From b1a806dccb3cdd9786c11643dfad670122fd6db2 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 27 Mar 2022 22:17:30 +0200 Subject: [PATCH] Rename 'GAMECLIENTONLY' definition to 'CLIENT_DLL' --- r5dev/common/opcodes.cpp | 4 ++-- r5dev/common/opcodes.h | 4 ++-- r5dev/core/init.cpp | 40 +++++++++++++++++------------------ r5dev/engine/host_state.cpp | 20 +++++++++--------- r5dev/engine/net_chan.cpp | 8 +++---- r5dev/gameui/IBrowser.cpp | 24 ++++++++++----------- r5dev/public/include/edict.h | 12 +++++------ r5dev/vproj/clientsdk.vcxproj | 4 ++-- 8 files changed, 58 insertions(+), 58 deletions(-) diff --git a/r5dev/common/opcodes.cpp b/r5dev/common/opcodes.cpp index 3ea73624..2dae1cd3 100644 --- a/r5dev/common/opcodes.cpp +++ b/r5dev/common/opcodes.cpp @@ -301,9 +301,9 @@ void RuntimePtc_Init() /* .TEXT */ p_CAI_NetworkManager__ShouldRebuild.Offset(0xA0).FindPatternSelf("FF ?? ?? ?? 00 00", ADDRESS::Direction::DOWN, 200).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Virtual call to restart when building AIN (which clears the AIN memory). Remove this once writing to file works. Detour_LevelInit.Offset(0x100).FindPatternSelf("74", ADDRESS::Direction::DOWN, 600).Patch({ 0xEB }); // JE --> JMP | Do while loop setting fields to -1 in navmesh is writing out of bounds (!TODO). #endif -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL Server_S2C_CONNECT_1.Offset(0x7).Patch({ 0xEB }); // JZ --> JMP | Prevent entitlement check to kick player from server on S2C_CONNECT Packet if it does not match the servers one. -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL } void RuntimePtc_Toggle() /* .TEXT */ diff --git a/r5dev/common/opcodes.h b/r5dev/common/opcodes.h index 0a58f478..922f2b2b 100644 --- a/r5dev/common/opcodes.h +++ b/r5dev/common/opcodes.h @@ -100,9 +100,9 @@ namespace //------------------------------------------------------------------------- // RUNTIME: S2C_CHALLENGE //------------------------------------------------------------------------- -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL ADDRESS Server_S2C_CONNECT_1 = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x3B\x05\x00\x00\x00\x00\x74\x0C", "xxx????xx"); -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL //------------------------------------------------------------------------- // .RDATA diff --git a/r5dev/core/init.cpp b/r5dev/core/init.cpp index 1256b7e0..1b9bff77 100644 --- a/r5dev/core/init.cpp +++ b/r5dev/core/init.cpp @@ -36,10 +36,10 @@ #endif // !DEDICATED #include "client/client.h" #include "client/IVEngineClient.h" -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL #include "server/server.h" #include "server/IVEngineServer.h" -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL #include "squirrel/sqinit.h" #include "squirrel/sqapi.h" #include "squirrel/sqvm.h" @@ -50,9 +50,9 @@ #include "rtech/rui/rui.h" #endif // !DEDICATED #include "engine/baseclient.h" -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL #include "engine/baseserver.h" -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL #include "engine/common.h" #include "engine/cmodel_bsp.h" #include "engine/host_cmd.h" @@ -61,9 +61,9 @@ #include "engine/net.h" #include "engine/net_chan.h" #include "engine/cl_main.h" -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL #include "engine/sv_main.h" -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL #include "engine/sys_dll.h" #include "engine/sys_dll2.h" #include "engine/sys_engine.h" @@ -74,7 +74,7 @@ #ifndef DEDICATED #include "engine/debugoverlay.h" #endif // !DEDICATED -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL #include "game/server/ai_node.h" #include "game/server/ai_network.h" #include "game/server/ai_networkmanager.h" @@ -83,7 +83,7 @@ #include "game/server/fairfight_impl.h" #include "game/server/gameinterface.h" #include "public/include/edict.h" -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL #ifndef DEDICATED #include "inputsystem/inputsystem.h" #include "windows/id3dx.h" @@ -135,9 +135,9 @@ void Systems_Init() CHLClient_Attach(); #endif // !DEDICATED -#if !defined(GAMECLIENTONLY) && defined (GAMEDLL_S3) +#if !defined(CLIENT_DLL) && defined (GAMEDLL_S3) CServer_Attach(); // S1 and S2 CServer functions require work. -#endif // !GAMECLIENTONLY && GAMEDLL_S3 +#endif // !CLIENT_DLL && GAMEDLL_S3 // !TEMP UNTIL CHOSTSTATE IS BUILD AGNOSTIC! // #if defined (DEDICATED) || defined (GAMEDLL_S3) @@ -150,9 +150,9 @@ void Systems_Init() IConVar_Attach(); CKeyValueSystem_Attach(); -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL IVEngineServer_Attach(); -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL SQAPI_Attach(); SQVM_Attach(); @@ -170,10 +170,10 @@ void Systems_Init() //DebugOverlays_Attach(); #endif // !DEDICATED -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL CAI_Utility_Attach(); CAI_NetworkManager_Attach(); -#endif // !#ifndef GAMECLIENTONLY +#endif // !#ifndef CLIENT_DLL // Patch instructions RuntimePtc_Init(); @@ -236,9 +236,9 @@ void Systems_Shutdown() CHLClient_Detach(); #endif // !DEDICATED -#if !defined(GAMECLIENTONLY) && defined (GAMEDLL_S3) +#if !defined(CLIENT_DLL) && defined (GAMEDLL_S3) CServer_Detach(); // S1 and S2 CServer functions require work. -#endif // !GAMECLIENTONLY && GAMEDLL_S3 +#endif // !CLIENT_DLL && GAMEDLL_S3 // !TEMP UNTIL CHOSTSTATE IS BUILD AGNOSTIC! // #if defined (DEDICATED) || defined (GAMEDLL_S3) @@ -251,9 +251,9 @@ void Systems_Shutdown() IConVar_Detach(); CKeyValueSystem_Detach(); -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL IVEngineServer_Detach(); -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL SQAPI_Detach(); SQVM_Detach(); @@ -270,10 +270,10 @@ void Systems_Shutdown() //DebugOverlays_Detach(); #endif // !DEDICATED -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL CAI_Utility_Detach(); CAI_NetworkManager_Detach(); -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL // Commit the transaction DetourTransactionCommit(); diff --git a/r5dev/engine/host_state.cpp b/r5dev/engine/host_state.cpp index 95149cb0..ce96da79 100644 --- a/r5dev/engine/host_state.cpp +++ b/r5dev/engine/host_state.cpp @@ -23,9 +23,9 @@ #include "engine/sys_engine.h" #include "engine/sys_utils.h" #include "engine/cmodel_bsp.h" -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL #include "engine/baseserver.h" -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL #include "rtech/rtech_game.h" #ifndef DEDICATED #include "vgui/vgui_baseui_interface.h" @@ -34,9 +34,9 @@ #include "networksystem/pylon.h" #include "public/include/bansystem.h" #include "public/include/edict.h" -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL #include "game/server/gameinterface.h" -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL bool g_bLevelResourceInitialized = false; //----------------------------------------------------------------------------- @@ -66,9 +66,9 @@ FORCEINLINE void CHostState::FrameUpdate(void* rcx, void* rdx, float time) } else { -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL *g_ServerAbortServer = true; -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL do { Cbuf_Execute(); @@ -257,9 +257,9 @@ FORCEINLINE void CHostState::GameShutDown(void) g_bLevelResourceInitialized = false; if (m_bActiveGame) { -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL g_pServerGameDLL->GameShutdown(); -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL m_bActiveGame = 0; #ifdef DEDICATED const char* szNoMap = "server_idle"; @@ -356,9 +356,9 @@ FORCEINLINE void CHostState::State_ChangeLevelMP(void) m_flShortFrameTime = 0.5; // Set frame time. g_bLevelResourceInitialized = false; -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL g_pServerGameDLL->LevelShutdown(); -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL if (CModelLoader_Map_IsValidFn(g_CModelLoader, m_levelName)) // Check if map is valid and if we can start a new game. { #ifndef DEDICATED diff --git a/r5dev/engine/net_chan.cpp b/r5dev/engine/net_chan.cpp index 7f9630b8..2bacf31e 100644 --- a/r5dev/engine/net_chan.cpp +++ b/r5dev/engine/net_chan.cpp @@ -11,9 +11,9 @@ #include "mathlib/color.h" #include "engine/sys_utils.h" #include "engine/net_chan.h" -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL #include "engine/baseclient.h" -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL #ifdef DEDICATED #include "engine/sv_rcon.h" #else // DEDICATED @@ -134,7 +134,7 @@ void HNET_PrintFunc(const char* fmt, ...) //----------------------------------------------------------------------------- void NET_DisconnectClient(CBaseClient* pClient, int nIndex, const char* szReason, uint8_t unk1, char unk2) { -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL if (!pClient) // Client valid? { return; @@ -154,7 +154,7 @@ void NET_DisconnectClient(CBaseClient* pClient, int nIndex, const char* szReason pClient->SetNetChan(nullptr); // Null netchan. CBaseClient_Clear(pClient); // Reset CClient instance for client. g_bIsPersistenceVarSet[nIndex] = false; // Reset Persistence var. -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL } /////////////////////////////////////////////////////////////////////////////// diff --git a/r5dev/gameui/IBrowser.cpp b/r5dev/gameui/IBrowser.cpp index dc901915..a171ec13 100644 --- a/r5dev/gameui/IBrowser.cpp +++ b/r5dev/gameui/IBrowser.cpp @@ -60,7 +60,7 @@ IBrowser::IBrowser(void) m_vszMapFileNameList.push_back(filename); } -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL static std::thread hostingServerRequestThread([this]() { while (true) @@ -71,7 +71,7 @@ IBrowser::IBrowser(void) }); hostingServerRequestThread.detach(); -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL /* Obtain handle to module */ static HGLOBAL rcData = NULL; @@ -159,12 +159,12 @@ void IBrowser::CompMenu(void) { SetSection(eSection::SERVER_BROWSER); } -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL if (ImGui::TabItemButton("Host Server")) { SetSection(eSection::HOST_SERVER); } -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL if (ImGui::TabItemButton("Settings")) { SetSection(eSection::SETTINGS); @@ -335,7 +335,7 @@ void IBrowser::ConnectToServer(const std::string& svServer, const std::string& s //----------------------------------------------------------------------------- void IBrowser::LaunchServer(void) { -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL DevMsg(eDLL_T::ENGINE, "Starting Server with name '%s', map '%s' and playlist '%s'\n", m_Server.svServerName.c_str(), m_Server.svMapName.c_str(), m_Server.svPlaylist.c_str()); /* @@ -353,7 +353,7 @@ void IBrowser::LaunchServer(void) std::stringstream cmd; cmd << "map " << m_Server.svMapName; ProcessCommand(cmd.str().c_str()); -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL } //----------------------------------------------------------------------------- @@ -426,7 +426,7 @@ void IBrowser::HiddenServersModal(void) //----------------------------------------------------------------------------- void IBrowser::HostServerSection(void) { -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL static std::string svServerNameErr = ""; ImGui::InputTextWithHint("##ServerHost_ServerName", "Server Name (Required)", &m_Server.svServerName); @@ -577,7 +577,7 @@ void IBrowser::HostServerSection(void) CKeyValueSystem_InitPlaylist(); // Re-Init playlist. } } -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL } //----------------------------------------------------------------------------- @@ -585,7 +585,7 @@ void IBrowser::HostServerSection(void) //----------------------------------------------------------------------------- void IBrowser::UpdateHostingStatus(void) { -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL if (!g_pHostState || !g_pCVar) { return; @@ -631,7 +631,7 @@ void IBrowser::UpdateHostingStatus(void) default: break; } -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL } //----------------------------------------------------------------------------- @@ -639,7 +639,7 @@ void IBrowser::UpdateHostingStatus(void) //----------------------------------------------------------------------------- void IBrowser::SendHostingPostRequest(void) { -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL static ConVar* hostport = g_pCVar->FindVar("hostport"); static ConVar* mp_gamemode = g_pCVar->FindVar("mp_gamemode"); @@ -676,7 +676,7 @@ void IBrowser::SendHostingPostRequest(void) { m_iv4HostRequestMessageColor = ImVec4(1.00f, 0.00f, 0.00f, 1.00f); } -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL } //----------------------------------------------------------------------------- diff --git a/r5dev/public/include/edict.h b/r5dev/public/include/edict.h index 46f22595..fccf9e08 100644 --- a/r5dev/public/include/edict.h +++ b/r5dev/public/include/edict.h @@ -3,9 +3,9 @@ #include "launcher/IApplication.h" #endif // !DEDICATED #include "public/include/globalvars_base.h" -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL #include "engine/sv_main.h" -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL //----------------------------------------------------------------------------- @@ -40,9 +40,9 @@ public: namespace { -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL CGlobalVars* g_ServerGlobalVariables = p_SV_InitGameDLL.Offset(0x0).FindPatternSelf("48 8D ?? ?? ?? ?? 01", ADDRESS::Direction::DOWN).ResolveRelativeAddressSelf(0x3, 0x7).RCast(); -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL #ifndef DEDICATED CGlobalVarsBase* g_ClientGlobalVariables = p_CModAppSystemGroup_Create.Offset(0x0).FindPatternSelf("4C 8D ?? ?? ?? ?? 01", ADDRESS::Direction::DOWN, 8000).ResolveRelativeAddressSelf(0x3, 0x7).RCast(); #endif // !DEDICATED @@ -53,9 +53,9 @@ class HEdict : public IDetour { virtual void debugp() { -#ifndef GAMECLIENTONLY +#ifndef CLIENT_DLL std::cout << "| VAR: g_ServerGlobalVariables : 0x" << std::hex << std::uppercase << g_ServerGlobalVariables << std::setw(0) << " |" << std::endl; -#endif // !GAMECLIENTONLY +#endif // !CLIENT_DLL #ifndef DEDICATED std::cout << "| VAR: g_ClientGlobalVariables : 0x" << std::hex << std::uppercase << g_ClientGlobalVariables << std::setw(0) << " |" << std::endl; #endif // !DEDICATED diff --git a/r5dev/vproj/clientsdk.vcxproj b/r5dev/vproj/clientsdk.vcxproj index fdb130c9..16b7cdf8 100644 --- a/r5dev/vproj/clientsdk.vcxproj +++ b/r5dev/vproj/clientsdk.vcxproj @@ -420,7 +420,7 @@ stdcpp17 stdc17 - /D GAMESDK /D GAMECLIENTONLY /D _CRT_SECURE_NO_WARNINGS %(AdditionalOptions) + /D GAMESDK /D CLIENT_DLL /D _CRT_SECURE_NO_WARNINGS %(AdditionalOptions) Windows @@ -460,7 +460,7 @@ true - /D GAMESDK /D GAMECLIENTONLY /D _CRT_SECURE_NO_WARNINGS %(AdditionalOptions) + /D GAMESDK /D CLIENT_DLL /D _CRT_SECURE_NO_WARNINGS %(AdditionalOptions) Windows