diff --git a/lsteamclient/steamclient_main.c b/lsteamclient/steamclient_main.c index 9c1631da..514841d1 100644 --- a/lsteamclient/steamclient_main.c +++ b/lsteamclient/steamclient_main.c @@ -356,6 +356,10 @@ static void execute_pending_callbacks(void) TRACE( "CALL_CDECL_FUNC_DATA func %p, data %p.\n", params.callback->call_cdecl_func_data.pFunc, params.callback->call_cdecl_func_data.data ); params.callback->call_cdecl_func_data.pFunc( params.callback->call_cdecl_func_data.data ); break; + case CALL_STDCALL_FUNC_DATA: + TRACE( "CALL_STDCALL_FUNC_DATA func %p, data %p.\n", params.callback->call_stdcall_func_data.pFunc, params.callback->call_stdcall_func_data.data ); + params.callback->call_stdcall_func_data.pFunc( params.callback->call_stdcall_func_data.data ); + break; case CALL_IFACE_VTABLE_0: TRACE( "CALL_IFACE_VTABLE_0 iface %p, arg0 %#jx, arg1 %#jx, arg2 %#jx.\n", params.callback->call_iface_vtable.iface, params.callback->call_iface_vtable.arg0, params.callback->call_iface_vtable.arg1, params.callback->call_iface_vtable.arg2 ); diff --git a/lsteamclient/unix_private.h b/lsteamclient/unix_private.h index 150c801e..6f45791d 100644 --- a/lsteamclient/unix_private.h +++ b/lsteamclient/unix_private.h @@ -25,6 +25,8 @@ extern void queue_vtable_callback_0_rules_responded( struct w_steam_iface *w_ifa typedef void (*W_CDECL w_cdecl_func)( void * ); extern void queue_cdecl_func_callback( w_cdecl_func func, void *data, uint32_t data_size ); +typedef void (*W_STDCALL w_stdcall_func)( void * ); +extern void queue_stdcall_func_callback( w_stdcall_func func, void *data, uint32_t data_size ); extern uint32_t manual_convert_nNativeKeyCode( uint32_t win_vk ); diff --git a/lsteamclient/unix_steam_input_manual.cpp b/lsteamclient/unix_steam_input_manual.cpp index 2080810e..c1c56011 100644 --- a/lsteamclient/unix_steam_input_manual.cpp +++ b/lsteamclient/unix_steam_input_manual.cpp @@ -315,9 +315,9 @@ NTSTATUS ISteamInput_SteamInput002_GetGlyphForXboxOrigin( void *args ) /* ISteamInput_SteamInput005 */ static void (W_STDCALL *w_EnableActionEventCallbacks_152)( SteamInputActionEvent_t * ); -static void u_SteamInputActionEventCallbackPointer_152( SteamInputActionEvent_t *dat ) +static void U_STDCALL u_SteamInputActionEventCallbackPointer_152( SteamInputActionEvent_t *dat ) { - if (w_EnableActionEventCallbacks_152) w_EnableActionEventCallbacks_152( dat ); + if (w_EnableActionEventCallbacks_152) queue_stdcall_func_callback( (w_stdcall_func)w_EnableActionEventCallbacks_152, dat, sizeof(*dat) ); } NTSTATUS ISteamInput_SteamInput005_EnableActionEventCallbacks( void *args ) diff --git a/lsteamclient/unixlib.cpp b/lsteamclient/unixlib.cpp index 34f82624..dd057d83 100644 --- a/lsteamclient/unixlib.cpp +++ b/lsteamclient/unixlib.cpp @@ -123,6 +123,26 @@ void queue_cdecl_func_callback( w_cdecl_func func, void *data, uint32_t data_siz pthread_mutex_unlock( &callbacks_lock ); } +void queue_stdcall_func_callback( w_stdcall_func func, void *data, uint32_t data_size ) +{ + uint32_t size = data_size; + struct callback_entry *entry; + + size += sizeof(struct callback_entry); + if (!(entry = (struct callback_entry *)malloc( size ))) return; + + entry->callback.type = CALL_STDCALL_FUNC_DATA; + size -= offsetof( struct callback_entry, callback ); + entry->callback.size = size; + + entry->callback.call_stdcall_func_data.pFunc = func; + memcpy( (char *)entry->callback.call_stdcall_func_data.data, data, data_size ); + + pthread_mutex_lock( &callbacks_lock ); + list_add_tail( &callbacks, &entry->entry ); + pthread_mutex_unlock( &callbacks_lock ); +} + u_FSteamNetworkingSocketsDebugOutput manual_convert_SetDebugOutputFunction_pfnFunc( w_FSteamNetworkingSocketsDebugOutput w_func ) { w_steam_networking_socket_debug_output = w_func; diff --git a/lsteamclient/unixlib.h b/lsteamclient/unixlib.h index c3521006..6295c147 100644 --- a/lsteamclient/unixlib.h +++ b/lsteamclient/unixlib.h @@ -35,6 +35,7 @@ enum callback_type SOCKETS_DEBUG_OUTPUT = 1, WARNING_MESSAGE_HOOK, CALL_CDECL_FUNC_DATA, + CALL_STDCALL_FUNC_DATA, CALL_IFACE_VTABLE_0, CALL_IFACE_VTABLE_1, CALL_IFACE_VTABLE_2, @@ -69,6 +70,12 @@ struct callback unsigned char data[1]; } call_cdecl_func_data; + struct + { + void (*W_STDCALL pFunc)( void * ); + unsigned char data[1]; + } call_stdcall_func_data; + struct { struct w_steam_iface *iface;