2020-09-29 16:19:06 +02:00
|
|
|
extern "C" {
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(steamclient);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "steam_defs.h"
|
|
|
|
#pragma push_macro("__cdecl")
|
|
|
|
#undef __cdecl
|
2023-09-20 08:23:56 +02:00
|
|
|
#pragma push_macro("strncpy")
|
|
|
|
#undef strncpy
|
2020-09-29 16:19:06 +02:00
|
|
|
#include "steamworks_sdk_150/steam_api.h"
|
|
|
|
#include "steamworks_sdk_150/isteamnetworkingsockets.h"
|
|
|
|
#include "steamworks_sdk_150/isteamnetworkingutils.h"
|
|
|
|
#include "steamworks_sdk_150/steamnetworkingtypes.h"
|
|
|
|
#pragma pop_macro("__cdecl")
|
2023-09-20 08:23:56 +02:00
|
|
|
#pragma pop_macro("strncpy")
|
2020-09-29 16:19:06 +02:00
|
|
|
#include "steamclient_private.h"
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
#define SDKVER_150
|
|
|
|
#include "struct_converters.h"
|
2020-10-02 19:38:05 +02:00
|
|
|
#include "cb_converters.h"
|
2020-09-29 16:19:06 +02:00
|
|
|
|
2023-08-24 01:27:02 +02:00
|
|
|
#define SDK_VERSION 1500
|
|
|
|
#include "steamclient_manual_common.h"
|
2020-09-29 16:19:06 +02:00
|
|
|
|
|
|
|
int cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnConnection(
|
|
|
|
void *linux_side, HSteamNetConnection hConn,
|
|
|
|
winSteamNetworkingMessage_t_150 **ppOutMessages, int nMaxMessages)
|
|
|
|
{
|
|
|
|
SteamNetworkingMessage_t *lin_ppOutMessages[nMaxMessages];
|
|
|
|
int retval = ((ISteamNetworkingSockets*)linux_side)->ReceiveMessagesOnConnection(hConn, lin_ppOutMessages, nMaxMessages);
|
2023-08-24 01:27:02 +02:00
|
|
|
lin_to_win_struct_SteamNetworkingMessage_t(retval, lin_ppOutMessages, ppOutMessages, nMaxMessages);
|
2020-09-29 16:19:06 +02:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
int cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceiveMessagesOnPollGroup(
|
|
|
|
void *linux_side, HSteamNetPollGroup hPollGroup,
|
|
|
|
winSteamNetworkingMessage_t_150 **ppOutMessages, int nMaxMessages)
|
|
|
|
{
|
|
|
|
SteamNetworkingMessage_t *lin_ppOutMessages[nMaxMessages];
|
|
|
|
int retval = ((ISteamNetworkingSockets*)linux_side)->ReceiveMessagesOnPollGroup(hPollGroup, lin_ppOutMessages, nMaxMessages);
|
2023-08-24 01:27:02 +02:00
|
|
|
lin_to_win_struct_SteamNetworkingMessage_t(retval, lin_ppOutMessages, ppOutMessages, nMaxMessages);
|
2020-09-29 16:19:06 +02:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cppISteamNetworkingSockets_SteamNetworkingSockets009_SendMessages(
|
|
|
|
void *linux_side, int nMessages, winSteamNetworkingMessage_t_150 **pMessages,
|
|
|
|
int64 *pOutMessageNumberOrResult)
|
|
|
|
{
|
|
|
|
#define MAX_SEND_MESSAGES 64
|
|
|
|
/* use the stack to avoid heap allocation */
|
|
|
|
struct SteamNetworkingMessage_t *lin_msgs[MAX_SEND_MESSAGES];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (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", nMessages, MAX_SEND_MESSAGES);
|
|
|
|
}
|
|
|
|
|
|
|
|
while(nMessages)
|
|
|
|
{
|
|
|
|
for(i = 0; i < nMessages && i < MAX_SEND_MESSAGES; ++i)
|
2023-08-24 01:27:02 +02:00
|
|
|
lin_msgs[i] = (SteamNetworkingMessage_t *)network_message_win_to_lin(pMessages[i]);
|
2020-09-29 16:19:06 +02:00
|
|
|
|
|
|
|
((ISteamNetworkingSockets*)linux_side)->SendMessages(i, lin_msgs, pOutMessageNumberOrResult);
|
|
|
|
|
|
|
|
nMessages -= i;
|
|
|
|
pMessages += i;
|
|
|
|
if(pOutMessageNumberOrResult)
|
|
|
|
pOutMessageNumberOrResult += i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-29 16:40:02 +02:00
|
|
|
int cppISteamNetworkingMessages_SteamNetworkingMessages002_ReceiveMessagesOnChannel(
|
|
|
|
void *linux_side, int nLocalChannel,
|
|
|
|
winSteamNetworkingMessage_t_150 ** ppOutMessages, int nMaxMessages)
|
|
|
|
{
|
|
|
|
SteamNetworkingMessage_t *lin_ppOutMessages[nMaxMessages];
|
|
|
|
int retval = ((ISteamNetworkingMessages*)linux_side)->ReceiveMessagesOnChannel(nLocalChannel, lin_ppOutMessages, nMaxMessages);
|
2023-08-24 01:27:02 +02:00
|
|
|
lin_to_win_struct_SteamNetworkingMessage_t(retval, lin_ppOutMessages, ppOutMessages, nMaxMessages);
|
2020-09-29 16:40:02 +02:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2020-10-02 19:38:05 +02:00
|
|
|
#pragma pack( push, 8 )
|
2021-12-20 16:48:44 +01:00
|
|
|
struct winSteamNetConnectionStatusChangedCallback_t_584 {
|
2020-10-02 19:38:05 +02:00
|
|
|
HSteamNetConnection m_hConn;
|
|
|
|
SteamNetConnectionInfo_t m_info __attribute__((aligned(8)));
|
|
|
|
ESteamNetworkingConnectionState m_eOldState;
|
|
|
|
} __attribute__ ((ms_struct));
|
|
|
|
#pragma pack( pop )
|
|
|
|
|
2021-12-20 16:48:44 +01:00
|
|
|
typedef void (*CDECL win_FnSteamNetConnectionStatusChanged)(winSteamNetConnectionStatusChangedCallback_t_584 *);
|
|
|
|
static win_FnSteamNetConnectionStatusChanged win_SteamNetConnectionStatusChanged;
|
2020-10-02 19:38:05 +02:00
|
|
|
|
2021-12-20 16:48:44 +01:00
|
|
|
static void lin_SteamNetConnectionStatusChanged(SteamNetConnectionStatusChangedCallback_t *l_dat)
|
2020-10-02 19:38:05 +02:00
|
|
|
{
|
|
|
|
win_FnSteamNetConnectionStatusChanged fn = win_SteamNetConnectionStatusChanged;
|
|
|
|
if(fn){
|
2021-12-20 16:48:44 +01:00
|
|
|
struct winSteamNetConnectionStatusChangedCallback_t_584 w_dat;
|
|
|
|
cb_SteamNetConnectionStatusChangedCallback_t_584(l_dat, &w_dat);
|
2020-10-02 19:38:05 +02: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);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cppISteamNetworkingUtils_SteamNetworkingUtils003_SetConfigValue(void *linux_side,
|
|
|
|
ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType,
|
|
|
|
intptr_t scopeObj, ESteamNetworkingConfigDataType eDataType, const void *pArg)
|
|
|
|
{
|
|
|
|
bool ret;
|
|
|
|
void *lin_fn; /* api requires passing pointer-to-pointer */
|
|
|
|
|
2021-12-20 16:48:44 +01:00
|
|
|
switch(eValue){
|
2020-10-02 19:38:05 +02:00
|
|
|
|
2021-12-20 16:48:44 +01:00
|
|
|
#define CASE(x, y) \
|
|
|
|
case k_ESteamNetworkingConfig_Callback_##x: \
|
|
|
|
if(!pArg){ \
|
|
|
|
ret = ((ISteamNetworkingUtils*)linux_side)->SetConfigValue(eValue, eScopeType, scopeObj, eDataType, NULL); \
|
|
|
|
}else{ \
|
|
|
|
if(*(void **)pArg == NULL) \
|
|
|
|
lin_fn = NULL; \
|
|
|
|
else \
|
|
|
|
lin_fn = (void *)&lin_##y; \
|
|
|
|
ret = ((ISteamNetworkingUtils*)linux_side)->SetConfigValue(eValue, eScopeType, scopeObj, eDataType, &lin_fn); \
|
|
|
|
if(ret) \
|
|
|
|
win_##y = *(win_Fn##y*)pArg; \
|
|
|
|
} \
|
2020-10-02 19:38:05 +02:00
|
|
|
return ret;
|
|
|
|
|
2021-12-20 16:48:44 +01:00
|
|
|
CASE(ConnectionStatusChanged, SteamNetConnectionStatusChanged)
|
|
|
|
CASE(AuthStatusChanged, SteamNetAuthenticationStatusChanged)
|
|
|
|
CASE(RelayNetworkStatusChanged, SteamRelayNetworkStatusChanged)
|
|
|
|
CASE(MessagesSessionRequest, SteamNetworkingMessagesSessionRequest)
|
|
|
|
CASE(MessagesSessionFailed, SteamNetworkingMessagesSessionFailed)
|
2020-10-02 19:38:05 +02:00
|
|
|
|
2021-12-20 16:48:44 +01:00
|
|
|
#undef CASE
|
2020-10-02 19:38:05 +02:00
|
|
|
|
|
|
|
default:
|
|
|
|
return ((ISteamNetworkingUtils*)linux_side)->SetConfigValue((ESteamNetworkingConfigValue)eValue, (ESteamNetworkingConfigScope)eScopeType, (intptr_t)scopeObj, (ESteamNetworkingConfigDataType)eDataType, (const void *)pArg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-08 18:09:30 +02:00
|
|
|
const char * cppISteamInput_SteamInput001_GetGlyphForActionOrigin(void *linux_side, EInputActionOrigin eOrigin)
|
|
|
|
{
|
|
|
|
const char *path_result;
|
|
|
|
path_result = ((ISteamInput*)linux_side)->GetGlyphForActionOrigin((EInputActionOrigin)eOrigin);
|
|
|
|
return steamclient_isteaminput_getglyph(eOrigin, path_result);
|
|
|
|
}
|
|
|
|
|
2021-10-08 19:58:43 +02:00
|
|
|
const char * cppISteamInput_SteamInput001_GetGlyphForXboxOrigin(void *linux_side, EXboxOrigin eOrigin)
|
|
|
|
{
|
|
|
|
const char *path_result;
|
|
|
|
path_result = ((ISteamInput*)linux_side)->GetGlyphForXboxOrigin((EXboxOrigin)eOrigin);
|
|
|
|
return steamclient_isteaminput_getglyph_xbox(eOrigin, path_result);
|
|
|
|
}
|
|
|
|
|
2021-10-08 18:09:30 +02:00
|
|
|
const char * cppISteamController_SteamController007_GetGlyphForActionOrigin(void *linux_side, EControllerActionOrigin eOrigin)
|
|
|
|
{
|
|
|
|
const char *path_result;
|
|
|
|
path_result = ((ISteamController*)linux_side)->GetGlyphForActionOrigin((EControllerActionOrigin)eOrigin);
|
|
|
|
return steamclient_isteamcontroller_getglyph(eOrigin, path_result);
|
|
|
|
}
|
|
|
|
|
2021-10-08 19:58:43 +02:00
|
|
|
const char * cppISteamController_SteamController007_GetGlyphForXboxOrigin(void *linux_side, EXboxOrigin eOrigin)
|
|
|
|
{
|
|
|
|
const char *path_result;
|
|
|
|
path_result = ((ISteamController*)linux_side)->GetGlyphForXboxOrigin((EXboxOrigin)eOrigin);
|
|
|
|
return steamclient_isteaminput_getglyph_xbox(eOrigin, path_result);
|
|
|
|
}
|
|
|
|
|
2020-09-29 16:19:06 +02:00
|
|
|
}
|