lsteamclient: Copy the ServerResponded parameter for delayed callbacks.

CW-Bug-Id: #23272
This commit is contained in:
Rémi Bernon 2024-01-19 11:40:09 +01:00 committed by Arkadiusz Hiler
parent 24d5272316
commit 121cdab5fc
5 changed files with 38 additions and 4 deletions

View file

@ -24,7 +24,7 @@ struct callback_entry
static struct list callbacks = LIST_INIT( callbacks );
static pthread_mutex_t callbacks_lock = PTHREAD_MUTEX_INITIALIZER;
extern void queue_vtable_callback( struct w_steam_iface *w_iface, enum callback_type type, uint64_t arg0, uint64_t arg1, uint64_t arg2 )
void queue_vtable_callback( struct w_steam_iface *w_iface, enum callback_type type, uint64_t arg0, uint64_t arg1, uint64_t arg2 )
{
struct callback_entry *entry;
uint32_t size = 0;
@ -46,7 +46,27 @@ extern void queue_vtable_callback( struct w_steam_iface *w_iface, enum callback_
pthread_mutex_unlock( &callbacks_lock );
}
extern void queue_vtable_callback_0_add_player_to_list( struct w_steam_iface *w_iface, const char *pchName, int nScore, float flTimePlayed )
void queue_vtable_callback_0_server_responded( struct w_steam_iface *w_iface, gameserveritem_t_105 *server )
{
uint32_t size = sizeof(*server);
struct callback_entry *entry;
size += sizeof(struct callback_entry);
if (!(entry = (struct callback_entry *)malloc( size ))) return;
entry->callback.type = CALL_IFACE_VTABLE_0_SERVER_RESPONDED;
size -= offsetof( struct callback_entry, callback );
entry->callback.size = size;
entry->callback.server_responded.iface = w_iface;
entry->callback.server_responded.server[0] = *server;
pthread_mutex_lock( &callbacks_lock );
list_add_tail( &callbacks, &entry->entry );
pthread_mutex_unlock( &callbacks_lock );
}
void queue_vtable_callback_0_add_player_to_list( struct w_steam_iface *w_iface, const char *pchName, int nScore, float flTimePlayed )
{
uint32_t name_size = strlen( pchName ) + 1, size = name_size;
struct callback_entry *entry;
@ -68,7 +88,7 @@ extern void queue_vtable_callback_0_add_player_to_list( struct w_steam_iface *w_
pthread_mutex_unlock( &callbacks_lock );
}
extern void queue_vtable_callback_0_rules_responded( struct w_steam_iface *w_iface, const char *pchRule, const char *pchValue )
void queue_vtable_callback_0_rules_responded( struct w_steam_iface *w_iface, const char *pchRule, const char *pchValue )
{
uint32_t rule_size = strlen( pchRule ) + 1, value_size = strlen( pchValue ) + 1, size = rule_size + value_size;
struct callback_entry *entry;