old steamclient006

This commit is contained in:
a 2024-12-06 22:49:02 +02:00
parent 30761a108c
commit 661dac1120
6 changed files with 761 additions and 600 deletions

View File

@ -212,48 +212,48 @@ bool steamclient_has_ipv6_functions()
static void *create_client_interface(const char *ver) static void *create_client_interface(const char *ver)
{ {
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
void *steam_client = nullptr;
Steam_Client *client_ptr = get_steam_client();
if (strstr(ver, "SteamClient") == ver) { if (strstr(ver, "SteamClient") == ver) {
if (strcmp(ver, "SteamClient007") == 0) { if (strcmp(ver, "SteamClient006") == 0) {
steam_client = static_cast<ISteamClient007 *>(get_steam_client()); return static_cast<ISteamClient006 *>(client_ptr);
} else if (strcmp(ver, "SteamClient007") == 0) {
return static_cast<ISteamClient007 *>(client_ptr);
} else if (strcmp(ver, "SteamClient008") == 0) { } else if (strcmp(ver, "SteamClient008") == 0) {
steam_client = static_cast<ISteamClient008 *>(get_steam_client()); return static_cast<ISteamClient008 *>(client_ptr);
} else if (strcmp(ver, "SteamClient009") == 0) { } else if (strcmp(ver, "SteamClient009") == 0) {
steam_client = static_cast<ISteamClient009 *>(get_steam_client()); return static_cast<ISteamClient009 *>(client_ptr);
} else if (strcmp(ver, "SteamClient010") == 0) { } else if (strcmp(ver, "SteamClient010") == 0) {
steam_client = static_cast<ISteamClient010 *>(get_steam_client()); return static_cast<ISteamClient010 *>(client_ptr);
} else if (strcmp(ver, "SteamClient011") == 0) { } else if (strcmp(ver, "SteamClient011") == 0) {
steam_client = static_cast<ISteamClient011 *>(get_steam_client()); return static_cast<ISteamClient011 *>(client_ptr);
} else if (strcmp(ver, "SteamClient012") == 0) { } else if (strcmp(ver, "SteamClient012") == 0) {
steam_client = static_cast<ISteamClient012 *>(get_steam_client()); return static_cast<ISteamClient012 *>(client_ptr);
} else if (strcmp(ver, "SteamClient013") == 0) { } else if (strcmp(ver, "SteamClient013") == 0) {
steam_client = static_cast<ISteamClient013 *>(get_steam_client()); return static_cast<ISteamClient013 *>(client_ptr);
} else if (strcmp(ver, "SteamClient014") == 0) { } else if (strcmp(ver, "SteamClient014") == 0) {
steam_client = static_cast<ISteamClient014 *>(get_steam_client()); return static_cast<ISteamClient014 *>(client_ptr);
} else if (strcmp(ver, "SteamClient015") == 0) { } else if (strcmp(ver, "SteamClient015") == 0) {
steam_client = static_cast<ISteamClient015 *>(get_steam_client()); return static_cast<ISteamClient015 *>(client_ptr);
} else if (strcmp(ver, "SteamClient016") == 0) { } else if (strcmp(ver, "SteamClient016") == 0) {
steam_client = static_cast<ISteamClient016 *>(get_steam_client()); return static_cast<ISteamClient016 *>(client_ptr);
} else if (strcmp(ver, "SteamClient017") == 0) { } else if (strcmp(ver, "SteamClient017") == 0) {
steam_client = static_cast<ISteamClient017 *>(get_steam_client()); return static_cast<ISteamClient017 *>(client_ptr);
} else if (strcmp(ver, "SteamClient018") == 0) { } else if (strcmp(ver, "SteamClient018") == 0) {
steam_client = static_cast<ISteamClient018 *>(get_steam_client()); return static_cast<ISteamClient018 *>(client_ptr);
} else if (strcmp(ver, "SteamClient019") == 0) { } else if (strcmp(ver, "SteamClient019") == 0) {
steam_client = static_cast<ISteamClient019 *>(get_steam_client()); return static_cast<ISteamClient019 *>(client_ptr);
} else if (strcmp(ver, "SteamClient020") == 0) { }
steamclient_has_ipv6_functions_flag = true;
steam_client = static_cast<ISteamClient020 *>(get_steam_client()); steamclient_has_ipv6_functions_flag = true;
if (strcmp(ver, "SteamClient020") == 0) {
return static_cast<ISteamClient020 *>(client_ptr);
} else if (strcmp(ver, STEAMCLIENT_INTERFACE_VERSION) == 0) { } else if (strcmp(ver, STEAMCLIENT_INTERFACE_VERSION) == 0) {
steamclient_has_ipv6_functions_flag = true; return static_cast<ISteamClient *>(client_ptr);
steam_client = static_cast<ISteamClient *>(get_steam_client());
} else {
PRINT_DEBUG("requested unknown steamclient version '%s'", ver);
get_steam_client()->report_missing_impl_and_exit(ver, EMU_FUNC_NAME);
} }
} }
return steam_client; client_ptr->report_missing_impl_and_exit(ver, EMU_FUNC_NAME);
} }
STEAMAPI_API void * S_CALLTYPE SteamInternal_CreateInterface( const char *ver ) STEAMAPI_API void * S_CALLTYPE SteamInternal_CreateInterface( const char *ver )

View File

@ -69,6 +69,7 @@ enum Steam_Pipe {
}; };
class Steam_Client : class Steam_Client :
public ISteamClient006,
public ISteamClient007, public ISteamClient007,
public ISteamClient008, public ISteamClient008,
public ISteamClient009, public ISteamClient009,
@ -347,6 +348,22 @@ public:
void DestroyAllInterfaces(); void DestroyAllInterfaces();
// older sdk ----------------------------------------------------------
// https://github.com/ValveSoftware/Proton/blob/proton_9.0/lsteamclient/steamworks_sdk_099v/isteamclient.h
// https://workshop.perforce.com/files/guest/knut_wikstrom/ValveSDKCode/public/steam/isteamclient.h
// creates a global instance of a steam user, so that other processes can share it
// used by the steam UI, to share it's account info/connection with any games it launches
// fails (returns NULL) if an existing instance already exists
HSteamUser CreateGlobalUser( HSteamPipe *phSteamPipe );
// retrieves the IVac interface associated with the handle
// there is normally only one instance of VAC running, but using this connects it to the right user/account
void *GetIVAC( HSteamUser hSteamUser );
// returns the name of a universe
const char *GetUniverseName( EUniverse eUniverse );
void *GetISteamBilling_old( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion );
// older sdk ----------------------------------------------------------
void report_missing_impl(std::string_view itf, std::string_view caller); void report_missing_impl(std::string_view itf, std::string_view caller);
[[noreturn]] void report_missing_impl_and_exit(std::string_view itf, std::string_view caller); [[noreturn]] void report_missing_impl_and_exit(std::string_view itf, std::string_view caller);

View File

@ -962,3 +962,53 @@ void Steam_Client::DestroyAllInterfaces()
{ {
PRINT_DEBUG_TODO(); PRINT_DEBUG_TODO();
} }
// older sdk ----------------------------------------------------------
// creates a global instance of a steam user, so that other processes can share it
// used by the steam UI, to share it's account info/connection with any games it launches
// fails (returns NULL) if an existing instance already exists
HSteamUser Steam_Client::CreateGlobalUser( HSteamPipe *phSteamPipe )
{
// TODO not sure if this implementation is correct
PRINT_DEBUG_TODO();
for (const auto& [pipe_handle, pipe_type] : steam_pipes) {
if (pipe_type == Steam_Pipe::CLIENT) {
if (phSteamPipe) *phSteamPipe = pipe_handle;
return 0;
}
}
HSteamPipe pipe = CreateSteamPipe();
if (phSteamPipe) *phSteamPipe = pipe;
steam_pipes[pipe] = Steam_Pipe::CLIENT;
return CLIENT_HSTEAMUSER;
}
// retrieves the IVac interface associated with the handle
// there is normally only one instance of VAC running, but using this connects it to the right user/account
void *Steam_Client::GetIVAC( HSteamUser hSteamUser )
{
PRINT_DEBUG_ENTRY();
// actual value from steamclient64.dll
return nullptr;
}
// returns the name of a universe
const char *Steam_Client::GetUniverseName( EUniverse eUniverse )
{
PRINT_DEBUG("%i", (int)eUniverse);
// actual values returned by steamclient64.dll
switch (eUniverse)
{
case EUniverse::k_EUniverseInvalid: return "Invalid";
case EUniverse::k_EUniversePublic: return "Public";
case EUniverse::k_EUniverseBeta: return "Beta";
case EUniverse::k_EUniverseInternal: return "Internal";
case EUniverse::k_EUniverseDev: return "Dev";
}
return "Unknown";
}
// older sdk ----------------------------------------------------------

View File

@ -33,6 +33,12 @@ ISteamBilling *Steam_Client::GetISteamBilling( HSteamUser hSteamUser, HSteamPipe
report_missing_impl_and_exit(pchVersion, EMU_FUNC_NAME); report_missing_impl_and_exit(pchVersion, EMU_FUNC_NAME);
} }
void *Steam_Client::GetISteamBilling_old( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("old");
return GetISteamBilling(hSteamUser, hSteamPipe, pchVersion);
}
// retrieves the ISteamAppDisableUpdate interface associated with the handle // retrieves the ISteamAppDisableUpdate interface associated with the handle
ISteamAppDisableUpdate *Steam_Client::GetISteamAppDisableUpdate( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) ISteamAppDisableUpdate *Steam_Client::GetISteamAppDisableUpdate( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
{ {

View File

@ -0,0 +1,87 @@
#ifndef ISTEAMCLIENT006_H
#define ISTEAMCLIENT006_H
#ifdef STEAM_WIN32
#pragma once
#endif
// this interface version is not found in public SDK archives, it is based on proton src: https://github.com/ValveSoftware/Proton/tree/proton_9.0/lsteamclient
#include "isteammasterserverupdater.h"
class ISteamClient006
{
public:
// Creates a communication pipe to the Steam client
virtual HSteamPipe CreateSteamPipe() = 0;
// Releases a previously created communications pipe
virtual bool BReleaseSteamPipe( HSteamPipe hSteamPipe ) = 0;
// creates a global instance of a steam user, so that other processes can share it
// used by the steam UI, to share it's account info/connection with any games it launches
// fails (returns NULL) if an existing instance already exists
virtual HSteamUser CreateGlobalUser( HSteamPipe *phSteamPipe ) = 0;
// connects to an existing global user, failing if none exists
// used by the game to coordinate with the steamUI
virtual HSteamUser ConnectToGlobalUser( HSteamPipe hSteamPipe ) = 0;
// used by game servers, create a steam user that won't be shared with anyone else
virtual HSteamUser CreateLocalUser( HSteamPipe *phSteamPipe ) = 0;
// removes an allocated user
virtual void ReleaseUser( HSteamPipe hSteamPipe, HSteamUser hUser ) = 0;
// retrieves the ISteamUser interface associated with the handle
virtual ISteamUser *GetISteamUser( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// retrieves the IVac interface associated with the handle
// there is normally only one instance of VAC running, but using this connects it to the right user/account
virtual void *GetIVAC( HSteamUser hSteamUser ) = 0;
// retrieves the ISteamGameServer interface associated with the handle
virtual ISteamGameServer *GetISteamGameServer( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// set the local IP and Port to bind to
// this must be set before CreateLocalUser()
virtual void SetLocalIPBinding( uint32 unIP, uint16 usPort ) = 0;
// returns the name of a universe
virtual const char *GetUniverseName( EUniverse eUniverse ) = 0;
// returns the ISteamFriends interface
virtual ISteamFriends *GetISteamFriends( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the ISteamUtils interface
virtual ISteamUtils *GetISteamUtils( HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
virtual void *GetISteamBilling_old( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the ISteamMatchmaking interface
virtual ISteamMatchmaking *GetISteamMatchmaking( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
virtual ISteamApps *GetISteamApps( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the ISteamContentServer interface
virtual ISteamContentServer *GetISteamContentServer( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the ISteamMasterServerUpdater interface
virtual ISteamMasterServerUpdater *GetISteamMasterServerUpdater( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the ISteamMatchmakingServers interface
virtual ISteamMatchmakingServers *GetISteamMatchmakingServers( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// this needs to be called every frame to process matchmaking results
// redundant if you're already calling SteamAPI_RunCallbacks()
virtual void RunFrame() = 0;
// returns the number of IPC calls made since the last time this function was called
// Used for perf debugging so you can understand how many IPC calls your game makes per frame
// Every IPC call is at minimum a thread context switch if not a process one so you want to rate
// control how often you do them.
virtual uint32 GetIPCCallCount() = 0;
};
#endif // ISTEAMCLIENT006_H

File diff suppressed because it is too large Load Diff