lsteamclient: Fixup ISteamUser_SteamUser_InitiateGameConnection directly.

CW-Bug-Id: #22729
This commit is contained in:
Rémi Bernon 2023-09-28 19:02:26 +02:00 committed by Arkadiusz Hiler
parent 468731b011
commit 09846111bd
4 changed files with 23 additions and 56 deletions

View File

@ -239,7 +239,6 @@ SOURCES = \
cppISteamUtils_SteamUtils010.cpp \
cppISteamVideo_STEAMVIDEO_INTERFACE_V001.cpp \
cppISteamVideo_STEAMVIDEO_INTERFACE_V002.cpp \
steamclient_manual_099y.cpp \
steamclient_manual_141.cpp \
steamclient_manual_142.cpp \
steamclient_manual_144.cpp \

View File

@ -18,7 +18,7 @@ struct cppISteamUser_SteamUser008
virtual int32_t GetHSteamUser( ) = 0;
virtual bool BLoggedOn( ) = 0;
virtual CSteamID GetSteamID( ) = 0;
virtual int32_t InitiateGameConnection( void *, int32_t, CSteamID, CGameID, uint32_t, uint16_t, bool, void *, int32_t ) = 0;
virtual int32_t InitiateGameConnection( void *, int32_t, CSteamID, CGameID *, uint32_t, uint16_t, bool, void *, int32_t ) = 0;
virtual void TerminateGameConnection( uint32_t, uint16_t ) = 0;
virtual void TrackAppUsageEvent( CGameID, int32_t, const char * ) = 0;
virtual void RefreshSteam2Login( ) = 0;
@ -43,6 +43,12 @@ void cppISteamUser_SteamUser008_GetSteamID( struct cppISteamUser_SteamUser008_Ge
*params->_ret = iface->GetSteamID( );
}
void cppISteamUser_SteamUser008_InitiateGameConnection( struct cppISteamUser_SteamUser008_InitiateGameConnection_params *params )
{
struct cppISteamUser_SteamUser008 *iface = (struct cppISteamUser_SteamUser008 *)params->linux_side;
params->_ret = iface->InitiateGameConnection( params->pBlob, params->cbMaxBlob, params->steamID, &params->gameID, params->unIPServer, params->usPortServer, params->bSecure, params->pvSteam2GetEncryptionKey, params->cbSteam2GetEncryptionKey );
}
void cppISteamUser_SteamUser008_TerminateGameConnection( struct cppISteamUser_SteamUser008_TerminateGameConnection_params *params )
{
struct cppISteamUser_SteamUser008 *iface = (struct cppISteamUser_SteamUser008 *)params->linux_side;

View File

@ -229,13 +229,6 @@ MANUAL_METHODS = {
Method("DestroyFakeUDPPort"),
Method("ReceiveMessages"),
],
"cppISteamUser_SteamUser": [
#TODO: Do we need the the value -> pointer conversion for other versions of the interface?
Method("InitiateGameConnection", lambda version: version == 8),
],
#"cppISteamClient_SteamClient": [
# Method("BShutdownIfAllPipesClosed"),
#],
}
@ -482,6 +475,14 @@ class Class:
for method in self.methods:
types = [declspec(p, "", prefix if prefix != "cpp" else None)
for p in method.get_arguments()]
# CGameID -> CGameID &
# Windows side follows the prototype in the header while Linux
# steamclient treats gameID parameter as pointer
if self.full_name == 'ISteamUser_SteamUser008' \
and method.name == 'InitiateGameConnection':
types[3] = 'CGameID *'
if type(method) is Destructor:
out(f' virtual ~{prefix}{self.full_name}( {", ".join(types)} ) = 0;\n')
else:
@ -728,6 +729,14 @@ def handle_method_cpp(method, classname, cppname, out):
return f'params->{name}'
params = [param_call(n, p) for n, p in zip(names[1:], method.get_arguments())]
# CGameID -> CGameID &
# Windows side follows the prototype in the header while Linux
# steamclient treats gameID parameter as pointer
if klass.full_name == 'ISteamUser_SteamUser008' \
and method.name == 'InitiateGameConnection':
params[3] = f'&{params[3]}'
out(f'iface->{method.spelling}( {", ".join(params)} );\n')
for name, param in sorted(need_output.items()):

View File

@ -1,47 +0,0 @@
#include "steamclient_private.h"
#include "steam_defs.h"
#pragma push_macro("__cdecl")
#undef __cdecl
#pragma push_macro("strncpy")
#undef strncpy
#include "steamworks_sdk_099y/steam_api.h"
#pragma pop_macro("__cdecl")
#pragma pop_macro("strncpy")
#define SDK_VERSION 992
#include "steamclient_manual_common.h"
extern "C"
{
#include "cppISteamUser_SteamUser008.h"
}
WINE_DEFAULT_DEBUG_CHANNEL(steamclient);
class ISteamUser_linux
{
public:
virtual HSteamUser GetHSteamUser() = 0;
virtual bool BLoggedOn() = 0;
virtual CSteamID GetSteamID() = 0;
/* CGameID -> CGameID &.
* Windows side follows the prototype in the header while Linux
* steamclient treats gameID parameter as pointer. */
virtual int InitiateGameConnection( void *pBlob, int cbMaxBlob, CSteamID steamID, CGameID &gameID, uint32 unIPServer, uint16 usPortServer, bool bSecure, void *pvSteam2GetEncryptionKey, int cbSteam2GetEncryptionKey ) = 0;
virtual void TerminateGameConnection( uint32 unIPServer, uint16 usPortServer ) = 0;
virtual void TrackAppUsageEvent( CGameID gameID, int eAppUsageEvent, const char *pchExtraInfo = "" ) = 0;
virtual void RefreshSteam2Login() = 0;
};
void cppISteamUser_SteamUser008_InitiateGameConnection( struct cppISteamUser_SteamUser008_InitiateGameConnection_params *params )
{
ISteamUser_linux *iface = (ISteamUser_linux *)params->linux_side;
WARN( "Manual call fixup.\n" );
params->_ret = iface->InitiateGameConnection( params->pBlob, params->cbMaxBlob, params->steamID,
params->gameID, params->unIPServer, params->usPortServer,
params->bSecure, params->pvSteam2GetEncryptionKey,
params->cbSteam2GetEncryptionKey );
}