2023-09-18 00:16:30 +03:00
|
|
|
#include "steamclient_private.h"
|
2020-09-29 17:19:06 +03:00
|
|
|
|
|
|
|
extern "C" {
|
2020-10-02 20:38:05 +03:00
|
|
|
#include "cb_converters.h"
|
2020-09-29 17:19:06 +03:00
|
|
|
|
2023-09-24 12:11:25 +03:00
|
|
|
#define SDKVER_157
|
2023-08-24 02:27:02 +03:00
|
|
|
#define SDK_VERSION 1500
|
|
|
|
#include "steamclient_manual_common.h"
|
2023-09-24 12:11:25 +03:00
|
|
|
}
|
2020-09-29 17:19:06 +03:00
|
|
|
|
2023-09-24 12:11:25 +03:00
|
|
|
#pragma push_macro( "__cdecl" )
|
|
|
|
#undef __cdecl
|
|
|
|
#pragma push_macro( "strncpy" )
|
|
|
|
#undef strncpy
|
2023-09-27 15:34:23 +03:00
|
|
|
typedef struct SteamNetConnectionRealTimeStatus_t SteamNetConnectionRealTimeStatus_t;
|
2023-09-24 12:11:25 +03:00
|
|
|
typedef struct winSteamNetworkingMessage_t winSteamNetworkingMessage_t_158;
|
|
|
|
#include "cppISteamNetworkingSockets_SteamNetworkingSockets009.hpp"
|
|
|
|
#include "cppISteamNetworkingMessages_SteamNetworkingMessages002.hpp"
|
|
|
|
#include "cppISteamNetworkingUtils_SteamNetworkingUtils003.hpp"
|
|
|
|
#include "cppISteamInput_SteamInput001.hpp"
|
|
|
|
#include "cppISteamController_SteamController007.hpp"
|
|
|
|
#pragma pop_macro( "__cdecl" )
|
|
|
|
#pragma pop_macro( "strncpy" )
|
2023-09-27 15:34:23 +03:00
|
|
|
|
2023-09-18 00:16:30 +03:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(steamclient);
|
|
|
|
|
2023-09-27 15:34:23 +03:00
|
|
|
void cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnConnection( struct cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnConnection_params *params )
|
2020-09-29 17:19:06 +03:00
|
|
|
{
|
2023-09-24 12:11:25 +03:00
|
|
|
struct cppISteamNetworkingSockets_SteamNetworkingSockets009 *iface = (struct cppISteamNetworkingSockets_SteamNetworkingSockets009 *)params->linux_side;
|
2023-09-27 15:34:23 +03:00
|
|
|
SteamNetworkingMessage_t *lin_ppOutMessages[params->nMaxMessages];
|
|
|
|
params->_ret = iface->ReceiveMessagesOnConnection( params->hConn, lin_ppOutMessages, params->nMaxMessages );
|
|
|
|
lin_to_win_struct_SteamNetworkingMessage_t( params->_ret, lin_ppOutMessages,
|
|
|
|
params->ppOutMessages, params->nMaxMessages );
|
2020-09-29 17:19:06 +03:00
|
|
|
}
|
|
|
|
|
2023-09-27 15:34:23 +03:00
|
|
|
void cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnPollGroup( struct cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnPollGroup_params *params )
|
2020-09-29 17:19:06 +03:00
|
|
|
{
|
2023-09-24 12:11:25 +03:00
|
|
|
struct cppISteamNetworkingSockets_SteamNetworkingSockets009 *iface = (struct cppISteamNetworkingSockets_SteamNetworkingSockets009 *)params->linux_side;
|
2023-09-27 15:34:23 +03:00
|
|
|
SteamNetworkingMessage_t *lin_ppOutMessages[params->nMaxMessages];
|
|
|
|
params->_ret = iface->ReceiveMessagesOnPollGroup( params->hPollGroup, lin_ppOutMessages, params->nMaxMessages );
|
|
|
|
lin_to_win_struct_SteamNetworkingMessage_t( params->_ret, lin_ppOutMessages,
|
|
|
|
params->ppOutMessages, params->nMaxMessages );
|
2020-09-29 17:19:06 +03:00
|
|
|
}
|
|
|
|
|
2023-09-27 15:34:23 +03:00
|
|
|
void cppISteamNetworkingSockets_SteamNetworkingSockets009_SendMessages( struct cppISteamNetworkingSockets_SteamNetworkingSockets009_SendMessages_params *params )
|
2020-09-29 17:19:06 +03:00
|
|
|
{
|
|
|
|
#define MAX_SEND_MESSAGES 64
|
2023-09-24 12:11:25 +03:00
|
|
|
struct cppISteamNetworkingSockets_SteamNetworkingSockets009 *iface = (struct cppISteamNetworkingSockets_SteamNetworkingSockets009 *)params->linux_side;
|
2020-09-29 17:19:06 +03:00
|
|
|
/* use the stack to avoid heap allocation */
|
|
|
|
struct SteamNetworkingMessage_t *lin_msgs[MAX_SEND_MESSAGES];
|
|
|
|
int i;
|
|
|
|
|
2023-09-27 15:34:23 +03:00
|
|
|
if (params->nMessages > MAX_SEND_MESSAGES)
|
2020-09-29 17:19:06 +03:00
|
|
|
{
|
|
|
|
/* if we ever hit this, increase MAX_SEND_MESSAGES appropriately */
|
2023-09-27 15:34:23 +03:00
|
|
|
FIXME( "Trying to send %u messages, which is more than %u! Will break up into pieces.\n",
|
|
|
|
params->nMessages, MAX_SEND_MESSAGES );
|
2020-09-29 17:19:06 +03:00
|
|
|
}
|
|
|
|
|
2023-09-27 15:34:23 +03:00
|
|
|
while (params->nMessages)
|
2020-09-29 17:19:06 +03:00
|
|
|
{
|
2023-09-27 15:34:23 +03:00
|
|
|
for (i = 0; i < params->nMessages && i < MAX_SEND_MESSAGES; ++i)
|
|
|
|
lin_msgs[i] = (SteamNetworkingMessage_t *)network_message_win_to_lin( params->pMessages[i] );
|
2020-09-29 17:19:06 +03:00
|
|
|
|
2023-09-24 12:11:25 +03:00
|
|
|
iface->SendMessages( i, lin_msgs, params->pOutMessageNumberOrResult );
|
2020-09-29 17:19:06 +03:00
|
|
|
|
2023-09-27 15:34:23 +03:00
|
|
|
params->nMessages -= i;
|
|
|
|
params->pMessages += i;
|
|
|
|
if (params->pOutMessageNumberOrResult) params->pOutMessageNumberOrResult += i;
|
2020-09-29 17:19:06 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-27 15:34:23 +03:00
|
|
|
void cppISteamNetworkingMessages_SteamNetworkingMessages002_ReceiveMessagesOnChannel( struct cppISteamNetworkingMessages_SteamNetworkingMessages002_ReceiveMessagesOnChannel_params *params )
|
2020-09-29 17:40:02 +03:00
|
|
|
{
|
2023-09-24 12:11:25 +03:00
|
|
|
struct cppISteamNetworkingMessages_SteamNetworkingMessages002 *iface = (struct cppISteamNetworkingMessages_SteamNetworkingMessages002 *)params->linux_side;
|
2023-09-27 15:34:23 +03:00
|
|
|
SteamNetworkingMessage_t *lin_ppOutMessages[params->nMaxMessages];
|
|
|
|
params->_ret = iface->ReceiveMessagesOnChannel( params->nLocalChannel, lin_ppOutMessages, params->nMaxMessages );
|
|
|
|
lin_to_win_struct_SteamNetworkingMessage_t( params->_ret, lin_ppOutMessages,
|
|
|
|
params->ppOutMessages, params->nMaxMessages );
|
2020-09-29 17:40:02 +03:00
|
|
|
}
|
|
|
|
|
2020-10-02 20:38:05 +03:00
|
|
|
#pragma pack( push, 8 )
|
2021-12-20 18:48:44 +03:00
|
|
|
struct winSteamNetConnectionStatusChangedCallback_t_584 {
|
2020-10-02 20:38:05 +03:00
|
|
|
HSteamNetConnection m_hConn;
|
|
|
|
SteamNetConnectionInfo_t m_info __attribute__((aligned(8)));
|
|
|
|
ESteamNetworkingConnectionState m_eOldState;
|
|
|
|
} __attribute__ ((ms_struct));
|
|
|
|
#pragma pack( pop )
|
|
|
|
|
2021-12-20 18:48:44 +03:00
|
|
|
typedef void (*CDECL win_FnSteamNetConnectionStatusChanged)(winSteamNetConnectionStatusChangedCallback_t_584 *);
|
|
|
|
static win_FnSteamNetConnectionStatusChanged win_SteamNetConnectionStatusChanged;
|
2020-10-02 20:38:05 +03:00
|
|
|
|
2021-12-20 18:48:44 +03:00
|
|
|
static void lin_SteamNetConnectionStatusChanged(SteamNetConnectionStatusChangedCallback_t *l_dat)
|
2020-10-02 20:38:05 +03:00
|
|
|
{
|
|
|
|
win_FnSteamNetConnectionStatusChanged fn = win_SteamNetConnectionStatusChanged;
|
|
|
|
if(fn){
|
2021-12-20 18:48:44 +03:00
|
|
|
struct winSteamNetConnectionStatusChangedCallback_t_584 w_dat;
|
|
|
|
cb_SteamNetConnectionStatusChangedCallback_t_584(l_dat, &w_dat);
|
2020-10-02 20:38:05 +03:00
|
|
|
fn(&w_dat);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef void (*CDECL win_FnSteamNetAuthenticationStatusChanged)(SteamNetAuthenticationStatus_t *);
|
|
|
|
win_FnSteamNetAuthenticationStatusChanged win_SteamNetAuthenticationStatusChanged;
|
|
|
|
|
|
|
|
void lin_SteamNetAuthenticationStatusChanged(SteamNetAuthenticationStatus_t *dat)
|
|
|
|
{
|
|
|
|
win_FnSteamNetAuthenticationStatusChanged fn = win_SteamNetAuthenticationStatusChanged;
|
|
|
|
if(fn)
|
|
|
|
fn(dat);
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef void (*CDECL win_FnSteamRelayNetworkStatusChanged)(SteamRelayNetworkStatus_t *);
|
|
|
|
win_FnSteamRelayNetworkStatusChanged win_SteamRelayNetworkStatusChanged;
|
|
|
|
|
|
|
|
void lin_SteamRelayNetworkStatusChanged(SteamRelayNetworkStatus_t *dat)
|
|
|
|
{
|
|
|
|
win_FnSteamRelayNetworkStatusChanged fn = win_SteamRelayNetworkStatusChanged;
|
|
|
|
if(fn)
|
|
|
|
fn(dat);
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef void (*CDECL win_FnSteamNetworkingMessagesSessionRequest)(SteamNetworkingMessagesSessionRequest_t *);
|
|
|
|
win_FnSteamNetworkingMessagesSessionRequest win_SteamNetworkingMessagesSessionRequest;
|
|
|
|
|
|
|
|
void lin_SteamNetworkingMessagesSessionRequest(SteamNetworkingMessagesSessionRequest_t *dat)
|
|
|
|
{
|
|
|
|
win_FnSteamNetworkingMessagesSessionRequest fn = win_SteamNetworkingMessagesSessionRequest;
|
|
|
|
if(fn)
|
|
|
|
fn(dat);
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef void (*CDECL win_FnSteamNetworkingMessagesSessionFailed)(SteamNetworkingMessagesSessionFailed_t *);
|
|
|
|
win_FnSteamNetworkingMessagesSessionFailed win_SteamNetworkingMessagesSessionFailed;
|
|
|
|
|
|
|
|
void lin_SteamNetworkingMessagesSessionFailed(SteamNetworkingMessagesSessionFailed_t *dat)
|
|
|
|
{
|
|
|
|
win_FnSteamNetworkingMessagesSessionFailed fn = win_SteamNetworkingMessagesSessionFailed;
|
|
|
|
if(fn)
|
|
|
|
fn(dat);
|
|
|
|
}
|
|
|
|
|
2023-09-24 12:11:25 +03:00
|
|
|
void cppISteamNetworkingUtils_SteamNetworkingUtils003_AllocateMessage( struct cppISteamNetworkingUtils_SteamNetworkingUtils003_AllocateMessage_params *params )
|
|
|
|
{
|
|
|
|
struct cppISteamNetworkingUtils_SteamNetworkingUtils003 *iface = (struct cppISteamNetworkingUtils_SteamNetworkingUtils003 *)params->linux_side;
|
|
|
|
params->_ret = (winSteamNetworkingMessage_t_152 *)iface->AllocateMessage( params->cbAllocateBuffer );
|
|
|
|
params->_ret = (winSteamNetworkingMessage_t_152 *)network_message_lin_to_win( params->_ret );
|
|
|
|
}
|
|
|
|
|
2023-09-27 15:34:23 +03:00
|
|
|
void cppISteamNetworkingUtils_SteamNetworkingUtils003_SetConfigValue( struct cppISteamNetworkingUtils_SteamNetworkingUtils003_SetConfigValue_params *params )
|
2020-10-02 20:38:05 +03:00
|
|
|
{
|
2023-09-24 12:11:25 +03:00
|
|
|
struct cppISteamNetworkingUtils_SteamNetworkingUtils003 *iface = (struct cppISteamNetworkingUtils_SteamNetworkingUtils003 *)params->linux_side;
|
2020-10-02 20:38:05 +03:00
|
|
|
void *lin_fn; /* api requires passing pointer-to-pointer */
|
|
|
|
|
2023-09-27 15:34:23 +03:00
|
|
|
switch (params->eValue)
|
|
|
|
{
|
|
|
|
|
2023-09-24 12:11:25 +03:00
|
|
|
#define CASE( x, y ) \
|
|
|
|
case k_ESteamNetworkingConfig_Callback_##x: \
|
|
|
|
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; \
|
2023-09-27 15:34:23 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
CASE( ConnectionStatusChanged, SteamNetConnectionStatusChanged )
|
|
|
|
CASE( AuthStatusChanged, SteamNetAuthenticationStatusChanged )
|
|
|
|
CASE( RelayNetworkStatusChanged, SteamRelayNetworkStatusChanged )
|
|
|
|
CASE( MessagesSessionRequest, SteamNetworkingMessagesSessionRequest )
|
|
|
|
CASE( MessagesSessionFailed, SteamNetworkingMessagesSessionFailed )
|
2020-10-02 20:38:05 +03:00
|
|
|
|
2021-12-20 18:48:44 +03:00
|
|
|
#undef CASE
|
2020-10-02 20:38:05 +03:00
|
|
|
|
|
|
|
default:
|
2023-09-24 12:11:25 +03:00
|
|
|
params->_ret = iface->SetConfigValue( params->eValue, params->eScopeType, params->scopeObj,
|
|
|
|
params->eDataType, params->pArg );
|
2020-10-02 20:38:05 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-27 15:34:23 +03:00
|
|
|
void cppISteamInput_SteamInput001_GetGlyphForActionOrigin( struct cppISteamInput_SteamInput001_GetGlyphForActionOrigin_params *params )
|
2021-10-08 19:09:30 +03:00
|
|
|
{
|
2023-09-24 12:11:25 +03:00
|
|
|
struct cppISteamInput_SteamInput001 *iface = (struct cppISteamInput_SteamInput001 *)params->linux_side;
|
|
|
|
params->_ret = iface->GetGlyphForActionOrigin( params->eOrigin );
|
2023-09-27 15:34:23 +03:00
|
|
|
params->_ret = steamclient_isteaminput_getglyph( params->eOrigin, params->_ret );
|
2021-10-08 19:09:30 +03:00
|
|
|
}
|
|
|
|
|
2023-09-27 15:34:23 +03:00
|
|
|
void cppISteamInput_SteamInput001_GetGlyphForXboxOrigin( struct cppISteamInput_SteamInput001_GetGlyphForXboxOrigin_params *params )
|
2021-10-08 20:58:43 +03:00
|
|
|
{
|
2023-09-24 12:11:25 +03:00
|
|
|
struct cppISteamInput_SteamInput001 *iface = (struct cppISteamInput_SteamInput001 *)params->linux_side;
|
|
|
|
params->_ret = iface->GetGlyphForXboxOrigin( params->eOrigin );
|
2023-09-27 15:34:23 +03:00
|
|
|
params->_ret = steamclient_isteaminput_getglyph_xbox( params->eOrigin, params->_ret );
|
2021-10-08 20:58:43 +03:00
|
|
|
}
|
|
|
|
|
2023-09-27 15:34:23 +03:00
|
|
|
void cppISteamController_SteamController007_GetGlyphForActionOrigin( struct cppISteamController_SteamController007_GetGlyphForActionOrigin_params *params )
|
2021-10-08 19:09:30 +03:00
|
|
|
{
|
2023-09-24 12:11:25 +03:00
|
|
|
struct cppISteamController_SteamController007 *iface = (struct cppISteamController_SteamController007 *)params->linux_side;
|
|
|
|
params->_ret = iface->GetGlyphForActionOrigin( params->eOrigin );
|
2023-09-27 15:34:23 +03:00
|
|
|
params->_ret = steamclient_isteamcontroller_getglyph( params->eOrigin, params->_ret );
|
2021-10-08 19:09:30 +03:00
|
|
|
}
|
|
|
|
|
2023-09-27 15:34:23 +03:00
|
|
|
void cppISteamController_SteamController007_GetGlyphForXboxOrigin( struct cppISteamController_SteamController007_GetGlyphForXboxOrigin_params *params )
|
2021-10-08 20:58:43 +03:00
|
|
|
{
|
2023-09-24 12:11:25 +03:00
|
|
|
struct cppISteamController_SteamController007 *iface = (struct cppISteamController_SteamController007 *)params->linux_side;
|
|
|
|
params->_ret = iface->GetGlyphForXboxOrigin( params->eOrigin );
|
2023-09-27 15:34:23 +03:00
|
|
|
params->_ret = steamclient_isteaminput_getglyph_xbox( params->eOrigin, params->_ret );
|
2020-09-29 17:19:06 +03:00
|
|
|
}
|