Fixed "Disable Out of Bounds Timer" (Player) not working in missions

This commit is contained in:
EricPlayZ
2024-05-03 01:22:19 +03:00
parent 0ec06592c4
commit 65e2dc3d44
3 changed files with 20 additions and 6 deletions

View File

@ -60,6 +60,7 @@ Thank you everyone for the support <3)" },
- Added "Disable Savegame CRC Check" (Misc; requires game restart to apply) - stops the game from falsely saying your savegame is corrupt whenever you modify it
- Fixed "God Mode" (Player) not working properly or at all in multiplayer
- Fixed volatiles still being able to kill you when they jump on top of you while "God Mode" (Player) is enabled
- Fixed "Disable Out of Bounds Timer" (Player) not working in missions
- Changed the config system to only write to the config file whenever there's a change in the mod menu)" }
};
}

View File

@ -64,15 +64,27 @@ namespace GamePH {
}
#pragma endregion
#pragma region IsNotOutOfBounds
static bool detourIsNotOutOfBounds(LPVOID pInstance, DWORD64 a2);
static Utils::Hook::MHook<LPVOID, bool(*)(LPVOID, DWORD64)> IsNotOutOfBoundsHook{ "IsNotOutOfBounds", &Offsets::Get_IsNotOutOfBounds, &detourIsNotOutOfBounds };
#pragma region IsNotOutOfMapBounds
static bool detourIsNotOutOfMapBounds(LPVOID pInstance, DWORD64 a2);
static Utils::Hook::MHook<LPVOID, bool(*)(LPVOID, DWORD64)> IsNotOutOfMapBoundsHook{ "IsNotOutOfMapBounds", &Offsets::Get_IsNotOutOfMapBounds, &detourIsNotOutOfMapBounds };
static bool detourIsNotOutOfBounds(LPVOID pInstance, DWORD64 a2) {
static bool detourIsNotOutOfMapBounds(LPVOID pInstance, DWORD64 a2) {
if (Menu::Player::disableOutOfBoundsTimer.GetValue())
return true;
return IsNotOutOfBoundsHook.pOriginal(pInstance, a2);
return IsNotOutOfMapBoundsHook.pOriginal(pInstance, a2);
}
#pragma endregion
#pragma region IsNotOutOfMissionBounds
static bool detourIsNotOutOfMissionBounds(LPVOID pInstance, DWORD64 a2);
static Utils::Hook::MHook<LPVOID, bool(*)(LPVOID, DWORD64)> IsNotOutOfMissionBoundsHook{ "IsNotOutOfMissionBounds", &Offsets::Get_IsNotOutOfMissionBounds, &detourIsNotOutOfMissionBounds };
static bool detourIsNotOutOfMissionBounds(LPVOID pInstance, DWORD64 a2) {
if (Menu::Player::disableOutOfBoundsTimer.GetValue())
return true;
return IsNotOutOfMissionBoundsHook.pOriginal(pInstance, a2);
}
#pragma endregion

View File

@ -62,7 +62,8 @@ struct Offsets {
AddOffset(ShowTPPModelFunc2, "gamedll_ph_x64_rwdi.dll", "40 53 48 83 EC ?? 48 8B 01 48 8B D9 FF 90 ?? ?? ?? ?? 84 C0 74 ?? 48 8B 83 ?? ?? ?? ?? 48 8B 88 ?? ?? ?? ?? 48 85 C9 74 ?? 48 83 B9 ?? ?? ?? ?? ?? 74 ?? 48 8B 81", Utils::SigScan::PatternType::Address, LPVOID)
AddOffset(ShowTPPModelFunc3, "gamedll_ph_x64_rwdi.dll", "48 83 EC ?? 38 91 ?? ?? ?? ?? 74 ?? 88 91", Utils::SigScan::PatternType::Address, LPVOID)
//AddOffset(CalculateOutOfBoundsTimer, "gamedll_ph_x64_rwdi.dll", "48 89 5C 24 ?? 48 89 74 24 ?? 57 48 81 EC ?? ?? ?? ?? 0F B6 99", PatternType::Address, LPVOID)
AddOffset(IsNotOutOfBounds, "gamedll_ph_x64_rwdi.dll", "48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 41 56 41 57 48 83 EC ?? 4C 8B F9 48 85 D2", Utils::SigScan::PatternType::Address, LPVOID)
AddOffset(IsNotOutOfMapBounds, "gamedll_ph_x64_rwdi.dll", "48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 41 56 41 57 48 83 EC ?? 4C 8B F9 48 85 D2", Utils::SigScan::PatternType::Address, LPVOID)
AddOffset(IsNotOutOfMissionBounds, "gamedll_ph_x64_rwdi.dll", "48 89 5C 24 ?? 57 48 83 EC ?? 48 8B F9 48 85 D2 74 ?? 48 8D 8A", Utils::SigScan::PatternType::Address, LPVOID)
AddOffset(ReloadJumps, "gamedll_ph_x64_rwdi.dll", "48 83 EC ?? E8 ?? ?? ?? ?? 48 8D 15", Utils::SigScan::PatternType::Address, LPVOID)
AddOffset(PlaySoundEvent, "gamedll_ph_x64_rwdi.dll", "4C 8B DC 49 89 5B ?? 49 89 73 ?? 57 48 81 EC ?? ?? ?? ?? 48 8B 44 24 ?? 48 8B F9 48 8B DA", Utils::SigScan::PatternType::Address, LPVOID)
AddOffset(CalculateFallHeight, "gamedll_ph_x64_rwdi.dll", "40 55 56 48 8D AC 24 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? 44 0F 29 9C 24", Utils::SigScan::PatternType::Address, LPVOID)