- Added "Invisible to Enemies" (Player)

- Changed Unlimited Immunity to use player variables instead of function hooking
This commit is contained in:
EricPlayZ
2024-05-04 00:58:15 +03:00
parent 1dcd0b884e
commit 3a51834d4b
5 changed files with 12 additions and 50 deletions

View File

@ -54,6 +54,7 @@ Thank you everyone for the support <3)" },
R"(- Added compatibility with v1.16.1 hotfix update
- Added "Player Immunity" slider (Player)
- Added "Unlimited Immunity" (Player)
- Added "Invisible to Enemies" (Player)
- Added "Increase Data PAKs Limit" (Misc; requires game restart to apply) - you can now add more than 8 data PAKs, e.g. data8.pak, data9.pak, data10.pak, etc, up to 200 PAKs in total
- Added "Disable Data PAKs CRC Check" (Misc; requires game restart to apply) - stops the game from detecting data PAKs, which allows you to use data PAK mods in multiplayer as well
- 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

View File

@ -223,51 +223,6 @@ namespace GamePH {
}
#pragma endregion
#pragma region CompareAndUpdateFloat
static bool funcHandlePlayerImmunityRunning = false;
static float detourCompareAndUpdateFloat(float result, float a1, float a2);
static Utils::Hook::MHook<LPVOID, float(*)(float, float, float)> CompareAndUpdateFloatHook{ "CompareAndUpdateFloat", &Offsets::Get_CompareAndUpdateFloat, &detourCompareAndUpdateFloat };
static float detourCompareAndUpdateFloat(float result, float a1, float a2) {
if (funcHandlePlayerImmunityRunning) {
LevelDI* iLevel = LevelDI::Get();
if (!iLevel || !iLevel->IsLoaded())
return CompareAndUpdateFloatHook.pOriginal(result, a1, a2);
GamePH::PlayerInfectionModule* playerInfectionModule = GamePH::PlayerInfectionModule::Get();
if (!playerInfectionModule)
return CompareAndUpdateFloatHook.pOriginal(result, a1, a2);
if (Menu::Player::unlimitedImmunity.GetValue())
return playerInfectionModule->immunity;
}
return CompareAndUpdateFloatHook.pOriginal(result, a1, a2);
}
#pragma endregion
#pragma region HandlePlayerImmunity
static void detourHandlePlayerImmunity(LPVOID pInstance, float a2);
static Utils::Hook::MHook<LPVOID, void(*)(LPVOID, float)> HandlePlayerImmunityHook{ "HandlePlayerImmunity", &Offsets::Get_HandlePlayerImmunity, &detourHandlePlayerImmunity };
static void detourHandlePlayerImmunity(LPVOID pInstance, float a2) {
funcHandlePlayerImmunityRunning = true;
HandlePlayerImmunityHook.pOriginal(pInstance, a2);
funcHandlePlayerImmunityRunning = false;
}
#pragma endregion
#pragma region HandlePlayerImmunity2
static void detourHandlePlayerImmunity2(LPVOID pInstance, DWORD64 a2, bool a3);
static Utils::Hook::MHook<LPVOID, void(*)(LPVOID, DWORD64 a2, bool a3)> HandlePlayerImmunity2Hook{ "HandlePlayerImmunity2", &Offsets::Get_HandlePlayerImmunity2, &detourHandlePlayerImmunity2 };
static void detourHandlePlayerImmunity2(LPVOID pInstance, DWORD64 a2, bool a3) {
funcHandlePlayerImmunityRunning = true;
HandlePlayerImmunity2Hook.pOriginal(pInstance, a2, a3);
funcHandlePlayerImmunityRunning = false;
}
#pragma endregion
#pragma region ByteHooks
static unsigned char SaveGameCRCBoolCheckBytes[3] = { 0xB3, 0x01, 0x90 }; // mov bl, 01
Utils::Hook::ByteHook<LPVOID> SaveGameCRCBoolCheckHook{ "SaveGameCRCBoolCheck", &Offsets::Get_SaveGameCRCBoolCheck, SaveGameCRCBoolCheckBytes, sizeof(SaveGameCRCBoolCheckBytes), &Menu::Misc::disableSavegameCRCCheck }; // and bl, dil

View File

@ -6438,6 +6438,7 @@ namespace Menu {
KeyBindOption godMode{ VK_F6 };
KeyBindOption unlimitedImmunity{ VK_NONE };
KeyBindOption freezePlayer{ VK_F7 };
KeyBindOption invisibleToEnemies{ VK_NONE };
KeyBindOption disableOutOfBoundsTimer{ VK_NONE };
KeyBindOption nightrunnerMode{ VK_F9 };
KeyBindOption oneHandedMode{ VK_NONE };
@ -6578,6 +6579,10 @@ namespace Menu {
GamePH::PlayerVariables::ManagePlayerVarOption("NightRunnerFurySmashEnabled", nightrunnerMode.GetValue(), !nightrunnerMode.GetValue(), &nightrunnerMode);
GamePH::PlayerVariables::ManagePlayerVarOption("NightRunnerFuryGroundPoundEnabled", nightrunnerMode.GetValue(), !nightrunnerMode.GetValue(), &nightrunnerMode);
GamePH::PlayerVariables::ManagePlayerVarOption("AntizinDrainBlocked", unlimitedImmunity.GetValue(), !unlimitedImmunity.GetValue(), &unlimitedImmunity);
GamePH::PlayerVariables::ManagePlayerVarOption("InVisibleToEnemies", invisibleToEnemies.GetValue(), !invisibleToEnemies.GetValue(), &invisibleToEnemies);
GamePH::PlayerVariables::ManagePlayerVarOption("LeftHandDisabled", oneHandedMode.GetValue(), !oneHandedMode.GetValue(), &oneHandedMode);
}
static void UpdateDisabledOptions() {
@ -6887,8 +6892,7 @@ namespace Menu {
ImGui::EndDisabled();
}
GamePH::PlayerInfectionModule* playerInfectionModule = GamePH::PlayerInfectionModule::Get();
ImGui::BeginDisabled(!playerInfectionModule);
{
ImGui::BeginDisabled(!playerInfectionModule); {
if (ImGui::SliderFloat("Player Immunity", &playerImmunity, 0.0f, playerMaxImmunity, "%.2f") && playerInfectionModule)
playerInfectionModule->immunity = playerImmunity / 100.0f;
else if (playerInfectionModule)
@ -6903,6 +6907,7 @@ namespace Menu {
ImGui::EndDisabled();
}
ImGui::SameLine();
ImGui::CheckboxHotkey("Invisible to Enemies", &invisibleToEnemies);
ImGui::CheckboxHotkey("Disable Out of Bounds Timer", &disableOutOfBoundsTimer);
ImGui::CheckboxHotkey("Nightrunner Mode", &nightrunnerMode);
ImGui::SameLine();

View File

@ -11,6 +11,7 @@ namespace Menu {
extern KeyBindOption godMode;
extern KeyBindOption unlimitedImmunity;
extern KeyBindOption freezePlayer;
extern KeyBindOption invisibleToEnemies;
extern KeyBindOption disableOutOfBoundsTimer;
extern KeyBindOption nightrunnerMode;
extern KeyBindOption oneHandedMode;

View File

@ -70,9 +70,9 @@ struct Offsets {
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)
AddOffset(PlayerHealthModuleKillPlayer, "gamedll_ph_x64_rwdi.dll", "40 53 48 83 EC ?? 48 8B 01 48 8B D9 FF 90 ?? ?? ?? ?? 84 C0 74 ?? 48 8B 4B ?? 48 81 C1 ?? ?? ?? ?? 48 8B 01 FF 50", Utils::SigScan::PatternType::Address, LPVOID)
AddOffset(CompareAndUpdateFloat, "gamedll_ph_x64_rwdi.dll", "0F 2F C1 73 ?? 0F 28 C1 C3", Utils::SigScan::PatternType::Address, LPVOID)
AddOffset(HandlePlayerImmunity, "gamedll_ph_x64_rwdi.dll", "48 8B C4 53 56 57 41 56 41 57", Utils::SigScan::PatternType::Address, LPVOID)
AddOffset(HandlePlayerImmunity2, "gamedll_ph_x64_rwdi.dll", "40 55 56 41 56 41 57 48 8D 6C 24 ?? 48 81 EC ?? ?? ?? ?? 48 8B F1 45 0F B6 F0", Utils::SigScan::PatternType::Address, LPVOID)
//AddOffset(CompareAndUpdateFloat, "gamedll_ph_x64_rwdi.dll", "0F 2F C1 73 ?? 0F 28 C1 C3", Utils::SigScan::PatternType::Address, LPVOID)
//AddOffset(HandlePlayerImmunity, "gamedll_ph_x64_rwdi.dll", "48 8B C4 53 56 57 41 56 41 57", Utils::SigScan::PatternType::Address, LPVOID)
//AddOffset(HandlePlayerImmunity2, "gamedll_ph_x64_rwdi.dll", "40 55 56 41 56 41 57 48 8D 6C 24 ?? 48 81 EC ?? ?? ?? ?? 48 8B F1 45 0F B6 F0", Utils::SigScan::PatternType::Address, LPVOID)
//AddOffset(HandleFallHeight, "gamedll_ph_x64_rwdi.dll", "48 89 5C 24 ?? 57 48 83 EC ?? 0F B6 FA 48 8B D9 0F B6 91", Utils::SigScan::PatternType::Address, LPVOID)
//AddOffset(HandlePlayerFall, "gamedll_ph_x64_rwdi.dll", "48 89 5C 24 ?? 57 48 83 EC ?? 0F 29 74 24 ?? 48 8B FA 0F 28 F2", Utils::SigScan::PatternType::Address, LPVOID)
//AddOffset(GetTimeWeatherSystem, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? 33 D2 48 8B C8 E8 ?? ?? ?? ?? 49 8D 4F 38", PatternType::RelativePointer, LPVOID)