lsteamclient: Rewrite SteamNetworkingMessage_t_153a unix thunks.

CW-Bug-Id: #22729
This commit is contained in:
Rémi Bernon 2023-10-02 14:50:49 +02:00 committed by Arkadiusz Hiler
parent fa9ded4baf
commit 05f84c8595
11 changed files with 421 additions and 265 deletions

View file

@ -215,8 +215,6 @@ SOURCES = \
cppISteamUserStats_STEAMUSERSTATS_INTERFACE_VERSION012.cpp \
cppISteamVideo_STEAMVIDEO_INTERFACE_V001.cpp \
cppISteamVideo_STEAMVIDEO_INTERFACE_V002.cpp \
steamclient_manual_150.cpp \
steamclient_manual_153a.cpp \
steamclient_manual_common.cpp \
struct_converters_111x.cpp \
struct_converters_112.cpp \

View file

@ -204,15 +204,15 @@ 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 <= 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,
"ISteamNetworkingSockets_ReceiveMessagesOnConnection": True,
"ISteamNetworkingSockets_ReceiveMessagesOnListenSocket": True,
"ISteamNetworkingSockets_ReceiveMessagesOnPollGroup": True,
"ISteamNetworkingSockets_SendMessages": True,
"ISteamNetworkingUtils_AllocateMessage": lambda ver, abi: abi == 'u' or ver <= 3,
"ISteamNetworkingUtils_AllocateMessage": True,
"ISteamNetworkingUtils_SetConfigValue": lambda ver, abi: abi == 'u' and ver >= 3,
"ISteamNetworkingMessages_ReceiveMessagesOnChannel": lambda ver, abi: abi == 'u',
"ISteamNetworkingMessages_ReceiveMessagesOnChannel": True,
"ISteamInput_EnableActionEventCallbacks": lambda ver, abi: abi == 'u',
"ISteamInput_GetGlyphForActionOrigin": True,
@ -225,7 +225,7 @@ MANUAL_METHODS = {
"ISteamController_GetGlyphForXboxOrigin": True,
"ISteamNetworkingFakeUDPPort_DestroyFakeUDPPort": lambda ver, abi: abi == 'w',
"ISteamNetworkingFakeUDPPort_ReceiveMessages": lambda ver, abi: abi == 'u',
"ISteamNetworkingFakeUDPPort_ReceiveMessages": True,
"ISteamClient_BShutdownIfAllPipesClosed": lambda ver, abi: abi == 'w',
"ISteamClient_CreateSteamPipe": lambda ver, abi: abi == 'w',

View file

@ -1,12 +1,15 @@
#include "steamclient_private.h"
#include "cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001.h"
#include "cppISteamNetworkingMessages_SteamNetworkingMessages002.h"
#include "cppISteamNetworkingSockets_SteamNetworkingSockets002.h"
#include "cppISteamNetworkingSockets_SteamNetworkingSockets004.h"
#include "cppISteamNetworkingSockets_SteamNetworkingSockets006.h"
#include "cppISteamNetworkingSockets_SteamNetworkingSockets008.h"
#include "cppISteamNetworkingSockets_SteamNetworkingSockets009.h"
#include "cppISteamNetworkingSockets_SteamNetworkingSockets012.h"
#include "cppISteamNetworkingUtils_SteamNetworkingUtils003.h"
#include "cppISteamNetworkingUtils_SteamNetworkingUtils004.h"
WINE_DEFAULT_DEBUG_CHANNEL(steamclient);
@ -173,6 +176,72 @@ static bool networking_message_pool_receive_147( uint32_t capacity, uint32_t cou
return true;
}
static void W_STDCALL w_SteamNetworkingMessage_t_153a_FreeData( w_SteamNetworkingMessage_t_153a *msg )
{
struct networking_message *message = CONTAINING_RECORD( msg, struct networking_message, w_msg_153a );
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_153a_Release( w_SteamNetworkingMessage_t_153a *msg )
{
struct networking_message *message = CONTAINING_RECORD( msg, struct networking_message, w_msg_153a );
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_153a( msg );
HeapFree( GetProcessHeap(), 0, message );
}
}
static w_SteamNetworkingMessage_t_153a *networking_message_init_153a( struct networking_message *message,
struct networking_message_pool *pool )
{
message->pool = pool;
message->p_data = &message->w_msg_153a.m_pData;
message->p_size = (uint32_t *)&message->w_msg_153a.m_cbSize;
message->w_msg_153a.m_pfnFreeData = w_SteamNetworkingMessage_t_153a_FreeData;
message->w_msg_153a.m_pfnRelease = w_SteamNetworkingMessage_t_153a_Release;
return &message->w_msg_153a;
}
static bool networking_message_pool_create_153a( uint32_t count, w_SteamNetworkingMessage_t_153a **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_153a( &pool->messages[count], pool );
return true;
}
static bool networking_message_pool_receive_153a( uint32_t capacity, uint32_t count, w_SteamNetworkingMessage_t_153a **messages )
{
struct networking_message_pool *pool = CONTAINING_RECORD( messages[0], struct networking_message, w_msg_153a )->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_153a( count, messages );
}
return true;
}
/* ISteamNetworkingSockets_SteamNetworkingSockets002 */
int32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_ReceiveMessagesOnConnection( struct w_steam_iface *_this,
@ -479,3 +548,135 @@ void __thiscall winISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_Des
cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_DestroyFakeUDPPort( &params );
HeapFree( GetProcessHeap(), 0, _this );
}
int32_t __thiscall winISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_ReceiveMessages( struct w_steam_iface *_this,
w_SteamNetworkingMessage_t_153a **ppOutMessages,
int32_t nMaxMessages )
{
struct cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_ReceiveMessages_params params =
{
.linux_side = _this->u_iface,
.ppOutMessages = ppOutMessages,
.nMaxMessages = nMaxMessages,
};
TRACE( "%p\n", _this );
if (!networking_message_pool_create_153a( nMaxMessages, params.ppOutMessages )) return 0;
cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_ReceiveMessages( &params );
if (!networking_message_pool_receive_153a( nMaxMessages, params._ret, params.ppOutMessages )) return 0;
return params._ret;
}
/* ISteamNetworkingMessages_SteamNetworkingMessages002 */
int32_t __thiscall winISteamNetworkingMessages_SteamNetworkingMessages002_ReceiveMessagesOnChannel( struct w_steam_iface *_this, int32_t nLocalChannel,
w_SteamNetworkingMessage_t_153a **ppOutMessages,
int32_t nMaxMessages )
{
struct cppISteamNetworkingMessages_SteamNetworkingMessages002_ReceiveMessagesOnChannel_params params =
{
.linux_side = _this->u_iface,
.nLocalChannel = nLocalChannel,
.ppOutMessages = ppOutMessages,
.nMaxMessages = nMaxMessages,
};
TRACE( "%p\n", _this );
if (!networking_message_pool_create_153a( nMaxMessages, params.ppOutMessages )) return 0;
cppISteamNetworkingMessages_SteamNetworkingMessages002_ReceiveMessagesOnChannel( &params );
if (!networking_message_pool_receive_153a( nMaxMessages, params._ret, params.ppOutMessages )) return 0;
return params._ret;
}
/* ISteamNetworkingSockets_SteamNetworkingSockets012 */
int32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets012_ReceiveMessagesOnConnection( struct w_steam_iface *_this,
uint32_t hConn, w_SteamNetworkingMessage_t_153a **ppOutMessages,
int32_t nMaxMessages )
{
struct cppISteamNetworkingSockets_SteamNetworkingSockets012_ReceiveMessagesOnConnection_params params =
{
.linux_side = _this->u_iface,
.hConn = hConn,
.ppOutMessages = ppOutMessages,
.nMaxMessages = nMaxMessages,
};
TRACE( "%p\n", _this );
if (!networking_message_pool_create_153a( nMaxMessages, params.ppOutMessages )) return 0;
cppISteamNetworkingSockets_SteamNetworkingSockets012_ReceiveMessagesOnConnection( &params );
if (!networking_message_pool_receive_153a( nMaxMessages, params._ret, params.ppOutMessages )) return 0;
return params._ret;
}
int32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets012_ReceiveMessagesOnPollGroup( struct w_steam_iface *_this, uint32_t hPollGroup,
w_SteamNetworkingMessage_t_153a **ppOutMessages,
int32_t nMaxMessages )
{
struct cppISteamNetworkingSockets_SteamNetworkingSockets012_ReceiveMessagesOnPollGroup_params params =
{
.linux_side = _this->u_iface,
.hPollGroup = hPollGroup,
.ppOutMessages = ppOutMessages,
.nMaxMessages = nMaxMessages,
};
TRACE( "%p\n", _this );
if (!networking_message_pool_create_153a( nMaxMessages, params.ppOutMessages )) return 0;
cppISteamNetworkingSockets_SteamNetworkingSockets012_ReceiveMessagesOnPollGroup( &params );
if (!networking_message_pool_receive_153a( nMaxMessages, params._ret, params.ppOutMessages )) return 0;
return params._ret;
}
/* ISteamNetworkingUtils_SteamNetworkingUtils004 */
void __thiscall winISteamNetworkingSockets_SteamNetworkingSockets012_SendMessages(struct w_steam_iface *_this, int32_t nMessages, w_SteamNetworkingMessage_t_153a *const *pMessages, int64_t *pOutMessageNumberOrResult)
{
struct cppISteamNetworkingSockets_SteamNetworkingSockets012_SendMessages_params params =
{
.linux_side = _this->u_iface,
.nMessages = nMessages,
.pMessages = pMessages,
.pOutMessageNumberOrResult = pOutMessageNumberOrResult,
};
int64_t i;
TRACE("%p\n", _this);
cppISteamNetworkingSockets_SteamNetworkingSockets012_SendMessages( &params );
for (i = 0; i < nMessages; i++) pMessages[i]->m_pfnRelease( pMessages[i] );
}
w_SteamNetworkingMessage_t_153a *__thiscall winISteamNetworkingUtils_SteamNetworkingUtils004_AllocateMessage( struct w_steam_iface *_this, int32_t cbAllocateBuffer )
{
struct cppISteamNetworkingUtils_SteamNetworkingUtils004_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_153a.m_cbSize = cbAllocateBuffer) &&
!(message->w_msg_153a.m_pData = HeapAlloc( GetProcessHeap(), 0, cbAllocateBuffer )))
{
HeapFree( GetProcessHeap(), 0, message );
return NULL;
}
message->w_msg_153a.m_pfnFreeData = w_SteamNetworkingMessage_t_153a_FreeData;
message->w_msg_153a.m_pfnRelease = w_SteamNetworkingMessage_t_153a_Release;
params._ret = &message->w_msg_153a;
cppISteamNetworkingUtils_SteamNetworkingUtils004_AllocateMessage( &params );
return params._ret;
}

View file

@ -1,18 +0,0 @@
#include "unix_private.h"
extern "C" {
#define SDKVER_157
#define SDK_VERSION 1500
#include "steamclient_manual_common.h"
}
#include "cppISteamNetworkingMessages_SteamNetworkingMessages002.hpp"
void cppISteamNetworkingMessages_SteamNetworkingMessages002_ReceiveMessagesOnChannel( struct cppISteamNetworkingMessages_SteamNetworkingMessages002_ReceiveMessagesOnChannel_params *params )
{
struct u_ISteamNetworkingMessages_SteamNetworkingMessages002 *iface = (struct u_ISteamNetworkingMessages_SteamNetworkingMessages002 *)params->linux_side;
u_SteamNetworkingMessage_t_153a *u_ppOutMessages[params->nMaxMessages];
params->_ret = iface->ReceiveMessagesOnChannel( params->nLocalChannel, u_ppOutMessages, params->nMaxMessages );
lin_to_win_struct_SteamNetworkingMessage_t( params->_ret, u_ppOutMessages,
params->ppOutMessages, params->nMaxMessages );
}

View file

@ -1,158 +0,0 @@
#include "unix_private.h"
extern "C" {
#include "win_constructors.h"
#define SDK_VERSION 1531
#include "steamclient_manual_common.h"
}
#include "cppISteamNetworkingUtils_SteamNetworkingUtils004.hpp"
#include "cppISteamNetworkingSockets_SteamNetworkingSockets012.hpp"
#include "cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001.hpp"
WINE_DEFAULT_DEBUG_CHANNEL(steamclient);
void cppISteamNetworkingSockets_SteamNetworkingSockets012_ReceiveMessagesOnConnection( struct cppISteamNetworkingSockets_SteamNetworkingSockets012_ReceiveMessagesOnConnection_params *params )
{
struct u_ISteamNetworkingSockets_SteamNetworkingSockets012 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets012 *)params->linux_side;
u_SteamNetworkingMessage_t_153a *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_SteamNetworkingSockets012_ReceiveMessagesOnPollGroup( struct cppISteamNetworkingSockets_SteamNetworkingSockets012_ReceiveMessagesOnPollGroup_params *params )
{
struct u_ISteamNetworkingSockets_SteamNetworkingSockets012 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets012 *)params->linux_side;
u_SteamNetworkingMessage_t_153a *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_SteamNetworkingSockets012_SendMessages( struct cppISteamNetworkingSockets_SteamNetworkingSockets012_SendMessages_params *params )
{
#define MAX_SEND_MESSAGES 64
struct u_ISteamNetworkingSockets_SteamNetworkingSockets012 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets012 *)params->linux_side;
/* use the stack to avoid heap allocation */
u_SteamNetworkingMessage_t_153a *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_153a *)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;
}
}
void cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_ReceiveMessages( struct cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_ReceiveMessages_params *params )
{
struct u_ISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001 *iface = (struct u_ISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001 *)params->linux_side;
u_SteamNetworkingMessage_t_153a *u_ppOutMessages[params->nMaxMessages];
params->_ret = iface->ReceiveMessages( u_ppOutMessages, params->nMaxMessages );
lin_to_win_struct_SteamNetworkingMessage_t( params->_ret, u_ppOutMessages,
params->ppOutMessages, params->nMaxMessages );
}
typedef void (*CDECL win_FnSteamNetConnectionStatusChanged)( w_SteamNetConnectionStatusChangedCallback_t_153a * );
static win_FnSteamNetConnectionStatusChanged win_SteamNetConnectionStatusChanged;
static void lin_SteamNetConnectionStatusChanged( u_SteamNetConnectionStatusChangedCallback_t_153a *u_dat )
{
win_FnSteamNetConnectionStatusChanged fn = win_SteamNetConnectionStatusChanged;
if (fn)
{
w_SteamNetConnectionStatusChangedCallback_t_153a 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_153a * );
static win_FnSteamNetworkingMessagesSessionFailed win_SteamNetworkingMessagesSessionFailed;
static void lin_SteamNetworkingMessagesSessionFailed( SteamNetworkingMessagesSessionFailed_t_153a *dat )
{
win_FnSteamNetworkingMessagesSessionFailed fn = win_SteamNetworkingMessagesSessionFailed;
if (fn) fn( dat );
}
void cppISteamNetworkingUtils_SteamNetworkingUtils004_SetConfigValue( struct cppISteamNetworkingUtils_SteamNetworkingUtils004_SetConfigValue_params *params )
{
struct u_ISteamNetworkingUtils_SteamNetworkingUtils004 *iface = (struct u_ISteamNetworkingUtils_SteamNetworkingUtils004 *)params->linux_side;
bool ret;
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 );
}
}
void cppISteamNetworkingUtils_SteamNetworkingUtils004_AllocateMessage( struct cppISteamNetworkingUtils_SteamNetworkingUtils004_AllocateMessage_params *params )
{
struct u_ISteamNetworkingUtils_SteamNetworkingUtils004 *iface = (struct u_ISteamNetworkingUtils_SteamNetworkingUtils004 *)params->linux_side;
u_SteamNetworkingMessage_t_153a *u_ret = iface->AllocateMessage( params->cbAllocateBuffer );
params->_ret = (w_SteamNetworkingMessage_t_153a *)network_message_lin_to_win( u_ret );
}

View file

@ -2,12 +2,16 @@
#include <stdlib.h>
#include "cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001.hpp"
#include "cppISteamNetworkingMessages_SteamNetworkingMessages002.hpp"
#include "cppISteamNetworkingSockets_SteamNetworkingSockets002.hpp"
#include "cppISteamNetworkingSockets_SteamNetworkingSockets004.hpp"
#include "cppISteamNetworkingSockets_SteamNetworkingSockets006.hpp"
#include "cppISteamNetworkingSockets_SteamNetworkingSockets008.hpp"
#include "cppISteamNetworkingSockets_SteamNetworkingSockets009.hpp"
#include "cppISteamNetworkingSockets_SteamNetworkingSockets012.hpp"
#include "cppISteamNetworkingUtils_SteamNetworkingUtils003.hpp"
#include "cppISteamNetworkingUtils_SteamNetworkingUtils004.hpp"
static void receive_messages_utow_144( uint32_t count, u_SteamNetworkingMessage_t_144 **u_msgs,
w_SteamNetworkingMessage_t_144 **w_msgs )
@ -339,3 +343,208 @@ void cppISteamNetworkingUtils_SteamNetworkingUtils003_SetConfigValue( struct cpp
params->eDataType, params->pArg );
}
}
static void receive_messages_utow_153a( uint32_t count, u_SteamNetworkingMessage_t_153a **u_msgs,
w_SteamNetworkingMessage_t_153a **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_153a );
w_SteamNetworkingMessage_t_153a *w_msg = &message->w_msg_153a;
u_SteamNetworkingMessage_t_153a *u_msg = u_msgs[i];
message->u_msg_153a = 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;
w_msg->m_idxLane = u_msg->m_idxLane;
}
}
void unix_networking_messages_receive_153a( uint32_t count, w_SteamNetworkingMessage_t_153a **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_153a );
w_SteamNetworkingMessage_t_153a *w_msg = &message->w_msg_153a;
u_SteamNetworkingMessage_t_153a *u_msg = message->u_msg_153a;
memcpy( w_msg->m_pData, u_msg->m_pData, u_msg->m_cbSize );
u_msg->m_pfnRelease( u_msg );
message->u_msg_153a = NULL;
}
}
static void U_STDCALL u_SteamNetworkingMessage_t_153a_FreeData( u_SteamNetworkingMessage_t_153a *msg )
{
free( msg->m_pData );
msg->m_pData = NULL;
}
static void send_messages_wtou_153a( uint32_t count, w_SteamNetworkingMessage_t_153a *const *w_msgs,
u_SteamNetworkingMessage_t_153a **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_153a );
w_SteamNetworkingMessage_t_153a *w_msg = &message->w_msg_153a;
u_SteamNetworkingMessage_t_153a *u_msg = message->u_msg_153a;
if (!u_msg->m_pData)
{
u_msg->m_pData = malloc( w_msg->m_cbSize );
u_msg->m_pfnFreeData = u_SteamNetworkingMessage_t_153a_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;
u_msg->m_idxLane = w_msg->m_idxLane;
/* steamclient library takes ownership */
message->u_msg_153a = NULL;
u_msgs[i] = u_msg;
}
}
void unix_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;
if (!message->u_msg_153a) return;
u_msg->m_pfnRelease( u_msg );
message->u_msg_153a = NULL;
}
/* ISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001 */
void cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_ReceiveMessages( struct cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_ReceiveMessages_params *params )
{
struct u_ISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001 *iface = (struct u_ISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001 *)params->linux_side;
u_SteamNetworkingMessage_t_153a *u_msgs[params->nMaxMessages];
params->_ret = iface->ReceiveMessages( u_msgs, params->nMaxMessages );
if (params->_ret > 0) receive_messages_utow_153a( params->_ret, u_msgs, params->ppOutMessages );
}
/* ISteamNetworkingMessages_SteamNetworkingMessages002 */
void cppISteamNetworkingMessages_SteamNetworkingMessages002_ReceiveMessagesOnChannel( struct cppISteamNetworkingMessages_SteamNetworkingMessages002_ReceiveMessagesOnChannel_params *params )
{
struct u_ISteamNetworkingMessages_SteamNetworkingMessages002 *iface = (struct u_ISteamNetworkingMessages_SteamNetworkingMessages002 *)params->linux_side;
u_SteamNetworkingMessage_t_153a *u_msgs[params->nMaxMessages];
params->_ret = iface->ReceiveMessagesOnChannel( params->nLocalChannel, u_msgs, params->nMaxMessages );
if (params->_ret > 0) receive_messages_utow_153a( params->_ret, u_msgs, params->ppOutMessages );
}
/* ISteamNetworkingSockets_SteamNetworkingSockets012 */
void cppISteamNetworkingSockets_SteamNetworkingSockets012_ReceiveMessagesOnConnection( struct cppISteamNetworkingSockets_SteamNetworkingSockets012_ReceiveMessagesOnConnection_params *params )
{
struct u_ISteamNetworkingSockets_SteamNetworkingSockets012 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets012 *)params->linux_side;
u_SteamNetworkingMessage_t_153a *u_msgs[params->nMaxMessages];
params->_ret = iface->ReceiveMessagesOnConnection( params->hConn, u_msgs, params->nMaxMessages );
if (params->_ret > 0) receive_messages_utow_153a( params->_ret, u_msgs, params->ppOutMessages );
}
void cppISteamNetworkingSockets_SteamNetworkingSockets012_ReceiveMessagesOnPollGroup( struct cppISteamNetworkingSockets_SteamNetworkingSockets012_ReceiveMessagesOnPollGroup_params *params )
{
struct u_ISteamNetworkingSockets_SteamNetworkingSockets012 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets012 *)params->linux_side;
u_SteamNetworkingMessage_t_153a *u_msgs[params->nMaxMessages];
params->_ret = iface->ReceiveMessagesOnPollGroup( params->hPollGroup, u_msgs, params->nMaxMessages );
if (params->_ret > 0) receive_messages_utow_153a( params->_ret, u_msgs, params->ppOutMessages );
}
void cppISteamNetworkingSockets_SteamNetworkingSockets012_SendMessages( struct cppISteamNetworkingSockets_SteamNetworkingSockets012_SendMessages_params *params )
{
struct u_ISteamNetworkingSockets_SteamNetworkingSockets012 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets012 *)params->linux_side;
u_SteamNetworkingMessage_t_153a *u_msgs[params->nMessages];
send_messages_wtou_153a( params->nMessages, params->pMessages, u_msgs );
iface->SendMessages( params->nMessages, u_msgs, params->pOutMessageNumberOrResult );
}
/* ISteamNetworkingUtils_SteamNetworkingUtils004 */
void cppISteamNetworkingUtils_SteamNetworkingUtils004_AllocateMessage( struct cppISteamNetworkingUtils_SteamNetworkingUtils004_AllocateMessage_params *params )
{
struct u_ISteamNetworkingUtils_SteamNetworkingUtils004 *iface = (struct u_ISteamNetworkingUtils_SteamNetworkingUtils004 *)params->linux_side;
u_SteamNetworkingMessage_t_153a *u_msg = iface->AllocateMessage( params->cbAllocateBuffer );
if (u_msg) receive_messages_utow_153a( 1, &u_msg, &params->_ret );
}
typedef void (*CDECL win_FnSteamNetConnectionStatusChanged_153a)( w_SteamNetConnectionStatusChangedCallback_t_153a * );
static win_FnSteamNetConnectionStatusChanged_153a win_SteamNetConnectionStatusChanged_153a;
static void lin_SteamNetConnectionStatusChanged_153a( u_SteamNetConnectionStatusChangedCallback_t_153a *u_dat )
{
win_FnSteamNetConnectionStatusChanged_153a fn = win_SteamNetConnectionStatusChanged_153a;
if (fn)
{
w_SteamNetConnectionStatusChangedCallback_t_153a w_dat = *u_dat;
fn( &w_dat );
}
}
typedef void (*CDECL win_FnSteamNetworkingMessagesSessionFailed_153a)( SteamNetworkingMessagesSessionFailed_t_153a * );
static win_FnSteamNetworkingMessagesSessionFailed_153a win_SteamNetworkingMessagesSessionFailed_153a;
static void lin_SteamNetworkingMessagesSessionFailed_153a( SteamNetworkingMessagesSessionFailed_t_153a *dat )
{
win_FnSteamNetworkingMessagesSessionFailed_153a fn = win_SteamNetworkingMessagesSessionFailed_153a;
if (fn) fn( dat );
}
void cppISteamNetworkingUtils_SteamNetworkingUtils004_SetConfigValue( struct cppISteamNetworkingUtils_SteamNetworkingUtils004_SetConfigValue_params *params )
{
struct u_ISteamNetworkingUtils_SteamNetworkingUtils004 *iface = (struct u_ISteamNetworkingUtils_SteamNetworkingUtils004 *)params->linux_side;
bool ret;
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_153a )
case 202 /*AuthStatusChanged*/: CASE( SteamNetAuthenticationStatusChanged )
case 203 /*RelayNetworkStatusChanged*/: CASE( SteamRelayNetworkStatusChanged )
case 204 /*MessagesSessionRequest*/: CASE( SteamNetworkingMessagesSessionRequest )
case 205 /*MessagesSessionFailed*/: CASE( SteamNetworkingMessagesSessionFailed_153a )
#undef CASE
default:
params->_ret = iface->SetConfigValue( params->eValue, params->eScopeType, params->scopeObj,
params->eDataType, params->pArg );
}
}

View file

@ -78,17 +78,21 @@ struct networking_message
{
u_SteamNetworkingMessage_t_144 *u_msg_144;
u_SteamNetworkingMessage_t_147 *u_msg_147;
u_SteamNetworkingMessage_t_153a *u_msg_153a;
};
union
{
w_SteamNetworkingMessage_t_144 w_msg_144;
w_SteamNetworkingMessage_t_147 w_msg_147;
w_SteamNetworkingMessage_t_153a w_msg_153a;
};
};
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 );
#endif
#ifdef __cplusplus

View file

@ -25,19 +25,6 @@ uint32_t __thiscall winISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001
return params._ret;
}
int32_t __thiscall winISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_ReceiveMessages(struct w_steam_iface *_this, w_SteamNetworkingMessage_t_153a **ppOutMessages, int32_t nMaxMessages)
{
struct cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_ReceiveMessages_params params =
{
.linux_side = _this->u_iface,
.ppOutMessages = ppOutMessages,
.nMaxMessages = nMaxMessages,
};
TRACE("%p\n", _this);
cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_ReceiveMessages( &params );
return params._ret;
}
void __thiscall winISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_ScheduleCleanup(struct w_steam_iface *_this, const SteamNetworkingIPAddr *remoteAddress)
{
struct cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_ScheduleCleanup_params params =

View file

@ -28,20 +28,6 @@ uint32_t __thiscall winISteamNetworkingMessages_SteamNetworkingMessages002_SendM
return params._ret;
}
int32_t __thiscall winISteamNetworkingMessages_SteamNetworkingMessages002_ReceiveMessagesOnChannel(struct w_steam_iface *_this, int32_t nLocalChannel, w_SteamNetworkingMessage_t_153a **ppOutMessages, int32_t nMaxMessages)
{
struct cppISteamNetworkingMessages_SteamNetworkingMessages002_ReceiveMessagesOnChannel_params params =
{
.linux_side = _this->u_iface,
.nLocalChannel = nLocalChannel,
.ppOutMessages = ppOutMessages,
.nMaxMessages = nMaxMessages,
};
TRACE("%p\n", _this);
cppISteamNetworkingMessages_SteamNetworkingMessages002_ReceiveMessagesOnChannel( &params );
return params._ret;
}
bool __thiscall winISteamNetworkingMessages_SteamNetworkingMessages002_AcceptSessionWithUser(struct w_steam_iface *_this, const SteamNetworkingIdentity_144 *identityRemote)
{
struct cppISteamNetworkingMessages_SteamNetworkingMessages002_AcceptSessionWithUser_params params =

View file

@ -2784,19 +2784,6 @@ uint32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets012_SendMes
return params._ret;
}
void __thiscall winISteamNetworkingSockets_SteamNetworkingSockets012_SendMessages(struct w_steam_iface *_this, int32_t nMessages, w_SteamNetworkingMessage_t_153a *const *pMessages, int64_t *pOutMessageNumberOrResult)
{
struct cppISteamNetworkingSockets_SteamNetworkingSockets012_SendMessages_params params =
{
.linux_side = _this->u_iface,
.nMessages = nMessages,
.pMessages = pMessages,
.pOutMessageNumberOrResult = pOutMessageNumberOrResult,
};
TRACE("%p\n", _this);
cppISteamNetworkingSockets_SteamNetworkingSockets012_SendMessages( &params );
}
uint32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets012_FlushMessagesOnConnection(struct w_steam_iface *_this, uint32_t hConn)
{
struct cppISteamNetworkingSockets_SteamNetworkingSockets012_FlushMessagesOnConnection_params params =
@ -2809,20 +2796,6 @@ uint32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets012_FlushMe
return params._ret;
}
int32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets012_ReceiveMessagesOnConnection(struct w_steam_iface *_this, uint32_t hConn, w_SteamNetworkingMessage_t_153a **ppOutMessages, int32_t nMaxMessages)
{
struct cppISteamNetworkingSockets_SteamNetworkingSockets012_ReceiveMessagesOnConnection_params params =
{
.linux_side = _this->u_iface,
.hConn = hConn,
.ppOutMessages = ppOutMessages,
.nMaxMessages = nMaxMessages,
};
TRACE("%p\n", _this);
cppISteamNetworkingSockets_SteamNetworkingSockets012_ReceiveMessagesOnConnection( &params );
return params._ret;
}
bool __thiscall winISteamNetworkingSockets_SteamNetworkingSockets012_GetConnectionInfo(struct w_steam_iface *_this, uint32_t hConn, SteamNetConnectionInfo_t_153a *pInfo)
{
struct cppISteamNetworkingSockets_SteamNetworkingSockets012_GetConnectionInfo_params params =
@ -2980,20 +2953,6 @@ bool __thiscall winISteamNetworkingSockets_SteamNetworkingSockets012_SetConnecti
return params._ret;
}
int32_t __thiscall winISteamNetworkingSockets_SteamNetworkingSockets012_ReceiveMessagesOnPollGroup(struct w_steam_iface *_this, uint32_t hPollGroup, w_SteamNetworkingMessage_t_153a **ppOutMessages, int32_t nMaxMessages)
{
struct cppISteamNetworkingSockets_SteamNetworkingSockets012_ReceiveMessagesOnPollGroup_params params =
{
.linux_side = _this->u_iface,
.hPollGroup = hPollGroup,
.ppOutMessages = ppOutMessages,
.nMaxMessages = nMaxMessages,
};
TRACE("%p\n", _this);
cppISteamNetworkingSockets_SteamNetworkingSockets012_ReceiveMessagesOnPollGroup( &params );
return params._ret;
}
bool __thiscall winISteamNetworkingSockets_SteamNetworkingSockets012_ReceivedRelayAuthTicket(struct w_steam_iface *_this, const void *pvTicket, int32_t cbTicket, SteamDatagramRelayAuthTicket *pOutParsedTicket)
{
struct cppISteamNetworkingSockets_SteamNetworkingSockets012_ReceivedRelayAuthTicket_params params =

View file

@ -1059,18 +1059,6 @@ DEFINE_THISCALL_WRAPPER(winISteamNetworkingUtils_SteamNetworkingUtils004_SteamNe
DEFINE_THISCALL_WRAPPER(winISteamNetworkingUtils_SteamNetworkingUtils004_SteamNetworkingIdentity_ParseString, 12)
DEFINE_THISCALL_WRAPPER(winISteamNetworkingUtils_SteamNetworkingUtils004_destructor, 4)
w_SteamNetworkingMessage_t_153a * __thiscall winISteamNetworkingUtils_SteamNetworkingUtils004_AllocateMessage(struct w_steam_iface *_this, int32_t cbAllocateBuffer)
{
struct cppISteamNetworkingUtils_SteamNetworkingUtils004_AllocateMessage_params params =
{
.linux_side = _this->u_iface,
.cbAllocateBuffer = cbAllocateBuffer,
};
TRACE("%p\n", _this);
cppISteamNetworkingUtils_SteamNetworkingUtils004_AllocateMessage( &params );
return params._ret;
}
uint32_t __thiscall winISteamNetworkingUtils_SteamNetworkingUtils004_GetRelayNetworkStatus(struct w_steam_iface *_this, SteamRelayNetworkStatus_t *pDetails)
{
struct cppISteamNetworkingUtils_SteamNetworkingUtils004_GetRelayNetworkStatus_params params =