Fix client.dll compile errors

Stripped more server only stuff from client.dll.
This commit is contained in:
Kawe Mazidjatari 2022-07-21 15:13:48 +02:00
parent 9758f988ec
commit b3ed5d4052
9 changed files with 25 additions and 21 deletions

View File

@ -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.

View File

@ -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())
{

View File

@ -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;
}

View File

@ -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;

View File

@ -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 \"<name>\".", FCVAR_RELEASE, Host_Kick_f, nullptr);
new ConCommand("sv_kickid", "Kick a client from the server by UserID or OriginID | Usage: kickid \"<UserID>\"/\"<OriginID>\".", 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 \"<UserID>\"/\"<OriginID>/<IPAddress>\".", FCVAR_RELEASE, Host_BanID_f, nullptr);
new ConCommand("sv_unban", "Unbans a client from the server by OriginID or IPAddress | Usage: unban \"<OriginID>\"/\"<IPAddress>\".", 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 |

View File

@ -83,7 +83,6 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\public\bansystem.cpp" />
<ClCompile Include="..\public\binstream.cpp" />
<ClCompile Include="..\public\memaddr.cpp" />
<ClCompile Include="..\public\module.cpp" />
@ -241,7 +240,6 @@
<ClInclude Include="..\public\include\inetmsghandler.h" />
<ClInclude Include="..\public\include\ivrenderview.h" />
<ClInclude Include="..\public\include\memaddr.h" />
<ClInclude Include="..\public\include\bansystem.h" />
<ClInclude Include="..\public\include\binstream.h" />
<ClInclude Include="..\public\include\httplib.h" />
<ClInclude Include="..\public\include\model_types.h" />
@ -578,7 +576,7 @@
<AdditionalLibraryDirectories>$(SolutionDir)lib\$(Configuration)\</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>IF EXIST "$(SolutionDir)..\..\r5apex.exe" del "$(SolutionDir)..\..\client.dll" &amp;&amp; copy /Y "$(TargetPath)" "$(SolutionDir)..\..\</Command>
<Command>IF EXIST "$(SolutionDir)..\..\r5apex.exe" del "$(SolutionDir)..\..\bin\x64_retail\client.dll" &amp;&amp; copy /Y "$(TargetPath)" "$(SolutionDir)..\..\bin\x64_retail\</Command>
</PostBuildEvent>
<PreBuildEvent>
<Command>
@ -621,7 +619,7 @@
<SetChecksum>true</SetChecksum>
</Link>
<PostBuildEvent>
<Command>IF EXIST "$(SolutionDir)..\..\r5apex.exe" del "$(SolutionDir)..\..\client.dll" &amp;&amp; copy /Y "$(TargetPath)" "$(SolutionDir)..\..\</Command>
<Command>IF EXIST "$(SolutionDir)..\..\r5apex.exe" del "$(SolutionDir)..\..\bin\x64_retail\client.dll" &amp;&amp; copy /Y "$(TargetPath)" "$(SolutionDir)..\..\bin\x64_retail\</Command>
</PostBuildEvent>
<PreBuildEvent>
<Command>

View File

@ -243,9 +243,6 @@
<ClCompile Include="..\gameui\IConsole.cpp">
<Filter>sdk\gameui</Filter>
</ClCompile>
<ClCompile Include="..\public\bansystem.cpp">
<Filter>sdk\public</Filter>
</ClCompile>
<ClCompile Include="..\public\utility.cpp">
<Filter>sdk\public</Filter>
</ClCompile>
@ -593,9 +590,6 @@
<ClInclude Include="..\gameui\IConsole.h">
<Filter>sdk\gameui</Filter>
</ClInclude>
<ClInclude Include="..\public\include\bansystem.h">
<Filter>sdk\public\include</Filter>
</ClInclude>
<ClInclude Include="..\public\include\httplib.h">
<Filter>sdk\public\include</Filter>
</ClInclude>

View File

@ -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

View File

@ -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);