Implement patch to enable 'DrawAllOverlays()'.

This commit is contained in:
Amos 2021-12-30 02:36:43 +01:00
parent 83129e88f8
commit 39a8a8fd30
5 changed files with 53 additions and 0 deletions

View File

@ -35,6 +35,9 @@
#include "rtech/rtech_game.h"
#include "rtech/stryder.h"
#include "engine/baseclient.h"
#ifndef DEDICATED
#include "engine/debugoverlay.h"
#endif // !DEDICATED
#include "engine/host_cmd.h"
#include "engine/host_state.h"
#include "engine/net_chan.h"
@ -77,6 +80,7 @@ void Systems_Init()
CEngineVGui_Attach();
CFPSPanel_Attach();
CHLClient_Attach();
DebugOverlays_Init();
#endif // !DEDICATED
CServer_Attach();

View File

@ -0,0 +1,15 @@
#include "core/stdafx.h"
#include "tier0/basetypes.h"
#include "engine/debugoverlay.h"
//-----------------------------------------------------------------------------
// Purpose: enables 'DrawAllOverlays()'
//-----------------------------------------------------------------------------
void DebugOverlays_Init()
{
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
p_DrawAllOverlays.Offset(0x189).Patch({ 0x83, 0x3F, 0x02 }); // Default value in memory is 0x2, condition is 0x4. Patch to fullfill condition.
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
p_DrawAllOverlays.Offset(0x188).Patch({ 0x83, 0x3F, 0x02 }); // Default value in memory is 0x2, condition is 0x4. Patch to fullfill condition.
#endif
}

View File

@ -0,0 +1,26 @@
#pragma once
namespace
{
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
ADDRESS p_DrawAllOverlays = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x40\x55\x48\x83\xEC\x50\x48\x8B\x05\x00\x00\x00\x00", "xxxxxxxxx????");
void (*DrawAllOverlays)(char a1) = (void (*)(char))p_DrawAllOverlays.GetPtr(); /*40 55 48 83 EC 50 48 8B 05 ? ? ? ?*/
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
ADDRESS p_DrawAllOverlays = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x40\x55\x48\x83\xEC\x30\x48\x8B\x05\x00\x00\x00\x00\x0F\xB6\xE9", "xxxxxxxxx????xxx");
void (*DrawAllOverlays)(char a1) = (void (*)(char))p_DrawAllOverlays.GetPtr(); /*40 55 48 83 EC 30 48 8B 05 ? ? ? ? 0F B6 E9*/
#endif
}
///////////////////////////////////////////////////////////////////////////////
class HDebugOverlay : public IDetour
{
virtual void debugp()
{
std::cout << "| FUN: DrawAllOverlays : 0x" << std::hex << std::uppercase << p_DrawAllOverlays.GetPtr() << std::setw(npad) << " |" << std::endl;
std::cout << "+----------------------------------------------------------------+" << std::endl;
}
};
///////////////////////////////////////////////////////////////////////////////
void DebugOverlays_Init();
REGISTER(HDebugOverlay);

View File

@ -33,6 +33,7 @@
<ClCompile Include="ebisusdk\EbisuSDK.cpp" />
<ClCompile Include="engine\baseclient.cpp" />
<ClCompile Include="engine\baseclientstate.cpp" />
<ClCompile Include="engine\debugoverlay.cpp" />
<ClCompile Include="engine\host_cmd.cpp" />
<ClCompile Include="engine\host_state.cpp" />
<ClCompile Include="engine\net_chan.cpp" />
@ -125,6 +126,7 @@
<ClInclude Include="ebisusdk\EbisuSDK.h" />
<ClInclude Include="engine\baseclient.h" />
<ClInclude Include="engine\baseclientstate.h" />
<ClInclude Include="engine\debugoverlay.h" />
<ClInclude Include="engine\host_cmd.h" />
<ClInclude Include="engine\host_state.h" />
<ClInclude Include="engine\net_chan.h" />

View File

@ -303,6 +303,9 @@
<ClCompile Include="engine\host_cmd.cpp">
<Filter>sdk\engine</Filter>
</ClCompile>
<ClCompile Include="engine\debugoverlay.cpp">
<Filter>sdk\engine</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="client\cdll_engine_int.h">
@ -839,6 +842,9 @@
<ClInclude Include="engine\host_cmd.h">
<Filter>sdk\engine</Filter>
</ClInclude>
<ClInclude Include="engine\debugoverlay.h">
<Filter>sdk\engine</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="r5dev.def" />