Support ASLR in III and VC

This commit is contained in:
Silent 2024-04-06 15:14:58 +02:00
parent 095ed65476
commit 33c206cfc3
No known key found for this signature in database
GPG Key ID: AE53149BB0C45AF1
5 changed files with 338 additions and 242 deletions

View File

@ -41,41 +41,41 @@ void InjectHooks()
std::unique_ptr<ScopedUnprotect::Unprotect> Protect = ScopedUnprotect::UnprotectSectionOrFullModule( GetModuleHandle( nullptr ), ".text" ); std::unique_ptr<ScopedUnprotect::Unprotect> Protect = ScopedUnprotect::UnprotectSectionOrFullModule( GetModuleHandle( nullptr ), ".text" );
if (*(DWORD*)0x5C1E75 == 0xB85548EC) if (*(DWORD*)Memory::DynBaseAddress(0x5C1E75) == 0xB85548EC)
{ {
// III 1.0 // III 1.0
ppUserFilesDir = (char**)0x580C16; ppUserFilesDir = (char**)Memory::DynBaseAddress(0x580C16);
Common::Patches::DDraw_III_10( width, height, aNoDesktopMode ); Common::Patches::DDraw_III_10( width, height, aNoDesktopMode );
} }
else if (*(DWORD*)0x5C2135 == 0xB85548EC) else if (*(DWORD*)Memory::DynBaseAddress(0x5C2135) == 0xB85548EC)
{ {
// III 1.1 // III 1.1
ppUserFilesDir = (char**)0x580F66; ppUserFilesDir = (char**)Memory::DynBaseAddress(0x580F66);
Common::Patches::DDraw_III_11( width, height, aNoDesktopMode ); Common::Patches::DDraw_III_11( width, height, aNoDesktopMode );
} }
else if (*(DWORD*)0x5C6FD5 == 0xB85548EC) else if (*(DWORD*)Memory::DynBaseAddress(0x5C6FD5) == 0xB85548EC)
{ {
// III Steam // III Steam
ppUserFilesDir = (char**)0x580E66; ppUserFilesDir = (char**)Memory::DynBaseAddress(0x580E66);
Common::Patches::DDraw_III_Steam( width, height, aNoDesktopMode ); Common::Patches::DDraw_III_Steam( width, height, aNoDesktopMode );
} }
else if (*(DWORD*)0x667BF5 == 0xB85548EC) else if (*(DWORD*)Memory::DynBaseAddress(0x667BF5) == 0xB85548EC)
{ {
// VC 1.0 // VC 1.0
ppUserFilesDir = (char**)0x6022AA; ppUserFilesDir = (char**)Memory::DynBaseAddress(0x6022AA);
Common::Patches::DDraw_VC_10( width, height, aNoDesktopMode ); Common::Patches::DDraw_VC_10( width, height, aNoDesktopMode );
} }
else if (*(DWORD*)0x667C45 == 0xB85548EC) else if (*(DWORD*)Memory::DynBaseAddress(0x667C45) == 0xB85548EC)
{ {
// VC 1.1 // VC 1.1
ppUserFilesDir = (char**)0x60228A; ppUserFilesDir = (char**)Memory::DynBaseAddress(0x60228A);
Common::Patches::DDraw_VC_11( width, height, aNoDesktopMode ); Common::Patches::DDraw_VC_11( width, height, aNoDesktopMode );
} }
else if (*(DWORD*)0x666BA5 == 0xB85548EC) else if (*(DWORD*)Memory::DynBaseAddress(0x666BA5) == 0xB85548EC)
{ {
// VC Steam // VC Steam
ppUserFilesDir = (char**)0x601ECA; ppUserFilesDir = (char**)Memory::DynBaseAddress(0x601ECA);
Common::Patches::DDraw_VC_Steam( width, height, aNoDesktopMode ); Common::Patches::DDraw_VC_Steam( width, height, aNoDesktopMode );
} }

View File

@ -62,7 +62,7 @@ namespace Common {
// ================= III ================= // ================= III =================
void DDraw_III_10( uint32_t width, uint32_t height, const char* desktopText ) void DDraw_III_10( uint32_t width, uint32_t height, const char* desktopText )
{ {
using namespace Memory; using namespace Memory::DynBase;
InjectHook(0x580BB0, GetMyDocumentsPath, HookType::Jump); InjectHook(0x580BB0, GetMyDocumentsPath, HookType::Jump);
@ -84,7 +84,7 @@ namespace Common {
void DDraw_III_11( uint32_t width, uint32_t height, const char* desktopText ) void DDraw_III_11( uint32_t width, uint32_t height, const char* desktopText )
{ {
using namespace Memory; using namespace Memory::DynBase;
InjectHook(0x580F00, GetMyDocumentsPath, HookType::Jump); InjectHook(0x580F00, GetMyDocumentsPath, HookType::Jump);
@ -106,7 +106,7 @@ namespace Common {
void DDraw_III_Steam( uint32_t width, uint32_t height, const char* desktopText ) void DDraw_III_Steam( uint32_t width, uint32_t height, const char* desktopText )
{ {
using namespace Memory; using namespace Memory::DynBase;
InjectHook(0x580E00, GetMyDocumentsPath, HookType::Jump); InjectHook(0x580E00, GetMyDocumentsPath, HookType::Jump);
@ -129,12 +129,12 @@ namespace Common {
// ================= VC ================= // ================= VC =================
void DDraw_VC_10( uint32_t width, uint32_t height, const char* desktopText ) void DDraw_VC_10( uint32_t width, uint32_t height, const char* desktopText )
{ {
using namespace Memory; using namespace Memory::DynBase;
InjectHook(0x602240, GetMyDocumentsPath, HookType::Jump); InjectHook(0x602240, GetMyDocumentsPath, HookType::Jump);
InjectHook(0x601A40, GetMyDocumentsPath, HookType::Call); InjectHook(0x601A40, GetMyDocumentsPath, HookType::Call);
InjectHook(0x601A45, 0x601B2F, HookType::Jump); InjectHook(0x601A45, DynBaseAddress(0x601B2F), HookType::Jump);
if (width != 0 && height != 0) if (width != 0 && height != 0)
{ {
@ -154,12 +154,12 @@ namespace Common {
void DDraw_VC_11( uint32_t width, uint32_t height, const char* desktopText ) void DDraw_VC_11( uint32_t width, uint32_t height, const char* desktopText )
{ {
using namespace Memory; using namespace Memory::DynBase;
InjectHook(0x602220, GetMyDocumentsPath, HookType::Jump); InjectHook(0x602220, GetMyDocumentsPath, HookType::Jump);
InjectHook(0x601A70, GetMyDocumentsPath, HookType::Call); InjectHook(0x601A70, GetMyDocumentsPath, HookType::Call);
InjectHook(0x601A75, 0x601B5F, HookType::Jump); InjectHook(0x601A75, DynBaseAddress(0x601B5F), HookType::Jump);
if (width != 0 && height != 0) if (width != 0 && height != 0)
{ {
@ -180,12 +180,12 @@ namespace Common {
void DDraw_VC_Steam( uint32_t width, uint32_t height, const char* desktopText ) void DDraw_VC_Steam( uint32_t width, uint32_t height, const char* desktopText )
{ {
using namespace Memory; using namespace Memory::DynBase;
InjectHook(0x601E60, GetMyDocumentsPath, HookType::Jump); InjectHook(0x601E60, GetMyDocumentsPath, HookType::Jump);
InjectHook(0x6016B0, GetMyDocumentsPath, HookType::Call); InjectHook(0x6016B0, GetMyDocumentsPath, HookType::Call);
InjectHook(0x6016B5, 0x60179F, HookType::Jump); InjectHook(0x6016B5, DynBaseAddress(0x60179F), HookType::Jump);
if (width != 0 && height != 0) if (width != 0 && height != 0)
{ {

@ -1 +1 @@
Subproject commit f69eb3956d9349ea820120b218676d74589ea0a2 Subproject commit 3d5474e8d5f8732f2306409c58890e5578d1eed7

View File

@ -55,28 +55,26 @@ static HMODULE hDLLModule;
static void (*DrawRect)(const CRect&,const CRGBA&); static void (*DrawRect)(const CRect&,const CRGBA&);
static void (*SetScale)(float,float);
static int* InstantHitsFiredByPlayer; static int* InstantHitsFiredByPlayer;
static const void* HeadlightsFix_JumpBack; static const void* HeadlightsFix_JumpBack;
void (__stdcall *AudioResetTimers)(unsigned int); void (__stdcall *AudioResetTimers)(unsigned int);
static void (*PrintString)(float,float,const wchar_t*);
static bool* bWantsToDrawHud; static bool* bWantsToDrawHud;
static bool* bCamCheck; static bool* bCamCheck;
static RsGlobalType* RsGlobal; static RsGlobalType* RsGlobal;
static const void* SubtitlesShadowFix_JumpBack; static const void* SubtitlesShadowFix_JumpBack;
static const float& ResolutionWidthMult = **AddressByVersion<float**>(0x57E956, 0x57ECA6, 0x57EBA6);
inline float GetWidthMult() inline float GetWidthMult()
{ {
static const float& ResolutionWidthMult = **AddressByVersion<float**>(0x57E956, 0x57ECA6, 0x57EBA6);
return ResolutionWidthMult; return ResolutionWidthMult;
} }
static const float& ResolutionHeightMult = **AddressByVersion<float**>(0x57E940, 0x57EC90, 0x57EB90);
inline float GetHeightMult() inline float GetHeightMult()
{ {
static const float& ResolutionHeightMult = **AddressByVersion<float**>(0x57E940, 0x57EC90, 0x57EB90);
return ResolutionHeightMult; return ResolutionHeightMult;
} }
@ -101,9 +99,18 @@ void ShowRadarTrace(float fX, float fY, unsigned int nScale, BYTE r, BYTE g, BYT
} }
} }
void SetScaleProperly(float fX, float fY) namespace ScalingFixes
{ {
SetScale(fX * GetWidthMult() * RsGlobal->MaximumWidth, fY * GetHeightMult() * RsGlobal->MaximumHeight); template<std::size_t Index>
static void (*orgSetScale)(float fX, float fY);
template<std::size_t Index>
static void SetScale_Fix(float fX, float fY)
{
orgSetScale<Index>(fX * GetWidthMult() * RsGlobal->MaximumWidth, fY * GetHeightMult() * RsGlobal->MaximumHeight);
}
HOOK_EACH_FUNC(SetScale, orgSetScale, SetScale_Fix);
} }
class CGang class CGang
@ -196,40 +203,75 @@ void __stdcall Recalculate(signed int nShadow)
fShadowYSize = nShadow * GetHeightMult() * RsGlobal->MaximumHeight; fShadowYSize = nShadow * GetHeightMult() * RsGlobal->MaximumHeight;
} }
static void AlteredPrintString_Internal(float fX, float fY, float fMarginX, float fMarginY, const wchar_t* pText) namespace PrintStringShadows
{ {
PrintString(fX - fMarginX + (fMarginX * GetWidthMult() * RsGlobal->MaximumWidth), fY - fMarginY + (fMarginY * GetHeightMult() * RsGlobal->MaximumHeight), pText); template<uintptr_t addr>
} static const float** margin = reinterpret_cast<const float**>(Memory::DynBaseAddress(addr));
template<uintptr_t pFltX, uintptr_t pFltY> static void PrintString_Internal(void (*printFn)(float,float,const wchar_t*), float fX, float fY, float fMarginX, float fMarginY, const wchar_t* pText)
void AlteredPrintString(float fX, float fY, const wchar_t* pText) {
{ printFn(fX - fMarginX + (fMarginX * GetWidthMult() * RsGlobal->MaximumWidth), fY - fMarginY + (fMarginY * GetHeightMult() * RsGlobal->MaximumHeight), pText);
const float fMarginX = **reinterpret_cast<float**>(pFltX); }
const float fMarginY = **reinterpret_cast<float**>(pFltY);
AlteredPrintString_Internal(fX, fY, fMarginX, fMarginY, pText);
}
template<uintptr_t pFltX, uintptr_t pFltY> template<uintptr_t pFltX, uintptr_t pFltY>
void AlteredPrintStringMinus(float fX, float fY, const wchar_t* pText) struct XY
{ {
const float fMarginX = **reinterpret_cast<float**>(pFltX); static inline void (*orgPrintString)(float,float,const wchar_t*);
const float fMarginY = **reinterpret_cast<float**>(pFltY); static void PrintString(float fX, float fY, const wchar_t* pText)
AlteredPrintString_Internal(fX, fY, -fMarginX, -fMarginY, pText); {
} PrintString_Internal(orgPrintString, fX, fY, **margin<pFltX>, **margin<pFltY>, pText);
}
template<uintptr_t pFltX> static void Hook(uintptr_t addr)
void AlteredPrintStringXOnly(float fX, float fY, const wchar_t* pText) {
{ Memory::DynBase::InterceptCall(addr, orgPrintString, PrintString);
const float fMarginX = **reinterpret_cast<float**>(pFltX); }
AlteredPrintString_Internal(fX, fY, fMarginX, 0.0f, pText); };
}
template<uintptr_t pFltY> template<uintptr_t pFltX, uintptr_t pFltY>
void AlteredPrintStringYOnly(float fX, float fY, const wchar_t* pText) struct XYMinus
{ {
const float fMarginY = **reinterpret_cast<float**>(pFltY); static inline void (*orgPrintString)(float,float,const wchar_t*);
AlteredPrintString_Internal(fX, fY, 0.0f, fMarginY, pText); static void PrintString(float fX, float fY, const wchar_t* pText)
{
PrintString_Internal(orgPrintString, fX, fY, -(**margin<pFltX>), -(**margin<pFltY>), pText);
}
static void Hook(uintptr_t addr)
{
Memory::DynBase::InterceptCall(addr, orgPrintString, PrintString);
}
};
template<uintptr_t pFltX>
struct X
{
static inline void (*orgPrintString)(float,float,const wchar_t*);
static void PrintString(float fX, float fY, const wchar_t* pText)
{
PrintString_Internal(orgPrintString, fX, fY, **margin<pFltX>, 0.0f, pText);
}
static void Hook(uintptr_t addr)
{
Memory::DynBase::InterceptCall(addr, orgPrintString, PrintString);
}
};
template<uintptr_t pFltY>
struct Y
{
static inline void (*orgPrintString)(float,float,const wchar_t*);
static void PrintString(float fX, float fY, const wchar_t* pText)
{
PrintString_Internal(orgPrintString, fX, fY, 0.0f, **margin<pFltY>, pText);
}
static void Hook(uintptr_t addr)
{
Memory::DynBase::InterceptCall(addr, orgPrintString, PrintString);
}
};
} }
float FixedRefValue() float FixedRefValue()
@ -319,8 +361,8 @@ int NewFrameRender(int nEvent, void* pParam)
return RsEventHandler(nEvent, pParam); return RsEventHandler(nEvent, pParam);
} }
static signed int& LastTimeFireTruckCreated = **(int**)0x41D2E5; static signed int& LastTimeFireTruckCreated = **(int**)Memory::DynBaseAddress(0x41D2E5);
static signed int& LastTimeAmbulanceCreated = **(int**)0x41D2F9; static signed int& LastTimeAmbulanceCreated = **(int**)Memory::DynBaseAddress(0x41D2F9);
static void (*orgCarCtrlReInit)(); static void (*orgCarCtrlReInit)();
void CarCtrlReInit_SilentPatch() void CarCtrlReInit_SilentPatch()
{ {
@ -834,19 +876,17 @@ void InjectDelayedPatches_III_Common()
void Patch_III_10(uint32_t width, uint32_t height) void Patch_III_10(uint32_t width, uint32_t height)
{ {
using namespace Memory; using namespace Memory::DynBase;
DrawRect = (void(*)(const CRect&,const CRGBA&))0x51F970; DrawRect = (void(*)(const CRect&,const CRGBA&))DynBaseAddress(0x51F970);
SetScale = (void(*)(float,float))0x501B80; AudioResetTimers = (void(__stdcall*)(unsigned int))DynBaseAddress(0x57CCD0);
AudioResetTimers = (void(__stdcall*)(unsigned int))0x57CCD0;
PrintString = (void(*)(float,float,const wchar_t*))0x500F50;
InstantHitsFiredByPlayer = *(int**)0x482C8F; InstantHitsFiredByPlayer = *(int**)DynBaseAddress(0x482C8F);
bWantsToDrawHud = *(bool**)0x4A5877; bWantsToDrawHud = *(bool**)DynBaseAddress(0x4A5877);
bCamCheck = *(bool**)0x4A588C; bCamCheck = *(bool**)DynBaseAddress(0x4A588C);
RsGlobal = *(RsGlobalType**)0x584C42; RsGlobal = *(RsGlobalType**)DynBaseAddress(0x584C42);
HeadlightsFix_JumpBack = (void*)0x5382F2; HeadlightsFix_JumpBack = (void*)DynBaseAddress(0x5382F2);
SubtitlesShadowFix_JumpBack = (void*)0x500D32; SubtitlesShadowFix_JumpBack = (void*)DynBaseAddress(0x500D32);
Patch<BYTE>(0x490F83, 1); Patch<BYTE>(0x490F83, 1);
@ -854,12 +894,15 @@ void Patch_III_10(uint32_t width, uint32_t height)
InjectHook(0x5382EC, HeadlightsFix, HookType::Jump); InjectHook(0x5382EC, HeadlightsFix, HookType::Jump);
InjectHook(0x4A5870, ShowRadarTrace, HookType::Jump); InjectHook(0x4A5870, ShowRadarTrace, HookType::Jump);
InjectHook(0x4209A7, SetScaleProperly); {
InjectHook(0x420A1F, SetScaleProperly); using namespace ScalingFixes;
InjectHook(0x420AC1, SetScaleProperly);
InjectHook(0x420D9E, SetScaleProperly); std::array<uintptr_t, 6> set_scale {
InjectHook(0x426342, SetScaleProperly); 0x4209A7, 0x420A1F, 0x420AC1, 0x420D9E, 0x426342, 0x4326B8
InjectHook(0x4326B8, SetScaleProperly); };
HookEach_SetScale(set_scale, InterceptCall);
}
InjectHook(0x4F9E4D, FixedRefValue); InjectHook(0x4F9E4D, FixedRefValue);
@ -879,35 +922,39 @@ void Patch_III_10(uint32_t width, uint32_t height)
Patch<BYTE>(0x5623B5, 0x90); Patch<BYTE>(0x5623B5, 0x90);
InjectHook(0x5623B6, M16StatsFix, HookType::Call); InjectHook(0x5623B6, M16StatsFix, HookType::Call);
InjectHook(0x505F82, AlteredPrintString<0x505F7B,0x505F50>); {
InjectHook(0x5065DA, AlteredPrintString<0x5065D3,0x5065A8>); using namespace PrintStringShadows;
InjectHook(0x50669B, AlteredPrintString<0x50668E,0x506670>);
InjectHook(0x50694B, AlteredPrintString<0x506944,0x506919>); XY<0x505F7B, 0x505F50>::Hook(0x505F82);
InjectHook(0x506A0C, AlteredPrintString<0x5069FF,0x5069E1>); XY<0x5065D3, 0x5065A8>::Hook(0x5065DA);
InjectHook(0x506C37, AlteredPrintString<0x506C2B,0x506C22>); XY<0x50668E, 0x506670>::Hook(0x50669B);
InjectHook(0x5070FA, AlteredPrintString<0x5070F3,0x5070C8>); XY<0x506944, 0x506919>::Hook(0x50694B);
InjectHook(0x507598, AlteredPrintString<0x507591,0x507566>); XY<0x5069FF, 0x5069E1>::Hook(0x506A0C);
InjectHook(0x507754, AlteredPrintString<0x50774D,0x507722>); XY<0x506C2B, 0x506C22>::Hook(0x506C37);
InjectHook(0x507944, AlteredPrintString<0x50793D,0x507912>); XY<0x5070F3, 0x5070C8>::Hook(0x5070FA);
InjectHook(0x507AC8, AlteredPrintStringYOnly<0x507A8B>); XY<0x507591, 0x507566>::Hook(0x507598);
InjectHook(0x507CF0, AlteredPrintString<0x507CE9,0x507CBE>); XY<0x50774D, 0x507722>::Hook(0x507754);
InjectHook(0x507FF1, AlteredPrintStringYOnly<0x507FB4>); XY<0x50793D, 0x507912>::Hook(0x507944);
InjectHook(0x508C6E, AlteredPrintString<0x508C67,0x508C46>); Y<0x507A8B>::Hook(0x507AC8);
InjectHook(0x508F09, AlteredPrintStringXOnly<0x508F02>); XY<0x507CE9, 0x507CBE>::Hook(0x507CF0);
InjectHook(0x426446, AlteredPrintString<0x42643F,0x426418>); Y<0x507FB4>::Hook(0x507FF1);
InjectHook(0x426584, AlteredPrintString<0x42657D,0x426556>); XY<0x508C67, 0x508C46>::Hook(0x508C6E);
InjectHook(0x42665F, AlteredPrintStringMinus<0x426658,0x426637>); X<0x508F02>::Hook(0x508F09);
InjectHook(0x5098D6, AlteredPrintString<0x509A5E,0x509A3D>); XY<0x42643F, 0x426418>::Hook(0x426446);
InjectHook(0x509A65, AlteredPrintStringMinus<0x509A5E,0x509A3D>); XY<0x42657D, 0x426556>::Hook(0x426584);
InjectHook(0x50A142, AlteredPrintStringXOnly<0x50A139>); XYMinus<0x426658, 0x426637>::Hook(0x42665F);
InjectHook(0x57E9F5, AlteredPrintString<0x57E9EE,0x57E9CD>); XY<0x509A5E, 0x509A3D>::Hook(0x5098D6);
XYMinus<0x509A5E, 0x509A3D>::Hook(0x509A65);
X<0x50A139>::Hook(0x50A142);
XY<0x57E9EE, 0x57E9CD>::Hook(0x57E9F5);
}
// RsMouseSetPos call (SA style fix) // RsMouseSetPos call (SA style fix)
ReadCall( 0x48E539, orgConstructRenderList ); ReadCall( 0x48E539, orgConstructRenderList );
InjectHook(0x48E539, ResetMousePos); InjectHook(0x48E539, ResetMousePos);
// New wndproc // New wndproc
OldWndProc = *(LRESULT (CALLBACK***)(HWND, UINT, WPARAM, LPARAM))0x581C74; OldWndProc = *(LRESULT (CALLBACK***)(HWND, UINT, WPARAM, LPARAM))DynBaseAddress(0x581C74);
Patch(0x581C74, &pCustomWndProc); Patch(0x581C74, &pCustomWndProc);
// Armour cheat as TORTOISE - like in 1.1 and Steam // Armour cheat as TORTOISE - like in 1.1 and Steam
@ -935,7 +982,7 @@ void Patch_III_10(uint32_t width, uint32_t height)
// add esp, 38h // add esp, 38h
// mov CGarages::RespraysAreFree, 0 // mov CGarages::RespraysAreFree, 0
// retn // retn
bool* pFreeResprays = *(bool**)0x4224A4; bool* pFreeResprays = *(bool**)DynBaseAddress(0x4224A4);
Patch<BYTE>(0x421E06, 0x38); Patch<BYTE>(0x421E06, 0x38);
Patch<WORD>(0x421E07, 0x05C6); Patch<WORD>(0x421E07, 0x05C6);
Patch<const void*>(0x421E09, pFreeResprays); Patch<const void*>(0x421E09, pFreeResprays);
@ -972,19 +1019,17 @@ void Patch_III_10(uint32_t width, uint32_t height)
void Patch_III_11(uint32_t width, uint32_t height) void Patch_III_11(uint32_t width, uint32_t height)
{ {
using namespace Memory; using namespace Memory::DynBase;
DrawRect = (void(*)(const CRect&,const CRGBA&))0x51FBA0; DrawRect = (void(*)(const CRect&,const CRGBA&))DynBaseAddress(0x51FBA0);
SetScale = (void(*)(float,float))0x501C60; AudioResetTimers = (void(__stdcall*)(unsigned int))DynBaseAddress(0x57CCC0);
AudioResetTimers = (void(__stdcall*)(unsigned int))0x57CCC0;
PrintString = (void(*)(float,float,const wchar_t*))0x501030;
InstantHitsFiredByPlayer = *(int**)0x482D5F; InstantHitsFiredByPlayer = *(int**)DynBaseAddress(0x482D5F);
bWantsToDrawHud = *(bool**)0x4A5967; bWantsToDrawHud = *(bool**)DynBaseAddress(0x4A5967);
bCamCheck = *(bool**)0x4A597C; bCamCheck = *(bool**)DynBaseAddress(0x4A597C);
RsGlobal = *(RsGlobalType**)0x584F82; RsGlobal = *(RsGlobalType**)DynBaseAddress(0x584F82);
HeadlightsFix_JumpBack = (void*)0x538532; HeadlightsFix_JumpBack = (void*)DynBaseAddress(0x538532);
SubtitlesShadowFix_JumpBack = (void*)0x500E12; SubtitlesShadowFix_JumpBack = (void*)DynBaseAddress(0x500E12);
Patch<BYTE>(0x491043, 1); Patch<BYTE>(0x491043, 1);
@ -992,12 +1037,15 @@ void Patch_III_11(uint32_t width, uint32_t height)
InjectHook(0x53852C, HeadlightsFix, HookType::Jump); InjectHook(0x53852C, HeadlightsFix, HookType::Jump);
InjectHook(0x4A5960, ShowRadarTrace, HookType::Jump); InjectHook(0x4A5960, ShowRadarTrace, HookType::Jump);
InjectHook(0x4209A7, SetScaleProperly); {
InjectHook(0x420A1F, SetScaleProperly); using namespace ScalingFixes;
InjectHook(0x420AC1, SetScaleProperly);
InjectHook(0x420D9E, SetScaleProperly); std::array<uintptr_t, 6> set_scale {
InjectHook(0x426342, SetScaleProperly); 0x4209A7, 0x420A1F, 0x420AC1, 0x420D9E, 0x426342, 0x4326B8
InjectHook(0x4326B8, SetScaleProperly); };
HookEach_SetScale(set_scale, InterceptCall);
}
InjectHook(0x4F9F2D, FixedRefValue); InjectHook(0x4F9F2D, FixedRefValue);
@ -1017,35 +1065,39 @@ void Patch_III_11(uint32_t width, uint32_t height)
Patch<BYTE>(0x5624E5, 0x90); Patch<BYTE>(0x5624E5, 0x90);
InjectHook(0x5624E6, M16StatsFix, HookType::Call); InjectHook(0x5624E6, M16StatsFix, HookType::Call);
InjectHook(0x506062, AlteredPrintString<0x50605B,0x506030>); {
InjectHook(0x5066BA, AlteredPrintString<0x5066B3,0x506688>); using namespace PrintStringShadows;
InjectHook(0x50677B, AlteredPrintString<0x50676E,0x506750>);
InjectHook(0x506A2B, AlteredPrintString<0x506A24,0x5069F9>); XY<0x50605B, 0x506030>::Hook(0x506062);
InjectHook(0x506AEC, AlteredPrintString<0x506ADF,0x506AC1>); XY<0x5066B3, 0x506688>::Hook(0x5066BA);
InjectHook(0x506D17, AlteredPrintString<0x506D0B,0x506D02>); XY<0x50676E, 0x506750>::Hook(0x50677B);
InjectHook(0x5071DA, AlteredPrintString<0x5071D3,0x5071A8>); XY<0x506A24, 0x5069F9>::Hook(0x506A2B);
InjectHook(0x507678, AlteredPrintString<0x507671,0x507646>); XY<0x506ADF, 0x506AC1>::Hook(0x506AEC);
InjectHook(0x507834, AlteredPrintString<0x50782D,0x507802>); XY<0x506D0B, 0x506D02>::Hook(0x506D17);
InjectHook(0x507A24, AlteredPrintString<0x507A1D,0x5079F2>); XY<0x5071D3, 0x5071A8>::Hook(0x5071DA);
InjectHook(0x507BA8, AlteredPrintStringYOnly<0x507B6B>); XY<0x507671, 0x507646>::Hook(0x507678);
InjectHook(0x507DD0, AlteredPrintString<0x507DC9,0x507D9E>); XY<0x50782D, 0x507802>::Hook(0x507834);
InjectHook(0x5080D1, AlteredPrintStringYOnly<0x508094>); XY<0x507A1D, 0x5079F2>::Hook(0x507A24);
InjectHook(0x508D4E, AlteredPrintString<0x508D47,0x508D26>); Y<0x507B6B>::Hook(0x507BA8);
InjectHook(0x508FE9, AlteredPrintStringXOnly<0x508FE2>); XY<0x507DC9, 0x507D9E>::Hook(0x507DD0);
InjectHook(0x426446, AlteredPrintString<0x42643F,0x426418>); Y<0x508094>::Hook(0x5080D1);
InjectHook(0x426584, AlteredPrintString<0x42657D,0x426556>); XY<0x508D47, 0x508D26>::Hook(0x508D4E);
InjectHook(0x42665F, AlteredPrintStringMinus<0x426658,0x426637>); X<0x508FE2>::Hook(0x508FE9);
InjectHook(0x5099B6, AlteredPrintString<0x509B3E,0x509B1D>); XY<0x42643F, 0x426418>::Hook(0x426446);
InjectHook(0x509B45, AlteredPrintStringMinus<0x509B3E,0x509B1D>); XY<0x42657D, 0x426556>::Hook(0x426584);
InjectHook(0x50A222, AlteredPrintStringXOnly<0x50A219>); XYMinus<0x426658, 0x426637>::Hook(0x42665F);
InjectHook(0x57ED45, AlteredPrintString<0x57ED3E,0x57ED1D>); XY<0x509B3E, 0x509B1D>::Hook(0x5099B6);
XYMinus<0x509B3E, 0x509B1D>::Hook(0x509B45);
X<0x50A219>::Hook(0x50A222);
XY<0x57ED3E, 0x57ED1D>::Hook(0x57ED45);
}
// RsMouseSetPos call (SA style fix) // RsMouseSetPos call (SA style fix)
ReadCall( 0x48E5F9, orgConstructRenderList ); ReadCall( 0x48E5F9, orgConstructRenderList );
InjectHook(0x48E5F9, ResetMousePos); InjectHook(0x48E5F9, ResetMousePos);
// New wndproc // New wndproc
OldWndProc = *(LRESULT (CALLBACK***)(HWND, UINT, WPARAM, LPARAM))0x581FB4; OldWndProc = *(LRESULT (CALLBACK***)(HWND, UINT, WPARAM, LPARAM))DynBaseAddress(0x581FB4);
Patch(0x581FB4, &pCustomWndProc); Patch(0x581FB4, &pCustomWndProc);
// (Hopefully) more precise frame limiter // (Hopefully) more precise frame limiter
@ -1063,7 +1115,7 @@ void Patch_III_11(uint32_t width, uint32_t height)
// add esp, 38h // add esp, 38h
// mov CGarages::RespraysAreFree, 0 // mov CGarages::RespraysAreFree, 0
// retn // retn
bool* pFreeResprays = *(bool**)0x4224A4; bool* pFreeResprays = *(bool**)DynBaseAddress(0x4224A4);
Patch<BYTE>(0x421E06, 0x38); Patch<BYTE>(0x421E06, 0x38);
Patch<WORD>(0x421E07, 0x05C6); Patch<WORD>(0x421E07, 0x05C6);
Patch<const void*>(0x421E09, pFreeResprays); Patch<const void*>(0x421E09, pFreeResprays);
@ -1090,28 +1142,29 @@ void Patch_III_11(uint32_t width, uint32_t height)
void Patch_III_Steam(uint32_t width, uint32_t height) void Patch_III_Steam(uint32_t width, uint32_t height)
{ {
using namespace Memory; using namespace Memory::DynBase;
DrawRect = (void(*)(const CRect&,const CRGBA&))0x51FB30; DrawRect = (void(*)(const CRect&,const CRGBA&))DynBaseAddress(0x51FB30);
SetScale = (void(*)(float,float))0x501BF0; AudioResetTimers = (void(__stdcall*)(unsigned int))DynBaseAddress(0x57CF20);
AudioResetTimers = (void(__stdcall*)(unsigned int))0x57CF20;
PrintString = (void(*)(float,float,const wchar_t*))0x500FC0;
InstantHitsFiredByPlayer = *(int**)0x482D5F; InstantHitsFiredByPlayer = *(int**)DynBaseAddress(0x482D5F);
bWantsToDrawHud = *(bool**)0x4A58F7; bWantsToDrawHud = *(bool**)DynBaseAddress(0x4A58F7);
bCamCheck = *(bool**)0x4A590C; bCamCheck = *(bool**)DynBaseAddress(0x4A590C);
RsGlobal = *(RsGlobalType**)0x584E72; RsGlobal = *(RsGlobalType**)DynBaseAddress(0x584E72);
SubtitlesShadowFix_JumpBack = (void*)0x500DA2; SubtitlesShadowFix_JumpBack = (void*)DynBaseAddress(0x500DA2);
Patch<BYTE>(0x490FD3, 1); Patch<BYTE>(0x490FD3, 1);
InjectHook(0x4A58F0, ShowRadarTrace, HookType::Jump); InjectHook(0x4A58F0, ShowRadarTrace, HookType::Jump);
InjectHook(0x4209A7, SetScaleProperly); {
InjectHook(0x420A1F, SetScaleProperly); using namespace ScalingFixes;
InjectHook(0x420AC1, SetScaleProperly);
InjectHook(0x420D9E, SetScaleProperly); std::array<uintptr_t, 6> set_scale {
InjectHook(0x426342, SetScaleProperly); 0x4209A7, 0x420A1F, 0x420AC1, 0x420D9E, 0x426342, 0x4326B8
InjectHook(0x4326B8, SetScaleProperly); };
HookEach_SetScale(set_scale, InterceptCall);
}
InjectHook(0x4F9EBD, FixedRefValue); InjectHook(0x4F9EBD, FixedRefValue);
@ -1131,35 +1184,39 @@ void Patch_III_Steam(uint32_t width, uint32_t height)
Patch<BYTE>(0x562495, 0x90); Patch<BYTE>(0x562495, 0x90);
InjectHook(0x562496, M16StatsFix, HookType::Call); InjectHook(0x562496, M16StatsFix, HookType::Call);
InjectHook(0x505FF2, AlteredPrintString<0x505FEB,0x505FC0>); {
InjectHook(0x50664A, AlteredPrintString<0x506643,0x506618>); using namespace PrintStringShadows;
InjectHook(0x50670B, AlteredPrintString<0x5066FE,0x5066E0>);
InjectHook(0x5069BB, AlteredPrintString<0x5069B4,0x506989>); XY<0x505FEB, 0x505FC0>::Hook(0x505FF2);
InjectHook(0x506A7C, AlteredPrintString<0x506A6F,0x506A51>); XY<0x506643, 0x506618>::Hook(0x50664A);
InjectHook(0x506CA7, AlteredPrintString<0x506C9B,0x506C92>); XY<0x5066FE, 0x5066E0>::Hook(0x50670B);
InjectHook(0x50716A, AlteredPrintString<0x507163,0x507138>); XY<0x5069B4, 0x506989>::Hook(0x5069BB);
InjectHook(0x507608, AlteredPrintString<0x507601,0x5075D6>); XY<0x506A6F, 0x506A51>::Hook(0x506A7C);
InjectHook(0x5077C4, AlteredPrintString<0x5077BD,0x507792>); XY<0x506C9B, 0x506C92>::Hook(0x506CA7);
InjectHook(0x5079B4, AlteredPrintString<0x5079AD,0x507982>); XY<0x507163, 0x507138>::Hook(0x50716A);
InjectHook(0x507B38, AlteredPrintStringYOnly<0x507AFB>); XY<0x507601, 0x5075D6>::Hook(0x507608);
InjectHook(0x507D60, AlteredPrintString<0x507D59,0x507D2E>); XY<0x5077BD, 0x507792>::Hook(0x5077C4);
InjectHook(0x508061, AlteredPrintStringYOnly<0x508024>); XY<0x5079AD, 0x507982>::Hook(0x5079B4);
InjectHook(0x508CDE, AlteredPrintString<0x508CD7,0x508CB6>); Y<0x507AFB>::Hook(0x507B38);
InjectHook(0x508F79, AlteredPrintStringXOnly<0x508F72>); XY<0x507D59, 0x507D2E>::Hook(0x507D60);
InjectHook(0x426446, AlteredPrintString<0x42643F,0x426418>); Y<0x508024>::Hook(0x508061);
InjectHook(0x426584, AlteredPrintString<0x42657D,0x426556>); XY<0x508CD7, 0x508CB6>::Hook(0x508CDE);
InjectHook(0x42665F, AlteredPrintStringMinus<0x426658,0x426637>); X<0x508F72>::Hook(0x508F79);
InjectHook(0x509946, AlteredPrintString<0x509ACE,0x509AAD>); XY<0x42643F, 0x426418>::Hook(0x426446);
InjectHook(0x509AD5, AlteredPrintStringMinus<0x509ACE,0x509AAD>); XY<0x42657D, 0x426556>::Hook(0x426584);
InjectHook(0x50A1B2, AlteredPrintStringXOnly<0x50A1A9>); XYMinus<0x426658, 0x426637>::Hook(0x42665F);
InjectHook(0x57EC45, AlteredPrintString<0x57EC3E,0x57EC1D>); XY<0x509ACE, 0x509AAD>::Hook(0x509946);
XYMinus<0x509ACE, 0x509AAD>::Hook(0x509AD5);
X<0x50A1A9>::Hook(0x50A1B2);
XY<0x57EC3E, 0x57EC1D>::Hook(0x57EC45);
}
// RsMouseSetPos call (SA style fix) // RsMouseSetPos call (SA style fix)
ReadCall( 0x48E589, orgConstructRenderList ); ReadCall( 0x48E589, orgConstructRenderList );
InjectHook(0x48E589, ResetMousePos); InjectHook(0x48E589, ResetMousePos);
// New wndproc // New wndproc
OldWndProc = *(LRESULT (CALLBACK***)(HWND, UINT, WPARAM, LPARAM))0x581EA4; OldWndProc = *(LRESULT (CALLBACK***)(HWND, UINT, WPARAM, LPARAM))DynBaseAddress(0x581EA4);
Patch(0x581EA4, &pCustomWndProc); Patch(0x581EA4, &pCustomWndProc);
// (Hopefully) more precise frame limiter // (Hopefully) more precise frame limiter
@ -1176,7 +1233,7 @@ void Patch_III_Steam(uint32_t width, uint32_t height)
// add esp, 38h // add esp, 38h
// mov CGarages::RespraysAreFree, 0 // mov CGarages::RespraysAreFree, 0
// retn // retn
bool* pFreeResprays = *(bool**)0x4224A4; bool* pFreeResprays = *(bool**)DynBaseAddress(0x4224A4);
Patch<BYTE>(0x421E06, 0x38); Patch<BYTE>(0x421E06, 0x38);
Patch<WORD>(0x421E07, 0x05C6); Patch<WORD>(0x421E07, 0x05C6);
Patch<const void*>(0x421E09, pFreeResprays); Patch<const void*>(0x421E09, pFreeResprays);

View File

@ -59,8 +59,6 @@ static HMODULE hDLLModule;
static const void* RosieAudioFix_JumpBack; static const void* RosieAudioFix_JumpBack;
static void (*PrintString)(float,float,const wchar_t*);
static RsGlobalType* RsGlobal; static RsGlobalType* RsGlobal;
static const void* SubtitlesShadowFix_JumpBack; static const void* SubtitlesShadowFix_JumpBack;
@ -128,40 +126,75 @@ void __stdcall Recalculate(float& fX, float& fY, signed int nShadow)
fY = nShadow * GetHeightMult() * RsGlobal->MaximumHeight; fY = nShadow * GetHeightMult() * RsGlobal->MaximumHeight;
} }
static void AlteredPrintString_Internal(float fX, float fY, float fMarginX, float fMarginY, const wchar_t* pText) namespace PrintStringShadows
{ {
PrintString(fX - fMarginX + (fMarginX * GetWidthMult() * RsGlobal->MaximumWidth), fY - fMarginY + (fMarginY * GetHeightMult() * RsGlobal->MaximumHeight), pText); template<uintptr_t addr>
} static const float** margin = reinterpret_cast<const float**>(Memory::DynBaseAddress(addr));
template<uintptr_t pFltX, uintptr_t pFltY> static void PrintString_Internal(void (*printFn)(float,float,const wchar_t*), float fX, float fY, float fMarginX, float fMarginY, const wchar_t* pText)
void AlteredPrintString(float fX, float fY, const wchar_t* pText) {
{ printFn(fX - fMarginX + (fMarginX * GetWidthMult() * RsGlobal->MaximumWidth), fY - fMarginY + (fMarginY * GetHeightMult() * RsGlobal->MaximumHeight), pText);
const float fMarginX = **reinterpret_cast<float**>(pFltX); }
const float fMarginY = **reinterpret_cast<float**>(pFltY);
AlteredPrintString_Internal(fX, fY, fMarginX, fMarginY, pText);
}
template<uintptr_t pFltX, uintptr_t pFltY> template<uintptr_t pFltX, uintptr_t pFltY>
void AlteredPrintStringMinus(float fX, float fY, const wchar_t* pText) struct XY
{ {
const float fMarginX = **reinterpret_cast<float**>(pFltX); static inline void (*orgPrintString)(float,float,const wchar_t*);
const float fMarginY = **reinterpret_cast<float**>(pFltY); static void PrintString(float fX, float fY, const wchar_t* pText)
AlteredPrintString_Internal(fX, fY, -fMarginX, -fMarginY, pText); {
} PrintString_Internal(orgPrintString, fX, fY, **margin<pFltX>, **margin<pFltY>, pText);
}
template<uintptr_t pFltX> static void Hook(uintptr_t addr)
void AlteredPrintStringXOnly(float fX, float fY, const wchar_t* pText) {
{ Memory::DynBase::InterceptCall(addr, orgPrintString, PrintString);
const float fMarginX = **reinterpret_cast<float**>(pFltX); }
AlteredPrintString_Internal(fX, fY, fMarginX, 0.0f, pText); };
}
template<uintptr_t pFltY> template<uintptr_t pFltX, uintptr_t pFltY>
void AlteredPrintStringYOnly(float fX, float fY, const wchar_t* pText) struct XYMinus
{ {
const float fMarginY = **reinterpret_cast<float**>(pFltY); static inline void (*orgPrintString)(float,float,const wchar_t*);
AlteredPrintString_Internal(fX, fY, 0.0f, fMarginY, pText); static void PrintString(float fX, float fY, const wchar_t* pText)
{
PrintString_Internal(orgPrintString, fX, fY, -(**margin<pFltX>), -(**margin<pFltY>), pText);
}
static void Hook(uintptr_t addr)
{
Memory::DynBase::InterceptCall(addr, orgPrintString, PrintString);
}
};
template<uintptr_t pFltX>
struct X
{
static inline void (*orgPrintString)(float,float,const wchar_t*);
static void PrintString(float fX, float fY, const wchar_t* pText)
{
PrintString_Internal(orgPrintString, fX, fY, **margin<pFltX>, 0.0f, pText);
}
static void Hook(uintptr_t addr)
{
Memory::DynBase::InterceptCall(addr, orgPrintString, PrintString);
}
};
template<uintptr_t pFltY>
struct Y
{
static inline void (*orgPrintString)(float,float,const wchar_t*);
static void PrintString(float fX, float fY, const wchar_t* pText)
{
PrintString_Internal(orgPrintString, fX, fY, 0.0f, **margin<pFltY>, pText);
}
static void Hook(uintptr_t addr)
{
Memory::DynBase::InterceptCall(addr, orgPrintString, PrintString);
}
};
} }
float FixedRefValue() float FixedRefValue()
@ -756,13 +789,11 @@ void InjectDelayedPatches_VC_Common()
void Patch_VC_10(uint32_t width, uint32_t height) void Patch_VC_10(uint32_t width, uint32_t height)
{ {
using namespace Memory; using namespace Memory::DynBase;
PrintString = (void(*)(float,float,const wchar_t*))0x551040; RsGlobal = *(RsGlobalType**)DynBaseAddress(0x602D32);
RosieAudioFix_JumpBack = (void*)DynBaseAddress(0x42BFFE);
RsGlobal = *(RsGlobalType**)0x602D32; SubtitlesShadowFix_JumpBack = (void*)DynBaseAddress(0x551701);
RosieAudioFix_JumpBack = (void*)0x42BFFE;
SubtitlesShadowFix_JumpBack = (void*)0x551701;
InjectHook(0x5433BD, FixedRefValue); InjectHook(0x5433BD, FixedRefValue);
@ -779,8 +810,12 @@ void Patch_VC_10(uint32_t width, uint32_t height)
Patch<BYTE>(0x551835, 0x24-0x18); Patch<BYTE>(0x551835, 0x24-0x18);
Patch<BYTE>(0x5516FB, 0x90); Patch<BYTE>(0x5516FB, 0x90);
InjectHook(0x5FA1FD, AlteredPrintString<0x5FA1F6,0x5FA1D5>); {
InjectHook(0x54474D, AlteredPrintStringMinus<0x544727,0x544727>); using namespace PrintStringShadows;
XY<0x5FA1F6, 0x5FA1D5>::Hook(0x5FA1FD);
XYMinus<0x544727, 0x544727>::Hook(0x54474D);
}
// Mouse fucking fix! // Mouse fucking fix!
Patch<DWORD>(0x601740, 0xC3C030); Patch<DWORD>(0x601740, 0xC3C030);
@ -796,12 +831,12 @@ void Patch_VC_10(uint32_t width, uint32_t height)
InjectHook(0x4A5E45, ResetMousePos); InjectHook(0x4A5E45, ResetMousePos);
// New wndproc // New wndproc
OldWndProc = *(LRESULT (CALLBACK***)(HWND, UINT, WPARAM, LPARAM))0x601727; OldWndProc = *(LRESULT (CALLBACK***)(HWND, UINT, WPARAM, LPARAM))DynBaseAddress(0x601727);
Patch(0x601727, &pCustomWndProc); Patch(0x601727, &pCustomWndProc);
// Y axis sensitivity fix // Y axis sensitivity fix
// By ThirteenAG // By ThirteenAG
float* sens = *(float**)0x4796E5; float* sens = *(float**)DynBaseAddress(0x4796E5);
Patch<const void*>(0x479410 + 0x2E0 + 0x2, sens); Patch<const void*>(0x479410 + 0x2E0 + 0x2, sens);
Patch<const void*>(0x47A20E + 0x27D + 0x2, sens); Patch<const void*>(0x47A20E + 0x27D + 0x2, sens);
Patch<const void*>(0x47AE27 + 0x1CC + 0x2, sens); Patch<const void*>(0x47AE27 + 0x1CC + 0x2, sens);
@ -863,13 +898,11 @@ void Patch_VC_10(uint32_t width, uint32_t height)
void Patch_VC_11(uint32_t width, uint32_t height) void Patch_VC_11(uint32_t width, uint32_t height)
{ {
using namespace Memory; using namespace Memory::DynBase;
PrintString = (void(*)(float,float,const wchar_t*))0x551060; RsGlobal = *(RsGlobalType**)DynBaseAddress(0x602D12);
RosieAudioFix_JumpBack = (void*)DynBaseAddress(0x42BFFE);
RsGlobal = *(RsGlobalType**)0x602D12; SubtitlesShadowFix_JumpBack = (void*)DynBaseAddress(0x551721);
RosieAudioFix_JumpBack = (void*)0x42BFFE;
SubtitlesShadowFix_JumpBack = (void*)0x551721;
InjectHook(0x5433DD, FixedRefValue); InjectHook(0x5433DD, FixedRefValue);
@ -886,8 +919,12 @@ void Patch_VC_11(uint32_t width, uint32_t height)
Patch<BYTE>(0x551855, 0x24-0x18); Patch<BYTE>(0x551855, 0x24-0x18);
Patch<BYTE>(0x55171B, 0x90); Patch<BYTE>(0x55171B, 0x90);
InjectHook(0x5FA21D, AlteredPrintString<0x5FA216,0x5FA1F5>); {
InjectHook(0x54476D, AlteredPrintStringMinus<0x544747,0x544747>); using namespace PrintStringShadows;
XY<0x5FA216, 0x5FA1F5>::Hook(0x5FA21D);
XYMinus<0x544747, 0x544747>::Hook(0x54476D);
}
// Mouse fucking fix! // Mouse fucking fix!
Patch<DWORD>(0x601770, 0xC3C030); Patch<DWORD>(0x601770, 0xC3C030);
@ -902,12 +939,12 @@ void Patch_VC_11(uint32_t width, uint32_t height)
InjectHook(0x4A5E65, ResetMousePos); InjectHook(0x4A5E65, ResetMousePos);
// New wndproc // New wndproc
OldWndProc = *(LRESULT (CALLBACK***)(HWND, UINT, WPARAM, LPARAM))0x601757; OldWndProc = *(LRESULT (CALLBACK***)(HWND, UINT, WPARAM, LPARAM))DynBaseAddress(0x601757);
Patch(0x601757, &pCustomWndProc); Patch(0x601757, &pCustomWndProc);
// Y axis sensitivity fix // Y axis sensitivity fix
// By ThirteenAG // By ThirteenAG
float* sens = *(float**)0x4796E5; float* sens = *(float**)DynBaseAddress(0x4796E5);
Patch<const void*>(0x479410 + 0x2E0 + 0x2, sens); Patch<const void*>(0x479410 + 0x2E0 + 0x2, sens);
Patch<const void*>(0x47A20E + 0x27D + 0x2, sens); Patch<const void*>(0x47A20E + 0x27D + 0x2, sens);
Patch<const void*>(0x47AE27 + 0x1CC + 0x2, sens); Patch<const void*>(0x47AE27 + 0x1CC + 0x2, sens);
@ -960,13 +997,11 @@ void Patch_VC_11(uint32_t width, uint32_t height)
void Patch_VC_Steam(uint32_t width, uint32_t height) void Patch_VC_Steam(uint32_t width, uint32_t height)
{ {
using namespace Memory; using namespace Memory::DynBase;
PrintString = (void(*)(float,float,const wchar_t*))0x550F30; RsGlobal = *(RsGlobalType**)DynBaseAddress(0x602952);
RosieAudioFix_JumpBack = (void*)DynBaseAddress(0x42BFCE);
RsGlobal = *(RsGlobalType**)0x602952; SubtitlesShadowFix_JumpBack = (void*)DynBaseAddress(0x5515F1);
RosieAudioFix_JumpBack = (void*)0x42BFCE;
SubtitlesShadowFix_JumpBack = (void*)0x5515F1;
InjectHook(0x5432AD, FixedRefValue); InjectHook(0x5432AD, FixedRefValue);
@ -983,8 +1018,12 @@ void Patch_VC_Steam(uint32_t width, uint32_t height)
Patch<BYTE>(0x551725, 0x24-0x18); Patch<BYTE>(0x551725, 0x24-0x18);
Patch<BYTE>(0x5515EB, 0x90); Patch<BYTE>(0x5515EB, 0x90);
InjectHook(0x5F9E5D, AlteredPrintString<0x5F9E56,0x5F9E35>); {
InjectHook(0x54463D, AlteredPrintStringMinus<0x544617,0x544617>); using namespace PrintStringShadows;
XY<0x5F9E56, 0x5F9E35>::Hook(0x5F9E5D);
XYMinus<0x544617, 0x544617>::Hook(0x54463D);
}
// Mouse fucking fix! // Mouse fucking fix!
Patch<DWORD>(0x6013B0, 0xC3C030); Patch<DWORD>(0x6013B0, 0xC3C030);
@ -999,12 +1038,12 @@ void Patch_VC_Steam(uint32_t width, uint32_t height)
InjectHook(0x4A5D15, ResetMousePos); InjectHook(0x4A5D15, ResetMousePos);
// New wndproc // New wndproc
OldWndProc = *(LRESULT (CALLBACK***)(HWND, UINT, WPARAM, LPARAM))0x601397; OldWndProc = *(LRESULT (CALLBACK***)(HWND, UINT, WPARAM, LPARAM))DynBaseAddress(0x601397);
Patch(0x601397, &pCustomWndProc); Patch(0x601397, &pCustomWndProc);
// Y axis sensitivity fix // Y axis sensitivity fix
// By ThirteenAG // By ThirteenAG
float* sens = *(float**)0x4795C5; float* sens = *(float**)DynBaseAddress(0x4795C5);
Patch<const void*>(0x4792F0 + 0x2E0 + 0x2, sens); Patch<const void*>(0x4792F0 + 0x2E0 + 0x2, sens);
Patch<const void*>(0x47A0EE + 0x27D + 0x2, sens); Patch<const void*>(0x47A0EE + 0x27D + 0x2, sens);
Patch<const void*>(0x47AD07 + 0x1CC + 0x2, sens); Patch<const void*>(0x47AD07 + 0x1CC + 0x2, sens);
@ -1056,7 +1095,7 @@ void Patch_VC_Steam(uint32_t width, uint32_t height)
void Patch_VC_JP() void Patch_VC_JP()
{ {
using namespace Memory; using namespace Memory::DynBase;
// Y axis sensitivity fix // Y axis sensitivity fix
// By ThirteenAG // By ThirteenAG