mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Moved every pattern to IDetour interface. This allows for debugging patterns scans more easily, and create threads during pattern searching (Operation is now fired in APIENTRY). Also cleaned up some unused code/extraneous comments. Slightly increased performance by purging duplicate patterns. Made variable search less dependent from other results (except if pattern-to-scan results is within the same header)
40 lines
2.0 KiB
C++
40 lines
2.0 KiB
C++
#pragma once
|
|
#include "engine/common.h"
|
|
|
|
/* ==== UTILITY ========================================================================================================================================================= */
|
|
inline CMemory p_Sys_Error_Internal;
|
|
inline auto Sys_Error_Internal = p_Sys_Error_Internal.RCast<int (*)(char* fmt, va_list args)>();
|
|
|
|
inline bool* gfExtendedError = nullptr;
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
int HSys_Error_Internal(char* fmt, va_list args);
|
|
|
|
void SysDll_Attach();
|
|
void SysDll_Detach();
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
class HSys_Dll : public IDetour
|
|
{
|
|
virtual void GetAdr(void) const
|
|
{
|
|
std::cout << "| FUN: Sys_Error_Internal : 0x" << std::hex << std::uppercase << p_Sys_Error_Internal.GetPtr() << std::setw(nPad) << " |" << std::endl;
|
|
std::cout << "| VAR: gfExtendedError : 0x" << std::hex << std::uppercase << gfExtendedError << std::setw(0) << " |" << std::endl;
|
|
std::cout << "+----------------------------------------------------------------+" << std::endl;
|
|
}
|
|
virtual void GetFun(void) const
|
|
{
|
|
p_Sys_Error_Internal = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x89\x5C\x24\x08\x48\x89\x74\x24\x10\x57\x48\x81\xEC\x30\x08\x00\x00\x48\x8B\xDA\x48\x8B\xF9\xE8\x00\x00\x00\xFF\x33\xF6\x48"), "xxxxxxxxxxxxxxxxxxxxxxxxx???xxxx");
|
|
Sys_Error_Internal = p_Sys_Error_Internal.RCast<int (*)(char*, va_list)>(); /*48 89 5C 24 08 48 89 74 24 10 57 48 81 EC 30 08 00 00 48 8B DA 48 8B F9 E8 ?? ?? ?? FF 33 F6 48*/
|
|
}
|
|
virtual void GetVar(void) const
|
|
{
|
|
gfExtendedError = p_COM_ExplainDisconnection.Offset(0x0).FindPatternSelf("C6 05", CMemory::Direction::DOWN, 300).ResolveRelativeAddressSelf(0x2, 0x7).RCast<bool*>();
|
|
}
|
|
virtual void GetCon(void) const { }
|
|
virtual void Attach(void) const { }
|
|
virtual void Detach(void) const { }
|
|
};
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
REGISTER(HSys_Dll); |