lsteamclient: Queue callback for input EnableActionEventCallbacks functions.

CW-Bug-Id: #22729
This commit is contained in:
Rémi Bernon 2023-10-03 11:01:47 +02:00 committed by Arkadiusz Hiler
parent 6a7dbe6160
commit 98a90a1458
5 changed files with 35 additions and 2 deletions

View file

@ -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 );

View file

@ -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 );

View file

@ -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 )

View file

@ -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;

View file

@ -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;