From 41588e0d2db5545ddd42067e447296b5ff7a8204 Mon Sep 17 00:00:00 2001 From: Silent Date: Sun, 15 Jun 2014 21:54:14 +0200 Subject: [PATCH] Out of map bounds bug fixed Steam subtitle sizes Ready for 1.1 beta release, I guess --- SAFix/SAFix.vcxproj | 2 +- SilentPatch/AudioHardware.cpp | 11 +++----- SilentPatch/dllmain.cpp | 49 ++++++++++++++++++++++++++++++++--- 3 files changed, 50 insertions(+), 12 deletions(-) diff --git a/SAFix/SAFix.vcxproj b/SAFix/SAFix.vcxproj index b0e45fa..e58e8a1 100644 --- a/SAFix/SAFix.vcxproj +++ b/SAFix/SAFix.vcxproj @@ -78,7 +78,7 @@ Use - true + false true true Windows diff --git a/SilentPatch/AudioHardware.cpp b/SilentPatch/AudioHardware.cpp index f7b56af..0b97ea6 100644 --- a/SilentPatch/AudioHardware.cpp +++ b/SilentPatch/AudioHardware.cpp @@ -17,23 +17,18 @@ static unsigned int nSamplesLeftToProcess = 0; unsigned int CAEDataStream::Seek(long nToSeek, int nPoint) { - LONG nRealDistToSeek; - switch ( nPoint ) { case FILE_BEGIN: - nRealDistToSeek = nToSeek + dwStartPosition; - break; - case FILE_CURRENT: - nRealDistToSeek = nToSeek; + nToSeek = nToSeek + dwStartPosition; break; case FILE_END: nPoint = FILE_BEGIN; - nRealDistToSeek = dwStartPosition + dwLength - nToSeek; + nToSeek = dwStartPosition + dwLength - nToSeek; break; } - dwCurrentPosition = SetFilePointer(hHandle, nRealDistToSeek, nullptr, nPoint); + dwCurrentPosition = SetFilePointer(hHandle, nToSeek, nullptr, nPoint); return dwCurrentPosition - dwStartPosition; } diff --git a/SilentPatch/dllmain.cpp b/SilentPatch/dllmain.cpp index 84b34d0..ba9750c 100644 --- a/SilentPatch/dllmain.cpp +++ b/SilentPatch/dllmain.cpp @@ -187,6 +187,8 @@ void __stdcall Recalculate(float& fX, float& fY, signed int nShadow) static CLinkList& m_alphaList = **(CLinkList**)0x733A4D; static CLinkList& ms_weaponPedsForPC = **(CLinkList**)0x53EACA; +static unsigned char* ZonesVisited = *(unsigned char**)0x57216A - 9; + #ifndef SA_STEAM_TEST void** rwengine = *(void***)0x58FFC0; #else @@ -236,8 +238,6 @@ RpMaterial* AlphaTest(RpMaterial* pMaterial, void* pData) return pMaterial; } -#include - RpMaterial* AlphaTestAndPush(RpMaterial* pMaterial, void* pData) { if ( RpMaterialGetTexture(pMaterial) ) @@ -325,7 +325,6 @@ RpAtomic* TwoPassAlphaRender(RpAtomic* atomic) RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, reinterpret_cast(nAlphaBlending)); return pAtomic; - //return nullptr; } RpAtomic* StaticPropellerRender(RpAtomic* pAtomic) @@ -403,6 +402,19 @@ void RenderWeaponsList() RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, reinterpret_cast(nAlphaBlending)); } +bool GetCurrentZoneLockedOrUnlocked(float fPosX, float fPosY) +{ + int Xindex = (fPosX+3000.0f) * (1.0f/600.0f); + int Yindex = (fPosY+3000.0f) * (1.0f/600.0f); + + // "Territories fix" + if ( (Xindex >= 0 && Xindex < 10) && (Yindex >= 0 && Yindex < 10) ) + return ZonesVisited[10*Xindex - Yindex + 9] != 0; + + // Outside of map bounds + return true; +} + #endif template @@ -1922,6 +1934,12 @@ void StartNewMission_BasketballFix() BasketballFix(ScriptSpace+200000, 69000); } +static const float fSteamSubtitleSizeX = 0.45f; +static const float fSteamSubtitleSizeY = 0.9f; +static const float fSteamRadioNamePosY = 33.0f; +static const float fSteamRadioNameSizeX = 0.4f; +static const float fSteamRadioNameSizeY = 0.6f; + BOOL InjectDelayedPatches_10() { if ( !IsAlreadyRunning() ) @@ -1974,6 +1992,28 @@ BOOL InjectDelayedPatches_10() Patch(*(float**)0x7034C0, 0.0); } + if ( GetPrivateProfileInt("SilentPatch", "SkipIntroSplashes", TRUE, ".\\SilentPatchSA.ini") != FALSE ) + { + // Skip the damn intro splash + Patch(0x748AA8, 0x3DEB); + } + + if ( GetPrivateProfileInt("SilentPatch", "SmallSteamTexts", TRUE, ".\\SilentPatchSA.ini") != FALSE ) + { + // We're on 1.0 - make texts smaller + Patch(0x58C387, &fSteamSubtitleSizeY); + Patch(0x58C40F, &fSteamSubtitleSizeY); + Patch(0x58C4CE, &fSteamSubtitleSizeY); + + Patch(0x58C39D, &fSteamSubtitleSizeX); + Patch(0x58C425, &fSteamSubtitleSizeX); + Patch(0x58C4E4, &fSteamSubtitleSizeX); + + Patch(0x4E9FD8, &fSteamRadioNamePosY); + Patch(0x4E9F22, &fSteamRadioNameSizeY); + Patch(0x4E9F38, &fSteamRadioNameSizeX); + } + return FALSE; } return TRUE; @@ -2150,6 +2190,9 @@ __forceinline void Patch_SA_10() //Patch(0x4F35E7, &UserTrackExtensions[1].Codec); Patch(0x4F322D, sizeof(UserTrackExtensions)); + // Zones fix + InjectHook(0x572130, GetCurrentZoneLockedOrUnlocked, PATCH_JUMP); + // Fixed police scanner names char* pScannerNames = *(char**)0x4E72D4; strncpy(pScannerNames + (8*113), "WESTP", 8);