mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2025-08-05 07:05:34 +02:00
Added legacy C exports
This commit is contained in:
parent
eb54feab90
commit
57e0038289
2 changed files with 279 additions and 0 deletions
221
dll/dll.cpp
221
dll/dll.cpp
|
@ -19,6 +19,7 @@
|
|||
#include "dll/dll.h"
|
||||
#include "dll/settings_parser.h"
|
||||
#include "dll/client_known_interfaces.h"
|
||||
#include "dll/capicmcallback.h"
|
||||
|
||||
|
||||
static char old_client[128] = STEAMCLIENT_INTERFACE_VERSION; //"SteamClient017";
|
||||
|
@ -1401,6 +1402,9 @@ STEAMCLIENT_API void Breakpad_SteamWriteMiniDumpUsingExceptionInfoWithBuildId( i
|
|||
STEAMCLIENT_API steam_bool Steam_BConnected( HSteamUser hUser, HSteamPipe hSteamPipe )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
if (get_steam_client()->steamclient_version < 5)
|
||||
return 0;
|
||||
|
||||
ISteamUser004 *su = reinterpret_cast<ISteamUser004 *>(get_steam_client()->GetISteamUser(hUser, hSteamPipe, "SteamUser004"));
|
||||
return su->BConnected();
|
||||
}
|
||||
|
@ -1408,6 +1412,9 @@ STEAMCLIENT_API steam_bool Steam_BConnected( HSteamUser hUser, HSteamPipe hSteam
|
|||
STEAMCLIENT_API steam_bool Steam_BLoggedOn( HSteamUser hUser, HSteamPipe hSteamPipe )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
if (get_steam_client()->steamclient_version < 5)
|
||||
return 0;
|
||||
|
||||
ISteamUser004 *su = reinterpret_cast<ISteamUser004 *>(get_steam_client()->GetISteamUser(hUser, hSteamPipe, "SteamUser004"));
|
||||
return su->BLoggedOn();
|
||||
}
|
||||
|
@ -1421,24 +1428,28 @@ STEAMCLIENT_API steam_bool Steam_BReleaseSteamPipe( HSteamPipe hSteamPipe )
|
|||
STEAMCLIENT_API HSteamUser Steam_ConnectToGlobalUser( HSteamPipe hSteamPipe )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
get_steam_client()->steamclient_version = 6;
|
||||
return get_steam_client()->ConnectToGlobalUser(hSteamPipe);
|
||||
}
|
||||
|
||||
STEAMCLIENT_API HSteamUser Steam_CreateGlobalUser( HSteamPipe *phSteamPipe )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
get_steam_client()->steamclient_version = 6;
|
||||
return get_steam_client()->CreateGlobalUser(phSteamPipe);
|
||||
}
|
||||
|
||||
STEAMCLIENT_API HSteamUser Steam_CreateLocalUser( HSteamPipe *phSteamPipe, EAccountType eAccountType )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
get_steam_client()->steamclient_version = 6;
|
||||
return get_steam_client()->CreateLocalUser(phSteamPipe, eAccountType);
|
||||
}
|
||||
|
||||
STEAMCLIENT_API HSteamPipe Steam_CreateSteamPipe()
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
get_steam_client()->steamclient_version = 6;
|
||||
return get_steam_client()->CreateSteamPipe();
|
||||
}
|
||||
|
||||
|
@ -1475,6 +1486,9 @@ STEAMCLIENT_API steam_bool Steam_GSGetSteam2GetEncryptionKeyToSendToNewClient( v
|
|||
STEAMCLIENT_API int Steam_GSGetSteamGameConnectToken(HSteamUser hUser, HSteamPipe hSteamPipe, void *pBlob, int cbMaxBlob)
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
if (get_steam_client()->steamclient_version < 5)
|
||||
return 0;
|
||||
|
||||
ISteamUser004 *su = reinterpret_cast<ISteamUser004 *>(get_steam_client()->GetISteamUser(hUser, hSteamPipe, "SteamUser004"));
|
||||
return su->GetSteamGameConnectToken(pBlob, cbMaxBlob);
|
||||
}
|
||||
|
@ -1579,6 +1593,9 @@ STEAMCLIENT_API steam_bool Steam_GSUpdateStatus( void *phSteamHandle, int cPlaye
|
|||
STEAMCLIENT_API int Steam_InitiateGameConnection( HSteamUser hUser, HSteamPipe hSteamPipe, void *pBlob, int cbMaxBlob, uint64 steamID, int nGameAppID, uint32 unIPServer, uint16 usPortServer, bool bSecure )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
if (get_steam_client()->steamclient_version < 5)
|
||||
return 0;
|
||||
|
||||
ISteamUser004 *su = reinterpret_cast<ISteamUser004 *>(get_steam_client()->GetISteamUser(hUser, hSteamPipe, "SteamUser004"));
|
||||
return su->InitiateGameConnection(pBlob, cbMaxBlob, steamID, nGameAppID, unIPServer, usPortServer, bSecure);
|
||||
}
|
||||
|
@ -1604,6 +1621,9 @@ STEAMCLIENT_API steam_bool Steam_IsKnownInterface( const char *pchVersion )
|
|||
STEAMCLIENT_API void Steam_LogOff( HSteamUser hUser, HSteamPipe hSteamPipe )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
if (get_steam_client()->steamclient_version < 5)
|
||||
return;
|
||||
|
||||
ISteamUser004 *su = reinterpret_cast<ISteamUser004 *>(get_steam_client()->GetISteamUser(hUser, hSteamPipe, "SteamUser004"));
|
||||
su->LogOff();
|
||||
}
|
||||
|
@ -1611,6 +1631,9 @@ STEAMCLIENT_API void Steam_LogOff( HSteamUser hUser, HSteamPipe hSteamPipe )
|
|||
STEAMCLIENT_API void Steam_LogOn( HSteamUser hUser, HSteamPipe hSteamPipe, uint64 ulSteamID )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
if (get_steam_client()->steamclient_version < 5)
|
||||
return;
|
||||
|
||||
ISteamUser004 *su = reinterpret_cast<ISteamUser004 *>(get_steam_client()->GetISteamUser(hUser, hSteamPipe, "SteamUser004"));
|
||||
su->LogOn(ulSteamID);
|
||||
}
|
||||
|
@ -1642,6 +1665,204 @@ STEAMCLIENT_API void Steam_SetLocalIPBinding( uint32 unIP, uint16 usLocalPort )
|
|||
STEAMCLIENT_API void Steam_TerminateGameConnection( HSteamUser hUser, HSteamPipe hSteamPipe, uint32 unIPServer, uint16 usPortServer )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
if (get_steam_client()->steamclient_version < 5)
|
||||
return;
|
||||
|
||||
ISteamUser004 *su = reinterpret_cast<ISteamUser004 *>(get_steam_client()->GetISteamUser(hUser, hSteamPipe, "SteamUser004"));
|
||||
su->TerminateGameConnection(unIPServer, usPortServer);
|
||||
}
|
||||
|
||||
// older sdk ----------------------------------------------------------
|
||||
STEAMCLIENT_API HSteamUser Steam3_ConnectToGlobalInstance()
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
get_steam_client()->steamclient_version = 4;
|
||||
return get_steam_client()->ConnectToGlobalInstance();
|
||||
}
|
||||
|
||||
STEAMCLIENT_API HSteamUser Steam3_CreateLocalInstance()
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
get_steam_client()->steamclient_version = 4;
|
||||
return get_steam_client()->CreateLocalInstance();
|
||||
}
|
||||
|
||||
STEAMCLIENT_API void Steam3_ReleaseInstance( HSteamUser hUser )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
get_steam_client()->ReleaseInstance(hUser);
|
||||
}
|
||||
|
||||
STEAMCLIENT_API steam_bool Steam3_BMainLoop( uint64 time, bool unk )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
// Bool argument was dropped in SteamClient003 so just ignore it for compatibility.
|
||||
return get_steam_client()->BMainLoop(time);
|
||||
}
|
||||
|
||||
STEAMCLIENT_API void Steam3_LogOn( HSteamUser hUser, uint64 steamID )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
if (get_steam_client()->steamclient_version < 2)
|
||||
return;
|
||||
|
||||
ISteamUser002 *su = reinterpret_cast<ISteamUser002 *>(get_steam_client()->GetISteamUser(hUser, "SteamUser002"));
|
||||
CSteamID steam_id_struct(steamID);
|
||||
su->LogOn(&steam_id_struct);
|
||||
}
|
||||
|
||||
STEAMCLIENT_API void Steam3_LogOff( HSteamUser hUser )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
if (get_steam_client()->steamclient_version < 2)
|
||||
return;
|
||||
|
||||
ISteamUser002 *su = reinterpret_cast<ISteamUser002 *>(get_steam_client()->GetISteamUser(hUser, "SteamUser002"));
|
||||
su->LogOff();
|
||||
}
|
||||
|
||||
STEAMCLIENT_API steam_bool Steam3_BLoggedOn( HSteamUser hUser )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
if (get_steam_client()->steamclient_version < 2)
|
||||
return 0;
|
||||
|
||||
ISteamUser002 *su = reinterpret_cast<ISteamUser002 *>(get_steam_client()->GetISteamUser(hUser, "SteamUser002"));
|
||||
return su->BLoggedOn();
|
||||
}
|
||||
|
||||
STEAMCLIENT_API steam_bool Steam3_BConnected( HSteamUser hUser )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
if (get_steam_client()->steamclient_version < 2)
|
||||
return 0;
|
||||
|
||||
ISteamUser002 *su = reinterpret_cast<ISteamUser002 *>(get_steam_client()->GetISteamUser(hUser, "SteamUser002"));
|
||||
return su->BConnected();
|
||||
}
|
||||
|
||||
STEAMCLIENT_API steam_bool Steam3_GSSendLogonRequest( HSteamUser hUser, uint64 steamID )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
if (get_steam_client()->steamclient_version < 2)
|
||||
return 0;
|
||||
|
||||
ISteamUser002 *su = reinterpret_cast<ISteamUser002 *>(get_steam_client()->GetISteamUser(hUser, "SteamUser002"));
|
||||
CSteamID steam_id_struct(steamID);
|
||||
return su->GSSendLogonRequest(&steam_id_struct);
|
||||
}
|
||||
|
||||
STEAMCLIENT_API steam_bool Steam3_GSSendDisconnect( HSteamUser hUser, uint64 steamID )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
if (get_steam_client()->steamclient_version < 2)
|
||||
return 0;
|
||||
|
||||
ISteamUser002 *su = reinterpret_cast<ISteamUser002 *>(get_steam_client()->GetISteamUser(hUser, "SteamUser002"));
|
||||
CSteamID steam_id_struct(steamID);
|
||||
return su->GSSendDisconnect(&steam_id_struct);
|
||||
}
|
||||
|
||||
STEAMCLIENT_API steam_bool Steam3_GSSendStatusResponse( HSteamUser hUser, uint64 steamID, int nSecondsConnected, int nSecondsSinceLast )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
if (get_steam_client()->steamclient_version < 2)
|
||||
return 0;
|
||||
|
||||
ISteamUser002 *su = reinterpret_cast<ISteamUser002 *>(get_steam_client()->GetISteamUser(hUser, "SteamUser002"));
|
||||
CSteamID steam_id_struct(steamID);
|
||||
return su->GSSendStatusResponse(&steam_id_struct, nSecondsConnected, nSecondsSinceLast);
|
||||
}
|
||||
|
||||
STEAMCLIENT_API steam_bool Steam3_GSSetStatus( HSteamUser hUser, int32 nAppIdServed, uint32 unServerFlags, int cPlayers, int cPlayersMax, int cBotPlayers, int unGamePort, const char *pchServerName, const char *pchGameDir, const char *pchMapName, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
if (get_steam_client()->steamclient_version < 2)
|
||||
return 0;
|
||||
|
||||
if (get_steam_client()->steamclient_version < 4) {
|
||||
ISteamUser002 *su = reinterpret_cast<ISteamUser002 *>(get_steam_client()->GetISteamUser(hUser, "SteamUser002"));
|
||||
return su->GSSetStatus(nAppIdServed, unServerFlags, cPlayers, cPlayersMax, cBotPlayers, unGamePort, pchServerName, pchGameDir, pchMapName, pchVersion);
|
||||
}
|
||||
|
||||
ISteamGameServer001 *gs = reinterpret_cast<ISteamGameServer001 *>(get_steam_client()->GetISteamGameServer(hUser, "SteamGameServer001"));
|
||||
return gs->Obsolete_GSSetStatus(nAppIdServed, unServerFlags, cPlayers, cPlayersMax, cBotPlayers, unGamePort, pchServerName, pchGameDir, pchMapName, pchVersion);
|
||||
}
|
||||
|
||||
static std::map<HSteamUser, CCAPICMCallBack> capi_cmcallback_map;
|
||||
|
||||
STEAMCLIENT_API void Steam3_Init( HSteamUser hUser,
|
||||
OnLogonSuccessFunc func1,
|
||||
OnLogonFailureFunc func2,
|
||||
OnLoggedOffFunc func3,
|
||||
OnBeginLogonRetryFunc func4,
|
||||
HandleVACChallengeFunc func5,
|
||||
GSHandleClientApproveFunc func6,
|
||||
GSHandleClientDenyFunc func7,
|
||||
GSHandleClientKickFunc func8 )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
get_steam_client()->steamclient_version = 2;
|
||||
ISteamUser002 *su = reinterpret_cast<ISteamUser002 *>(get_steam_client()->GetISteamUser(hUser, "SteamUser002"));
|
||||
CCAPICMCallBack new_cmcallback(func1, func2, func3, func4, func5, func6, func7, func8);
|
||||
auto [it, _] = capi_cmcallback_map.insert_or_assign(hUser, new_cmcallback);
|
||||
su->Init(&it->second, nullptr);
|
||||
}
|
||||
|
||||
STEAMCLIENT_API steam_bool Steam3_GSSendUserConnect( HSteamUser hUser, uint64 steamID, uint32 unIPPublic, uint32 unk )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
ISteamGameServer001 *gs = reinterpret_cast<ISteamGameServer001 *>(get_steam_client()->GetISteamGameServer(hUser, "SteamGameServer001"));
|
||||
return gs->GSSendUserConnect(steamID, unIPPublic, unk);
|
||||
}
|
||||
|
||||
STEAMCLIENT_API steam_bool Steam3_GSSendUserDisconnect( HSteamUser hUser, uint64 steamID )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
ISteamGameServer001 *gs = reinterpret_cast<ISteamGameServer001 *>(get_steam_client()->GetISteamGameServer(hUser, "SteamGameServer001"));
|
||||
return gs->GSSendUserDisconnect(steamID);
|
||||
}
|
||||
|
||||
STEAMCLIENT_API steam_bool Steam3_GSSendUserStatusResponse( HSteamUser hUser, uint64 steamID, int nSecondsConnected, int nSecondsSinceLast )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
ISteamGameServer001 *gs = reinterpret_cast<ISteamGameServer001 *>(get_steam_client()->GetISteamGameServer(hUser, "SteamGameServer001"));
|
||||
return gs->GSSendUserStatusResponse(steamID, nSecondsConnected, nSecondsSinceLast);
|
||||
}
|
||||
|
||||
STEAMCLIENT_API steam_bool Steam3_BGetCallback( HSteamUser hUser, int *piCallback, uint8_t **ppubParam, int *unk )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
if (get_steam_client()->steamclient_version != 4)
|
||||
return 0;
|
||||
|
||||
ISteamUser004_old *su = reinterpret_cast<ISteamUser004_old *>(get_steam_client()->GetISteamUser(hUser, "SteamUser004"));
|
||||
return su->BGetCallback(piCallback, ppubParam, unk);
|
||||
}
|
||||
|
||||
STEAMCLIENT_API void Steam3_FreeLastCallback( HSteamUser hUser )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
if (get_steam_client()->steamclient_version != 4)
|
||||
return;
|
||||
|
||||
ISteamUser004_old *su = reinterpret_cast<ISteamUser004_old *>(get_steam_client()->GetISteamUser(hUser, "SteamUser004"));
|
||||
su->FreeLastCallback();
|
||||
}
|
||||
|
||||
STEAMCLIENT_API int Steam3_GetSteamTicket( HSteamUser hUser, void *pBlob, int cbMaxBlob )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
if (get_steam_client()->steamclient_version != 4)
|
||||
return 0;
|
||||
|
||||
ISteamUser004_old *su = reinterpret_cast<ISteamUser004_old *>(get_steam_client()->GetISteamUser(hUser, "SteamUser004"));
|
||||
return su->GetSteamTicket(pBlob, cbMaxBlob);
|
||||
}
|
||||
|
||||
STEAMCLIENT_API void Steam3_SetLocalIPBinding( uint32 unIP, uint16 usLocalPort )
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
get_steam_client()->SetLocalIPBinding(unIP, usLocalPort);
|
||||
}
|
||||
// older sdk ----------------------------------------------------------
|
||||
|
|
58
dll/dll/capicmcallback.h
Normal file
58
dll/dll/capicmcallback.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
#ifndef __INCLUDED_CAPICMCALLBACK_H__
|
||||
#define __INCLUDED_CAPICMCALLBACK_H__
|
||||
|
||||
#include "base.h"
|
||||
|
||||
typedef void (*OnLogonSuccessFunc)();
|
||||
typedef void (*OnLogonFailureFunc)(EResult);
|
||||
typedef void (*OnLoggedOffFunc)();
|
||||
typedef void (*OnBeginLogonRetryFunc)();
|
||||
typedef void (*HandleVACChallengeFunc)(int, void *, int);
|
||||
typedef void (*GSHandleClientApproveFunc)(CSteamID *);
|
||||
typedef void (*GSHandleClientDenyFunc)(CSteamID *, EDenyReason);
|
||||
typedef void (*GSHandleClientKickFunc)(CSteamID *, EDenyReason);
|
||||
|
||||
class CCAPICMCallBack : public ICMCallback
|
||||
{
|
||||
public:
|
||||
CCAPICMCallBack(OnLogonSuccessFunc func1,
|
||||
OnLogonFailureFunc func2,
|
||||
OnLoggedOffFunc func3,
|
||||
OnBeginLogonRetryFunc func4,
|
||||
HandleVACChallengeFunc func5,
|
||||
GSHandleClientApproveFunc func6,
|
||||
GSHandleClientDenyFunc func7,
|
||||
GSHandleClientKickFunc func8)
|
||||
{
|
||||
OnLogonSuccess_ptr = func1;
|
||||
OnLogonFailure_ptr = func2;
|
||||
OnLoggedOff_ptr = func3;
|
||||
OnBeginLogonRetry_ptr = func4;
|
||||
HandleVACChallenge_ptr = func5;
|
||||
GSHandleClientApprove_ptr = func6;
|
||||
GSHandleClientDeny_ptr = func7;
|
||||
GSHandleClientKick_ptr = func8;
|
||||
}
|
||||
~CCAPICMCallBack() {}
|
||||
|
||||
void OnLogonSuccess() { OnLogonSuccess_ptr(); }
|
||||
void OnLogonFailure(EResult result) { OnLogonFailure_ptr(result); }
|
||||
void OnLoggedOff() { OnLoggedOff_ptr(); }
|
||||
void OnBeginLogonRetry() { OnBeginLogonRetry_ptr(); }
|
||||
void HandleVACChallenge(int unk1, void *unk2, int unk3) { HandleVACChallenge_ptr(unk1, unk2, unk3); }
|
||||
void GSHandleClientApprove(CSteamID *steamID) { GSHandleClientApprove_ptr(steamID); }
|
||||
void GSHandleClientDeny(CSteamID *steamID, EDenyReason reason) { GSHandleClientDeny_ptr(steamID, reason); }
|
||||
void GSHandleClientKick(CSteamID *steamID, EDenyReason reason) { GSHandleClientKick_ptr(steamID, reason); }
|
||||
|
||||
private:
|
||||
OnLogonSuccessFunc OnLogonSuccess_ptr{};
|
||||
OnLogonFailureFunc OnLogonFailure_ptr{};
|
||||
OnLoggedOffFunc OnLoggedOff_ptr{};
|
||||
OnBeginLogonRetryFunc OnBeginLogonRetry_ptr{};
|
||||
HandleVACChallengeFunc HandleVACChallenge_ptr{};
|
||||
GSHandleClientApproveFunc GSHandleClientApprove_ptr{};
|
||||
GSHandleClientDenyFunc GSHandleClientDeny_ptr{};
|
||||
GSHandleClientKickFunc GSHandleClientKick_ptr{};
|
||||
};
|
||||
|
||||
#endif // __INCLUDED_CAPICMCALLBACK_H__
|
Loading…
Add table
Reference in a new issue