SA::Render compatibility

This commit is contained in:
Silent 2014-09-19 22:29:02 +02:00
parent 94637d52f9
commit cf0ff3df38

View file

@ -1482,11 +1482,18 @@ BOOL InjectDelayedPatches_10()
bool bHasImVehFt = GetModuleHandle("ImVehFt.asi") != nullptr; bool bHasImVehFt = GetModuleHandle("ImVehFt.asi") != nullptr;
bool bSAMP = GetModuleHandle("samp") != nullptr; bool bSAMP = GetModuleHandle("samp") != nullptr;
bool bSARender = GetModuleHandle("SARender.asi") != nullptr;
// PS2 sun - more // PS2 sun - more
DoSunAndMoon = (void(*)())(*(int*)0x53C137 + 0x53C136 + 5); DoSunAndMoon = (void(*)())(*(int*)0x53C137 + 0x53C136 + 5);
InjectHook(0x53C136, SunAndMoonFarClip); InjectHook(0x53C136, SunAndMoonFarClip);
if ( !bSARender )
{
// Twopass rendering (experimental)
Patch<BYTE>(0x4C441E, 0x57);
Patch<DWORD>(0x4C4424, 0x5F04C483);
Patch<DWORD>(0x4C4428, 0x0004C25E);
if ( GetPrivateProfileIntW(L"SilentPatch", L"TwoPassRendering", FALSE, wcModulePath) != FALSE ) if ( GetPrivateProfileIntW(L"SilentPatch", L"TwoPassRendering", FALSE, wcModulePath) != FALSE )
{ {
InjectHook(0x4C441F, SetRendererForAtomic<TwoPassAlphaRender>, PATCH_CALL); InjectHook(0x4C441F, SetRendererForAtomic<TwoPassAlphaRender>, PATCH_CALL);
@ -1498,23 +1505,6 @@ BOOL InjectDelayedPatches_10()
InjectHook(0x4C441F, SetRendererForAtomic<OnePassAlphaRender>, PATCH_CALL); InjectHook(0x4C441F, SetRendererForAtomic<OnePassAlphaRender>, PATCH_CALL);
} }
if ( GetPrivateProfileIntW(L"SilentPatch", L"EnableScriptFixes", TRUE, wcModulePath) != FALSE )
{
// Gym glitch fix
Patch<WORD>(0x470B03, 0xCD8B);
Patch<DWORD>(0x470B0A, 0x8B04508B);
Patch<WORD>(0x470B0E, 0x9000);
Nop(0x470B10, 1);
InjectHook(0x470B05, &CRunningScript::GetDay_GymGlitch, PATCH_CALL);
// Basketball fix
WipeLocalVariableMemoryForMissionScript = (void(*)())(*(int*)0x489A71 + 0x489A70 + 5);
TheScriptsLoad = (void(*)())(*(int*)0x5D18F1 + 0x5D18F0 + 5);
InjectHook(0x5D18F0, TheScriptsLoad_BasketballFix);
// Fixed for Hoodlum
InjectHook(0x489A70, StartNewMission_BasketballFix);
InjectHook(0x4899F0, StartNewMission_BasketballFix);
}
if ( !bSAMP && GetPrivateProfileIntW(L"SilentPatch", L"NVCShader", FALSE, wcModulePath) != FALSE ) if ( !bSAMP && GetPrivateProfileIntW(L"SilentPatch", L"NVCShader", FALSE, wcModulePath) != FALSE )
{ {
@ -1550,6 +1540,29 @@ BOOL InjectDelayedPatches_10()
Patch<float>(*(float**)0x7034C0, 0.0); Patch<float>(*(float**)0x7034C0, 0.0);
} }
// Weapons rendering
InjectHook(0x5E7859, RenderWeapon);
InjectHook(0x732F30, RenderWeaponPedsForPC, PATCH_JUMP);
}
if ( GetPrivateProfileIntW(L"SilentPatch", L"EnableScriptFixes", TRUE, wcModulePath) != FALSE )
{
// Gym glitch fix
Patch<WORD>(0x470B03, 0xCD8B);
Patch<DWORD>(0x470B0A, 0x8B04508B);
Patch<WORD>(0x470B0E, 0x9000);
Nop(0x470B10, 1);
InjectHook(0x470B05, &CRunningScript::GetDay_GymGlitch, PATCH_CALL);
// Basketball fix
WipeLocalVariableMemoryForMissionScript = (void(*)())(*(int*)0x489A71 + 0x489A70 + 5);
TheScriptsLoad = (void(*)())(*(int*)0x5D18F1 + 0x5D18F0 + 5);
InjectHook(0x5D18F0, TheScriptsLoad_BasketballFix);
// Fixed for Hoodlum
InjectHook(0x489A70, StartNewMission_BasketballFix);
InjectHook(0x4899F0, StartNewMission_BasketballFix);
}
if ( GetPrivateProfileIntW(L"SilentPatch", L"SkipIntroSplashes", TRUE, wcModulePath) != FALSE ) if ( GetPrivateProfileIntW(L"SilentPatch", L"SkipIntroSplashes", TRUE, wcModulePath) != FALSE )
{ {
// Skip the damn intro splash // Skip the damn intro splash
@ -1654,11 +1667,19 @@ BOOL InjectDelayedPatches_11()
bool bHasImVehFt = GetModuleHandle("ImVehFt.asi") != nullptr; bool bHasImVehFt = GetModuleHandle("ImVehFt.asi") != nullptr;
bool bSAMP = GetModuleHandle("samp") != nullptr; bool bSAMP = GetModuleHandle("samp") != nullptr;
bool bSARender = GetModuleHandle("SARender.asi") != nullptr;
// PS2 sun - more // PS2 sun - more
DoSunAndMoon = (void(*)())(*(int*)0x53C5D7 + 0x53C5D6 + 5); DoSunAndMoon = (void(*)())(*(int*)0x53C5D7 + 0x53C5D6 + 5);
InjectHook(0x53C5D6, SunAndMoonFarClip); InjectHook(0x53C5D6, SunAndMoonFarClip);
if ( !bSARender )
{
// Twopass rendering (experimental)
Patch<BYTE>(0x4C449E, 0x57);
Patch<DWORD>(0x4C44A4, 0x5F04C483);
Patch<DWORD>(0x4C44A8, 0x0004C25E);
if ( GetPrivateProfileIntW(L"SilentPatch", L"TwoPassRendering", FALSE, wcModulePath) != FALSE ) if ( GetPrivateProfileIntW(L"SilentPatch", L"TwoPassRendering", FALSE, wcModulePath) != FALSE )
{ {
InjectHook(0x4C449F, SetRendererForAtomic<TwoPassAlphaRender>, PATCH_CALL); InjectHook(0x4C449F, SetRendererForAtomic<TwoPassAlphaRender>, PATCH_CALL);
@ -1670,24 +1691,6 @@ BOOL InjectDelayedPatches_11()
InjectHook(0x4C449F, SetRendererForAtomic<OnePassAlphaRender>, PATCH_CALL); InjectHook(0x4C449F, SetRendererForAtomic<OnePassAlphaRender>, PATCH_CALL);
} }
if ( GetPrivateProfileIntW(L"SilentPatch", L"EnableScriptFixes", TRUE, wcModulePath) != FALSE )
{
// Gym glitch fix
Patch<WORD>(0x470B83, 0xCD8B);
Patch<DWORD>(0x470B8A, 0x8B04508B);
Patch<WORD>(0x470B8E, 0x9000);
Nop(0x470B90, 1);
InjectHook(0x470B85, &CRunningScript::GetDay_GymGlitch, PATCH_CALL);
// Basketball fix
WipeLocalVariableMemoryForMissionScript = (void(*)())(*(int*)0x489AF1 + 0x489AF0 + 5);
TheScriptsLoad = (void(*)())(*(int*)0x5D20D1 + 0x5D20D0 + 5);
InjectHook(0x5D20D0, TheScriptsLoad_BasketballFix);
// Fixed for Hoodlum
InjectHook(0x489A70, StartNewMission_BasketballFix);
InjectHook(0x489AF0, StartNewMission_BasketballFix);
}
if ( !bSAMP && GetPrivateProfileIntW(L"SilentPatch", L"NVCShader", FALSE, wcModulePath) != FALSE ) if ( !bSAMP && GetPrivateProfileIntW(L"SilentPatch", L"NVCShader", FALSE, wcModulePath) != FALSE )
{ {
// Shaders! // Shaders!
@ -1737,6 +1740,29 @@ BOOL InjectDelayedPatches_11()
Patch<float>(*(float**)0x703CF0, 0.0); Patch<float>(*(float**)0x703CF0, 0.0);
} }
// Weapons rendering
InjectHook(0x5E8079, RenderWeapon);
InjectHook(0x733760, RenderWeaponPedsForPC, PATCH_JUMP);
}
if ( GetPrivateProfileIntW(L"SilentPatch", L"EnableScriptFixes", TRUE, wcModulePath) != FALSE )
{
// Gym glitch fix
Patch<WORD>(0x470B83, 0xCD8B);
Patch<DWORD>(0x470B8A, 0x8B04508B);
Patch<WORD>(0x470B8E, 0x9000);
Nop(0x470B90, 1);
InjectHook(0x470B85, &CRunningScript::GetDay_GymGlitch, PATCH_CALL);
// Basketball fix
WipeLocalVariableMemoryForMissionScript = (void(*)())(*(int*)0x489AF1 + 0x489AF0 + 5);
TheScriptsLoad = (void(*)())(*(int*)0x5D20D1 + 0x5D20D0 + 5);
InjectHook(0x5D20D0, TheScriptsLoad_BasketballFix);
// Fixed for Hoodlum
InjectHook(0x489A70, StartNewMission_BasketballFix);
InjectHook(0x489AF0, StartNewMission_BasketballFix);
}
if ( GetPrivateProfileIntW(L"SilentPatch", L"SkipIntroSplashes", TRUE, wcModulePath) != FALSE ) if ( GetPrivateProfileIntW(L"SilentPatch", L"SkipIntroSplashes", TRUE, wcModulePath) != FALSE )
{ {
// Skip the damn intro splash // Skip the damn intro splash
@ -1834,11 +1860,19 @@ BOOL InjectDelayedPatches_Steam()
bool bHasImVehFt = GetModuleHandle("ImVehFt.asi") != nullptr; bool bHasImVehFt = GetModuleHandle("ImVehFt.asi") != nullptr;
bool bSAMP = GetModuleHandle("samp") != nullptr; bool bSAMP = GetModuleHandle("samp") != nullptr;
bool bSARender = GetModuleHandle("SARender.asi") != nullptr;
// PS2 sun - more // PS2 sun - more
DoSunAndMoon = (void(*)())(*(int*)0x54E0B7 + 0x54E0B6 + 5); DoSunAndMoon = (void(*)())(*(int*)0x54E0B7 + 0x54E0B6 + 5);
InjectHook(0x54E0B6, SunAndMoonFarClip); InjectHook(0x54E0B6, SunAndMoonFarClip);
if ( !bSARender )
{
// Twopass rendering (experimental)
Patch<BYTE>(0x4CEBF3, 0x57);
Patch<DWORD>(0x4CEBF9, 0xC25E5F5F);
Patch<WORD>(0x4CEBFD, 0x0004);
if ( GetPrivateProfileIntW(L"SilentPatch", L"TwoPassRendering", FALSE, wcModulePath) != FALSE ) if ( GetPrivateProfileIntW(L"SilentPatch", L"TwoPassRendering", FALSE, wcModulePath) != FALSE )
{ {
InjectHook(0x4CEBF4, SetRendererForAtomic<TwoPassAlphaRender>, PATCH_CALL); InjectHook(0x4CEBF4, SetRendererForAtomic<TwoPassAlphaRender>, PATCH_CALL);
@ -1850,24 +1884,6 @@ BOOL InjectDelayedPatches_Steam()
InjectHook(0x4CEBF4, SetRendererForAtomic<OnePassAlphaRender>, PATCH_CALL); InjectHook(0x4CEBF4, SetRendererForAtomic<OnePassAlphaRender>, PATCH_CALL);
} }
if ( GetPrivateProfileIntW(L"SilentPatch", L"EnableScriptFixes", TRUE, wcModulePath) != FALSE )
{
// Gym glitch fix
Patch<WORD>(0x476C2A, 0xCD8B);
Patch<DWORD>(0x476C31, 0x408B088B);
Patch<WORD>(0x476C35, 0x9004);
Nop(0x476C37, 1);
InjectHook(0x476C2C, &CRunningScript::GetDay_GymGlitch, PATCH_CALL);
// Basketball fix
WipeLocalVariableMemoryForMissionScript = (void(*)())(*(int*)0x4907AF + 0x4907AE + 5);
TheScriptsLoad = (void(*)())(*(int*)0x5EE018 + 0x5EE017 + 5);
InjectHook(0x5EE017, TheScriptsLoad_BasketballFix);
// Fixed for Hoodlum
InjectHook(0x4907AE, StartNewMission_BasketballFix);
InjectHook(0x49072E, StartNewMission_BasketballFix);
}
if ( !bSAMP && GetPrivateProfileIntW(L"SilentPatch", L"NVCShader", FALSE, wcModulePath) != FALSE ) if ( !bSAMP && GetPrivateProfileIntW(L"SilentPatch", L"NVCShader", FALSE, wcModulePath) != FALSE )
{ {
// Shaders! // Shaders!
@ -1904,6 +1920,29 @@ BOOL InjectDelayedPatches_Steam()
Patch<float>(*(float**)0x746E57, 0.0); Patch<float>(*(float**)0x746E57, 0.0);
} }
// Weapons rendering
InjectHook(0x604DD9, RenderWeapon);
InjectHook(0x76D170, RenderWeaponPedsForPC, PATCH_JUMP);
}
if ( GetPrivateProfileIntW(L"SilentPatch", L"EnableScriptFixes", TRUE, wcModulePath) != FALSE )
{
// Gym glitch fix
Patch<WORD>(0x476C2A, 0xCD8B);
Patch<DWORD>(0x476C31, 0x408B088B);
Patch<WORD>(0x476C35, 0x9004);
Nop(0x476C37, 1);
InjectHook(0x476C2C, &CRunningScript::GetDay_GymGlitch, PATCH_CALL);
// Basketball fix
WipeLocalVariableMemoryForMissionScript = (void(*)())(*(int*)0x4907AF + 0x4907AE + 5);
TheScriptsLoad = (void(*)())(*(int*)0x5EE018 + 0x5EE017 + 5);
InjectHook(0x5EE017, TheScriptsLoad_BasketballFix);
// Fixed for Hoodlum
InjectHook(0x4907AE, StartNewMission_BasketballFix);
InjectHook(0x49072E, StartNewMission_BasketballFix);
}
if ( GetPrivateProfileIntW(L"SilentPatch", L"SmallSteamTexts", TRUE, wcModulePath) == FALSE ) if ( GetPrivateProfileIntW(L"SilentPatch", L"SmallSteamTexts", TRUE, wcModulePath) == FALSE )
{ {
// We're on Steam - make texts bigger // We're on Steam - make texts bigger
@ -2047,25 +2086,6 @@ void Patch_SA_10()
// Make sure DirectInput mouse device is set non-exclusive (may not be needed?) // Make sure DirectInput mouse device is set non-exclusive (may not be needed?)
Patch<DWORD>(AddressByRegion_10<DWORD>(0x7469A0), 0x9090C030); Patch<DWORD>(AddressByRegion_10<DWORD>(0x7469A0), 0x9090C030);
// Weapons rendering
/*InjectHook(0x5E7859, RenderWeapon);
InjectHook(0x732F30, RenderWeaponsList, PATCH_JUMP);
//Patch<WORD>(0x53EAC4, 0x0DEB);
//Patch<WORD>(0x705322, 0x0DEB);
//Patch<WORD>(0x7271E3, 0x0DEB);
//Patch<BYTE>(0x73314E, 0xC3);
Patch<DWORD>(0x732F95, 0x560CEC83);
Patch<DWORD>(0x732FA2, 0x20245C8B);
Patch<WORD>(0x733128, 0x20EB);
Patch<WORD>(0x733135, 0x13EB);
Nop(0x732FBC, 5);
//Nop(0x732F93, 6);
//Nop(0x733144, 6);
Nop(0x732FA6, 6);
//Nop(0x5E46DA, 2);*/
InjectHook(0x5E7859, RenderWeapon);
InjectHook(0x732F30, RenderWeaponPedsForPC, PATCH_JUMP);
// Hunter interior & static_rotor for helis // Hunter interior & static_rotor for helis
InjectHook(0x4C78F2, HunterTest, PATCH_JUMP); InjectHook(0x4C78F2, HunterTest, PATCH_JUMP);
InjectHook(0x4C9618, CacheCRC32); InjectHook(0x4C9618, CacheCRC32);
@ -2089,12 +2109,6 @@ void Patch_SA_10()
//Patch<DWORD>(0x733B55, 40); //Patch<DWORD>(0x733B55, 40);
//Patch<BYTE>(0x5B3ADD, 4); //Patch<BYTE>(0x5B3ADD, 4);
// Twopass rendering (experimental)
Patch<BYTE>(0x4C441E, 0x57);
//InjectHook(0x4C441F, SetRendererForAtomic, PATCH_CALL);
Patch<DWORD>(0x4C4424, 0x5F04C483);
Patch<DWORD>(0x4C4428, 0x0004C25E);
// Lightbeam fix // Lightbeam fix
Patch<WORD>(0x6A2E88, 0x0EEB); Patch<WORD>(0x6A2E88, 0x0EEB);
Nop(0x6A2E9C, 3); Nop(0x6A2E9C, 3);
@ -2268,10 +2282,6 @@ void Patch_SA_11()
// Make sure DirectInput mouse device is set non-exclusive (may not be needed?) // Make sure DirectInput mouse device is set non-exclusive (may not be needed?)
Patch<DWORD>(AddressByRegion_11<DWORD>(0x747270), 0x9090C030); Patch<DWORD>(AddressByRegion_11<DWORD>(0x747270), 0x9090C030);
// Weapons rendering
InjectHook(0x5E8079, RenderWeapon);
InjectHook(0x733760, RenderWeaponPedsForPC, PATCH_JUMP);
// Hunter interior & static_rotor for helis // Hunter interior & static_rotor for helis
InjectHook(0x4C7972, HunterTest, PATCH_JUMP); InjectHook(0x4C7972, HunterTest, PATCH_JUMP);
InjectHook(0x4C9818, CacheCRC32); InjectHook(0x4C9818, CacheCRC32);
@ -2279,11 +2289,6 @@ void Patch_SA_11()
// Moonphases // Moonphases
InjectHook(0x7142FB, HandleMoonStuffStub, PATCH_JUMP); InjectHook(0x7142FB, HandleMoonStuffStub, PATCH_JUMP);
// Twopass rendering (experimental)
Patch<BYTE>(0x4C449E, 0x57);
Patch<DWORD>(0x4C44A4, 0x5F04C483);
Patch<DWORD>(0x4C44A8, 0x0004C25E);
// Lightbeam fix // Lightbeam fix
Patch<WORD>(0x6A36A8, 0x0EEB); Patch<WORD>(0x6A36A8, 0x0EEB);
Nop(0x6A36BC, 3); Nop(0x6A36BC, 3);
@ -2473,10 +2478,6 @@ void Patch_SA_Steam()
// Make sure DirectInput mouse device is set non-exclusive (may not be needed?) // Make sure DirectInput mouse device is set non-exclusive (may not be needed?)
Patch<DWORD>(0x7807D0, 0x9090C030); Patch<DWORD>(0x7807D0, 0x9090C030);
// Weapons rendering
InjectHook(0x604DD9, RenderWeapon);
InjectHook(0x76D170, RenderWeaponPedsForPC, PATCH_JUMP);
// Hunter interior & static_rotor for helis // Hunter interior & static_rotor for helis
InjectHook(0x4D21E1, HunterTest, PATCH_JUMP); InjectHook(0x4D21E1, HunterTest, PATCH_JUMP);
InjectHook(0x4D3F1D, CacheCRC32); InjectHook(0x4D3F1D, CacheCRC32);
@ -2488,11 +2489,6 @@ void Patch_SA_Steam()
// Moonphases // Moonphases
InjectHook(0x72F058, HandleMoonStuffStub_Steam, PATCH_JUMP); InjectHook(0x72F058, HandleMoonStuffStub_Steam, PATCH_JUMP);
// Twopass rendering (experimental)
Patch<BYTE>(0x4CEBF3, 0x57);
Patch<DWORD>(0x4CEBF9, 0xC25E5F5F);
Patch<WORD>(0x4CEBFD, 0x0004);
// Lightbeam fix // Lightbeam fix
Patch<WORD>(0x6CFEF9, 0x10EB); Patch<WORD>(0x6CFEF9, 0x10EB);
Nop(0x6CFF0F, 3); Nop(0x6CFF0F, 3);