mirror of
https://github.com/ValveSoftware/Proton.git
synced 2025-01-14 15:48:11 +03:00
lsteamclient: wrap FSteamNetworkingSocketsDebugOutput
This commit is contained in:
parent
aa4c6fcc22
commit
197f25db04
@ -71,6 +71,7 @@ SteamNetworkingMicroseconds cppISteamNetworkingUtils_SteamNetworkingUtils001_Get
|
||||
|
||||
void cppISteamNetworkingUtils_SteamNetworkingUtils001_SetDebugOutputFunction(void *linux_side, ESteamNetworkingSocketsDebugOutputType eDetailLevel, FSteamNetworkingSocketsDebugOutput pfnFunc)
|
||||
{
|
||||
pfnFunc = (FSteamNetworkingSocketsDebugOutput)manual_convert_FSteamNetworkingSocketsDebugOutput((void*)pfnFunc);
|
||||
((ISteamNetworkingUtils*)linux_side)->SetDebugOutputFunction((ESteamNetworkingSocketsDebugOutputType)eDetailLevel, (FSteamNetworkingSocketsDebugOutput)pfnFunc);
|
||||
}
|
||||
|
||||
|
@ -169,6 +169,11 @@ manually_handled_structs = [
|
||||
"SteamNetworkingMessage_t"
|
||||
]
|
||||
|
||||
# manual converters for simple types (function pointers)
|
||||
manual_type_converters = [
|
||||
"FSteamNetworkingSocketsDebugOutput"
|
||||
]
|
||||
|
||||
#struct_conversion_cache = {
|
||||
# '142': {
|
||||
# 'SteamUGCDetails_t': True,
|
||||
@ -467,6 +472,7 @@ def handle_method(cfile, classname, winclassname, cppname, method, cpp, cpp_h, e
|
||||
cfile.write(", %s *_r" % method.result_type.spelling)
|
||||
unnamed = 'a'
|
||||
need_convert = []
|
||||
manual_convert = []
|
||||
for param in list(method.get_children()):
|
||||
if param.kind == clang.cindex.CursorKind.PARM_DECL:
|
||||
if param.type.kind == clang.cindex.TypeKind.POINTER and \
|
||||
@ -486,6 +492,8 @@ def handle_method(cfile, classname, winclassname, cppname, method, cpp, cpp_h, e
|
||||
need_convert.append(param)
|
||||
#preserve pointers
|
||||
win_name = typename.replace(real_type.spelling, "win%s_%s" % (real_type.spelling, sdkver))
|
||||
elif real_type.spelling in manual_type_converters:
|
||||
manual_convert.append(param)
|
||||
|
||||
if param.spelling == "":
|
||||
cfile.write(", %s _%s" % (win_name, unnamed))
|
||||
@ -532,6 +540,8 @@ def handle_method(cfile, classname, winclassname, cppname, method, cpp, cpp_h, e
|
||||
#raw structs
|
||||
cpp.write(" %s lin_%s;\n" % (param.type.spelling, param.spelling))
|
||||
cpp.write(" win_to_lin_struct_%s_%s(&%s, &lin_%s);\n" % (param.type.spelling, sdkver, param.spelling, param.spelling))
|
||||
for param in manual_convert:
|
||||
cpp.write(" %s = (%s)manual_convert_%s((void*)%s);\n" % (param.spelling, param.type.spelling, param.type.spelling, param.spelling))
|
||||
|
||||
cfile.write(" TRACE(\"%p\\n\", _this);\n")
|
||||
|
||||
|
@ -209,7 +209,8 @@ typedef struct SteamDatagramHostedAddress SteamDatagramHostedAddress;
|
||||
typedef void *SteamAPI_CheckCallbackRegistered_t;
|
||||
typedef void *SteamAPIWarningMessageHook_t;
|
||||
typedef void *SteamAPI_PostAPIResultInProcess_t;
|
||||
typedef void *FSteamNetworkingSocketsDebugOutput; /* XXX */
|
||||
|
||||
typedef void (*FSteamNetworkingSocketsDebugOutput)(ESteamNetworkingSocketsDebugOutputType nType, const char *pszMsg);
|
||||
|
||||
typedef uint8 Salt_t[8];
|
||||
typedef uint64 GID_t;
|
||||
|
@ -46,6 +46,7 @@ void *create_LinuxISteamMatchmakingServerListResponse(void *win, const char *ver
|
||||
void *create_LinuxISteamMatchmakingPingResponse(void *win, const char *version);
|
||||
void *create_LinuxISteamMatchmakingPlayersResponse(void *win, const char *version);
|
||||
void *create_LinuxISteamMatchmakingRulesResponse(void *win, const char *version);
|
||||
void *manual_convert_FSteamNetworkingSocketsDebugOutput(void *win_func);
|
||||
|
||||
extern char g_tmppath[PATH_MAX];
|
||||
|
||||
|
@ -280,3 +280,18 @@ void *create_LinuxISteamMatchmakingRulesResponse(void *win, const char *version)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/***** FSteamNetworkingSocketsDebugOutput *****/
|
||||
static void (CDECL *stored_FSteamNetworkingSocketsDebugOutput)(ESteamNetworkingSocketsDebugOutputType nType, const char *pszMsg);
|
||||
|
||||
static void lin_FSteamNetworkingSocketsDebugOutput(ESteamNetworkingSocketsDebugOutputType nType, const char *pszMsg)
|
||||
{
|
||||
stored_FSteamNetworkingSocketsDebugOutput(nType, pszMsg);
|
||||
}
|
||||
|
||||
void *manual_convert_FSteamNetworkingSocketsDebugOutput(void *win_func)
|
||||
{
|
||||
stored_FSteamNetworkingSocketsDebugOutput = (void*)win_func;
|
||||
return &lin_FSteamNetworkingSocketsDebugOutput;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user