-
Notifications
You must be signed in to change notification settings - Fork 54
compatibilty for steam interface v9 #1088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: reactivedrop_beta
Are you sure you want to change the base?
Changes from all commits
10d45f0
871a4c3
cc54197
1bfddc3
574e27f
d2c65ca
a56dd03
23e3500
76f5470
63fe81d
565b770
c4ecb02
e07a8a5
5b8531d
3efb672
7c3e902
782f4e6
847bf3b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,7 +38,6 @@ void CRD_Infection_Deathmatch_Stats::OnUpdate( C_RD_HUD_VScript *pHUD ) | |
|
|
||
| if ( !m_bStatsRequested && SteamUserStats() ) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can probably remove this entire variable and the code that references it |
||
| { | ||
| SteamUserStats()->RequestCurrentStats(); | ||
| m_bStatsRequested = true; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -123,6 +123,9 @@ | |
| #undef CreateEvent | ||
|
|
||
| #ifndef CLIENT_DLL | ||
| // include gameserver interface | ||
| #include "rd_gameserver.h" | ||
|
|
||
| // expose server helper interface | ||
| #include "serverhelper.h" | ||
| static CServerHelper g_ServerHelper; | ||
|
|
@@ -619,6 +622,10 @@ bool CServerGameDLL::DLLInit( CreateInterfaceFn appSystemFactory, | |
| CGlobalVars *pGlobals) | ||
| { | ||
|
|
||
| #ifndef CLIENT_DLL | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this file isn't compiled with |
||
| GameServerInit(); | ||
| #endif | ||
|
|
||
| COM_TimestampedLog( "ConnectTier1/2/3Libraries - Start" ); | ||
|
|
||
| ConnectTier1Libraries( &appSystemFactory, 1 ); | ||
|
|
@@ -1457,6 +1464,9 @@ static void OnServerUpdateRequested() | |
|
|
||
| void CServerGameDLL::Think( bool finalTick ) | ||
| { | ||
| // run callbacks on every tick | ||
| GameServerCallbacks(); | ||
|
|
||
| static bool s_bUpdateCheckInit = engine->IsDedicatedServer(); | ||
| if ( s_bUpdateCheckInit ) | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| #include "cbase.h" | ||
| #include "rd_gameserver.h" | ||
|
|
||
| // memdbgon must be the last include file in a .cpp file!!! | ||
| #include "tier0/memdbgon.h" | ||
|
|
||
| inline uint16 GetCommandLinePort(const char* type, uint16 defaultPort = 0) | ||
| { | ||
| uint port = 0; | ||
|
|
||
| if (CommandLine()->CheckParm(type)) { | ||
| const char* sPortStr = CommandLine()->ParmValue(type, nullptr); | ||
| port = atoi(sPortStr); | ||
| } | ||
|
|
||
| if (port < 1024) port = defaultPort; | ||
|
|
||
| return port; | ||
| } | ||
|
|
||
| inline const char* GetGameVersion() | ||
| { | ||
| static char version[64] = "0.0.0.0"; | ||
|
|
||
| FILE* f = fopen("reactivedrop/steam.inf", "r"); | ||
| if (!f) | ||
| return version; | ||
|
|
||
| char line[256]; | ||
| while (fgets(line, sizeof(line), f)) | ||
| { | ||
| if (strncmp(line, "PatchVersion=", 13) == 0) | ||
| { | ||
| strncpy(version, line + 13, sizeof(version)); | ||
| version[strcspn(version, "\r\n")] = '\0'; | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| fclose(f); | ||
| return version; | ||
| } | ||
|
|
||
| bool GameServerInit() | ||
| { | ||
| // initialize the gameserver, srcds already binds to the correct ip and ports, so we can just pass the same parameters here | ||
| // get ip | ||
| uint32 ip = INADDR_ANY; | ||
| const char* ipStr = CommandLine()->ParmValue("-ip", nullptr); | ||
|
|
||
| if (CommandLine()->CheckParm("-ip")) { | ||
| struct sockaddr_in sa; | ||
| if (inet_pton(AF_INET, ipStr, &sa.sin_addr) == 1) { | ||
| ip = ntohl(sa.sin_addr.s_addr); | ||
| } | ||
| } | ||
|
|
||
| // get ports | ||
| uint16 gamePort = GetCommandLinePort("-port", 0); | ||
| uint16 clientPort = GetCommandLinePort("-clientport", 0); | ||
|
|
||
| // get version | ||
| const char* version = GetGameVersion(); | ||
|
|
||
| // show some debug | ||
| ConMsg("Using ip: %s:%d (%u) [%s]\n", ip > 0 ? ipStr : "0.0.0.0", gamePort, ip, version); | ||
|
|
||
| // load steam api | ||
| // this is done in engine, but needs to be redone at exactly this timing, to reconnect all steam interfaces | ||
| SteamAPI_Init(); | ||
|
|
||
| // we can spawn a gameserver immediately | ||
| const bool result = SteamGameServer_Init(ip, gamePort, clientPort, eServerModeAuthenticationAndSecure, version); | ||
| ConMsg("StartGameServer_Init resulted in %s\n", result ? "success" : "failure"); | ||
| return result; | ||
| } | ||
|
|
||
| void GameServerCallbacks() | ||
| { | ||
| // steam callbacks | ||
| SteamGameServer_RunCallbacks(); | ||
|
|
||
| // this is normally done in engine, but not anymore | ||
| // we need to put this here | ||
| if (SteamGameServer()) { | ||
| bool bLoggedIn = SteamGameServer()->BLoggedOn(); | ||
| if (!bLoggedIn) { | ||
| SteamGameServer()->LogOnAnonymous(); | ||
| } | ||
| } | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #ifndef GAMESERVER_H | ||
| #define GAMESERVER_H | ||
|
|
||
| #ifdef _WIN32 | ||
| #pragma once | ||
| #endif | ||
|
|
||
| #include "cbase.h" | ||
| #include "ws2tcpip.h" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. include isn't used in this header, so it can be moved to the cpp file |
||
|
|
||
| bool GameServerInit(); | ||
| void GameServerCallbacks(); | ||
|
|
||
| #endif | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,7 +64,7 @@ class CReactiveDropWorkshop : public CAutoGameSystem | |
| void ClearCaches( const char *szReason ); | ||
| void DoClearCaches(); | ||
| void GetActiveAddons( CUtlVector<PublishedFileId_t> &active ); | ||
| bool UpdateAndLoadAddon( PublishedFileId_t id, bool bHighPriority = false, bool bUnload = false ); | ||
| bool UpdateAndLoadAddon( PublishedFileId_t id, bool bHighPriority = false, bool bUnload = false, bool forceUpdate = false ); | ||
| void RealLoadAddon( PublishedFileId_t id ); | ||
| bool LoadAddon( PublishedFileId_t id, bool bFromDownload ); | ||
| void RealUnloadAddon( PublishedFileId_t id ); | ||
|
|
@@ -81,7 +81,9 @@ class CReactiveDropWorkshop : public CAutoGameSystem | |
| void SetupThink(); | ||
| bool DedicatedServerWorkshopSetup(); | ||
| void EnableServerWorkshopItem( PublishedFileId_t id ); | ||
| void OnPublishedFileDetails(RemoteStorageGetPublishedFileDetailsResult_t* pResult, bool bIOFailure); | ||
| bool m_bWorkshopSetupCompleted; | ||
| CUtlMap<PublishedFileId_t, int> s_SteamRemoteStorageChecked{DefLessFunc(PublishedFileId_t)}; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this isn't static, so it shouldn't start with |
||
| #endif | ||
|
|
||
| PublishedFileId_t FindAddonProvidingFile( const char *pszFileName ); | ||
|
|
@@ -139,6 +141,8 @@ class CReactiveDropWorkshop : public CAutoGameSystem | |
| const WorkshopItem_t & TryQueryAddon( PublishedFileId_t nPublishedFileID ); | ||
| #ifdef CLIENT_DLL | ||
| bool LoadAddonEarly( PublishedFileId_t nPublishedFileID ); | ||
| #else | ||
| CCallResult<CReactiveDropWorkshop, RemoteStorageGetPublishedFileDetailsResult_t> m_PublishedFileDetailsCallResult; | ||
| #endif | ||
|
|
||
| private: | ||
|
|
@@ -306,7 +310,7 @@ class CReactiveDropWorkshop : public CAutoGameSystem | |
| CCallResult<CReactiveDropWorkshop, SteamUGCQueryCompleted_t> m_UpdateWorkshopItemQueryResultCallback; | ||
| void UpdateWorkshopItemQueryResultCallback( SteamUGCQueryCompleted_t *pResult, bool bIOFailure ); | ||
| CCallResult<CReactiveDropWorkshop, CreateItemResult_t> m_CreateItemResultCallbackCurated; | ||
| void CreateItemResultCallbackCurated( CreateItemResult_t *pResult, bool bIOFailure ); | ||
| void CreateItemResultCallbackCurated( CreateItemResult_t *pResult, bool bIOFailure ); | ||
| friend static void ugc_create(const CCommand & args); | ||
| friend static void ugc_curated_create(const CCommand & args); | ||
| friend static void ugc_update(const CCommand & args); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should probably only run callbacks once per frame (check for a specific value for
curStage)