From b3ed5d4052785ac50c01da2ee57961bb2b475171 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Thu, 21 Jul 2022 15:13:48 +0200 Subject: [PATCH] Fix client.dll compile errors Stripped more server only stuff from client.dll. --- r5dev/common/opcodes.cpp | 6 ++++++ r5dev/engine/host_state.cpp | 5 ++++- r5dev/engine/net_chan.cpp | 5 +---- r5dev/sdklauncher/sdklauncher.cpp | 8 ++++---- r5dev/tier1/cmd.cpp | 2 ++ r5dev/vproj/clientsdk.vcxproj | 6 ++---- r5dev/vproj/clientsdk.vcxproj.filters | 6 ------ r5dev/vstdlib/callback.cpp | 6 ++++-- r5dev/vstdlib/callback.h | 2 ++ 9 files changed, 25 insertions(+), 21 deletions(-) diff --git a/r5dev/common/opcodes.cpp b/r5dev/common/opcodes.cpp index 6ce6f8f5..d8445532 100644 --- a/r5dev/common/opcodes.cpp +++ b/r5dev/common/opcodes.cpp @@ -17,8 +17,10 @@ #include "engine/client/client.h" #include "engine/client/clientstate.h" #include "engine/sys_getmodes.h" +#ifndef CLIENT_DLL #include "game/server/ai_networkmanager.h" #include "game/server/fairfight_impl.h" +#endif // !CLIENT_DLL #include "rtech/rtech_game.h" #include "rtech/rui/rui.h" #include "client/cdll_engine_int.h" @@ -356,7 +358,9 @@ void RuntimePtc_Init() /* .TEXT */ { #ifndef DEDICATED p_WASAPI_GetAudioDevice.Offset(0x410).FindPatternSelf("FF 15 ?? ?? 01 00", CMemory::Direction::DOWN, 100).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0xEB }); // CAL --> NOP | Disable debugger check when miles searches for audio device to allow attaching the debugger to the game upon launch. +#ifndef CLIENT_DLL FairFight_Init.Offset(0x0).FindPatternSelf("0F 87", CMemory::Direction::DOWN, 200).Patch({ 0x0F, 0x85 }); // JA --> JNZ | Prevent 'FairFight' anti-cheat from initializing on the server by comparing RAX against 0x0 instead. Init will crash since the plugins aren't shipped. +#endif // !CLIENT_DLL SCR_BeginLoadingPlaque.Offset(0x1AD).FindPatternSelf("75 27", CMemory::Direction::DOWN).Patch({ 0xEB, 0x27 }); // JNE --> JMP | Prevent connect command from crashing by invalid call to UI function. p_SQVM_CompileError.Offset(0x0).FindPatternSelf("41 B0 01", CMemory::Direction::DOWN, 400).Patch({ 0x41, 0xB0, 0x00 }); // MOV --> MOV | Set script error level to 0 (not severe): 'mov r8b, 0'. p_SQVM_CompileError.Offset(0xE0).FindPatternSelf("E8", CMemory::Direction::DOWN, 200).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | TODO: causes errors on client script error. Research required (same function as soft error but that one doesn't crash). @@ -365,8 +369,10 @@ void RuntimePtc_Init() /* .TEXT */ #endif // !DEDICATED #if defined (GAMEDLL_S2) || defined (GAMEDLL_S3) +#ifndef CLIENT_DLL p_CAI_NetworkManager__ShouldRebuild.Offset(0xA0).FindPatternSelf("FF ?? ?? ?? 00 00", CMemory::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", CMemory::Direction::DOWN, 600).Patch({ 0xEB }); // JE --> JMP | Do while loop setting fields to -1 in navmesh is writing out of bounds (!TODO). +#endif // !CLIENT_DLL #endif #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. diff --git a/r5dev/engine/host_state.cpp b/r5dev/engine/host_state.cpp index fd5e6299..19a31073 100644 --- a/r5dev/engine/host_state.cpp +++ b/r5dev/engine/host_state.cpp @@ -210,19 +210,22 @@ FORCEINLINE void CHostState::Think(void) const { if (!bInitialized) // Initialize clocks. { +#ifndef CLIENT_DLL banListTimer.Start(); #ifdef DEDICATED pylonTimer.Start(); #endif // DEDICATED statsTimer.Start(); +#endif // !CLIENT_DLL bInitialized = true; } - +#ifndef CLIENT_DLL if (banListTimer.GetDurationInProgress().GetSeconds() > sv_banlistRefreshInterval->GetDouble()) { g_pBanSystem->BanListCheck(); banListTimer.Start(); } +#endif // !CLIENT_DLL #ifdef DEDICATED if (pylonTimer.GetDurationInProgress().GetSeconds() > sv_pylonRefreshInterval->GetDouble()) { diff --git a/r5dev/engine/net_chan.cpp b/r5dev/engine/net_chan.cpp index 9c94a86b..f034598e 100644 --- a/r5dev/engine/net_chan.cpp +++ b/r5dev/engine/net_chan.cpp @@ -29,10 +29,7 @@ string CNetChan::GetAddress(void) const char szAdr[INET6_ADDRSTRLEN]{}; if (!inet_ntop(AF_INET6, &this->remote_address.adr, szAdr, INET6_ADDRSTRLEN)) { - if (sv_showconnecting->GetBool()) - { - Warning(eDLL_T::ENGINE, "%s - Address conversion failed: %s", __FUNCTION__, NET_ErrorString(WSAGetLastError())); - } + Warning(eDLL_T::ENGINE, "%s - Address conversion failed: %s", __FUNCTION__, NET_ErrorString(WSAGetLastError())); } return szAdr; } diff --git a/r5dev/sdklauncher/sdklauncher.cpp b/r5dev/sdklauncher/sdklauncher.cpp index 2378bddb..840e49f1 100644 --- a/r5dev/sdklauncher/sdklauncher.cpp +++ b/r5dev/sdklauncher/sdklauncher.cpp @@ -398,7 +398,7 @@ bool CLauncher::Setup(eLaunchMode lMode, eLaunchState lState) return false; } - m_svWorkerDll = m_svCurrentDir + "\\bin\\client.dll"; + m_svWorkerDll = m_svCurrentDir + "\\bin\\x64_retail\\client.dll"; m_svGameExe = m_svCurrentDir + "\\r5apex.exe"; m_svCmdLine = m_svCurrentDir + "\\r5apex.exe " + svCmdLineArgs; @@ -421,7 +421,7 @@ bool CLauncher::Setup(eLaunchMode lMode, eLaunchState lState) return false; } - m_svWorkerDll = m_svCurrentDir + "\\bin\\client.dll"; + m_svWorkerDll = m_svCurrentDir + "\\bin\\x64_retail\\client.dll"; m_svGameExe = m_svCurrentDir + "\\r5apex.exe"; m_svCmdLine = m_svCurrentDir + "\\r5apex.exe " + svCmdLineArgs; @@ -498,7 +498,7 @@ bool CLauncher::Setup(eLaunchMode lMode, const string& svCommandLine) } case eLaunchMode::LM_CLIENT_DEBUG: { - m_svWorkerDll = m_svCurrentDir + "\\bin\\client.dll"; + m_svWorkerDll = m_svCurrentDir + "\\bin\\x64_retail\\client.dll"; m_svGameExe = m_svCurrentDir + "\\r5apex.exe"; m_svCmdLine = m_svCurrentDir + "\\r5apex.exe " + svCommandLine; @@ -507,7 +507,7 @@ bool CLauncher::Setup(eLaunchMode lMode, const string& svCommandLine) } case eLaunchMode::LM_CLIENT: { - m_svWorkerDll = m_svCurrentDir + "\\bin\\client.dll"; + m_svWorkerDll = m_svCurrentDir + "\\bin\\x64_retail\\client.dll"; m_svGameExe = m_svCurrentDir + "\\r5apex.exe"; m_svCmdLine = m_svCurrentDir + "\\r5apex.exe " + svCommandLine; diff --git a/r5dev/tier1/cmd.cpp b/r5dev/tier1/cmd.cpp index 48021ed3..26828c73 100644 --- a/r5dev/tier1/cmd.cpp +++ b/r5dev/tier1/cmd.cpp @@ -133,6 +133,7 @@ void ConCommand::Init(void) #endif //!DEDICATED //------------------------------------------------------------------------- // SERVER DLL | +#ifndef CLIENT_DLL new ConCommand("script", "Run input code as SERVER script on the VM.", FCVAR_GAMEDLL | FCVAR_CHEAT, SQVM_ServerScript_f, nullptr); new ConCommand("sv_kick", "Kick a client from the server by name. | Usage: kick \"\".", FCVAR_RELEASE, Host_Kick_f, nullptr); new ConCommand("sv_kickid", "Kick a client from the server by UserID or OriginID | Usage: kickid \"\"/\"\".", FCVAR_RELEASE, Host_KickID_f, nullptr); @@ -140,6 +141,7 @@ void ConCommand::Init(void) new ConCommand("sv_banid", "Bans a client from the server by UserID, OriginID or IPAddress | Usage: banid \"\"/\"/\".", FCVAR_RELEASE, Host_BanID_f, nullptr); new ConCommand("sv_unban", "Unbans a client from the server by OriginID or IPAddress | Usage: unban \"\"/\"\".", FCVAR_RELEASE, Host_Unban_f, nullptr); new ConCommand("sv_reloadbanlist", "Reloads the ban list from the disk.", FCVAR_RELEASE, Host_ReloadBanList_f, nullptr); +#endif // !CLIENT_DLL #ifndef DEDICATED //------------------------------------------------------------------------- // CLIENT DLL | diff --git a/r5dev/vproj/clientsdk.vcxproj b/r5dev/vproj/clientsdk.vcxproj index 38b39072..8dfb0bdd 100644 --- a/r5dev/vproj/clientsdk.vcxproj +++ b/r5dev/vproj/clientsdk.vcxproj @@ -83,7 +83,6 @@ NotUsing NotUsing - @@ -241,7 +240,6 @@ - @@ -578,7 +576,7 @@ $(SolutionDir)lib\$(Configuration)\ - IF EXIST "$(SolutionDir)..\..\r5apex.exe" del "$(SolutionDir)..\..\client.dll" && copy /Y "$(TargetPath)" "$(SolutionDir)..\..\ + IF EXIST "$(SolutionDir)..\..\r5apex.exe" del "$(SolutionDir)..\..\bin\x64_retail\client.dll" && copy /Y "$(TargetPath)" "$(SolutionDir)..\..\bin\x64_retail\ @@ -621,7 +619,7 @@ true - IF EXIST "$(SolutionDir)..\..\r5apex.exe" del "$(SolutionDir)..\..\client.dll" && copy /Y "$(TargetPath)" "$(SolutionDir)..\..\ + IF EXIST "$(SolutionDir)..\..\r5apex.exe" del "$(SolutionDir)..\..\bin\x64_retail\client.dll" && copy /Y "$(TargetPath)" "$(SolutionDir)..\..\bin\x64_retail\ diff --git a/r5dev/vproj/clientsdk.vcxproj.filters b/r5dev/vproj/clientsdk.vcxproj.filters index f9459dfe..b32d81aa 100644 --- a/r5dev/vproj/clientsdk.vcxproj.filters +++ b/r5dev/vproj/clientsdk.vcxproj.filters @@ -243,9 +243,6 @@ sdk\gameui - - sdk\public - sdk\public @@ -593,9 +590,6 @@ sdk\gameui - - sdk\public\include - sdk\public\include diff --git a/r5dev/vstdlib/callback.cpp b/r5dev/vstdlib/callback.cpp index b8b26b5a..12477fe8 100644 --- a/r5dev/vstdlib/callback.cpp +++ b/r5dev/vstdlib/callback.cpp @@ -24,7 +24,9 @@ #include "gameui/IBrowser.h" #include "gameui/IConsole.h" #endif // !DEDICATED +#ifndef CLIENT_DLL #include "public/include/bansystem.h" +#endif // !CLIENT_DLL #include "mathlib/crc32.h" #include "vstdlib/completion.h" #include "vstdlib/callback.h" @@ -103,7 +105,7 @@ void Host_Kick_f(const CCommand& args) NET_DisconnectClient(pClient, i, "Kicked from server", 0, 1); } } - +#ifndef CLIENT_DLL /* ===================== Host_KickID_f @@ -325,7 +327,7 @@ void Host_ReloadBanList_f(const CCommand& args) { g_pBanSystem->Load(); // Reload banlist. } - +#endif // !CLIENT_DLL /* ===================== Pak_ListPaks_f diff --git a/r5dev/vstdlib/callback.h b/r5dev/vstdlib/callback.h index 9e91f39c..6df2098b 100644 --- a/r5dev/vstdlib/callback.h +++ b/r5dev/vstdlib/callback.h @@ -17,12 +17,14 @@ bool MP_GameMode_Changed_f(ConVar* pVTable); void GameConsole_Invoke_f(const CCommand& args); void ServerBrowser_Invoke_f(const CCommand& args); #endif // !DEDICATED +#ifndef CLIENT_DLL void Host_Kick_f(const CCommand& args); void Host_KickID_f(const CCommand& args); void Host_Ban_f(const CCommand& args); void Host_BanID_f(const CCommand& args); void Host_Unban_f(const CCommand& args); void Host_ReloadBanList_f(const CCommand& args); +#endif // !CLIENT_DLL void Pak_ListPaks_f(const CCommand& args); void Pak_RequestUnload_f(const CCommand& args); void Pak_RequestLoad_f(const CCommand& args);