Proton/lsteamclient/steamclient_manual_147.cpp

58 lines
2.8 KiB
C++
Raw Normal View History

#include "unix_private.h"
2019-12-11 22:59: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
WINE_DEFAULT_DEBUG_CHANNEL(steamclient);
void cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnConnection( struct cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnConnection_params *params )
2019-12-11 22:59:25 +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,
params->ppOutMessages, params->nMaxMessages );
2019-12-11 22:59:25 +03:00
}
void cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnListenSocket( struct cppISteamNetworkingSockets_SteamNetworkingSockets006_ReceiveMessagesOnListenSocket_params *params )
2019-12-11 22:59:25 +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,
params->ppOutMessages, params->nMaxMessages );
2019-12-11 22:59:25 +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
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 */
u_SteamNetworkingMessage_t_147 *u_msgs[MAX_SEND_MESSAGES];
2019-12-11 22:59:25 +03:00
int i;
if (params->nMessages > MAX_SEND_MESSAGES)
2019-12-11 22:59:25 +03:00
{
/* 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 );
2019-12-11 22:59:25 +03:00
}
while (params->nMessages)
2019-12-11 22:59:25 +03:00
{
for (i = 0; i < params->nMessages && i < MAX_SEND_MESSAGES; ++i)
u_msgs[i] = (u_SteamNetworkingMessage_t_147 *)network_message_win_to_lin( params->pMessages[i] );
2019-12-11 22:59:25 +03:00
iface->SendMessages( i, u_msgs, params->pOutMessageNumberOrResult );
2019-12-11 22:59:25 +03:00
params->nMessages -= i;
params->pMessages += i;
if (params->pOutMessageNumberOrResult) params->pOutMessageNumberOrResult += i;
2019-12-11 22:59:25 +03:00
}
}