mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
This change was planned for a long time. This moves all REGISTER calls to a single translation unit, this is required as we currently added a very dirty workaround for not registering duplicates by checking if VFTable pointer was already present in the vector... Registering from single translation unit prevents duplicate instances that gets created if header is included by more cpp files. Reworking this reduced 100kb+ of compiled code. This commit also reworked the way functions/variables/constant gets logged with their addresses; the new code formats them on the fly, and allows for resize at any time. Formatting is no longer required by programmer. TODO: currently there are some compile errors for dedicated and client dll's. These will be resolved very soon as they need to be properly worked out still (server & client only stuff needs to be properly split). Use the 'main' (stable) branch for the time being if you need to compile these dll's.
39 lines
2.2 KiB
C++
39 lines
2.2 KiB
C++
#pragma once
|
|
|
|
/* ==== RUI ====================================================================================================================================================== */
|
|
inline CMemory p_Rui_Draw;
|
|
inline auto v_Rui_Draw = p_Rui_Draw.RCast<bool(*)(__int64* a1, __m128* a2, const __m128i* a3, __int64 a4, __m128* a5)>();
|
|
|
|
inline CMemory p_Rui_LoadAsset;
|
|
inline auto v_Rui_LoadAsset = p_Rui_LoadAsset.RCast<void* (*)(const char* szRuiAssetName)>();
|
|
|
|
inline CMemory p_Rui_GetFontFace;
|
|
inline auto v_Rui_GetFontFace = p_Rui_GetFontFace.RCast<int16_t (*)(void)>();
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
class V_Rui : public IDetour
|
|
{
|
|
virtual void GetAdr(void) const
|
|
{
|
|
LogFunAdr("Rui_Draw", p_Rui_Draw.GetPtr());
|
|
LogFunAdr("Rui_LoadAsset", p_Rui_LoadAsset.GetPtr());
|
|
LogFunAdr("Rui_GetFontFace", p_Rui_GetFontFace.GetPtr());
|
|
}
|
|
virtual void GetFun(void) const
|
|
{
|
|
p_Rui_Draw = g_GameDll.FindPatternSIMD("40 53 48 83 EC 40 4C 8B 5A 18");
|
|
v_Rui_Draw = p_Rui_Draw.RCast<bool(*)(__int64*, __m128*, const __m128i*, __int64, __m128*)>(); /* 40 53 48 83 EC 40 4C 8B 5A 18 */
|
|
|
|
p_Rui_LoadAsset = g_GameDll.FindPatternSIMD("E8 ?? ?? ?? ?? EB 03 49 8B C6 48 89 86 ?? ?? ?? ?? 8B 86 ?? ?? ?? ??").FollowNearCallSelf();
|
|
v_Rui_LoadAsset = p_Rui_LoadAsset.RCast<void* (*)(const char*)>(); /*E8 ?? ?? ?? ?? EB 03 49 8B C6 48 89 86 ?? ?? ?? ?? 8B 86 ?? ?? ?? ??*/
|
|
|
|
p_Rui_GetFontFace = g_GameDll.FindPatternSIMD("F7 05 ?? ?? ?? ?? ?? ?? ?? ?? 4C 8D 0D ?? ?? ?? ?? 74 05 49 8B D1 EB 19 48 8B 05 ?? ?? ?? ?? 48 8D 15 ?? ?? ?? ?? 48 8B 48 58 48 85 C9 48 0F 45 D1 F7 05 ?? ?? ?? ?? ?? ?? ?? ?? 75 19 48 8B 05 ?? ?? ?? ?? 4C 8D 0D ?? ?? ?? ?? 4C 8B 40 58 4D 85 C0 4D 0F 45 C8 49 8B C9 48 FF 25 ?? ?? ?? ??");
|
|
v_Rui_GetFontFace = p_Rui_GetFontFace.RCast<int16_t(*)(void)>();/*F7 05 ? ? ? ? ? ? ? ? 4C 8D 0D ? ? ? ? 74 05 49 8B D1 EB 19 48 8B 05 ? ? ? ? 48 8D 15 ? ? ? ? 48 8B 48 58 48 85 C9 48 0F 45 D1 F7 05 ? ? ? ? ? ? ? ? 75 19 48 8B 05 ? ? ? ? 4C 8D 0D ? ? ? ? 4C 8B 40 58 4D 85 C0 4D 0F 45 C8 49 8B C9 48 FF 25 ? ? ? ?*/
|
|
}
|
|
virtual void GetVar(void) const { }
|
|
virtual void GetCon(void) const { }
|
|
virtual void Attach(void) const;
|
|
virtual void Detach(void) const;
|
|
};
|
|
///////////////////////////////////////////////////////////////////////////////
|