From 649421bf261b0a5089b2305f42d5cba13eae9dc1 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Thu, 16 May 2019 11:23:30 -0500 Subject: [PATCH] lsteamclient: Add ISteamNetworkingSockets support --- ...List_STEAMAPPLIST_INTERFACE_VERSION001.cpp | 1 + ...et_STEAMAPPTICKET_INTERFACE_VERSION001.cpp | 1 + ...eamApps_STEAMAPPS_INTERFACE_VERSION008.cpp | 1 + .../cppISteamClient_SteamClient018.cpp | 1 + ...cppISteamController_SteamController007.cpp | 1 + .../cppISteamFriends_SteamFriends017.cpp | 1 + ...ameCoordinator_SteamGameCoordinator001.cpp | 1 + ...ameServerStats_SteamGameServerStats001.cpp | 1 + ...cppISteamGameServer_SteamGameServer012.cpp | 1 + ...STEAMHTMLSURFACE_INTERFACE_VERSION_005.cpp | 1 + ...eamHTTP_STEAMHTTP_INTERFACE_VERSION003.cpp | 1 + lsteamclient/cppISteamInput_SteamInput001.cpp | 1 + ...nventory_STEAMINVENTORY_INTERFACE_V003.cpp | 1 + ...kingServers_SteamMatchMakingServers002.cpp | 1 + ...pISteamMatchmaking_SteamMatchMaking009.cpp | 1 + ..._STEAMMUSICREMOTE_INTERFACE_VERSION001.cpp | 1 + ...mMusic_STEAMMUSIC_INTERFACE_VERSION001.cpp | 1 + ...rkingSockets_SteamNetworkingSockets002.cpp | 162 +++++++++++ ...workingSockets_SteamNetworkingSockets002.h | 28 ++ ...cppISteamNetworking_SteamNetworking005.cpp | 1 + ...MPARENTALSETTINGS_INTERFACE_VERSION001.cpp | 1 + .../cppISteamParties_SteamParties002.cpp | 1 + ...TEAMREMOTESTORAGE_INTERFACE_VERSION014.cpp | 1 + ..._STEAMSCREENSHOTS_INTERFACE_VERSION003.cpp | 1 + ...SteamUGC_STEAMUGC_INTERFACE_VERSION012.cpp | 1 + ...ts_STEAMUSERSTATS_INTERFACE_VERSION011.cpp | 1 + lsteamclient/cppISteamUser_SteamUser020.cpp | 1 + lsteamclient/cppISteamUtils_SteamUtils009.cpp | 1 + ...pISteamVideo_STEAMVIDEO_INTERFACE_V002.cpp | 1 + lsteamclient/gen_wrapper.py | 45 ++- lsteamclient/queue.h | 113 ++++++++ lsteamclient/steam_defs.h | 72 ++++- lsteamclient/steamclient_manual_144.cpp | 99 +++++++ .../isteamnetworkingsockets.h | 10 +- .../steamworks_sdk_144/steamnetworkingtypes.h | 93 +++--- lsteamclient/struct_converters.h | 22 ++ lsteamclient/struct_converters_144.cpp | 1 + lsteamclient/winISteamNetworkingSockets.c | 273 ++++++++++++++++++ lsteamclient/win_constructors.h | 1 + lsteamclient/win_constructors_table.dat | 1 + 40 files changed, 877 insertions(+), 70 deletions(-) create mode 100644 lsteamclient/cppISteamNetworkingSockets_SteamNetworkingSockets002.cpp create mode 100644 lsteamclient/cppISteamNetworkingSockets_SteamNetworkingSockets002.h create mode 100644 lsteamclient/queue.h create mode 100644 lsteamclient/steamclient_manual_144.cpp create mode 100644 lsteamclient/winISteamNetworkingSockets.c diff --git a/lsteamclient/cppISteamAppList_STEAMAPPLIST_INTERFACE_VERSION001.cpp b/lsteamclient/cppISteamAppList_STEAMAPPLIST_INTERFACE_VERSION001.cpp index 4cf5c1b2..3106de2b 100644 --- a/lsteamclient/cppISteamAppList_STEAMAPPLIST_INTERFACE_VERSION001.cpp +++ b/lsteamclient/cppISteamAppList_STEAMAPPLIST_INTERFACE_VERSION001.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/cppISteamAppTicket_STEAMAPPTICKET_INTERFACE_VERSION001.cpp b/lsteamclient/cppISteamAppTicket_STEAMAPPTICKET_INTERFACE_VERSION001.cpp index 522b69c3..3f6ae57a 100644 --- a/lsteamclient/cppISteamAppTicket_STEAMAPPTICKET_INTERFACE_VERSION001.cpp +++ b/lsteamclient/cppISteamAppTicket_STEAMAPPTICKET_INTERFACE_VERSION001.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamworks_sdk_144/isteamappticket.h" #include "steamclient_private.h" #ifdef __cplusplus diff --git a/lsteamclient/cppISteamApps_STEAMAPPS_INTERFACE_VERSION008.cpp b/lsteamclient/cppISteamApps_STEAMAPPS_INTERFACE_VERSION008.cpp index 8de7c3df..18402936 100644 --- a/lsteamclient/cppISteamApps_STEAMAPPS_INTERFACE_VERSION008.cpp +++ b/lsteamclient/cppISteamApps_STEAMAPPS_INTERFACE_VERSION008.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/cppISteamClient_SteamClient018.cpp b/lsteamclient/cppISteamClient_SteamClient018.cpp index bda9382e..d59370b4 100644 --- a/lsteamclient/cppISteamClient_SteamClient018.cpp +++ b/lsteamclient/cppISteamClient_SteamClient018.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/cppISteamController_SteamController007.cpp b/lsteamclient/cppISteamController_SteamController007.cpp index 13fc7e33..519562b7 100644 --- a/lsteamclient/cppISteamController_SteamController007.cpp +++ b/lsteamclient/cppISteamController_SteamController007.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/cppISteamFriends_SteamFriends017.cpp b/lsteamclient/cppISteamFriends_SteamFriends017.cpp index d29102a1..1864fad8 100644 --- a/lsteamclient/cppISteamFriends_SteamFriends017.cpp +++ b/lsteamclient/cppISteamFriends_SteamFriends017.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/cppISteamGameCoordinator_SteamGameCoordinator001.cpp b/lsteamclient/cppISteamGameCoordinator_SteamGameCoordinator001.cpp index 6ac4b4ab..879b2e81 100644 --- a/lsteamclient/cppISteamGameCoordinator_SteamGameCoordinator001.cpp +++ b/lsteamclient/cppISteamGameCoordinator_SteamGameCoordinator001.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamworks_sdk_144/isteamgamecoordinator.h" #include "steamclient_private.h" #ifdef __cplusplus diff --git a/lsteamclient/cppISteamGameServerStats_SteamGameServerStats001.cpp b/lsteamclient/cppISteamGameServerStats_SteamGameServerStats001.cpp index 2fd5cd04..fa7964cc 100644 --- a/lsteamclient/cppISteamGameServerStats_SteamGameServerStats001.cpp +++ b/lsteamclient/cppISteamGameServerStats_SteamGameServerStats001.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamworks_sdk_144/isteamgameserverstats.h" #include "steamclient_private.h" #ifdef __cplusplus diff --git a/lsteamclient/cppISteamGameServer_SteamGameServer012.cpp b/lsteamclient/cppISteamGameServer_SteamGameServer012.cpp index 6fda0b61..bdeaf249 100644 --- a/lsteamclient/cppISteamGameServer_SteamGameServer012.cpp +++ b/lsteamclient/cppISteamGameServer_SteamGameServer012.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamworks_sdk_144/isteamgameserver.h" #include "steamclient_private.h" #ifdef __cplusplus diff --git a/lsteamclient/cppISteamHTMLSurface_STEAMHTMLSURFACE_INTERFACE_VERSION_005.cpp b/lsteamclient/cppISteamHTMLSurface_STEAMHTMLSURFACE_INTERFACE_VERSION_005.cpp index 84880675..d56ca361 100644 --- a/lsteamclient/cppISteamHTMLSurface_STEAMHTMLSURFACE_INTERFACE_VERSION_005.cpp +++ b/lsteamclient/cppISteamHTMLSurface_STEAMHTMLSURFACE_INTERFACE_VERSION_005.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/cppISteamHTTP_STEAMHTTP_INTERFACE_VERSION003.cpp b/lsteamclient/cppISteamHTTP_STEAMHTTP_INTERFACE_VERSION003.cpp index 2ffd4bed..79f828f6 100644 --- a/lsteamclient/cppISteamHTTP_STEAMHTTP_INTERFACE_VERSION003.cpp +++ b/lsteamclient/cppISteamHTTP_STEAMHTTP_INTERFACE_VERSION003.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/cppISteamInput_SteamInput001.cpp b/lsteamclient/cppISteamInput_SteamInput001.cpp index b86d00a4..565a39f7 100644 --- a/lsteamclient/cppISteamInput_SteamInput001.cpp +++ b/lsteamclient/cppISteamInput_SteamInput001.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/cppISteamInventory_STEAMINVENTORY_INTERFACE_V003.cpp b/lsteamclient/cppISteamInventory_STEAMINVENTORY_INTERFACE_V003.cpp index a75fdd02..cf2f1d79 100644 --- a/lsteamclient/cppISteamInventory_STEAMINVENTORY_INTERFACE_V003.cpp +++ b/lsteamclient/cppISteamInventory_STEAMINVENTORY_INTERFACE_V003.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/cppISteamMatchmakingServers_SteamMatchMakingServers002.cpp b/lsteamclient/cppISteamMatchmakingServers_SteamMatchMakingServers002.cpp index 045c4956..4bb6f3fc 100644 --- a/lsteamclient/cppISteamMatchmakingServers_SteamMatchMakingServers002.cpp +++ b/lsteamclient/cppISteamMatchmakingServers_SteamMatchMakingServers002.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/cppISteamMatchmaking_SteamMatchMaking009.cpp b/lsteamclient/cppISteamMatchmaking_SteamMatchMaking009.cpp index 0be40292..fced21a8 100644 --- a/lsteamclient/cppISteamMatchmaking_SteamMatchMaking009.cpp +++ b/lsteamclient/cppISteamMatchmaking_SteamMatchMaking009.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/cppISteamMusicRemote_STEAMMUSICREMOTE_INTERFACE_VERSION001.cpp b/lsteamclient/cppISteamMusicRemote_STEAMMUSICREMOTE_INTERFACE_VERSION001.cpp index d6a7a57f..9b165174 100644 --- a/lsteamclient/cppISteamMusicRemote_STEAMMUSICREMOTE_INTERFACE_VERSION001.cpp +++ b/lsteamclient/cppISteamMusicRemote_STEAMMUSICREMOTE_INTERFACE_VERSION001.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/cppISteamMusic_STEAMMUSIC_INTERFACE_VERSION001.cpp b/lsteamclient/cppISteamMusic_STEAMMUSIC_INTERFACE_VERSION001.cpp index f2f3a8ac..42b27c34 100644 --- a/lsteamclient/cppISteamMusic_STEAMMUSIC_INTERFACE_VERSION001.cpp +++ b/lsteamclient/cppISteamMusic_STEAMMUSIC_INTERFACE_VERSION001.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/cppISteamNetworkingSockets_SteamNetworkingSockets002.cpp b/lsteamclient/cppISteamNetworkingSockets_SteamNetworkingSockets002.cpp new file mode 100644 index 00000000..ab858dae --- /dev/null +++ b/lsteamclient/cppISteamNetworkingSockets_SteamNetworkingSockets002.cpp @@ -0,0 +1,162 @@ +#include "steam_defs.h" +#include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" +#include "steamworks_sdk_144/isteamnetworkingsockets.h" +#include "steamclient_private.h" +#ifdef __cplusplus +extern "C" { +#endif +#define SDKVER_144 +#include "struct_converters.h" +#include "cppISteamNetworkingSockets_SteamNetworkingSockets002.h" +HSteamListenSocket cppISteamNetworkingSockets_SteamNetworkingSockets002_CreateListenSocketIP(void *linux_side, const SteamNetworkingIPAddr * localAddress) +{ + return ((ISteamNetworkingSockets*)linux_side)->CreateListenSocketIP((const SteamNetworkingIPAddr *)localAddress); +} + +HSteamNetConnection cppISteamNetworkingSockets_SteamNetworkingSockets002_ConnectByIPAddress(void *linux_side, const SteamNetworkingIPAddr * address) +{ + return ((ISteamNetworkingSockets*)linux_side)->ConnectByIPAddress((const SteamNetworkingIPAddr *)address); +} + +HSteamListenSocket cppISteamNetworkingSockets_SteamNetworkingSockets002_CreateListenSocketP2P(void *linux_side, int nVirtualPort) +{ + return ((ISteamNetworkingSockets*)linux_side)->CreateListenSocketP2P((int)nVirtualPort); +} + +HSteamNetConnection cppISteamNetworkingSockets_SteamNetworkingSockets002_ConnectP2P(void *linux_side, const SteamNetworkingIdentity * identityRemote, int nVirtualPort) +{ + return ((ISteamNetworkingSockets*)linux_side)->ConnectP2P((const SteamNetworkingIdentity *)identityRemote, (int)nVirtualPort); +} + +EResult cppISteamNetworkingSockets_SteamNetworkingSockets002_AcceptConnection(void *linux_side, HSteamNetConnection hConn) +{ + return ((ISteamNetworkingSockets*)linux_side)->AcceptConnection((HSteamNetConnection)hConn); +} + +bool cppISteamNetworkingSockets_SteamNetworkingSockets002_CloseConnection(void *linux_side, HSteamNetConnection hPeer, int nReason, const char * pszDebug, bool bEnableLinger) +{ + return ((ISteamNetworkingSockets*)linux_side)->CloseConnection((HSteamNetConnection)hPeer, (int)nReason, (const char *)pszDebug, (bool)bEnableLinger); +} + +bool cppISteamNetworkingSockets_SteamNetworkingSockets002_CloseListenSocket(void *linux_side, HSteamListenSocket hSocket) +{ + return ((ISteamNetworkingSockets*)linux_side)->CloseListenSocket((HSteamListenSocket)hSocket); +} + +bool cppISteamNetworkingSockets_SteamNetworkingSockets002_SetConnectionUserData(void *linux_side, HSteamNetConnection hPeer, int64 nUserData) +{ + return ((ISteamNetworkingSockets*)linux_side)->SetConnectionUserData((HSteamNetConnection)hPeer, (int64)nUserData); +} + +int64 cppISteamNetworkingSockets_SteamNetworkingSockets002_GetConnectionUserData(void *linux_side, HSteamNetConnection hPeer) +{ + return ((ISteamNetworkingSockets*)linux_side)->GetConnectionUserData((HSteamNetConnection)hPeer); +} + +void cppISteamNetworkingSockets_SteamNetworkingSockets002_SetConnectionName(void *linux_side, HSteamNetConnection hPeer, const char * pszName) +{ + ((ISteamNetworkingSockets*)linux_side)->SetConnectionName((HSteamNetConnection)hPeer, (const char *)pszName); +} + +bool cppISteamNetworkingSockets_SteamNetworkingSockets002_GetConnectionName(void *linux_side, HSteamNetConnection hPeer, char * pszName, int nMaxLen) +{ + return ((ISteamNetworkingSockets*)linux_side)->GetConnectionName((HSteamNetConnection)hPeer, (char *)pszName, (int)nMaxLen); +} + +EResult cppISteamNetworkingSockets_SteamNetworkingSockets002_SendMessageToConnection(void *linux_side, HSteamNetConnection hConn, const void * pData, uint32 cbData, int nSendFlags) +{ + return ((ISteamNetworkingSockets*)linux_side)->SendMessageToConnection((HSteamNetConnection)hConn, (const void *)pData, (uint32)cbData, (int)nSendFlags); +} + +EResult cppISteamNetworkingSockets_SteamNetworkingSockets002_FlushMessagesOnConnection(void *linux_side, HSteamNetConnection hConn) +{ + return ((ISteamNetworkingSockets*)linux_side)->FlushMessagesOnConnection((HSteamNetConnection)hConn); +} + +int cppISteamNetworkingSockets_SteamNetworkingSockets002_ReceiveMessagesOnConnection(void *linux_side, HSteamNetConnection hConn, winSteamNetworkingMessage_t_144 ** ppOutMessages, int nMaxMessages) +{ + SteamNetworkingMessage_t * lin_ppOutMessages; + win_to_lin_struct_SteamNetworkingMessage_t_144(ppOutMessages, &lin_ppOutMessages); + int retval = ((ISteamNetworkingSockets*)linux_side)->ReceiveMessagesOnConnection((HSteamNetConnection)hConn, &lin_ppOutMessages, (int)nMaxMessages); + lin_to_win_struct_SteamNetworkingMessage_t_144(retval, &lin_ppOutMessages, ppOutMessages); + return retval; +} + +int cppISteamNetworkingSockets_SteamNetworkingSockets002_ReceiveMessagesOnListenSocket(void *linux_side, HSteamListenSocket hSocket, winSteamNetworkingMessage_t_144 ** ppOutMessages, int nMaxMessages) +{ + SteamNetworkingMessage_t * lin_ppOutMessages; + win_to_lin_struct_SteamNetworkingMessage_t_144(ppOutMessages, &lin_ppOutMessages); + int retval = ((ISteamNetworkingSockets*)linux_side)->ReceiveMessagesOnListenSocket((HSteamListenSocket)hSocket, &lin_ppOutMessages, (int)nMaxMessages); + lin_to_win_struct_SteamNetworkingMessage_t_144(retval, &lin_ppOutMessages, ppOutMessages); + return retval; +} + +bool cppISteamNetworkingSockets_SteamNetworkingSockets002_GetConnectionInfo(void *linux_side, HSteamNetConnection hConn, SteamNetConnectionInfo_t * pInfo) +{ + return ((ISteamNetworkingSockets*)linux_side)->GetConnectionInfo((HSteamNetConnection)hConn, (SteamNetConnectionInfo_t *)pInfo); +} + +bool cppISteamNetworkingSockets_SteamNetworkingSockets002_GetQuickConnectionStatus(void *linux_side, HSteamNetConnection hConn, SteamNetworkingQuickConnectionStatus * pStats) +{ + return ((ISteamNetworkingSockets*)linux_side)->GetQuickConnectionStatus((HSteamNetConnection)hConn, (SteamNetworkingQuickConnectionStatus *)pStats); +} + +int cppISteamNetworkingSockets_SteamNetworkingSockets002_GetDetailedConnectionStatus(void *linux_side, HSteamNetConnection hConn, char * pszBuf, int cbBuf) +{ + return ((ISteamNetworkingSockets*)linux_side)->GetDetailedConnectionStatus((HSteamNetConnection)hConn, (char *)pszBuf, (int)cbBuf); +} + +bool cppISteamNetworkingSockets_SteamNetworkingSockets002_GetListenSocketAddress(void *linux_side, HSteamListenSocket hSocket, SteamNetworkingIPAddr * address) +{ + return ((ISteamNetworkingSockets*)linux_side)->GetListenSocketAddress((HSteamListenSocket)hSocket, (SteamNetworkingIPAddr *)address); +} + +bool cppISteamNetworkingSockets_SteamNetworkingSockets002_CreateSocketPair(void *linux_side, HSteamNetConnection * pOutConnection1, HSteamNetConnection * pOutConnection2, bool bUseNetworkLoopback, const SteamNetworkingIdentity * pIdentity1, const SteamNetworkingIdentity * pIdentity2) +{ + return ((ISteamNetworkingSockets*)linux_side)->CreateSocketPair((HSteamNetConnection *)pOutConnection1, (HSteamNetConnection *)pOutConnection2, (bool)bUseNetworkLoopback, (const SteamNetworkingIdentity *)pIdentity1, (const SteamNetworkingIdentity *)pIdentity2); +} + +bool cppISteamNetworkingSockets_SteamNetworkingSockets002_GetIdentity(void *linux_side, SteamNetworkingIdentity * pIdentity) +{ + return ((ISteamNetworkingSockets*)linux_side)->GetIdentity((SteamNetworkingIdentity *)pIdentity); +} + +bool cppISteamNetworkingSockets_SteamNetworkingSockets002_ReceivedRelayAuthTicket(void *linux_side, const void * pvTicket, int cbTicket, SteamDatagramRelayAuthTicket * pOutParsedTicket) +{ + return ((ISteamNetworkingSockets*)linux_side)->ReceivedRelayAuthTicket((const void *)pvTicket, (int)cbTicket, (SteamDatagramRelayAuthTicket *)pOutParsedTicket); +} + +int cppISteamNetworkingSockets_SteamNetworkingSockets002_FindRelayAuthTicketForServer(void *linux_side, const SteamNetworkingIdentity * identityGameServer, int nVirtualPort, SteamDatagramRelayAuthTicket * pOutParsedTicket) +{ + return ((ISteamNetworkingSockets*)linux_side)->FindRelayAuthTicketForServer((const SteamNetworkingIdentity *)identityGameServer, (int)nVirtualPort, (SteamDatagramRelayAuthTicket *)pOutParsedTicket); +} + +HSteamNetConnection cppISteamNetworkingSockets_SteamNetworkingSockets002_ConnectToHostedDedicatedServer(void *linux_side, const SteamNetworkingIdentity * identityTarget, int nVirtualPort) +{ + return ((ISteamNetworkingSockets*)linux_side)->ConnectToHostedDedicatedServer((const SteamNetworkingIdentity *)identityTarget, (int)nVirtualPort); +} + +uint16 cppISteamNetworkingSockets_SteamNetworkingSockets002_GetHostedDedicatedServerPort(void *linux_side) +{ + return ((ISteamNetworkingSockets*)linux_side)->GetHostedDedicatedServerPort(); +} + +SteamNetworkingPOPID cppISteamNetworkingSockets_SteamNetworkingSockets002_GetHostedDedicatedServerPOPID(void *linux_side) +{ + return ((ISteamNetworkingSockets*)linux_side)->GetHostedDedicatedServerPOPID(); +} + +bool cppISteamNetworkingSockets_SteamNetworkingSockets002_GetHostedDedicatedServerAddress(void *linux_side, SteamDatagramHostedAddress * pRouting) +{ + return ((ISteamNetworkingSockets*)linux_side)->GetHostedDedicatedServerAddress((SteamDatagramHostedAddress *)pRouting); +} + +HSteamListenSocket cppISteamNetworkingSockets_SteamNetworkingSockets002_CreateHostedDedicatedServerListenSocket(void *linux_side, int nVirtualPort) +{ + return ((ISteamNetworkingSockets*)linux_side)->CreateHostedDedicatedServerListenSocket((int)nVirtualPort); +} + +#ifdef __cplusplus +} +#endif diff --git a/lsteamclient/cppISteamNetworkingSockets_SteamNetworkingSockets002.h b/lsteamclient/cppISteamNetworkingSockets_SteamNetworkingSockets002.h new file mode 100644 index 00000000..7538bf17 --- /dev/null +++ b/lsteamclient/cppISteamNetworkingSockets_SteamNetworkingSockets002.h @@ -0,0 +1,28 @@ +extern HSteamListenSocket cppISteamNetworkingSockets_SteamNetworkingSockets002_CreateListenSocketIP(void *, const SteamNetworkingIPAddr *); +extern HSteamNetConnection cppISteamNetworkingSockets_SteamNetworkingSockets002_ConnectByIPAddress(void *, const SteamNetworkingIPAddr *); +extern HSteamListenSocket cppISteamNetworkingSockets_SteamNetworkingSockets002_CreateListenSocketP2P(void *, int); +extern HSteamNetConnection cppISteamNetworkingSockets_SteamNetworkingSockets002_ConnectP2P(void *, const SteamNetworkingIdentity *, int); +extern EResult cppISteamNetworkingSockets_SteamNetworkingSockets002_AcceptConnection(void *, HSteamNetConnection); +extern bool cppISteamNetworkingSockets_SteamNetworkingSockets002_CloseConnection(void *, HSteamNetConnection, int, const char *, bool); +extern bool cppISteamNetworkingSockets_SteamNetworkingSockets002_CloseListenSocket(void *, HSteamListenSocket); +extern bool cppISteamNetworkingSockets_SteamNetworkingSockets002_SetConnectionUserData(void *, HSteamNetConnection, int64); +extern int64 cppISteamNetworkingSockets_SteamNetworkingSockets002_GetConnectionUserData(void *, HSteamNetConnection); +extern void cppISteamNetworkingSockets_SteamNetworkingSockets002_SetConnectionName(void *, HSteamNetConnection, const char *); +extern bool cppISteamNetworkingSockets_SteamNetworkingSockets002_GetConnectionName(void *, HSteamNetConnection, char *, int); +extern EResult cppISteamNetworkingSockets_SteamNetworkingSockets002_SendMessageToConnection(void *, HSteamNetConnection, const void *, uint32, int); +extern EResult cppISteamNetworkingSockets_SteamNetworkingSockets002_FlushMessagesOnConnection(void *, HSteamNetConnection); +extern int cppISteamNetworkingSockets_SteamNetworkingSockets002_ReceiveMessagesOnConnection(void *, HSteamNetConnection, winSteamNetworkingMessage_t_144 **, int); +extern int cppISteamNetworkingSockets_SteamNetworkingSockets002_ReceiveMessagesOnListenSocket(void *, HSteamListenSocket, winSteamNetworkingMessage_t_144 **, int); +extern bool cppISteamNetworkingSockets_SteamNetworkingSockets002_GetConnectionInfo(void *, HSteamNetConnection, SteamNetConnectionInfo_t *); +extern bool cppISteamNetworkingSockets_SteamNetworkingSockets002_GetQuickConnectionStatus(void *, HSteamNetConnection, SteamNetworkingQuickConnectionStatus *); +extern int cppISteamNetworkingSockets_SteamNetworkingSockets002_GetDetailedConnectionStatus(void *, HSteamNetConnection, char *, int); +extern bool cppISteamNetworkingSockets_SteamNetworkingSockets002_GetListenSocketAddress(void *, HSteamListenSocket, SteamNetworkingIPAddr *); +extern bool cppISteamNetworkingSockets_SteamNetworkingSockets002_CreateSocketPair(void *, HSteamNetConnection *, HSteamNetConnection *, bool, const SteamNetworkingIdentity *, const SteamNetworkingIdentity *); +extern bool cppISteamNetworkingSockets_SteamNetworkingSockets002_GetIdentity(void *, SteamNetworkingIdentity *); +extern bool cppISteamNetworkingSockets_SteamNetworkingSockets002_ReceivedRelayAuthTicket(void *, const void *, int, SteamDatagramRelayAuthTicket *); +extern int cppISteamNetworkingSockets_SteamNetworkingSockets002_FindRelayAuthTicketForServer(void *, const SteamNetworkingIdentity *, int, SteamDatagramRelayAuthTicket *); +extern HSteamNetConnection cppISteamNetworkingSockets_SteamNetworkingSockets002_ConnectToHostedDedicatedServer(void *, const SteamNetworkingIdentity *, int); +extern uint16 cppISteamNetworkingSockets_SteamNetworkingSockets002_GetHostedDedicatedServerPort(void *); +extern SteamNetworkingPOPID cppISteamNetworkingSockets_SteamNetworkingSockets002_GetHostedDedicatedServerPOPID(void *); +extern bool cppISteamNetworkingSockets_SteamNetworkingSockets002_GetHostedDedicatedServerAddress(void *, SteamDatagramHostedAddress *); +extern HSteamListenSocket cppISteamNetworkingSockets_SteamNetworkingSockets002_CreateHostedDedicatedServerListenSocket(void *, int); diff --git a/lsteamclient/cppISteamNetworking_SteamNetworking005.cpp b/lsteamclient/cppISteamNetworking_SteamNetworking005.cpp index b41838a0..0ff7c487 100644 --- a/lsteamclient/cppISteamNetworking_SteamNetworking005.cpp +++ b/lsteamclient/cppISteamNetworking_SteamNetworking005.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/cppISteamParentalSettings_STEAMPARENTALSETTINGS_INTERFACE_VERSION001.cpp b/lsteamclient/cppISteamParentalSettings_STEAMPARENTALSETTINGS_INTERFACE_VERSION001.cpp index 3bb04241..bc705f10 100644 --- a/lsteamclient/cppISteamParentalSettings_STEAMPARENTALSETTINGS_INTERFACE_VERSION001.cpp +++ b/lsteamclient/cppISteamParentalSettings_STEAMPARENTALSETTINGS_INTERFACE_VERSION001.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamworks_sdk_144/isteamparentalsettings.h" #include "steamclient_private.h" #ifdef __cplusplus diff --git a/lsteamclient/cppISteamParties_SteamParties002.cpp b/lsteamclient/cppISteamParties_SteamParties002.cpp index 212f2730..744ed1eb 100644 --- a/lsteamclient/cppISteamParties_SteamParties002.cpp +++ b/lsteamclient/cppISteamParties_SteamParties002.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/cppISteamRemoteStorage_STEAMREMOTESTORAGE_INTERFACE_VERSION014.cpp b/lsteamclient/cppISteamRemoteStorage_STEAMREMOTESTORAGE_INTERFACE_VERSION014.cpp index b428e5ff..ff4d2c0d 100644 --- a/lsteamclient/cppISteamRemoteStorage_STEAMREMOTESTORAGE_INTERFACE_VERSION014.cpp +++ b/lsteamclient/cppISteamRemoteStorage_STEAMREMOTESTORAGE_INTERFACE_VERSION014.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/cppISteamScreenshots_STEAMSCREENSHOTS_INTERFACE_VERSION003.cpp b/lsteamclient/cppISteamScreenshots_STEAMSCREENSHOTS_INTERFACE_VERSION003.cpp index aef2258a..6830a139 100644 --- a/lsteamclient/cppISteamScreenshots_STEAMSCREENSHOTS_INTERFACE_VERSION003.cpp +++ b/lsteamclient/cppISteamScreenshots_STEAMSCREENSHOTS_INTERFACE_VERSION003.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/cppISteamUGC_STEAMUGC_INTERFACE_VERSION012.cpp b/lsteamclient/cppISteamUGC_STEAMUGC_INTERFACE_VERSION012.cpp index ffc88e37..8f493a51 100644 --- a/lsteamclient/cppISteamUGC_STEAMUGC_INTERFACE_VERSION012.cpp +++ b/lsteamclient/cppISteamUGC_STEAMUGC_INTERFACE_VERSION012.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/cppISteamUserStats_STEAMUSERSTATS_INTERFACE_VERSION011.cpp b/lsteamclient/cppISteamUserStats_STEAMUSERSTATS_INTERFACE_VERSION011.cpp index 296c3e9b..18fc4556 100644 --- a/lsteamclient/cppISteamUserStats_STEAMUSERSTATS_INTERFACE_VERSION011.cpp +++ b/lsteamclient/cppISteamUserStats_STEAMUSERSTATS_INTERFACE_VERSION011.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/cppISteamUser_SteamUser020.cpp b/lsteamclient/cppISteamUser_SteamUser020.cpp index 773e386a..60e4bb7f 100644 --- a/lsteamclient/cppISteamUser_SteamUser020.cpp +++ b/lsteamclient/cppISteamUser_SteamUser020.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/cppISteamUtils_SteamUtils009.cpp b/lsteamclient/cppISteamUtils_SteamUtils009.cpp index 3eb37cde..a67ec65a 100644 --- a/lsteamclient/cppISteamUtils_SteamUtils009.cpp +++ b/lsteamclient/cppISteamUtils_SteamUtils009.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/cppISteamVideo_STEAMVIDEO_INTERFACE_V002.cpp b/lsteamclient/cppISteamVideo_STEAMVIDEO_INTERFACE_V002.cpp index 73e98466..bac81536 100644 --- a/lsteamclient/cppISteamVideo_STEAMVIDEO_INTERFACE_V002.cpp +++ b/lsteamclient/cppISteamVideo_STEAMVIDEO_INTERFACE_V002.cpp @@ -1,5 +1,6 @@ #include "steam_defs.h" #include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" #ifdef __cplusplus extern "C" { diff --git a/lsteamclient/gen_wrapper.py b/lsteamclient/gen_wrapper.py index 7eae72ea..1ba6c536 100755 --- a/lsteamclient/gen_wrapper.py +++ b/lsteamclient/gen_wrapper.py @@ -134,6 +134,9 @@ files = [ ("isteamparentalsettings.h", [ "ISteamParentalSettings" ]), + ("isteamnetworkingsockets.h", [ + "ISteamNetworkingSockets" + ]), ("isteamnetworkingsocketsserialized.h", [ "ISteamNetworkingSocketsSerialized" ]), @@ -157,6 +160,11 @@ exempt_structs = [ "ValvePackingSentinel_t" ] +# we have converters for these written by hand because they're too complicated to generate +manually_handled_structs = [ + "SteamNetworkingMessage_t" +] + #struct_conversion_cache = { # '142': { # 'SteamUGCDetails_t': True, @@ -371,6 +379,8 @@ def find_windows_struct(struct): def struct_needs_conversion_nocache(struct): if strip_const(struct.spelling) in exempt_structs: return False + if strip_const(struct.spelling) in manually_handled_structs: + return True windows_struct = find_windows_struct(struct) assert(not windows_struct is None) #must find windows_struct for field in struct.get_fields(): @@ -505,9 +515,13 @@ def handle_method(cfile, classname, winclassname, cppname, method, cpp, cpp_h, e for param in need_convert: if param.type.kind == clang.cindex.TypeKind.POINTER: #handle single pointers, but not double pointers - assert(param.type.get_pointee().kind == clang.cindex.TypeKind.RECORD) + real_type = param.type; + while real_type.kind == clang.cindex.TypeKind.POINTER: + real_type = real_type.get_pointee() + assert(param.type.get_pointee().kind == clang.cindex.TypeKind.RECORD or \ + strip_const(real_type.spelling) in manually_handled_structs) cpp.write(" %s lin_%s;\n" % (strip_const(param.type.get_pointee().spelling), param.spelling)) - cpp.write(" win_to_lin_struct_%s_%s(%s, &lin_%s);\n" % (strip_const(param.type.get_pointee().spelling), sdkver, param.spelling, param.spelling)) + cpp.write(" win_to_lin_struct_%s_%s(%s, &lin_%s);\n" % (strip_const(real_type.spelling), sdkver, param.spelling, param.spelling)) else: #raw structs cpp.write(" %s lin_%s;\n" % (param.type.spelling, param.spelling)) @@ -596,7 +610,14 @@ def handle_method(cfile, classname, winclassname, cppname, method, cpp, cpp_h, e for param in need_convert: if param.type.kind == clang.cindex.TypeKind.POINTER: if not "const " in param.type.spelling: #don't modify const arguments - cpp.write(" lin_to_win_struct_%s_%s(&lin_%s, %s);\n" % (param.type.get_pointee().spelling, sdkver, param.spelling, param.spelling)) + real_type = param.type; + while real_type.kind == clang.cindex.TypeKind.POINTER: + real_type = real_type.get_pointee() + if strip_const(real_type.spelling) in manually_handled_structs: + #this is clumsy + cpp.write(" lin_to_win_struct_%s_%s(retval, &lin_%s, %s);\n" % (real_type.spelling, sdkver, param.spelling, param.spelling)) + else: + cpp.write(" lin_to_win_struct_%s_%s(&lin_%s, %s);\n" % (real_type.spelling, sdkver, param.spelling, param.spelling)) else: cpp.write(" lin_to_win_struct_%s_%s(&lin_%s, &%s);\n" % (param.type.spelling, sdkver, param.spelling, param.spelling)) if method.result_type.kind != clang.cindex.TypeKind.VOID and \ @@ -653,6 +674,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(steamclient); cpp = open("%s.cpp" % cppname, "w") cpp.write("#include \"steam_defs.h\"\n") cpp.write("#include \"steamworks_sdk_%s/steam_api.h\"\n" % sdkver) + if os.path.isfile("steamworks_sdk_%s/steamnetworkingtypes.h" % sdkver): + cpp.write("#include \"steamworks_sdk_%s/steamnetworkingtypes.h\"\n" % sdkver) if not fname == "steam_api.h": cpp.write("#include \"steamworks_sdk_%s/%s\"\n" % (sdkver, fname)) cpp.write("#include \"steamclient_private.h\"\n") @@ -741,7 +764,11 @@ def handle_struct(sdkver, struct): struct_needs_conversion(m.type): to_file.write(" win%s_%s %s;\n" % (m.type.spelling, sdkver, m.displayname)) else: - to_file.write(" %s %s;\n" % (m.type.spelling, m.displayname)) + if m.type.kind == clang.cindex.TypeKind.POINTER and \ + m.type.get_pointee().kind == clang.cindex.TypeKind.FUNCTIONPROTO: + to_file.write(" void *%s; /*fn pointer*/\n" % m.displayname) + else: + to_file.write(" %s %s;\n" % (m.type.spelling, m.displayname)) to_file.write("} __attribute__ ((ms_struct));\n") to_file.write("#pragma pack( pop )\n") @@ -764,10 +791,16 @@ def handle_struct(sdkver, struct): hfile.write("typedef struct win%s win%s;\n" % (struct_name, struct_name)) hfile.write("struct %s;\n" % struct.displayname); + if strip_const(struct.spelling) in manually_handled_structs: + #this is clumsy + hfile.write("extern void %s(struct win%s **w, struct %s **l);\n" % (w2l_handler_name, struct_name, struct.displayname)) + hfile.write("extern void %s(int retval, struct %s **l, struct win%s **w);\n" % (l2w_handler_name, struct.displayname, struct_name)) + hfile.write("#endif\n\n") + return + hfile.write("extern void %s(const struct win%s *w, struct %s *l);\n" % (w2l_handler_name, struct_name, struct.displayname)) hfile.write("extern void %s(const struct %s *l, struct win%s *w);\n" % (l2w_handler_name, struct.displayname, struct_name)) hfile.write("#endif\n\n") - else: #for callbacks, we use the windows struct size in the cb dispatch switch windows_struct = find_windows_struct(struct.type) @@ -812,6 +845,8 @@ def handle_struct(sdkver, struct): cppfile.write("#include \"steamworks_sdk_%s/isteamgameserverstats.h\"\n" % (sdkver)) if os.path.isfile("steamworks_sdk_%s/isteamgamecoordinator.h" % sdkver): cppfile.write("#include \"steamworks_sdk_%s/isteamgamecoordinator.h\"\n" % sdkver) + if os.path.isfile("steamworks_sdk_%s/steamnetworkingtypes.h" % sdkver): + cppfile.write("#include \"steamworks_sdk_%s/steamnetworkingtypes.h\"\n" % sdkver) cppfile.write("#include \"steamclient_private.h\"\n") cppfile.write("extern \"C\" {\n") cppfile.write("#define SDKVER_%s\n" % sdkver) diff --git a/lsteamclient/queue.h b/lsteamclient/queue.h new file mode 100644 index 00000000..f3044dc1 --- /dev/null +++ b/lsteamclient/queue.h @@ -0,0 +1,113 @@ +/* $OpenBSD: queue.h,v 1.45 2018/07/12 14:22:54 sashan Exp $ */ +/* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */ + +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)queue.h 8.5 (Berkeley) 8/20/94 + */ + +#if defined(QUEUE_MACRO_DEBUG) || (defined(_KERNEL) && defined(DIAGNOSTIC)) +#define _Q_INVALID ((void *)-1) +#define _Q_INVALIDATE(a) (a) = _Q_INVALID +#else +#define _Q_INVALIDATE(a) +#endif + +/* + * Singly-linked List definitions. + */ +#define SLIST_HEAD(name, type) \ +struct name { \ + struct type *slh_first; /* first element */ \ +} + +#define SLIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define SLIST_ENTRY(type) \ +struct { \ + struct type *sle_next; /* next element */ \ +} + +/* + * Singly-linked List access methods. + */ +#define SLIST_FIRST(head) ((head)->slh_first) +#define SLIST_END(head) NULL +#define SLIST_EMPTY(head) (SLIST_FIRST(head) == SLIST_END(head)) +#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) + +#define SLIST_FOREACH(var, head, field) \ + for((var) = SLIST_FIRST(head); \ + (var) != SLIST_END(head); \ + (var) = SLIST_NEXT(var, field)) + +#define SLIST_FOREACH_SAFE(var, head, field, tvar) \ + for ((var) = SLIST_FIRST(head); \ + (var) && ((tvar) = SLIST_NEXT(var, field), 1); \ + (var) = (tvar)) + +/* + * Singly-linked List functions. + */ +#define SLIST_INIT(head) { \ + SLIST_FIRST(head) = SLIST_END(head); \ +} + +#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ + (elm)->field.sle_next = (slistelm)->field.sle_next; \ + (slistelm)->field.sle_next = (elm); \ +} while (0) + +#define SLIST_INSERT_HEAD(head, elm, field) do { \ + (elm)->field.sle_next = (head)->slh_first; \ + (head)->slh_first = (elm); \ +} while (0) + +#define SLIST_REMOVE_AFTER(elm, field) do { \ + (elm)->field.sle_next = (elm)->field.sle_next->field.sle_next; \ +} while (0) + +#define SLIST_REMOVE_HEAD(head, field) do { \ + (head)->slh_first = (head)->slh_first->field.sle_next; \ +} while (0) + +#define SLIST_REMOVE(head, elm, type, field) do { \ + if ((head)->slh_first == (elm)) { \ + SLIST_REMOVE_HEAD((head), field); \ + } else { \ + struct type *curelm = (head)->slh_first; \ + \ + while (curelm->field.sle_next != (elm)) \ + curelm = curelm->field.sle_next; \ + curelm->field.sle_next = \ + curelm->field.sle_next->field.sle_next; \ + } \ + _Q_INVALIDATE((elm)->field.sle_next); \ +} while (0) diff --git a/lsteamclient/steam_defs.h b/lsteamclient/steam_defs.h index ff439448..2bb89aee 100644 --- a/lsteamclient/steam_defs.h +++ b/lsteamclient/steam_defs.h @@ -8,6 +8,17 @@ typedef uint32_t EHTMLMouseButton, EHTMLKeyModifiers; typedef char bool; /* 1 byte on modern visual studio c++ */ #endif +typedef uint8_t uint8; +typedef int8_t int8; +typedef int16_t int16; +typedef uint16_t uint16; +typedef int32_t int32; +typedef uint32_t uint32; +typedef int64_t int64; +typedef uint64_t uint64; +typedef int64 lint64; +typedef uint64 ulint64; + typedef uint32_t EUserUGCList, EUGCMatchingUGCType, EUserUGCListSortOrder, @@ -73,11 +84,12 @@ typedef uint32_t EUserUGCList, EActivateGameOverlayToWebPageMode, ESteamPartyBeaconLocationData, ESteamPartyBeaconLocationType, - EInputActionOrigin + EInputActionOrigin, + ESteamNetworkingIdentityType ; -/* these are PODs, so just copy the data. hopefully the - * packing and alignment are the same... */ +/* structs below are PODs with identical size & layout across platforms */ + typedef struct CSteamID { unsigned char a[8]; } CSteamID; typedef struct CGameID { unsigned char a[8]; } CGameID; typedef struct RemoteStorageUpdatePublishedFileRequest_t { unsigned char a[40]; } RemoteStorageUpdatePublishedFileRequest_t; @@ -127,6 +139,42 @@ typedef struct InputMotionData_t float rotVelZ; } InputMotionData_t; +typedef struct SteamNetworkingIPAddr +{ + union + { + uint8 m_ipv6[ 16 ]; + struct + { + uint64 m_8zeros; + uint16 m_0000; + uint16 m_ffff; + uint8 m_ip[ 4 ]; + } m_ipv4; + } ip; + uint16 m_port; +} SteamNetworkingIPAddr; + +#define k_cchMaxGenericString 32 +#define k_cchMaxXboxPairwiseID 32 +#define k_cbMaxGenericBytes 32 + +typedef struct SteamNetworkingIdentity +{ + ESteamNetworkingIdentityType m_eType; + + int m_cbSize; + + union { + uint64 m_steamID64; + char m_szGenericString[ k_cchMaxGenericString ]; + char m_szXboxPairwiseID[ k_cchMaxXboxPairwiseID ]; + uint8 m_genericBytes[ k_cbMaxGenericBytes ]; + SteamNetworkingIPAddr m_ip; + uint32 m_reserved[ 32 ]; + } data; +} SteamNetworkingIdentity; + #pragma pack( pop ) /* never dereferenced */ @@ -144,22 +192,16 @@ typedef struct SteamUGCDetails_t SteamUGCDetails_t; typedef struct gameserveritem_t gameserveritem_t; typedef struct MatchMakingKeyValuePair_t MatchMakingKeyValuePair_t; typedef struct SteamPartyBeaconLocation_t SteamPartyBeaconLocation_t; +typedef struct SteamNetConnectionInfo_t SteamNetConnectionInfo_t; +typedef struct SteamNetworkingQuickConnectionStatus SteamNetworkingQuickConnectionStatus; +typedef struct SteamDatagramRelayAuthTicket SteamDatagramRelayAuthTicket; +typedef struct SteamDatagramHostedAddress SteamDatagramHostedAddress; /* FIXME: we don't care about fn pointer types, just pass 'em through */ typedef void *SteamAPI_CheckCallbackRegistered_t; typedef void *SteamAPIWarningMessageHook_t; typedef void *SteamAPI_PostAPIResultInProcess_t; -typedef uint8_t uint8; -typedef int8_t int8; -typedef int16_t int16; -typedef uint16_t uint16; -typedef int32_t int32; -typedef uint32_t uint32; -typedef int64_t int64; -typedef uint64_t uint64; -typedef int64 lint64; -typedef uint64 ulint64; typedef uint8 Salt_t[8]; typedef uint64 GID_t; typedef uint64 JobID_t; @@ -211,6 +253,10 @@ typedef uint64 InputHandle_t; typedef uint64 InputActionSetHandle_t; typedef uint64 InputDigitalActionHandle_t; typedef uint64 InputAnalogActionHandle_t; +typedef uint32 HSteamNetConnection; +typedef int64 SteamNetworkingMicroseconds; +typedef uint32 HSteamListenSocket; +typedef uint32 SteamNetworkingPOPID; #pragma pack( push, 4 ) typedef struct CallbackMsg_t diff --git a/lsteamclient/steamclient_manual_144.cpp b/lsteamclient/steamclient_manual_144.cpp new file mode 100644 index 00000000..e17dd769 --- /dev/null +++ b/lsteamclient/steamclient_manual_144.cpp @@ -0,0 +1,99 @@ +#include "steam_defs.h" +#include "steamworks_sdk_144/steam_api.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" +#include "steamclient_private.h" +extern "C" { +#define SDKVER_144 +#include "struct_converters.h" + +#include "windows.h" +#include "queue.h" + +/***** manual struct converter for SteamNetworkingMessage_t *****/ + +struct msg_wrapper { + struct winSteamNetworkingMessage_t_144 win_msg; + struct SteamNetworkingMessage_t *lin_msg; + + void (*orig_FreeData)(SteamNetworkingMessage_t *); + + SLIST_ENTRY(msg_wrapper) entry; +}; + +SLIST_HEAD(free_msgs_head, msg_wrapper) free_msgs = SLIST_HEAD_INITIALIZER(free_msgs); +CRITICAL_SECTION free_msgs_lock = { NULL, -1, 0, 0, 0, 0 }; + +void CDECL win_FreeData(struct winSteamNetworkingMessage_t_144 *win_msg) +{ + struct msg_wrapper *msg = CONTAINING_RECORD(win_msg, struct msg_wrapper, win_msg); + if(msg->orig_FreeData) + msg->orig_FreeData(msg->lin_msg); +} + +void CDECL win_Release(struct winSteamNetworkingMessage_t_144 *win_msg) +{ + struct msg_wrapper *msg = CONTAINING_RECORD(win_msg, struct msg_wrapper, win_msg); + msg->lin_msg->m_pfnRelease(msg->lin_msg); + msg->lin_msg = NULL; + EnterCriticalSection(&free_msgs_lock); + SLIST_INSERT_HEAD(&free_msgs, msg, entry); + LeaveCriticalSection(&free_msgs_lock); +} + +void lin_FreeData(struct SteamNetworkingMessage_t *lin_msg) +{ + struct msg_wrapper *msg = CONTAINING_RECORD(lin_msg, struct msg_wrapper, lin_msg); + if(msg->win_msg.m_pfnFreeData) + ((void (*)(struct winSteamNetworkingMessage_t_144 *))msg->win_msg.m_pfnFreeData)(&msg->win_msg); +} + +void win_to_lin_struct_SteamNetworkingMessage_t_144(struct winSteamNetworkingMessage_t_144 **w, struct SteamNetworkingMessage_t **l) +{ + /* it's an output param, do nothing. */ +} + +void lin_to_win_struct_SteamNetworkingMessage_t_144(int n_messages, struct SteamNetworkingMessage_t **l, struct winSteamNetworkingMessage_t_144 **w) +{ + int i; + for(i = 0; i < n_messages; ++i) + { + struct msg_wrapper *msg; + + EnterCriticalSection(&free_msgs_lock); + + msg = SLIST_FIRST(&free_msgs); + + if(!msg){ + /* allocs can be pricey, so alloc in blocks */ +#define MSGS_PER_BLOCK 16 + struct msg_wrapper *msgs = (struct msg_wrapper *)HeapAlloc(GetProcessHeap(), 0, sizeof(struct msg_wrapper) * MSGS_PER_BLOCK); + for(i = 1; i < MSGS_PER_BLOCK; ++i) + SLIST_INSERT_HEAD(&free_msgs, &msg[i], entry); + msg = &msgs[0]; + }else + SLIST_REMOVE_HEAD(&free_msgs, entry); + + LeaveCriticalSection(&free_msgs_lock); + + msg->lin_msg = l[i]; + + msg->orig_FreeData = msg->lin_msg->m_pfnFreeData; + msg->lin_msg->m_pfnFreeData = lin_FreeData; + + msg->win_msg.m_pData = msg->lin_msg->m_pData; + msg->win_msg.m_cbSize = msg->lin_msg->m_cbSize; + msg->win_msg.m_conn = msg->lin_msg->m_conn; + msg->win_msg.m_sender = msg->lin_msg->m_sender; + msg->win_msg.m_nConnUserData = msg->lin_msg->m_nConnUserData; + msg->win_msg.m_usecTimeReceived= msg->lin_msg->m_usecTimeReceived; + msg->win_msg.m_nMessageNumber = msg->lin_msg->m_nMessageNumber; + msg->win_msg.m_pfnFreeData = (void*)win_FreeData; + msg->win_msg.m_pfnRelease = (void*)win_Release; + msg->win_msg.m_nChannel = msg->lin_msg->m_nChannel; + msg->win_msg.m___nPadDummy = msg->lin_msg->m___nPadDummy; + + w[i] = &msg->win_msg; + } +} + +} diff --git a/lsteamclient/steamworks_sdk_144/isteamnetworkingsockets.h b/lsteamclient/steamworks_sdk_144/isteamnetworkingsockets.h index 37175a03..a9befc09 100644 --- a/lsteamclient/steamworks_sdk_144/isteamnetworkingsockets.h +++ b/lsteamclient/steamworks_sdk_144/isteamnetworkingsockets.h @@ -53,7 +53,7 @@ public: /// /// When a client attempts to connect, a SteamNetConnectionStatusChangedCallback_t /// will be posted. The connection will be in the connecting state. - virtual HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddress ) = 0; + virtual HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr *localAddress ) = 0; /// Creates a connection and begins talking to a "server" over UDP at the /// given IPv4 or IPv6 address. The remote host must be listening with a @@ -73,7 +73,7 @@ public: /// distributed through some other out-of-band mechanism), you don't have any /// way of knowing who is actually on the other end, and thus are vulnerable to /// man-in-the-middle attacks. - virtual HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address ) = 0; + virtual HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr *address ) = 0; #ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR /// Like CreateListenSocketIP, but clients will connect using ConnectP2P @@ -99,7 +99,7 @@ public: /// /// If you use this, you probably want to call ISteamNetworkingUtils::InitializeRelayNetworkAccess() /// when your app initializes - virtual HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, int nVirtualPort ) = 0; + virtual HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity *identityRemote, int nVirtualPort ) = 0; #endif /// Accept an incoming connection that has been received on a listen socket. @@ -331,7 +331,7 @@ public: /// /// Typically this is useful just to confirm that you have a ticket, before you /// call ConnectToHostedDedicatedServer to connect to the server. - virtual int FindRelayAuthTicketForServer( const SteamNetworkingIdentity &identityGameServer, int nVirtualPort, SteamDatagramRelayAuthTicket *pOutParsedTicket ) = 0; + virtual int FindRelayAuthTicketForServer( const SteamNetworkingIdentity *identityGameServer, int nVirtualPort, SteamDatagramRelayAuthTicket *pOutParsedTicket ) = 0; /// Client call to connect to a server hosted in a Valve data center, on the specified virtual /// port. You must have placed a ticket for this server into the cache, or else this connect attempt will fail! @@ -342,7 +342,7 @@ public: /// /// If you use this, you probably want to call ISteamNetworkingUtils::InitializeRelayNetworkAccess() /// when your app initializes - virtual HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity &identityTarget, int nVirtualPort ) = 0; + virtual HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity *identityTarget, int nVirtualPort ) = 0; // // Servers hosted in Valve data centers diff --git a/lsteamclient/steamworks_sdk_144/steamnetworkingtypes.h b/lsteamclient/steamworks_sdk_144/steamnetworkingtypes.h index c48bf10e..55432926 100644 --- a/lsteamclient/steamworks_sdk_144/steamnetworkingtypes.h +++ b/lsteamclient/steamworks_sdk_144/steamnetworkingtypes.h @@ -20,7 +20,7 @@ #define STEAMNETWORKINGSOCKETS_INTERFACE extern #endif #define STEAMNETWORKINGSOCKETS_ENABLE_SDR -#include +#include "steam_api_common.h" // //---------------------------------------- @@ -148,7 +148,7 @@ struct SteamNetworkingIPAddr uint16 m_ffff; uint8 m_ip[ 4 ]; // NOTE: As bytes, i.e. network byte order } m_ipv4; - }; + } ip; uint16 m_port; // Host byte order /// See if two addresses are identical @@ -224,7 +224,7 @@ struct SteamNetworkingIdentity uint8 m_genericBytes[ k_cbMaxGenericBytes ]; SteamNetworkingIPAddr m_ip; uint32 m_reserved[ 32 ]; // Pad structure to leave easy room for future expansion - }; + } data; }; #pragma pack(pop) @@ -1051,7 +1051,6 @@ inline SteamNetworkingPOPID CalculateSteamNetworkingPOPIDFromString( const char template inline void GetSteamNetworkingLocationPOPStringFromID( SteamNetworkingPOPID id, char (&szCode)[N] ) { - static_assert( N >= 5, "Fixed-size buffer not big enough to hold SDR POP ID" ); szCode[0] = char( id >> 16U ); szCode[1] = char( id >> 8U ); szCode[2] = char( id ); @@ -1067,48 +1066,48 @@ inline void GetSteamNetworkingLocationPOPStringFromID( SteamNetworkingPOPID id, typedef SteamNetworkingMessage_t ISteamNetworkingMessage; typedef SteamNetworkingErrMsg SteamDatagramErrMsg; -inline void SteamNetworkingIPAddr::Clear() { memset( this, 0, sizeof(*this) ); } -inline bool SteamNetworkingIPAddr::IsIPv6AllZeros() const { const uint64 *q = (const uint64 *)m_ipv6; return q[0] == 0 && q[1] == 0; } -inline void SteamNetworkingIPAddr::SetIPv6( const uint8 *ipv6, uint16 nPort ) { memcpy( m_ipv6, ipv6, 16 ); m_port = nPort; } -inline void SteamNetworkingIPAddr::SetIPv4( uint32 nIP, uint16 nPort ) { m_ipv4.m_8zeros = 0; m_ipv4.m_0000 = 0; m_ipv4.m_ffff = 0xffff; m_ipv4.m_ip[0] = uint8(nIP>>24); m_ipv4.m_ip[1] = uint8(nIP>>16); m_ipv4.m_ip[2] = uint8(nIP>>8); m_ipv4.m_ip[3] = uint8(nIP); m_port = nPort; } -inline bool SteamNetworkingIPAddr::IsIPv4() const { return m_ipv4.m_8zeros == 0 && m_ipv4.m_0000 == 0 && m_ipv4.m_ffff == 0xffff; } -inline uint32 SteamNetworkingIPAddr::GetIPv4() const { return IsIPv4() ? ( (uint32(m_ipv4.m_ip[0])<<24) | (uint32(m_ipv4.m_ip[1])<<16) | (uint32(m_ipv4.m_ip[2])<<8) | uint32(m_ipv4.m_ip[3]) ) : 0; } -inline void SteamNetworkingIPAddr::SetIPv6LocalHost( uint16 nPort ) { m_ipv4.m_8zeros = 0; m_ipv4.m_0000 = 0; m_ipv4.m_ffff = 0; m_ipv6[12] = 0; m_ipv6[13] = 0; m_ipv6[14] = 0; m_ipv6[15] = 1; m_port = nPort; } -inline bool SteamNetworkingIPAddr::IsLocalHost() const { return ( m_ipv4.m_8zeros == 0 && m_ipv4.m_0000 == 0 && m_ipv4.m_ffff == 0 && m_ipv6[12] == 0 && m_ipv6[13] == 0 && m_ipv6[14] == 0 && m_ipv6[15] == 1 ) || ( GetIPv4() == 0x7f000001 ); } -inline bool SteamNetworkingIPAddr::operator==(const SteamNetworkingIPAddr &x ) const { return memcmp( this, &x, sizeof(SteamNetworkingIPAddr) ) == 0; } - -inline void SteamNetworkingIdentity::Clear() { memset( this, 0, sizeof(*this) ); } -inline bool SteamNetworkingIdentity::IsInvalid() const { return m_eType == k_ESteamNetworkingIdentityType_Invalid; } -inline void SteamNetworkingIdentity::SetSteamID( CSteamID steamID ) { SetSteamID64( steamID.ConvertToUint64() ); } -inline CSteamID SteamNetworkingIdentity::GetSteamID() const { return CSteamID( GetSteamID64() ); } -inline void SteamNetworkingIdentity::SetSteamID64( uint64 steamID ) { m_eType = k_ESteamNetworkingIdentityType_SteamID; m_cbSize = sizeof( m_steamID64 ); m_steamID64 = steamID; } -inline uint64 SteamNetworkingIdentity::GetSteamID64() const { return m_eType == k_ESteamNetworkingIdentityType_SteamID ? m_steamID64 : 0; } -inline bool SteamNetworkingIdentity::SetXboxPairwiseID( const char *pszString ) { size_t l = strlen( pszString ); if ( l < 1 || l >= sizeof(m_szXboxPairwiseID) ) return false; - m_eType = k_ESteamNetworkingIdentityType_XboxPairwiseID; m_cbSize = int(l+1); memcpy( m_szXboxPairwiseID, pszString, m_cbSize ); return true; } -inline const char *SteamNetworkingIdentity::GetXboxPairwiseID() const { return m_eType == k_ESteamNetworkingIdentityType_XboxPairwiseID ? m_szXboxPairwiseID : nullptr; } -inline void SteamNetworkingIdentity::SetIPAddr( const SteamNetworkingIPAddr &addr ) { m_eType = k_ESteamNetworkingIdentityType_IPAddress; m_cbSize = (int)sizeof(m_ip); m_ip = addr; } -inline const SteamNetworkingIPAddr *SteamNetworkingIdentity::GetIPAddr() const { return m_eType == k_ESteamNetworkingIdentityType_IPAddress ? &m_ip : nullptr; } -inline void SteamNetworkingIdentity::SetLocalHost() { m_eType = k_ESteamNetworkingIdentityType_IPAddress; m_cbSize = (int)sizeof(m_ip); m_ip.SetIPv6LocalHost(); } -inline bool SteamNetworkingIdentity::IsLocalHost() const { return m_eType == k_ESteamNetworkingIdentityType_IPAddress && m_ip.IsLocalHost(); } -inline bool SteamNetworkingIdentity::SetGenericString( const char *pszString ) { size_t l = strlen( pszString ); if ( l >= sizeof(m_szGenericString) ) return false; - m_eType = k_ESteamNetworkingIdentityType_GenericString; m_cbSize = int(l+1); memcpy( m_szGenericString, pszString, m_cbSize ); return true; } -inline const char *SteamNetworkingIdentity::GetGenericString() const { return m_eType == k_ESteamNetworkingIdentityType_GenericString ? m_szGenericString : nullptr; } -inline bool SteamNetworkingIdentity::SetGenericBytes( const void *data, size_t cbLen ) { if ( cbLen > sizeof(m_genericBytes) ) return false; - m_eType = k_ESteamNetworkingIdentityType_GenericBytes; m_cbSize = int(cbLen); memcpy( m_genericBytes, data, m_cbSize ); return true; } -inline const uint8 *SteamNetworkingIdentity::GetGenericBytes( int &cbLen ) const { if ( m_eType != k_ESteamNetworkingIdentityType_GenericBytes ) return nullptr; - cbLen = m_cbSize; return m_genericBytes; } -inline bool SteamNetworkingIdentity::operator==(const SteamNetworkingIdentity &x ) const { return m_eType == x.m_eType && m_cbSize == x.m_cbSize && memcmp( m_genericBytes, x.m_genericBytes, m_cbSize ) == 0; } -inline void SteamNetworkingMessage_t::Release() { (*m_pfnRelease)( this ); } - -#if defined( STEAMNETWORKINGSOCKETS_STATIC_LINK ) || !defined( STEAMNETWORKINGSOCKETS_STEAM ) -STEAMNETWORKINGSOCKETS_INTERFACE void SteamAPI_SteamNetworkingIPAddr_ToString( const SteamNetworkingIPAddr *pAddr, char *buf, size_t cbBuf, bool bWithPort ); -STEAMNETWORKINGSOCKETS_INTERFACE bool SteamAPI_SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr *pAddr, const char *pszStr ); -STEAMNETWORKINGSOCKETS_INTERFACE void SteamAPI_SteamNetworkingIdentity_ToString( const SteamNetworkingIdentity &identity, char *buf, size_t cbBuf ); -STEAMNETWORKINGSOCKETS_INTERFACE bool SteamAPI_SteamNetworkingIdentity_ParseString( SteamNetworkingIdentity *pIdentity, size_t sizeofIdentity, const char *pszStr ); -inline void SteamNetworkingIPAddr::ToString( char *buf, size_t cbBuf, bool bWithPort ) const { SteamAPI_SteamNetworkingIPAddr_ToString( this, buf, cbBuf, bWithPort ); } -inline bool SteamNetworkingIPAddr::ParseString( const char *pszStr ) { return SteamAPI_SteamNetworkingIPAddr_ParseString( this, pszStr ); } -inline void SteamNetworkingIdentity::ToString( char *buf, size_t cbBuf ) const { SteamAPI_SteamNetworkingIdentity_ToString( *this, buf, cbBuf ); } -inline bool SteamNetworkingIdentity::ParseString( const char *pszStr ) { return SteamAPI_SteamNetworkingIdentity_ParseString( this, sizeof(*this), pszStr ); } -#endif +//inline void SteamNetworkingIPAddr::Clear() { memset( this, 0, sizeof(*this) ); } +//inline bool SteamNetworkingIPAddr::IsIPv6AllZeros() const { const uint64 *q = (const uint64 *)m_ipv6; return q[0] == 0 && q[1] == 0; } +//inline void SteamNetworkingIPAddr::SetIPv6( const uint8 *ipv6, uint16 nPort ) { memcpy( m_ipv6, ipv6, 16 ); m_port = nPort; } +//inline void SteamNetworkingIPAddr::SetIPv4( uint32 nIP, uint16 nPort ) { m_ipv4.m_8zeros = 0; m_ipv4.m_0000 = 0; m_ipv4.m_ffff = 0xffff; m_ipv4.m_ip[0] = uint8(nIP>>24); m_ipv4.m_ip[1] = uint8(nIP>>16); m_ipv4.m_ip[2] = uint8(nIP>>8); m_ipv4.m_ip[3] = uint8(nIP); m_port = nPort; } +//inline bool SteamNetworkingIPAddr::IsIPv4() const { return m_ipv4.m_8zeros == 0 && m_ipv4.m_0000 == 0 && m_ipv4.m_ffff == 0xffff; } +//inline uint32 SteamNetworkingIPAddr::GetIPv4() const { return IsIPv4() ? ( (uint32(m_ipv4.m_ip[0])<<24) | (uint32(m_ipv4.m_ip[1])<<16) | (uint32(m_ipv4.m_ip[2])<<8) | uint32(m_ipv4.m_ip[3]) ) : 0; } +//inline void SteamNetworkingIPAddr::SetIPv6LocalHost( uint16 nPort ) { m_ipv4.m_8zeros = 0; m_ipv4.m_0000 = 0; m_ipv4.m_ffff = 0; m_ipv6[12] = 0; m_ipv6[13] = 0; m_ipv6[14] = 0; m_ipv6[15] = 1; m_port = nPort; } +//inline bool SteamNetworkingIPAddr::IsLocalHost() const { return ( m_ipv4.m_8zeros == 0 && m_ipv4.m_0000 == 0 && m_ipv4.m_ffff == 0 && m_ipv6[12] == 0 && m_ipv6[13] == 0 && m_ipv6[14] == 0 && m_ipv6[15] == 1 ) || ( GetIPv4() == 0x7f000001 ); } +//inline bool SteamNetworkingIPAddr::operator==(const SteamNetworkingIPAddr &x ) const { return memcmp( this, &x, sizeof(SteamNetworkingIPAddr) ) == 0; } +// +//inline void SteamNetworkingIdentity::Clear() { memset( this, 0, sizeof(*this) ); } +//inline bool SteamNetworkingIdentity::IsInvalid() const { return m_eType == k_ESteamNetworkingIdentityType_Invalid; } +//inline void SteamNetworkingIdentity::SetSteamID( CSteamID steamID ) { SetSteamID64( steamID.ConvertToUint64() ); } +//inline CSteamID SteamNetworkingIdentity::GetSteamID() const { return CSteamID( GetSteamID64() ); } +//inline void SteamNetworkingIdentity::SetSteamID64( uint64 steamID ) { m_eType = k_ESteamNetworkingIdentityType_SteamID; m_cbSize = sizeof( m_steamID64 ); m_steamID64 = steamID; } +//inline uint64 SteamNetworkingIdentity::GetSteamID64() const { return m_eType == k_ESteamNetworkingIdentityType_SteamID ? m_steamID64 : 0; } +//inline bool SteamNetworkingIdentity::SetXboxPairwiseID( const char *pszString ) { size_t l = strlen( pszString ); if ( l < 1 || l >= sizeof(m_szXboxPairwiseID) ) return false; +// m_eType = k_ESteamNetworkingIdentityType_XboxPairwiseID; m_cbSize = int(l+1); memcpy( m_szXboxPairwiseID, pszString, m_cbSize ); return true; } +//inline const char *SteamNetworkingIdentity::GetXboxPairwiseID() const { return m_eType == k_ESteamNetworkingIdentityType_XboxPairwiseID ? m_szXboxPairwiseID : nullptr; } +//inline void SteamNetworkingIdentity::SetIPAddr( const SteamNetworkingIPAddr &addr ) { m_eType = k_ESteamNetworkingIdentityType_IPAddress; m_cbSize = (int)sizeof(m_ip); m_ip = addr; } +//inline const SteamNetworkingIPAddr *SteamNetworkingIdentity::GetIPAddr() const { return m_eType == k_ESteamNetworkingIdentityType_IPAddress ? &m_ip : nullptr; } +//inline void SteamNetworkingIdentity::SetLocalHost() { m_eType = k_ESteamNetworkingIdentityType_IPAddress; m_cbSize = (int)sizeof(m_ip); m_ip.SetIPv6LocalHost(); } +//inline bool SteamNetworkingIdentity::IsLocalHost() const { return m_eType == k_ESteamNetworkingIdentityType_IPAddress && m_ip.IsLocalHost(); } +//inline bool SteamNetworkingIdentity::SetGenericString( const char *pszString ) { size_t l = strlen( pszString ); if ( l >= sizeof(m_szGenericString) ) return false; +// m_eType = k_ESteamNetworkingIdentityType_GenericString; m_cbSize = int(l+1); memcpy( m_szGenericString, pszString, m_cbSize ); return true; } +//inline const char *SteamNetworkingIdentity::GetGenericString() const { return m_eType == k_ESteamNetworkingIdentityType_GenericString ? m_szGenericString : nullptr; } +//inline bool SteamNetworkingIdentity::SetGenericBytes( const void *data, size_t cbLen ) { if ( cbLen > sizeof(m_genericBytes) ) return false; +// m_eType = k_ESteamNetworkingIdentityType_GenericBytes; m_cbSize = int(cbLen); memcpy( m_genericBytes, data, m_cbSize ); return true; } +//inline const uint8 *SteamNetworkingIdentity::GetGenericBytes( int &cbLen ) const { if ( m_eType != k_ESteamNetworkingIdentityType_GenericBytes ) return nullptr; +// cbLen = m_cbSize; return m_genericBytes; } +//inline bool SteamNetworkingIdentity::operator==(const SteamNetworkingIdentity &x ) const { return m_eType == x.m_eType && m_cbSize == x.m_cbSize && memcmp( m_genericBytes, x.m_genericBytes, m_cbSize ) == 0; } +//inline void SteamNetworkingMessage_t::Release() { (*m_pfnRelease)( this ); } +// +//#if defined( STEAMNETWORKINGSOCKETS_STATIC_LINK ) || !defined( STEAMNETWORKINGSOCKETS_STEAM ) +//STEAMNETWORKINGSOCKETS_INTERFACE void SteamAPI_SteamNetworkingIPAddr_ToString( const SteamNetworkingIPAddr *pAddr, char *buf, size_t cbBuf, bool bWithPort ); +//STEAMNETWORKINGSOCKETS_INTERFACE bool SteamAPI_SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr *pAddr, const char *pszStr ); +//STEAMNETWORKINGSOCKETS_INTERFACE void SteamAPI_SteamNetworkingIdentity_ToString( const SteamNetworkingIdentity &identity, char *buf, size_t cbBuf ); +//STEAMNETWORKINGSOCKETS_INTERFACE bool SteamAPI_SteamNetworkingIdentity_ParseString( SteamNetworkingIdentity *pIdentity, size_t sizeofIdentity, const char *pszStr ); +//inline void SteamNetworkingIPAddr::ToString( char *buf, size_t cbBuf, bool bWithPort ) const { SteamAPI_SteamNetworkingIPAddr_ToString( this, buf, cbBuf, bWithPort ); } +//inline bool SteamNetworkingIPAddr::ParseString( const char *pszStr ) { return SteamAPI_SteamNetworkingIPAddr_ParseString( this, pszStr ); } +//inline void SteamNetworkingIdentity::ToString( char *buf, size_t cbBuf ) const { SteamAPI_SteamNetworkingIdentity_ToString( *this, buf, cbBuf ); } +//inline bool SteamNetworkingIdentity::ParseString( const char *pszStr ) { return SteamAPI_SteamNetworkingIdentity_ParseString( this, sizeof(*this), pszStr ); } +//#endif #endif // #ifndef STEAMNETWORKINGTYPES diff --git a/lsteamclient/struct_converters.h b/lsteamclient/struct_converters.h index 7ee2e013..50b380ff 100644 --- a/lsteamclient/struct_converters.h +++ b/lsteamclient/struct_converters.h @@ -64,6 +64,28 @@ extern void win_to_lin_struct_SteamUGCDetails_t_144(const struct winSteamUGCDeta extern void lin_to_win_struct_SteamUGCDetails_t_144(const struct SteamUGCDetails_t *l, struct winSteamUGCDetails_t_144 *w); #endif +#if defined(SDKVER_144) || !defined(__cplusplus) +#pragma pack( push, 8 ) +struct winSteamNetworkingMessage_t_144 { + void * m_pData; + uint32 m_cbSize; + HSteamNetConnection m_conn; + SteamNetworkingIdentity m_sender; + int64 m_nConnUserData; + SteamNetworkingMicroseconds m_usecTimeReceived; + int64 m_nMessageNumber; + void *m_pfnFreeData; /*fn pointer*/ + void *m_pfnRelease; /*fn pointer*/ + int m_nChannel; + int m___nPadDummy; +} __attribute__ ((ms_struct)); +#pragma pack( pop ) +typedef struct winSteamNetworkingMessage_t_144 winSteamNetworkingMessage_t_144; +struct SteamNetworkingMessage_t; +extern void win_to_lin_struct_SteamNetworkingMessage_t_144(struct winSteamNetworkingMessage_t_144 **w, struct SteamNetworkingMessage_t **l); +extern void lin_to_win_struct_SteamNetworkingMessage_t_144(int retval, struct SteamNetworkingMessage_t **l, struct winSteamNetworkingMessage_t_144 **w); +#endif + #if defined(SDKVER_143y) || !defined(__cplusplus) #pragma pack( push, 8 ) struct winSteamPartyBeaconLocation_t_143y { diff --git a/lsteamclient/struct_converters_144.cpp b/lsteamclient/struct_converters_144.cpp index f3a83df1..71758c16 100644 --- a/lsteamclient/struct_converters_144.cpp +++ b/lsteamclient/struct_converters_144.cpp @@ -3,6 +3,7 @@ #include "steamworks_sdk_144/isteamgameserver.h" #include "steamworks_sdk_144/isteamgameserverstats.h" #include "steamworks_sdk_144/isteamgamecoordinator.h" +#include "steamworks_sdk_144/steamnetworkingtypes.h" #include "steamclient_private.h" extern "C" { #define SDKVER_144 diff --git a/lsteamclient/winISteamNetworkingSockets.c b/lsteamclient/winISteamNetworkingSockets.c new file mode 100644 index 00000000..699bcb46 --- /dev/null +++ b/lsteamclient/winISteamNetworkingSockets.c @@ -0,0 +1,273 @@ +/* This file is auto-generated, do not edit. */ +#include + +#include "windef.h" +#include "winbase.h" +#include "wine/debug.h" + +#include "cxx.h" + +#include "steam_defs.h" + +#include "steamclient_private.h" + +#include "struct_converters.h" + +WINE_DEFAULT_DEBUG_CHANNEL(steamclient); + +#include "cppISteamNetworkingSockets_SteamNetworkingSockets002.h" + +typedef struct __winISteamNetworkingSockets_SteamNetworkingSockets002 { + vtable_ptr *vtable; + void *linux_side; +} winISteamNetworkingSockets_SteamNetworkingSockets002; + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_CreateListenSocketIP, 8) +HSteamListenSocket __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_CreateListenSocketIP(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, const SteamNetworkingIPAddr * localAddress) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_CreateListenSocketIP(_this->linux_side, localAddress); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_ConnectByIPAddress, 8) +HSteamNetConnection __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_ConnectByIPAddress(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, const SteamNetworkingIPAddr * address) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_ConnectByIPAddress(_this->linux_side, address); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_CreateListenSocketP2P, 8) +HSteamListenSocket __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_CreateListenSocketP2P(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, int nVirtualPort) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_CreateListenSocketP2P(_this->linux_side, nVirtualPort); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_ConnectP2P, 12) +HSteamNetConnection __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_ConnectP2P(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, const SteamNetworkingIdentity * identityRemote, int nVirtualPort) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_ConnectP2P(_this->linux_side, identityRemote, nVirtualPort); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_AcceptConnection, 8) +EResult __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_AcceptConnection(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, HSteamNetConnection hConn) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_AcceptConnection(_this->linux_side, hConn); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_CloseConnection, 20) +bool __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_CloseConnection(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, HSteamNetConnection hPeer, int nReason, const char * pszDebug, bool bEnableLinger) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_CloseConnection(_this->linux_side, hPeer, nReason, pszDebug, bEnableLinger); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_CloseListenSocket, 8) +bool __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_CloseListenSocket(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, HSteamListenSocket hSocket) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_CloseListenSocket(_this->linux_side, hSocket); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_SetConnectionUserData, 16) +bool __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_SetConnectionUserData(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, HSteamNetConnection hPeer, int64 nUserData) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_SetConnectionUserData(_this->linux_side, hPeer, nUserData); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_GetConnectionUserData, 8) +int64 __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_GetConnectionUserData(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, HSteamNetConnection hPeer) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_GetConnectionUserData(_this->linux_side, hPeer); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_SetConnectionName, 12) +void __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_SetConnectionName(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, HSteamNetConnection hPeer, const char * pszName) +{ + TRACE("%p\n", _this); + cppISteamNetworkingSockets_SteamNetworkingSockets002_SetConnectionName(_this->linux_side, hPeer, pszName); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_GetConnectionName, 16) +bool __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_GetConnectionName(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, HSteamNetConnection hPeer, char * pszName, int nMaxLen) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_GetConnectionName(_this->linux_side, hPeer, pszName, nMaxLen); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_SendMessageToConnection, 20) +EResult __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_SendMessageToConnection(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, HSteamNetConnection hConn, const void * pData, uint32 cbData, int nSendFlags) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_SendMessageToConnection(_this->linux_side, hConn, pData, cbData, nSendFlags); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_FlushMessagesOnConnection, 8) +EResult __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_FlushMessagesOnConnection(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, HSteamNetConnection hConn) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_FlushMessagesOnConnection(_this->linux_side, hConn); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_ReceiveMessagesOnConnection, 16) +int __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_ReceiveMessagesOnConnection(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, HSteamNetConnection hConn, winSteamNetworkingMessage_t_144 ** ppOutMessages, int nMaxMessages) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_ReceiveMessagesOnConnection(_this->linux_side, hConn, ppOutMessages, nMaxMessages); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_ReceiveMessagesOnListenSocket, 16) +int __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_ReceiveMessagesOnListenSocket(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, HSteamListenSocket hSocket, winSteamNetworkingMessage_t_144 ** ppOutMessages, int nMaxMessages) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_ReceiveMessagesOnListenSocket(_this->linux_side, hSocket, ppOutMessages, nMaxMessages); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_GetConnectionInfo, 12) +bool __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_GetConnectionInfo(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, HSteamNetConnection hConn, SteamNetConnectionInfo_t * pInfo) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_GetConnectionInfo(_this->linux_side, hConn, pInfo); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_GetQuickConnectionStatus, 12) +bool __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_GetQuickConnectionStatus(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, HSteamNetConnection hConn, SteamNetworkingQuickConnectionStatus * pStats) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_GetQuickConnectionStatus(_this->linux_side, hConn, pStats); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_GetDetailedConnectionStatus, 16) +int __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_GetDetailedConnectionStatus(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, HSteamNetConnection hConn, char * pszBuf, int cbBuf) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_GetDetailedConnectionStatus(_this->linux_side, hConn, pszBuf, cbBuf); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_GetListenSocketAddress, 12) +bool __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_GetListenSocketAddress(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, HSteamListenSocket hSocket, SteamNetworkingIPAddr * address) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_GetListenSocketAddress(_this->linux_side, hSocket, address); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_CreateSocketPair, 24) +bool __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_CreateSocketPair(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, HSteamNetConnection * pOutConnection1, HSteamNetConnection * pOutConnection2, bool bUseNetworkLoopback, const SteamNetworkingIdentity * pIdentity1, const SteamNetworkingIdentity * pIdentity2) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_CreateSocketPair(_this->linux_side, pOutConnection1, pOutConnection2, bUseNetworkLoopback, pIdentity1, pIdentity2); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_GetIdentity, 8) +bool __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_GetIdentity(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, SteamNetworkingIdentity * pIdentity) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_GetIdentity(_this->linux_side, pIdentity); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_ReceivedRelayAuthTicket, 16) +bool __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_ReceivedRelayAuthTicket(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, const void * pvTicket, int cbTicket, SteamDatagramRelayAuthTicket * pOutParsedTicket) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_ReceivedRelayAuthTicket(_this->linux_side, pvTicket, cbTicket, pOutParsedTicket); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_FindRelayAuthTicketForServer, 16) +int __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_FindRelayAuthTicketForServer(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, const SteamNetworkingIdentity * identityGameServer, int nVirtualPort, SteamDatagramRelayAuthTicket * pOutParsedTicket) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_FindRelayAuthTicketForServer(_this->linux_side, identityGameServer, nVirtualPort, pOutParsedTicket); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_ConnectToHostedDedicatedServer, 12) +HSteamNetConnection __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_ConnectToHostedDedicatedServer(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, const SteamNetworkingIdentity * identityTarget, int nVirtualPort) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_ConnectToHostedDedicatedServer(_this->linux_side, identityTarget, nVirtualPort); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_GetHostedDedicatedServerPort, 4) +uint16 __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_GetHostedDedicatedServerPort(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_GetHostedDedicatedServerPort(_this->linux_side); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_GetHostedDedicatedServerPOPID, 4) +SteamNetworkingPOPID __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_GetHostedDedicatedServerPOPID(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_GetHostedDedicatedServerPOPID(_this->linux_side); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_GetHostedDedicatedServerAddress, 8) +bool __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_GetHostedDedicatedServerAddress(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, SteamDatagramHostedAddress * pRouting) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_GetHostedDedicatedServerAddress(_this->linux_side, pRouting); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_CreateHostedDedicatedServerListenSocket, 8) +HSteamListenSocket __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_CreateHostedDedicatedServerListenSocket(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this, int nVirtualPort) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingSockets_SteamNetworkingSockets002_CreateHostedDedicatedServerListenSocket(_this->linux_side, nVirtualPort); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingSockets_SteamNetworkingSockets002_destructor, 4) +void __thiscall winISteamNetworkingSockets_SteamNetworkingSockets002_destructor(winISteamNetworkingSockets_SteamNetworkingSockets002 *_this) +{/* never called */} + +extern vtable_ptr winISteamNetworkingSockets_SteamNetworkingSockets002_vtable; + +#ifndef __GNUC__ +void __asm_dummy_vtables(void) { +#endif + __ASM_VTABLE(winISteamNetworkingSockets_SteamNetworkingSockets002, + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_CreateListenSocketIP) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_ConnectByIPAddress) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_CreateListenSocketP2P) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_ConnectP2P) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_AcceptConnection) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_CloseConnection) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_CloseListenSocket) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_SetConnectionUserData) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_GetConnectionUserData) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_SetConnectionName) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_GetConnectionName) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_SendMessageToConnection) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_FlushMessagesOnConnection) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_ReceiveMessagesOnConnection) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_ReceiveMessagesOnListenSocket) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_GetConnectionInfo) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_GetQuickConnectionStatus) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_GetDetailedConnectionStatus) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_GetListenSocketAddress) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_CreateSocketPair) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_GetIdentity) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_ReceivedRelayAuthTicket) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_FindRelayAuthTicketForServer) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_ConnectToHostedDedicatedServer) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_GetHostedDedicatedServerPort) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_GetHostedDedicatedServerPOPID) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_GetHostedDedicatedServerAddress) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_CreateHostedDedicatedServerListenSocket) + VTABLE_ADD_FUNC(winISteamNetworkingSockets_SteamNetworkingSockets002_destructor) + ); +#ifndef __GNUC__ +} +#endif + +winISteamNetworkingSockets_SteamNetworkingSockets002 *create_winISteamNetworkingSockets_SteamNetworkingSockets002(void *linux_side) +{ + winISteamNetworkingSockets_SteamNetworkingSockets002 *r = HeapAlloc(GetProcessHeap(), 0, sizeof(winISteamNetworkingSockets_SteamNetworkingSockets002)); + TRACE("-> %p\n", r); + r->vtable = &winISteamNetworkingSockets_SteamNetworkingSockets002_vtable; + r->linux_side = linux_side; + return r; +} + diff --git a/lsteamclient/win_constructors.h b/lsteamclient/win_constructors.h index 98ba0849..1d1111a6 100644 --- a/lsteamclient/win_constructors.h +++ b/lsteamclient/win_constructors.h @@ -25,6 +25,7 @@ extern void *create_winISteamGameServer_SteamGameServer012(void *); extern void *create_winISteamGameServerStats_SteamGameServerStats001(void *); extern void *create_winISteamGameCoordinator_SteamGameCoordinator001(void *); extern void *create_winISteamParentalSettings_STEAMPARENTALSETTINGS_INTERFACE_VERSION001(void *); +extern void *create_winISteamNetworkingSockets_SteamNetworkingSockets002(void *); extern void *create_winISteamNetworkingSocketsSerialized_SteamNetworkingSocketsSerialized003(void *); extern void *create_winISteamNetworkingSocketsSerialized_SteamNetworkingSocketsSerialized002(void *); extern void *create_winISteamClient_SteamClient017(void *); diff --git a/lsteamclient/win_constructors_table.dat b/lsteamclient/win_constructors_table.dat index 250ddb02..f8d8822a 100644 --- a/lsteamclient/win_constructors_table.dat +++ b/lsteamclient/win_constructors_table.dat @@ -25,6 +25,7 @@ {"SteamGameServerStats001", &create_winISteamGameServerStats_SteamGameServerStats001}, {"SteamGameCoordinator001", &create_winISteamGameCoordinator_SteamGameCoordinator001}, {"STEAMPARENTALSETTINGS_INTERFACE_VERSION001", &create_winISteamParentalSettings_STEAMPARENTALSETTINGS_INTERFACE_VERSION001}, + {"SteamNetworkingSockets002", &create_winISteamNetworkingSockets_SteamNetworkingSockets002}, {"SteamNetworkingSocketsSerialized003", &create_winISteamNetworkingSocketsSerialized_SteamNetworkingSocketsSerialized003}, {"SteamNetworkingSocketsSerialized002", &create_winISteamNetworkingSocketsSerialized_SteamNetworkingSocketsSerialized002}, {"SteamNetworkingSocketsSerialized001", &create_winISteamNetworkingSocketsSerialized_SteamNetworkingSocketsSerialized002}, /* alias */