diff --git a/EGameTools/source/changelog.h b/EGameTools/source/changelog.h index bc4e917..6b4a0a0 100644 --- a/EGameTools/source/changelog.h +++ b/EGameTools/source/changelog.h @@ -58,6 +58,7 @@ Thank you everyone for the support <3)" }, - Added "Unlimited Stamina" (Player) - Added "Invisible to Enemies" (Player) - Added "Disable Air Control" (Player) +- Added "Disable Head Correction" (Player) - disables centering of the player's hands to the screen while jumping - Added "Allow Grapple Hook in Safezone" (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 scanning data PAKs, which allows you to use data PAK mods in multiplayer as well diff --git a/EGameTools/source/config/config.cpp b/EGameTools/source/config/config.cpp index a9d4e42..f2ed1a7 100644 --- a/EGameTools/source/config/config.cpp +++ b/EGameTools/source/config/config.cpp @@ -4349,8 +4349,9 @@ namespace Config { { "Menu:Keybinds", "DisableOutOfBoundsTimerToggleKey", std::string("VK_NONE"), &Menu::Player::disableOutOfBoundsTimer, String}, { "Menu:Keybinds", "NightrunnerModeToggleKey", std::string("VK_F9"), &Menu::Player::nightrunnerMode, String}, { "Menu:Keybinds", "OneHandedModeToggleKey", std::string("VK_NONE"), &Menu::Player::oneHandedMode, String}, - { "Menu:Keybinds", "DisableAirControlToggleKey", std::string("VK_NONE"), &Menu::Player::disableAirControl, String}, { "Menu:Keybinds", "AllowGrappleHookInSafezoneToggleKey", std::string("VK_NONE"), &Menu::Player::allowGrappleHookInSafezone, String}, + { "Menu:Keybinds", "DisableAirControlToggleKey", std::string("VK_NONE"), &Menu::Player::disableAirControl, String }, + { "Menu:Keybinds", "DisableHeadCorrectionToggleKey", std::string("VK_NONE"), &Menu::Player::disableHeadCorrection, String }, { "Menu:Keybinds", "FreeCamToggleKey", std::string("VK_F3"), &Menu::Camera::freeCam, String}, { "Menu:Keybinds", "TeleportPlayerToCameraToggleKey", std::string("VK_F4"), &Menu::Camera::teleportPlayerToCamera, String}, { "Menu:Keybinds", "ThirdPersonToggleKey", std::string("VK_F1"), &Menu::Camera::thirdPersonCamera, String}, @@ -4368,8 +4369,9 @@ namespace Config { { "Player:Misc", "DisableOutOfBoundsTimer", true, &Menu::Player::disableOutOfBoundsTimer, OPTION }, { "Player:Misc", "NightrunnerMode", false, &Menu::Player::nightrunnerMode, OPTION }, { "Player:Misc", "OneHandedMode", false, &Menu::Player::oneHandedMode, OPTION }, - { "Player:Misc", "DisableAirControl", false, &Menu::Player::disableAirControl, OPTION }, { "Player:Misc", "AllowGrappleHookInSafezone", false, &Menu::Player::allowGrappleHookInSafezone, OPTION }, + { "Player:PlayerJumpParameters", "DisableAirControl", false, &Menu::Player::disableAirControl, OPTION }, + { "Player:PlayerJumpParameters", "DisableHeadCorrection", false, &Menu::Player::disableHeadCorrection, OPTION }, { "Player:PlayerVariables", "Enabled", false, &Menu::Player::playerVariables, OPTION }, { "Player:PlayerVariables", "LastSaveSCRPath", std::string(), &Menu::Player::saveSCRPath, String }, { "Player:PlayerVariables", "LastLoadSCRFilePath", std::string(), &Menu::Player::loadSCRFilePath, String }, diff --git a/EGameTools/source/game/GamePH/game_hooks.cpp b/EGameTools/source/game/GamePH/game_hooks.cpp index 368d3dc..1a68930 100644 --- a/EGameTools/source/game/GamePH/game_hooks.cpp +++ b/EGameTools/source/game/GamePH/game_hooks.cpp @@ -238,31 +238,19 @@ namespace GamePH { } #pragma endregion -#pragma region ReadPlayerJumpParam - static bool isOnAllowVelocityMod = false; +#pragma region ReadPlayerJumpParams + static DWORD64 detourReadPlayerJumpParams(DWORD64 a1, DWORD64 a2, DWORD64 a3, char a4, DWORD64* a5); + static Utils::Hook::MHook ReadPlayerJumpParamsHook{ "ReadPlayerJumpParams", &Offsets::Get_ReadPlayerJumpParams, &detourReadPlayerJumpParams }; - static bool detourReadPlayerJumpParam(DWORD64 a1, const char* a2); - static Utils::Hook::MHook ReadPlayerJumpParamHook{ "ReadPlayerJumpParam", &Offsets::Get_ReadPlayerJumpParam, &detourReadPlayerJumpParam }; + static DWORD64 detourReadPlayerJumpParams(DWORD64 a1, DWORD64 a2, DWORD64 a3, char a4, DWORD64* a5) { + DWORD64 result = ReadPlayerJumpParamsHook.pOriginal(a1, a2, a3, a4, a5); - static bool detourReadPlayerJumpParam(DWORD64 a1, const char* a2) { - if (!strcmp(a2, "AllowVelocityMod")) - isOnAllowVelocityMod = true; + if (Menu::Player::disableAirControl.GetValue()) + *reinterpret_cast(a1 + Offsets::Get_allowVelocityMod_offset()) = false; + if (Menu::Player::disableHeadCorrection.GetValue()) + *reinterpret_cast(a1 + Offsets::Get_disableHeadCorrection_offset()) = true; - return ReadPlayerJumpParamHook.pOriginal(a1, a2); - } -#pragma endregion - -#pragma region GetBoolFromPlayerJumpParam - static bool detourGetBoolFromPlayerJumpParam(LPVOID a1); - static Utils::Hook::MHook GetBoolFromPlayerJumpParamHook{ "GetBoolFromPlayerJumpParam", &Offsets::Get_GetBoolFromPlayerJumpParam, &detourGetBoolFromPlayerJumpParam }; - - static bool detourGetBoolFromPlayerJumpParam(LPVOID a1) { - if (Menu::Player::disableAirControl.GetValue() && isOnAllowVelocityMod) { - isOnAllowVelocityMod = false; - return false; - } - - return GetBoolFromPlayerJumpParamHook.pOriginal(a1); + return result; } #pragma endregion diff --git a/EGameTools/source/menu/player.cpp b/EGameTools/source/menu/player.cpp index 7cd7c30..c181da3 100644 --- a/EGameTools/source/menu/player.cpp +++ b/EGameTools/source/menu/player.cpp @@ -6443,8 +6443,9 @@ namespace Menu { KeyBindOption disableOutOfBoundsTimer{ VK_NONE }; KeyBindOption nightrunnerMode{ VK_F9 }; KeyBindOption oneHandedMode{ VK_NONE }; - KeyBindOption disableAirControl{ VK_NONE }; KeyBindOption allowGrappleHookInSafezone{ VK_NONE }; + KeyBindOption disableAirControl{ VK_NONE }; + KeyBindOption disableHeadCorrection{ VK_NONE }; Option playerVariables{}; std::string saveSCRPath{}; @@ -6598,6 +6599,10 @@ namespace Menu { disableAirControl.SetPrevValue(disableAirControl.GetValue()); GamePH::ReloadJumps(); } + if (disableHeadCorrection.HasChanged()) { + disableHeadCorrection.SetPrevValue(disableHeadCorrection.GetValue()); + GamePH::ReloadJumps(); + } } Tab Tab::instance{}; @@ -6925,11 +6930,12 @@ namespace Menu { ImGui::CheckboxHotkey("Nightrunner Mode", &nightrunnerMode, "Makes Aiden super-human/infected"); ImGui::SameLine(); ImGui::CheckboxHotkey("One-handed Mode", &oneHandedMode, "Removes Aiden's left hand"); - ImGui::CheckboxHotkey("Disable Air Control", &disableAirControl, "Disables the ability to change the player's direction of momentum while in-air"); - ImGui::SameLine(); ImGui::CheckboxHotkey("Allow Grapple Hook in Safezone", &allowGrappleHookInSafezone, "Allows player to use grapple hook while in a safezone"); ImGui::SeparatorText("Player Jump Parameters"); + ImGui::CheckboxHotkey("Disable Air Control", &disableAirControl, "Disables the ability to change the player's direction of momentum while jumping (in-air)"); + ImGui::SameLine(); + ImGui::CheckboxHotkey("Disable Head Correction", &disableHeadCorrection, "Disables centering of the player's hands to the screen while jumping"); if (ImGui::Button("Reload Jump Params", "Reloads jump_parameters.scr from any mod located inside EGameTools\\UserModFiles")) { if (Utils::Files::FileExistsInDir("jump_parameters.scr", "EGameTools\\UserModFiles")) { GamePH::ReloadJumps(); diff --git a/EGameTools/source/menu/player.h b/EGameTools/source/menu/player.h index 6b92b4a..fba72ba 100644 --- a/EGameTools/source/menu/player.h +++ b/EGameTools/source/menu/player.h @@ -16,8 +16,9 @@ namespace Menu { extern KeyBindOption disableOutOfBoundsTimer; extern KeyBindOption nightrunnerMode; extern KeyBindOption oneHandedMode; - extern KeyBindOption disableAirControl; extern KeyBindOption allowGrappleHookInSafezone; + extern KeyBindOption disableAirControl; + extern KeyBindOption disableHeadCorrection; extern Option playerVariables; extern std::string saveSCRPath; diff --git a/EGameTools/source/offsets.h b/EGameTools/source/offsets.h index b263239..613aa68 100644 --- a/EGameTools/source/offsets.h +++ b/EGameTools/source/offsets.h @@ -60,6 +60,8 @@ struct Offsets { AddVTOffset(TPPCameraDI, "gamedll_ph_x64_rwdi.dll", "TPPCameraDI", LPVOID) AddStaticOffset(gameDI_PH2_offset, 0x28) + AddStaticOffset(allowVelocityMod_offset, 0x5C) + AddStaticOffset(disableHeadCorrection_offset, 0x108) AddOffset(CLobbySteam, "engine_x64_rwdi.dll", "48 8B 05 [?? ?? ?? ?? 48 85 C0 74 ?? 48 83 C0", Utils::SigScan::PatternType::RelativePointer, LPVOID) AddOffset(g_PlayerObjProperties, "gamedll_ph_x64_rwdi.dll", "48 89 0D [?? ?? ?? ?? E8 ?? ?? ?? ?? 48 85 C0", Utils::SigScan::PatternType::RelativePointer, LPVOID) AddOffset(g_DayNightCycle, "gamedll_ph_x64_rwdi.dll", "48 8B 0D [?? ?? ?? ?? 48 85 C9 74 ?? E8 ?? ?? ?? ?? 84 C0 74 ?? B0 ?? 48 83 C4 ?? C3 32 C0", Utils::SigScan::PatternType::RelativePointer, LPVOID) @@ -90,8 +92,7 @@ struct Offsets { 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(CanUseGrappleHook, "gamedll_ph_x64_rwdi.dll", "48 89 5C 24 ?? 57 48 83 EC ?? 48 8B 01 0F B6 FA 48 8B D9 FF 90 ?? ?? ?? ?? F6 80", Utils::SigScan::PatternType::Address, LPVOID) - AddOffset(ReadPlayerJumpParam, "gamedll_ph_x64_rwdi.dll", "48 8B 01 4C 8B C2 48 8B 48", Utils::SigScan::PatternType::Address, LPVOID) - AddOffset(GetBoolFromPlayerJumpParam, "gamedll_ph_x64_rwdi.dll", "40 53 48 83 EC ?? 48 83 79 ?? ?? 48 8B D9 74 ?? 48 8B 41 ?? 48 8B 48 ?? 48 8B 01 FF 50 ?? 85 C0", Utils::SigScan::PatternType::Address, LPVOID) + AddOffset(ReadPlayerJumpParams, "gamedll_ph_x64_rwdi.dll", "40 55 56 57 41 56 41 57 48 8D AC 24 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? 4C 8B B5", 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)