From 5db246cc03a447904b75ea944df090b3571d0e34 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 29 Sep 2020 09:40:02 -0500 Subject: [PATCH] lsteamclient: support ISteamNetworkingMessages (cherry picked from commit 30c21636c543427b6407fc7df980d6030ab71eac) --- ...ingMessages_SteamNetworkingMessages002.cpp | 42 +++++++++ ...rkingMessages_SteamNetworkingMessages002.h | 6 ++ lsteamclient/gen_wrapper.py | 13 ++- lsteamclient/steam_defs.h | 3 +- lsteamclient/steamclient_manual_150.cpp | 10 ++ .../isteamnetworkingmessages.h | 1 - lsteamclient/winISteamNetworkingMessages.c | 92 +++++++++++++++++++ lsteamclient/win_constructors.h | 1 + lsteamclient/win_constructors_table.dat | 1 + 9 files changed, 165 insertions(+), 4 deletions(-) create mode 100644 lsteamclient/cppISteamNetworkingMessages_SteamNetworkingMessages002.cpp create mode 100644 lsteamclient/cppISteamNetworkingMessages_SteamNetworkingMessages002.h create mode 100644 lsteamclient/winISteamNetworkingMessages.c diff --git a/lsteamclient/cppISteamNetworkingMessages_SteamNetworkingMessages002.cpp b/lsteamclient/cppISteamNetworkingMessages_SteamNetworkingMessages002.cpp new file mode 100644 index 00000000..e35bd210 --- /dev/null +++ b/lsteamclient/cppISteamNetworkingMessages_SteamNetworkingMessages002.cpp @@ -0,0 +1,42 @@ +#include "steam_defs.h" +#pragma push_macro("__cdecl") +#undef __cdecl +#include "steamworks_sdk_150/steam_api.h" +#include "steamworks_sdk_150/steamnetworkingtypes.h" +#include "steamworks_sdk_150/isteamnetworkingmessages.h" +#pragma pop_macro("__cdecl") +#include "steamclient_private.h" +#ifdef __cplusplus +extern "C" { +#endif +#define SDKVER_150 +#include "struct_converters.h" +#include "cppISteamNetworkingMessages_SteamNetworkingMessages002.h" +EResult cppISteamNetworkingMessages_SteamNetworkingMessages002_SendMessageToUser(void *linux_side, const SteamNetworkingIdentity * identityRemote, const void * pubData, uint32 cubData, int nSendFlags, int nRemoteChannel) +{ + return ((ISteamNetworkingMessages*)linux_side)->SendMessageToUser((const SteamNetworkingIdentity *)identityRemote, (const void *)pubData, (uint32)cubData, (int)nSendFlags, (int)nRemoteChannel); +} + +bool cppISteamNetworkingMessages_SteamNetworkingMessages002_AcceptSessionWithUser(void *linux_side, const SteamNetworkingIdentity * identityRemote) +{ + return ((ISteamNetworkingMessages*)linux_side)->AcceptSessionWithUser((const SteamNetworkingIdentity *)identityRemote); +} + +bool cppISteamNetworkingMessages_SteamNetworkingMessages002_CloseSessionWithUser(void *linux_side, const SteamNetworkingIdentity * identityRemote) +{ + return ((ISteamNetworkingMessages*)linux_side)->CloseSessionWithUser((const SteamNetworkingIdentity *)identityRemote); +} + +bool cppISteamNetworkingMessages_SteamNetworkingMessages002_CloseChannelWithUser(void *linux_side, const SteamNetworkingIdentity * identityRemote, int nLocalChannel) +{ + return ((ISteamNetworkingMessages*)linux_side)->CloseChannelWithUser((const SteamNetworkingIdentity *)identityRemote, (int)nLocalChannel); +} + +ESteamNetworkingConnectionState cppISteamNetworkingMessages_SteamNetworkingMessages002_GetSessionConnectionInfo(void *linux_side, const SteamNetworkingIdentity * identityRemote, SteamNetConnectionInfo_t * pConnectionInfo, SteamNetworkingQuickConnectionStatus * pQuickStatus) +{ + return ((ISteamNetworkingMessages*)linux_side)->GetSessionConnectionInfo((const SteamNetworkingIdentity *)identityRemote, (SteamNetConnectionInfo_t *)pConnectionInfo, (SteamNetworkingQuickConnectionStatus *)pQuickStatus); +} + +#ifdef __cplusplus +} +#endif diff --git a/lsteamclient/cppISteamNetworkingMessages_SteamNetworkingMessages002.h b/lsteamclient/cppISteamNetworkingMessages_SteamNetworkingMessages002.h new file mode 100644 index 00000000..403b027e --- /dev/null +++ b/lsteamclient/cppISteamNetworkingMessages_SteamNetworkingMessages002.h @@ -0,0 +1,6 @@ +extern EResult cppISteamNetworkingMessages_SteamNetworkingMessages002_SendMessageToUser(void *, const SteamNetworkingIdentity *, const void *, uint32, int, int); +extern int cppISteamNetworkingMessages_SteamNetworkingMessages002_ReceiveMessagesOnChannel(void *, int, winSteamNetworkingMessage_t_150 **, int); +extern bool cppISteamNetworkingMessages_SteamNetworkingMessages002_AcceptSessionWithUser(void *, const SteamNetworkingIdentity *); +extern bool cppISteamNetworkingMessages_SteamNetworkingMessages002_CloseSessionWithUser(void *, const SteamNetworkingIdentity *); +extern bool cppISteamNetworkingMessages_SteamNetworkingMessages002_CloseChannelWithUser(void *, const SteamNetworkingIdentity *, int); +extern ESteamNetworkingConnectionState cppISteamNetworkingMessages_SteamNetworkingMessages002_GetSessionConnectionInfo(void *, const SteamNetworkingIdentity *, SteamNetConnectionInfo_t *, SteamNetworkingQuickConnectionStatus *); diff --git a/lsteamclient/gen_wrapper.py b/lsteamclient/gen_wrapper.py index cfd86d74..e3b6e18d 100755 --- a/lsteamclient/gen_wrapper.py +++ b/lsteamclient/gen_wrapper.py @@ -142,6 +142,9 @@ files = [ ("isteamparentalsettings.h", [ "ISteamParentalSettings" ]), + ("isteamnetworkingmessages.h", [ + "ISteamNetworkingMessages" + ]), ("isteamnetworkingsockets.h", [ "ISteamNetworkingSockets" ]), @@ -210,6 +213,9 @@ manually_handled_methods = { "cppISteamNetworkingUtils_SteamNetworkingUtils003": [ "AllocateMessage", ], + "cppISteamNetworkingMessages_SteamNetworkingMessages002": [ + "ReceiveMessagesOnChannel" + ], } # manual converters for simple types (function pointers) @@ -859,7 +865,10 @@ def handle_method(cfile, classname, winclassname, cppname, method, cpp, cpp_h, e def get_iface_version(classname): # ISteamClient -> STEAMCLIENT_INTERFACE_VERSION - defname = "%s_INTERFACE_VERSION" % classname[1:].upper() + if "SteamNetworkingMessages" in classname: + defname = "%s_VERSION" % classname[1:].upper() + else: + defname = "%s_INTERFACE_VERSION" % classname[1:].upper() if defname in iface_versions.keys(): ver = iface_versions[defname] else: @@ -1207,7 +1216,7 @@ for sdkver in sdk_versions: for f in os.listdir("steamworks_sdk_%s" % sdkver): x = open("steamworks_sdk_%s/%s" % (sdkver, f), "r") for l in x: - if "INTERFACE_VERSION" in l: + if "define STEAM" in l and "_VERSION" in l: result = prog.match(l) if result: iface, version = result.group(1, 2) diff --git a/lsteamclient/steam_defs.h b/lsteamclient/steam_defs.h index 41be2581..dbe16dce 100644 --- a/lsteamclient/steam_defs.h +++ b/lsteamclient/steam_defs.h @@ -98,7 +98,8 @@ typedef uint32_t EUserUGCList, ESteamIPv6ConnectivityState, ESteamIPv6ConnectivityProtocol, EDurationControlOnlineState, - ETextFilteringContext + ETextFilteringContext, + ESteamNetworkingConnectionState ; /* XXX NO */ diff --git a/lsteamclient/steamclient_manual_150.cpp b/lsteamclient/steamclient_manual_150.cpp index 3b598fb4..154e7155 100644 --- a/lsteamclient/steamclient_manual_150.cpp +++ b/lsteamclient/steamclient_manual_150.cpp @@ -198,4 +198,14 @@ void cppISteamNetworkingSockets_SteamNetworkingSockets009_SendMessages( } } +int cppISteamNetworkingMessages_SteamNetworkingMessages002_ReceiveMessagesOnChannel( + void *linux_side, int nLocalChannel, + winSteamNetworkingMessage_t_150 ** ppOutMessages, int nMaxMessages) +{ + SteamNetworkingMessage_t *lin_ppOutMessages[nMaxMessages]; + int retval = ((ISteamNetworkingMessages*)linux_side)->ReceiveMessagesOnChannel(nLocalChannel, lin_ppOutMessages, nMaxMessages); + lin_to_win_struct_SteamNetworkingMessage_t_150(retval, lin_ppOutMessages, ppOutMessages, nMaxMessages); + return retval; +} + } diff --git a/lsteamclient/steamworks_sdk_150/isteamnetworkingmessages.h b/lsteamclient/steamworks_sdk_150/isteamnetworkingmessages.h index cde7505b..0f2f28ab 100644 --- a/lsteamclient/steamworks_sdk_150/isteamnetworkingmessages.h +++ b/lsteamclient/steamworks_sdk_150/isteamnetworkingmessages.h @@ -2,7 +2,6 @@ #ifndef ISTEAMNETWORKINGMESSAGES #define ISTEAMNETWORKINGMESSAGES -#pragma once #include "steamnetworkingtypes.h" diff --git a/lsteamclient/winISteamNetworkingMessages.c b/lsteamclient/winISteamNetworkingMessages.c new file mode 100644 index 00000000..461d4d5e --- /dev/null +++ b/lsteamclient/winISteamNetworkingMessages.c @@ -0,0 +1,92 @@ +/* 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 "cppISteamNetworkingMessages_SteamNetworkingMessages002.h" + +typedef struct __winISteamNetworkingMessages_SteamNetworkingMessages002 { + vtable_ptr *vtable; + void *linux_side; +} winISteamNetworkingMessages_SteamNetworkingMessages002; + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingMessages_SteamNetworkingMessages002_SendMessageToUser, 24) +EResult __thiscall winISteamNetworkingMessages_SteamNetworkingMessages002_SendMessageToUser(winISteamNetworkingMessages_SteamNetworkingMessages002 *_this, const SteamNetworkingIdentity * identityRemote, const void * pubData, uint32 cubData, int nSendFlags, int nRemoteChannel) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingMessages_SteamNetworkingMessages002_SendMessageToUser(_this->linux_side, identityRemote, pubData, cubData, nSendFlags, nRemoteChannel); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingMessages_SteamNetworkingMessages002_ReceiveMessagesOnChannel, 16) +int __thiscall winISteamNetworkingMessages_SteamNetworkingMessages002_ReceiveMessagesOnChannel(winISteamNetworkingMessages_SteamNetworkingMessages002 *_this, int nLocalChannel, winSteamNetworkingMessage_t_150 ** ppOutMessages, int nMaxMessages) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingMessages_SteamNetworkingMessages002_ReceiveMessagesOnChannel(_this->linux_side, nLocalChannel, ppOutMessages, nMaxMessages); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingMessages_SteamNetworkingMessages002_AcceptSessionWithUser, 8) +bool __thiscall winISteamNetworkingMessages_SteamNetworkingMessages002_AcceptSessionWithUser(winISteamNetworkingMessages_SteamNetworkingMessages002 *_this, const SteamNetworkingIdentity * identityRemote) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingMessages_SteamNetworkingMessages002_AcceptSessionWithUser(_this->linux_side, identityRemote); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingMessages_SteamNetworkingMessages002_CloseSessionWithUser, 8) +bool __thiscall winISteamNetworkingMessages_SteamNetworkingMessages002_CloseSessionWithUser(winISteamNetworkingMessages_SteamNetworkingMessages002 *_this, const SteamNetworkingIdentity * identityRemote) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingMessages_SteamNetworkingMessages002_CloseSessionWithUser(_this->linux_side, identityRemote); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingMessages_SteamNetworkingMessages002_CloseChannelWithUser, 12) +bool __thiscall winISteamNetworkingMessages_SteamNetworkingMessages002_CloseChannelWithUser(winISteamNetworkingMessages_SteamNetworkingMessages002 *_this, const SteamNetworkingIdentity * identityRemote, int nLocalChannel) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingMessages_SteamNetworkingMessages002_CloseChannelWithUser(_this->linux_side, identityRemote, nLocalChannel); +} + +DEFINE_THISCALL_WRAPPER(winISteamNetworkingMessages_SteamNetworkingMessages002_GetSessionConnectionInfo, 16) +ESteamNetworkingConnectionState __thiscall winISteamNetworkingMessages_SteamNetworkingMessages002_GetSessionConnectionInfo(winISteamNetworkingMessages_SteamNetworkingMessages002 *_this, const SteamNetworkingIdentity * identityRemote, SteamNetConnectionInfo_t * pConnectionInfo, SteamNetworkingQuickConnectionStatus * pQuickStatus) +{ + TRACE("%p\n", _this); + return cppISteamNetworkingMessages_SteamNetworkingMessages002_GetSessionConnectionInfo(_this->linux_side, identityRemote, pConnectionInfo, pQuickStatus); +} + +extern vtable_ptr winISteamNetworkingMessages_SteamNetworkingMessages002_vtable; + +#ifndef __GNUC__ +void __asm_dummy_vtables(void) { +#endif + __ASM_VTABLE(winISteamNetworkingMessages_SteamNetworkingMessages002, + VTABLE_ADD_FUNC(winISteamNetworkingMessages_SteamNetworkingMessages002_SendMessageToUser) + VTABLE_ADD_FUNC(winISteamNetworkingMessages_SteamNetworkingMessages002_ReceiveMessagesOnChannel) + VTABLE_ADD_FUNC(winISteamNetworkingMessages_SteamNetworkingMessages002_AcceptSessionWithUser) + VTABLE_ADD_FUNC(winISteamNetworkingMessages_SteamNetworkingMessages002_CloseSessionWithUser) + VTABLE_ADD_FUNC(winISteamNetworkingMessages_SteamNetworkingMessages002_CloseChannelWithUser) + VTABLE_ADD_FUNC(winISteamNetworkingMessages_SteamNetworkingMessages002_GetSessionConnectionInfo) + ); +#ifndef __GNUC__ +} +#endif + +winISteamNetworkingMessages_SteamNetworkingMessages002 *create_winISteamNetworkingMessages_SteamNetworkingMessages002(void *linux_side) +{ + winISteamNetworkingMessages_SteamNetworkingMessages002 *r = HeapAlloc(GetProcessHeap(), 0, sizeof(winISteamNetworkingMessages_SteamNetworkingMessages002)); + TRACE("-> %p\n", r); + r->vtable = &winISteamNetworkingMessages_SteamNetworkingMessages002_vtable; + r->linux_side = linux_side; + return r; +} + diff --git a/lsteamclient/win_constructors.h b/lsteamclient/win_constructors.h index a39c835e..1b1f5346 100644 --- a/lsteamclient/win_constructors.h +++ b/lsteamclient/win_constructors.h @@ -27,6 +27,7 @@ extern void *create_winISteamGameServer_SteamGameServer013(void *); extern void *create_winISteamGameServerStats_SteamGameServerStats001(void *); extern void *create_winISteamGameCoordinator_SteamGameCoordinator001(void *); extern void *create_winISteamParentalSettings_STEAMPARENTALSETTINGS_INTERFACE_VERSION001(void *); +extern void *create_winISteamNetworkingMessages_SteamNetworkingMessages002(void *); extern void *create_winISteamNetworkingSockets_SteamNetworkingSockets009(void *); extern void *create_winISteamNetworkingUtils_SteamNetworkingUtils003(void *); extern void *create_winISteamUtils_SteamUtils009(void *); diff --git a/lsteamclient/win_constructors_table.dat b/lsteamclient/win_constructors_table.dat index e343967b..1ccec6c5 100644 --- a/lsteamclient/win_constructors_table.dat +++ b/lsteamclient/win_constructors_table.dat @@ -27,6 +27,7 @@ {"SteamGameServerStats001", &create_winISteamGameServerStats_SteamGameServerStats001}, {"SteamGameCoordinator001", &create_winISteamGameCoordinator_SteamGameCoordinator001}, {"STEAMPARENTALSETTINGS_INTERFACE_VERSION001", &create_winISteamParentalSettings_STEAMPARENTALSETTINGS_INTERFACE_VERSION001}, + {"SteamNetworkingMessages002", &create_winISteamNetworkingMessages_SteamNetworkingMessages002}, {"SteamNetworkingSockets009", &create_winISteamNetworkingSockets_SteamNetworkingSockets009}, {"SteamNetworkingUtils003", &create_winISteamNetworkingUtils_SteamNetworkingUtils003}, {"SteamUtils009", &create_winISteamUtils_SteamUtils009},