r5sdk/r5dev/engine/sys_getmodes.h
Kawe Mazidjatari e32cc6ae6a Code overhaul
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)
2022-04-18 03:35:08 +02:00

44 lines
2.8 KiB
C++

#pragma once
//-------------------------------------------------------------------------
// CGAME
//-------------------------------------------------------------------------
inline CMemory p_CVideoMode_Common__CreateGameWindow;
inline auto CVideoMode_Common__CreateGameWindow = p_CVideoMode_Common__CreateGameWindow.RCast<bool (*)(int* pnRect)>();
inline CMemory p_CVideoMode_Common__CreateWindowClass;
inline auto CVideoMode_Common__CreateWindowClass = p_CVideoMode_Common__CreateWindowClass.RCast<HWND(*)(vrect_t* pnRect)>();
void HCVideoMode_Common_Attach();
void HCVideoMode_Common_Detach();
///////////////////////////////////////////////////////////////////////////////
class HVideoMode_Common : public IDetour
{
virtual void GetAdr(void) const
{
std::cout << "| FUN: CVideoMode_Common::CreateGameWindow : 0x" << std::hex << std::uppercase << p_CVideoMode_Common__CreateGameWindow.GetPtr() << std::setw(nPad) << " |" << std::endl;
std::cout << "| FUN: CVideoMode_Common::CreateWindowClass : 0x" << std::hex << std::uppercase << p_CVideoMode_Common__CreateWindowClass.GetPtr() << std::setw(nPad) << " |" << std::endl;
std::cout << "+----------------------------------------------------------------+" << std::endl;
}
virtual void GetFun(void) const
{
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
p_CVideoMode_Common__CreateGameWindow = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x40\x56\x57\x48\x83\xEC\x38\x48\x8B\xF9\xE8\x00\x00\x00\x00"), "xxxxxxxxxxx????");
p_CVideoMode_Common__CreateWindowClass = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x40\x55\x53\x57\x41\x56\x48\x8D\xAC\x24\x00\x00\x00\x00\x48\x81\xEC\x00\x00\x00\x00\x4C\x8B\xF1"), "xxxxxxxxxx????xxx????xxx");
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
p_CVideoMode_Common__CreateGameWindow = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x40\x56\x57\x48\x83\xEC\x28\x48\x8B\xF9\xE8\x00\x00\x00\x00\x48\x8B\xF0"), "xxxxxxxxxxx????xxx");
p_CVideoMode_Common__CreateWindowClass = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x40\x55\x53\x57\x48\x8D\xAC\x24\x00\x00\x00\x00\x48\x81\xEC\x00\x00\x00\x00\x48\x8B\xF9\xFF\x15\x00\x00\x00\x00"), "xxxxxxxx????xxx????xxxxx????");
#endif
CVideoMode_Common__CreateGameWindow = p_CVideoMode_Common__CreateGameWindow.RCast<bool (*)(int*)>(); /*40 56 57 48 83 EC 28 48 8B F9 E8 ?? ?? ?? ?? 48 8B F0*/
CVideoMode_Common__CreateWindowClass = p_CVideoMode_Common__CreateWindowClass.RCast<HWND(*)(vrect_t*)>(); /*40 55 53 57 48 8D AC 24 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? 48 8B F9 FF 15 ?? ?? ?? ??*/
}
virtual void GetVar(void) const { }
virtual void GetCon(void) const { }
virtual void Attach(void) const { }
virtual void Detach(void) const { }
};
///////////////////////////////////////////////////////////////////////////////
REGISTER(HVideoMode_Common);