2023-09-30 15:02:30 +03:00
|
|
|
#include "unix_private.h"
|
2019-12-11 22:59:25 +03:00
|
|
|
|
2023-09-24 12:11:25 +03:00
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#define SDK_VERSION 1470
|
|
|
|
#include "steamclient_manual_common.h"
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "cppISteamNetworkingSockets_SteamNetworkingSockets006.hpp"
|
2019-12-11 22:59:25 +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_SteamNetworkingSockets006_ReceiveMessagesOnConnection( struct cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnConnection_params *params )
|
2019-12-11 22:59:25 +03:00
|
|
|
{
|
2023-09-30 15:02:30 +03:00
|
|
|
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,
|
2023-09-27 15:34:23 +03:00
|
|
|
params->ppOutMessages, params->nMaxMessages );
|
2019-12-11 22:59:25 +03:00
|
|
|
}
|
|
|
|
|
2023-09-27 15:34:23 +03:00
|
|
|
void cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnListenSocket( struct cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnListenSocket_params *params )
|
2019-12-11 22:59:25 +03:00
|
|
|
{
|
2023-09-30 15:02:30 +03:00
|
|
|
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,
|
2023-09-27 15:34:23 +03:00
|
|
|
params->ppOutMessages, params->nMaxMessages );
|
2019-12-11 22:59:25 +03:00
|
|
|
}
|
|
|
|
|
2023-09-27 15:34:23 +03:00
|
|
|
void cppISteamNetworkingSockets_SteamNetworkingSockets006_SendMessages( struct cppISteamNetworkingSockets_SteamNetworkingSockets006_SendMessages_params *params )
|
2019-12-11 22:59:25 +03:00
|
|
|
{
|
|
|
|
#define MAX_SEND_MESSAGES 64
|
2023-09-30 15:02:30 +03:00
|
|
|
struct u_ISteamNetworkingSockets_SteamNetworkingSockets006 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets006 *)params->linux_side;
|
2019-12-11 22:59:25 +03:00
|
|
|
/* use the stack to avoid heap allocation */
|
2023-09-30 15:02:30 +03:00
|
|
|
u_SteamNetworkingMessage_t_147 *u_msgs[MAX_SEND_MESSAGES];
|
2019-12-11 22:59:25 +03:00
|
|
|
int i;
|
|
|
|
|
2023-09-27 15:34:23 +03:00
|
|
|
if (params->nMessages > MAX_SEND_MESSAGES)
|
2019-12-11 22:59:25 +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 );
|
2019-12-11 22:59:25 +03:00
|
|
|
}
|
|
|
|
|
2023-09-27 15:34:23 +03:00
|
|
|
while (params->nMessages)
|
2019-12-11 22:59:25 +03:00
|
|
|
{
|
2023-09-27 15:34:23 +03:00
|
|
|
for (i = 0; i < params->nMessages && i < MAX_SEND_MESSAGES; ++i)
|
2023-09-30 15:02:30 +03:00
|
|
|
u_msgs[i] = (u_SteamNetworkingMessage_t_147 *)network_message_win_to_lin( params->pMessages[i] );
|
2019-12-11 22:59:25 +03:00
|
|
|
|
2023-09-30 15:02:30 +03:00
|
|
|
iface->SendMessages( i, u_msgs, params->pOutMessageNumberOrResult );
|
2019-12-11 22:59:25 +03:00
|
|
|
|
2023-09-27 15:34:23 +03:00
|
|
|
params->nMessages -= i;
|
|
|
|
params->pMessages += i;
|
|
|
|
if (params->pOutMessageNumberOrResult) params->pOutMessageNumberOrResult += i;
|
2019-12-11 22:59:25 +03:00
|
|
|
}
|
|
|
|
}
|