From bdac0cd83f185d444670b1d8905bb5deee1c03ce Mon Sep 17 00:00:00 2001 From: s1lentq Date: Sun, 15 Dec 2024 18:30:55 +0700 Subject: [PATCH] Add steam interface adapter ISteamGameServer v011 for rehlds api --- rehlds/CMakeLists.txt | 1 + rehlds/msvc/ReHLDS.vcxproj | 3 + rehlds/msvc/ReHLDS.vcxproj.filters | 12 + rehlds/public/rehlds/rehlds_interfaces.h | 2 +- rehlds/public/steam/isteamgameserver.h | 11 +- rehlds/public/steam/isteamgameserver011.h | 256 ++++++++++++++++ rehlds/public/steam/steam_gameserver.h | 3 +- rehlds/rehlds/rehlds_interfaces_impl.cpp | 4 +- rehlds/rehlds/rehlds_interfaces_impl.h | 3 +- rehlds/rehlds/steam_adapter/gameserver011.cpp | 289 ++++++++++++++++++ rehlds/rehlds/steam_adapter/gameserver011.h | 9 + 11 files changed, 582 insertions(+), 11 deletions(-) create mode 100644 rehlds/public/steam/isteamgameserver011.h create mode 100644 rehlds/rehlds/steam_adapter/gameserver011.cpp create mode 100644 rehlds/rehlds/steam_adapter/gameserver011.h diff --git a/rehlds/CMakeLists.txt b/rehlds/CMakeLists.txt index e48e87d1..bd968bd5 100644 --- a/rehlds/CMakeLists.txt +++ b/rehlds/CMakeLists.txt @@ -184,6 +184,7 @@ set(ENGINE_SRCS rehlds/rehlds_interfaces_impl.cpp rehlds/rehlds_messagemngr_impl.cpp rehlds/rehlds_security.cpp + rehlds/steam_adapter/gameserver011.cpp ) set(UNITTESTS_SRCS diff --git a/rehlds/msvc/ReHLDS.vcxproj b/rehlds/msvc/ReHLDS.vcxproj index 2b4d97ca..97807198 100644 --- a/rehlds/msvc/ReHLDS.vcxproj +++ b/rehlds/msvc/ReHLDS.vcxproj @@ -140,6 +140,7 @@ + @@ -413,6 +414,7 @@ + @@ -467,6 +469,7 @@ + diff --git a/rehlds/msvc/ReHLDS.vcxproj.filters b/rehlds/msvc/ReHLDS.vcxproj.filters index 0dae4f75..8b841498 100644 --- a/rehlds/msvc/ReHLDS.vcxproj.filters +++ b/rehlds/msvc/ReHLDS.vcxproj.filters @@ -51,6 +51,9 @@ {c91850f0-8e81-47e5-9a5f-53215766e960} + + {4e2d8487-e3d7-44e0-a4e7-1ab2aae5d5d1} + @@ -344,6 +347,9 @@ rehlds + + rehlds\steam_adapter + @@ -1126,5 +1132,11 @@ public\steam + + public\steam + + + rehlds\steam_adapter + \ No newline at end of file diff --git a/rehlds/public/rehlds/rehlds_interfaces.h b/rehlds/public/rehlds/rehlds_interfaces.h index 438838c1..c68c3963 100644 --- a/rehlds/public/rehlds/rehlds_interfaces.h +++ b/rehlds/public/rehlds/rehlds_interfaces.h @@ -285,7 +285,7 @@ class IRehldsServerData { virtual void SetResourcesNum(int num) = 0; virtual struct resource_s *GetResource(int index) = 0; virtual void SetName(const char* name) = 0; - virtual class ISteamGameServer *GetSteamGameServer() = 0; + virtual class ISteamGameServer011 *GetSteamGameServer() = 0; virtual struct netadr_s *GetNetFrom() = 0; virtual double GetOldTime() = 0; diff --git a/rehlds/public/steam/isteamgameserver.h b/rehlds/public/steam/isteamgameserver.h index 149b4e30..cb647fab 100644 --- a/rehlds/public/steam/isteamgameserver.h +++ b/rehlds/public/steam/isteamgameserver.h @@ -25,7 +25,7 @@ class ISteamGameServer // /// This is called by SteamGameServer_Init, and you will usually not need to call it directly - STEAM_PRIVATE_API( virtual bool InitGameServer( uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char *pchVersionString ) = 0; ) + virtual bool InitGameServer( uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char *pchVersionString ) = 0; /// Game product identifier. This is currently used by the master server for version checking purposes. /// It's a required field, but will eventually will go away, and the AppID will be used for this purpose. @@ -256,14 +256,13 @@ class ISteamGameServer // Return Value: true if successful, false if failure (ie, steamIDUser wasn't for an active player) virtual bool BUpdateUserData( CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore ) = 0; -// Deprecated functions. These will be removed in a future version of the SDK. +// DEPRECATED! +// These will be removed in a future version of the SDK. // If you really need these, please contact us and help us understand what you are // using them for. -// STEAM_PRIVATE_API( - virtual void SetMasterServerHeartbeatInterval( int iHeartbeatInterval ) = 0; - virtual void ForceMasterServerHeartbeat() = 0; -// ) + virtual void SetMasterServerHeartbeatInterval( int iHeartbeatInterval ) = 0; + virtual void ForceMasterServerHeartbeat() = 0; }; #define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer015" diff --git a/rehlds/public/steam/isteamgameserver011.h b/rehlds/public/steam/isteamgameserver011.h new file mode 100644 index 00000000..a5527dd0 --- /dev/null +++ b/rehlds/public/steam/isteamgameserver011.h @@ -0,0 +1,256 @@ +//====== Copyright (c) 1996-2008, Valve Corporation, All rights reserved. ======= +// +// Purpose: interface 011 version to steam for game servers +// +//============================================================================= + +#ifndef ISTEAMGAMESERVER_011_H +#define ISTEAMGAMESERVER_011_H +#ifdef _WIN32 +#pragma once +#endif + +#include "steam_api_common.h" + +//----------------------------------------------------------------------------- +// Purpose: Functions for authenticating users via Steam to play on a game server +//----------------------------------------------------------------------------- +class ISteamGameServer011 +{ +public: + +// +// Basic server data. These properties, if set, must be set before before calling LogOn. They +// may not be changed after logged in. +// + + /// This is called by SteamGameServer_Init, and you will usually not need to call it directly + virtual bool InitGameServer( uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char *pchVersionString ) = 0; + + /// Game product identifier. This is currently used by the master server for version checking purposes. + /// It's a required field, but will eventually will go away, and the AppID will be used for this purpose. + virtual void SetProduct( const char *pszProduct ) = 0; + + /// Description of the game. This is a required field and is displayed in the steam server browser....for now. + /// This is a required field, but it will go away eventually, as the data should be determined from the AppID. + virtual void SetGameDescription( const char *pszGameDescription ) = 0; + + /// If your game is a "mod," pass the string that identifies it. The default is an empty string, meaning + /// this application is the original game, not a mod. + /// + /// @see k_cbMaxGameServerGameDir + virtual void SetModDir( const char *pszModDir ) = 0; + + /// Is this is a dedicated server? The default value is false. + virtual void SetDedicatedServer( bool bDedicated ) = 0; + +// +// Login +// + + /// Begin process to login to a persistent game server account + /// + /// You need to register for callbacks to determine the result of this operation. + /// @see SteamServersConnected_t + /// @see SteamServerConnectFailure_t + /// @see SteamServersDisconnected_t + virtual void LogOn( + const char *pszAccountName, + const char *pszPassword + ) = 0; + + /// Login to a generic, anonymous account. + /// + /// Note: in previous versions of the SDK, this was automatically called within SteamGameServer_Init, + /// but this is no longer the case. + virtual void LogOnAnonymous() = 0; + + /// Begin process of logging game server out of steam + virtual void LogOff() = 0; + + // status functions + virtual bool BLoggedOn() = 0; + virtual bool BSecure() = 0; + virtual CSteamID GetSteamID() = 0; + + /// Returns true if the master server has requested a restart. + /// Only returns true once per request. + virtual bool WasRestartRequested() = 0; + +// +// Server state. These properties may be changed at any time. +// + + /// Max player count that will be reported to server browser and client queries + virtual void SetMaxPlayerCount( int cPlayersMax ) = 0; + + /// Number of bots. Default value is zero + virtual void SetBotPlayerCount( int cBotplayers ) = 0; + + /// Set the name of server as it will appear in the server browser + /// + /// @see k_cbMaxGameServerName + virtual void SetServerName( const char *pszServerName ) = 0; + + /// Set name of map to report in the server browser + /// + /// @see k_cbMaxGameServerName + virtual void SetMapName( const char *pszMapName ) = 0; + + /// Let people know if your server will require a password + virtual void SetPasswordProtected( bool bPasswordProtected ) = 0; + + /// Spectator server. The default value is zero, meaning the service + /// is not used. + virtual void SetSpectatorPort( uint16 unSpectatorPort ) = 0; + + /// Name of the spectator server. (Only used if spectator port is nonzero.) + /// + /// @see k_cbMaxGameServerMapName + virtual void SetSpectatorServerName( const char *pszSpectatorServerName ) = 0; + + /// Call this to clear the whole list of key/values that are sent in rules queries. + virtual void ClearAllKeyValues() = 0; + + /// Call this to add/update a key/value pair. + virtual void SetKeyValue( const char *pKey, const char *pValue ) = 0; + + /// Sets a string defining the "gametags" for this server, this is optional, but if it is set + /// it allows users to filter in the matchmaking/server-browser interfaces based on the value + /// + /// @see k_cbMaxGameServerTags + virtual void SetGameTags( const char *pchGameTags ) = 0; + + /// Sets a string defining the "gamedata" for this server, this is optional, but if it is set + /// it allows users to filter in the matchmaking/server-browser interfaces based on the value + /// don't set this unless it actually changes, its only uploaded to the master once (when + /// acknowledged) + /// + /// @see k_cbMaxGameServerGameData + virtual void SetGameData( const char *pchGameData) = 0; + + /// Region identifier. This is an optional field, the default value is empty, meaning the "world" region + virtual void SetRegion( const char *pszRegion ) = 0; + +// +// Player list management / authentication +// + + // Handles receiving a new connection from a Steam user. This call will ask the Steam + // servers to validate the users identity, app ownership, and VAC status. If the Steam servers + // are off-line, then it will validate the cached ticket itself which will validate app ownership + // and identity. The AuthBlob here should be acquired on the game client using SteamUser()->InitiateGameConnection() + // and must then be sent up to the game server for authentication. + // + // Return Value: returns true if the users ticket passes basic checks. pSteamIDUser will contain the Steam ID of this user. pSteamIDUser must NOT be NULL + // If the call succeeds then you should expect a GSClientApprove_t or GSClientDeny_t callback which will tell you whether authentication + // for the user has succeeded or failed (the steamid in the callback will match the one returned by this call) + virtual bool SendUserConnectAndAuthenticate( uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser ) = 0; + + // Creates a fake user (ie, a bot) which will be listed as playing on the server, but skips validation. + // + // Return Value: Returns a SteamID for the user to be tracked with, you should call HandleUserDisconnect() + // when this user leaves the server just like you would for a real user. + virtual CSteamID CreateUnauthenticatedUserConnection() = 0; + + // Should be called whenever a user leaves our game server, this lets Steam internally + // track which users are currently on which servers for the purposes of preventing a single + // account being logged into multiple servers, showing who is currently on a server, etc. + virtual void SendUserDisconnect( CSteamID steamIDUser ) = 0; + + // Update the data to be displayed in the server browser and matchmaking interfaces for a user + // currently connected to the server. For regular users you must call this after you receive a + // GSUserValidationSuccess callback. + // + // Return Value: true if successful, false if failure (ie, steamIDUser wasn't for an active player) + virtual bool BUpdateUserData( CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore ) = 0; + + // New auth system APIs - do not mix with the old auth system APIs. + // ---------------------------------------------------------------- + + // Retrieve ticket to be sent to the entity who wishes to authenticate you ( using BeginAuthSession API ). + // pcbTicket retrieves the length of the actual ticket. + virtual HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0; + + // Authenticate ticket ( from GetAuthSessionTicket ) from entity steamID to be sure it is valid and isnt reused + // Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse ) + virtual EBeginAuthSessionResult BeginAuthSession( const void *pAuthTicket, int cbAuthTicket, CSteamID steamID ) = 0; + + // Stop tracking started by BeginAuthSession - called when no longer playing game with this entity + virtual void EndAuthSession( CSteamID steamID ) = 0; + + // Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to + virtual void CancelAuthTicket( HAuthTicket hAuthTicket ) = 0; + + // After receiving a user's authentication data, and passing it to SendUserConnectAndAuthenticate, use this function + // to determine if the user owns downloadable content specified by the provided AppID. + virtual EUserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_t appID ) = 0; + + // Ask if a user in in the specified group, results returns async by GSUserGroupStatus_t + // returns false if we're not connected to the steam servers and thus cannot ask + virtual bool RequestUserGroupStatus( CSteamID steamIDUser, CSteamID steamIDGroup ) = 0; + +// +// Query steam for server data +// + + // Ask for the gameplay stats for the server. Results returned in a callback + virtual void GetGameplayStats( ) = 0; + + // Gets the reputation score for the game server. This API also checks if the server or some + // other server on the same IP is banned from the Steam master servers. + virtual SteamAPICall_t GetServerReputation( ) = 0; + + // Returns the public IP of the server according to Steam, useful when the server is + // behind NAT and you want to advertise its IP in a lobby for other clients to directly + // connect to + virtual uint32 GetPublicIP() = 0; + +// These are in GameSocketShare mode, where instead of ISteamGameServer creating its own +// socket to talk to the master server on, it lets the game use its socket to forward messages +// back and forth. This prevents us from requiring server ops to open up yet another port +// in their firewalls. +// +// the IP address and port should be in host order, i.e 127.0.0.1 == 0x7f000001 + + // These are used when you've elected to multiplex the game server's UDP socket + // rather than having the master server updater use its own sockets. + // + // Source games use this to simplify the job of the server admins, so they + // don't have to open up more ports on their firewalls. + + // Call this when a packet that starts with 0xFFFFFFFF comes in. That means + // it's for us. + virtual bool HandleIncomingPacket( const void *pData, int cbData, uint32 srcIP, uint16 srcPort ) = 0; + + // AFTER calling HandleIncomingPacket for any packets that came in that frame, call this. + // This gets a packet that the master server updater needs to send out on UDP. + // It returns the length of the packet it wants to send, or 0 if there are no more packets to send. + // Call this each frame until it returns 0. + virtual int GetNextOutgoingPacket( void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort ) = 0; + +// +// Control heartbeats / advertisement with master server +// + + // Call this as often as you like to tell the master server updater whether or not + // you want it to be active (default: off). + virtual void EnableHeartbeats( bool bActive ) = 0; + + // You usually don't need to modify this. + // Pass -1 to use the default value for iHeartbeatInterval. + // Some mods change this. + virtual void SetHeartbeatInterval( int iHeartbeatInterval ) = 0; + + // Force a heartbeat to steam at the next opportunity + virtual void ForceHeartbeat() = 0; + + // associate this game server with this clan for the purposes of computing player compat + virtual SteamAPICall_t AssociateWithClan( CSteamID steamIDClan ) = 0; + + // ask if any of the current players dont want to play with this new player - or vice versa + virtual SteamAPICall_t ComputeNewPlayerCompatibility( CSteamID steamIDNewPlayer ) = 0; + +}; + +#endif // ISTEAMGAMESERVER_011_H diff --git a/rehlds/public/steam/steam_gameserver.h b/rehlds/public/steam/steam_gameserver.h index db273428..d6e5d008 100644 --- a/rehlds/public/steam/steam_gameserver.h +++ b/rehlds/public/steam/steam_gameserver.h @@ -1,4 +1,4 @@ -//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. ======= +//====== Copyright 1996-2008, Valve Corporation, All rights reserved. ======= // // Purpose: // @@ -12,6 +12,7 @@ #include "steam_api.h" #include "isteamgameserver.h" +#include "isteamgameserver011.h" #include "isteamgameserverstats.h" enum EServerMode diff --git a/rehlds/rehlds/rehlds_interfaces_impl.cpp b/rehlds/rehlds/rehlds_interfaces_impl.cpp index 0922bfa9..200f790e 100644 --- a/rehlds/rehlds/rehlds_interfaces_impl.cpp +++ b/rehlds/rehlds/rehlds_interfaces_impl.cpp @@ -904,8 +904,8 @@ IGameClient* GetRehldsApiClient(client_t* cl) return g_GameClients[idx]; } -ISteamGameServer* EXT_FUNC CRehldsServerData::GetSteamGameServer() { - return ::SteamGameServer(); +ISteamGameServer011* EXT_FUNC CRehldsServerData::GetSteamGameServer() { + return ::SteamGameServer_v011(); } netadr_t* EXT_FUNC CRehldsServerData::GetNetFrom() { diff --git a/rehlds/rehlds/rehlds_interfaces_impl.h b/rehlds/rehlds/rehlds_interfaces_impl.h index 7c625472..f3f5b4ed 100644 --- a/rehlds/rehlds/rehlds_interfaces_impl.h +++ b/rehlds/rehlds/rehlds_interfaces_impl.h @@ -29,6 +29,7 @@ #include "maintypes.h" #include "rehlds_interfaces.h" #include "server.h" +#include "steam_adapter/gameserver011.h" const int NET_DECOMPRESS_MAX_TIMES = 10; @@ -309,7 +310,7 @@ class CRehldsServerData : public IRehldsServerData { virtual void SetResourcesNum(int num); virtual struct resource_s *GetResource(int index); virtual void SetName(const char* name); - virtual ISteamGameServer *GetSteamGameServer(); + virtual ISteamGameServer011 *GetSteamGameServer(); virtual netadr_t *GetNetFrom(); virtual double GetOldTime(); diff --git a/rehlds/rehlds/steam_adapter/gameserver011.cpp b/rehlds/rehlds/steam_adapter/gameserver011.cpp new file mode 100644 index 00000000..fb792a97 --- /dev/null +++ b/rehlds/rehlds/steam_adapter/gameserver011.cpp @@ -0,0 +1,289 @@ +//============================================================================= +// +// Versioned interface adapter ISteamGameServer for rehlds api +// +//============================================================================= + +#include "precompiled.h" + +#include "steam/steam_api.h" +#include "steam/steam_gameserver.h" + +class CAdapterSteamGameServer011: public ISteamGameServer011 +{ +public: + virtual bool InitGameServer(uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char *pchVersionString); + virtual void SetProduct(const char *pszProduct); + virtual void SetGameDescription(const char *pszGameDescription); + virtual void SetModDir(const char *pszModDir); + virtual void SetDedicatedServer(bool bDedicated); + virtual void LogOn(const char *pszAccountName, const char *pszPassword); + virtual void LogOnAnonymous(); + virtual void LogOff(); + virtual bool BLoggedOn(); + virtual bool BSecure(); + virtual CSteamID GetSteamID(); + virtual bool WasRestartRequested(); + virtual void SetMaxPlayerCount(int cPlayersMax); + virtual void SetBotPlayerCount(int cBotplayers); + virtual void SetServerName(const char *pszServerName); + virtual void SetMapName(const char *pszMapName); + virtual void SetPasswordProtected(bool bPasswordProtected); + virtual void SetSpectatorPort(uint16 unSpectatorPort); + virtual void SetSpectatorServerName(const char *pszSpectatorServerName); + virtual void ClearAllKeyValues(); + virtual void SetKeyValue(const char *pKey, const char *pValue); + virtual void SetGameTags(const char *pchGameTags); + virtual void SetGameData(const char *pchGameData); + virtual void SetRegion(const char *pszRegion); + virtual bool SendUserConnectAndAuthenticate(uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser); + virtual CSteamID CreateUnauthenticatedUserConnection(); + virtual void SendUserDisconnect(CSteamID steamIDUser); + virtual bool BUpdateUserData(CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore); + virtual HAuthTicket GetAuthSessionTicket(void *pTicket, int cbMaxTicket, uint32 *pcbTicket); + virtual EBeginAuthSessionResult BeginAuthSession(const void *pAuthTicket, int cbAuthTicket, CSteamID steamID); + virtual void EndAuthSession(CSteamID steamID); + virtual void CancelAuthTicket(HAuthTicket hAuthTicket); + virtual EUserHasLicenseForAppResult UserHasLicenseForApp(CSteamID steamID, AppId_t appID); + virtual bool RequestUserGroupStatus(CSteamID steamIDUser, CSteamID steamIDGroup); + virtual void GetGameplayStats(); + virtual SteamAPICall_t GetServerReputation(); + virtual uint32 GetPublicIP(); + virtual bool HandleIncomingPacket(const void *pData, int cbData, uint32 srcIP, uint16 srcPort); + virtual int GetNextOutgoingPacket(void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort); + virtual void EnableHeartbeats(bool bActive); + virtual void SetHeartbeatInterval(int iHeartbeatInterval); + virtual void ForceHeartbeat(); + virtual SteamAPICall_t AssociateWithClan(CSteamID steamIDClan); + virtual SteamAPICall_t ComputeNewPlayerCompatibility(CSteamID steamIDNewPlayer); +}; + +ISteamGameServer011 *SteamGameServer_v011() +{ + static CAdapterSteamGameServer011 gSteamGameServer011Singleton{}; + return &gSteamGameServer011Singleton; +} + +bool CAdapterSteamGameServer011::InitGameServer(uint32_t unIP, uint16_t usGamePort, uint16_t usQueryPort, uint32_t unFlags, AppId_t nGameAppId, const char *pchVersionString) +{ + return SteamGameServer()->InitGameServer(unIP, usGamePort, usQueryPort, unFlags, nGameAppId, pchVersionString); +} + +void CAdapterSteamGameServer011::SetProduct(const char *pszProduct) +{ + SteamGameServer()->SetProduct(pszProduct); +} + +void CAdapterSteamGameServer011::SetGameDescription(const char *pszGameDescription) +{ + SteamGameServer()->SetGameDescription(pszGameDescription); +} + +void CAdapterSteamGameServer011::SetModDir(const char *pszModDir) +{ + SteamGameServer()->SetModDir(pszModDir); +} + +void CAdapterSteamGameServer011::SetDedicatedServer(bool bDedicated) +{ + SteamGameServer()->SetDedicatedServer(bDedicated); +} + +void CAdapterSteamGameServer011::LogOn(const char *pszAccountName, const char *pszPassword) +{ + const char *pszToken = pszAccountName; + SteamGameServer()->LogOn(pszToken); +} + +void CAdapterSteamGameServer011::LogOnAnonymous() +{ + SteamGameServer()->LogOnAnonymous(); +} + +void CAdapterSteamGameServer011::LogOff() +{ + SteamGameServer()->LogOff(); +} + +bool CAdapterSteamGameServer011::BLoggedOn() +{ + return SteamGameServer()->BLoggedOn(); +} + +bool CAdapterSteamGameServer011::BSecure() +{ + return SteamGameServer()->BSecure(); +} + +CSteamID CAdapterSteamGameServer011::GetSteamID() +{ + return SteamGameServer()->GetSteamID(); +} + +bool CAdapterSteamGameServer011::WasRestartRequested() +{ + return SteamGameServer()->WasRestartRequested(); +} + +void CAdapterSteamGameServer011::SetMaxPlayerCount(int cPlayersMax) +{ + SteamGameServer()->SetMaxPlayerCount(cPlayersMax); +} + +void CAdapterSteamGameServer011::SetBotPlayerCount(int cBotplayers) +{ + SteamGameServer()->SetBotPlayerCount(cBotplayers); +} + +void CAdapterSteamGameServer011::SetServerName(const char *pszServerName) +{ + SteamGameServer()->SetServerName(pszServerName); +} + +void CAdapterSteamGameServer011::SetMapName(const char *pszMapName) +{ + SteamGameServer()->SetMapName(pszMapName); +} + +void CAdapterSteamGameServer011::SetPasswordProtected(bool bPasswordProtected) +{ + SteamGameServer()->SetPasswordProtected(bPasswordProtected); +} + +void CAdapterSteamGameServer011::SetSpectatorPort(uint16_t unSpectatorPort) +{ + SteamGameServer()->SetSpectatorPort(unSpectatorPort); +} + +void CAdapterSteamGameServer011::SetSpectatorServerName(const char *pszSpectatorServerName) +{ + SteamGameServer()->SetSpectatorServerName(pszSpectatorServerName); +} + +void CAdapterSteamGameServer011::ClearAllKeyValues() +{ + SteamGameServer()->ClearAllKeyValues(); +} + +void CAdapterSteamGameServer011::SetKeyValue(const char *pKey, const char *pValue) +{ + SteamGameServer()->SetKeyValue(pKey, pValue); +} + +void CAdapterSteamGameServer011::SetGameTags(const char *pchGameTags) +{ + SteamGameServer()->SetGameTags(pchGameTags); +} + +void CAdapterSteamGameServer011::SetGameData(const char *pchGameData) +{ + SteamGameServer()->SetGameData(pchGameData); +} + +void CAdapterSteamGameServer011::SetRegion(const char *pszRegion) +{ + SteamGameServer()->SetRegion(pszRegion); +} + +bool CAdapterSteamGameServer011::SendUserConnectAndAuthenticate(uint32_t unIPClient, const void *pvAuthBlob, uint32_t cubAuthBlobSize, CSteamID *pSteamIDUser) +{ + return SteamGameServer()->SendUserConnectAndAuthenticate(unIPClient, pvAuthBlob, cubAuthBlobSize, pSteamIDUser); +} + +CSteamID CAdapterSteamGameServer011::CreateUnauthenticatedUserConnection() +{ + return SteamGameServer()->CreateUnauthenticatedUserConnection(); +} + +void CAdapterSteamGameServer011::SendUserDisconnect(CSteamID steamIDUser) +{ + SteamGameServer()->SendUserDisconnect(steamIDUser); +} + +bool CAdapterSteamGameServer011::BUpdateUserData(CSteamID steamIDUser, const char *pchPlayerName, uint32_t uScore) +{ + return SteamGameServer()->BUpdateUserData(steamIDUser, pchPlayerName, uScore); +} + +HAuthTicket CAdapterSteamGameServer011::GetAuthSessionTicket(void *pTicket, int cbMaxTicket, uint32_t *pcbTicket) +{ + SteamNetworkingIdentity snidl{}; + snidl.SetSteamID64(GetSteamID().ConvertToUint64()); + return SteamGameServer()->GetAuthSessionTicket(pTicket, cbMaxTicket, pcbTicket, &snidl); +} + +EBeginAuthSessionResult CAdapterSteamGameServer011::BeginAuthSession(const void *pAuthTicket, int cbAuthTicket, CSteamID steamID) +{ + return SteamGameServer()->BeginAuthSession(pAuthTicket, cbAuthTicket, steamID); +} + +void CAdapterSteamGameServer011::EndAuthSession(CSteamID steamID) +{ + SteamGameServer()->EndAuthSession(steamID); +} + +void CAdapterSteamGameServer011::CancelAuthTicket(HAuthTicket hAuthTicket) +{ + SteamGameServer()->CancelAuthTicket(hAuthTicket); +} + +EUserHasLicenseForAppResult CAdapterSteamGameServer011::UserHasLicenseForApp(CSteamID steamID, AppId_t appID) +{ + return SteamGameServer()->UserHasLicenseForApp(steamID, appID); +} + +bool CAdapterSteamGameServer011::RequestUserGroupStatus(CSteamID steamIDUser, CSteamID steamIDGroup) +{ + return SteamGameServer()->RequestUserGroupStatus(steamIDUser, steamIDGroup); +} + +void CAdapterSteamGameServer011::GetGameplayStats() +{ + SteamGameServer()->GetGameplayStats(); +} + +SteamAPICall_t CAdapterSteamGameServer011::GetServerReputation() +{ + return SteamGameServer()->GetServerReputation(); +} + +uint32_t CAdapterSteamGameServer011::GetPublicIP() +{ + SteamIPAddress_t publicIP = SteamGameServer()->GetPublicIP(); + return publicIP.m_unIPv4; +} + +bool CAdapterSteamGameServer011::HandleIncomingPacket(const void *pData, int cbData, uint32_t srcIP, uint16_t srcPort) +{ + return SteamGameServer()->HandleIncomingPacket(pData, cbData, srcIP, srcPort); +} + +int CAdapterSteamGameServer011::GetNextOutgoingPacket(void *pOut, int cbMaxOut, uint32_t *pNetAdr, uint16_t *pPort) +{ + return SteamGameServer()->GetNextOutgoingPacket(pOut, cbMaxOut, pNetAdr, pPort); +} + +void CAdapterSteamGameServer011::EnableHeartbeats(bool bActive) +{ + SteamGameServer()->SetAdvertiseServerActive(bActive); +} + +void CAdapterSteamGameServer011::SetHeartbeatInterval(int iHeartbeatInterval) +{ + SteamGameServer()->SetMasterServerHeartbeatInterval(iHeartbeatInterval); +} + +void CAdapterSteamGameServer011::ForceHeartbeat() +{ + SteamGameServer()->ForceMasterServerHeartbeat(); +} + +SteamAPICall_t CAdapterSteamGameServer011::AssociateWithClan(CSteamID steamIDClan) +{ + return SteamGameServer()->AssociateWithClan(steamIDClan); +} + +SteamAPICall_t CAdapterSteamGameServer011::ComputeNewPlayerCompatibility(CSteamID steamIDNewPlayer) +{ + return SteamGameServer()->ComputeNewPlayerCompatibility(steamIDNewPlayer); +} diff --git a/rehlds/rehlds/steam_adapter/gameserver011.h b/rehlds/rehlds/steam_adapter/gameserver011.h new file mode 100644 index 00000000..6163aa20 --- /dev/null +++ b/rehlds/rehlds/steam_adapter/gameserver011.h @@ -0,0 +1,9 @@ +//============================================================================= +// +// Versioned interface adapter ISteamGameServer for rehlds api +// +//============================================================================= + +#pragma once + +ISteamGameServer011 *SteamGameServer_v011();