lsteamclient: Copy the ServerResponded parameter for delayed callbacks.
CW-Bug-Id: #23272
This commit is contained in:
parent
24d5272316
commit
121cdab5fc
5 changed files with 38 additions and 4 deletions
|
@ -390,6 +390,12 @@ void execute_pending_callbacks(void)
|
|||
params.callback->call_iface_vtable.arg0, params.callback->call_iface_vtable.arg1, params.callback->call_iface_vtable.arg2) );
|
||||
break;
|
||||
|
||||
case CALL_IFACE_VTABLE_0_SERVER_RESPONDED:
|
||||
TRACE( "CALL_IFACE_VTABLE_0_SERVER_RESPONDED iface %p, server %p.\n", params.callback->server_responded.iface,
|
||||
params.callback->server_responded.server );
|
||||
CALL_VTBL_FUNC( params.callback->server_responded.iface, 0, void, (void *, gameserveritem_t_105 *), (params.callback->server_responded.iface,
|
||||
params.callback->server_responded.server) );
|
||||
break;
|
||||
case CALL_IFACE_VTABLE_0_ADD_PLAYER_TO_LIST:
|
||||
TRACE( "CALL_IFACE_VTABLE_0_ADD_PLAYER_TO_LIST iface %p, name %s, score %u, time_played %f.\n", params.callback->add_player_to_list.iface,
|
||||
params.callback->add_player_to_list.name, params.callback->add_player_to_list.score, params.callback->add_player_to_list.time_played );
|
||||
|
|
|
@ -22,6 +22,7 @@ extern "C"
|
|||
|
||||
struct w_steam_iface;
|
||||
extern void queue_vtable_callback( struct w_steam_iface *w_iface, enum callback_type type, uint64_t arg0, uint64_t arg1, uint64_t arg2 );
|
||||
extern void queue_vtable_callback_0_server_responded( struct w_steam_iface *w_iface, gameserveritem_t_105 *server );
|
||||
extern void queue_vtable_callback_0_add_player_to_list( struct w_steam_iface *w_iface, const char *pchName, int nScore, float flTimePlayed );
|
||||
extern void queue_vtable_callback_0_rules_responded( struct w_steam_iface *w_iface, const char *pchRule, const char *pchValue );
|
||||
|
||||
|
|
|
@ -672,7 +672,7 @@ struct SteamMatchmakingPingResponse : u_ISteamMatchmakingPingResponse
|
|||
|
||||
void SteamMatchmakingPingResponse::ServerResponded( gameserveritem_t_105 *server )
|
||||
{
|
||||
queue_vtable_callback( this->w_iface, CALL_IFACE_VTABLE_0, (intptr_t)server, 0, 0 );
|
||||
queue_vtable_callback_0_server_responded( this->w_iface, server );
|
||||
}
|
||||
|
||||
void SteamMatchmakingPingResponse::ServerFailedToRespond(void)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -40,6 +40,7 @@ enum callback_type
|
|||
CALL_IFACE_VTABLE_0,
|
||||
CALL_IFACE_VTABLE_1,
|
||||
CALL_IFACE_VTABLE_2,
|
||||
CALL_IFACE_VTABLE_0_SERVER_RESPONDED,
|
||||
CALL_IFACE_VTABLE_0_ADD_PLAYER_TO_LIST,
|
||||
CALL_IFACE_VTABLE_0_RULES_RESPONDED,
|
||||
};
|
||||
|
@ -79,6 +80,12 @@ struct callback
|
|||
uint64_t arg2;
|
||||
} call_iface_vtable;
|
||||
|
||||
struct
|
||||
{
|
||||
struct w_steam_iface *iface;
|
||||
gameserveritem_t_105 server[];
|
||||
} server_responded;
|
||||
|
||||
struct
|
||||
{
|
||||
struct w_steam_iface *iface;
|
||||
|
|
Loading…
Reference in a new issue