2023-09-17 23:16:30 +02:00
|
|
|
#include "steamclient_private.h"
|
2020-06-02 17:30:04 +02:00
|
|
|
|
|
|
|
#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-06-02 17:30:04 +02:00
|
|
|
#include "steamworks_sdk_148a/steam_api.h"
|
|
|
|
#include "steamworks_sdk_148a/isteamnetworkingsockets.h"
|
|
|
|
#include "steamworks_sdk_148a/isteamnetworkingutils.h"
|
|
|
|
#include "steamworks_sdk_148a/steamnetworkingtypes.h"
|
|
|
|
#pragma pop_macro("__cdecl")
|
2023-09-20 08:23:56 +02:00
|
|
|
#pragma pop_macro("strncpy")
|
2020-06-02 17:30:04 +02:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
#define SDKVER_148a
|
|
|
|
#include "struct_converters.h"
|
|
|
|
|
2023-08-24 01:27:02 +02:00
|
|
|
#define SDK_VERSION 1481
|
|
|
|
#include "steamclient_manual_common.h"
|
2020-06-02 17:30:04 +02:00
|
|
|
|
2023-09-27 14:34:23 +02:00
|
|
|
typedef winSteamNetworkingMessage_t_148a winSteamNetworkingMessage_t_149;
|
|
|
|
typedef winSteamNetworkingMessage_t_148a winSteamNetworkingMessage_t_152;
|
|
|
|
#include "cppISteamNetworkingSockets_SteamNetworkingSockets008.h"
|
|
|
|
#include "cppISteamNetworkingUtils_SteamNetworkingUtils003.h"
|
|
|
|
}
|
|
|
|
|
2023-09-17 23:16:30 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(steamclient);
|
|
|
|
|
2023-09-27 14:34:23 +02:00
|
|
|
void cppISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnConnection( struct cppISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnConnection_params *params )
|
2020-06-02 17:30:04 +02:00
|
|
|
{
|
2023-09-27 14:34:23 +02:00
|
|
|
ISteamNetworkingSockets *iface = (ISteamNetworkingSockets *)params->linux_side;
|
|
|
|
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-06-02 17:30:04 +02:00
|
|
|
}
|
|
|
|
|
2023-09-27 14:34:23 +02:00
|
|
|
void cppISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnPollGroup( struct cppISteamNetworkingSockets_SteamNetworkingSockets008_ReceiveMessagesOnPollGroup_params *params )
|
2020-06-02 17:30:04 +02:00
|
|
|
{
|
2023-09-27 14:34:23 +02:00
|
|
|
ISteamNetworkingSockets *iface = (ISteamNetworkingSockets *)params->linux_side;
|
|
|
|
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-06-02 17:30:04 +02:00
|
|
|
}
|
|
|
|
|
2023-09-27 14:34:23 +02:00
|
|
|
void cppISteamNetworkingSockets_SteamNetworkingSockets008_SendMessages( struct cppISteamNetworkingSockets_SteamNetworkingSockets008_SendMessages_params *params )
|
2020-06-02 17:30:04 +02:00
|
|
|
{
|
|
|
|
#define MAX_SEND_MESSAGES 64
|
2023-09-27 14:34:23 +02:00
|
|
|
ISteamNetworkingSockets *iface = (ISteamNetworkingSockets *)params->linux_side;
|
2020-06-02 17:30:04 +02:00
|
|
|
/* use the stack to avoid heap allocation */
|
|
|
|
struct SteamNetworkingMessage_t *lin_msgs[MAX_SEND_MESSAGES];
|
|
|
|
int i;
|
|
|
|
|
2023-09-27 14:34:23 +02:00
|
|
|
if (params->nMessages > MAX_SEND_MESSAGES)
|
2020-06-02 17:30:04 +02:00
|
|
|
{
|
|
|
|
/* if we ever hit this, increase MAX_SEND_MESSAGES appropriately */
|
2023-09-27 14:34:23 +02:00
|
|
|
FIXME( "Trying to send %u messages, which is more than %u! Will break up into pieces.\n",
|
|
|
|
params->nMessages, MAX_SEND_MESSAGES );
|
2020-06-02 17:30:04 +02:00
|
|
|
}
|
|
|
|
|
2023-09-27 14:34:23 +02:00
|
|
|
while (params->nMessages)
|
2020-06-02 17:30:04 +02:00
|
|
|
{
|
2023-09-27 14:34:23 +02: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-06-02 17:30:04 +02:00
|
|
|
|
2023-09-14 14:53:26 +02:00
|
|
|
iface->SendMessages( i, lin_msgs, (int64 *)params->pOutMessageNumberOrResult );
|
2020-06-02 17:30:04 +02:00
|
|
|
|
2023-09-27 14:34:23 +02:00
|
|
|
params->nMessages -= i;
|
|
|
|
params->pMessages += i;
|
|
|
|
if (params->pOutMessageNumberOrResult) params->pOutMessageNumberOrResult += i;
|
2020-06-02 17:30:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-27 14:34:23 +02:00
|
|
|
void cppISteamNetworkingUtils_SteamNetworkingUtils003_AllocateMessage( struct cppISteamNetworkingUtils_SteamNetworkingUtils003_AllocateMessage_params *params )
|
2020-06-02 17:30:04 +02:00
|
|
|
{
|
2023-09-27 14:34:23 +02:00
|
|
|
ISteamNetworkingUtils *iface = (ISteamNetworkingUtils *)params->linux_side;
|
|
|
|
params->_ret = (winSteamNetworkingMessage_t_148a *)iface->AllocateMessage( params->cbAllocateBuffer );
|
|
|
|
params->_ret = (winSteamNetworkingMessage_t_148a *)network_message_lin_to_win( params->_ret );
|
2020-06-02 17:30:04 +02:00
|
|
|
}
|