lsteamclient: Use unixlib interface for C API functions.
CW-Bug-Id: #22729
This commit is contained in:
parent
4e8556ae62
commit
cf89fdf018
9 changed files with 329 additions and 105 deletions
|
@ -200,6 +200,23 @@ MANUAL_STRUCTS = [
|
|||
"SteamNetworkingMessage_t"
|
||||
]
|
||||
|
||||
UNIX_FUNCS = [
|
||||
'steamclient_init',
|
||||
'steamclient_next_callback',
|
||||
'steamclient_CreateInterface',
|
||||
'steamclient_Steam_GetAPICallResult',
|
||||
'steamclient_Steam_BGetCallback',
|
||||
'steamclient_callback_message_receive',
|
||||
'steamclient_Steam_FreeLastCallback',
|
||||
'steamclient_Steam_ReleaseThreadLocalMemory',
|
||||
'steamclient_Steam_IsKnownInterface',
|
||||
'steamclient_Steam_NotifyMissingInterface',
|
||||
'steamclient_networking_messages_receive_144',
|
||||
'steamclient_networking_messages_receive_147',
|
||||
'steamclient_networking_messages_receive_153a',
|
||||
'steamclient_networking_message_release_147',
|
||||
'steamclient_networking_message_release_153a',
|
||||
]
|
||||
|
||||
MANUAL_METHODS = {
|
||||
#TODO: 001 005 007
|
||||
|
@ -1497,6 +1514,8 @@ with open(u"unixlib_generated.h", "w") as file:
|
|||
|
||||
out(u'enum unix_funcs\n')
|
||||
out(u'{\n')
|
||||
for func in UNIX_FUNCS:
|
||||
out(f' unix_{func},\n')
|
||||
for klass, method in all_methods:
|
||||
sdkver = klass._sdkver
|
||||
if type(method) is Destructor:
|
||||
|
@ -1518,6 +1537,8 @@ with open('unixlib_generated.cpp', 'w') as file:
|
|||
|
||||
out(u'extern "C" const unixlib_entry_t __wine_unix_call_funcs[] =\n')
|
||||
out(u'{\n')
|
||||
for func in UNIX_FUNCS:
|
||||
out(f' {func},\n')
|
||||
for klass, method in all_methods:
|
||||
sdkver = klass._sdkver
|
||||
if type(method) is Destructor:
|
||||
|
|
|
@ -92,8 +92,9 @@ static bool networking_message_pool_receive_144( int32_t capacity, int32_t count
|
|||
|
||||
if (count > 0)
|
||||
{
|
||||
struct steamclient_networking_messages_receive_144_params params = {.count = count, .w_msgs = messages};
|
||||
if (!networking_message_pool_alloc_data( count, pool )) return false;
|
||||
unix_networking_messages_receive_144( count, messages );
|
||||
STEAMCLIENT_CALL( steamclient_networking_messages_receive_144, ¶ms );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -117,7 +118,8 @@ static void W_STDCALL w_SteamNetworkingMessage_t_147_Release( w_SteamNetworkingM
|
|||
if (message->pool) networking_message_pool_release( message->pool );
|
||||
else
|
||||
{
|
||||
unix_networking_message_release_147( msg );
|
||||
struct steamclient_networking_message_release_147_params params = {.w_msg = msg};
|
||||
STEAMCLIENT_CALL( steamclient_networking_message_release_147, ¶ms );
|
||||
HeapFree( GetProcessHeap(), 0, message );
|
||||
}
|
||||
}
|
||||
|
@ -158,8 +160,9 @@ static bool networking_message_pool_receive_147( uint32_t capacity, uint32_t cou
|
|||
|
||||
if (count)
|
||||
{
|
||||
struct steamclient_networking_messages_receive_147_params params = {.count = count, .w_msgs = messages};
|
||||
if (!networking_message_pool_alloc_data( count, pool )) return false;
|
||||
unix_networking_messages_receive_147( count, messages );
|
||||
STEAMCLIENT_CALL( steamclient_networking_messages_receive_147, ¶ms );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -183,7 +186,8 @@ static void W_STDCALL w_SteamNetworkingMessage_t_153a_Release( w_SteamNetworking
|
|||
if (message->pool) networking_message_pool_release( message->pool );
|
||||
else
|
||||
{
|
||||
unix_networking_message_release_153a( msg );
|
||||
struct steamclient_networking_message_release_153a_params params = {.w_msg = msg};
|
||||
STEAMCLIENT_CALL( steamclient_networking_message_release_153a, ¶ms );
|
||||
HeapFree( GetProcessHeap(), 0, message );
|
||||
}
|
||||
}
|
||||
|
@ -224,8 +228,9 @@ static bool networking_message_pool_receive_153a( uint32_t capacity, uint32_t co
|
|||
|
||||
if (count)
|
||||
{
|
||||
struct steamclient_networking_messages_receive_153a_params params = {.count = count, .w_msgs = messages};
|
||||
if (!networking_message_pool_alloc_data( count, pool )) return false;
|
||||
unix_networking_messages_receive_153a( count, messages );
|
||||
STEAMCLIENT_CALL( steamclient_networking_messages_receive_153a, ¶ms );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -477,48 +477,51 @@ static int load_steamclient(void)
|
|||
else
|
||||
params.ignore_child_processes = ignore_child_processes;
|
||||
|
||||
if (!unix_steamclient_init( ¶ms )) return 0;
|
||||
if (STEAMCLIENT_CALL( steamclient_init, ¶ms )) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void *CDECL CreateInterface(const char *name, int *return_code)
|
||||
{
|
||||
struct steamclient_CreateInterface_params params = {.name = name, .return_code = return_code};
|
||||
|
||||
TRACE("name: %s, return_code: %p\n", name, return_code);
|
||||
if (!load_steamclient()) return NULL;
|
||||
return create_win_interface( name, unix_CreateInterface( name, return_code ) );
|
||||
if (STEAMCLIENT_CALL( steamclient_CreateInterface, ¶ms )) return NULL;
|
||||
return create_win_interface( name, params._ret );
|
||||
}
|
||||
|
||||
static void execute_pending_callbacks(void)
|
||||
{
|
||||
struct callback *callback = NULL;
|
||||
uint32_t callback_size = 0;
|
||||
struct steamclient_next_callback_params params = {0};
|
||||
|
||||
while (unix_steamclient_next_callback( callback, &callback_size ))
|
||||
while (!STEAMCLIENT_CALL( steamclient_next_callback, ¶ms ) && params._ret)
|
||||
{
|
||||
if (!callback || callback_size > callback->size)
|
||||
callback = realloc( callback, callback_size );
|
||||
else switch (callback->type)
|
||||
if (!params.callback || params.size > params.callback->size)
|
||||
params.callback = realloc( params.callback, params.size );
|
||||
else switch (params.callback->type)
|
||||
{
|
||||
case SOCKETS_DEBUG_OUTPUT:
|
||||
TRACE( "SOCKETS_DEBUG_OUTPUT func %p, type %u, msg %s.\n", callback->sockets_debug_output.pfnFunc,
|
||||
callback->sockets_debug_output.type, wine_dbgstr_a( callback->sockets_debug_output.msg ) );
|
||||
callback->sockets_debug_output.pfnFunc( callback->sockets_debug_output.type, callback->sockets_debug_output.msg );
|
||||
TRACE( "SOCKETS_DEBUG_OUTPUT func %p, type %u, msg %s.\n", params.callback->sockets_debug_output.pfnFunc,
|
||||
params.callback->sockets_debug_output.type, wine_dbgstr_a( params.callback->sockets_debug_output.msg ) );
|
||||
params.callback->sockets_debug_output.pfnFunc( params.callback->sockets_debug_output.type, params.callback->sockets_debug_output.msg );
|
||||
break;
|
||||
case WARNING_MESSAGE_HOOK:
|
||||
TRACE( "WARNING_MESSAGE_HOOK func %p, severity %d, msg %s.\n", callback->warning_message_hook.pFunction,
|
||||
callback->warning_message_hook.severity, wine_dbgstr_a( callback->warning_message_hook.msg ) );
|
||||
callback->warning_message_hook.pFunction( callback->warning_message_hook.severity, callback->warning_message_hook.msg );
|
||||
TRACE( "WARNING_MESSAGE_HOOK func %p, severity %d, msg %s.\n", params.callback->warning_message_hook.pFunction,
|
||||
params.callback->warning_message_hook.severity, wine_dbgstr_a( params.callback->warning_message_hook.msg ) );
|
||||
params.callback->warning_message_hook.pFunction( params.callback->warning_message_hook.severity, params.callback->warning_message_hook.msg );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
free( callback );
|
||||
free( params.callback );
|
||||
}
|
||||
|
||||
static void *last_callback_data;
|
||||
|
||||
bool CDECL Steam_FreeLastCallback( int32_t pipe )
|
||||
{
|
||||
struct steamclient_Steam_FreeLastCallback_params params = {.pipe = pipe};
|
||||
TRACE( "%u\n", pipe );
|
||||
|
||||
if (!load_steamclient()) return 0;
|
||||
|
@ -526,13 +529,25 @@ bool CDECL Steam_FreeLastCallback( int32_t pipe )
|
|||
HeapFree( GetProcessHeap(), 0, last_callback_data );
|
||||
last_callback_data = NULL;
|
||||
|
||||
return unix_Steam_FreeLastCallback( pipe );
|
||||
STEAMCLIENT_CALL( steamclient_Steam_FreeLastCallback, ¶ms );
|
||||
return params._ret;
|
||||
}
|
||||
|
||||
bool CDECL Steam_BGetCallback( int32_t pipe, w_CallbackMsg_t *win_msg, int32_t *ignored )
|
||||
{
|
||||
u_CallbackMsg_t u_msg;
|
||||
bool ret;
|
||||
struct steamclient_Steam_BGetCallback_params params =
|
||||
{
|
||||
.pipe = pipe,
|
||||
.w_msg = win_msg,
|
||||
.ignored = ignored,
|
||||
.u_msg = &u_msg,
|
||||
};
|
||||
struct steamclient_callback_message_receive_params receive_params =
|
||||
{
|
||||
.u_msg = &u_msg,
|
||||
.w_msg = win_msg,
|
||||
};
|
||||
|
||||
TRACE("%u, %p, %p\n", pipe, win_msg, ignored);
|
||||
|
||||
|
@ -541,11 +556,12 @@ bool CDECL Steam_BGetCallback( int32_t pipe, w_CallbackMsg_t *win_msg, int32_t *
|
|||
execute_pending_callbacks();
|
||||
|
||||
next_event:
|
||||
if (!(ret = unix_Steam_BGetCallback( pipe, win_msg, ignored, &u_msg ))) return FALSE;
|
||||
STEAMCLIENT_CALL( steamclient_Steam_BGetCallback, ¶ms );
|
||||
if (!params._ret) return FALSE;
|
||||
|
||||
if (!(win_msg->m_pubParam = HeapAlloc( GetProcessHeap(), 0, win_msg->m_cubParam ))) return FALSE;
|
||||
last_callback_data = win_msg->m_pubParam;
|
||||
unix_callback_message_receive( &u_msg, win_msg );
|
||||
STEAMCLIENT_CALL( steamclient_callback_message_receive, &receive_params );
|
||||
|
||||
if (win_msg->m_iCallback == 0x14b) /* GameOverlayActivated_t::k_iCallback */
|
||||
{
|
||||
|
@ -572,24 +588,37 @@ next_event:
|
|||
}
|
||||
|
||||
execute_pending_callbacks();
|
||||
return ret;
|
||||
return params._ret;
|
||||
}
|
||||
|
||||
bool CDECL Steam_GetAPICallResult( int32_t pipe, uint64_t call, void *w_callback,
|
||||
int w_callback_len, int id, bool *failed )
|
||||
{
|
||||
struct steamclient_Steam_GetAPICallResult_params params =
|
||||
{
|
||||
.pipe = pipe,
|
||||
.call = call,
|
||||
.w_callback = w_callback,
|
||||
.w_callback_len = w_callback_len,
|
||||
.id = id,
|
||||
.failed = failed,
|
||||
};
|
||||
|
||||
TRACE( "%u, x, %p, %u, %u, %p\n", pipe, w_callback, w_callback_len, id, failed );
|
||||
|
||||
if (!load_steamclient()) return FALSE;
|
||||
return unix_Steam_GetAPICallResult( pipe, call, w_callback, w_callback_len, id, failed );
|
||||
STEAMCLIENT_CALL( steamclient_Steam_GetAPICallResult, ¶ms );
|
||||
return params._ret;
|
||||
}
|
||||
|
||||
void CDECL Steam_ReleaseThreadLocalMemory(int bThreadExit)
|
||||
{
|
||||
struct steamclient_Steam_ReleaseThreadLocalMemory_params params = {.thread_exit = bThreadExit};
|
||||
TRACE("%d\n", bThreadExit);
|
||||
|
||||
if (!load_steamclient()) return;
|
||||
unix_Steam_ReleaseThreadLocalMemory( bThreadExit );
|
||||
|
||||
STEAMCLIENT_CALL( steamclient_Steam_ReleaseThreadLocalMemory, ¶ms );
|
||||
}
|
||||
|
||||
void CDECL Breakpad_SteamMiniDumpInit( uint32_t a, const char *b, const char *c )
|
||||
|
@ -621,14 +650,17 @@ void CDECL Breakpad_SteamWriteMiniDumpUsingExceptionInfoWithBuildId(int a, int b
|
|||
|
||||
bool CDECL Steam_IsKnownInterface( const char *pchVersion )
|
||||
{
|
||||
struct steamclient_Steam_IsKnownInterface_params params = {.version = pchVersion};
|
||||
TRACE("%s\n", pchVersion);
|
||||
load_steamclient();
|
||||
return unix_Steam_IsKnownInterface( pchVersion );
|
||||
STEAMCLIENT_CALL( steamclient_Steam_IsKnownInterface, ¶ms );
|
||||
return params._ret;
|
||||
}
|
||||
|
||||
void CDECL Steam_NotifyMissingInterface( int32_t hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
struct steamclient_Steam_NotifyMissingInterface_params params = {.pipe = hSteamPipe, .version = pchVersion};
|
||||
TRACE("%u %s\n", hSteamPipe, pchVersion);
|
||||
load_steamclient();
|
||||
unix_Steam_NotifyMissingInterface( hSteamPipe, pchVersion );
|
||||
STEAMCLIENT_CALL( steamclient_Steam_NotifyMissingInterface, ¶ms );
|
||||
}
|
||||
|
|
|
@ -62,6 +62,22 @@ extern void queue_sockets_debug_output( void (*W_STDCALL pfnFunc)( uint32_t, con
|
|||
extern void queue_warning_message_hook( void (*W_CDECL pFunction)( int32_t, const char * ),
|
||||
int32_t severity, const char *msg );
|
||||
|
||||
extern NTSTATUS steamclient_init( void * );
|
||||
extern NTSTATUS steamclient_next_callback( void * );
|
||||
extern NTSTATUS steamclient_CreateInterface( void * );
|
||||
extern NTSTATUS steamclient_Steam_GetAPICallResult( void * );
|
||||
extern NTSTATUS steamclient_Steam_BGetCallback( void * );
|
||||
extern NTSTATUS steamclient_callback_message_receive( void * );
|
||||
extern NTSTATUS steamclient_Steam_FreeLastCallback( void * );
|
||||
extern NTSTATUS steamclient_Steam_ReleaseThreadLocalMemory( void * );
|
||||
extern NTSTATUS steamclient_Steam_IsKnownInterface( void * );
|
||||
extern NTSTATUS steamclient_Steam_NotifyMissingInterface( void * );
|
||||
extern NTSTATUS steamclient_networking_messages_receive_144( void * );
|
||||
extern NTSTATUS steamclient_networking_messages_receive_147( void * );
|
||||
extern NTSTATUS steamclient_networking_messages_receive_153a( void * );
|
||||
extern NTSTATUS steamclient_networking_message_release_147( void * );
|
||||
extern NTSTATUS steamclient_networking_message_release_153a( void * );
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif /* __cplusplus */
|
||||
|
|
|
@ -24,13 +24,14 @@ static void receive_messages_utow_144( uint32_t count, u_SteamNetworkingMessage_
|
|||
}
|
||||
}
|
||||
|
||||
void unix_networking_messages_receive_144( uint32_t count, w_SteamNetworkingMessage_t_144 **w_msgs )
|
||||
NTSTATUS steamclient_networking_messages_receive_144( void *args )
|
||||
{
|
||||
struct steamclient_networking_messages_receive_144_params *params = (struct steamclient_networking_messages_receive_144_params *)args;
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
for (i = 0; i < params->count; i++)
|
||||
{
|
||||
struct networking_message *message = CONTAINING_RECORD( w_msgs[i], struct networking_message, w_msg_144 );
|
||||
struct networking_message *message = CONTAINING_RECORD( params->w_msgs[i], struct networking_message, w_msg_144 );
|
||||
w_SteamNetworkingMessage_t_144 *w_msg = &message->w_msg_144;
|
||||
u_SteamNetworkingMessage_t_144 *u_msg = message->u_msg_144;
|
||||
|
||||
|
@ -38,6 +39,8 @@ void unix_networking_messages_receive_144( uint32_t count, w_SteamNetworkingMess
|
|||
u_msg->m_pfnRelease( u_msg );
|
||||
message->u_msg_144 = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ISteamNetworkingSockets_SteamNetworkingSockets002 */
|
||||
|
@ -108,13 +111,14 @@ static void receive_messages_utow_147( uint32_t count, u_SteamNetworkingMessage_
|
|||
}
|
||||
}
|
||||
|
||||
void unix_networking_messages_receive_147( uint32_t count, w_SteamNetworkingMessage_t_147 **w_msgs )
|
||||
NTSTATUS steamclient_networking_messages_receive_147( void *args )
|
||||
{
|
||||
struct steamclient_networking_messages_receive_147_params *params = (struct steamclient_networking_messages_receive_147_params *)args;
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
for (i = 0; i < params->count; i++)
|
||||
{
|
||||
struct networking_message *message = CONTAINING_RECORD( w_msgs[i], struct networking_message, w_msg_147 );
|
||||
struct networking_message *message = CONTAINING_RECORD( params->w_msgs[i], struct networking_message, w_msg_147 );
|
||||
w_SteamNetworkingMessage_t_147 *w_msg = &message->w_msg_147;
|
||||
u_SteamNetworkingMessage_t_147 *u_msg = message->u_msg_147;
|
||||
|
||||
|
@ -122,6 +126,8 @@ void unix_networking_messages_receive_147( uint32_t count, w_SteamNetworkingMess
|
|||
u_msg->m_pfnRelease( u_msg );
|
||||
message->u_msg_147 = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void U_STDCALL u_SteamNetworkingMessage_t_147_FreeData( u_SteamNetworkingMessage_t_147 *msg )
|
||||
|
@ -164,7 +170,7 @@ static void send_messages_wtou_147( uint32_t count, w_SteamNetworkingMessage_t_1
|
|||
}
|
||||
}
|
||||
|
||||
void unix_networking_message_release_147( w_SteamNetworkingMessage_t_147 *w_msg )
|
||||
static void networking_message_release_147( w_SteamNetworkingMessage_t_147 *w_msg )
|
||||
{
|
||||
struct networking_message *message = CONTAINING_RECORD( w_msg, struct networking_message, w_msg_147 );
|
||||
u_SteamNetworkingMessage_t_147 *u_msg = message->u_msg_147;
|
||||
|
@ -174,6 +180,13 @@ void unix_networking_message_release_147( w_SteamNetworkingMessage_t_147 *w_msg
|
|||
message->u_msg_147 = NULL;
|
||||
}
|
||||
|
||||
NTSTATUS steamclient_networking_message_release_147( void *args )
|
||||
{
|
||||
struct steamclient_networking_message_release_147_params *params = (struct steamclient_networking_message_release_147_params *)args;
|
||||
networking_message_release_147( params->w_msg );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ISteamNetworkingSockets_SteamNetworkingSockets006 */
|
||||
|
||||
NTSTATUS ISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnConnection( void *args )
|
||||
|
@ -389,13 +402,14 @@ static void receive_messages_utow_153a( uint32_t count, u_SteamNetworkingMessage
|
|||
}
|
||||
}
|
||||
|
||||
void unix_networking_messages_receive_153a( uint32_t count, w_SteamNetworkingMessage_t_153a **w_msgs )
|
||||
NTSTATUS steamclient_networking_messages_receive_153a( void *args )
|
||||
{
|
||||
struct steamclient_networking_messages_receive_153a_params *params = (struct steamclient_networking_messages_receive_153a_params *)args;
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
for (i = 0; i < params->count; i++)
|
||||
{
|
||||
struct networking_message *message = CONTAINING_RECORD( w_msgs[i], struct networking_message, w_msg_153a );
|
||||
struct networking_message *message = CONTAINING_RECORD( params->w_msgs[i], struct networking_message, w_msg_153a );
|
||||
w_SteamNetworkingMessage_t_153a *w_msg = &message->w_msg_153a;
|
||||
u_SteamNetworkingMessage_t_153a *u_msg = message->u_msg_153a;
|
||||
|
||||
|
@ -403,6 +417,8 @@ void unix_networking_messages_receive_153a( uint32_t count, w_SteamNetworkingMes
|
|||
u_msg->m_pfnRelease( u_msg );
|
||||
message->u_msg_153a = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void U_STDCALL u_SteamNetworkingMessage_t_153a_FreeData( u_SteamNetworkingMessage_t_153a *msg )
|
||||
|
@ -446,7 +462,7 @@ static void send_messages_wtou_153a( uint32_t count, w_SteamNetworkingMessage_t_
|
|||
}
|
||||
}
|
||||
|
||||
void unix_networking_message_release_153a( w_SteamNetworkingMessage_t_153a *w_msg )
|
||||
static void networking_message_release_153a( w_SteamNetworkingMessage_t_153a *w_msg )
|
||||
{
|
||||
struct networking_message *message = CONTAINING_RECORD( w_msg, struct networking_message, w_msg_153a );
|
||||
u_SteamNetworkingMessage_t_153a *u_msg = message->u_msg_153a;
|
||||
|
@ -456,6 +472,13 @@ void unix_networking_message_release_153a( w_SteamNetworkingMessage_t_153a *w_ms
|
|||
message->u_msg_153a = NULL;
|
||||
}
|
||||
|
||||
NTSTATUS steamclient_networking_message_release_153a( void *args )
|
||||
{
|
||||
struct steamclient_networking_message_release_153a_params *params = (struct steamclient_networking_message_release_153a_params *)args;
|
||||
networking_message_release_153a( params->w_msg );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001 */
|
||||
|
||||
NTSTATUS ISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_ReceiveMessages( void *args )
|
||||
|
|
|
@ -57,8 +57,9 @@ void queue_warning_message_hook( void (*W_CDECL pFunction)( int32_t, const char
|
|||
pthread_mutex_unlock( &callbacks_lock );
|
||||
}
|
||||
|
||||
bool unix_steamclient_next_callback( struct callback *callback, uint32_t *size )
|
||||
NTSTATUS steamclient_next_callback( void *args )
|
||||
{
|
||||
struct steamclient_next_callback_params *params = (struct steamclient_next_callback_params *)args;
|
||||
struct list *ptr;
|
||||
|
||||
pthread_mutex_lock( &callbacks_lock );
|
||||
|
@ -66,18 +67,19 @@ bool unix_steamclient_next_callback( struct callback *callback, uint32_t *size )
|
|||
{
|
||||
struct callback_entry *entry = LIST_ENTRY( ptr, struct callback_entry, entry );
|
||||
|
||||
if (entry->callback.size <= *size)
|
||||
if (entry->callback.size <= params->size)
|
||||
{
|
||||
memcpy( callback, &entry->callback, entry->callback.size );
|
||||
memcpy( params->callback, &entry->callback, entry->callback.size );
|
||||
list_remove( &entry->entry );
|
||||
free( entry );
|
||||
}
|
||||
|
||||
*size = entry->callback.size;
|
||||
params->size = entry->callback.size;
|
||||
}
|
||||
pthread_mutex_unlock( &callbacks_lock );
|
||||
|
||||
return !!ptr;
|
||||
params->_ret = !!ptr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *(*p_CreateInterface)( const char *name, int *return_code );
|
||||
|
@ -88,46 +90,60 @@ static void (*p_Steam_ReleaseThreadLocalMemory)( int );
|
|||
static bool (*p_Steam_IsKnownInterface)( const char * );
|
||||
static void (*p_Steam_NotifyMissingInterface)( int32_t, const char * );
|
||||
|
||||
bool unix_Steam_BGetCallback( uint32_t pipe, w_CallbackMsg_t *w_msg, int32_t *ignored, u_CallbackMsg_t *u_msg )
|
||||
NTSTATUS steamclient_Steam_BGetCallback( void *args )
|
||||
{
|
||||
if (!p_Steam_BGetCallback( pipe, u_msg, ignored )) return false;
|
||||
callback_message_utow( u_msg, w_msg );
|
||||
return true;
|
||||
}
|
||||
struct steamclient_Steam_BGetCallback_params *params = (struct steamclient_Steam_BGetCallback_params *)args;
|
||||
|
||||
void unix_callback_message_receive( u_CallbackMsg_t *u_msg, w_CallbackMsg_t *w_msg )
|
||||
{
|
||||
convert_callback_utow( u_msg->m_iCallback, (void *)u_msg->m_pubParam, u_msg->m_cubParam,
|
||||
(void *)w_msg->m_pubParam, w_msg->m_cubParam );
|
||||
}
|
||||
|
||||
bool unix_Steam_FreeLastCallback( uint32_t pipe )
|
||||
{
|
||||
return p_Steam_FreeLastCallback( pipe );
|
||||
}
|
||||
|
||||
bool unix_Steam_GetAPICallResult( int32_t pipe, uint64_t call, void *w_callback, int w_callback_len,
|
||||
int id, bool *failed )
|
||||
{
|
||||
int u_callback_len = w_callback_len;
|
||||
void *u_callback;
|
||||
bool ret;
|
||||
|
||||
if (!(u_callback = alloc_callback_wtou( id, w_callback, &u_callback_len ))) return false;
|
||||
|
||||
ret = p_Steam_GetAPICallResult( pipe, call, u_callback, u_callback_len, id, failed );
|
||||
|
||||
if (ret && u_callback != w_callback)
|
||||
if (!p_Steam_BGetCallback( params->pipe, params->u_msg, params->ignored ))
|
||||
params->_ret = false;
|
||||
else
|
||||
{
|
||||
convert_callback_utow( id, u_callback, u_callback_len, w_callback, w_callback_len );
|
||||
callback_message_utow( params->u_msg, params->w_msg );
|
||||
params->_ret = true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
NTSTATUS steamclient_callback_message_receive( void *args )
|
||||
{
|
||||
struct steamclient_callback_message_receive_params *params = (struct steamclient_callback_message_receive_params *)args;
|
||||
convert_callback_utow( params->u_msg->m_iCallback, (void *)params->u_msg->m_pubParam,
|
||||
params->u_msg->m_cubParam, (void *)params->w_msg->m_pubParam,
|
||||
params->w_msg->m_cubParam );
|
||||
return 0;
|
||||
}
|
||||
|
||||
NTSTATUS steamclient_Steam_FreeLastCallback( void *args )
|
||||
{
|
||||
struct steamclient_Steam_FreeLastCallback_params *params = (struct steamclient_Steam_FreeLastCallback_params *)args;
|
||||
params->_ret = p_Steam_FreeLastCallback( params->pipe );
|
||||
return 0;
|
||||
}
|
||||
|
||||
NTSTATUS steamclient_Steam_GetAPICallResult( void *args )
|
||||
{
|
||||
struct steamclient_Steam_GetAPICallResult_params *params = (struct steamclient_Steam_GetAPICallResult_params *)args;
|
||||
int u_callback_len = params->w_callback_len;
|
||||
void *u_callback;
|
||||
|
||||
if (!(u_callback = alloc_callback_wtou( params->id, params->w_callback, &u_callback_len ))) return false;
|
||||
|
||||
params->_ret = p_Steam_GetAPICallResult( params->pipe, params->call, u_callback, u_callback_len,
|
||||
params->id, params->failed );
|
||||
|
||||
if (params->_ret && u_callback != params->w_callback)
|
||||
{
|
||||
convert_callback_utow( params->id, u_callback, u_callback_len, params->w_callback, params->w_callback_len );
|
||||
HeapFree( GetProcessHeap(), 0, u_callback );
|
||||
}
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool unix_steamclient_init( struct steamclient_init_params *params )
|
||||
NTSTATUS steamclient_init( void *args )
|
||||
{
|
||||
struct steamclient_init_params *params = (struct steamclient_init_params *)args;
|
||||
char path[PATH_MAX], resolved_path[PATH_MAX];
|
||||
static void *steamclient;
|
||||
|
||||
|
@ -136,7 +152,7 @@ bool unix_steamclient_init( struct steamclient_init_params *params )
|
|||
if (params->ignore_child_processes_unset) unsetenv( "IgnoreChildProcesses" );
|
||||
else if (params->ignore_child_processes) setenv( "IgnoreChildProcesses", params->ignore_child_processes, TRUE );
|
||||
|
||||
if (steamclient) return true;
|
||||
if (steamclient) return 0;
|
||||
|
||||
#ifdef __APPLE__
|
||||
if (getenv( "STEAM_COMPAT_CLIENT_INSTALL_PATH" ))
|
||||
|
@ -163,14 +179,14 @@ bool unix_steamclient_init( struct steamclient_init_params *params )
|
|||
if (!(steamclient = dlopen( path, RTLD_NOW )))
|
||||
{
|
||||
ERR( "unable to load native steamclient library\n" );
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#define LOAD_FUNC( x ) \
|
||||
if (!(p_##x = (decltype(p_##x))dlsym( steamclient, #x ))) \
|
||||
{ \
|
||||
ERR( "unable to load " #x "\n" ); \
|
||||
return false; \
|
||||
return -1; \
|
||||
}
|
||||
|
||||
LOAD_FUNC( CreateInterface );
|
||||
|
@ -181,25 +197,33 @@ bool unix_steamclient_init( struct steamclient_init_params *params )
|
|||
LOAD_FUNC( Steam_IsKnownInterface );
|
||||
LOAD_FUNC( Steam_NotifyMissingInterface );
|
||||
|
||||
return true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *unix_CreateInterface( const char *name, int *return_code )
|
||||
NTSTATUS steamclient_CreateInterface( void *args )
|
||||
{
|
||||
return p_CreateInterface( name, return_code );
|
||||
struct steamclient_CreateInterface_params *params = (struct steamclient_CreateInterface_params *)args;
|
||||
params->_ret = p_CreateInterface( params->name, params->return_code );
|
||||
return 0;
|
||||
}
|
||||
|
||||
void unix_Steam_ReleaseThreadLocalMemory( int thread_exit )
|
||||
NTSTATUS steamclient_Steam_ReleaseThreadLocalMemory( void *args )
|
||||
{
|
||||
p_Steam_ReleaseThreadLocalMemory( thread_exit );
|
||||
struct steamclient_Steam_ReleaseThreadLocalMemory_params *params = (struct steamclient_Steam_ReleaseThreadLocalMemory_params *)args;
|
||||
p_Steam_ReleaseThreadLocalMemory( params->thread_exit );
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool unix_Steam_IsKnownInterface( const char *version )
|
||||
NTSTATUS steamclient_Steam_IsKnownInterface( void *args )
|
||||
{
|
||||
return p_Steam_IsKnownInterface( version );
|
||||
struct steamclient_Steam_IsKnownInterface_params *params = (struct steamclient_Steam_IsKnownInterface_params *)args;
|
||||
params->_ret = p_Steam_IsKnownInterface( params->version );
|
||||
return 0;
|
||||
}
|
||||
|
||||
void unix_Steam_NotifyMissingInterface( int32_t pipe, const char *version )
|
||||
NTSTATUS steamclient_Steam_NotifyMissingInterface( void *args )
|
||||
{
|
||||
p_Steam_NotifyMissingInterface( pipe, version );
|
||||
struct steamclient_Steam_NotifyMissingInterface_params *params = (struct steamclient_Steam_NotifyMissingInterface_params *)args;
|
||||
p_Steam_NotifyMissingInterface( params->pipe, params->version );
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -67,17 +67,96 @@ struct callback
|
|||
};
|
||||
};
|
||||
|
||||
extern bool unix_steamclient_init( struct steamclient_init_params *params );
|
||||
extern bool unix_steamclient_next_callback( struct callback *callback, uint32_t *length );
|
||||
extern void *unix_CreateInterface( const char *name, int *return_code );
|
||||
extern bool unix_Steam_GetAPICallResult( int32_t pipe, uint64_t call, void *w_callback,
|
||||
int w_callback_len, int id, bool *failed );
|
||||
extern bool unix_Steam_BGetCallback( uint32_t pipe, w_CallbackMsg_t *w_msg, int32_t *ignored, u_CallbackMsg_t *u_msg );
|
||||
extern void unix_callback_message_receive( u_CallbackMsg_t *u_msg, w_CallbackMsg_t *w_msg );
|
||||
extern bool unix_Steam_FreeLastCallback( uint32_t pipe );
|
||||
extern void unix_Steam_ReleaseThreadLocalMemory( int thread_exit );
|
||||
extern bool unix_Steam_IsKnownInterface( const char *version );
|
||||
extern void unix_Steam_NotifyMissingInterface( int32_t pipe, const char *version );
|
||||
struct steamclient_next_callback_params
|
||||
{
|
||||
bool _ret;
|
||||
struct callback *callback;
|
||||
uint32_t size;
|
||||
};
|
||||
|
||||
struct steamclient_CreateInterface_params
|
||||
{
|
||||
void *_ret;
|
||||
const char *name;
|
||||
int *return_code;
|
||||
};
|
||||
|
||||
struct steamclient_Steam_GetAPICallResult_params
|
||||
{
|
||||
bool _ret;
|
||||
int32_t pipe;
|
||||
uint64_t call;
|
||||
void *w_callback;
|
||||
int w_callback_len;
|
||||
int id;
|
||||
bool *failed;
|
||||
};
|
||||
|
||||
struct steamclient_Steam_BGetCallback_params
|
||||
{
|
||||
bool _ret;
|
||||
uint32_t pipe;
|
||||
w_CallbackMsg_t *w_msg;
|
||||
int32_t *ignored;
|
||||
u_CallbackMsg_t *u_msg;
|
||||
};
|
||||
|
||||
struct steamclient_callback_message_receive_params
|
||||
{
|
||||
u_CallbackMsg_t *u_msg;
|
||||
w_CallbackMsg_t *w_msg;
|
||||
};
|
||||
|
||||
struct steamclient_Steam_FreeLastCallback_params
|
||||
{
|
||||
bool _ret;
|
||||
uint32_t pipe;
|
||||
};
|
||||
|
||||
struct steamclient_Steam_ReleaseThreadLocalMemory_params
|
||||
{
|
||||
int thread_exit;
|
||||
};
|
||||
|
||||
struct steamclient_Steam_IsKnownInterface_params
|
||||
{
|
||||
bool _ret;
|
||||
const char *version;
|
||||
};
|
||||
|
||||
struct steamclient_Steam_NotifyMissingInterface_params
|
||||
{
|
||||
int32_t pipe;
|
||||
const char *version;
|
||||
};
|
||||
|
||||
struct steamclient_networking_messages_receive_144_params
|
||||
{
|
||||
uint32_t count;
|
||||
w_SteamNetworkingMessage_t_144 **w_msgs;
|
||||
};
|
||||
|
||||
struct steamclient_networking_messages_receive_147_params
|
||||
{
|
||||
uint32_t count;
|
||||
w_SteamNetworkingMessage_t_147 **w_msgs;
|
||||
};
|
||||
|
||||
struct steamclient_networking_messages_receive_153a_params
|
||||
{
|
||||
uint32_t count;
|
||||
w_SteamNetworkingMessage_t_153a **w_msgs;
|
||||
};
|
||||
|
||||
struct steamclient_networking_message_release_147_params
|
||||
{
|
||||
w_SteamNetworkingMessage_t_147 *w_msg;
|
||||
};
|
||||
|
||||
struct steamclient_networking_message_release_153a_params
|
||||
{
|
||||
w_SteamNetworkingMessage_t_153a *w_msg;
|
||||
};
|
||||
|
||||
struct networking_message_pool;
|
||||
struct networking_message
|
||||
|
@ -100,12 +179,6 @@ struct networking_message
|
|||
};
|
||||
};
|
||||
|
||||
extern void unix_networking_messages_receive_144( uint32_t count, w_SteamNetworkingMessage_t_144 **w_msgs );
|
||||
extern void unix_networking_messages_receive_147( uint32_t count, w_SteamNetworkingMessage_t_147 **w_msgs );
|
||||
extern void unix_networking_messages_receive_153a( uint32_t count, w_SteamNetworkingMessage_t_153a **w_msgs );
|
||||
extern void unix_networking_message_release_147( w_SteamNetworkingMessage_t_147 *w_msg );
|
||||
extern void unix_networking_message_release_153a( w_SteamNetworkingMessage_t_153a *w_msg );
|
||||
|
||||
typedef NTSTATUS (*unixlib_entry_t)( void *args );
|
||||
extern const unixlib_entry_t __wine_unix_call_funcs[];
|
||||
|
||||
|
|
|
@ -4,6 +4,21 @@
|
|||
|
||||
extern "C" const unixlib_entry_t __wine_unix_call_funcs[] =
|
||||
{
|
||||
steamclient_init,
|
||||
steamclient_next_callback,
|
||||
steamclient_CreateInterface,
|
||||
steamclient_Steam_GetAPICallResult,
|
||||
steamclient_Steam_BGetCallback,
|
||||
steamclient_callback_message_receive,
|
||||
steamclient_Steam_FreeLastCallback,
|
||||
steamclient_Steam_ReleaseThreadLocalMemory,
|
||||
steamclient_Steam_IsKnownInterface,
|
||||
steamclient_Steam_NotifyMissingInterface,
|
||||
steamclient_networking_messages_receive_144,
|
||||
steamclient_networking_messages_receive_147,
|
||||
steamclient_networking_messages_receive_153a,
|
||||
steamclient_networking_message_release_147,
|
||||
steamclient_networking_message_release_153a,
|
||||
ISteamAppList_STEAMAPPLIST_INTERFACE_VERSION001_GetNumInstalledApps,
|
||||
ISteamAppList_STEAMAPPLIST_INTERFACE_VERSION001_GetInstalledApps,
|
||||
ISteamAppList_STEAMAPPLIST_INTERFACE_VERSION001_GetAppName,
|
||||
|
|
|
@ -45560,6 +45560,21 @@ struct ISteamUtils_SteamUtils010_DismissFloatingGamepadTextInput_params
|
|||
|
||||
enum unix_funcs
|
||||
{
|
||||
unix_steamclient_init,
|
||||
unix_steamclient_next_callback,
|
||||
unix_steamclient_CreateInterface,
|
||||
unix_steamclient_Steam_GetAPICallResult,
|
||||
unix_steamclient_Steam_BGetCallback,
|
||||
unix_steamclient_callback_message_receive,
|
||||
unix_steamclient_Steam_FreeLastCallback,
|
||||
unix_steamclient_Steam_ReleaseThreadLocalMemory,
|
||||
unix_steamclient_Steam_IsKnownInterface,
|
||||
unix_steamclient_Steam_NotifyMissingInterface,
|
||||
unix_steamclient_networking_messages_receive_144,
|
||||
unix_steamclient_networking_messages_receive_147,
|
||||
unix_steamclient_networking_messages_receive_153a,
|
||||
unix_steamclient_networking_message_release_147,
|
||||
unix_steamclient_networking_message_release_153a,
|
||||
unix_ISteamAppList_STEAMAPPLIST_INTERFACE_VERSION001_GetNumInstalledApps,
|
||||
unix_ISteamAppList_STEAMAPPLIST_INTERFACE_VERSION001_GetInstalledApps,
|
||||
unix_ISteamAppList_STEAMAPPLIST_INTERFACE_VERSION001_GetAppName,
|
||||
|
|
Loading…
Reference in a new issue