mirror of
https://github.com/EricPlayZ/EGameTools.git
synced 2025-07-18 17:37:53 +08:00
Added Player Health slider, added Disable Out of Bounds Timer, added Disable HUD, now using less function signatures, therefore less effort is required when updating the mod! Also cleaned up the code a lot, it's now a bit more organized.
This commit is contained in:
@ -33,6 +33,7 @@
|
||||
<ClCompile Include="source\memory.cpp" />
|
||||
<ClCompile Include="source\menu\camera.cpp" />
|
||||
<ClCompile Include="source\menu\menu.cpp" />
|
||||
<ClCompile Include="source\menu\misc.cpp" />
|
||||
<ClCompile Include="source\menu\player.cpp" />
|
||||
<ClCompile Include="source\menu\world.cpp" />
|
||||
<ClCompile Include="source\sigscan\sigscan.cpp" />
|
||||
@ -68,6 +69,7 @@
|
||||
<ClInclude Include="source\memory.h" />
|
||||
<ClInclude Include="source\menu\camera.h" />
|
||||
<ClInclude Include="source\menu\menu.h" />
|
||||
<ClInclude Include="source\menu\misc.h" />
|
||||
<ClInclude Include="source\menu\player.h" />
|
||||
<ClInclude Include="source\menu\world.h" />
|
||||
<ClInclude Include="source\MinHook\include\MinHook.h" />
|
||||
|
@ -65,6 +65,9 @@
|
||||
<ClCompile Include="source\ImGuiEx\ImGuiEx.cpp">
|
||||
<Filter>ImGuiEx</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="source\menu\misc.cpp">
|
||||
<Filter>menu</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="source\memory.h" />
|
||||
@ -161,6 +164,9 @@
|
||||
<ClInclude Include="source\ImGuiEx\ImGuiEx.h">
|
||||
<Filter>ImGuiEx</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="source\menu\misc.h">
|
||||
<Filter>menu</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="MinHook">
|
||||
|
@ -22,7 +22,7 @@ LRESULT __stdcall hkWindowProc(_In_ HWND hwnd, _In_ UINT uMsg, _In_ WPARAM wPara
|
||||
if (ImGui::isAnyHotkeyBtnPressed || !ImGui::timeSinceHotkeyBtnPressed.GetTimePassed() || KeyBindOption::wasAnyKeyPressed)
|
||||
break;
|
||||
|
||||
for (auto& option : KeyBindOption::GetInstances()) {
|
||||
for (auto& option : *KeyBindOption::GetInstances()) {
|
||||
if (option->GetImGuiDisabled())
|
||||
continue;
|
||||
if (wParam == option->GetKeyBind()) {
|
||||
@ -36,7 +36,7 @@ LRESULT __stdcall hkWindowProc(_In_ HWND hwnd, _In_ UINT uMsg, _In_ WPARAM wPara
|
||||
if (!KeyBindOption::wasAnyKeyPressed)
|
||||
break;
|
||||
|
||||
for (auto& option : KeyBindOption::GetInstances()) {
|
||||
for (auto& option : *KeyBindOption::GetInstances()) {
|
||||
if (wParam == option->GetKeyBind())
|
||||
KeyBindOption::wasAnyKeyPressed = false;
|
||||
}
|
||||
|
@ -2,7 +2,11 @@
|
||||
#include <array>
|
||||
#include <filesystem>
|
||||
#include <functional>
|
||||
#include "..\menu\camera.h"
|
||||
#include "..\menu\menu.h"
|
||||
#include "..\menu\misc.h"
|
||||
#include "..\menu\player.h"
|
||||
#include "..\menu\world.h"
|
||||
#include "..\print.h"
|
||||
#include "..\utils.h"
|
||||
#include "config.h"
|
||||
@ -4024,6 +4028,7 @@ namespace Config {
|
||||
{ "Menu:Keybinds", "TeleportPlayerToCameraToggleKey", std::string("VK_F4"), &Menu::Camera::teleportPlayerToCamera, String},
|
||||
{ "Menu:Keybinds", "ThirdPersonToggleKey", std::string("VK_F1"), &Menu::Camera::thirdPersonCamera, String},
|
||||
{ "Menu:Keybinds", "UseTPPModelToggleKey", std::string("VK_F2"), &Menu::Camera::tpUseTPPModel, String},
|
||||
{ "Menu:Keybinds", "DisableHUDToggleKey", std::string("VK_F8"), &Menu::Misc::disableHUD, String},
|
||||
{ "Player:Misc", "GodMode", false, &Menu::Player::godMode, OPTION },
|
||||
{ "Player:Misc", "DisableOutOfBoundsTimer", true, &Menu::Player::disableOutOfBoundsTimer, OPTION },
|
||||
{ "Player:PlayerVariables", "Enabled", false, &Menu::Player::playerVariables, OPTION },
|
||||
@ -4132,9 +4137,13 @@ namespace Config {
|
||||
std::string strValue{};
|
||||
for (auto& entry : configVariablesDefault) {
|
||||
switch (entry.type) {
|
||||
case OPTION:
|
||||
reinterpret_cast<Option*>(entry.optionPtr)->SetBothValues(reader.Get(entry.section.data(), entry.key.data(), std::any_cast<bool>(entry.value)));
|
||||
case OPTION: {
|
||||
Option* option = reinterpret_cast<Option*>(entry.optionPtr);
|
||||
if (option->GetImGuiDisabled())
|
||||
break;
|
||||
option->SetBothValues(reader.Get(entry.section.data(), entry.key.data(), std::any_cast<bool>(entry.value)));
|
||||
break;
|
||||
}
|
||||
case Float:
|
||||
*reinterpret_cast<float*>(entry.optionPtr) = reader.Get(entry.section.data(), entry.key.data(), std::any_cast<float>(entry.value));
|
||||
break;
|
||||
|
@ -11,16 +11,8 @@
|
||||
#include "menu\menu.h"
|
||||
#include "sigscan\offsets.h"
|
||||
|
||||
#pragma region Option
|
||||
std::set<Option*> Option::instances{};
|
||||
std::set<Option*> Option::GetInstances() { return instances; };
|
||||
#pragma endregion
|
||||
|
||||
#pragma region KeyBindOption
|
||||
bool KeyBindOption::wasAnyKeyPressed = false;
|
||||
|
||||
std::set<KeyBindOption*> KeyBindOption::instances{};
|
||||
std::set<KeyBindOption*> KeyBindOption::GetInstances() { return instances; };
|
||||
#pragma endregion
|
||||
|
||||
namespace Core {
|
||||
@ -121,8 +113,8 @@ namespace Core {
|
||||
if (!GamePH::PlayerVariables::gotPlayerVars)
|
||||
GamePH::PlayerVariables::GetPlayerVars();
|
||||
|
||||
Menu::Player::Update();
|
||||
Menu::Camera::Update();
|
||||
for (auto& menuTab : *Menu::MenuTab::GetInstances())
|
||||
menuTab.second->Update();
|
||||
|
||||
/*Engine::CRTTI* g_BackgroundModuleScreenController = GamePH::BackgroundModuleScreenController::Get();
|
||||
if (!g_BackgroundModuleScreenController)
|
||||
@ -146,14 +138,10 @@ namespace Core {
|
||||
hookRendererThread = std::thread(LoopHookRenderer);
|
||||
hookRendererThread.detach();
|
||||
|
||||
GamePH::LoopHookCreatePlayerHealthModule();
|
||||
GamePH::LoopHookOnUpdate();
|
||||
GamePH::LoopHookCalculateFreeCamCollision();
|
||||
GamePH::LoopHookLifeSetHealth();
|
||||
GamePH::LoopHookTogglePhotoMode();
|
||||
GamePH::LoopHookMoveCameraFromForwardUpPos();
|
||||
GamePH::LoopHookShowTPPModelFunc3();
|
||||
GamePH::LoopHookIsNotOutOfBounds();
|
||||
for (auto& hook : *Hook::HookBase::GetInstances())
|
||||
hook->HookLoop();
|
||||
for (auto& hook : *Hook::HookBase::GetInstances())
|
||||
hook->HookLoop();
|
||||
|
||||
const HANDLE proc = GetCurrentProcess();
|
||||
WaitForSingleObject(proc, INFINITE);
|
||||
|
@ -21,9 +21,9 @@ struct Key {
|
||||
|
||||
class Option {
|
||||
public:
|
||||
Option() { instances.insert(this); };
|
||||
~Option() { instances.erase(this); }
|
||||
static std::set<Option*> GetInstances();
|
||||
Option() { GetInstances()->insert(this); };
|
||||
~Option() { GetInstances()->erase(this); }
|
||||
static std::set<Option*>* GetInstances() { static std::set<Option*> instances{}; return &instances; };
|
||||
|
||||
bool value = false;
|
||||
|
||||
@ -41,16 +41,14 @@ public:
|
||||
private:
|
||||
bool imGuiDisabled = false;
|
||||
bool previousValue = false;
|
||||
|
||||
static std::set<Option*> instances;
|
||||
};
|
||||
class KeyBindOption : public Option {
|
||||
public:
|
||||
static bool wasAnyKeyPressed;
|
||||
|
||||
KeyBindOption(int keyCode) : keyCode(keyCode) { instances.insert(this); };
|
||||
~KeyBindOption() { instances.erase(this); }
|
||||
static std::set<KeyBindOption*> GetInstances();
|
||||
KeyBindOption(int keyCode) : keyCode(keyCode) { GetInstances()->insert(this); };
|
||||
~KeyBindOption() { GetInstances()->erase(this); }
|
||||
static std::set<KeyBindOption*>* GetInstances() { static std::set<KeyBindOption*> instances{}; return &instances; };
|
||||
|
||||
const char* ToString() {
|
||||
if (const auto it = std::ranges::find(keyMap, keyCode, &Key::code); it != keyMap.end())
|
||||
@ -212,8 +210,6 @@ private:
|
||||
{ "]", VK_OEM_6, ImGuiKey_RightBracket },
|
||||
{ "`", VK_OEM_3, ImGuiKey_GraveAccent }
|
||||
});
|
||||
|
||||
static std::set<KeyBindOption*> instances;
|
||||
};
|
||||
|
||||
namespace Core {
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include "MinHook\include\MinHook.h"
|
||||
#include "config\config.h"
|
||||
#include "game_classes.h"
|
||||
#include "memory.h"
|
||||
#include "menu\camera.h"
|
||||
#include "menu\misc.h"
|
||||
#include "menu\player.h"
|
||||
#include "print.h"
|
||||
#include "sigscan\offsets.h"
|
||||
@ -18,153 +18,101 @@ namespace Core {
|
||||
#pragma region GamePH
|
||||
namespace GamePH {
|
||||
#pragma region Hooks
|
||||
#pragma region CreatePlayerHealthModule
|
||||
static DWORD64(*pCreatePlayerHealthModule)(DWORD64 playerHealthModule) = nullptr;
|
||||
static DWORD64(*oCreatePlayerHealthModule)(DWORD64 playerHealthModule) = nullptr;
|
||||
DWORD64 detourCreatePlayerHealthModule(DWORD64 playerHealthModule) {
|
||||
PlayerHealthModule::pPlayerHealthModule = reinterpret_cast<PlayerHealthModule*>(playerHealthModule);
|
||||
return oCreatePlayerHealthModule(playerHealthModule);
|
||||
}
|
||||
void LoopHookCreatePlayerHealthModule() {
|
||||
while (true) {
|
||||
Sleep(250);
|
||||
// Forward decl
|
||||
static DWORD64 detourCreatePlayerHealthModule(DWORD64 playerHealthModule);
|
||||
static void detourOnPostUpdate(LPVOID pGameDI_PH2);
|
||||
static DWORD64 detourCalculateFreeCamCollision(LPVOID pFreeCamera, float* finalPos);
|
||||
static void detourLifeSetHealth(float* pLifeHealth, float health);
|
||||
static void detourTogglePhotoMode(LPVOID guiPhotoModeData, bool enabled);
|
||||
static void detourShowTPPModelFunc3(DWORD64 a1, bool showTPPModel);
|
||||
static void detourMoveCameraFromForwardUpPos(LPVOID pCBaseCamera, float* a3, float* a4, Vector3* pos);
|
||||
static bool detourIsNotOutOfBounds(LPVOID pInstance, DWORD64 a2);
|
||||
static void detourShowUIManager(LPVOID pLevelDI, bool enabled);
|
||||
|
||||
if (!pCreatePlayerHealthModule)
|
||||
pCreatePlayerHealthModule = (decltype(pCreatePlayerHealthModule))Offsets::Get_CreatePlayerHealthModule();
|
||||
else if (!oCreatePlayerHealthModule && MH_CreateHook(pCreatePlayerHealthModule, &detourCreatePlayerHealthModule, reinterpret_cast<LPVOID*>(&oCreatePlayerHealthModule)) == MH_OK) {
|
||||
MH_EnableHook(pCreatePlayerHealthModule);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma region CreatePlayerHealthModule
|
||||
static Hook::MHook<LPVOID, DWORD64(*)(DWORD64)> CreatePlayerHealthModuleHook{ &Offsets::Get_CreatePlayerHealthModule, &detourCreatePlayerHealthModule };
|
||||
|
||||
static DWORD64 detourCreatePlayerHealthModule(DWORD64 playerHealthModule) {
|
||||
PlayerHealthModule::pPlayerHealthModule = reinterpret_cast<PlayerHealthModule*>(playerHealthModule);
|
||||
return CreatePlayerHealthModuleHook.pOriginal(playerHealthModule);
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region OnPostUpdate
|
||||
static void(*oOnPostUpdate)(LPVOID pGameDI_PH2) = nullptr;
|
||||
void detourOnPostUpdate(LPVOID pGameDI_PH2) {
|
||||
oOnPostUpdate(pGameDI_PH2);
|
||||
static Hook::VTHook<GamePH::GameDI_PH2*, void(*)(LPVOID)> OnPostUpdateHook{ &GamePH::GameDI_PH2::Get, &detourOnPostUpdate, 0x3A8 };
|
||||
|
||||
static void detourOnPostUpdate(LPVOID pGameDI_PH2) {
|
||||
OnPostUpdateHook.pOriginal(pGameDI_PH2);
|
||||
Core::OnPostUpdate();
|
||||
}
|
||||
void LoopHookOnUpdate() {
|
||||
GamePH::GameDI_PH2* pGameDI_PH2 = nullptr;
|
||||
|
||||
while (true) {
|
||||
Sleep(250);
|
||||
|
||||
pGameDI_PH2 = GamePH::GameDI_PH2::Get();
|
||||
if (!pGameDI_PH2)
|
||||
continue;
|
||||
|
||||
Hook::VTHook(pGameDI_PH2, &detourOnPostUpdate, reinterpret_cast<LPVOID*>(&oOnPostUpdate), 0x3a8);
|
||||
if (oOnPostUpdate)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CalculateFreeCamCollision
|
||||
static DWORD64(*pCalculateFreeCamCollision)(LPVOID pFreeCamera, float* finalPos) = nullptr;
|
||||
static DWORD64(*oCalculateFreeCamCollision)(LPVOID pFreeCamera, float* finalPos) = nullptr;
|
||||
DWORD64 detourCalculateFreeCamCollision(LPVOID pFreeCamera, float* finalPos) {
|
||||
static Hook::MHook<LPVOID, DWORD64(*)(LPVOID, float*)> CalculateFreeCamCollisionHook{ &Offsets::Get_CalculateFreeCamCollision, &detourCalculateFreeCamCollision };
|
||||
|
||||
static DWORD64 detourCalculateFreeCamCollision(LPVOID pFreeCamera, float* finalPos) {
|
||||
if (Menu::Camera::disablePhotoModeLimits.GetValue() || Menu::Camera::freeCam.GetValue())
|
||||
return 0;
|
||||
|
||||
return oCalculateFreeCamCollision(pFreeCamera, finalPos);
|
||||
}
|
||||
void LoopHookCalculateFreeCamCollision() {
|
||||
while (true) {
|
||||
Sleep(250);
|
||||
|
||||
if (!pCalculateFreeCamCollision)
|
||||
pCalculateFreeCamCollision = (decltype(pCalculateFreeCamCollision))Offsets::Get_CalculateFreeCamCollision();
|
||||
else if (!oCalculateFreeCamCollision && MH_CreateHook(pCalculateFreeCamCollision, &detourCalculateFreeCamCollision, reinterpret_cast<LPVOID*>(&oCalculateFreeCamCollision)) == MH_OK) {
|
||||
MH_EnableHook(pCalculateFreeCamCollision);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return CalculateFreeCamCollisionHook.pOriginal(pFreeCamera, finalPos);
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region LifeSetHealth
|
||||
static void(*pLifeSetHealth)(float* pLifeHealth, float health) = nullptr;
|
||||
static void(*oLifeSetHealth)(float* pLifeHealth, float health) = nullptr;
|
||||
void detourLifeSetHealth(float* pLifeHealth, float health) {
|
||||
static Hook::MHook<LPVOID, void(*)(float*, float)> LifeSetHealthHook{ &Offsets::Get_LifeSetHealth, &detourLifeSetHealth };
|
||||
|
||||
static void detourLifeSetHealth(float* pLifeHealth, float health) {
|
||||
if (!Menu::Player::godMode.GetValue() && !Menu::Camera::freeCam.GetValue())
|
||||
return oLifeSetHealth(pLifeHealth, health);
|
||||
return LifeSetHealthHook.pOriginal(pLifeHealth, health);
|
||||
|
||||
GamePH::PlayerHealthModule* playerHealthModule = GamePH::PlayerHealthModule::Get();
|
||||
if (!playerHealthModule)
|
||||
return oLifeSetHealth(pLifeHealth, health);
|
||||
return LifeSetHealthHook.pOriginal(pLifeHealth, health);
|
||||
GamePH::LevelDI* iLevel = GamePH::LevelDI::Get();
|
||||
if (!iLevel || !iLevel->IsLoaded())
|
||||
return oLifeSetHealth(pLifeHealth, health);
|
||||
return LifeSetHealthHook.pOriginal(pLifeHealth, health);
|
||||
|
||||
if (std::abs(reinterpret_cast<LONG64>(playerHealthModule) - reinterpret_cast<LONG64>(pLifeHealth)) < 0x100 && playerHealthModule->health > 0.0f)
|
||||
return;
|
||||
|
||||
oLifeSetHealth(pLifeHealth, health);
|
||||
}
|
||||
void LoopHookLifeSetHealth() {
|
||||
while (true) {
|
||||
Sleep(250);
|
||||
|
||||
if (!pLifeSetHealth)
|
||||
pLifeSetHealth = (decltype(pLifeSetHealth))Offsets::Get_LifeSetHealth();
|
||||
else if (!oLifeSetHealth && MH_CreateHook(pLifeSetHealth, &detourLifeSetHealth, reinterpret_cast<LPVOID*>(&oLifeSetHealth)) == MH_OK) {
|
||||
MH_EnableHook(pLifeSetHealth);
|
||||
break;
|
||||
}
|
||||
}
|
||||
LifeSetHealthHook.pOriginal(pLifeHealth, health);
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region TogglePhotoMode
|
||||
static void(*pTogglePhotoMode)(LPVOID guiPhotoModeData, bool enabled) = nullptr;
|
||||
static void(*oTogglePhotoMode)(LPVOID guiPhotoModeData, bool enabled) = nullptr;
|
||||
void detourTogglePhotoMode(LPVOID guiPhotoModeData, bool enabled) {
|
||||
static Hook::MHook<LPVOID, void(*)(LPVOID, bool)> TogglePhotoModeHook{ &Offsets::Get_TogglePhotoMode, &detourTogglePhotoMode };
|
||||
|
||||
static void detourTogglePhotoMode(LPVOID guiPhotoModeData, bool enabled) {
|
||||
Menu::Camera::photoMode.Set(enabled);
|
||||
|
||||
if (!Menu::Camera::freeCam.GetValue())
|
||||
return oTogglePhotoMode(guiPhotoModeData, enabled);
|
||||
return TogglePhotoModeHook.pOriginal(guiPhotoModeData, enabled);
|
||||
GamePH::GameDI_PH* pGameDI_PH = GamePH::GameDI_PH::Get();
|
||||
if (!pGameDI_PH)
|
||||
return oTogglePhotoMode(guiPhotoModeData, enabled);
|
||||
return TogglePhotoModeHook.pOriginal(guiPhotoModeData, enabled);
|
||||
GamePH::FreeCamera* pFreeCam = GamePH::FreeCamera::Get();
|
||||
if (!pFreeCam)
|
||||
return oTogglePhotoMode(guiPhotoModeData, enabled);
|
||||
return TogglePhotoModeHook.pOriginal(guiPhotoModeData, enabled);
|
||||
|
||||
if (enabled) {
|
||||
pGameDI_PH->TogglePhotoMode();
|
||||
pFreeCam->AllowCameraMovement(0);
|
||||
}
|
||||
|
||||
oTogglePhotoMode(guiPhotoModeData, enabled);
|
||||
}
|
||||
void LoopHookTogglePhotoMode() {
|
||||
while (true) {
|
||||
Sleep(250);
|
||||
|
||||
if (!pTogglePhotoMode)
|
||||
pTogglePhotoMode = (decltype(pTogglePhotoMode))Offsets::Get_TogglePhotoMode();
|
||||
else if (!oTogglePhotoMode && MH_CreateHook(pTogglePhotoMode, &detourTogglePhotoMode, reinterpret_cast<LPVOID*>(&oTogglePhotoMode)) == MH_OK) {
|
||||
MH_EnableHook(pTogglePhotoMode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
TogglePhotoModeHook.pOriginal(guiPhotoModeData, enabled);
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region ShowTPPModelFunc3
|
||||
static Option wannaUseTPPModel{};
|
||||
static Hook::MHook<LPVOID, void(*)(DWORD64, bool)> ShowTPPModelFunc3Hook{ &Offsets::Get_ShowTPPModelFunc3, &detourShowTPPModelFunc3 };
|
||||
|
||||
static void(*pShowTPPModelFunc3)(DWORD64 a1, bool showTPPModel) = nullptr;
|
||||
static void(*oShowTPPModelFunc3)(DWORD64 a1, bool showTPPModel) = nullptr;
|
||||
void detourShowTPPModelFunc3(DWORD64 a1, bool showTPPModel) {
|
||||
static void detourShowTPPModelFunc3(DWORD64 a1, bool showTPPModel) {
|
||||
wannaUseTPPModel.Set(showTPPModel);
|
||||
|
||||
gen_TPPModel* pgen_TPPModel = gen_TPPModel::Get();
|
||||
if (!pgen_TPPModel) {
|
||||
oShowTPPModelFunc3(a1, showTPPModel);
|
||||
ShowTPPModelFunc3Hook.pOriginal(a1, showTPPModel);
|
||||
return;
|
||||
}
|
||||
if (wannaUseTPPModel.HasChangedTo(false)) {
|
||||
@ -172,30 +120,17 @@ namespace GamePH {
|
||||
pgen_TPPModel->enableTPPModel2 = true;
|
||||
pgen_TPPModel->enableTPPModel1 = true;
|
||||
}
|
||||
oShowTPPModelFunc3(a1, showTPPModel);
|
||||
}
|
||||
void LoopHookShowTPPModelFunc3() {
|
||||
while (true) {
|
||||
Sleep(250);
|
||||
|
||||
if (!pShowTPPModelFunc3)
|
||||
pShowTPPModelFunc3 = (decltype(pShowTPPModelFunc3))Offsets::Get_ShowTPPModelFunc3();
|
||||
else if (!oShowTPPModelFunc3 && MH_CreateHook(pShowTPPModelFunc3, &detourShowTPPModelFunc3, reinterpret_cast<LPVOID*>(&oShowTPPModelFunc3)) == MH_OK) {
|
||||
MH_EnableHook(pShowTPPModelFunc3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ShowTPPModelFunc3Hook.pOriginal(a1, showTPPModel);
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region MoveCameraFromForwardUpPos
|
||||
static bool waitOneMoreFrame = false;
|
||||
static void(*pMoveCameraFromForwardUpPos)(LPVOID pCBaseCamera, float* a3, float* a4, Vector3* pos) = nullptr;
|
||||
static void(*oMoveCameraFromForwardUpPos)(LPVOID pCBaseCamera, float* a3, float* a4, Vector3* pos) = nullptr;
|
||||
void detourMoveCameraFromForwardUpPos(LPVOID pCBaseCamera, float* a3, float* a4, Vector3* pos) {
|
||||
static Hook::MHook<LPVOID, void(*)(LPVOID, float*, float*, Vector3*)> MoveCameraFromForwardUpPosHook{ &Offsets::Get_MoveCameraFromForwardUpPos, &detourMoveCameraFromForwardUpPos };
|
||||
|
||||
static void detourMoveCameraFromForwardUpPos(LPVOID pCBaseCamera, float* a3, float* a4, Vector3* pos) {
|
||||
GamePH::LevelDI* iLevel = GamePH::LevelDI::Get();
|
||||
if (!iLevel || !iLevel->IsLoaded())
|
||||
return oMoveCameraFromForwardUpPos(pCBaseCamera, a3, a4, pos);
|
||||
return MoveCameraFromForwardUpPosHook.pOriginal(pCBaseCamera, a3, a4, pos);
|
||||
|
||||
gen_TPPModel* pgen_TPPModel = gen_TPPModel::Get();
|
||||
if (pgen_TPPModel) {
|
||||
@ -255,11 +190,11 @@ namespace GamePH {
|
||||
}
|
||||
|
||||
if (!Menu::Camera::thirdPersonCamera.GetValue() || Menu::Camera::photoMode.GetValue() || Menu::Camera::freeCam.GetValue() || !pos)
|
||||
return oMoveCameraFromForwardUpPos(pCBaseCamera, a3, a4, pos);
|
||||
return MoveCameraFromForwardUpPosHook.pOriginal(pCBaseCamera, a3, a4, pos);
|
||||
|
||||
CameraFPPDI* viewCam = static_cast<CameraFPPDI*>(iLevel->GetViewCamera());
|
||||
if (!viewCam)
|
||||
return oMoveCameraFromForwardUpPos(pCBaseCamera, a3, a4, pos);
|
||||
return MoveCameraFromForwardUpPosHook.pOriginal(pCBaseCamera, a3, a4, pos);
|
||||
|
||||
Vector3 forwardVec{};
|
||||
viewCam->GetForwardVector(&forwardVec);
|
||||
@ -270,42 +205,32 @@ namespace GamePH {
|
||||
|
||||
*pos = newCamPos;
|
||||
|
||||
oMoveCameraFromForwardUpPos(pCBaseCamera, a3, a4, pos);
|
||||
}
|
||||
void LoopHookMoveCameraFromForwardUpPos() {
|
||||
while (true) {
|
||||
Sleep(250);
|
||||
|
||||
if (!pMoveCameraFromForwardUpPos)
|
||||
pMoveCameraFromForwardUpPos = (decltype(pMoveCameraFromForwardUpPos))Offsets::Get_MoveCameraFromForwardUpPos();
|
||||
else if (!oMoveCameraFromForwardUpPos && MH_CreateHook(pMoveCameraFromForwardUpPos, &detourMoveCameraFromForwardUpPos, reinterpret_cast<LPVOID*>(&oMoveCameraFromForwardUpPos)) == MH_OK) {
|
||||
MH_EnableHook(pMoveCameraFromForwardUpPos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
MoveCameraFromForwardUpPosHook.pOriginal(pCBaseCamera, a3, a4, pos);
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region IsNotOutOfBounds
|
||||
static bool(*pIsNotOutOfBounds)(LPVOID pInstance, DWORD64 a2) = nullptr;
|
||||
static bool(*oIsNotOutOfBounds)(LPVOID pInstance, DWORD64 a2) = nullptr;
|
||||
bool detourIsNotOutOfBounds(LPVOID pInstance, DWORD64 a2) {
|
||||
static Hook::MHook<LPVOID, bool(*)(LPVOID, DWORD64)> IsNotOutOfBoundsHook{ &Offsets::Get_IsNotOutOfBounds, &detourIsNotOutOfBounds };
|
||||
|
||||
static bool detourIsNotOutOfBounds(LPVOID pInstance, DWORD64 a2) {
|
||||
if (Menu::Player::disableOutOfBoundsTimer.GetValue())
|
||||
return true;
|
||||
|
||||
return oIsNotOutOfBounds(pInstance, a2);
|
||||
return IsNotOutOfBoundsHook.pOriginal(pInstance, a2);
|
||||
}
|
||||
void LoopHookIsNotOutOfBounds() {
|
||||
while (true) {
|
||||
Sleep(250);
|
||||
#pragma endregion
|
||||
|
||||
if (!pIsNotOutOfBounds)
|
||||
pIsNotOutOfBounds = (decltype(pIsNotOutOfBounds))Offsets::Get_IsNotOutOfBounds();
|
||||
else if (!oIsNotOutOfBounds && MH_CreateHook(pIsNotOutOfBounds, &detourIsNotOutOfBounds, reinterpret_cast<LPVOID*>(&oIsNotOutOfBounds)) == MH_OK) {
|
||||
MH_EnableHook(pIsNotOutOfBounds);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma region ShowUIManager
|
||||
static LPVOID GetShowUIManager() {
|
||||
return Utils::GetProcAddr("engine_x64_rwdi.dll", "?ShowUIManager@ILevel@@QEAAX_N@Z");
|
||||
}
|
||||
static Hook::MHook<LPVOID, void(*)(LPVOID, bool)> ShowUIManagerHook{ &GetShowUIManager, &detourShowUIManager };
|
||||
|
||||
static void detourShowUIManager(LPVOID pLevelDI, bool enabled) {
|
||||
if (Menu::Misc::disableHUD.GetValue())
|
||||
enabled = false;
|
||||
|
||||
ShowUIManagerHook.pOriginal(pLevelDI, enabled);
|
||||
}
|
||||
#pragma endregion
|
||||
#pragma endregion
|
||||
@ -325,13 +250,13 @@ namespace GamePH {
|
||||
DWORD64 tppFunc2Addr = ShowTPPModelFunc2(pGameDI_PH);
|
||||
if (!tppFunc2Addr)
|
||||
return;
|
||||
if (!pShowTPPModelFunc3)
|
||||
if (!ShowTPPModelFunc3Hook.pTarget)
|
||||
return;
|
||||
gen_TPPModel* pgen_TPPModel = gen_TPPModel::Get();
|
||||
if (!pgen_TPPModel)
|
||||
return;
|
||||
|
||||
pShowTPPModelFunc3(tppFunc2Addr, showTPPModel);
|
||||
ShowTPPModelFunc3Hook.pTarget(tppFunc2Addr, showTPPModel);
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
@ -499,7 +424,7 @@ namespace GamePH {
|
||||
__try {
|
||||
if (!pPlayerHealthModule)
|
||||
return nullptr;
|
||||
if (!*reinterpret_cast<PDWORD64*>(pPlayerHealthModule))
|
||||
if (!*reinterpret_cast<LPVOID*>(pPlayerHealthModule))
|
||||
return nullptr;
|
||||
|
||||
return pPlayerHealthModule;
|
||||
@ -534,19 +459,12 @@ namespace GamePH {
|
||||
|
||||
#pragma region CameraFPPDI
|
||||
Vector3* CameraFPPDI::GetForwardVector(Vector3* outForwardVec) {
|
||||
Vector3* (*pGetForwardVector)(LPVOID pCameraFPPDI, Vector3 * outForwardVec) = (decltype(pGetForwardVector))Offsets::Get_GetForwardVector();
|
||||
Vector3* (*pGetForwardVector)(LPVOID pCameraFPPDI, Vector3 * outForwardVec) = (decltype(pGetForwardVector))Utils::GetProcAddr("engine_x64_rwdi.dll", "?GetForwardVector@IBaseCamera@@QEBA?BVvec3@@XZ");
|
||||
if (!pGetForwardVector)
|
||||
return nullptr;
|
||||
|
||||
return pGetForwardVector(this, outForwardVec);
|
||||
}
|
||||
Vector3* CameraFPPDI::GetUpVector(Vector3* outUpVec) {
|
||||
Vector3* (*pGetUpVector)(LPVOID pCameraFPPDI, Vector3 * outUpVec) = (decltype(pGetUpVector))Offsets::Get_GetUpVector();
|
||||
if (!pGetUpVector)
|
||||
return nullptr;
|
||||
|
||||
return pGetUpVector(this, outUpVec);
|
||||
}
|
||||
Vector3* CameraFPPDI::GetPosition(Vector3* posIN) {
|
||||
return Memory::CallVT<181, Vector3*>(this, posIN);
|
||||
}
|
||||
@ -570,19 +488,12 @@ namespace GamePH {
|
||||
|
||||
#pragma region FreeCamera
|
||||
Vector3* FreeCamera::GetForwardVector(Vector3* outForwardVec) {
|
||||
Vector3* (*pGetForwardVector)(LPVOID pFreeCamera, Vector3 * outForwardVec) = (decltype(pGetForwardVector))Offsets::Get_GetForwardVector();
|
||||
Vector3* (*pGetForwardVector)(LPVOID pFreeCamera, Vector3 * outForwardVec) = (decltype(pGetForwardVector))Utils::GetProcAddr("engine_x64_rwdi.dll", "?GetForwardVector@IBaseCamera@@QEBA?BVvec3@@XZ");
|
||||
if (!pGetForwardVector)
|
||||
return nullptr;
|
||||
|
||||
return pGetForwardVector(this, outForwardVec);
|
||||
}
|
||||
Vector3* FreeCamera::GetUpVector(Vector3* outUpVec) {
|
||||
Vector3* (*pGetUpVector)(LPVOID pFreeCamera, Vector3 * outUpVec) = (decltype(pGetUpVector))Offsets::Get_GetUpVector();
|
||||
if (!pGetUpVector)
|
||||
return nullptr;
|
||||
|
||||
return pGetUpVector(this, outUpVec);
|
||||
}
|
||||
Vector3* FreeCamera::GetPosition(Vector3* posIN) {
|
||||
return Memory::CallVT<181, Vector3*>(this, posIN);
|
||||
}
|
||||
@ -635,20 +546,14 @@ namespace GamePH {
|
||||
namespace TimeWeather {
|
||||
#pragma region CSystem
|
||||
void CSystem::SetForcedWeather(int weather) {
|
||||
if (!Offsets::Get_SetForcedWeather())
|
||||
return;
|
||||
|
||||
void(*pSetForcedWeather)(LPVOID timeWeatherSystem, int weather) = (decltype(pSetForcedWeather))Offsets::Get_SetForcedWeather();
|
||||
void(*pSetForcedWeather)(LPVOID timeWeatherSystem, int weather) = (decltype(pSetForcedWeather))Utils::GetProcAddr("engine_x64_rwdi.dll", "?SetForcedWeather@CSystem@TimeWeather@@QEAAXW4TYPE@EWeather@@VApiDebugAccess@2@@Z");
|
||||
if (!pSetForcedWeather)
|
||||
return;
|
||||
|
||||
pSetForcedWeather(this, weather);
|
||||
}
|
||||
int CSystem::GetCurrentWeather() {
|
||||
if (!Offsets::Get_GetCurrentWeather())
|
||||
return EWeather::TYPE::Default;
|
||||
|
||||
int(*pGetCurrentWeather)(LPVOID timeWeatherSystem) = (decltype(pGetCurrentWeather))Offsets::Get_GetCurrentWeather();
|
||||
int(*pGetCurrentWeather)(LPVOID timeWeatherSystem) = (decltype(pGetCurrentWeather))Utils::GetProcAddr("engine_x64_rwdi.dll", "?GetCurrentWeather@CSystem@TimeWeather@@QEBA?AW4TYPE@EWeather@@XZ");
|
||||
if (!pGetCurrentWeather)
|
||||
return EWeather::TYPE::Default;
|
||||
|
||||
@ -676,10 +581,7 @@ namespace GamePH {
|
||||
|
||||
#pragma region LevelDI
|
||||
bool LevelDI::IsLoading() {
|
||||
if (!Offsets::Get_IsLoading())
|
||||
return true;
|
||||
|
||||
bool(*pIsLoading)(LPVOID iLevel) = (decltype(pIsLoading))Offsets::Get_IsLoading();
|
||||
bool(*pIsLoading)(LPVOID iLevel) = (decltype(pIsLoading))Utils::GetProcAddr("engine_x64_rwdi.dll", "?IsLoading@ILevel@@QEBA_NXZ");
|
||||
if (!pIsLoading)
|
||||
return true;
|
||||
|
||||
@ -699,10 +601,7 @@ namespace GamePH {
|
||||
return false;
|
||||
}
|
||||
LPVOID LevelDI::GetViewCamera() {
|
||||
if (!Offsets::Get_GetViewCamera())
|
||||
return nullptr;
|
||||
|
||||
LPVOID(*pGetViewCamera)(LPVOID iLevel) = (decltype(pGetViewCamera))Offsets::Get_GetViewCamera();
|
||||
LPVOID(*pGetViewCamera)(LPVOID iLevel) = (decltype(pGetViewCamera))Utils::GetProcAddr("engine_x64_rwdi.dll", "?GetViewCamera@ILevel@@QEBAPEAVIBaseCamera@@XZ");
|
||||
if (!pGetViewCamera)
|
||||
return nullptr;
|
||||
|
||||
@ -717,19 +616,19 @@ namespace GamePH {
|
||||
float LevelDI::GetTimePlayed() {
|
||||
return Memory::CallVT<317, float>(this);
|
||||
}
|
||||
void LevelDI::ShowUIManager(bool enabled) {
|
||||
void(*pShowUIManager)(LPVOID iLevel, bool enabled) = (decltype(pShowUIManager))Utils::GetProcAddr("engine_x64_rwdi.dll", "?ShowUIManager@ILevel@@QEAAX_N@Z");
|
||||
if (!pShowUIManager)
|
||||
return;
|
||||
|
||||
pShowUIManager(this, enabled);
|
||||
}
|
||||
TimeWeather::CSystem* LevelDI::GetTimeWeatherSystem() {
|
||||
__try {
|
||||
if (!Offsets::Get_GetTimeWeatherSystem())
|
||||
return nullptr;
|
||||
|
||||
TimeWeather::CSystem*(*pGetTimeWeatherSystem)(LevelDI* iLevel) = (decltype(pGetTimeWeatherSystem))Offsets::Get_GetTimeWeatherSystem();
|
||||
if (!pGetTimeWeatherSystem)
|
||||
return nullptr;
|
||||
|
||||
return pGetTimeWeatherSystem(this);
|
||||
} __except (EXCEPTION_EXECUTE_HANDLER) {
|
||||
TimeWeather::CSystem*(*pGetTimeWeatherSystem)(LevelDI* iLevel) = (decltype(pGetTimeWeatherSystem))Utils::GetProcAddr("engine_x64_rwdi.dll", "?GetTimeWeatherSystem@ILevel@@QEBAPEAVCSystem@TimeWeather@@XZ");
|
||||
if (!pGetTimeWeatherSystem)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return pGetTimeWeatherSystem(this);
|
||||
}
|
||||
|
||||
LevelDI* LevelDI::Get() {
|
||||
@ -826,10 +725,7 @@ namespace GamePH {
|
||||
|
||||
#pragma region GameDI_PH
|
||||
float GameDI_PH::GetGameTimeDelta() {
|
||||
if (!Offsets::Get_GetGameTimeDelta())
|
||||
return -1.0f;
|
||||
|
||||
float(*pGetGameTimeDelta)(LPVOID pGameDI_PH) = (decltype(pGetGameTimeDelta))Offsets::Get_GetGameTimeDelta();
|
||||
float(*pGetGameTimeDelta)(LPVOID pGameDI_PH) = (decltype(pGetGameTimeDelta))Utils::GetProcAddr("engine_x64_rwdi.dll", "?GetGameTimeDelta@IGame@@QEBAMXZ");
|
||||
if (!pGetGameTimeDelta)
|
||||
return -1.0f;
|
||||
|
||||
|
@ -93,15 +93,6 @@ namespace Engine {
|
||||
}
|
||||
|
||||
namespace GamePH {
|
||||
extern void LoopHookCreatePlayerHealthModule();
|
||||
extern void LoopHookOnUpdate();
|
||||
extern void LoopHookCalculateFreeCamCollision();
|
||||
extern void LoopHookLifeSetHealth();
|
||||
extern void LoopHookTogglePhotoMode();
|
||||
extern void LoopHookMoveCameraFromForwardUpPos();
|
||||
extern void LoopHookShowTPPModelFunc3();
|
||||
extern void LoopHookIsNotOutOfBounds();
|
||||
|
||||
extern void ShowTPPModel(bool showTPPModel);
|
||||
|
||||
class PlayerVariables {
|
||||
@ -247,6 +238,7 @@ namespace GamePH {
|
||||
float GetTimeDelta();
|
||||
void SetViewCamera(LPVOID viewCam);
|
||||
float GetTimePlayed();
|
||||
void ShowUIManager(bool enabled);
|
||||
TimeWeather::CSystem* GetTimeWeatherSystem();
|
||||
|
||||
static LevelDI* Get();
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
#include "sigscan\offsets.h"
|
||||
#include "hook.h"
|
||||
#include "sigscan\offsets.h"
|
||||
|
||||
namespace Hook {
|
||||
// VTable hooking
|
||||
@ -17,7 +17,7 @@ namespace Hook {
|
||||
VirtualProtect(mbi.BaseAddress, mbi.RegionSize, protection, &mbi.Protect);
|
||||
}
|
||||
|
||||
void VTHook(LPVOID instance, LPVOID pDetour, LPVOID* ppOriginal, const DWORD offset) {
|
||||
void HookVT(LPVOID instance, LPVOID pDetour, LPVOID* ppOriginal, const DWORD offset) {
|
||||
PDWORD64* entry = reinterpret_cast<PDWORD64*>(*reinterpret_cast<DWORD64*>(instance) + offset);
|
||||
*ppOriginal = *entry;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
#include <Windows.h>
|
||||
#include <functional>
|
||||
#include <set>
|
||||
#include "MinHook\include\MinHook.h"
|
||||
|
||||
namespace Hook {
|
||||
struct DETOUR_INFO {
|
||||
@ -18,7 +20,7 @@ namespace Hook {
|
||||
}
|
||||
};
|
||||
|
||||
extern void VTHook(LPVOID instance, LPVOID pDetour, LPVOID* ppOriginal, const DWORD offset);
|
||||
extern void HookVT(LPVOID instance, LPVOID pDetour, LPVOID* ppOriginal, const DWORD offset);
|
||||
|
||||
extern DETOUR_INFO MidFuncHook(LPVOID pTarget, LPVOID hookedFunc, const size_t nops = 0, const size_t bytesToSkip = 0);
|
||||
|
||||
@ -36,4 +38,69 @@ namespace Hook {
|
||||
void Disable();
|
||||
~BreakpointHook();
|
||||
};
|
||||
|
||||
class HookBase {
|
||||
public:
|
||||
HookBase() { GetInstances()->insert(this); }
|
||||
~HookBase() { GetInstances()->erase(this); }
|
||||
static std::set<HookBase*>* GetInstances() { static std::set<HookBase*> instances{}; return &instances; };
|
||||
|
||||
virtual void HookLoop() {};
|
||||
};
|
||||
template <typename GetTargetOffsetRetType, typename OrigType>
|
||||
class MHook : HookBase {
|
||||
public:
|
||||
MHook(GetTargetOffsetRetType(*pGetOffsetFunc)(), OrigType pDetour) : pGetOffsetFunc(pGetOffsetFunc), pDetour(pDetour) {}
|
||||
|
||||
void HookLoop() override {
|
||||
while (true) {
|
||||
Sleep(250);
|
||||
|
||||
if (!pGetOffsetFunc)
|
||||
continue;
|
||||
|
||||
if (!pTarget)
|
||||
pTarget = reinterpret_cast<OrigType>(pGetOffsetFunc());
|
||||
else if (!pOriginal && MH_CreateHook(pTarget, pDetour, reinterpret_cast<LPVOID*>(&pOriginal)) == MH_OK) {
|
||||
MH_EnableHook(pTarget);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OrigType pOriginal = nullptr;
|
||||
OrigType pTarget = nullptr;
|
||||
private:
|
||||
GetTargetOffsetRetType(*pGetOffsetFunc)() = nullptr;
|
||||
OrigType pDetour = nullptr;
|
||||
};
|
||||
template <typename GetTargetOffsetRetType, typename OrigType>
|
||||
class VTHook : HookBase {
|
||||
public:
|
||||
VTHook(GetTargetOffsetRetType(*pGetOffsetFunc)(), OrigType pDetour, DWORD offset) : pGetOffsetFunc(pGetOffsetFunc), pDetour(pDetour), offset(offset) {}
|
||||
|
||||
void HookLoop() override {
|
||||
while (true) {
|
||||
Sleep(250);
|
||||
|
||||
if (!pGetOffsetFunc)
|
||||
continue;
|
||||
|
||||
if (!pInstance)
|
||||
pInstance = pGetOffsetFunc();
|
||||
else if (!pOriginal) {
|
||||
Hook::HookVT(pInstance, pDetour, reinterpret_cast<LPVOID*>(&pOriginal), offset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OrigType pOriginal = nullptr;
|
||||
private:
|
||||
GetTargetOffsetRetType(*pGetOffsetFunc)() = nullptr;
|
||||
LPVOID pInstance = nullptr;
|
||||
OrigType pDetour = nullptr;
|
||||
|
||||
DWORD offset = 0x0;
|
||||
};
|
||||
}
|
@ -4,6 +4,7 @@
|
||||
#include "..\core.h"
|
||||
#include "..\game_classes.h"
|
||||
#include "..\sigscan\offsets.h"
|
||||
#include "camera.h"
|
||||
#include "menu.h"
|
||||
|
||||
namespace Menu {
|
||||
@ -27,7 +28,7 @@ namespace Menu {
|
||||
static const int baseFOV = 57;
|
||||
static const float baseSafezoneFOVReduction = -10.0f;
|
||||
|
||||
static void UpdateFOVWhileMenuClosed() {
|
||||
static void UpdateFOV() {
|
||||
if (menuToggle.GetValue())
|
||||
return;
|
||||
|
||||
@ -97,21 +98,25 @@ namespace Menu {
|
||||
}
|
||||
}
|
||||
|
||||
void Update() {
|
||||
UpdateFOVWhileMenuClosed();
|
||||
Tab Tab::instance{};
|
||||
void Tab::Update() {
|
||||
UpdateFOV();
|
||||
FreeCamUpdate();
|
||||
UpdatePlayerVars();
|
||||
}
|
||||
|
||||
void Render() {
|
||||
void Tab::Render() {
|
||||
GamePH::LevelDI* iLevel = GamePH::LevelDI::Get();
|
||||
ImGui::SeparatorText("Free Camera");
|
||||
ImGui::BeginDisabled(photoMode.GetValue(), &freeCam); {
|
||||
ImGui::BeginDisabled(!iLevel || !iLevel->IsLoaded() || photoMode.GetValue(), &freeCam); {
|
||||
ImGui::Checkbox("Enabled##FreeCam", &freeCam);
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
ImGui::Hotkey("##FreeCamToggleKey", freeCam);
|
||||
ImGui::SliderFloat("Speed##FreeCam", &freeCamSpeed, 0.0f, 100.0f);
|
||||
ImGui::Checkbox("Teleport Player to Camera", &teleportPlayerToCamera);
|
||||
ImGui::BeginDisabled(!iLevel || !iLevel->IsLoaded(), &teleportPlayerToCamera); {
|
||||
ImGui::Checkbox("Teleport Player to Camera", &teleportPlayerToCamera);
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
ImGui::Hotkey("##TeleportPlayerToCamToggleKey", teleportPlayerToCamera);
|
||||
|
||||
ImGui::SeparatorText("Third Person Camera");
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "..\core.h"
|
||||
#include "menu.h"
|
||||
|
||||
namespace Menu {
|
||||
namespace Camera {
|
||||
@ -19,7 +20,13 @@ namespace Menu {
|
||||
extern Option disablePhotoModeLimits;
|
||||
extern Option disableSafezoneFOVReduction;
|
||||
|
||||
extern void Update();
|
||||
extern void Render();
|
||||
class Tab : MenuTab {
|
||||
public:
|
||||
Tab() : MenuTab("Camera", 1) {}
|
||||
void Update() override;
|
||||
void Render() override;
|
||||
|
||||
static Tab instance;
|
||||
};
|
||||
}
|
||||
}
|
@ -1,9 +1,6 @@
|
||||
#include <Hotkey.h>
|
||||
#include <imgui.h>
|
||||
#include "camera.h"
|
||||
#include "menu.h"
|
||||
#include "player.h"
|
||||
#include "world.h"
|
||||
|
||||
namespace Menu {
|
||||
static const ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize;
|
||||
@ -20,17 +17,11 @@ namespace Menu {
|
||||
ImGui::SetNextWindowSizeConstraints(minWndSize, maxWndSize);
|
||||
ImGui::Begin("EGameTools", &menuToggle.value, windowFlags); {
|
||||
if (ImGui::BeginTabBar("##MainTabBar")) {
|
||||
if (ImGui::BeginTabItem("Player")) {
|
||||
Player::Render();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
if (ImGui::BeginTabItem("Camera")) {
|
||||
Camera::Render();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
if (ImGui::BeginTabItem("World")) {
|
||||
World::Render();
|
||||
ImGui::EndTabItem();
|
||||
for (auto& tab : *MenuTab::GetInstances()) {
|
||||
if (ImGui::BeginTabItem(tab.second->tabName.data())) {
|
||||
tab.second->Render();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
|
@ -1,10 +1,21 @@
|
||||
#pragma once
|
||||
#include "..\core.h"
|
||||
#include "camera.h"
|
||||
#include "player.h"
|
||||
#include "world.h"
|
||||
|
||||
namespace Menu {
|
||||
class MenuTab {
|
||||
public:
|
||||
MenuTab(std::string_view name, int tabIndex) : tabName(name), tabIndex(tabIndex) { GetInstances()->insert({ tabIndex, this}); };
|
||||
~MenuTab() { GetInstances()->erase({ tabIndex, this }); }
|
||||
static std::set<std::pair<int, MenuTab*>>* GetInstances() { static std::set<std::pair<int, MenuTab*>> instances{}; return &instances; };
|
||||
|
||||
virtual void Render() {};
|
||||
virtual void Update() {};
|
||||
|
||||
std::string_view tabName{};
|
||||
private:
|
||||
int tabIndex{};
|
||||
};
|
||||
|
||||
extern KeyBindOption menuToggle;
|
||||
extern float transparency;
|
||||
|
||||
|
32
DL2GameOverhaulScript/source/menu/misc.cpp
Normal file
32
DL2GameOverhaulScript/source/menu/misc.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include <Hotkey.h>
|
||||
#include <ImGuiEx.h>
|
||||
#include <imgui.h>
|
||||
#include "..\game_classes.h"
|
||||
#include "misc.h"
|
||||
|
||||
namespace Menu {
|
||||
namespace Misc {
|
||||
KeyBindOption disableHUD{ VK_F8 };
|
||||
|
||||
Tab Tab::instance{};
|
||||
void Tab::Update() {
|
||||
GamePH::LevelDI* iLevel = GamePH::LevelDI::Get();
|
||||
if (!iLevel)
|
||||
return;
|
||||
|
||||
if (disableHUD.HasChanged()) {
|
||||
disableHUD.SetPrevValue(disableHUD.GetValue());
|
||||
iLevel->ShowUIManager(!disableHUD.GetValue());
|
||||
}
|
||||
}
|
||||
void Tab::Render() {
|
||||
GamePH::LevelDI* iLevel = GamePH::LevelDI::Get();
|
||||
ImGui::SeparatorText("Misc##Misc");
|
||||
ImGui::BeginDisabled(!iLevel->IsLoaded(), &disableHUD); {
|
||||
ImGui::Checkbox("Disable HUD", &disableHUD);
|
||||
ImGui::Hotkey("##GodModeToggleKey", disableHUD);
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
17
DL2GameOverhaulScript/source/menu/misc.h
Normal file
17
DL2GameOverhaulScript/source/menu/misc.h
Normal file
@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include "menu.h"
|
||||
|
||||
namespace Menu {
|
||||
namespace Misc {
|
||||
extern KeyBindOption disableHUD;
|
||||
|
||||
class Tab : MenuTab {
|
||||
public:
|
||||
Tab() : MenuTab("Misc", 2) {}
|
||||
void Update() override;
|
||||
void Render() override;
|
||||
|
||||
static Tab instance;
|
||||
};
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,12 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "..\core.h"
|
||||
#include "menu.h"
|
||||
|
||||
namespace Menu {
|
||||
namespace Player {
|
||||
extern float playerHealth;
|
||||
extern float playerMaxHealth;
|
||||
extern KeyBindOption godMode;
|
||||
extern KeyBindOption freezePlayer;
|
||||
extern Option playerVariables;
|
||||
@ -12,7 +15,13 @@ namespace Menu {
|
||||
extern std::string saveSCRPath;
|
||||
extern std::string loadSCRFilePath;
|
||||
|
||||
extern void Update();
|
||||
extern void Render();
|
||||
class Tab : MenuTab {
|
||||
public:
|
||||
Tab() : MenuTab("Player", 0) {}
|
||||
void Update() override;
|
||||
void Render() override;
|
||||
|
||||
static Tab instance;
|
||||
};
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
#include <imgui.h>
|
||||
#include "..\game_classes.h"
|
||||
#include "world.h"
|
||||
|
||||
namespace Menu {
|
||||
namespace World {
|
||||
@ -16,10 +17,13 @@ namespace Menu {
|
||||
"Stormy"
|
||||
};
|
||||
|
||||
void Render() {
|
||||
Tab Tab::instance{};
|
||||
void Tab::Update() {}
|
||||
void Tab::Render() {
|
||||
GamePH::DayNightCycle* dayNightCycle = GamePH::DayNightCycle::Get();
|
||||
GamePH::LevelDI* iLevel = GamePH::LevelDI::Get();
|
||||
ImGui::SeparatorText("Misc##World");
|
||||
ImGui::BeginDisabled(!Engine::CBulletPhysicsCharacter::Get() || !dayNightCycle || dayNightCycle->time1 == 0.0f); {
|
||||
ImGui::BeginDisabled(!iLevel || !iLevel->IsLoaded() || !dayNightCycle || dayNightCycle->time1 == 0.0f); {
|
||||
if (ImGui::SliderFloat("Time", &time, 0.01f, 24.0f, "%.2f", ImGuiSliderFlags_AlwaysClamp) && dayNightCycle)
|
||||
dayNightCycle->SetDaytime(time);
|
||||
else if (dayNightCycle)
|
||||
@ -28,7 +32,7 @@ namespace Menu {
|
||||
}
|
||||
|
||||
GamePH::TimeWeather::CSystem* timeWeatherSystem = GamePH::TimeWeather::CSystem::Get();
|
||||
const bool weatherDisabledFlag = !Engine::CBulletPhysicsCharacter::Get() || !timeWeatherSystem;
|
||||
const bool weatherDisabledFlag = !iLevel || !iLevel->IsLoaded() || !timeWeatherSystem;
|
||||
|
||||
ImGui::SeparatorText("Weather");
|
||||
ImGui::BeginDisabled(weatherDisabledFlag); {
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "..\game_classes.h"
|
||||
#include "menu.h"
|
||||
|
||||
namespace Menu {
|
||||
namespace World {
|
||||
@ -7,6 +8,13 @@ namespace Menu {
|
||||
|
||||
extern EWeather::TYPE weather;
|
||||
|
||||
extern void Render();
|
||||
class Tab : MenuTab {
|
||||
public:
|
||||
Tab() : MenuTab("World", 3) {}
|
||||
void Update() override;
|
||||
void Render() override;
|
||||
|
||||
static Tab instance;
|
||||
};
|
||||
}
|
||||
}
|
@ -45,28 +45,28 @@ struct Offsets {
|
||||
//AddOffset(g_CameraFPPDI, "gamedll_ph_x64_rwdi.dll", "48 89 05 [?? ?? ?? ?? 40 84 FF", PatternType::RelativePointer, PDWORD64)
|
||||
AddOffset(g_FreeCamera, "gamedll_ph_x64_rwdi.dll", "48 89 05 [?? ?? ?? ?? 48 89 4C 24 ??", PatternType::RelativePointer, PDWORD64)
|
||||
AddStaticOffset2(g_BackgroundModuleScreenController, "gamedll_ph_x64_rwdi.dll", 0x3377760)
|
||||
AddOffset(CameraFPPDI_VT, "gamedll_ph_x64_rwdi.dll", "48 8D 05 [?? ?? ?? ?? 48 89 07 48 8D 4F 60", PatternType::RelativePointer, DWORD64)
|
||||
//AddOffset(CameraFPPDI_VT, "gamedll_ph_x64_rwdi.dll", "48 8D 05 [?? ?? ?? ?? 48 89 07 48 8D 4F 60", PatternType::RelativePointer, DWORD64)
|
||||
|
||||
// Functions
|
||||
AddOffset(ReadVideoSettings, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? 48 8D 4C 24 ?? FF 15 ?? ?? ?? ?? 48 C7 C2 ?? ?? ?? ??", PatternType::RelativePointer, LPVOID)
|
||||
AddOffset(CalculateFreeCamCollision, "gamedll_ph_x64_rwdi.dll", "E8 [?? ?? ?? ?? 48 8B 06 4C 8D 4C 24 ??", PatternType::RelativePointer, LPVOID)
|
||||
AddOffset(GetViewCamera, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? 48 85 C0 74 28 48 8B C8", PatternType::RelativePointer, LPVOID)
|
||||
//AddOffset(GetViewCamera, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? 48 85 C0 74 28 48 8B C8", PatternType::RelativePointer, LPVOID)
|
||||
AddOffset(CreatePlayerHealthModule, "gamedll_ph_x64_rwdi.dll", "48 89 5C 24 ?? 55 56 57 41 54 41 55 41 56 41 57 48 8D 6C 24 ?? 48 81 EC ?? ?? ?? ?? 4C 8B F1 E8 ?? ?? ?? ?? 48 8D 05 ?? ?? ?? ??", PatternType::Address, LPVOID)
|
||||
AddOffset(LifeSetHealth, "gamedll_ph_x64_rwdi.dll", "E8 [?? ?? ?? ?? 49 8D 4C 24 ?? 49 03 CE", PatternType::RelativePointer, LPVOID)
|
||||
AddOffset(TogglePhotoMode, "gamedll_ph_x64_rwdi.dll", "48 83 EC 48 38 91 ?? ?? ?? ??", PatternType::Address, LPVOID)
|
||||
AddOffset(OnUpdate_ChangeMap, "gamedll_ph_x64_rwdi.dll", "E8 [?? ?? ?? ?? 88 44 24 20 48 8B 84 24 ?? ?? ?? ?? 48 83 78 ?? ??", PatternType::RelativePointer, LPVOID)
|
||||
//AddOffset(OnUpdate_ChangeMap, "gamedll_ph_x64_rwdi.dll", "E8 [?? ?? ?? ?? 88 44 24 20 48 8B 84 24 ?? ?? ?? ?? 48 83 78 ?? ??", PatternType::RelativePointer, LPVOID)
|
||||
AddOffset(ShowTPPModelFunc2, "gamedll_ph_x64_rwdi.dll", "E8 [?? ?? ?? ?? 45 8D 45 40", PatternType::RelativePointer, LPVOID)
|
||||
AddOffset(ShowTPPModelFunc3, "gamedll_ph_x64_rwdi.dll", "E9 [?? ?? ?? ?? 48 85 D2 74 0A", PatternType::RelativePointer, 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", PatternType::Address, LPVOID)
|
||||
AddOffset(GetTimeWeatherSystem, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? 33 D2 48 8B C8 E8 ?? ?? ?? ?? 49 8D 4F 38", PatternType::RelativePointer, LPVOID)
|
||||
AddOffset(SetForcedWeather, "engine_x64_rwdi.dll", "89 51 68 C3 CC CC CC CC CC CC CC CC CC CC CC CC", PatternType::Address, LPVOID)
|
||||
AddOffset(GetCurrentWeather, "engine_x64_rwdi.dll", "48 8B 41 78 48 85 C0 75 0F", PatternType::Address, LPVOID)
|
||||
//AddOffset(GetTimeWeatherSystem, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? 33 D2 48 8B C8 E8 ?? ?? ?? ?? 49 8D 4F 38", PatternType::RelativePointer, LPVOID)
|
||||
//AddOffset(SetForcedWeather, "engine_x64_rwdi.dll", "89 51 68 C3 CC CC CC CC CC CC CC CC CC CC CC CC", PatternType::Address, LPVOID)
|
||||
//AddOffset(GetCurrentWeather, "engine_x64_rwdi.dll", "48 8B 41 78 48 85 C0 75 0F", PatternType::Address, LPVOID)
|
||||
AddOffset(MoveCameraFromForwardUpPos, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? 48 8B 03 48 8B CB F3 0F 10 9B ?? ?? ?? ??", PatternType::RelativePointer, LPVOID)
|
||||
AddOffset(GetForwardVector, "engine_x64_rwdi.dll", "4C 8B 41 38 41 8B 40 48", PatternType::Address, LPVOID)
|
||||
AddOffset(GetUpVector, "engine_x64_rwdi.dll", "4C 8B 41 38 41 8B 40 44", PatternType::Address, LPVOID)
|
||||
AddOffset(IsLoading, "engine_x64_rwdi.dll", "48 8B 05 ?? ?? ?? ?? 48 8B 51 38", PatternType::Address, LPVOID)
|
||||
AddOffset(GetGameTimeDelta, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? F3 0F 59 05 ?? ?? ?? ?? F3 0F 58 03", PatternType::RelativePointer, LPVOID)
|
||||
//AddOffset(GetForwardVector, "engine_x64_rwdi.dll", "4C 8B 41 38 41 8B 40 48", PatternType::Address, LPVOID)
|
||||
//AddOffset(IsLoading, "engine_x64_rwdi.dll", "48 8B 05 ?? ?? ?? ?? 48 8B 51 38", PatternType::Address, LPVOID)
|
||||
//AddOffset(ShowUIManager, "engine_x64_rwdi.dll", "48 8B 0D ?? ?? ?? ?? E9 ?? ?? ?? ?? CC CC CC CC 48 8B 49 ?? E9 ?? ?? ?? ?? CC CC CC CC CC CC CC 48 8B 49 ?? E9 ?? ?? ?? ?? CC CC CC CC CC CC CC 48 8B 49 ?? E9 ?? ?? ?? ?? CC CC CC CC CC CC CC 48 8B 49 ?? E9 ?? ?? ?? ?? CC CC CC CC CC CC CC 40 53", PatternType::Address, LPVOID)
|
||||
//AddOffset(GetGameTimeDelta, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? F3 0F 59 05 ?? ?? ?? ?? F3 0F 58 03", PatternType::RelativePointer, LPVOID)
|
||||
AddOffset(CRTTI_FindField, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? 48 85 C0 75 2C", PatternType::RelativePointer, LPVOID)
|
||||
AddOffset(CRTTIFieldTypedNative_Get_float, "engine_x64_rwdi.dll", "48 89 5C 24 ?? 57 48 83 EC 20 8B 41 14 49 8B F8 4C 8B 02 48 8B D9 C1 E8 11 48 8B CA A8 01 74 06 41 FF 50 30 EB 04 41 FF 50 20 4C 8B C8 48 8B 43 60 48 85 C0 74 13 48 8B D7 49 8B C9 48 8B 5C 24 ?? 48 83 C4 20 5F 48 FF E0 48 63 43 50 48 8B 5C 24 ?? 42 8B 0C 08", PatternType::Address, LPVOID)
|
||||
};
|
||||
|
@ -12,6 +12,11 @@ namespace Utils {
|
||||
|
||||
auto end = clock::now();
|
||||
long timePassedMs = static_cast<long>((end - start).count());
|
||||
|
||||
if (timePassedMs < 0) {
|
||||
start = std::chrono::time_point_cast<std::chrono::milliseconds>(clock::now());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (timePassedMs >= timeToPass)
|
||||
timePassed = true;
|
||||
@ -31,6 +36,14 @@ namespace Utils {
|
||||
return true;
|
||||
}
|
||||
|
||||
FARPROC GetProcAddr(std::string_view module, std::string_view funcName) {
|
||||
HMODULE moduleHandle = GetModuleHandleA(module.data());
|
||||
if (!moduleHandle)
|
||||
return nullptr;
|
||||
|
||||
return GetProcAddress(moduleHandle, funcName.data());
|
||||
}
|
||||
|
||||
std::string_view GetDesktopDir() {
|
||||
char path[MAX_PATH + 1];
|
||||
if (!SHGetSpecialFolderPathA(HWND_DESKTOP, path, CSIDL_DESKTOP, FALSE))
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
|
||||
enum class WindowsVersion {
|
||||
Unknown,
|
||||
@ -33,6 +33,8 @@ namespace Utils {
|
||||
return std::to_string(val);
|
||||
}
|
||||
|
||||
extern FARPROC GetProcAddr(std::string_view module, std::string_view funcName);
|
||||
|
||||
extern std::string_view GetDesktopDir();
|
||||
extern WindowsVersion GetWindowsVersion();
|
||||
}
|
@ -12,6 +12,7 @@ UseTPPModel=1
|
||||
[Menu]
|
||||
Transparency=99
|
||||
[Menu:Keybinds]
|
||||
DisableHUDToggleKey=VK_F8
|
||||
FreeCamToggleKey=VK_F3
|
||||
FreezePlayerToggleKey=VK_F7
|
||||
GodModeToggleKey=VK_F6
|
||||
@ -20,6 +21,7 @@ TeleportPlayerToCameraToggleKey=VK_F4
|
||||
ThirdPersonToggleKey=VK_F1
|
||||
UseTPPModelToggleKey=VK_F2
|
||||
[Player:Misc]
|
||||
DisableOutOfBoundsTimer=1
|
||||
GodMode=0
|
||||
[Player:PlayerVariables]
|
||||
Enabled=0
|
||||
|
Reference in New Issue
Block a user