- Added "Camera Offset" sliders for camera position (Camera)

- Added "Zoom In" with default key set to Q (Camera); this is similar to the zoom-in feature from Cyberpunk 2077
- Added separate FOV sliders for each type of camera (Camera)
- Added "Enable Debugging Console" for developer debugging purposes (Debug)

- Fixed FOV slider not affecting Third Person Camera
- Fixed not all options in the mod menu being disabled whilst the game is starting up
This commit is contained in:
EricPlayZ
2025-01-12 08:08:02 +02:00
parent d269480ef2
commit 2e5d807ca8
23 changed files with 385 additions and 169 deletions

View File

@ -183,7 +183,7 @@
</IntrinsicFunctions>
<AdditionalIncludeDirectories>include;deps</AdditionalIncludeDirectories>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName)_$(PlatformTarget).pch</PrecompiledHeaderOutputFile>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
@ -214,7 +214,7 @@
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpplatest</LanguageStandard>
<AdditionalIncludeDirectories>include;deps;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName)_$(PlatformTarget).pch</PrecompiledHeaderOutputFile>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>

View File

@ -11,12 +11,13 @@ namespace EGSDK::Engine {
ClassHelpers::buffer<0x5C, float> Y;
ClassHelpers::buffer<0x6C, float> Z;
};*/
float GetFOV();
Vector3* GetForwardVector(Vector3* outForwardVec);
Vector3* GetUpVector(Vector3* outUpVec);
Vector3* GetLeftVector(Vector3* outLeftVec);
Vector3* GetPosition(Vector3* outPos);
void SetPosition(const Vector3* pos);
void SetFOV(float fov);
void SetPosition(const Vector3* pos);
};
}

View File

@ -12,7 +12,7 @@ namespace EGSDK::GamePH {
ClassHelpers::buffer<0x38, Engine::CBaseCamera*> pCBaseCamera;
ClassHelpers::buffer<0x42, bool> enableSpeedMultiplier1;
ClassHelpers::buffer<0x43, bool> enableSpeedMultiplier2;
ClassHelpers::buffer<0x1B4, float> FOV;
//ClassHelpers::buffer<0x1B4, float> FOV;
ClassHelpers::buffer<0x1CC, float> speedMultiplier;
};

View File

@ -7,6 +7,8 @@ namespace EGSDK::GamePH {
namespace Hooks {
extern EGameSDK_API Utils::Hook::MHook<void*, DWORD64(*)(DWORD64), DWORD64> CreatePlayerHealthModuleHook;
extern EGameSDK_API Utils::Hook::MHook<void*, DWORD64(*)(DWORD64), DWORD64> CreatePlayerInfeIctionModuleHook;
extern EGameSDK_API bool didOnPostUpdateHookExecute;
extern EGameSDK_API Utils::Hook::VTHook<GameDI_PH2*, void(*)(void*), void*> OnPostUpdateHook;
}
}

View File

@ -42,13 +42,14 @@ namespace EGSDK::Utils {
bool IsHooked();
void SetHooked(bool value);
protected:
private:
std::string_view* name = nullptr;
volatile LONG isHooking = 0;
volatile LONG isHooked = 0;
};
template <typename GetTargetOffsetRetType>
class ByteHook : HookBase {
class ByteHook : public HookBase {
public:
ByteHook(const std::string_view& name, GetTargetOffsetRetType(*pGetOffsetFunc)(), unsigned char* patchBytes, size_t bytesAmount) : HookBase(name), pGetOffsetFunc(pGetOffsetFunc), patchBytes(patchBytes), bytesAmount(bytesAmount) {}
@ -125,7 +126,7 @@ namespace EGSDK::Utils {
Utils::Time::Timer timeSpentHooking{ 120000 };
};
template <typename GetTargetOffsetRetType, typename OrigType, typename... Args>
class MHook : HookBase {
class MHook : public HookBase {
public:
using CallbackType = std::function<void(Args...)>;
@ -180,7 +181,7 @@ namespace EGSDK::Utils {
std::vector<CallbackType> callbacks;
};
template <typename GetTargetOffsetRetType, typename OrigType, typename... Args>
class VTHook : HookBase {
class VTHook : public HookBase {
public:
using CallbackType = std::function<void(Args...)>;

View File

@ -3,6 +3,9 @@
#include <EGSDK\Utils\Memory.h>
namespace EGSDK::Engine {
float CBaseCamera::GetFOV() {
return Utils::Memory::SafeCallFunction<float>("engine_x64_rwdi.dll", "?GetFOV@IBaseCamera@@QEBAMXZ", -1.0f, this);
}
Vector3* CBaseCamera::GetForwardVector(Vector3* outForwardVec) {
return Utils::Memory::SafeCallFunction<Vector3*>("engine_x64_rwdi.dll", "?GetForwardVector@IBaseCamera@@QEBA?BVvec3@@XZ", nullptr, this, outForwardVec);
}
@ -16,10 +19,10 @@ namespace EGSDK::Engine {
return Utils::Memory::SafeCallFunction<Vector3*>("engine_x64_rwdi.dll", "?GetPosition@IBaseCamera@@UEBA?BVvec3@@XZ", nullptr, this, outPos);
}
void CBaseCamera::SetPosition(const Vector3* pos) {
Utils::Memory::SafeCallFunctionVoid("engine_x64_rwdi.dll", "?SetPosition@IBaseCamera@@QEAAXAEBVvec3@@@Z", this, pos);
}
void CBaseCamera::SetFOV(float fov) {
Utils::Memory::SafeCallFunctionVoid("engine_x64_rwdi.dll", "?SetFOV@IBaseCamera@@QEAAXM@Z", this, fov);
}
void CBaseCamera::SetPosition(const Vector3* pos) {
Utils::Memory::SafeCallFunctionVoid("engine_x64_rwdi.dll", "?SetPosition@IBaseCamera@@QEAAXAEBVvec3@@@Z", this, pos);
}
}

View File

@ -31,7 +31,10 @@ namespace EGSDK::GamePH {
#pragma endregion
#pragma region OnPostUpdate
bool didOnPostUpdateHookExecute = false;
Utils::Hook::VTHook<GameDI_PH2*, void(*)(void*), void*> OnPostUpdateHook{ "OnPostUpdate", &GameDI_PH2::Get, [](void* pGameDI_PH2) {
didOnPostUpdateHookExecute = true;
Core::OnPostUpdate();
OnPostUpdateHook.ExecuteCallbacks(pGameDI_PH2);

View File

@ -140,7 +140,7 @@
</IntrinsicFunctions>
<AdditionalIncludeDirectories>include;..\EGameSDK\include;..\EGameSDK\deps;deps;deps\ImGui;deps\freetype\include;</AdditionalIncludeDirectories>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName)_$(PlatformTarget).pch</PrecompiledHeaderOutputFile>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
@ -175,7 +175,7 @@
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpplatest</LanguageStandard>
<AdditionalIncludeDirectories>include;..\EGameSDK\include;..\EGameSDK\deps;deps;deps\ImGui;deps\freetype\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName)_$(PlatformTarget).pch</PrecompiledHeaderOutputFile>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>

View File

@ -6,7 +6,7 @@
#include <EGSDK\Utils\Values.h>
namespace ImGui {
bool isAnyHotkeyBtnPressed = false;
bool isAnyHotkeyBtnClicked = false;
EGSDK::Utils::Time::Timer timeSinceHotkeyBtnPressed{ 250 };
Key::Key(std::string_view name, int code, ImGuiKey imGuiCode) : name(name), code(code), imGuiCode(imGuiCode) {}
@ -65,11 +65,11 @@ namespace ImGui {
#pragma endregion
#pragma region KeyBindOption
bool KeyBindOption::wasAnyKeyPressed = false;
bool KeyBindOption::wasAnyHotkeyToggled = false;
bool KeyBindOption::scrolledMouseWheelUp = false;
bool KeyBindOption::scrolledMouseWheelDown = false;
KeyBindOption::KeyBindOption(int keyCode) : keyCode(keyCode) {
KeyBindOption::KeyBindOption(int keyCode, bool isToggleableOption) : keyCode(keyCode), isToggleableOption(isToggleableOption) {
GetInstances()->insert(this);
};
KeyBindOption::~KeyBindOption() {
@ -162,6 +162,36 @@ namespace ImGui {
}
return false;
}
bool KeyBindOption::IsToggleableOption() const {
return isToggleableOption;
}
void KeyBindOption::SetIsKeyDown(bool newValue) {
isKeyDown = newValue;
}
void KeyBindOption::SetIsKeyPressed(bool newValue) {
isKeyPressed = newValue;
}
void KeyBindOption::SetIsKeyReleased(bool newValue) {
isKeyReleased = newValue;
}
bool KeyBindOption::IsKeyDown() {
return isKeyDown;
}
bool KeyBindOption::IsKeyPressed() {
if (isKeyPressed) {
isKeyPressed = false;
return true;
}
return false;
}
bool KeyBindOption::IsKeyReleased() {
if (!isKeyDown && isKeyReleased) {
isKeyReleased = false;
return true;
}
return false;
}
const std::array<Key, 103> KeyBindOption::keyMap = std::to_array<Key>({
{ "'", VK_OEM_7, ImGuiKey_Apostrophe },
@ -456,12 +486,12 @@ namespace ImGui {
GetCurrentContext()->ActiveIdAllowOverlap = true;
if ((!IsItemHovered() && GetIO().MouseClicked[0]) || key->SetToPressedKey()) {
timeSinceHotkeyBtnPressed = EGSDK::Utils::Time::Timer(250);
isAnyHotkeyBtnPressed = false;
isAnyHotkeyBtnClicked = false;
ClearActiveID();
} else
SetActiveID(id, GetCurrentWindow());
} else if (Button(key->ToStringKeyMap().data(), ImVec2(0.0f, 0.0f))) {
isAnyHotkeyBtnPressed = true;
isAnyHotkeyBtnClicked = true;
SetActiveID(id, GetCurrentWindow());
}

View File

@ -11,7 +11,7 @@
#endif
namespace ImGui {
extern bool isAnyHotkeyBtnPressed;
extern bool isAnyHotkeyBtnClicked;
extern EGSDK::Utils::Time::Timer timeSinceHotkeyBtnPressed;
struct Key {
@ -54,11 +54,11 @@ namespace ImGui {
};
class KeyBindOption : public Option {
public:
static bool wasAnyKeyPressed;
static bool wasAnyHotkeyToggled;
static bool scrolledMouseWheelUp;
static bool scrolledMouseWheelDown;
KeyBindOption(int keyCode);
KeyBindOption(int keyCode, bool isToggleableOption = true);
~KeyBindOption();
static std::set<KeyBindOption*>* GetInstances();
@ -72,8 +72,21 @@ namespace ImGui {
void ChangeKeyBind(int newKeyBind);
bool SetToPressedKey();
bool IsToggleableOption() const;
void SetIsKeyDown(bool newValue);
void SetIsKeyPressed(bool newValue);
void SetIsKeyReleased(bool newValue);
bool IsKeyDown();
bool IsKeyPressed();
bool IsKeyReleased();
private:
int keyCode = 0;
bool isToggleableOption = true;
bool isKeyDown = false;
bool isKeyPressed = false;
bool isKeyReleased = false;
static const std::array<Key, 103> keyMap;
static const std::array<VKey, 135> virtualKeyMap;
};

View File

@ -150,6 +150,21 @@ I have some things planned for the next updates, but time will decide when I'll
R"(- Added compatibility with v1.19 Tower Raid: Halloween Run update
- Improved CPU performance at game startup when using the mod, this should stop the system from freezing for some people when starting up the game
- Improved memory signature scanning, increasing reliability and performance; if you encounter issues with classses in the Debug menu being NULL, please open up a bug report!
- Improved MountDataPaks hook error detection (the error related to MountDataPaks should not show up in the console as often anymore))" }
- Improved MountDataPaks hook error detection (the error related to MountDataPaks should not show up in the console as often anymore))" },
{ "v1.3.0",
R"(- Added compatibility with v1.20.1 "Winter Tales" hotfix update
- Added EGameSDK.dll as a dependency library for EGameTools (EGameSDK coming soon TM, I hope some of you developers are looking forward to it!)
- Added "Camera Offset" sliders for camera position (Camera)
- Added "Zoom In" with default key set to Q (Camera); this is similar to the zoom-in feature from Cyberpunk 2077
- Added separate FOV sliders for each type of camera (Camera)
- Added "Disable Low Level Mouse Hook" for developer debugging purposes, or in case of performance issues on the end-user side (Debug)
- Added "Disable Vftable Scanning" for developer debugging purposes, or in case of performance issues or class detection issues on the end-user side (Debug)
- Added "Enable Debugging Console" for developer debugging purposes (Debug)
- Fixed random classes not getting detected properly, resulting in NULL values in the Debug tab, which was caused by unreliable class vftable scanning which can now be disabled through the "Disable Vftable Scanning" in the Debug tab in case of class detection issues
- Fixed game progression not working properly if you modify Player Variables related to game progression, because game and mod Player Variables interfere with each other
- Fixed random crashes related to Player Variables (if you still experience crashes at startup, please open a bug report)
- Fixed FOV slider not affecting Third Person Camera
- Fixed not all options in the mod menu being disabled whilst the game is starting up)" }
};
}

View File

@ -3,8 +3,8 @@
#include <EGSDK\Utils\Values.h>
namespace EGT {
constexpr const char* MOD_VERSION_STR = "v1.2.4";
constexpr unsigned long MOD_VERSION = 10204;
constexpr const char* MOD_VERSION_STR = "v1.3.0";
constexpr unsigned long MOD_VERSION = 10300;
constexpr unsigned long GAME_VER_COMPAT = 12001;
namespace Core {

View File

@ -6,19 +6,22 @@
namespace EGT::Menu {
namespace Camera {
extern EGSDK::Vector3 cameraOffset;
extern int FOV;
extern float firstPersonFOV;
extern ImGui::KeyBindOption firstPersonZoomIn;
extern ImGui::Option photoMode;
extern ImGui::KeyBindOption freeCam;
extern float freeCamFOV;
extern float freeCamSpeed;
extern ImGui::KeyBindOption teleportPlayerToCamera;
extern ImGui::KeyBindOption thirdPersonCamera;
extern ImGui::KeyBindOption tpUseTPPModel;
extern float tpDistanceBehindPlayer;
extern float tpHeightAbovePlayer;
extern float tpHorizontalDistanceFromPlayer;
extern float thirdPersonFOV;
extern float thirdPersonDistanceBehindPlayer;
extern float thirdPersonHeightAbovePlayer;
extern float thirdPersonHorizontalDistanceFromPlayer;
extern float lensDistortion;
extern ImGui::KeyBindOption goProMode;

View File

@ -3,8 +3,9 @@
namespace EGT::Menu {
namespace Debug {
extern bool disableLowLevelMouseHook;
extern bool disableVftableScanning;
extern ImGui::Option disableLowLevelMouseHook;
extern ImGui::Option disableVftableScanning;
extern ImGui::Option enableDebuggingConsole;
class Tab : MenuTab {
public:

View File

@ -17,6 +17,7 @@
namespace EGT::Config {
enum ValueType {
OPTION,
Int,
Float,
String
};
@ -61,10 +62,11 @@ namespace EGT::Config {
{ "Menu:Keybinds", "NoSpreadToggleKey", Menu::Weapon::noSpread.ToStringVKeyMap(), &Menu::Weapon::noSpread, String },
{ "Menu:Keybinds", "NoRecoilToggleKey", Menu::Weapon::noRecoil.ToStringVKeyMap(), &Menu::Weapon::noRecoil, String },
{ "Menu:Keybinds", "InstantReloadToggleKey", Menu::Weapon::instantReload.ToStringVKeyMap(), &Menu::Weapon::instantReload, String },
{ "Menu:Keybinds", "FreeCamToggleKey", Menu::Camera::freeCam.ToStringVKeyMap(), &Menu::Camera::freeCam, String },
{ "Menu:Keybinds", "TeleportPlayerToCameraToggleKey", Menu::Camera::teleportPlayerToCamera.ToStringVKeyMap(), &Menu::Camera::teleportPlayerToCamera, String },
{ "Menu:Keybinds", "FirstPersonZoomInHoldingKey", Menu::Camera::firstPersonZoomIn.ToStringVKeyMap(), &Menu::Camera::firstPersonZoomIn, String },
{ "Menu:Keybinds", "ThirdPersonToggleKey", Menu::Camera::thirdPersonCamera.ToStringVKeyMap(), &Menu::Camera::thirdPersonCamera, String },
{ "Menu:Keybinds", "UseTPPModelToggleKey", Menu::Camera::tpUseTPPModel.ToStringVKeyMap(), &Menu::Camera::tpUseTPPModel, String },
{ "Menu:Keybinds", "FreeCamToggleKey", Menu::Camera::freeCam.ToStringVKeyMap(), &Menu::Camera::freeCam, String },
{ "Menu:Keybinds", "TeleportPlayerToCameraToggleKey", Menu::Camera::teleportPlayerToCamera.ToStringVKeyMap(), &Menu::Camera::teleportPlayerToCamera, String },
{ "Menu:Keybinds", "GoProMode", Menu::Camera::goProMode.ToStringVKeyMap(), &Menu::Camera::goProMode, String },
{ "Menu:Keybinds", "DisableSafezoneFOVReduction", Menu::Camera::disableSafezoneFOVReduction.ToStringVKeyMap(), &Menu::Camera::disableSafezoneFOVReduction, String },
{ "Menu:Keybinds", "DisablePhotoModeLimits", Menu::Camera::disablePhotoModeLimits.ToStringVKeyMap(), &Menu::Camera::disablePhotoModeLimits, String },
@ -94,13 +96,19 @@ namespace EGT::Config {
{ "Weapon:Misc", "NoSpread", Menu::Weapon::noSpread.GetValue(), &Menu::Weapon::noSpread, OPTION },
{ "Weapon:Misc", "NoRecoil", Menu::Weapon::noRecoil.GetValue(), &Menu::Weapon::noRecoil, OPTION },
{ "Weapon:Misc", "InstantReload", Menu::Weapon::instantReload.GetValue(), &Menu::Weapon::instantReload, OPTION },
{ "Camera:FreeCam", "FOV", Menu::Camera::freeCamFOV, &Menu::Camera::freeCamFOV, Float },
{ "Camera:FreeCam", "Speed", Menu::Camera::freeCamSpeed, &Menu::Camera::freeCamSpeed, Float },
{ "Camera:FreeCam", "TeleportPlayerToCamera", Menu::Camera::teleportPlayerToCamera.GetValue(), &Menu::Camera::teleportPlayerToCamera, OPTION },
{ "Camera:FirstPerson", "XOffset", Menu::Camera::cameraOffset.X, &Menu::Camera::cameraOffset.X, Float },
{ "Camera:FirstPerson", "YOffset", Menu::Camera::cameraOffset.Y, &Menu::Camera::cameraOffset.Y, Float },
{ "Camera:FirstPerson", "ZOffset", Menu::Camera::cameraOffset.Z, &Menu::Camera::cameraOffset.Z, Float },
{ "Camera:FirstPerson", "ZoomIn", Menu::Camera::firstPersonZoomIn.GetValue(), &Menu::Camera::firstPersonZoomIn, OPTION},
{ "Camera:ThirdPerson", "Enabled", Menu::Camera::thirdPersonCamera.GetValue(), &Menu::Camera::thirdPersonCamera, OPTION },
{ "Camera:ThirdPerson", "UseTPPModel", Menu::Camera::tpUseTPPModel.GetValue(), &Menu::Camera::tpUseTPPModel, OPTION },
{ "Camera:ThirdPerson", "DistanceBehindPlayer", Menu::Camera::tpDistanceBehindPlayer, &Menu::Camera::tpDistanceBehindPlayer, Float },
{ "Camera:ThirdPerson", "HeightAbovePlayer", Menu::Camera::tpHeightAbovePlayer, &Menu::Camera::tpHeightAbovePlayer, Float },
{ "Camera:ThirdPerson", "HorizontalDistanceFromPlayer", Menu::Camera::tpHorizontalDistanceFromPlayer, &Menu::Camera::tpHorizontalDistanceFromPlayer, Float },
{ "Camera:ThirdPerson", "FOV", Menu::Camera::thirdPersonFOV, &Menu::Camera::thirdPersonFOV, Float },
{ "Camera:ThirdPerson", "DistanceBehindPlayer", Menu::Camera::thirdPersonDistanceBehindPlayer, &Menu::Camera::thirdPersonDistanceBehindPlayer, Float },
{ "Camera:ThirdPerson", "HeightAbovePlayer", Menu::Camera::thirdPersonHeightAbovePlayer, &Menu::Camera::thirdPersonHeightAbovePlayer, Float },
{ "Camera:ThirdPerson", "HorizontalDistanceFromPlayer", Menu::Camera::thirdPersonHorizontalDistanceFromPlayer, &Menu::Camera::thirdPersonHorizontalDistanceFromPlayer, Float },
{ "Camera:Misc", "LensDistortion", Menu::Camera::lensDistortion, &Menu::Camera::lensDistortion, Float },
{ "Camera:Misc", "GoProMode", Menu::Camera::goProMode.GetValue(), &Menu::Camera::goProMode, OPTION },
{ "Camera:Misc", "DisableSafezoneFOVReduction", Menu::Camera::disableSafezoneFOVReduction.GetValue(), &Menu::Camera::disableSafezoneFOVReduction, OPTION },
@ -113,8 +121,9 @@ namespace EGT::Config {
{ "Misc:GameChecks", "IncreaseDataPAKsLimit", Menu::Misc::increaseDataPAKsLimit.GetValue(), &Menu::Misc::increaseDataPAKsLimit, OPTION },
{ "World:Time", "SlowMotionSpeed", Menu::World::slowMotionSpeed, &Menu::World::slowMotionSpeed, Float },
{ "World:Time", "SlowMotionTransitionTime", Menu::World::slowMotionTransitionTime, &Menu::World::slowMotionTransitionTime, Float },
{ "Debug:Misc", "DisableLowLevelMouseHook", Menu::Debug::disableLowLevelMouseHook, &Menu::Debug::disableLowLevelMouseHook, OPTION },
{ "Debug:Misc", "DisableVftableScanning", Menu::Debug::disableVftableScanning, &Menu::Debug::disableVftableScanning, OPTION },
{ "Debug:Misc", "DisableLowLevelMouseHook", Menu::Debug::disableLowLevelMouseHook.GetValue(), &Menu::Debug::disableLowLevelMouseHook, OPTION },
{ "Debug:Misc", "DisableVftableScanning", Menu::Debug::disableVftableScanning.GetValue(), &Menu::Debug::disableVftableScanning, OPTION },
{ "Debug:Misc", "EnableDebuggingConsole", Menu::Debug::enableDebuggingConsole.GetValue(), &Menu::Debug::enableDebuggingConsole, OPTION }
});
configVariables = configVariablesDefault;
}
@ -124,6 +133,9 @@ namespace EGT::Config {
case OPTION:
reader.UpdateEntry(entry.section.data(), entry.key.data(), std::any_cast<bool>(entry.value));
break;
case Int:
reader.UpdateEntry(entry.section.data(), entry.key.data(), std::any_cast<int>(entry.value));
break;
case Float:
reader.UpdateEntry(entry.section.data(), entry.key.data(), std::any_cast<float>(entry.value));
break;
@ -154,6 +166,10 @@ namespace EGT::Config {
reader.InsertEntry(entry.section.data(), entry.key.data(), std::any_cast<bool>(entry.value));
break;
}
case Int:
*reinterpret_cast<int*>(entry.optionPtr) = std::any_cast<int>(entry.value);
reader.InsertEntry(entry.section.data(), entry.key.data(), std::any_cast<int>(entry.value));
break;
case Float:
*reinterpret_cast<float*>(entry.optionPtr) = std::any_cast<float>(entry.value);
reader.InsertEntry(entry.section.data(), entry.key.data(), std::any_cast<float>(entry.value));
@ -215,9 +231,19 @@ namespace EGT::Config {
ImGui::Option* option = reinterpret_cast<ImGui::Option*>(entry.optionPtr);
if (option->GetChangesAreDisabled())
break;
#ifdef _DEBUG
if (entry.key == "DisableLowLevelMouseHook") {
option->SetBothValues(reader.Get(entry.section.data(), entry.key.data(), true));
break;
}
#endif
option->SetBothValues(reader.Get(entry.section.data(), entry.key.data(), std::any_cast<bool>(entry.value)));
break;
}
case Int:
*reinterpret_cast<int*>(entry.optionPtr) = reader.Get(entry.section.data(), entry.key.data(), std::any_cast<int>(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;
@ -275,6 +301,10 @@ namespace EGT::Config {
if (reader.Get(entry.section.data(), entry.key.data(), std::any_cast<bool>(entry.value)) != reinterpret_cast<ImGui::Option*>(entry.optionPtr)->GetValue())
return true;
break;
case Int:
if (reader.Get(entry.section.data(), entry.key.data(), std::any_cast<int>(entry.value)) != *reinterpret_cast<int*>(entry.optionPtr))
return true;
break;
case Float:
if (!EGSDK::Utils::Values::are_samef(reader.Get(entry.section.data(), entry.key.data(), std::any_cast<float>(entry.value)), *reinterpret_cast<float*>(entry.optionPtr)))
return true;

View File

@ -32,17 +32,21 @@ namespace EGT::Core {
}
static FILE* f = nullptr;
void OpenIOBuffer() {
freopen_s(&f, "CONOUT$", "w", stdout);
}
void CloseIOBuffer() {
if (f)
fclose(f);
}
void EnableConsole() {
AllocConsole();
SetConsoleTitle("EGameTools");
HWND consoleWindow = GetConsoleWindow();
MoveWindow(consoleWindow, 0, 0, 1800, 720, TRUE);
freopen_s(&f, "CONOUT$", "w", stdout);
DisableConsoleQuickEdit();
}
void DisableConsole() {
if (f)
fclose(f);
FreeConsole();
}
#pragma endregion
@ -65,7 +69,7 @@ namespace EGT::Core {
Sleep(1000);
if (!EGSDK::Core::rendererAPI) {
SPDLOG_WARN("rendererAPI is null, skipping iteration");
SPDLOG_INFO("rendererAPI is null, skipping iteration");
continue;
}
kiero::Status::Enum initStatus = kiero::init(EGSDK::Core::rendererAPI == 11 ? kiero::RenderType::D3D11 : kiero::RenderType::D3D12);
@ -215,9 +219,6 @@ namespace EGT::Core {
void InitLogger() {
try {
static std::vector<spdlog::sink_ptr> sinks{};
EGSDK::Core::spdlogSinks.push_back(std::make_shared<spdlog::sinks::wincolor_stdout_sink_mt>());
std::shared_ptr<spdlog::logger> logger = std::make_shared<spdlog::logger>("EGameTools", std::begin(EGSDK::Core::spdlogSinks), std::end(EGSDK::Core::spdlogSinks));
EGSDK::Core::SetDefaultLoggerSettings(logger);
@ -229,6 +230,10 @@ namespace EGT::Core {
exit(0);
}
}
static void AddConsoleSink() {
EGSDK::Core::spdlogSinks.push_back(std::make_shared<spdlog::sinks::wincolor_stdout_sink_mt>());
InitLogger();
}
static void OnPostUpdate(void* pGameDI_PH2) {
for (auto& menuTab : *Menu::MenuTab::GetInstances())
@ -295,8 +300,13 @@ namespace EGT::Core {
Config::InitConfig();
threads.emplace_back(Config::ConfigLoop);
SPDLOG_INFO("Setting vftable scanning to: {}", Menu::Debug::disableVftableScanning);
EGSDK::ClassHelpers::SetIsVftableScanningDisabled(Menu::Debug::disableVftableScanning);
if (Menu::Debug::enableDebuggingConsole.GetValue()) {
EnableConsole();
AddConsoleSink();
}
SPDLOG_INFO("Setting vftable scanning to: {}", Menu::Debug::disableVftableScanning.GetValue());
EGSDK::ClassHelpers::SetIsVftableScanningDisabled(Menu::Debug::disableVftableScanning.GetValue());
SPDLOG_INFO("Creating symlink for loading files");
CreateSymlinkForLoadingFiles();

View File

@ -53,9 +53,9 @@ namespace EGT::Engine {
newCamPos.Y += Menu::Camera::cameraOffset.Y;
newCamPos -= normForwardVec * -Menu::Camera::cameraOffset.Z;
} else if (Menu::Camera::thirdPersonCamera.GetValue()) {
newCamPos -= normForwardVec * -Menu::Camera::tpDistanceBehindPlayer;
newCamPos.Y += Menu::Camera::tpHeightAbovePlayer - 1.5f;
newCamPos -= normLeftVec * Menu::Camera::tpHorizontalDistanceFromPlayer;
newCamPos -= normForwardVec * -Menu::Camera::thirdPersonDistanceBehindPlayer;
newCamPos.Y += Menu::Camera::thirdPersonHeightAbovePlayer - 1.5f;
newCamPos -= normLeftVec * Menu::Camera::thirdPersonHorizontalDistanceFromPlayer;
}
*pos = newCamPos;
@ -64,6 +64,20 @@ namespace EGT::Engine {
}
#pragma endregion
#pragma region SetFOV
static void* GetSetFOV() {
return EGSDK::Utils::Memory::GetProcAddr("engine_x64_rwdi.dll", "?SetFOV@IBaseCamera@@QEAAXM@Z");
}
EGSDK::Utils::Hook::MHook<void*, void(*)(void*, float), float> SetFOVHook{ "SetFOV", &GetSetFOV, [](void* pCBaseCamera, float fov) -> void {
if (Menu::Camera::thirdPersonCamera.GetValue())
fov = static_cast<float>(Menu::Camera::thirdPersonFOV);
SetFOVHook.ExecuteCallbacks(fov);
return SetFOVHook.pOriginal(pCBaseCamera, fov);
} };
#pragma endregion
#pragma region fs::open
static const std::string userModFilesFullPath = "\\\\?\\" + std::filesystem::absolute("..\\..\\..\\source\\data\\EGameTools\\UserModFiles").string();

View File

@ -17,7 +17,7 @@ namespace EGT::ImGui_impl {
switch (uMsg) {
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
if (Menu::firstTimeRunning.GetValue() || ImGui::isAnyHotkeyBtnPressed || !ImGui::timeSinceHotkeyBtnPressed.DidTimePass() || ImGui::KeyBindOption::wasAnyKeyPressed)
if (Menu::firstTimeRunning.GetValue())
break;
for (auto& option : *ImGui::KeyBindOption::GetInstances()) {
@ -27,21 +27,34 @@ namespace EGT::ImGui_impl {
continue;
if (wParam == option->GetKeyBind()) {
ImGui::KeyBindOption::wasAnyKeyPressed = true;
option->Toggle();
if (!Menu::menuToggle.GetValue()) {
option->SetIsKeyPressed(!option->IsKeyDown());
option->SetIsKeyDown(true);
}
if (option->IsToggleableOption() && !ImGui::KeyBindOption::wasAnyHotkeyToggled && !ImGui::isAnyHotkeyBtnClicked && ImGui::timeSinceHotkeyBtnPressed.DidTimePass()) {
ImGui::KeyBindOption::wasAnyHotkeyToggled = true;
option->Toggle();
}
}
}
break;
case WM_KEYUP:
case WM_SYSKEYUP:
if (!ImGui::KeyBindOption::wasAnyKeyPressed)
break;
for (auto& option : *ImGui::KeyBindOption::GetInstances()) {
if (wParam == option->GetKeyBind())
ImGui::KeyBindOption::wasAnyKeyPressed = false;
if (wParam == option->GetKeyBind()) {
if (!Menu::menuToggle.GetValue()) {
option->SetIsKeyReleased(option->IsKeyDown());
option->SetIsKeyPressed(false);
option->SetIsKeyDown(false);
}
ImGui::KeyBindOption::wasAnyHotkeyToggled = false;
}
}
break;
default:
break;
}
EGSDK::Engine::CInput* pCInput = EGSDK::Engine::CInput::Get();
@ -151,7 +164,7 @@ namespace EGT::ImGui_impl {
gHwnd = hwnd;
oWndProc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (LONG_PTR)hkWindowProc);
if (!Menu::Debug::disableLowLevelMouseHook)
if (!Menu::Debug::disableLowLevelMouseHook.GetValue())
EnableMouseHook();
}
}

View File

@ -1,5 +1,6 @@
#include <ImGui\imgui_hotkey.h>
#include <ImGui\imguiex.h>
#include <ImGui\imguiex_animation.h>
#include <EGSDK\Engine\CVideoSettings.h>
#include <EGSDK\GamePH\FreeCamera.h>
#include <EGSDK\GamePH\GameDI_PH.h>
@ -14,103 +15,169 @@
namespace EGT::Menu {
namespace Camera {
static constexpr float baseFOV = 57;
static constexpr float baseSafezoneFOVReduction = -10.0f;
static constexpr float baseSprintHeadCorrectionFactor = 0.55f;
EGSDK::Vector3 cameraOffset{};
int FOV = 57;
float firstPersonFOV = baseFOV;
ImGui::KeyBindOption firstPersonZoomIn{ 'Q' , false };
static bool isZoomingIn = false;
ImGui::Option photoMode{ false };
ImGui::KeyBindOption freeCam{ VK_F3 };
float freeCamFOV = baseFOV;
float freeCamSpeed = 2.0f;
ImGui::KeyBindOption teleportPlayerToCamera{ VK_F4 };
ImGui::KeyBindOption thirdPersonCamera{ VK_F1 };
ImGui::KeyBindOption tpUseTPPModel{ VK_F2 };
float tpDistanceBehindPlayer = 2.0f;
float tpHeightAbovePlayer = 1.35f;
float tpHorizontalDistanceFromPlayer = 0.0f;
float thirdPersonFOV = baseFOV;
float thirdPersonDistanceBehindPlayer = 2.0f;
float thirdPersonHeightAbovePlayer = 1.35f;
float thirdPersonHorizontalDistanceFromPlayer = 0.0f;
float lensDistortion = 20.0f;
static float altLensDistortion = 20.0f;
static float altLensDistortion = lensDistortion;
ImGui::KeyBindOption goProMode{ VK_NONE };
ImGui::KeyBindOption disableSafezoneFOVReduction{ VK_NONE };
ImGui::KeyBindOption disablePhotoModeLimits{ VK_NONE };
ImGui::KeyBindOption disableHeadCorrection{ VK_NONE };
static constexpr int baseFOV = 57;
static constexpr float baseSafezoneFOVReduction = -10.0f;
static constexpr float baseSprintHeadCorrectionFactor = 0.55f;
static void UpdateFirstPersonFOV() {
auto iLevel = EGSDK::GamePH::LevelDI::Get();
auto viewCam = iLevel ? reinterpret_cast<EGSDK::Engine::CBaseCamera*>(iLevel->GetViewCamera()) : nullptr;
{
static float previousFirstPersonFOV = firstPersonFOV;
static void UpdateFOV() {
EGSDK::GamePH::LevelDI* iLevel = EGSDK::GamePH::LevelDI::Get();
EGSDK::Engine::CBaseCamera* viewCam = nullptr;
if (iLevel)
viewCam = reinterpret_cast<EGSDK::Engine::CBaseCamera*>(iLevel->GetViewCamera());
if (goProMode.GetValue()) {
if (goProMode.HasChangedTo(true)) {
previousFirstPersonFOV = firstPersonFOV;
goProMode.SetPrevValue(true);
}
static int previousFOV = FOV;
if (goProMode.GetValue()) {
if (goProMode.HasChangedTo(true)) {
previousFOV = FOV;
goProMode.SetPrevValue(true);
if (iLevel && viewCam)
viewCam->SetFOV(110.0f);
firstPersonFOV = 110;
return;
} else if (goProMode.HasChangedTo(false)) {
firstPersonFOV = previousFirstPersonFOV;
goProMode.SetPrevValue(false);
if (iLevel && viewCam)
viewCam->SetFOV(firstPersonFOV);
}
}
static float originalFirstPersonFOV = firstPersonFOV;
static float previousFirstPersonFOV = firstPersonFOV;
static bool scrolledDown = false;
static bool hasChangedZoomLevel = false;
static int zoomLevel = 0;
if (iLevel && viewCam && !thirdPersonCamera.GetValue() && !freeCam.GetValue()) {
if (firstPersonZoomIn.IsKeyDown()) {
if (firstPersonZoomIn.IsKeyPressed()) {
hasChangedZoomLevel = true;
if (!isZoomingIn) {
originalFirstPersonFOV = firstPersonFOV;
previousFirstPersonFOV = originalFirstPersonFOV;
} else
previousFirstPersonFOV = firstPersonFOV;
}
if (iLevel && viewCam)
viewCam->SetFOV(110.0f);
FOV = 110;
return;
} else if (goProMode.HasChangedTo(false)) {
FOV = previousFOV;
goProMode.SetPrevValue(false);
isZoomingIn = true;
float newFOV = previousFirstPersonFOV;
switch (zoomLevel) {
case 0:
newFOV = std::max(originalFirstPersonFOV - 25.0f, 42.0f);
break;
case 1:
newFOV = std::max(originalFirstPersonFOV - 45.0f, 25.0f);
break;
case 2:
newFOV = std::max(originalFirstPersonFOV - 65.0f, 15.0f);
break;
default:
break;
}
firstPersonFOV = ImGui::AnimateLerp("zoomInFOVLerp", previousFirstPersonFOV, newFOV, 0.3f, hasChangedZoomLevel, &ImGui::AnimEaseOutSine);
viewCam->SetFOV(firstPersonFOV);
hasChangedZoomLevel = false;
if (iLevel && viewCam)
viewCam->SetFOV(static_cast<float>(FOV));
if (ImGui::KeyBindOption::scrolledMouseWheelUp) {
ImGui::KeyBindOption::scrolledMouseWheelUp = false;
if (zoomLevel < 2) {
scrolledDown = false;
hasChangedZoomLevel = true;
previousFirstPersonFOV = firstPersonFOV;
zoomLevel++;
}
} else if (ImGui::KeyBindOption::scrolledMouseWheelDown) {
ImGui::KeyBindOption::scrolledMouseWheelDown = false;
if (zoomLevel > 0) {
scrolledDown = true;
hasChangedZoomLevel = true;
previousFirstPersonFOV = firstPersonFOV;
zoomLevel--;
}
}
} else {
zoomLevel = 0;
scrolledDown = false;
if (firstPersonZoomIn.IsKeyReleased()) {
hasChangedZoomLevel = true;
previousFirstPersonFOV = firstPersonFOV;
}
if (!EGSDK::Utils::Values::are_samef(firstPersonFOV, originalFirstPersonFOV) && isZoomingIn) {
firstPersonFOV = ImGui::AnimateLerp("zoomInFOVLerp", previousFirstPersonFOV, originalFirstPersonFOV, 0.25f, hasChangedZoomLevel, &ImGui::AnimEaseOutSine);
viewCam->SetFOV(firstPersonFOV);
hasChangedZoomLevel = false;
} else
isZoomingIn = false;
}
}
EGSDK::Engine::CVideoSettings* videoSettings = EGSDK::Engine::CVideoSettings::Get();
if (!videoSettings || goProMode.GetValue() || menuToggle.GetValue())
return;
FOV = static_cast<int>(videoSettings->extraFOV) + baseFOV;
auto videoSettings = EGSDK::Engine::CVideoSettings::Get();
if (videoSettings && !goProMode.GetValue() && !menuToggle.GetValue() && !isZoomingIn)
firstPersonFOV = static_cast<int>(videoSettings->extraFOV) + baseFOV;
}
static void FreeCamUpdate() {
if (photoMode.GetValue())
return;
EGSDK::GamePH::LevelDI* iLevel = EGSDK::GamePH::LevelDI::Get();
auto iLevel = EGSDK::GamePH::LevelDI::Get();
if (!iLevel || !iLevel->IsLoaded())
return;
void* viewCam = iLevel->GetViewCamera();
auto viewCam = iLevel->GetViewCamera();
if (!viewCam)
return;
EGSDK::GamePH::GameDI_PH* pGameDI_PH = EGSDK::GamePH::GameDI_PH::Get();
auto pGameDI_PH = EGSDK::GamePH::GameDI_PH::Get();
if (!pGameDI_PH)
return;
EGSDK::GamePH::FreeCamera* pFreeCam = EGSDK::GamePH::FreeCamera::Get();
auto pFreeCam = EGSDK::GamePH::FreeCamera::Get();
if (!pFreeCam)
return;
static bool prevFreeCam = freeCam.GetValue();
static bool prevEanbleSpeedMultiplier = pFreeCam->enableSpeedMultiplier1;
static bool prevEnableSpeedMultiplier = pFreeCam->enableSpeedMultiplier1;
static float prevSpeedMultiplier = pFreeCam->speedMultiplier;
static float prevFOV = pFreeCam->FOV;
static float prevFOV = pFreeCam->GetFOV();
if (freeCam.GetValue() && !iLevel->IsTimerFrozen()) {
if (viewCam == pFreeCam) {
pFreeCam->enableSpeedMultiplier1 = true;
if (ImGui::KeyBindOption::scrolledMouseWheelUp) {
ImGui::KeyBindOption::scrolledMouseWheelUp = false;
freeCamSpeed += 0.1f;
freeCamSpeed = std::min(freeCamSpeed + 0.1f, 200.0f);
} else if (ImGui::KeyBindOption::scrolledMouseWheelDown) {
ImGui::KeyBindOption::scrolledMouseWheelDown = false;
freeCamSpeed -= 0.1f;
freeCamSpeed = std::max(freeCamSpeed - 0.1f, 0.1f);
}
if (freeCamSpeed < 0.1f)
freeCamSpeed = 0.1f;
else if (freeCamSpeed > 200.0f)
freeCamSpeed = 200.0f;
pFreeCam->speedMultiplier = freeCamSpeed;
pFreeCam->FOV = static_cast<float>(FOV);
pFreeCam->SetFOV(static_cast<float>(freeCamFOV));
if (ImGui::IsKeyDown(ImGuiKey_LeftShift))
pFreeCam->speedMultiplier *= 2.0f;
@ -118,13 +185,12 @@ namespace EGT::Menu {
pFreeCam->speedMultiplier /= 2.0f;
pFreeCam->GetPosition(&EGT::Engine::Hooks::freeCamPosBeforeGamePause);
return;
}
prevEanbleSpeedMultiplier = pFreeCam->enableSpeedMultiplier1;
prevEnableSpeedMultiplier = pFreeCam->enableSpeedMultiplier1;
prevSpeedMultiplier = pFreeCam->speedMultiplier;
prevFOV = pFreeCam->FOV;
prevFOV = pFreeCam->GetFOV();
pGameDI_PH->TogglePhotoMode();
pFreeCam->AllowCameraMovement(2);
@ -132,9 +198,9 @@ namespace EGT::Menu {
Engine::Hooks::switchedFreeCamByGamePause = freeCam.GetValue() && iLevel->IsTimerFrozen();
if (prevFreeCam) {
pFreeCam->enableSpeedMultiplier1 = prevEanbleSpeedMultiplier;
pFreeCam->enableSpeedMultiplier1 = prevEnableSpeedMultiplier;
pFreeCam->speedMultiplier = prevSpeedMultiplier;
pFreeCam->FOV = prevFOV;
pFreeCam->SetFOV(prevFOV);
}
if (viewCam != pFreeCam)
return;
@ -146,21 +212,21 @@ namespace EGT::Menu {
prevFreeCam = freeCam.GetValue();
}
static void UpdateTPPModel() {
EGSDK::GamePH::LevelDI* iLevel = EGSDK::GamePH::LevelDI::Get();
auto iLevel = EGSDK::GamePH::LevelDI::Get();
if (!iLevel || !iLevel->IsLoaded())
return;
auto pPlayerDI_PH = EGSDK::GamePH::PlayerDI_PH::Get();
if (!pPlayerDI_PH)
return;
EGSDK::GamePH::PlayerDI_PH* pPlayerDI_PH = EGSDK::GamePH::PlayerDI_PH::Get();
if (pPlayerDI_PH) {
if (Menu::Camera::freeCam.GetValue() && !iLevel->IsTimerFrozen())
EGSDK::GamePH::ShowTPPModel(true);
else if (Menu::Camera::freeCam.GetValue() && iLevel->IsTimerFrozen() && !photoMode.GetValue())
EGSDK::GamePH::ShowTPPModel(false);
else if (Menu::Camera::thirdPersonCamera.GetValue() && Menu::Camera::tpUseTPPModel.GetValue())
EGSDK::GamePH::ShowTPPModel(true);
else if (!photoMode.GetValue())
EGSDK::GamePH::ShowTPPModel(false);
}
if (freeCam.GetValue() && !iLevel->IsTimerFrozen())
EGSDK::GamePH::ShowTPPModel(true);
else if (freeCam.GetValue() && iLevel->IsTimerFrozen() && !photoMode.GetValue())
EGSDK::GamePH::ShowTPPModel(false);
else if (thirdPersonCamera.GetValue() && tpUseTPPModel.GetValue())
EGSDK::GamePH::ShowTPPModel(true);
else if (!photoMode.GetValue())
EGSDK::GamePH::ShowTPPModel(false);
}
static void PlayerVarsUpdate() {
if (!EGSDK::GamePH::PlayerVariables::gotPlayerVars)
@ -170,6 +236,7 @@ namespace EGT::Menu {
static float prevLensDistortion = lensDistortion;
static bool lensDistortionJustEnabled = false;
if (goProMode.GetValue()) {
if (!lensDistortionJustEnabled) {
prevLensDistortion = lensDistortion;
@ -180,14 +247,14 @@ namespace EGT::Menu {
altLensDistortion = prevLensDistortion;
lensDistortionJustEnabled = false;
}
EGSDK::GamePH::PlayerVariables::ChangePlayerVar("FOVCorrection", goProMode.GetValue() ? (altLensDistortion / 100.0f) : (lensDistortion / 100.0f));
EGSDK::GamePH::PlayerVariables::ChangePlayerVar("FOVCorrection", goProMode.GetValue() ? (altLensDistortion / 100.0f) : (lensDistortion / 100.0f));
EGSDK::GamePH::PlayerVariables::ManagePlayerVarByBool("SprintHeadCorrectionFactor", 0.0f, baseSprintHeadCorrectionFactor, goProMode.GetValue() ? goProMode.GetValue() : disableHeadCorrection.GetValue(), true);
}
static void UpdateDisabledOptions() {
EGSDK::GamePH::LevelDI* iLevel = EGSDK::GamePH::LevelDI::Get();
freeCam.SetChangesAreDisabled(!iLevel || !iLevel->IsLoaded() || photoMode.GetValue());
thirdPersonCamera.SetChangesAreDisabled(freeCam.GetValue() || photoMode.GetValue());
auto iLevel = EGSDK::GamePH::LevelDI::Get();
freeCam.SetChangesAreDisabled(!iLevel || !iLevel->IsLoaded() || photoMode.GetValue() || isZoomingIn);
thirdPersonCamera.SetChangesAreDisabled(freeCam.GetValue() || photoMode.GetValue() || isZoomingIn);
tpUseTPPModel.SetChangesAreDisabled(freeCam.GetValue() || photoMode.GetValue());
}
static void HandleToggles() {
@ -203,7 +270,7 @@ namespace EGT::Menu {
Tab Tab::instance{};
void Tab::Update() {
UpdateFOV();
UpdateFirstPersonFOV();
FreeCamUpdate();
UpdateTPPModel();
PlayerVarsUpdate();
@ -211,22 +278,19 @@ namespace EGT::Menu {
HandleToggles();
}
void Tab::Render() {
ImGui::SeparatorText("Camera");
ImGui::SeparatorText("Free Camera");
ImGui::BeginDisabled(freeCam.GetChangesAreDisabled() || photoMode.GetValue());
ImGui::CheckboxHotkey("Enabled##FreeCam", &freeCam, "Enables free camera which allows you to travel anywhere with the camera");
ImGui::SeparatorText("First Person Camera");
auto pCVideoSettings = EGSDK::Engine::CVideoSettings::Get();
ImGui::BeginDisabled(!pCVideoSettings || goProMode.GetValue() || isZoomingIn);
if (ImGui::SliderFloat("FOV##FirstPerson", "First person camera field of view", &firstPersonFOV, 20.0f, 160.0f, "%.0f<EFBFBD>") && pCVideoSettings)
pCVideoSettings->extraFOV = firstPersonFOV - baseFOV;
else if (pCVideoSettings && !goProMode.GetValue())
firstPersonFOV = pCVideoSettings->extraFOV + baseFOV;
ImGui::EndDisabled();
ImGui::SameLine();
ImGui::BeginDisabled(teleportPlayerToCamera.GetChangesAreDisabled());
ImGui::CheckboxHotkey("Teleport Player to Camera", &teleportPlayerToCamera, "Teleports the player to the camera while Free Camera is activated");
ImGui::BeginDisabled(freeCam.GetChangesAreDisabled());
ImGui::SetNextItemWidth(400.0f * Menu::scale);
ImGui::SliderFloat3("Camera Offset (XYZ)", reinterpret_cast<float*>(&cameraOffset), -0.5f, 0.5f, "%.2fm");
ImGui::EndDisabled();
ImGui::SliderFloat("Speed##FreeCam", &freeCamSpeed, 0.1f, 200.0f, "%.2fx", ImGuiSliderFlags_AlwaysClamp);
ImGui::SeparatorText("Third Person Camera");
ImGui::BeginDisabled(thirdPersonCamera.GetChangesAreDisabled());
ImGui::CheckboxHotkey("Enabled##ThirdPerson", &thirdPersonCamera, "Enables the third person camera");
@ -238,25 +302,26 @@ namespace EGT::Menu {
ImGui::CheckboxHotkey("Use Third Person Player (TPP) Model", &tpUseTPPModel, "Uses Aiden's TPP (Third Person Player) model while the third person camera is enabled");
ImGui::EndDisabled();
ImGui::SliderFloat("Distance behind player", &tpDistanceBehindPlayer, 1.0f, 10.0f, "%.2fm");
ImGui::SliderFloat("Height above player", &tpHeightAbovePlayer, 1.0f, 3.0f, "%.2fm");
ImGui::SliderFloat("Horizontal distance from player", &tpHorizontalDistanceFromPlayer, -2.0f, 2.0f, "%.2fm");
ImGui::SliderFloat("FOV##ThirdPerson", "Third person camera field of view", &thirdPersonFOV, 20.0f, 160.0f, "%.0f<EFBFBD>");
ImGui::SliderFloat("Distance behind player", &thirdPersonDistanceBehindPlayer, 1.0f, 10.0f, "%.2fm");
ImGui::SliderFloat("Height above player", &thirdPersonHeightAbovePlayer, 1.0f, 3.0f, "%.2fm");
ImGui::SliderFloat("Horizontal distance from player", &thirdPersonHorizontalDistanceFromPlayer, -2.0f, 2.0f, "%.2fm");
ImGui::SeparatorText("Free Camera");
ImGui::BeginDisabled(freeCam.GetChangesAreDisabled() || photoMode.GetValue());
ImGui::CheckboxHotkey("Enabled##FreeCam", &freeCam, "Enables free camera which allows you to travel anywhere with the camera");
ImGui::EndDisabled();
ImGui::SameLine();
ImGui::BeginDisabled(teleportPlayerToCamera.GetChangesAreDisabled());
ImGui::CheckboxHotkey("Teleport Player to Camera", &teleportPlayerToCamera, "Teleports the player to the camera while Free Camera is activated");
ImGui::EndDisabled();
ImGui::SliderFloat("FOV##FreeCam", "Free camera field of view", &freeCamFOV, 20.0f, 160.0f, "%.0f<EFBFBD>");
ImGui::SliderFloat("Speed##FreeCam", &freeCamSpeed, 0.1f, 200.0f, "%.2fx", ImGuiSliderFlags_AlwaysClamp);
ImGui::SeparatorText("Misc");
ImGui::BeginDisabled(freeCam.GetChangesAreDisabled() || photoMode.GetValue());
ImGui::SliderFloat("X offset", &cameraOffset.X, -10.0f, 10.0f, "%.2fm");
ImGui::SliderFloat("Y offset", &cameraOffset.Y, -10.0f, 10.0f, "%.2fm");
ImGui::SliderFloat("Z offset", &cameraOffset.Z, -10.0f, 10.0f, "%.2fm");
ImGui::EndDisabled();
auto pCVideoSettings = EGSDK::Engine::CVideoSettings::Get();
ImGui::BeginDisabled(!pCVideoSettings || goProMode.GetValue());
if (ImGui::SliderInt("FOV", "Camera Field of View", &FOV, 20, 160) && pCVideoSettings)
pCVideoSettings->extraFOV = static_cast<float>(FOV - baseFOV);
else if (pCVideoSettings && !goProMode.GetValue())
FOV = static_cast<int>(pCVideoSettings->extraFOV) + baseFOV;
ImGui::EndDisabled();
ImGui::BeginDisabled(goProMode.GetValue());
ImGui::SliderFloat("Lens Distortion", "Default game value is 20%", goProMode.GetValue() ? &altLensDistortion : &lensDistortion, 0.0f, 100.0f, "%.1f%%");
ImGui::EndDisabled();
@ -267,6 +332,7 @@ namespace EGT::Menu {
ImGui::CheckboxHotkey("Disable Photo Mode Limits", &disablePhotoModeLimits, "Disables the invisible box while in Photo Mode");
ImGui::SameLine();
ImGui::CheckboxHotkey("Disable Head Correction", &disableHeadCorrection, "Disables centering of the player's hands to the center of the camera");
ImGui::CheckboxHotkey("Zoom In", &firstPersonZoomIn);
ImGui::Separator();
ImGui::TextColored(ImGui::ColorConvertU32ToFloat4(IM_COL32(200, 0, 0, 255)), "* GoPro Mode is best used with Head Bob Reduction set to 0 and Player FOV\nCorrection set to 0 in game options");

View File

@ -63,11 +63,16 @@ namespace EGT::Menu {
};
#ifdef _DEBUG
bool disableLowLevelMouseHook = true;
ImGui::Option disableLowLevelMouseHook{ true };
#else
bool disableLowLevelMouseHook = false;
ImGui::Option disableLowLevelMouseHook { false };
#endif
ImGui::Option disableVftableScanning { false };
#ifdef _DEBUG
ImGui::Option enableDebuggingConsole { true };
#else
ImGui::Option enableDebuggingConsole { false };
#endif
bool disableVftableScanning = false;
static void RenderClassAddrPair(const std::pair<std::string_view, void*(*)()>* pair) {
const float maxInputTextWidth = ImGui::CalcTextSize("0x0000000000000000").x;
@ -100,9 +105,10 @@ namespace EGT::Menu {
void Tab::Render() {
ImGui::SeparatorText("Misc##Debug");
if (ImGui::Checkbox("Disable Low Level Mouse Hook", &disableLowLevelMouseHook, "Disables the low level mouse hook that is used to capture mouse input in the game; this option is used for debugging purposes"))
ImGui_impl::Win32::ToggleMouseHook(disableLowLevelMouseHook);
ImGui_impl::Win32::ToggleMouseHook(disableLowLevelMouseHook.GetValue());
if (ImGui::Checkbox("Disable Vftable Scanning", &disableVftableScanning, "Disables the vftable scanning for classes that are used in the game and used to validate a class in memory; this option is used for debugging purposes"))
EGSDK::ClassHelpers::SetIsVftableScanningDisabled(disableVftableScanning);
EGSDK::ClassHelpers::SetIsVftableScanningDisabled(disableVftableScanning.GetValue());
ImGui::Checkbox("Enable Debugging Console *", &enableDebuggingConsole, "Enables EGameTools' debugging console that shows up when starting up the game; this option is used for debugging purposes");
ImGui::SeparatorText("Class addresses##Debug");
if (ImGui::CollapsingHeader("GamePH", ImGuiTreeNodeFlags_None)) {
ImGui::Indent();
@ -116,6 +122,8 @@ namespace EGT::Menu {
RenderClassAddrPair(&pair);
ImGui::Unindent();
}
ImGui::Separator();
ImGui::TextColored(ImGui::ColorConvertU32ToFloat4(IM_COL32(200, 0, 0, 255)), "* Option requires game restart to apply");
}
}
}

View File

@ -2,6 +2,7 @@
#include <ImGui\imguiex.h>
#include <EGSDK\Core\Core.h>
#include <EGSDK\GamePH\GamePH_Misc.h>
#include <EGSDK\GamePH\GamePH_Hooks.h>
#include <EGT\Menu\Menu.h>
#include <EGT\Core\Core.h>
@ -51,12 +52,16 @@ namespace EGT::Menu {
if (ImGui::BeginTabItem(tab.second->tabName.data())) {
ImGui::SetNextWindowBgAlpha(static_cast<float>(opacity) / 100.0f);
ImGui::SetNextWindowSizeConstraints(ImVec2(std::fmax(minWndSize.x - GImGui->Style.WindowPadding.x * 2.0f, ImGui::CalcTextSize(EGSDK::Core::gameVer > GAME_VER_COMPAT ? "Please wait for a new mod update." : "Upgrade your game version to one that the mod supports.").x), remainingHeight), ImVec2(maxWndSize.x - GImGui->Style.WindowPadding.x * 2.0f, remainingHeight));
ImGui::BeginDisabled(!EGSDK::GamePH::Hooks::didOnPostUpdateHookExecute);
if (ImGui::BeginChild("##TabChild", ImVec2(0.0f, 0.0f), ImGuiChildFlags_AlwaysAutoResize | ImGuiChildFlags_AutoResizeX | ImGuiChildFlags_Border)) {
currentTabIndex = tab.first;
childWidth = ImGui::GetItemRectSize().x;
tab.second->Render();
ImGui::EndChild();
}
ImGui::EndDisabled();
ImGui::EndTabItem();
}
}

View File

@ -377,13 +377,8 @@ namespace EGT::Menu {
ImGui::Text(cameraPos.data());
ImGui::Text(waypointPos.data());
ImGui::PushItemWidth(200.0f * Menu::scale);
ImGui::InputFloat("X", &teleportCoords.X, 1.0f, 10.0f, "%.2f");
ImGui::SameLine();
ImGui::InputFloat("Y", &teleportCoords.Y, 1.0f, 10.0f, "%.2f");
ImGui::SameLine();
ImGui::InputFloat("Z", &teleportCoords.Z, 1.0f, 10.0f, "%.2f");
ImGui::PopItemWidth();
ImGui::SetNextItemWidth(500.0f * Menu::scale);
ImGui::InputFloat3("Teleport Coords (XYZ)", reinterpret_cast<float*>(&teleportCoords), "%.2fm");
ImGui::EndDisabled();
}

View File

@ -3,6 +3,8 @@
#include <EGSDK\Utils\Hook.h>
namespace EGT::Core {
extern void OpenIOBuffer();
extern void CloseIOBuffer();
extern void EnableConsole();
extern void DisableConsole();
@ -28,7 +30,7 @@ static HANDLE mainThreadHandle{};
BOOL APIENTRY DllMain(HMODULE moduleHandle, DWORD64 reasonForCall, void* lpReserved) {
switch (reasonForCall) {
case DLL_PROCESS_ATTACH: {
EGT::Core::EnableConsole();
EGT::Core::OpenIOBuffer();
EGT::Core::InitLogger();
MH_Initialize();
@ -55,6 +57,7 @@ BOOL APIENTRY DllMain(HMODULE moduleHandle, DWORD64 reasonForCall, void* lpReser
SPDLOG_INFO("DLL_PROCESS_DETACH");
EGT::Core::Cleanup();
EGT::Core::DisableConsole();
EGT::Core::CloseIOBuffer();
if (mainThreadHandle) {
SPDLOG_INFO("Closing main thread handle");