lsteamclient: Wrap SteamAPIWarningMessageHook_t callback.

CW-Bug-Id: #20813
This commit is contained in:
Paul Gofman 2022-06-14 17:54:51 -05:00 committed by Arkadiusz Hiler
parent 242d655a0f
commit bcd3d5218f
26 changed files with 64 additions and 1 deletions

View file

@ -112,6 +112,7 @@ void *cppISteamClient_SteamClient007_GetISteamNetworking(void *linux_side, HStea
void cppISteamClient_SteamClient007_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction) void cppISteamClient_SteamClient007_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction)
{ {
pFunction = (SteamAPIWarningMessageHook_t)manual_convert_SteamAPIWarningMessageHook_t((void*)pFunction);
((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction); ((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction);
} }

View file

@ -112,6 +112,7 @@ uint32 cppISteamClient_SteamClient008_GetIPCCallCount(void *linux_side)
void cppISteamClient_SteamClient008_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction) void cppISteamClient_SteamClient008_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction)
{ {
pFunction = (SteamAPIWarningMessageHook_t)manual_convert_SteamAPIWarningMessageHook_t((void*)pFunction);
((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction); ((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction);
} }

View file

@ -117,6 +117,7 @@ uint32 cppISteamClient_SteamClient009_GetIPCCallCount(void *linux_side)
void cppISteamClient_SteamClient009_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction) void cppISteamClient_SteamClient009_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction)
{ {
pFunction = (SteamAPIWarningMessageHook_t)manual_convert_SteamAPIWarningMessageHook_t((void*)pFunction);
((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction); ((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction);
} }

View file

@ -117,6 +117,7 @@ uint32 cppISteamClient_SteamClient010_GetIPCCallCount(void *linux_side)
void cppISteamClient_SteamClient010_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction) void cppISteamClient_SteamClient010_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction)
{ {
pFunction = (SteamAPIWarningMessageHook_t)manual_convert_SteamAPIWarningMessageHook_t((void*)pFunction);
((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction); ((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction);
} }

View file

@ -122,6 +122,7 @@ uint32 cppISteamClient_SteamClient011_GetIPCCallCount(void *linux_side)
void cppISteamClient_SteamClient011_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction) void cppISteamClient_SteamClient011_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction)
{ {
pFunction = (SteamAPIWarningMessageHook_t)manual_convert_SteamAPIWarningMessageHook_t((void*)pFunction);
((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction); ((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction);
} }

View file

@ -117,6 +117,7 @@ uint32 cppISteamClient_SteamClient012_GetIPCCallCount(void *linux_side)
void cppISteamClient_SteamClient012_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction) void cppISteamClient_SteamClient012_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction)
{ {
pFunction = (SteamAPIWarningMessageHook_t)manual_convert_SteamAPIWarningMessageHook_t((void*)pFunction);
((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction); ((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction);
} }

View file

@ -117,6 +117,7 @@ uint32 cppISteamClient_SteamClient013_GetIPCCallCount(void *linux_side)
void cppISteamClient_SteamClient013_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction) void cppISteamClient_SteamClient013_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction)
{ {
pFunction = (SteamAPIWarningMessageHook_t)manual_convert_SteamAPIWarningMessageHook_t((void*)pFunction);
((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction); ((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction);
} }

View file

@ -117,6 +117,7 @@ uint32 cppISteamClient_SteamClient014_GetIPCCallCount(void *linux_side)
void cppISteamClient_SteamClient014_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction) void cppISteamClient_SteamClient014_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction)
{ {
pFunction = (SteamAPIWarningMessageHook_t)manual_convert_SteamAPIWarningMessageHook_t((void*)pFunction);
((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction); ((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction);
} }

View file

@ -117,6 +117,7 @@ uint32 cppISteamClient_SteamClient015_GetIPCCallCount(void *linux_side)
void cppISteamClient_SteamClient015_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction) void cppISteamClient_SteamClient015_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction)
{ {
pFunction = (SteamAPIWarningMessageHook_t)manual_convert_SteamAPIWarningMessageHook_t((void*)pFunction);
((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction); ((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction);
} }

View file

@ -117,6 +117,7 @@ uint32 cppISteamClient_SteamClient016_GetIPCCallCount(void *linux_side)
void cppISteamClient_SteamClient016_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction) void cppISteamClient_SteamClient016_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction)
{ {
pFunction = (SteamAPIWarningMessageHook_t)manual_convert_SteamAPIWarningMessageHook_t((void*)pFunction);
((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction); ((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction);
} }

View file

@ -117,6 +117,7 @@ uint32 cppISteamClient_SteamClient017_GetIPCCallCount(void *linux_side)
void cppISteamClient_SteamClient017_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction) void cppISteamClient_SteamClient017_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction)
{ {
pFunction = (SteamAPIWarningMessageHook_t)manual_convert_SteamAPIWarningMessageHook_t((void*)pFunction);
((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction); ((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction);
} }

View file

@ -123,6 +123,7 @@ uint32 cppISteamClient_SteamClient018_GetIPCCallCount(void *linux_side)
void cppISteamClient_SteamClient018_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction) void cppISteamClient_SteamClient018_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction)
{ {
pFunction = (SteamAPIWarningMessageHook_t)manual_convert_SteamAPIWarningMessageHook_t((void*)pFunction);
((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction); ((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction);
} }

View file

@ -123,6 +123,7 @@ uint32 cppISteamClient_SteamClient019_GetIPCCallCount(void *linux_side)
void cppISteamClient_SteamClient019_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction) void cppISteamClient_SteamClient019_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction)
{ {
pFunction = (SteamAPIWarningMessageHook_t)manual_convert_SteamAPIWarningMessageHook_t((void*)pFunction);
((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction); ((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction);
} }

View file

@ -123,6 +123,7 @@ uint32 cppISteamClient_SteamClient020_GetIPCCallCount(void *linux_side)
void cppISteamClient_SteamClient020_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction) void cppISteamClient_SteamClient020_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction)
{ {
pFunction = (SteamAPIWarningMessageHook_t)manual_convert_SteamAPIWarningMessageHook_t((void*)pFunction);
((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction); ((ISteamClient*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction);
} }

View file

@ -92,6 +92,7 @@ uint32 cppISteamUtils_SteamUtils004_GetIPCCallCount(void *linux_side)
void cppISteamUtils_SteamUtils004_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction) void cppISteamUtils_SteamUtils004_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction)
{ {
pFunction = (SteamAPIWarningMessageHook_t)manual_convert_SteamAPIWarningMessageHook_t((void*)pFunction);
((ISteamUtils*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction); ((ISteamUtils*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction);
} }

View file

@ -92,6 +92,7 @@ uint32 cppISteamUtils_SteamUtils005_GetIPCCallCount(void *linux_side)
void cppISteamUtils_SteamUtils005_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction) void cppISteamUtils_SteamUtils005_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction)
{ {
pFunction = (SteamAPIWarningMessageHook_t)manual_convert_SteamAPIWarningMessageHook_t((void*)pFunction);
((ISteamUtils*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction); ((ISteamUtils*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction);
} }

View file

@ -92,6 +92,7 @@ uint32 cppISteamUtils_SteamUtils006_GetIPCCallCount(void *linux_side)
void cppISteamUtils_SteamUtils006_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction) void cppISteamUtils_SteamUtils006_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction)
{ {
pFunction = (SteamAPIWarningMessageHook_t)manual_convert_SteamAPIWarningMessageHook_t((void*)pFunction);
((ISteamUtils*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction); ((ISteamUtils*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction);
} }

View file

@ -92,6 +92,7 @@ uint32 cppISteamUtils_SteamUtils007_GetIPCCallCount(void *linux_side)
void cppISteamUtils_SteamUtils007_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction) void cppISteamUtils_SteamUtils007_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction)
{ {
pFunction = (SteamAPIWarningMessageHook_t)manual_convert_SteamAPIWarningMessageHook_t((void*)pFunction);
((ISteamUtils*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction); ((ISteamUtils*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction);
} }

View file

@ -92,6 +92,7 @@ uint32 cppISteamUtils_SteamUtils008_GetIPCCallCount(void *linux_side)
void cppISteamUtils_SteamUtils008_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction) void cppISteamUtils_SteamUtils008_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction)
{ {
pFunction = (SteamAPIWarningMessageHook_t)manual_convert_SteamAPIWarningMessageHook_t((void*)pFunction);
((ISteamUtils*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction); ((ISteamUtils*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction);
} }

View file

@ -93,6 +93,7 @@ uint32 cppISteamUtils_SteamUtils009_GetIPCCallCount(void *linux_side)
void cppISteamUtils_SteamUtils009_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction) void cppISteamUtils_SteamUtils009_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction)
{ {
pFunction = (SteamAPIWarningMessageHook_t)manual_convert_SteamAPIWarningMessageHook_t((void*)pFunction);
((ISteamUtils*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction); ((ISteamUtils*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction);
} }

View file

@ -93,6 +93,7 @@ uint32 cppISteamUtils_SteamUtils010_GetIPCCallCount(void *linux_side)
void cppISteamUtils_SteamUtils010_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction) void cppISteamUtils_SteamUtils010_SetWarningMessageHook(void *linux_side, SteamAPIWarningMessageHook_t pFunction)
{ {
pFunction = (SteamAPIWarningMessageHook_t)manual_convert_SteamAPIWarningMessageHook_t((void*)pFunction);
((ISteamUtils*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction); ((ISteamUtils*)linux_side)->SetWarningMessageHook((SteamAPIWarningMessageHook_t)pFunction);
} }

View file

@ -245,6 +245,7 @@ def method_needs_manual_handling(interface_with_version, method_name):
# manual converters for simple types (function pointers) # manual converters for simple types (function pointers)
manual_type_converters = [ manual_type_converters = [
"FSteamNetworkingSocketsDebugOutput", "FSteamNetworkingSocketsDebugOutput",
"SteamAPIWarningMessageHook_t",
"SteamAPI_CheckCallbackRegistered_t" "SteamAPI_CheckCallbackRegistered_t"
] ]

View file

@ -235,7 +235,7 @@ typedef struct SteamNetConnectionRealTimeLaneStatus_t SteamNetConnectionRealTime
typedef struct SteamNetworkingFakeIPResult_t SteamNetworkingFakeIPResult_t; typedef struct SteamNetworkingFakeIPResult_t SteamNetworkingFakeIPResult_t;
typedef uint32 (*SteamAPI_CheckCallbackRegistered_t)(int cb); typedef uint32 (*SteamAPI_CheckCallbackRegistered_t)(int cb);
typedef void *SteamAPIWarningMessageHook_t; //already cdecl, no need for conversion(?) typedef void *SteamAPIWarningMessageHook_t;
typedef void *SteamAPI_PostAPIResultInProcess_t; //unused typedef void *SteamAPI_PostAPIResultInProcess_t; //unused
typedef void (*FSteamNetworkingSocketsDebugOutput)(ESteamNetworkingSocketsDebugOutputType nType, const char *pszMsg); typedef void (*FSteamNetworkingSocketsDebugOutput)(ESteamNetworkingSocketsDebugOutputType nType, const char *pszMsg);

View file

@ -692,6 +692,7 @@ static void callback_complete(UINT64 cookie)
typedef void (WINAPI *win_FSteamNetworkingSocketsDebugOutput)(ESteamNetworkingSocketsDebugOutputType nType, typedef void (WINAPI *win_FSteamNetworkingSocketsDebugOutput)(ESteamNetworkingSocketsDebugOutputType nType,
const char *pszMsg); const char *pszMsg);
typedef void (CDECL *win_SteamAPIWarningMessageHook_t)(int, const char *pszMsg);
static DWORD WINAPI callback_thread(void *dummy) static DWORD WINAPI callback_thread(void *dummy)
{ {
@ -710,6 +711,15 @@ static DWORD WINAPI callback_thread(void *dummy)
cb_data.sockets_debug_output.msg); cb_data.sockets_debug_output.msg);
callback_complete(cookie); callback_complete(cookie);
break; break;
case STEAM_API_WARNING_HOOK:
TRACE("STEAM_API_WARNING_HOOK func %p, type %u, msg %s.\n",
cb_data.func, cb_data.steam_api_warning_hook.severity,
wine_dbgstr_a(cb_data.steam_api_warning_hook.msg));
((win_SteamAPIWarningMessageHook_t)cb_data.func)(cb_data.steam_api_warning_hook.severity,
cb_data.steam_api_warning_hook.msg);
callback_complete(cookie);
break;
default: default:
ERR("Unexpected callback type %u.\n", cb_data.type); ERR("Unexpected callback type %u.\n", cb_data.type);
break; break;

View file

@ -59,6 +59,7 @@ void *create_LinuxISteamMatchmakingServerListResponse(void *win, const char *ver
void *create_LinuxISteamMatchmakingPingResponse(void *win, const char *version); void *create_LinuxISteamMatchmakingPingResponse(void *win, const char *version);
void *create_LinuxISteamMatchmakingPlayersResponse(void *win, const char *version); void *create_LinuxISteamMatchmakingPlayersResponse(void *win, const char *version);
void *create_LinuxISteamMatchmakingRulesResponse(void *win, const char *version); void *create_LinuxISteamMatchmakingRulesResponse(void *win, const char *version);
void *manual_convert_SteamAPIWarningMessageHook_t(void *win_func);
void *manual_convert_FSteamNetworkingSocketsDebugOutput(void *win_func); void *manual_convert_FSteamNetworkingSocketsDebugOutput(void *win_func);
void *manual_convert_SteamAPI_CheckCallbackRegistered_t(void *win_func); void *manual_convert_SteamAPI_CheckCallbackRegistered_t(void *win_func);
@ -73,6 +74,7 @@ void *alloc_vtable(void *vtable, unsigned int method_count, const char *iface_ve
enum callback_type enum callback_type
{ {
SOCKET_DEBUG_OUTPUT = 1, SOCKET_DEBUG_OUTPUT = 1,
STEAM_API_WARNING_HOOK,
}; };
struct callback_data struct callback_data
@ -88,6 +90,12 @@ struct callback_data
const char *msg; const char *msg;
} }
sockets_debug_output; sockets_debug_output;
struct
{
int severity;
const char *msg;
}
steam_api_warning_hook;
}; };
}; };

View file

@ -315,6 +315,29 @@ void *manual_convert_FSteamNetworkingSocketsDebugOutput(void *win_func)
} }
static void *stored_SteamAPIWarningMessageHook_t;
static void lin_SteamAPIWarningMessageHook_t(int severity, const char *msg)
{
struct callback_data cb_data = { 0 };
/* Only Unix native calls from here (not even TRACE):
* this is native Unix thread which is not initialized by Wine. */
cb_data.type = STEAM_API_WARNING_HOOK;
cb_data.func = stored_SteamAPIWarningMessageHook_t;
cb_data.steam_api_warning_hook.severity = severity;
cb_data.steam_api_warning_hook.msg = msg;
execute_callback(&cb_data);
}
void *manual_convert_SteamAPIWarningMessageHook_t(void *win_func)
{
TRACE("win_func %p, returning %p.\n", win_func, lin_SteamAPIWarningMessageHook_t);
stored_SteamAPIWarningMessageHook_t = win_func;
return &lin_SteamAPIWarningMessageHook_t;
}
/***** SteamAPI_CheckCallbackRegistered_t *****/ /***** SteamAPI_CheckCallbackRegistered_t *****/
static uint32 (__attribute__((ms_abi)) *stored_SteamAPI_CheckCallbackRegistered_t)(int cb); static uint32 (__attribute__((ms_abi)) *stored_SteamAPI_CheckCallbackRegistered_t)(int cb);