From 20b2f09e8a8eea84279f4bf89e86bf0a7bdbd6a1 Mon Sep 17 00:00:00 2001 From: Silent Date: Fri, 26 Sep 2014 15:34:21 +0200 Subject: [PATCH] 6 extra directionals on Medium and higher --- SAFix/SilentPatchSA.cpp | 35 +++++++++++++++++++++++++++++++++++ SilentPatch/MemoryMgr.h | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/SAFix/SilentPatchSA.cpp b/SAFix/SilentPatchSA.cpp index 58f2674..7bb3f9f 100644 --- a/SAFix/SilentPatchSA.cpp +++ b/SAFix/SilentPatchSA.cpp @@ -1593,6 +1593,29 @@ NoFPSLimit_Skip: } } +static void* const g_fx = *AddressByVersion(0x4A9649, 0x4AA4EF, 0x4B2BB9); +void __declspec(naked) GetMaxExtraDirectionals() +{ + _asm + { + call CanSeeOutSideFromCurrArea + test al, al + jz GetMaxExtraDirectionals_Six + + // Low details? + mov eax, [g_fx] + cmp dword ptr [eax+54h], 0 + jne GetMaxExtraDirectionals_Six + mov ebx, 4 + retn + +GetMaxExtraDirectionals_Six: + mov ebx, 6 + retn + } +} + + static const float fSteamSubtitleSizeX = 0.45f; static const float fSteamSubtitleSizeY = 0.9f; static const float fSteamRadioNamePosY = 33.0f; @@ -2397,6 +2420,10 @@ void Patch_SA_10() Patch(0x5D9A91, 8); Patch(0x5D9F1F, 8); + // 6 extra directionals on Medium and higher + InjectHook(0x735881, GetMaxExtraDirectionals, PATCH_CALL); + Patch(0x735886, 0x07EB); + // Default resolution to native resolution RECT desktop; GetWindowRect(GetDesktopWindow(), &desktop); @@ -2626,6 +2653,10 @@ void Patch_SA_11() Patch(0x5DA2A0, 8); Patch(0x5DA73F, 8); + // 6 extra directionals on Medium and higher + InjectHook(0x7360B1, GetMaxExtraDirectionals, PATCH_CALL); + Patch(0x7360B6, 0x07EB); + // Default resolution to native resolution RECT desktop; GetWindowRect(GetDesktopWindow(), &desktop); @@ -2829,6 +2860,10 @@ void Patch_SA_Steam() Patch(0x5F61D0, 8); Patch(0x5F666D, 8); + // 6 extra directionals on Medium and higher + InjectHook(0x768046, GetMaxExtraDirectionals, PATCH_CALL); + Patch(0x76804B, 0x0AEB); + // Default resolution to native resolution RECT desktop; GetWindowRect(GetDesktopWindow(), &desktop); diff --git a/SilentPatch/MemoryMgr.h b/SilentPatch/MemoryMgr.h index ba694bf..8ca20c1 100644 --- a/SilentPatch/MemoryMgr.h +++ b/SilentPatch/MemoryMgr.h @@ -134,7 +134,7 @@ inline T AddressByVersion(DWORD address10, DWORD address11, DWORD addressSteam) switch ( *bVer ) { case 1: - //assert(address11); + assert(address11); // Safety measures - if null, return dummy var pointer to prevent a crash if ( !address11 )