- Added "Current Weapon Durability" slider (Weapon) - currently only works while your weapon is physically equipped in your hand

- Added "Unlimited Durability" (Weapon)
This commit is contained in:
EricPlayZ
2024-05-10 03:05:31 +03:00
parent 7dc2fd4de1
commit 725b0bff41
19 changed files with 188 additions and 8 deletions

View File

@ -37,6 +37,7 @@
<ClCompile Include="source\game\GamePH\GameDI_PH2.cpp" />
<ClCompile Include="source\game\GamePH\gen_TPPModel.cpp" />
<ClCompile Include="source\game\GamePH\game_hooks.cpp" />
<ClCompile Include="source\game\GamePH\InventoryItem.cpp" />
<ClCompile Include="source\game\GamePH\LevelDI.cpp" />
<ClCompile Include="source\game\GamePH\LocalClientDI.cpp" />
<ClCompile Include="source\game\GamePH\LogicalPlayer.cpp" />
@ -97,6 +98,7 @@
<ClCompile Include="source\menu\menu.cpp" />
<ClCompile Include="source\menu\misc.cpp" />
<ClCompile Include="source\menu\player.cpp" />
<ClCompile Include="source\menu\weapon.cpp" />
<ClCompile Include="source\menu\world.cpp" />
<ClCompile Include="source\utils\files.cpp" />
<ClCompile Include="source\utils\hook.cpp" />
@ -137,6 +139,8 @@
<ClInclude Include="source\game\GamePH\GameDI_PH.h" />
<ClInclude Include="source\game\GamePH\GameDI_PH2.h" />
<ClInclude Include="source\game\GamePH\gen_TPPModel.h" />
<ClInclude Include="source\game\GamePH\InventoryItem.h" />
<ClInclude Include="source\game\GamePH\ItemDescWithContext.h" />
<ClInclude Include="source\game\GamePH\LevelDI.h" />
<ClInclude Include="source\game\GamePH\LocalClientDI.h" />
<ClInclude Include="source\game\GamePH\LogicalPlayer.h" />
@ -177,6 +181,7 @@
<ClInclude Include="source\menu\menu.h" />
<ClInclude Include="source\menu\misc.h" />
<ClInclude Include="source\menu\player.h" />
<ClInclude Include="source\menu\weapon.h" />
<ClInclude Include="source\menu\world.h" />
<ClInclude Include="source\MinHook\MinHook.h" />
<ClInclude Include="source\offsets.h" />

View File

@ -200,6 +200,12 @@
<ClCompile Include="source\utils\rtti.cpp">
<Filter>utils</Filter>
</ClCompile>
<ClCompile Include="source\menu\weapon.cpp">
<Filter>menu</Filter>
</ClCompile>
<ClCompile Include="source\game\GamePH\InventoryItem.cpp">
<Filter>game\GamePH</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="source\kiero.h" />
@ -423,6 +429,15 @@
<ClInclude Include="source\utils\rtti.h">
<Filter>utils</Filter>
</ClInclude>
<ClInclude Include="source\menu\weapon.h">
<Filter>menu</Filter>
</ClInclude>
<ClInclude Include="source\game\GamePH\InventoryItem.h">
<Filter>game\GamePH</Filter>
</ClInclude>
<ClInclude Include="source\game\GamePH\ItemDescWithContext.h">
<Filter>game\GamePH</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="MinHook">

View File

@ -59,8 +59,10 @@ Thank you everyone for the support <3)" },
- Added "Invisible to Enemies" (Player)
- Added "Disable Air Control" (Player)
- Added "Allow Grapple Hook in Safezone" (Player)
- Added "Current Weapon Durability" slider (Weapon) - currently only works while your weapon is physically equipped in your hand
- Added "Unlimited Durability" (Weapon)
- Added "Lens Distortion" slider (Camera)
- Added "Disable Head Correction" (Player) - disables centering of the player's hands to the center of the camera
- Added "Disable Head Correction" (Camera) - disables centering of the player's hands to the center of the camera
- 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
- 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

@ -3,6 +3,7 @@
#include "..\menu\menu.h"
#include "..\menu\misc.h"
#include "..\menu\player.h"
#include "..\menu\weapon.h"
#include "..\menu\world.h"
#include "config.h"
@ -4351,6 +4352,7 @@ namespace Config {
{ "Menu:Keybinds", "OneHandedModeToggleKey", std::string("VK_NONE"), &Menu::Player::oneHandedMode, 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", "UnlimitedDurabilityToggleKey", std::string("VK_NONE"), &Menu::Weapon::unlimitedDurability, 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},
@ -4374,6 +4376,7 @@ namespace Config {
{ "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 },
{ "Weapon:Misc", "UnlimitedDurability", false, &Menu::Weapon::unlimitedDurability, OPTION },
{ "Camera:FreeCam", "Speed", 2.0f, &Menu::Camera::freeCamSpeed, Float },
{ "Camera:FreeCam", "TeleportPlayerToCamera", false, &Menu::Camera::teleportPlayerToCamera, OPTION },
{ "Camera:ThirdPerson", "Enabled", false, &Menu::Camera::thirdPersonCamera, OPTION },

View File

@ -13,7 +13,6 @@ namespace GamePH {
};
float GetGameTimeDelta();
DWORD64 GetCurrentGameVersion();
void TogglePhotoMode(bool doNothing = false, bool setAsOptionalCamera = false);
static GameDI_PH* Get();

View File

@ -0,0 +1,20 @@
#include <pch.h>
#include "..\offsets.h"
#include "InventoryItem.h"
#include "ItemDescWithContext.h"
namespace GamePH {
ItemDescWithContext* InventoryItem::GetItemDescCtx() {
__try {
ItemDescWithContext* ptr = reinterpret_cast<ItemDescWithContext*>(reinterpret_cast<DWORD64>(this) + 0x40);
if (!Utils::Memory::IsValidPtrMod(ptr, "gamedll_ph_x64_rwdi.dll"))
return nullptr;
if (*reinterpret_cast<DWORD64**>(ptr) != Offsets::GetVT_ItemDescWithContext())
return nullptr;
return ptr;
} __except (EXCEPTION_EXECUTE_HANDLER) {
return nullptr;
}
}
}

View File

@ -0,0 +1,10 @@
#pragma once
#include "..\buffer.h"
#include "ItemDescWithContext.h"
namespace GamePH {
class InventoryItem {
public:
ItemDescWithContext* GetItemDescCtx();
};
}

View File

@ -0,0 +1,11 @@
#pragma once
#include "..\buffer.h"
namespace GamePH {
class ItemDescWithContext {
public:
union {
buffer<0xA8, float> weaponDurability;
};
};
}

View File

@ -1,5 +1,6 @@
#include <pch.h>
#include "..\offsets.h"
#include "InventoryItem.h"
#include "LevelDI.h"
#include "PlayerDI_PH.h"
@ -21,4 +22,22 @@ namespace GamePH {
return nullptr;
}
}
InventoryItem* PlayerDI_PH::GetCurrentWeapon(UINT indexMaybe) {
__try {
LPVOID(*pPlayerGetCurrentWeapon)(LPVOID pPlayerDI_PH, UINT indexMaybe) = (decltype(pPlayerGetCurrentWeapon))Offsets::Get_PlayerGetCurrentWeapon();
if (!pPlayerGetCurrentWeapon)
return nullptr;
InventoryItem* ptr = reinterpret_cast<InventoryItem*>(pPlayerGetCurrentWeapon(this, indexMaybe));
if (!Utils::Memory::IsValidPtrMod(ptr, "gamedll_ph_x64_rwdi.dll"))
return nullptr;
if (*reinterpret_cast<DWORD64**>(ptr) != Offsets::GetVT_InventoryItem())
return nullptr;
return ptr;
} __except (EXCEPTION_EXECUTE_HANDLER) {
return nullptr;
}
}
}

View File

@ -1,9 +1,12 @@
#pragma once
#include "..\buffer.h"
#include "InventoryItem.h"
namespace GamePH {
class PlayerDI_PH {
public:
static PlayerDI_PH* Get();
InventoryItem* GetCurrentWeapon(UINT a1);
};
}

View File

@ -32,7 +32,7 @@ namespace Menu {
KeyBindOption disablePhotoModeLimits{ VK_NONE };
KeyBindOption disableSafezoneFOVReduction{ VK_NONE };
KeyBindOption disableHeadCorrection{ VK_NONE };
float baseSprintHeadCorrectionFactor = 0.55f;
static constexpr float baseSprintHeadCorrectionFactor = 0.55f;
static constexpr int baseFOV = 57;
static constexpr float baseSafezoneFOVReduction = -10.0f;

View File

@ -25,7 +25,7 @@ namespace Menu {
class Tab : MenuTab {
public:
Tab() : MenuTab("Camera", 1) {}
Tab() : MenuTab("Camera", 2) {}
void Update() override;
void Render() override;

View File

@ -5,7 +5,7 @@ namespace Menu {
namespace Debug {
class Tab : MenuTab {
public:
Tab() : MenuTab("Debug", 4) {}
Tab() : MenuTab("Debug", 5) {}
void Update() override;
void Render() override;

View File

@ -10,7 +10,7 @@ namespace Menu {
static ImVec2 EGTLogoSize = defEGTLogoSize;
static constexpr ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoScrollbar;
static constexpr ImVec2 defMinWndSize = ImVec2(425.0f, 725.0f);
static constexpr ImVec2 defMinWndSize = ImVec2(500.0f, 725.0f);
static ImVec2 minWndSize = defMinWndSize;
static constexpr ImVec2 defMaxWndSize = ImVec2(900.0f, 725.0f);
static ImVec2 maxWndSize = defMaxWndSize;

View File

@ -11,7 +11,7 @@ namespace Menu {
class Tab : MenuTab {
public:
Tab() : MenuTab("Misc", 2) {}
Tab() : MenuTab("Misc", 3) {}
void Update() override;
void Render() override;

View File

@ -0,0 +1,72 @@
#include <pch.h>
#include "..\core.h"
#include "..\game\GamePH\LevelDI.h"
#include "..\game\GamePH\PlayerDI_PH.h"
#include "..\game\GamePH\PlayerVariables.h"
#include "menu.h"
#include "weapon.h"
namespace Menu {
namespace Weapon {
float currentWeaponDurability = 150.0f;
KeyBindOption unlimitedDurability{ VK_NONE };
static constexpr float baseWeaponDurabilityMul = 1.0f;
static void UpdatePlayerVars() {
if (!GamePH::PlayerVariables::gotPlayerVars)
return;
GamePH::PlayerVariables::ManagePlayerVarOption("MeleeWpnDurabilityMulReduce", 0.0f, baseWeaponDurabilityMul, &unlimitedDurability, true);
}
static void UpdateWeaponDurability(bool updateSlider) {
GamePH::LevelDI* iLevel = GamePH::LevelDI::Get();
if (!iLevel || !iLevel->IsLoaded())
return;
GamePH::PlayerDI_PH* player = GamePH::PlayerDI_PH::Get();
if (!player)
return;
GamePH::InventoryItem* weaponItem = player->GetCurrentWeapon(0);
if (!weaponItem)
return;
GamePH::ItemDescWithContext* weaponItemCtx = weaponItem->GetItemDescCtx();
if (!weaponItemCtx)
return;
updateSlider ? (currentWeaponDurability = weaponItemCtx->weaponDurability) : (weaponItemCtx->weaponDurability = currentWeaponDurability);
}
static bool isWeaponInteractionDisabled() {
GamePH::LevelDI* iLevel = GamePH::LevelDI::Get();
if (!iLevel || !iLevel->IsLoaded())
return true;
GamePH::PlayerDI_PH* player = GamePH::PlayerDI_PH::Get();
if (!player)
return true;
GamePH::InventoryItem* weaponItem = player->GetCurrentWeapon(0);
if (!weaponItem || !weaponItem->GetItemDescCtx())
return true;
return false;
}
Tab Tab::instance{};
void Tab::Update() {
if (!Menu::menuToggle.GetValue())
UpdateWeaponDurability(true);
UpdatePlayerVars();
}
void Tab::Render() {
ImGui::SeparatorText("Current Weapon");
ImGui::BeginDisabled(isWeaponInteractionDisabled()); {
if (ImGui::SliderFloat("Weapon Durability", &currentWeaponDurability, 0.1f, 999.0f, "%.2f", ImGuiSliderFlags_AlwaysClamp))
UpdateWeaponDurability(false);
else
UpdateWeaponDurability(true);
ImGui::EndDisabled();
}
ImGui::SeparatorText("Misc");
ImGui::CheckboxHotkey("Unlimited Durability", &unlimitedDurability, "Enables unlimited durability for all weapons");
}
}
}

View File

@ -0,0 +1,18 @@
#pragma once
#include "..\core.h"
#include "menu.h"
namespace Menu {
namespace Weapon {
extern KeyBindOption unlimitedDurability;
class Tab : MenuTab {
public:
Tab() : MenuTab("Weapon", 1) {}
void Update() override;
void Render() override;
static Tab instance;
};
}
}

View File

@ -15,7 +15,7 @@ namespace Menu {
class Tab : MenuTab {
public:
Tab() : MenuTab("World", 3) {}
Tab() : MenuTab("World", 4) {}
void Update() override;
void Render() override;

View File

@ -51,6 +51,8 @@ struct Offsets {
AddVTOffset(DayNightCycle, "gamedll_ph_x64_rwdi.dll", "DayNightCycle", LPVOID)
AddVTOffset(FreeCamera, "gamedll_ph_x64_rwdi.dll", "FreeCamera", LPVOID)
AddVTOffset(GameDI_PH, "gamedll_ph_x64_rwdi.dll", "GameDI_PH", LPVOID)
AddVTOffset(InventoryItem, "gamedll_ph_x64_rwdi.dll", "InventoryItem", LPVOID)
AddVTOffset(ItemDescWithContext, "gamedll_ph_x64_rwdi.dll", "ItemDescWithContext", LPVOID)
AddVTOffset(LevelDI, "gamedll_ph_x64_rwdi.dll", "LevelDI", LPVOID)
AddVTOffset(LocalClientDI, "gamedll_ph_x64_rwdi.dll", "LocalClientDI", LPVOID)
AddVTOffset(LogicalPlayer, "gamedll_ph_x64_rwdi.dll", "LogicalPlayer", LPVOID)
@ -93,6 +95,7 @@ struct Offsets {
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(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(PlayerGetCurrentWeapon, "gamedll_ph_x64_rwdi.dll", "8B C2 48 8D 14 80 48 83 BC D1 ?? ?? ?? ?? ?? 74 ?? 48 8B 84 D1 ?? ?? ?? ?? C3 33 C0 C3 CC CC CC 8B C2", 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)