diff --git a/SilentPatchSA/SilentPatchSA.cpp b/SilentPatchSA/SilentPatchSA.cpp index d73a79f..71d1efb 100644 --- a/SilentPatchSA/SilentPatchSA.cpp +++ b/SilentPatchSA/SilentPatchSA.cpp @@ -199,7 +199,7 @@ static void (*ShutdownRenderWare)(); static void (*DoSunAndMoon)(); static void (*sub_5DA6A0)(void*, void*, void*, void*); -auto WorldRemove = AddressByVersion(0x563280, 0, 0x57D370); +auto WorldRemove = AddressByVersion(0x563280, 0, 0x57D370, 0x57C480, 0); // SA variables @@ -863,7 +863,7 @@ void UpdateEscalators() } -static char** pStencilShadowsPad = *AddressByVersion(0x70FC4F, 0, 0x75E286); +static char** pStencilShadowsPad = *AddressByVersion(0x70FC4F, 0, 0x75E286, 0x758A47, 0); void StencilShadowAlloc( ) { static char* pMemory = nullptr; @@ -3889,6 +3889,35 @@ void Patch_SA_NewSteam_r2() InjectHook(0x41A5A9, CollisionData_NewAndInit); + // Crash when entering advanced display options on a dual monitor machine after: + // - starting game on primary monitor in maximum resolution, exiting, + // starting again in maximum resolution on secondary monitor. + // Secondary monitor maximum resolution had to be greater than maximum resolution of primary monitor. + // Not in 1.01 + int pGetNumVideoModes = DynBaseAddress(0x779B71); + orgGetNumVideoModes = (RwInt32(*)())(*(int*)(pGetNumVideoModes+1) + pGetNumVideoModes + 5); + InjectHook(0x779B71, GetNumVideoModes_Store); + InjectHook(0x779AD1, GetNumVideoModes_Retrieve); + + + // Fixed escalators crash + orgEscalatorsUpdate = (void(*)())DynBaseAddress(0x735B90); + InjectHook(0x735BC5, UpdateEscalators, PATCH_JUMP); + + Patch(0x734BAE, 0x4E8D); + Patch(0x734BB0, 0x84); + InjectHook(0x734BB1, &CEscalator::SwitchOffNoRemove, PATCH_CALL); + Patch(0x734BB6, 0x52EB); + + + // Don't allocate constant memory for stencil shadows every frame + InjectHook(0x75ADA9, StencilShadowAlloc, PATCH_CALL); + Nop(0x75ADE1, 3); + Patch(0x75ADAE, 0x2CEB); + Patch(0x75AE35, 0x5D5B5E5F); // pop edi, pop esi, pop ebx, pop ebp, retn + Patch(0x75AE39, 0xC3); + + // Proper aspect ratios static const float f43 = 4.0f/3.0f, f54 = 5.0f/4.0f, f169 = 16.0f/9.0f; Patch(0x73424B, &f169);