diff --git a/r5dev/core/init.cpp b/r5dev/core/init.cpp index fe4f928b..34091b0a 100644 --- a/r5dev/core/init.cpp +++ b/r5dev/core/init.cpp @@ -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(); diff --git a/r5dev/engine/debugoverlay.cpp b/r5dev/engine/debugoverlay.cpp new file mode 100644 index 00000000..a009275a --- /dev/null +++ b/r5dev/engine/debugoverlay.cpp @@ -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 +} diff --git a/r5dev/engine/debugoverlay.h b/r5dev/engine/debugoverlay.h new file mode 100644 index 00000000..ffce292f --- /dev/null +++ b/r5dev/engine/debugoverlay.h @@ -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); diff --git a/r5dev/r5dev.vcxproj b/r5dev/r5dev.vcxproj index 58d193dd..5962ff77 100644 --- a/r5dev/r5dev.vcxproj +++ b/r5dev/r5dev.vcxproj @@ -33,6 +33,7 @@ + @@ -125,6 +126,7 @@ + diff --git a/r5dev/r5dev.vcxproj.filters b/r5dev/r5dev.vcxproj.filters index 78e557f1..9200efb0 100644 --- a/r5dev/r5dev.vcxproj.filters +++ b/r5dev/r5dev.vcxproj.filters @@ -303,6 +303,9 @@ sdk\engine + + sdk\engine + @@ -839,6 +842,9 @@ sdk\engine + + sdk\engine +