diff --git a/lsteamclient/Makefile.in b/lsteamclient/Makefile.in index 844a62d6..67a187ea 100644 --- a/lsteamclient/Makefile.in +++ b/lsteamclient/Makefile.in @@ -215,8 +215,6 @@ SOURCES = \ cppISteamUserStats_STEAMUSERSTATS_INTERFACE_VERSION012.cpp \ cppISteamVideo_STEAMVIDEO_INTERFACE_V001.cpp \ cppISteamVideo_STEAMVIDEO_INTERFACE_V002.cpp \ - steamclient_manual_147.cpp \ - steamclient_manual_148a.cpp \ steamclient_manual_150.cpp \ steamclient_manual_153a.cpp \ steamclient_manual_common.cpp \ diff --git a/lsteamclient/gen_wrapper.py b/lsteamclient/gen_wrapper.py index 53c30011..798b358d 100755 --- a/lsteamclient/gen_wrapper.py +++ b/lsteamclient/gen_wrapper.py @@ -204,12 +204,12 @@ MANUAL_STRUCTS = [ MANUAL_METHODS = { #TODO: 001 005 007 #NOTE: 003 never appeared in a public SDK, but is an alias for 002 (the version in SDK 1.45 is actually 004 but incorrectly versioned as 003) - "ISteamNetworkingSockets_ReceiveMessagesOnConnection": lambda ver, abi: abi == 'u' or ver <= 4, - "ISteamNetworkingSockets_ReceiveMessagesOnListenSocket": lambda ver, abi: abi == 'u' or ver <= 4, - "ISteamNetworkingSockets_ReceiveMessagesOnPollGroup": lambda ver, abi: abi == 'u', - "ISteamNetworkingSockets_SendMessages": lambda ver, abi: abi == 'u', + "ISteamNetworkingSockets_ReceiveMessagesOnConnection": lambda ver, abi: abi == 'u' or ver <= 9, + "ISteamNetworkingSockets_ReceiveMessagesOnListenSocket": lambda ver, abi: abi == 'u' or ver <= 9, + "ISteamNetworkingSockets_ReceiveMessagesOnPollGroup": lambda ver, abi: abi == 'u' or ver <= 9, + "ISteamNetworkingSockets_SendMessages": lambda ver, abi: abi == 'u' or ver <= 9, - "ISteamNetworkingUtils_AllocateMessage": lambda ver, abi: abi == 'u', + "ISteamNetworkingUtils_AllocateMessage": lambda ver, abi: abi == 'u' or ver <= 3, "ISteamNetworkingUtils_SetConfigValue": lambda ver, abi: abi == 'u' and ver >= 3, "ISteamNetworkingMessages_ReceiveMessagesOnChannel": lambda ver, abi: abi == 'u', diff --git a/lsteamclient/steam_networking_manual.c b/lsteamclient/steam_networking_manual.c index 5ba0cf79..57b2da21 100644 --- a/lsteamclient/steam_networking_manual.c +++ b/lsteamclient/steam_networking_manual.c @@ -3,6 +3,10 @@ #include "cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001.h" #include "cppISteamNetworkingSockets_SteamNetworkingSockets002.h" #include "cppISteamNetworkingSockets_SteamNetworkingSockets004.h" +#include "cppISteamNetworkingSockets_SteamNetworkingSockets006.h" +#include "cppISteamNetworkingSockets_SteamNetworkingSockets008.h" +#include "cppISteamNetworkingSockets_SteamNetworkingSockets009.h" +#include "cppISteamNetworkingUtils_SteamNetworkingUtils003.h" WINE_DEFAULT_DEBUG_CHANNEL(steamclient); @@ -103,6 +107,72 @@ static bool networking_message_pool_receive_144( int32_t capacity, int32_t count return true; } +static void W_STDCALL w_SteamNetworkingMessage_t_147_FreeData( w_SteamNetworkingMessage_t_147 *msg ) +{ + struct networking_message *message = CONTAINING_RECORD( msg, struct networking_message, w_msg_147 ); + + if (msg->m_pData) SecureZeroMemory( msg->m_pData, msg->m_cbSize ); + if (!message->pool) HeapFree( GetProcessHeap(), 0, msg->m_pData ); +} + +static void W_STDCALL w_SteamNetworkingMessage_t_147_Release( w_SteamNetworkingMessage_t_147 *msg ) +{ + struct networking_message *message = CONTAINING_RECORD( msg, struct networking_message, w_msg_147 ); + + if (msg->m_pfnFreeData) msg->m_pfnFreeData( msg ); + SecureZeroMemory( msg, sizeof(*msg) ); + + if (message->pool) networking_message_pool_release( message->pool ); + else + { + unix_networking_message_release_147( msg ); + HeapFree( GetProcessHeap(), 0, message ); + } +} + +static w_SteamNetworkingMessage_t_147 *networking_message_init_147( struct networking_message *message, + struct networking_message_pool *pool ) +{ + message->pool = pool; + message->p_data = &message->w_msg_147.m_pData; + message->p_size = (uint32_t *)&message->w_msg_147.m_cbSize; + message->w_msg_147.m_pfnFreeData = w_SteamNetworkingMessage_t_147_FreeData; + message->w_msg_147.m_pfnRelease = w_SteamNetworkingMessage_t_147_Release; + return &message->w_msg_147; +} + +static bool networking_message_pool_create_147( uint32_t count, w_SteamNetworkingMessage_t_147 **messages ) +{ + uint32_t size = offsetof( struct networking_message_pool, messages[count] ); + struct networking_message_pool *pool; + + if (!(pool = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size ))) + { + ERR( "Failed to allocate memory for networking messages\n" ); + return false; + } + pool->ref = count; + + while (count--) messages[count] = networking_message_init_147( &pool->messages[count], pool ); + return true; +} + +static bool networking_message_pool_receive_147( uint32_t capacity, uint32_t count, w_SteamNetworkingMessage_t_147 **messages ) +{ + struct networking_message_pool *pool = CONTAINING_RECORD( messages[0], struct networking_message, w_msg_147 )->pool; + uint32_t i; + + for (i = count; i < capacity; i++) messages[i]->m_pfnRelease( messages[i] ); + + if (count) + { + if (!networking_message_pool_alloc_data( count, pool )) return false; + unix_networking_messages_receive_147( count, messages ); + } + + return true; +} + /* ISteamNetworkingSockets_SteamNetworkingSockets002 */ int32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_ReceiveMessagesOnConnection( struct w_steam_iface *_this, @@ -189,6 +259,217 @@ int32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets004_ReceiveM return params._ret; } +/* ISteamNetworkingSockets_SteamNetworkingSockets006 */ + +int32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnConnection( struct w_steam_iface *_this, + uint32_t hConn, w_SteamNetworkingMessage_t_147 **ppOutMessages, + int32_t nMaxMessages ) +{ + struct cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnConnection_params params = + { + .linux_side = _this->u_iface, + .hConn = hConn, + .ppOutMessages = ppOutMessages, + .nMaxMessages = nMaxMessages, + }; + + TRACE( "%p\n", _this ); + + if (!networking_message_pool_create_147( nMaxMessages, params.ppOutMessages )) return 0; + cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnConnection( ¶ms ); + if (!networking_message_pool_receive_147( nMaxMessages, params._ret, params.ppOutMessages )) return 0; + + return params._ret; +} + +int32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnListenSocket( struct w_steam_iface *_this, uint32_t hSocket, + w_SteamNetworkingMessage_t_147 **ppOutMessages, int32_t nMaxMessages ) +{ + struct cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnListenSocket_params params = + { + .linux_side = _this->u_iface, + .hSocket = hSocket, + .ppOutMessages = ppOutMessages, + .nMaxMessages = nMaxMessages, + }; + + TRACE( "%p\n", _this ); + + if (!networking_message_pool_create_147( nMaxMessages, params.ppOutMessages )) return 0; + cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnListenSocket( ¶ms ); + if (!networking_message_pool_receive_147( nMaxMessages, params._ret, params.ppOutMessages )) return 0; + + return params._ret; +} + +void __thiscall winISteamNetworkingSockets_SteamNetworkingSockets006_SendMessages(struct w_steam_iface *_this, int32_t nMessages, w_SteamNetworkingMessage_t_147 **pMessages, int64_t *pOutMessageNumberOrResult) +{ + struct cppISteamNetworkingSockets_SteamNetworkingSockets006_SendMessages_params params = + { + .linux_side = _this->u_iface, + .nMessages = nMessages, + .pMessages = pMessages, + .pOutMessageNumberOrResult = pOutMessageNumberOrResult, + }; + int64_t i; + + TRACE("%p\n", _this); + + cppISteamNetworkingSockets_SteamNetworkingSockets006_SendMessages( ¶ms ); + for (i = 0; i < nMessages; i++) pMessages[i]->m_pfnRelease( pMessages[i] ); +} + +/* ISteamNetworkingSockets_SteamNetworkingSockets008 */ + +int32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnConnection( struct w_steam_iface *_this, + uint32_t hConn, w_SteamNetworkingMessage_t_147 **ppOutMessages, + int32_t nMaxMessages ) +{ + struct cppISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnConnection_params params = + { + .linux_side = _this->u_iface, + .hConn = hConn, + .ppOutMessages = ppOutMessages, + .nMaxMessages = nMaxMessages, + }; + + TRACE( "%p\n", _this ); + + if (!networking_message_pool_create_147( nMaxMessages, params.ppOutMessages )) return 0; + cppISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnConnection( ¶ms ); + if (!networking_message_pool_receive_147( nMaxMessages, params._ret, params.ppOutMessages )) return 0; + + return params._ret; +} + +int32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnPollGroup( struct w_steam_iface *_this, uint32_t hPollGroup, + w_SteamNetworkingMessage_t_147 **ppOutMessages, + int32_t nMaxMessages ) +{ + struct cppISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnPollGroup_params params = + { + .linux_side = _this->u_iface, + .hPollGroup = hPollGroup, + .ppOutMessages = ppOutMessages, + .nMaxMessages = nMaxMessages, + }; + + TRACE( "%p\n", _this ); + + if (!networking_message_pool_create_147( nMaxMessages, params.ppOutMessages )) return 0; + cppISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnPollGroup( ¶ms ); + if (!networking_message_pool_receive_147( nMaxMessages, params._ret, params.ppOutMessages )) return 0; + + return params._ret; +} + +void __thiscall winISteamNetworkingSockets_SteamNetworkingSockets008_SendMessages(struct w_steam_iface *_this, int32_t nMessages, w_SteamNetworkingMessage_t_147 *const *pMessages, int64_t *pOutMessageNumberOrResult) +{ + struct cppISteamNetworkingSockets_SteamNetworkingSockets008_SendMessages_params params = + { + .linux_side = _this->u_iface, + .nMessages = nMessages, + .pMessages = pMessages, + .pOutMessageNumberOrResult = pOutMessageNumberOrResult, + }; + int64_t i; + + TRACE("%p\n", _this); + + cppISteamNetworkingSockets_SteamNetworkingSockets008_SendMessages( ¶ms ); + for (i = 0; i < nMessages; i++) pMessages[i]->m_pfnRelease( pMessages[i] ); +} + +/* ISteamNetworkingSockets_SteamNetworkingSockets009 */ + +int32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnConnection( struct w_steam_iface *_this, + uint32_t hConn, w_SteamNetworkingMessage_t_147 **ppOutMessages, + int32_t nMaxMessages ) +{ + struct cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnConnection_params params = + { + .linux_side = _this->u_iface, + .hConn = hConn, + .ppOutMessages = ppOutMessages, + .nMaxMessages = nMaxMessages, + }; + + TRACE( "%p\n", _this ); + + if (!networking_message_pool_create_147( nMaxMessages, params.ppOutMessages )) return 0; + cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnConnection( ¶ms ); + if (!networking_message_pool_receive_147( nMaxMessages, params._ret, params.ppOutMessages )) return 0; + + return params._ret; +} + +int32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnPollGroup( struct w_steam_iface *_this, uint32_t hPollGroup, + w_SteamNetworkingMessage_t_147 **ppOutMessages, + int32_t nMaxMessages ) +{ + struct cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnPollGroup_params params = + { + .linux_side = _this->u_iface, + .hPollGroup = hPollGroup, + .ppOutMessages = ppOutMessages, + .nMaxMessages = nMaxMessages, + }; + + TRACE( "%p\n", _this ); + + if (!networking_message_pool_create_147( nMaxMessages, params.ppOutMessages )) return 0; + cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnPollGroup( ¶ms ); + if (!networking_message_pool_receive_147( nMaxMessages, params._ret, params.ppOutMessages )) return 0; + + return params._ret; +} + +void __thiscall winISteamNetworkingSockets_SteamNetworkingSockets009_SendMessages(struct w_steam_iface *_this, int32_t nMessages, w_SteamNetworkingMessage_t_147 *const *pMessages, int64_t *pOutMessageNumberOrResult) +{ + struct cppISteamNetworkingSockets_SteamNetworkingSockets009_SendMessages_params params = + { + .linux_side = _this->u_iface, + .nMessages = nMessages, + .pMessages = pMessages, + .pOutMessageNumberOrResult = pOutMessageNumberOrResult, + }; + int64_t i; + + TRACE("%p\n", _this); + + cppISteamNetworkingSockets_SteamNetworkingSockets009_SendMessages( ¶ms ); + for (i = 0; i < nMessages; i++) pMessages[i]->m_pfnRelease( pMessages[i] ); +} + +/* ISteamNetworkingUtils_SteamNetworkingUtils003 */ + +w_SteamNetworkingMessage_t_147 *__thiscall winISteamNetworkingUtils_SteamNetworkingUtils003_AllocateMessage( struct w_steam_iface *_this, int32_t cbAllocateBuffer ) +{ + struct cppISteamNetworkingUtils_SteamNetworkingUtils003_AllocateMessage_params params = + { + .linux_side = _this->u_iface, + .cbAllocateBuffer = cbAllocateBuffer, + }; + struct networking_message *message; + + TRACE( "%p\n", _this ); + + if (!(message = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*message) ))) return NULL; + if ((message->w_msg_147.m_cbSize = cbAllocateBuffer) && + !(message->w_msg_147.m_pData = HeapAlloc( GetProcessHeap(), 0, cbAllocateBuffer ))) + { + HeapFree( GetProcessHeap(), 0, message ); + return NULL; + } + message->w_msg_147.m_pfnFreeData = w_SteamNetworkingMessage_t_147_FreeData; + message->w_msg_147.m_pfnRelease = w_SteamNetworkingMessage_t_147_Release; + params._ret = &message->w_msg_147; + + cppISteamNetworkingUtils_SteamNetworkingUtils003_AllocateMessage( ¶ms ); + + return params._ret; +} + /* ISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001 */ void __thiscall winISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_DestroyFakeUDPPort( struct w_steam_iface *_this ) diff --git a/lsteamclient/steamclient_manual_147.cpp b/lsteamclient/steamclient_manual_147.cpp deleted file mode 100644 index 3a3715c0..00000000 --- a/lsteamclient/steamclient_manual_147.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "unix_private.h" - -extern "C" -{ -#define SDK_VERSION 1470 -#include "steamclient_manual_common.h" -} - -#include "cppISteamNetworkingSockets_SteamNetworkingSockets006.hpp" - -WINE_DEFAULT_DEBUG_CHANNEL(steamclient); - -void cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnConnection( struct cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnConnection_params *params ) -{ - struct u_ISteamNetworkingSockets_SteamNetworkingSockets006 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets006 *)params->linux_side; - u_SteamNetworkingMessage_t_147 *u_ppOutMessages[params->nMaxMessages]; - params->_ret = iface->ReceiveMessagesOnConnection( params->hConn, u_ppOutMessages, params->nMaxMessages ); - lin_to_win_struct_SteamNetworkingMessage_t( params->_ret, u_ppOutMessages, - params->ppOutMessages, params->nMaxMessages ); -} - -void cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnListenSocket( struct cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnListenSocket_params *params ) -{ - struct u_ISteamNetworkingSockets_SteamNetworkingSockets006 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets006 *)params->linux_side; - u_SteamNetworkingMessage_t_147 *u_ppOutMessages[params->nMaxMessages]; - params->_ret = iface->ReceiveMessagesOnListenSocket( params->hSocket, u_ppOutMessages, params->nMaxMessages ); - lin_to_win_struct_SteamNetworkingMessage_t( params->_ret, u_ppOutMessages, - params->ppOutMessages, params->nMaxMessages ); -} - -void cppISteamNetworkingSockets_SteamNetworkingSockets006_SendMessages( struct cppISteamNetworkingSockets_SteamNetworkingSockets006_SendMessages_params *params ) -{ -#define MAX_SEND_MESSAGES 64 - struct u_ISteamNetworkingSockets_SteamNetworkingSockets006 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets006 *)params->linux_side; - /* use the stack to avoid heap allocation */ - u_SteamNetworkingMessage_t_147 *u_msgs[MAX_SEND_MESSAGES]; - int i; - - if (params->nMessages > MAX_SEND_MESSAGES) - { - /* if we ever hit this, increase MAX_SEND_MESSAGES appropriately */ - FIXME( "Trying to send %u messages, which is more than %u! Will break up into pieces.\n", - params->nMessages, MAX_SEND_MESSAGES ); - } - - while (params->nMessages) - { - for (i = 0; i < params->nMessages && i < MAX_SEND_MESSAGES; ++i) - u_msgs[i] = (u_SteamNetworkingMessage_t_147 *)network_message_win_to_lin( params->pMessages[i] ); - - iface->SendMessages( i, u_msgs, params->pOutMessageNumberOrResult ); - - params->nMessages -= i; - params->pMessages += i; - if (params->pOutMessageNumberOrResult) params->pOutMessageNumberOrResult += i; - } -} diff --git a/lsteamclient/steamclient_manual_148a.cpp b/lsteamclient/steamclient_manual_148a.cpp deleted file mode 100644 index 02be7463..00000000 --- a/lsteamclient/steamclient_manual_148a.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "unix_private.h" - -extern "C" -{ -#define SDK_VERSION 1481 -#include "steamclient_manual_common.h" -} - -#include "cppISteamNetworkingSockets_SteamNetworkingSockets008.hpp" - -WINE_DEFAULT_DEBUG_CHANNEL(steamclient); - -void cppISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnConnection( struct cppISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnConnection_params *params ) -{ - struct u_ISteamNetworkingSockets_SteamNetworkingSockets008 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets008 *)params->linux_side; - u_SteamNetworkingMessage_t_147 *u_ppOutMessages[params->nMaxMessages]; - params->_ret = iface->ReceiveMessagesOnConnection( params->hConn, u_ppOutMessages, params->nMaxMessages ); - lin_to_win_struct_SteamNetworkingMessage_t( params->_ret, u_ppOutMessages, - params->ppOutMessages, params->nMaxMessages ); -} - -void cppISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnPollGroup( struct cppISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnPollGroup_params *params ) -{ - struct u_ISteamNetworkingSockets_SteamNetworkingSockets008 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets008 *)params->linux_side; - u_SteamNetworkingMessage_t_147 *u_ppOutMessages[params->nMaxMessages]; - params->_ret = iface->ReceiveMessagesOnPollGroup( params->hPollGroup, u_ppOutMessages, params->nMaxMessages ); - lin_to_win_struct_SteamNetworkingMessage_t( params->_ret, u_ppOutMessages, - params->ppOutMessages, params->nMaxMessages ); -} - -void cppISteamNetworkingSockets_SteamNetworkingSockets008_SendMessages( struct cppISteamNetworkingSockets_SteamNetworkingSockets008_SendMessages_params *params ) -{ -#define MAX_SEND_MESSAGES 64 - struct u_ISteamNetworkingSockets_SteamNetworkingSockets008 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets008 *)params->linux_side; - /* use the stack to avoid heap allocation */ - u_SteamNetworkingMessage_t_147 *u_msgs[MAX_SEND_MESSAGES]; - int i; - - if (params->nMessages > MAX_SEND_MESSAGES) - { - /* if we ever hit this, increase MAX_SEND_MESSAGES appropriately */ - FIXME( "Trying to send %u messages, which is more than %u! Will break up into pieces.\n", - params->nMessages, MAX_SEND_MESSAGES ); - } - - while (params->nMessages) - { - for (i = 0; i < params->nMessages && i < MAX_SEND_MESSAGES; ++i) - u_msgs[i] = (u_SteamNetworkingMessage_t_147 *)network_message_win_to_lin( params->pMessages[i] ); - - iface->SendMessages( i, u_msgs, params->pOutMessageNumberOrResult ); - - params->nMessages -= i; - params->pMessages += i; - if (params->pOutMessageNumberOrResult) params->pOutMessageNumberOrResult += i; - } -} diff --git a/lsteamclient/steamclient_manual_150.cpp b/lsteamclient/steamclient_manual_150.cpp index 60c4d27e..72299ed6 100644 --- a/lsteamclient/steamclient_manual_150.cpp +++ b/lsteamclient/steamclient_manual_150.cpp @@ -6,57 +6,7 @@ extern "C" { #include "steamclient_manual_common.h" } -#include "cppISteamNetworkingSockets_SteamNetworkingSockets009.hpp" #include "cppISteamNetworkingMessages_SteamNetworkingMessages002.hpp" -#include "cppISteamNetworkingUtils_SteamNetworkingUtils003.hpp" - -WINE_DEFAULT_DEBUG_CHANNEL(steamclient); - -void cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnConnection( struct cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnConnection_params *params ) -{ - struct u_ISteamNetworkingSockets_SteamNetworkingSockets009 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets009 *)params->linux_side; - u_SteamNetworkingMessage_t_147 *u_ppOutMessages[params->nMaxMessages]; - params->_ret = iface->ReceiveMessagesOnConnection( params->hConn, u_ppOutMessages, params->nMaxMessages ); - lin_to_win_struct_SteamNetworkingMessage_t( params->_ret, u_ppOutMessages, - params->ppOutMessages, params->nMaxMessages ); -} - -void cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnPollGroup( struct cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnPollGroup_params *params ) -{ - struct u_ISteamNetworkingSockets_SteamNetworkingSockets009 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets009 *)params->linux_side; - u_SteamNetworkingMessage_t_147 *u_ppOutMessages[params->nMaxMessages]; - params->_ret = iface->ReceiveMessagesOnPollGroup( params->hPollGroup, u_ppOutMessages, params->nMaxMessages ); - lin_to_win_struct_SteamNetworkingMessage_t( params->_ret, u_ppOutMessages, - params->ppOutMessages, params->nMaxMessages ); -} - -void cppISteamNetworkingSockets_SteamNetworkingSockets009_SendMessages( struct cppISteamNetworkingSockets_SteamNetworkingSockets009_SendMessages_params *params ) -{ -#define MAX_SEND_MESSAGES 64 - struct u_ISteamNetworkingSockets_SteamNetworkingSockets009 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets009 *)params->linux_side; - /* use the stack to avoid heap allocation */ - u_SteamNetworkingMessage_t_147 *lin_msgs[MAX_SEND_MESSAGES]; - int i; - - if (params->nMessages > MAX_SEND_MESSAGES) - { - /* if we ever hit this, increase MAX_SEND_MESSAGES appropriately */ - FIXME( "Trying to send %u messages, which is more than %u! Will break up into pieces.\n", - params->nMessages, MAX_SEND_MESSAGES ); - } - - while (params->nMessages) - { - for (i = 0; i < params->nMessages && i < MAX_SEND_MESSAGES; ++i) - lin_msgs[i] = (u_SteamNetworkingMessage_t_147 *)network_message_win_to_lin( params->pMessages[i] ); - - iface->SendMessages( i, lin_msgs, params->pOutMessageNumberOrResult ); - - params->nMessages -= i; - params->pMessages += i; - if (params->pOutMessageNumberOrResult) params->pOutMessageNumberOrResult += i; - } -} void cppISteamNetworkingMessages_SteamNetworkingMessages002_ReceiveMessagesOnChannel( struct cppISteamNetworkingMessages_SteamNetworkingMessages002_ReceiveMessagesOnChannel_params *params ) { @@ -66,90 +16,3 @@ void cppISteamNetworkingMessages_SteamNetworkingMessages002_ReceiveMessagesOnCha lin_to_win_struct_SteamNetworkingMessage_t( params->_ret, u_ppOutMessages, params->ppOutMessages, params->nMaxMessages ); } - -typedef void (*CDECL win_FnSteamNetConnectionStatusChanged)( w_SteamNetConnectionStatusChangedCallback_t_151 * ); -static win_FnSteamNetConnectionStatusChanged win_SteamNetConnectionStatusChanged; -static void lin_SteamNetConnectionStatusChanged( u_SteamNetConnectionStatusChangedCallback_t_151 *u_dat ) -{ - win_FnSteamNetConnectionStatusChanged fn = win_SteamNetConnectionStatusChanged; - if (fn) - { - w_SteamNetConnectionStatusChangedCallback_t_151 w_dat = *u_dat; - fn(&w_dat); - } -} - -typedef void (*CDECL win_FnSteamNetAuthenticationStatusChanged)( SteamNetAuthenticationStatus_t * ); -static win_FnSteamNetAuthenticationStatusChanged win_SteamNetAuthenticationStatusChanged; -static void lin_SteamNetAuthenticationStatusChanged( SteamNetAuthenticationStatus_t *dat ) -{ - win_FnSteamNetAuthenticationStatusChanged fn = win_SteamNetAuthenticationStatusChanged; - if (fn) fn( dat ); -} - -typedef void (*CDECL win_FnSteamRelayNetworkStatusChanged)( SteamRelayNetworkStatus_t * ); -static win_FnSteamRelayNetworkStatusChanged win_SteamRelayNetworkStatusChanged; -static void lin_SteamRelayNetworkStatusChanged( SteamRelayNetworkStatus_t *dat ) -{ - win_FnSteamRelayNetworkStatusChanged fn = win_SteamRelayNetworkStatusChanged; - if (fn) fn( dat ); -} - -typedef void (*CDECL win_FnSteamNetworkingMessagesSessionRequest)( SteamNetworkingMessagesSessionRequest_t_151 * ); -static win_FnSteamNetworkingMessagesSessionRequest win_SteamNetworkingMessagesSessionRequest; -static void lin_SteamNetworkingMessagesSessionRequest( SteamNetworkingMessagesSessionRequest_t_151 *dat ) -{ - win_FnSteamNetworkingMessagesSessionRequest fn = win_SteamNetworkingMessagesSessionRequest; - if (fn) fn( dat ); -} - -typedef void (*CDECL win_FnSteamNetworkingMessagesSessionFailed)( SteamNetworkingMessagesSessionFailed_t_151 * ); -static win_FnSteamNetworkingMessagesSessionFailed win_SteamNetworkingMessagesSessionFailed; -static void lin_SteamNetworkingMessagesSessionFailed( SteamNetworkingMessagesSessionFailed_t_151 *dat ) -{ - win_FnSteamNetworkingMessagesSessionFailed fn = win_SteamNetworkingMessagesSessionFailed; - if (fn) fn( dat ); -} - -void cppISteamNetworkingUtils_SteamNetworkingUtils003_AllocateMessage( struct cppISteamNetworkingUtils_SteamNetworkingUtils003_AllocateMessage_params *params ) -{ - struct u_ISteamNetworkingUtils_SteamNetworkingUtils003 *iface = (struct u_ISteamNetworkingUtils_SteamNetworkingUtils003 *)params->linux_side; - u_SteamNetworkingMessage_t_147 *u_ret = iface->AllocateMessage( params->cbAllocateBuffer ); - params->_ret = (w_SteamNetworkingMessage_t_147 *)network_message_lin_to_win( u_ret ); -} - -void cppISteamNetworkingUtils_SteamNetworkingUtils003_SetConfigValue( struct cppISteamNetworkingUtils_SteamNetworkingUtils003_SetConfigValue_params *params ) -{ - struct u_ISteamNetworkingUtils_SteamNetworkingUtils003 *iface = (struct u_ISteamNetworkingUtils_SteamNetworkingUtils003 *)params->linux_side; - void *lin_fn; /* api requires passing pointer-to-pointer */ - - switch (params->eValue) - { -#define CASE( y ) \ - if (!params->pArg) \ - { \ - params->_ret = iface->SetConfigValue( params->eValue, params->eScopeType, \ - params->scopeObj, params->eDataType, NULL ); \ - } \ - else \ - { \ - if (*(void **)params->pArg == NULL) lin_fn = NULL; \ - else lin_fn = (void *)&lin_##y; \ - params->_ret = iface->SetConfigValue( params->eValue, params->eScopeType, \ - params->scopeObj, params->eDataType, &lin_fn ); \ - if (params->_ret) win_##y = *(win_Fn##y *)params->pArg; \ - } - - case 201 /*ConnectionStatusChanged*/: CASE( SteamNetConnectionStatusChanged ) - case 202 /*AuthStatusChanged*/: CASE( SteamNetAuthenticationStatusChanged ) - case 203 /*RelayNetworkStatusChanged*/: CASE( SteamRelayNetworkStatusChanged ) - case 204 /*MessagesSessionRequest*/: CASE( SteamNetworkingMessagesSessionRequest ) - case 205 /*MessagesSessionFailed*/: CASE( SteamNetworkingMessagesSessionFailed ) - -#undef CASE - - default: - params->_ret = iface->SetConfigValue( params->eValue, params->eScopeType, params->scopeObj, - params->eDataType, params->pArg ); - } -} diff --git a/lsteamclient/unix_steam_networking_manual.cpp b/lsteamclient/unix_steam_networking_manual.cpp index ead5eade..56ddf37f 100644 --- a/lsteamclient/unix_steam_networking_manual.cpp +++ b/lsteamclient/unix_steam_networking_manual.cpp @@ -1,7 +1,13 @@ #include "steamclient_structs.h" +#include + #include "cppISteamNetworkingSockets_SteamNetworkingSockets002.hpp" #include "cppISteamNetworkingSockets_SteamNetworkingSockets004.hpp" +#include "cppISteamNetworkingSockets_SteamNetworkingSockets006.hpp" +#include "cppISteamNetworkingSockets_SteamNetworkingSockets008.hpp" +#include "cppISteamNetworkingSockets_SteamNetworkingSockets009.hpp" +#include "cppISteamNetworkingUtils_SteamNetworkingUtils003.hpp" static void receive_messages_utow_144( uint32_t count, u_SteamNetworkingMessage_t_144 **u_msgs, w_SteamNetworkingMessage_t_144 **w_msgs ) @@ -76,3 +82,260 @@ void cppISteamNetworkingSockets_SteamNetworkingSockets004_ReceiveMessagesOnListe params->_ret = iface->ReceiveMessagesOnListenSocket( params->hSocket, u_msgs, params->nMaxMessages ); if (params->_ret > 0) receive_messages_utow_144( params->_ret, u_msgs, params->ppOutMessages ); } + +static void receive_messages_utow_147( uint32_t count, u_SteamNetworkingMessage_t_147 **u_msgs, + w_SteamNetworkingMessage_t_147 **w_msgs ) +{ + uint32_t i; + + for (i = 0; i < count; i++) + { + struct networking_message *message = CONTAINING_RECORD( 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 = u_msgs[i]; + message->u_msg_147 = u_msg; + + w_msg->m_cbSize = u_msg->m_cbSize; + w_msg->m_conn = u_msg->m_conn; + w_msg->m_identityPeer = u_msg->m_identityPeer; + w_msg->m_nConnUserData = u_msg->m_nConnUserData; + w_msg->m_usecTimeReceived = u_msg->m_usecTimeReceived; + w_msg->m_nMessageNumber = u_msg->m_nMessageNumber; + w_msg->m_nChannel = u_msg->m_nChannel; + w_msg->m_nFlags = u_msg->m_nFlags; + w_msg->m_nUserData = u_msg->m_nUserData; + } +} + +void unix_networking_messages_receive_147( uint32_t count, w_SteamNetworkingMessage_t_147 **w_msgs ) +{ + uint32_t i; + + for (i = 0; i < count; i++) + { + struct networking_message *message = CONTAINING_RECORD( 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; + + memcpy( w_msg->m_pData, u_msg->m_pData, u_msg->m_cbSize ); + u_msg->m_pfnRelease( u_msg ); + message->u_msg_147 = NULL; + } +} + +static void U_STDCALL u_SteamNetworkingMessage_t_147_FreeData( u_SteamNetworkingMessage_t_147 *msg ) +{ + free( msg->m_pData ); + msg->m_pData = NULL; +} + +static void send_messages_wtou_147( uint32_t count, w_SteamNetworkingMessage_t_147 *const *w_msgs, + u_SteamNetworkingMessage_t_147 **u_msgs ) +{ + uint32_t i; + + for (i = 0; i < count; i++) + { + struct networking_message *message = CONTAINING_RECORD( 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; + + if (!u_msg->m_pData) + { + u_msg->m_pData = malloc( w_msg->m_cbSize ); + u_msg->m_pfnFreeData = u_SteamNetworkingMessage_t_147_FreeData; + } + + memcpy( u_msg->m_pData, w_msg->m_pData, w_msg->m_cbSize ); + u_msg->m_cbSize = w_msg->m_cbSize; + u_msg->m_conn = w_msg->m_conn; + u_msg->m_identityPeer = w_msg->m_identityPeer; + u_msg->m_nConnUserData = w_msg->m_nConnUserData; + u_msg->m_usecTimeReceived = w_msg->m_usecTimeReceived; + u_msg->m_nMessageNumber = w_msg->m_nMessageNumber; + u_msg->m_nChannel = w_msg->m_nChannel; + u_msg->m_nFlags = w_msg->m_nFlags; + u_msg->m_nUserData = w_msg->m_nUserData; + + /* steamclient library takes ownership */ + message->u_msg_147 = NULL; + u_msgs[i] = u_msg; + } +} + +void unix_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; + + if (!message->u_msg_147) return; + u_msg->m_pfnRelease( u_msg ); + message->u_msg_147 = NULL; +} + +/* ISteamNetworkingSockets_SteamNetworkingSockets006 */ + +void cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnConnection( struct cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnConnection_params *params ) +{ + struct u_ISteamNetworkingSockets_SteamNetworkingSockets006 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets006 *)params->linux_side; + u_SteamNetworkingMessage_t_147 *u_msgs[params->nMaxMessages]; + params->_ret = iface->ReceiveMessagesOnConnection( params->hConn, u_msgs, params->nMaxMessages ); + if (params->_ret > 0) receive_messages_utow_147( params->_ret, u_msgs, params->ppOutMessages ); +} + +void cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnListenSocket( struct cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnListenSocket_params *params ) +{ + struct u_ISteamNetworkingSockets_SteamNetworkingSockets006 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets006 *)params->linux_side; + u_SteamNetworkingMessage_t_147 *u_msgs[params->nMaxMessages]; + params->_ret = iface->ReceiveMessagesOnListenSocket( params->hSocket, u_msgs, params->nMaxMessages ); + if (params->_ret > 0) receive_messages_utow_147( params->_ret, u_msgs, params->ppOutMessages ); +} + +void cppISteamNetworkingSockets_SteamNetworkingSockets006_SendMessages( struct cppISteamNetworkingSockets_SteamNetworkingSockets006_SendMessages_params *params ) +{ + struct u_ISteamNetworkingSockets_SteamNetworkingSockets006 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets006 *)params->linux_side; + u_SteamNetworkingMessage_t_147 *u_msgs[params->nMessages]; + send_messages_wtou_147( params->nMessages, params->pMessages, u_msgs ); + iface->SendMessages( params->nMessages, u_msgs, params->pOutMessageNumberOrResult ); +} + +/* ISteamNetworkingSockets_SteamNetworkingSockets008 */ + +void cppISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnConnection( struct cppISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnConnection_params *params ) +{ + struct u_ISteamNetworkingSockets_SteamNetworkingSockets008 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets008 *)params->linux_side; + u_SteamNetworkingMessage_t_147 *u_msgs[params->nMaxMessages]; + params->_ret = iface->ReceiveMessagesOnConnection( params->hConn, u_msgs, params->nMaxMessages ); + if (params->_ret > 0) receive_messages_utow_147( params->_ret, u_msgs, params->ppOutMessages ); +} + +void cppISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnPollGroup( struct cppISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnPollGroup_params *params ) +{ + struct u_ISteamNetworkingSockets_SteamNetworkingSockets008 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets008 *)params->linux_side; + u_SteamNetworkingMessage_t_147 *u_msgs[params->nMaxMessages]; + params->_ret = iface->ReceiveMessagesOnPollGroup( params->hPollGroup, u_msgs, params->nMaxMessages ); + if (params->_ret > 0) receive_messages_utow_147( params->_ret, u_msgs, params->ppOutMessages ); +} + +void cppISteamNetworkingSockets_SteamNetworkingSockets008_SendMessages( struct cppISteamNetworkingSockets_SteamNetworkingSockets008_SendMessages_params *params ) +{ + struct u_ISteamNetworkingSockets_SteamNetworkingSockets008 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets008 *)params->linux_side; + u_SteamNetworkingMessage_t_147 *u_msgs[params->nMessages]; + send_messages_wtou_147( params->nMessages, params->pMessages, u_msgs ); + iface->SendMessages( params->nMessages, u_msgs, params->pOutMessageNumberOrResult ); +} + +/* ISteamNetworkingSockets_SteamNetworkingSockets009 */ + +void cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnConnection( struct cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnConnection_params *params ) +{ + struct u_ISteamNetworkingSockets_SteamNetworkingSockets009 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets009 *)params->linux_side; + u_SteamNetworkingMessage_t_147 *u_msgs[params->nMaxMessages]; + params->_ret = iface->ReceiveMessagesOnConnection( params->hConn, u_msgs, params->nMaxMessages ); + if (params->_ret > 0) receive_messages_utow_147( params->_ret, u_msgs, params->ppOutMessages ); +} + +void cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnPollGroup( struct cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnPollGroup_params *params ) +{ + struct u_ISteamNetworkingSockets_SteamNetworkingSockets009 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets009 *)params->linux_side; + u_SteamNetworkingMessage_t_147 *u_msgs[params->nMaxMessages]; + params->_ret = iface->ReceiveMessagesOnPollGroup( params->hPollGroup, u_msgs, params->nMaxMessages ); + if (params->_ret > 0) receive_messages_utow_147( params->_ret, u_msgs, params->ppOutMessages ); +} + +void cppISteamNetworkingSockets_SteamNetworkingSockets009_SendMessages( struct cppISteamNetworkingSockets_SteamNetworkingSockets009_SendMessages_params *params ) +{ + struct u_ISteamNetworkingSockets_SteamNetworkingSockets009 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets009 *)params->linux_side; + u_SteamNetworkingMessage_t_147 *u_msgs[params->nMessages]; + send_messages_wtou_147( params->nMessages, params->pMessages, u_msgs ); + iface->SendMessages( params->nMessages, u_msgs, params->pOutMessageNumberOrResult ); +} + +/* ISteamNetworkingUtils_SteamNetworkingUtils003 */ + +void cppISteamNetworkingUtils_SteamNetworkingUtils003_AllocateMessage( struct cppISteamNetworkingUtils_SteamNetworkingUtils003_AllocateMessage_params *params ) +{ + struct u_ISteamNetworkingUtils_SteamNetworkingUtils003 *iface = (struct u_ISteamNetworkingUtils_SteamNetworkingUtils003 *)params->linux_side; + u_SteamNetworkingMessage_t_147 *u_msg = iface->AllocateMessage( params->cbAllocateBuffer ); + if (u_msg) receive_messages_utow_147( 1, &u_msg, ¶ms->_ret ); +} + +typedef void (*CDECL win_FnSteamNetConnectionStatusChanged)( w_SteamNetConnectionStatusChangedCallback_t_151 * ); +static win_FnSteamNetConnectionStatusChanged win_SteamNetConnectionStatusChanged; +static void lin_SteamNetConnectionStatusChanged( u_SteamNetConnectionStatusChangedCallback_t_151 *u_dat ) +{ + win_FnSteamNetConnectionStatusChanged fn = win_SteamNetConnectionStatusChanged; + if (fn) + { + w_SteamNetConnectionStatusChangedCallback_t_151 w_dat = *u_dat; + fn( &w_dat ); + } +} + +typedef void (*CDECL win_FnSteamNetAuthenticationStatusChanged)( SteamNetAuthenticationStatus_t * ); +static win_FnSteamNetAuthenticationStatusChanged win_SteamNetAuthenticationStatusChanged; +static void lin_SteamNetAuthenticationStatusChanged( SteamNetAuthenticationStatus_t *dat ) +{ + win_FnSteamNetAuthenticationStatusChanged fn = win_SteamNetAuthenticationStatusChanged; + if (fn) fn( dat ); +} + +typedef void (*CDECL win_FnSteamRelayNetworkStatusChanged)( SteamRelayNetworkStatus_t * ); +static win_FnSteamRelayNetworkStatusChanged win_SteamRelayNetworkStatusChanged; +static void lin_SteamRelayNetworkStatusChanged( SteamRelayNetworkStatus_t *dat ) +{ + win_FnSteamRelayNetworkStatusChanged fn = win_SteamRelayNetworkStatusChanged; + if (fn) fn( dat ); +} + +typedef void (*CDECL win_FnSteamNetworkingMessagesSessionRequest)( SteamNetworkingMessagesSessionRequest_t_151 * ); +static win_FnSteamNetworkingMessagesSessionRequest win_SteamNetworkingMessagesSessionRequest; +static void lin_SteamNetworkingMessagesSessionRequest( SteamNetworkingMessagesSessionRequest_t_151 *dat ) +{ + win_FnSteamNetworkingMessagesSessionRequest fn = win_SteamNetworkingMessagesSessionRequest; + if (fn) fn( dat ); +} + +typedef void (*CDECL win_FnSteamNetworkingMessagesSessionFailed)( SteamNetworkingMessagesSessionFailed_t_151 * ); +static win_FnSteamNetworkingMessagesSessionFailed win_SteamNetworkingMessagesSessionFailed; +static void lin_SteamNetworkingMessagesSessionFailed( SteamNetworkingMessagesSessionFailed_t_151 *dat ) +{ + win_FnSteamNetworkingMessagesSessionFailed fn = win_SteamNetworkingMessagesSessionFailed; + if (fn) fn( dat ); +} + +void cppISteamNetworkingUtils_SteamNetworkingUtils003_SetConfigValue( struct cppISteamNetworkingUtils_SteamNetworkingUtils003_SetConfigValue_params *params ) +{ + struct u_ISteamNetworkingUtils_SteamNetworkingUtils003 *iface = (struct u_ISteamNetworkingUtils_SteamNetworkingUtils003 *)params->linux_side; + void *lin_fn; /* api requires passing pointer-to-pointer */ + + switch (params->eValue) + { +#define CASE( y ) \ + if (!params->pArg) \ + { \ + params->_ret = iface->SetConfigValue( params->eValue, params->eScopeType, \ + params->scopeObj, params->eDataType, NULL ); \ + } \ + else \ + { \ + if (*(void **)params->pArg == NULL) lin_fn = NULL; \ + else lin_fn = (void *)&lin_##y; \ + params->_ret = iface->SetConfigValue( params->eValue, params->eScopeType, \ + params->scopeObj, params->eDataType, &lin_fn ); \ + if (params->_ret) win_##y = *(win_Fn##y *)params->pArg; \ + } + + case 201 /*ConnectionStatusChanged*/: CASE( SteamNetConnectionStatusChanged ) + case 202 /*AuthStatusChanged*/: CASE( SteamNetAuthenticationStatusChanged ) + case 203 /*RelayNetworkStatusChanged*/: CASE( SteamRelayNetworkStatusChanged ) + case 204 /*MessagesSessionRequest*/: CASE( SteamNetworkingMessagesSessionRequest ) + case 205 /*MessagesSessionFailed*/: CASE( SteamNetworkingMessagesSessionFailed ) + +#undef CASE + + default: + params->_ret = iface->SetConfigValue( params->eValue, params->eScopeType, params->scopeObj, + params->eDataType, params->pArg ); + } +} diff --git a/lsteamclient/unixlib.h b/lsteamclient/unixlib.h index f839c00a..1f3e7f22 100644 --- a/lsteamclient/unixlib.h +++ b/lsteamclient/unixlib.h @@ -74,11 +74,21 @@ struct networking_message void **p_data; uint32_t *p_size; - u_SteamNetworkingMessage_t_144 *u_msg_144; - w_SteamNetworkingMessage_t_144 w_msg_144; + union + { + u_SteamNetworkingMessage_t_144 *u_msg_144; + u_SteamNetworkingMessage_t_147 *u_msg_147; + }; + union + { + w_SteamNetworkingMessage_t_144 w_msg_144; + w_SteamNetworkingMessage_t_147 w_msg_147; + }; }; 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_message_release_147( w_SteamNetworkingMessage_t_147 *w_msg ); #endif #ifdef __cplusplus diff --git a/lsteamclient/winISteamNetworkingSockets.c b/lsteamclient/winISteamNetworkingSockets.c index e9fb6dca..31255474 100644 --- a/lsteamclient/winISteamNetworkingSockets.c +++ b/lsteamclient/winISteamNetworkingSockets.c @@ -1083,19 +1083,6 @@ uint32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets006_SendMes return params._ret; } -void __thiscall winISteamNetworkingSockets_SteamNetworkingSockets006_SendMessages(struct w_steam_iface *_this, int32_t nMessages, w_SteamNetworkingMessage_t_147 **pMessages, int64_t *pOutMessageNumberOrResult) -{ - struct cppISteamNetworkingSockets_SteamNetworkingSockets006_SendMessages_params params = - { - .linux_side = _this->u_iface, - .nMessages = nMessages, - .pMessages = pMessages, - .pOutMessageNumberOrResult = pOutMessageNumberOrResult, - }; - TRACE("%p\n", _this); - cppISteamNetworkingSockets_SteamNetworkingSockets006_SendMessages( ¶ms ); -} - uint32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets006_FlushMessagesOnConnection(struct w_steam_iface *_this, uint32_t hConn) { struct cppISteamNetworkingSockets_SteamNetworkingSockets006_FlushMessagesOnConnection_params params = @@ -1108,34 +1095,6 @@ uint32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets006_FlushMe return params._ret; } -int32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnConnection(struct w_steam_iface *_this, uint32_t hConn, w_SteamNetworkingMessage_t_147 **ppOutMessages, int32_t nMaxMessages) -{ - struct cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnConnection_params params = - { - .linux_side = _this->u_iface, - .hConn = hConn, - .ppOutMessages = ppOutMessages, - .nMaxMessages = nMaxMessages, - }; - TRACE("%p\n", _this); - cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnConnection( ¶ms ); - return params._ret; -} - -int32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnListenSocket(struct w_steam_iface *_this, uint32_t hSocket, w_SteamNetworkingMessage_t_147 **ppOutMessages, int32_t nMaxMessages) -{ - struct cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnListenSocket_params params = - { - .linux_side = _this->u_iface, - .hSocket = hSocket, - .ppOutMessages = ppOutMessages, - .nMaxMessages = nMaxMessages, - }; - TRACE("%p\n", _this); - cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnListenSocket( ¶ms ); - return params._ret; -} - bool __thiscall winISteamNetworkingSockets_SteamNetworkingSockets006_GetConnectionInfo(struct w_steam_iface *_this, uint32_t hConn, SteamNetConnectionInfo_t_144 *pInfo) { struct cppISteamNetworkingSockets_SteamNetworkingSockets006_GetConnectionInfo_params params = @@ -1638,19 +1597,6 @@ uint32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets008_SendMes return params._ret; } -void __thiscall winISteamNetworkingSockets_SteamNetworkingSockets008_SendMessages(struct w_steam_iface *_this, int32_t nMessages, w_SteamNetworkingMessage_t_147 *const *pMessages, int64_t *pOutMessageNumberOrResult) -{ - struct cppISteamNetworkingSockets_SteamNetworkingSockets008_SendMessages_params params = - { - .linux_side = _this->u_iface, - .nMessages = nMessages, - .pMessages = pMessages, - .pOutMessageNumberOrResult = pOutMessageNumberOrResult, - }; - TRACE("%p\n", _this); - cppISteamNetworkingSockets_SteamNetworkingSockets008_SendMessages( ¶ms ); -} - uint32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets008_FlushMessagesOnConnection(struct w_steam_iface *_this, uint32_t hConn) { struct cppISteamNetworkingSockets_SteamNetworkingSockets008_FlushMessagesOnConnection_params params = @@ -1663,20 +1609,6 @@ uint32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets008_FlushMe return params._ret; } -int32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnConnection(struct w_steam_iface *_this, uint32_t hConn, w_SteamNetworkingMessage_t_147 **ppOutMessages, int32_t nMaxMessages) -{ - struct cppISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnConnection_params params = - { - .linux_side = _this->u_iface, - .hConn = hConn, - .ppOutMessages = ppOutMessages, - .nMaxMessages = nMaxMessages, - }; - TRACE("%p\n", _this); - cppISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnConnection( ¶ms ); - return params._ret; -} - bool __thiscall winISteamNetworkingSockets_SteamNetworkingSockets008_GetConnectionInfo(struct w_steam_iface *_this, uint32_t hConn, SteamNetConnectionInfo_t_144 *pInfo) { struct cppISteamNetworkingSockets_SteamNetworkingSockets008_GetConnectionInfo_params params = @@ -1817,20 +1749,6 @@ bool __thiscall winISteamNetworkingSockets_SteamNetworkingSockets008_SetConnecti return params._ret; } -int32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnPollGroup(struct w_steam_iface *_this, uint32_t hPollGroup, w_SteamNetworkingMessage_t_147 **ppOutMessages, int32_t nMaxMessages) -{ - struct cppISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnPollGroup_params params = - { - .linux_side = _this->u_iface, - .hPollGroup = hPollGroup, - .ppOutMessages = ppOutMessages, - .nMaxMessages = nMaxMessages, - }; - TRACE("%p\n", _this); - cppISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnPollGroup( ¶ms ); - return params._ret; -} - bool __thiscall winISteamNetworkingSockets_SteamNetworkingSockets008_ReceivedRelayAuthTicket(struct w_steam_iface *_this, const void *pvTicket, int32_t cbTicket, SteamDatagramRelayAuthTicket *pOutParsedTicket) { struct cppISteamNetworkingSockets_SteamNetworkingSockets008_ReceivedRelayAuthTicket_params params = @@ -2263,19 +2181,6 @@ uint32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets009_SendMes return params._ret; } -void __thiscall winISteamNetworkingSockets_SteamNetworkingSockets009_SendMessages(struct w_steam_iface *_this, int32_t nMessages, w_SteamNetworkingMessage_t_147 *const *pMessages, int64_t *pOutMessageNumberOrResult) -{ - struct cppISteamNetworkingSockets_SteamNetworkingSockets009_SendMessages_params params = - { - .linux_side = _this->u_iface, - .nMessages = nMessages, - .pMessages = pMessages, - .pOutMessageNumberOrResult = pOutMessageNumberOrResult, - }; - TRACE("%p\n", _this); - cppISteamNetworkingSockets_SteamNetworkingSockets009_SendMessages( ¶ms ); -} - uint32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets009_FlushMessagesOnConnection(struct w_steam_iface *_this, uint32_t hConn) { struct cppISteamNetworkingSockets_SteamNetworkingSockets009_FlushMessagesOnConnection_params params = @@ -2288,20 +2193,6 @@ uint32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets009_FlushMe return params._ret; } -int32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnConnection(struct w_steam_iface *_this, uint32_t hConn, w_SteamNetworkingMessage_t_147 **ppOutMessages, int32_t nMaxMessages) -{ - struct cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnConnection_params params = - { - .linux_side = _this->u_iface, - .hConn = hConn, - .ppOutMessages = ppOutMessages, - .nMaxMessages = nMaxMessages, - }; - TRACE("%p\n", _this); - cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnConnection( ¶ms ); - return params._ret; -} - bool __thiscall winISteamNetworkingSockets_SteamNetworkingSockets009_GetConnectionInfo(struct w_steam_iface *_this, uint32_t hConn, SteamNetConnectionInfo_t_144 *pInfo) { struct cppISteamNetworkingSockets_SteamNetworkingSockets009_GetConnectionInfo_params params = @@ -2442,20 +2333,6 @@ bool __thiscall winISteamNetworkingSockets_SteamNetworkingSockets009_SetConnecti return params._ret; } -int32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnPollGroup(struct w_steam_iface *_this, uint32_t hPollGroup, w_SteamNetworkingMessage_t_147 **ppOutMessages, int32_t nMaxMessages) -{ - struct cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnPollGroup_params params = - { - .linux_side = _this->u_iface, - .hPollGroup = hPollGroup, - .ppOutMessages = ppOutMessages, - .nMaxMessages = nMaxMessages, - }; - TRACE("%p\n", _this); - cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnPollGroup( ¶ms ); - return params._ret; -} - bool __thiscall winISteamNetworkingSockets_SteamNetworkingSockets009_ReceivedRelayAuthTicket(struct w_steam_iface *_this, const void *pvTicket, int32_t cbTicket, SteamDatagramRelayAuthTicket *pOutParsedTicket) { struct cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceivedRelayAuthTicket_params params = diff --git a/lsteamclient/winISteamNetworkingUtils.c b/lsteamclient/winISteamNetworkingUtils.c index e0be7283..a9364834 100644 --- a/lsteamclient/winISteamNetworkingUtils.c +++ b/lsteamclient/winISteamNetworkingUtils.c @@ -712,18 +712,6 @@ DEFINE_THISCALL_WRAPPER(winISteamNetworkingUtils_SteamNetworkingUtils003_SteamNe DEFINE_THISCALL_WRAPPER(winISteamNetworkingUtils_SteamNetworkingUtils003_SteamNetworkingIdentity_ParseString, 12) DEFINE_THISCALL_WRAPPER(winISteamNetworkingUtils_SteamNetworkingUtils003_destructor, 4) -w_SteamNetworkingMessage_t_147 * __thiscall winISteamNetworkingUtils_SteamNetworkingUtils003_AllocateMessage(struct w_steam_iface *_this, int32_t cbAllocateBuffer) -{ - struct cppISteamNetworkingUtils_SteamNetworkingUtils003_AllocateMessage_params params = - { - .linux_side = _this->u_iface, - .cbAllocateBuffer = cbAllocateBuffer, - }; - TRACE("%p\n", _this); - cppISteamNetworkingUtils_SteamNetworkingUtils003_AllocateMessage( ¶ms ); - return params._ret; -} - uint32_t __thiscall winISteamNetworkingUtils_SteamNetworkingUtils003_GetRelayNetworkStatus(struct w_steam_iface *_this, SteamRelayNetworkStatus_t *pDetails) { struct cppISteamNetworkingUtils_SteamNetworkingUtils003_GetRelayNetworkStatus_params params =