Updated RsMouseSetPos call fix

This commit is contained in:
Silent 2018-01-10 01:08:41 +01:00
parent f30ebc487d
commit 75b512764b
2 changed files with 10 additions and 4 deletions

View file

@ -133,8 +133,8 @@ LRESULT CALLBACK CustomWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPara
} }
static auto* const pCustomWndProc = CustomWndProc; static auto* const pCustomWndProc = CustomWndProc;
static void (* const ConstructRenderList)() = AddressByVersion<void(*)()>(0x4A76B0, 0x4A77A0, 0x4A7730);
static void (* const RsMouseSetPos)(RwV2d*) = AddressByVersion<void(*)(RwV2d*)>(0x580D20, 0x581070, 0x580F70); static void (* const RsMouseSetPos)(RwV2d*) = AddressByVersion<void(*)(RwV2d*)>(0x580D20, 0x581070, 0x580F70);
static void (*orgConstructRenderList)();
void ResetMousePos() void ResetMousePos()
{ {
if ( bGameInFocus ) if ( bGameInFocus )
@ -142,7 +142,7 @@ void ResetMousePos()
RwV2d vecPos = { RsGlobal->MaximumWidth * 0.5f, RsGlobal->MaximumHeight * 0.5f }; RwV2d vecPos = { RsGlobal->MaximumWidth * 0.5f, RsGlobal->MaximumHeight * 0.5f };
RsMouseSetPos(&vecPos); RsMouseSetPos(&vecPos);
} }
ConstructRenderList(); orgConstructRenderList();
} }
void __declspec(naked) M16StatsFix() void __declspec(naked) M16StatsFix()
@ -434,6 +434,7 @@ void Patch_III_10(const RECT& desktop)
InjectHook(0x57E9F5, AlteredPrintString<0x57E9EE,0x57E9CD>); InjectHook(0x57E9F5, AlteredPrintString<0x57E9EE,0x57E9CD>);
// RsMouseSetPos call (SA style fix) // RsMouseSetPos call (SA style fix)
ReadCall( 0x48E539, orgConstructRenderList );
InjectHook(0x48E539, ResetMousePos); InjectHook(0x48E539, ResetMousePos);
// New wndproc // New wndproc
@ -580,6 +581,7 @@ void Patch_III_11(const RECT& desktop)
InjectHook(0x57ED45, AlteredPrintString<0x57ED3E,0x57ED1D>); InjectHook(0x57ED45, AlteredPrintString<0x57ED3E,0x57ED1D>);
// RsMouseSetPos call (SA style fix) // RsMouseSetPos call (SA style fix)
ReadCall( 0x48E5F9, orgConstructRenderList );
InjectHook(0x48E5F9, ResetMousePos); InjectHook(0x48E5F9, ResetMousePos);
// New wndproc // New wndproc
@ -702,6 +704,7 @@ void Patch_III_Steam(const RECT& desktop)
InjectHook(0x57EC45, AlteredPrintString<0x57EC3E,0x57EC1D>); InjectHook(0x57EC45, AlteredPrintString<0x57EC3E,0x57EC1D>);
// RsMouseSetPos call (SA style fix) // RsMouseSetPos call (SA style fix)
ReadCall( 0x48E589, orgConstructRenderList );
InjectHook(0x48E589, ResetMousePos); InjectHook(0x48E589, ResetMousePos);
// New wndproc // New wndproc

View file

@ -77,8 +77,8 @@ LRESULT CALLBACK CustomWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPara
} }
static auto* const pCustomWndProc = CustomWndProc; static auto* const pCustomWndProc = CustomWndProc;
static void (* const ConstructRenderList)() = AddressByVersion<void(*)()>(0x4CA260, 0x4CA280, 0x4CA120);
static void (* const RsMouseSetPos)(RwV2d*) = AddressByVersion<void(*)(RwV2d*)>(0x6030C0, 0x6030A0, 0x602CE0); static void (* const RsMouseSetPos)(RwV2d*) = AddressByVersion<void(*)(RwV2d*)>(0x6030C0, 0x6030A0, 0x602CE0);
static void (*orgConstructRenderList)();
void ResetMousePos() void ResetMousePos()
{ {
if ( bGameInFocus ) if ( bGameInFocus )
@ -86,7 +86,7 @@ void ResetMousePos()
RwV2d vecPos = { RsGlobal->MaximumWidth * 0.5f, RsGlobal->MaximumHeight * 0.5f }; RwV2d vecPos = { RsGlobal->MaximumWidth * 0.5f, RsGlobal->MaximumHeight * 0.5f };
RsMouseSetPos(&vecPos); RsMouseSetPos(&vecPos);
} }
ConstructRenderList(); orgConstructRenderList();
} }
void __stdcall Recalculate(float& fX, float& fY, signed int nShadow) void __stdcall Recalculate(float& fX, float& fY, signed int nShadow)
@ -265,6 +265,7 @@ void Patch_VC_10(const RECT& desktop)
// RsMouseSetPos call (SA style fix) // RsMouseSetPos call (SA style fix)
ReadCall( 0x4A5E45, orgConstructRenderList );
InjectHook(0x4A5E45, ResetMousePos); InjectHook(0x4A5E45, ResetMousePos);
// New wndproc // New wndproc
@ -378,6 +379,7 @@ void Patch_VC_11(const RECT& desktop)
InjectHook(0x600469, GetTimeSinceLastFrame); InjectHook(0x600469, GetTimeSinceLastFrame);
// RsMouseSetPos call (SA style fix) // RsMouseSetPos call (SA style fix)
ReadCall( 0x4A5E65, orgConstructRenderList );
InjectHook(0x4A5E65, ResetMousePos); InjectHook(0x4A5E65, ResetMousePos);
// New wndproc // New wndproc
@ -482,6 +484,7 @@ void Patch_VC_Steam(const RECT& desktop)
InjectHook(0x6000A9, GetTimeSinceLastFrame); InjectHook(0x6000A9, GetTimeSinceLastFrame);
// RsMouseSetPos call (SA style fix) // RsMouseSetPos call (SA style fix)
ReadCall( 0x4A5D15, orgConstructRenderList );
InjectHook(0x4A5D15, ResetMousePos); InjectHook(0x4A5D15, ResetMousePos);
// New wndproc // New wndproc