From 2fe9915ce76064f26eece37113fd8263be63bef6 Mon Sep 17 00:00:00 2001 From: Silent Date: Mon, 11 Jan 2016 23:55:25 +0100 Subject: [PATCH] Fixed lensflare --- SilentPatchSA/SilentPatchSA.cpp | 39 +++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/SilentPatchSA/SilentPatchSA.cpp b/SilentPatchSA/SilentPatchSA.cpp index 8e3dce9..145c1bb 100644 --- a/SilentPatchSA/SilentPatchSA.cpp +++ b/SilentPatchSA/SilentPatchSA.cpp @@ -202,7 +202,7 @@ static void (*sub_5DA6A0)(void*, void*, void*, void*); // SA variables void** rwengine = *AddressByVersion(0x58FFC0, 0x53F032, 0x48C194); -signed int& ms_extraVertColourPluginOffset = **AddressByVersion(0x5D6362, 0x5D6B42, 0x5F2B65); +RwInt32& ms_extraVertColourPluginOffset = **AddressByVersion(0x5D6362, 0x5D6B42, 0x5F2B65); unsigned char& nGameClockDays = **AddressByVersion(0x4E841D, 0x4E886D, 0x4F3871); unsigned char& nGameClockMonths = **AddressByVersion(0x4E842D, 0x4E887D, 0x4F3861); @@ -711,6 +711,21 @@ int Int32Rand() return generator() & 0x7FFFFFFF; } +void (*FlushSpriteBuffer)() = AddressByVersion(0x70CF20, 0, 0); +void FlushLensSwitchZ( RwRenderState rwa, void* rwb ) +{ + FlushSpriteBuffer(); + RwRenderStateSet( rwa, rwb ); +} + +void (*InitSpriteBuffer2D)() = AddressByVersion(0x70CFD0, 0, 0); +void InitBufferSwitchZ( RwRenderState rwa, void* rwb ) +{ + RwRenderStateSet( rwa, rwb ); + InitSpriteBuffer2D(); +} + + #include static void* pNVCShader = nullptr; @@ -2444,9 +2459,6 @@ void Patch_SA_10() // PS2 SUN!!!!!!!!!!!!!!!!! static const float fSunMult = (1050.0f * 0.95f) / 1500.0f; - Nop(0x6FB316, 3); - Nop(0x6FB480, 3); - Nop(0x6FB17C, 3); Patch(0x6FC5B0, &fSunMult); //Patch(0x6FB172, 0x0BEB); @@ -2605,6 +2617,25 @@ void Patch_SA_10() // Game seems to assume they can show together Nop(0x58BA8F, 6); + // Fixed lens flare + Patch(0x70F45A, 0); + Patch(0x6FB621, 0xC3); + Patch(0x6FB600, 0x21); + InjectHook(0x6FB622, 0x70CF20, PATCH_CALL); + Patch(0x6FB627, 0xDCEB); + + Patch(0x6FB476, 0xB990); + Patch(0x6FB478, &FlushLensSwitchZ); + Patch(0x6FB480, 0xD1FF); + Nop(0x6FB482, 1); + Patch(0x6FB621, 0xC3); + + Patch(0x6FAF28, 0xB990); + Patch(0x6FAF2A, &InitBufferSwitchZ); + Patch(0x6FAF32, 0xD1FF); + Nop(0x6FAF34, 1); + + // Fixed police scanner names char* pScannerNames = *(char**)0x4E72D4; strncpy(pScannerNames + (8*113), "WESTP", 8);