Updated the mod to work with the latest patch, I need to clean the code because spending several days just to make this work is not an option, especially after a break that lasted half a year and forgetting what all this damn code does xD

This commit is contained in:
EricPlayZ
2024-01-06 03:33:37 +02:00
parent 1178c9c53d
commit 0d0859395f
21 changed files with 3563 additions and 74 deletions

View File

@ -157,8 +157,9 @@
<AdditionalLibraryDirectories>source\MinHook\lib;</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>source\MinHook\lib;</AdditionalLibraryDirectories>
</Link> </Link>
<PostBuildEvent> <PostBuildEvent>
<Command>copy /Y "$(SolutionDir)Extra Files\Default Config\EGameTools.ini" "$(SolutionDir)$(PlatformShortName)\$(Configuration)\EGameTools.ini"</Command> <Command>copy /Y "$(SolutionDir)Extra Files\Default Config\EGameTools.ini" "$(SolutionDir)$(PlatformShortName)\$(Configuration)\EGameTools.ini"
<Message>Copying the default config file to the debug build directory</Message> copy /Y "$(SolutionDir)x64\Debug\EGameTools.asi" "D:\Program Files (x86)\Steam\steamapps\common\Dying Light 2\ph\work\bin\x64\EGameTools.asi"</Command>
<Message>Copying the default config file to the debug build directory and the compiled ASI into the game folder</Message>
</PostBuildEvent> </PostBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -167,19 +168,20 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;DL2GameOverhaulScript_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp20</LanguageStandard> <LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalIncludeDirectories>source\ImGui;source\ImGuiFileDialog;source\MinHook\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>source\ImGui;source\ImGuiFileDialog;source\MinHook\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>None</DebugInformationFormat>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>false</GenerateDebugInformation>
<EnableUAC>false</EnableUAC> <EnableUAC>false</EnableUAC>
<AdditionalLibraryDirectories>source\MinHook\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>source\MinHook\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libMinHook-x64-v141-mtd.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>libMinHook-x64-v141-mtd.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>

View File

@ -0,0 +1,9 @@
[Camera]
DisablePhotoModeLimits=1
DisableSafezoneFOVReduction=1
[Menu:Keybinds]
ToggleKey=VK_F5
[Player:PlayerVariables]
LastLoadSCRFilePath=C:\Users\EricPlayZ\Desktop\player_variables.scr
LastSaveSCRPath=C:\Users\EricPlayZ\Desktop
UseBACKUPPlayerVars=1

View File

@ -0,0 +1,9 @@
[Camera]
DisablePhotoModeLimits=1
DisableSafezoneFOVReduction=1
[Menu:Keybinds]
ToggleKey=VK_F5
[Player:PlayerVariables]
LastLoadSCRFilePath=C:\Users\EricPlayZ\Desktop\player_variables.scr
LastSaveSCRPath=C:\Users\EricPlayZ\Desktop
UseBACKUPPlayerVars=0

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,7 @@
#pragma once #pragma once
namespace Config { namespace Config {
extern const char playerVars[];
extern int menuToggleKey; extern int menuToggleKey;
extern void SaveConfig(); extern void SaveConfig();

View File

@ -103,7 +103,7 @@ namespace Core {
if (!rendererAPI.empty()) if (!rendererAPI.empty())
return oReadVideoSettings(instance, file, flag1); return oReadVideoSettings(instance, file, flag1);
DWORD renderer = *reinterpret_cast<PDWORD>(reinterpret_cast<DWORD64>(instance) + 0x78); DWORD renderer = *reinterpret_cast<PDWORD>(reinterpret_cast<DWORD64>(instance) + 0x7C);
rendererAPI = !renderer ? "d3d11" : "d3d12"; rendererAPI = !renderer ? "d3d11" : "d3d12";
return oReadVideoSettings(instance, file, flag1); return oReadVideoSettings(instance, file, flag1);
@ -132,6 +132,8 @@ namespace Core {
createdConfigThread = true; createdConfigThread = true;
} }
if (Menu::Player::useBACKUPPlayerVarsEnabled && GamePH::PlayerVariables::playerVars.empty())
GamePH::PlayerVariables::RunHooksBACKUP();
if (!GamePH::PlayerVariables::gotPlayerVars) if (!GamePH::PlayerVariables::gotPlayerVars)
GamePH::PlayerVariables::GetPlayerVars(); GamePH::PlayerVariables::GetPlayerVars();
@ -150,10 +152,11 @@ namespace Core {
DWORD64 WINAPI MainThread(HMODULE hModule) { DWORD64 WINAPI MainThread(HMODULE hModule) {
EnableConsole(); EnableConsole();
HookLdrpInitRoutine();
Config::InitConfig(); Config::InitConfig();
if (!Menu::Player::useBACKUPPlayerVarsEnabled)
HookLdrpInitRoutine();
MH_Initialize(); MH_Initialize();
LoopHookReadVideoSettings(); LoopHookReadVideoSettings();

View File

@ -1,12 +1,19 @@
#include <iostream> #include <iostream>
#include <string_view> #include <string>
#include <thread> #include <thread>
#include "MinHook\include\MinHook.h" #include "MinHook\include\MinHook.h"
#include "sigscan\offsets.h" #include "sigscan\offsets.h"
#include "menu\player.h" #include "menu\player.h"
#include "menu\camera.h" #include "menu\camera.h"
#include "config\config.h"
#include "game_classes.h" #include "game_classes.h"
#include "memory.h" #include "memory.h"
#include "print.h"
#include "utils.h"
//#define DEBUGPVARS
#ifdef DEBUGPVARS
#include <fstream>
#endif
namespace Core { namespace Core {
extern void OnPostUpdate(); extern void OnPostUpdate();
@ -52,7 +59,7 @@ namespace GamePH {
if (!pGameDI_PH2) if (!pGameDI_PH2)
continue; continue;
Hook::VTHook(pGameDI_PH2, &detourOnPostUpdate, reinterpret_cast<LPVOID*>(&oOnPostUpdate), 0x368); Hook::VTHook(pGameDI_PH2, &detourOnPostUpdate, reinterpret_cast<LPVOID*>(&oOnPostUpdate), 0x3a8);
if (oOnPostUpdate) if (oOnPostUpdate)
break; break;
} }
@ -144,39 +151,77 @@ namespace GamePH {
PDWORD64 PlayerVariables::FloatPlayerVariableVT; PDWORD64 PlayerVariables::FloatPlayerVariableVT;
PDWORD64 PlayerVariables::BoolPlayerVariableVT; PDWORD64 PlayerVariables::BoolPlayerVariableVT;
std::vector <std::pair<std::string_view, std::pair<LPVOID, std::string_view>>> PlayerVariables::playerVars; std::vector <std::pair<std::string, std::pair<LPVOID, std::string>>> PlayerVariables::playerVars;
std::vector <std::pair<std::string_view, std::pair<std::any, std::string_view>>> PlayerVariables::playerVarsDefault; std::vector <std::pair<std::string, std::pair<std::any, std::string>>> PlayerVariables::playerVarsDefault;
std::vector <std::pair<std::string, std::pair<std::any, std::string>>> PlayerVariables::playerCustomVarsDefault;
bool PlayerVariables::gotPlayerVars = false; bool PlayerVariables::gotPlayerVars = false;
std::unique_ptr<Hook::BreakpointHook> PlayerVariables::loadPlayerFloatVarBpHook = nullptr; std::unique_ptr<Hook::BreakpointHook> PlayerVariables::loadPlayerFloatVarBpHook = nullptr;
std::unique_ptr<Hook::BreakpointHook> PlayerVariables::loadPlayerBoolVarBpHook = nullptr; std::unique_ptr<Hook::BreakpointHook> PlayerVariables::loadPlayerBoolVarBpHook = nullptr;
bool PlayerVariables::hooked = false; bool PlayerVariables::hooked = false;
bool PlayerVariables::hookedBACKUP = false;
void PlayerVariables::RunHooks() { void PlayerVariables::RunHooks() {
if (hooked) if (hooked)
return; return;
if (!Offsets::Get_LoadPlayerFloatVariableOffset()) if (!Offsets::Get_LoadPlayerFloatVariableOffset())
return; return;
if (!Offsets::Get_LoadPlayerBoolVariableOffset())
return;
loadPlayerFloatVarBpHook = std::make_unique<Hook::BreakpointHook>(Offsets::Get_LoadPlayerFloatVariableOffset(), [&](PEXCEPTION_POINTERS info) -> void { loadPlayerFloatVarBpHook = std::make_unique<Hook::BreakpointHook>(Offsets::Get_LoadPlayerFloatVariableOffset(), [&](PEXCEPTION_POINTERS info) -> void {
const char* tempName = reinterpret_cast<const char*>(info->ContextRecord->R8); const char* tempName = reinterpret_cast<const char*>(info->ContextRecord->R8);
const std::string_view name = tempName; const std::string name = tempName;
PlayerVariables::playerVars.emplace_back(name, std::make_pair(nullptr, "float")); PlayerVariables::playerVars.emplace_back(name, std::make_pair(nullptr, "float"));
PlayerVariables::playerVarsDefault.emplace_back(name, std::make_pair(0.0f, "float")); PlayerVariables::playerVarsDefault.emplace_back(name, std::make_pair(0.0f, "float"));
PlayerVariables::playerCustomVarsDefault.emplace_back(name, std::make_pair(0.0f, "float"));
}); });
loadPlayerBoolVarBpHook = std::make_unique<Hook::BreakpointHook>(Offsets::Get_LoadPlayerBoolVariableOffset(), [&](PEXCEPTION_POINTERS info) -> void { loadPlayerBoolVarBpHook = std::make_unique<Hook::BreakpointHook>(Offsets::Get_LoadPlayerFloatVariableOffset() - Offsets::Get_LoadPlayerVariableFuncSize(), [&](PEXCEPTION_POINTERS info) -> void {
const char* tempName = reinterpret_cast<const char*>(info->ContextRecord->R8); const char* tempName = reinterpret_cast<const char*>(info->ContextRecord->R8);
const std::string_view name = tempName; const std::string name = tempName;
PlayerVariables::playerVars.emplace_back(name, std::make_pair(nullptr, "bool")); PlayerVariables::playerVars.emplace_back(name, std::make_pair(nullptr, "bool"));
PlayerVariables::playerVarsDefault.emplace_back(name, std::make_pair(false, "bool")); PlayerVariables::playerVarsDefault.emplace_back(name, std::make_pair(false, "bool"));
PlayerVariables::playerCustomVarsDefault.emplace_back(name, std::make_pair(false, "bool"));
}); });
hooked = true; hooked = true;
} }
void PlayerVariables::RunHooksBACKUP() {
if (hookedBACKUP)
return;
if (!playerVars.empty())
return;
if (!Offsets::Get_LoadPlayerFloatVariableOffset())
return;
std::stringstream ss(Config::playerVars);
while (ss.good()) {
std::string pVar{};
getline(ss, pVar, ',');
std::stringstream ssPVar(pVar);
std::string varName{};
std::string varType{};
while (ssPVar.good()) {
std::string subStr{};
getline(ssPVar, subStr, ':');
if (subStr != "float" && subStr != "bool")
varName = subStr;
else
varType = subStr;
}
PlayerVariables::playerVars.emplace_back(varName, std::make_pair(nullptr, varType));
PlayerVariables::playerVarsDefault.emplace_back(varName, std::make_pair(varType == "float" ? 0.0f : false, varType));
PlayerVariables::playerCustomVarsDefault.emplace_back(varName, std::make_pair(varType == "float" ? 0.0f : false, varType));
}
hookedBACKUP = true;
}
PDWORD64 PlayerVariables::GetFloatPlayerVariableVT() { PDWORD64 PlayerVariables::GetFloatPlayerVariableVT() {
if (FloatPlayerVariableVT) if (FloatPlayerVariableVT)
@ -212,6 +257,21 @@ namespace GamePH {
if (!GetBoolPlayerVariableVT()) if (!GetBoolPlayerVariableVT())
return; return;
#ifdef DEBUGPVARS
std::string pVars{};
for (auto const& [key, val] : GamePH::PlayerVariables::playerVars) {
pVars.append(key);
pVars.append(":");
pVars.append(val.second);
pVars.append(",");
}
pVars.pop_back();
std::ofstream out("pvars.txt");
out << pVars;
out.close();
#endif
PDWORD64* playerVarsMem = reinterpret_cast<PDWORD64*>(Get()); PDWORD64* playerVarsMem = reinterpret_cast<PDWORD64*>(Get());
bool isFloatPlayerVar = false; bool isFloatPlayerVar = false;
bool isBoolPlayerVar = false; bool isBoolPlayerVar = false;
@ -223,7 +283,7 @@ namespace GamePH {
if (isFloatPlayerVar || isBoolPlayerVar) { if (isFloatPlayerVar || isBoolPlayerVar) {
it->second.first = playerVarsMem + 1; it->second.first = playerVarsMem + 1;
const std::string_view varName = it->first; const std::string varName = it->first;
auto itDef = std::find_if(GamePH::PlayerVariables::playerVarsDefault.begin(), GamePH::PlayerVariables::playerVarsDefault.end(), [&varName](const auto& pair) { auto itDef = std::find_if(GamePH::PlayerVariables::playerVarsDefault.begin(), GamePH::PlayerVariables::playerVarsDefault.end(), [&varName](const auto& pair) {
return pair.first == varName; return pair.first == varName;
@ -235,6 +295,16 @@ namespace GamePH {
itDef->second.first = *reinterpret_cast<bool*>(it->second.first); itDef->second.first = *reinterpret_cast<bool*>(it->second.first);
} }
auto itCustomDef = std::find_if(GamePH::PlayerVariables::playerCustomVarsDefault.begin(), GamePH::PlayerVariables::playerCustomVarsDefault.end(), [&varName](const auto& pair) {
return pair.first == varName;
});
if (itCustomDef != GamePH::PlayerVariables::playerCustomVarsDefault.end()) {
if (isFloatPlayerVar)
itCustomDef->second.first = *reinterpret_cast<float*>(it->second.first);
else
itCustomDef->second.first = *reinterpret_cast<bool*>(it->second.first);
}
playerVarsMem += isFloatPlayerVar ? 3 : 2; playerVarsMem += isFloatPlayerVar ? 3 : 2;
break; break;
} else } else
@ -243,8 +313,10 @@ namespace GamePH {
} }
gotPlayerVars = true; gotPlayerVars = true;
loadPlayerFloatVarBpHook->Disable(); if (!Menu::Player::useBACKUPPlayerVarsEnabled) {
loadPlayerBoolVarBpHook->Disable(); loadPlayerFloatVarBpHook->Disable();
loadPlayerBoolVarBpHook->Disable();
}
} }
PlayerVariables* PlayerVariables::Get() { PlayerVariables* PlayerVariables::Get() {
@ -318,10 +390,10 @@ namespace GamePH {
#pragma region FreeCamera #pragma region FreeCamera
Vector3* FreeCamera::GetPosition(Vector3* posIN) { Vector3* FreeCamera::GetPosition(Vector3* posIN) {
return Memory::CallVT<198, Vector3*>(this, posIN); return Memory::CallVT<181, Vector3*>(this, posIN);
} }
void FreeCamera::AllowCameraMovement(int mode) { void FreeCamera::AllowCameraMovement(int mode) {
Memory::CallVT<203>(this, mode); Memory::CallVT<187>(this, mode);
} }
FreeCamera* FreeCamera::Get() { FreeCamera* FreeCamera::Get() {
@ -410,7 +482,7 @@ namespace GamePH {
#pragma region LevelDI #pragma region LevelDI
float LevelDI::GetTimePlayed() { float LevelDI::GetTimePlayed() {
return Memory::CallVT<334, float>(this); return Memory::CallVT<317, float>(this);
} }
LPVOID LevelDI::GetViewCamera() { LPVOID LevelDI::GetViewCamera() {
if (!Offsets::Get_GetViewCameraOffset()) if (!Offsets::Get_GetViewCameraOffset())
@ -461,7 +533,7 @@ namespace GamePH {
if (!pGameDI_PH) if (!pGameDI_PH)
return nullptr; return nullptr;
GameDI_PH2* ptr = reinterpret_cast<GameDI_PH2*>(reinterpret_cast<DWORD64>(pGameDI_PH) + Offsets::Get_gameDI_PH2Offset()); GameDI_PH2* ptr = reinterpret_cast<GameDI_PH2*>(reinterpret_cast<DWORD64>(pGameDI_PH) + Offsets::Get_gameDI_PH2_offset());
if (!Memory::IsValidPtrMod(ptr, "gamedll_ph_x64_rwdi.dll")) if (!Memory::IsValidPtrMod(ptr, "gamedll_ph_x64_rwdi.dll"))
return nullptr; return nullptr;
@ -473,14 +545,11 @@ namespace GamePH {
#pragma endregion #pragma endregion
#pragma region GameDI_PH #pragma region GameDI_PH
PDWORD64 GameDI_PH::GetLocalPlayerEntity() {
return Memory::CallVT<135, PDWORD64>(this);
}
INT64 GameDI_PH::GetCurrentGameVersion() { INT64 GameDI_PH::GetCurrentGameVersion() {
return Memory::CallVT<218, INT64>(this); return Memory::CallVT<225, INT64>(this);
} }
void GameDI_PH::TogglePhotoMode(bool doNothing, bool setAsOptionalCamera) { void GameDI_PH::TogglePhotoMode(bool doNothing, bool setAsOptionalCamera) {
Memory::CallVT<249>(this, doNothing, setAsOptionalCamera); Memory::CallVT<258>(this, doNothing, setAsOptionalCamera);
} }
GameDI_PH* GameDI_PH::Get() { GameDI_PH* GameDI_PH::Get() {

View File

@ -2,7 +2,7 @@
#include <Windows.h> #include <Windows.h>
#include <map> #include <map>
#include <vector> #include <vector>
#include <string_view> #include <string>
#include <memory> #include <memory>
#include <any> #include <any>
#include "hook.h" #include "hook.h"
@ -58,15 +58,18 @@ namespace GamePH {
static PDWORD64 FloatPlayerVariableVT; static PDWORD64 FloatPlayerVariableVT;
static PDWORD64 BoolPlayerVariableVT; static PDWORD64 BoolPlayerVariableVT;
public: public:
static std::vector<std::pair<std::string_view, std::pair<LPVOID, std::string_view>>> playerVars; static std::vector<std::pair<std::string, std::pair<LPVOID, std::string>>> playerVars;
static std::vector<std::pair<std::string_view, std::pair<std::any, std::string_view>>> playerVarsDefault; static std::vector<std::pair<std::string, std::pair<std::any, std::string>>> playerVarsDefault;
static std::vector<std::pair<std::string, std::pair<std::any, std::string>>> playerCustomVarsDefault;
static bool gotPlayerVars; static bool gotPlayerVars;
static std::unique_ptr<Hook::BreakpointHook> loadPlayerFloatVarBpHook; static std::unique_ptr<Hook::BreakpointHook> loadPlayerFloatVarBpHook;
static std::unique_ptr<Hook::BreakpointHook> loadPlayerBoolVarBpHook; static std::unique_ptr<Hook::BreakpointHook> loadPlayerBoolVarBpHook;
static bool hooked; static bool hooked;
static bool hookedBACKUP;
static void RunHooks(); static void RunHooks();
static void RunHooksBACKUP();
static PDWORD64 GetFloatPlayerVariableVT(); static PDWORD64 GetFloatPlayerVariableVT();
static PDWORD64 GetBoolPlayerVariableVT(); static PDWORD64 GetBoolPlayerVariableVT();
@ -78,7 +81,7 @@ namespace GamePH {
class PlayerState { class PlayerState {
public: public:
union { union {
DEFINE_MEMBER_N(PlayerVariables*, playerVars, 0x278); DEFINE_MEMBER_N(PlayerVariables*, playerVars, 0x290);
}; };
static PlayerState* Get(); static PlayerState* Get();
@ -146,7 +149,6 @@ namespace GamePH {
class GameDI_PH { class GameDI_PH {
public: public:
PDWORD64 GetLocalPlayerEntity();
INT64 GetCurrentGameVersion(); INT64 GetCurrentGameVersion();
void TogglePhotoMode(bool doNothing = false, bool setAsOptionalCamera = false); void TogglePhotoMode(bool doNothing = false, bool setAsOptionalCamera = false);
@ -156,7 +158,7 @@ namespace GamePH {
class PlayerObjProperties { class PlayerObjProperties {
public: public:
union { union {
DEFINE_MEMBER_N(Engine::CoPhysicsProperty*, pCoPhysicsProperty, 0xE8); DEFINE_MEMBER_N(Engine::CoPhysicsProperty*, pCoPhysicsProperty, 0xF0);
}; };
static PlayerObjProperties* Get(); static PlayerObjProperties* Get();
@ -167,7 +169,7 @@ namespace Engine {
class CVideoSettings { class CVideoSettings {
public: public:
union { union {
DEFINE_MEMBER_N(float, ExtraFOV, 0x78); DEFINE_MEMBER_N(float, ExtraFOV, 0x7C);
}; };
static CVideoSettings* Get(); static CVideoSettings* Get();
@ -187,7 +189,7 @@ namespace Engine {
union { union {
DEFINE_MEMBER_N(GamePH::GameDI_PH*, pGameDI_PH, 0x8); DEFINE_MEMBER_N(GamePH::GameDI_PH*, pGameDI_PH, 0x8);
DEFINE_MEMBER_N(CVideoSettings*, pCVideoSettings, 0x28); DEFINE_MEMBER_N(CVideoSettings*, pCVideoSettings, 0x28);
DEFINE_MEMBER_N(CLevel*, pCLevel, 0x370); DEFINE_MEMBER_N(CLevel*, pCLevel, 0x380);
}; };
static CGame* Get(); static CGame* Get();
@ -213,9 +215,9 @@ namespace Engine {
class CBulletPhysicsCharacter { class CBulletPhysicsCharacter {
public: public:
union { union {
DEFINE_MEMBER_N(Vector3, playerPos2, 0x87C); DEFINE_MEMBER_N(Vector3, playerPos2, 0x8A0);
DEFINE_MEMBER_N(Vector3, playerPos, 0x894); DEFINE_MEMBER_N(Vector3, playerPos, 0x8B8);
DEFINE_MEMBER_N(float, playerDownwardVelocity, 0xC28); DEFINE_MEMBER_N(float, playerDownwardVelocity, 0xC38);
}; };
static Vector3 posBeforeFreeze; static Vector3 posBeforeFreeze;

View File

@ -1,7 +1,7 @@
#include "hook.h"
#include "sigscan\offsets.h"
#include <cstdint> #include <cstdint>
#include <iostream> #include <iostream>
#include "sigscan\offsets.h"
#include "hook.h"
namespace Hook { namespace Hook {
// VTable hooking // VTable hooking

View File

@ -156,7 +156,7 @@ namespace Menu {
} }
ImGui::BeginDisabled(!GamePH::PlayerVariables::gotPlayerVars); { ImGui::BeginDisabled(!GamePH::PlayerVariables::gotPlayerVars); {
ImGui::Checkbox("Disabled Safezone FOV Reduction", &disableSafezoneFOVReductionEnabled.value); ImGui::Checkbox("Disable Safezone FOV Reduction", &disableSafezoneFOVReductionEnabled.value);
ImGui::EndDisabled(); ImGui::EndDisabled();
} }
} }

View File

@ -6,7 +6,7 @@
namespace Menu { namespace Menu {
static const ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize; static const ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize;
static const ImVec2 minWndSize = ImVec2(0.0f, 0.0f); static const ImVec2 minWndSize = ImVec2(0.0f, 0.0f);
static const ImVec2 maxWndSize = ImVec2(700.0f, 675.0f); static const ImVec2 maxWndSize = ImVec2(900.0f, 675.0f);
bool isOpen = false; bool isOpen = false;

View File

@ -5684,16 +5684,22 @@ namespace Menu {
0x75, 0x65, 0x6E, 0x63, 0x65, 0x22, 0x2C, 0x20, 0x22, 0x31, 0x2E, 0x30, 0x22, 0x29, 0x3B, 0x0D, 0x75, 0x65, 0x6E, 0x63, 0x65, 0x22, 0x2C, 0x20, 0x22, 0x31, 0x2E, 0x30, 0x22, 0x29, 0x3B, 0x0D,
0x0A, 0x7D, 0x0D, 0x0A }; 0x0A, 0x7D, 0x0D, 0x0A };
#pragma endregion #pragma endregion
static bool debugEnabled = false;
SMART_BOOL godModeEnabled{}; SMART_BOOL godModeEnabled{};
SMART_BOOL freezePlayerEnabled{}; SMART_BOOL freezePlayerEnabled{};
bool useBACKUPPlayerVarsEnabled = false;
std::string saveSCRPath{}; std::string saveSCRPath{};
std::string loadSCRFilePath{}; std::string loadSCRFilePath{};
bool restoreVarsToSavedVarsEnabled = false;
static char playerVarsSearchFilter[64]; static char playerVarsSearchFilter[64];
static std::string_view getParamName(const std::string_view str) { static std::string getParamName(const std::string str) {
size_t firstQuotePos = str.find_first_of("\""); size_t firstQuotePos = str.find_first_of("\"");
size_t lastQuotePos = firstQuotePos; size_t lastQuotePos = firstQuotePos;
if (firstQuotePos == std::string::npos) if (firstQuotePos == std::string::npos)
@ -5748,7 +5754,7 @@ namespace Menu {
std::string line{}; std::string line{};
while (std::getline(iss, line)) { while (std::getline(iss, line)) {
const std::string origLine = line; const std::string origLine = line;
const std::string_view paramName = getParamName(line); const std::string paramName = getParamName(line);
if (paramName.empty()) if (paramName.empty())
continue; continue;
@ -5791,7 +5797,7 @@ namespace Menu {
std::string line{}; std::string line{};
while (std::getline(file, line)) { while (std::getline(file, line)) {
const std::string_view paramName = getParamName(line); const std::string paramName = getParamName(line);
if (paramName.empty()) if (paramName.empty())
continue; continue;
const std::string paramValue = getParamValue(line); const std::string paramValue = getParamValue(line);
@ -5823,10 +5829,12 @@ namespace Menu {
for (auto const& [key, val] : GamePH::PlayerVariables::playerVars) { for (auto const& [key, val] : GamePH::PlayerVariables::playerVars) {
if (!val.first) if (!val.first)
continue; continue;
auto itDef = std::find_if(GamePH::PlayerVariables::playerVarsDefault.begin(), GamePH::PlayerVariables::playerVarsDefault.end(), [&key](const auto& pair) {
auto& defVars = restoreVarsToSavedVarsEnabled ? GamePH::PlayerVariables::playerCustomVarsDefault : GamePH::PlayerVariables::playerVarsDefault;
auto itDef = std::find_if(defVars.begin(), defVars.end(), [&key](const auto& pair) {
return pair.first == key; return pair.first == key;
}); });
if (itDef == GamePH::PlayerVariables::playerVarsDefault.end()) if (itDef == defVars.end())
continue; continue;
if (val.second == "float") { if (val.second == "float") {
@ -5842,6 +5850,28 @@ namespace Menu {
ImGui::OpenPopup("Restored player variables!"); ImGui::OpenPopup("Restored player variables!");
} }
static void SaveVariablesAsDefault() {
for (auto const& [key, val] : GamePH::PlayerVariables::playerVars) {
if (!val.first)
continue;
auto itCustomDef = std::find_if(GamePH::PlayerVariables::playerCustomVarsDefault.begin(), GamePH::PlayerVariables::playerCustomVarsDefault.end(), [&key](const auto& pair) {
return pair.first == key;
});
if (itCustomDef == GamePH::PlayerVariables::playerCustomVarsDefault.end())
continue;
if (val.second == "float") {
float* varAddr = reinterpret_cast<float*>(val.first);
itCustomDef->second.first = *varAddr;
} else if (val.second == "bool") {
bool* varAddr = reinterpret_cast<bool*>(val.first);
itCustomDef->second.first = *varAddr;
}
}
ImGui::OpenPopup("Saved current player variables!");
}
static void RestoreVariableToDefault(LPVOID variable) { static void RestoreVariableToDefault(LPVOID variable) {
auto it = std::find_if(GamePH::PlayerVariables::playerVars.begin(), GamePH::PlayerVariables::playerVars.end(), [&variable](const auto& pair) { auto it = std::find_if(GamePH::PlayerVariables::playerVars.begin(), GamePH::PlayerVariables::playerVars.end(), [&variable](const auto& pair) {
return pair.second.first == variable; return pair.second.first == variable;
@ -5849,10 +5879,11 @@ namespace Menu {
if (it == GamePH::PlayerVariables::playerVars.end()) if (it == GamePH::PlayerVariables::playerVars.end())
return; return;
auto itDef = std::find_if(GamePH::PlayerVariables::playerVarsDefault.begin(), GamePH::PlayerVariables::playerVarsDefault.end(), [&it](const auto& pair) { auto& defVars = restoreVarsToSavedVarsEnabled ? GamePH::PlayerVariables::playerCustomVarsDefault : GamePH::PlayerVariables::playerVarsDefault;
auto itDef = std::find_if(defVars.begin(), defVars.end(), [&it](const auto& pair) {
return pair.first == it->first; return pair.first == it->first;
}); });
if (itDef == GamePH::PlayerVariables::playerVarsDefault.end()) if (itDef == defVars.end())
return; return;
if (it->second.second == "float") { if (it->second.second == "float") {
@ -5894,6 +5925,30 @@ namespace Menu {
playerCharacter->FreezeCharacter(); playerCharacter->FreezeCharacter();
} }
void UpdatePlayerVars() {
auto bgn = GamePH::PlayerVariables::playerVars.begin();
for (auto it = bgn; it != GamePH::PlayerVariables::playerVars.end(); ++it) {
if (!it->second.first)
continue;
try {
auto& valDef = GamePH::PlayerVariables::playerVarsDefault.at(it - bgn);
if (it->second.second == "float") {
float* varAddr = reinterpret_cast<float*>(it->second.first);
if (!Utils::are_same(*varAddr, *(varAddr + 1)) && !Utils::are_same(*(varAddr + 1), std::any_cast<float>(valDef.second.first)))
*varAddr = *(varAddr + 1);
} else if (it->second.second == "bool") {
bool* varAddr = reinterpret_cast<bool*>(it->second.first);
if (*varAddr != *(varAddr + 1) && *(varAddr + 1) != std::any_cast<bool>(valDef.second.first))
*varAddr = *(varAddr + 1);
}
} catch (std::out_of_range& e) {
UNREFERENCED_PARAMETER(e);
}
}
}
void Update() { void Update() {
if (Menu::Camera::freeCamEnabled.value) if (Menu::Camera::freeCamEnabled.value)
godModeEnabled.Change(true); godModeEnabled.Change(true);
@ -5906,9 +5961,12 @@ namespace Menu {
freezePlayerEnabled.Restore(); freezePlayerEnabled.Restore();
PlayerPositionUpdate(); PlayerPositionUpdate();
UpdatePlayerVars();
} }
void Render() { void Render() {
ImGui::Checkbox("Debug", &debugEnabled);
ImGui::BeginDisabled(!GamePH::PlayerHealthModule::Get() || Menu::Camera::freeCamEnabled.value); { ImGui::BeginDisabled(!GamePH::PlayerHealthModule::Get() || Menu::Camera::freeCamEnabled.value); {
ImGui::Checkbox("God Mode", &godModeEnabled.value); ImGui::Checkbox("God Mode", &godModeEnabled.value);
ImGui::EndDisabled(); ImGui::EndDisabled();
@ -5918,6 +5976,9 @@ namespace Menu {
ImGui::Checkbox("Freeze Player", &freezePlayerEnabled.value); ImGui::Checkbox("Freeze Player", &freezePlayerEnabled.value);
ImGui::EndDisabled(); ImGui::EndDisabled();
} }
ImGui::Checkbox("Use BACKUP Player Vars (USE ONLY IF PLAYER VARIABLES IS DISABLED!)", &useBACKUPPlayerVarsEnabled);
ImGui::BeginDisabled(!GamePH::PlayerVariables::gotPlayerVars); { ImGui::BeginDisabled(!GamePH::PlayerVariables::gotPlayerVars); {
if (ImGui::CollapsingHeader("Player Variables", ImGuiTreeNodeFlags_None)) { if (ImGui::CollapsingHeader("Player Variables", ImGuiTreeNodeFlags_None)) {
ImGui::Indent(); ImGui::Indent();
@ -5926,9 +5987,15 @@ namespace Menu {
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("Load variables from file")) if (ImGui::Button("Load variables from file"))
ImGuiFileDialog::Instance()->OpenDialog("ChooseSCRLoadPath", "Choose File", ".scr", loadSCRFilePath.empty() ? "." : loadSCRFilePath); ImGuiFileDialog::Instance()->OpenDialog("ChooseSCRLoadPath", "Choose File", ".scr", loadSCRFilePath.empty() ? "." : loadSCRFilePath);
ImGui::SameLine();
ImGui::Checkbox("Restore variables to saved variables", &restoreVarsToSavedVarsEnabled);
if (ImGui::Button("Restore variables to default")) if (ImGui::Button("Restore variables to default"))
RestoreVariablesToDefault(); RestoreVariablesToDefault();
ImGui::SameLine();
if (ImGui::Button("Save current variables as default"))
SaveVariablesAsDefault();
ImGui::Separator(); ImGui::Separator();
ImGui::InputTextWithHint("##VarsSearch", "Search variables", playerVarsSearchFilter, 64); ImGui::InputTextWithHint("##VarsSearch", "Search variables", playerVarsSearchFilter, 64);
@ -5948,23 +6015,37 @@ namespace Menu {
if (val.second == "float") { if (val.second == "float") {
float* varAddr = reinterpret_cast<float*>(val.first); float* varAddr = reinterpret_cast<float*>(val.first);
ImGui::InputFloat(key.data(), &*varAddr); float newValue = *varAddr;
if (ImGui::InputFloat(key.data(), &newValue)) {
*varAddr = newValue;
*(varAddr + 1) = newValue;
}
ImGui::SameLine(); ImGui::SameLine();
restoreBtnName = std::string("Restore##") + std::string(key); restoreBtnName = std::string("Restore##") + std::string(key);
if (ImGui::Button(restoreBtnName.c_str())) if (ImGui::Button(restoreBtnName.c_str()))
RestoreVariableToDefault(val.first); RestoreVariableToDefault(val.first);
if (debugEnabled) {
*(varAddr + 1) = *varAddr; ImGui::SameLine();
ImGui::Text("0x%p", varAddr);
}
} else if (val.second == "bool") { } else if (val.second == "bool") {
bool* varAddr = reinterpret_cast<bool*>(val.first); bool* varAddr = reinterpret_cast<bool*>(val.first);
ImGui::Checkbox(key.data(), &*varAddr); bool newValue = *varAddr;
if (ImGui::Checkbox(key.data(), &newValue)) {
*varAddr = newValue;
*(varAddr + 1) = newValue;
}
ImGui::SameLine(); ImGui::SameLine();
restoreBtnName = std::string("Restore##") + std::string(key); restoreBtnName = std::string("Restore##") + std::string(key);
if (ImGui::Button(restoreBtnName.c_str())) if (ImGui::Button(restoreBtnName.c_str()))
RestoreVariableToDefault(val.first); RestoreVariableToDefault(val.first);
if (debugEnabled) {
*(varAddr + 1) = *varAddr; ImGui::SameLine();
ImGui::Text("0x%p", varAddr);
}
} }
} }
ImGui::Unindent(); ImGui::Unindent();
@ -6019,6 +6100,12 @@ namespace Menu {
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
ImGui::EndPopup(); ImGui::EndPopup();
} }
if (ImGui::BeginPopupModal("Saved current player variables!", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::Text("All current player variables have been stored as default! Now if you have \"Restore variables to saved variables\" enabled, restoring to default will restore player variables to the ones you have saved!");
if (ImGui::Button("OK", ImVec2(120.0f, 0.0f)))
ImGui::CloseCurrentPopup();
ImGui::EndPopup();
}
} }
} }
} }

View File

@ -7,9 +7,13 @@ namespace Menu {
extern SMART_BOOL godModeEnabled; extern SMART_BOOL godModeEnabled;
extern SMART_BOOL freezePlayerEnabled; extern SMART_BOOL freezePlayerEnabled;
extern bool useBACKUPPlayerVarsEnabled;
extern std::string saveSCRPath; extern std::string saveSCRPath;
extern std::string loadSCRFilePath; extern std::string loadSCRFilePath;
extern bool restoreVarsToSavedVarsEnabled;
extern void Update(); extern void Update();
extern void Render(); extern void Render();
} }

View File

@ -2,15 +2,12 @@
#include "sigscan.h" #include "sigscan.h"
#include "..\memory.h" #include "..\memory.h"
// macro for lazily adding signatures to this sig list
#define AddOffset(name, moduleName, pattern, type, retType) \ #define AddOffset(name, moduleName, pattern, type, retType) \
static retType Get_## name () {\ static retType Get_## name () {\
static retType name = NULL;\ static retType name = NULL;\
if (Memory::IsValidPtr(name)) return name; \ if (Memory::IsValidPtr(name)) return name; \
return name=reinterpret_cast<retType>(PatternScanner::FindPattern(moduleName, {pattern, type}));\ return name=reinterpret_cast<retType>(PatternScanner::FindPattern(moduleName, {pattern, type}));\
} }
// macro for lazily adding offsets to the sig list
#define AddStaticOffset(name, off) \ #define AddStaticOffset(name, off) \
static DWORD64 Get_## name () {\ static DWORD64 Get_## name () {\
static DWORD64 name = NULL;\ static DWORD64 name = NULL;\
@ -18,44 +15,44 @@ static DWORD64 Get_## name () {\
return name=static_cast<DWORD64>(off);\ return name=static_cast<DWORD64>(off);\
} }
// Static offsets go here // NEEDS REPLACING SIGNATURES FOR MOST!!!
struct Offsets { struct Offsets {
// ntdll.dll // ntdll.dll
AddOffset(LdrpCallInitRoutineOffset, "ntdll.dll", "[48 89 5C 24 08 44 89 44 24 18 48", PatternType::Address, PDWORD64) AddOffset(LdrpCallInitRoutineOffset, "ntdll.dll", "[48 89 5C 24 08 44 89 44 24 18 48", PatternType::Address, PDWORD64)
AddOffset(LdrpRunInitializeRoutinesOffset, "ntdll.dll", "[48 89 4C 24 08 53 56 57 41 54 41 55 41 56 41 57 48 81 EC 90", PatternType::Address, PDWORD64) // for win7 AddOffset(LdrpRunInitializeRoutinesOffset, "ntdll.dll", "[48 89 4C 24 08 53 56 57 41 54 41 55 41 56 41 57 48 81 EC 90", PatternType::Address, PDWORD64) // for win7
// Input related // Input related
AddOffset(g_CInput, "engine_x64_rwdi.dll", "48 89 05 [?? ?? ?? ?? E8 ?? ?? ?? ?? 48 8B 86 ?? ?? ?? ??", PatternType::RelativePointer, PDWORD64*) AddOffset(g_CInput, "engine_x64_rwdi.dll", "48 8B 0D [?? ?? ?? ?? 48 85 C9 74 0F 48 8B 01 84 D2", PatternType::RelativePointer, PDWORD64*)
// Player vars related // Player vars related
AddOffset(LoadPlayerFloatVariableOffset, "gamedll_ph_x64_rwdi.dll", "E8 [?? ?? ?? ?? 48 8D 55 80 48 8B 08", PatternType::RelativePointer, PDWORD64); AddStaticOffset(LoadPlayerVariableFuncSize, 0x14E)
AddOffset(LoadPlayerBoolVariableOffset, "gamedll_ph_x64_rwdi.dll", "E8 [?? ?? ?? ?? 48 8D 55 98 48 8B 08", PatternType::RelativePointer, PDWORD64); AddOffset(LoadPlayerFloatVariableOffset, "gamedll_ph_x64_rwdi.dll", "E8 [?? ?? ?? ?? 48 8B D0 48 8D 8C 24 ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 8D 94 24 ?? ?? ?? ?? 48 8B 8C 24 ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 8D 8C 24 ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 8D 8C 24 ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 8B 84 24 ?? ?? ?? ??", PatternType::RelativePointer, PDWORD64);
AddOffset(InitializePlayerVariablesOffset, "gamedll_ph_x64_rwdi.dll", "E8 [?? ?? ?? ?? 48 8B E8 48 8B CF 48 89 AF ?? ?? ?? ??", PatternType::RelativePointer, DWORD64) AddOffset(InitializePlayerVariablesOffset, "gamedll_ph_x64_rwdi.dll", "E8 [?? ?? ?? ?? 48 8B F0 48 8B CF", PatternType::RelativePointer, DWORD64)
AddStaticOffset(initPlayerFloatVarsInstrOffset, 0xE); AddStaticOffset(initPlayerFloatVarsInstrOffset, 0x99);
AddStaticOffset(initPlayerBoolVarsInstrOffset, 0x234); AddStaticOffset(initPlayerBoolVarsInstrOffset, 0x2E7);
AddOffset(PlayerStateOffset, "gamedll_ph_x64_rwdi.dll", "48 8B 3D [?? ?? ?? ?? 4C 8B EA", PatternType::RelativePointer, LPVOID) AddOffset(PlayerStateOffset, "gamedll_ph_x64_rwdi.dll", "4C 8B 35 [?? ?? ?? ?? 4C 8B E2", PatternType::RelativePointer, LPVOID)
// Game related // Game related
AddStaticOffset(gameDI_PH2_offset, 0x28)
AddOffset(CLobbySteamOffset, "engine_x64_rwdi.dll", "48 8B 05 [?? ?? ?? ?? 48 85 C0 74 05 48 83 C0 08 C3", PatternType::RelativePointer, LPVOID) AddOffset(CLobbySteamOffset, "engine_x64_rwdi.dll", "48 8B 05 [?? ?? ?? ?? 48 85 C0 74 05 48 83 C0 08 C3", PatternType::RelativePointer, LPVOID)
AddStaticOffset(gameDI_PH2Offset, 0x18)
AddOffset(g_PlayerObjProperties, "gamedll_ph_x64_rwdi.dll", "48 8B D9 48 89 0D [?? ?? ?? ??", PatternType::RelativePointer, LPVOID) AddOffset(g_PlayerObjProperties, "gamedll_ph_x64_rwdi.dll", "48 8B D9 48 89 0D [?? ?? ?? ??", PatternType::RelativePointer, LPVOID)
AddOffset(g_DayNightCycle, "gamedll_ph_x64_rwdi.dll", "48 8B 0D [?? ?? ?? ?? 48 85 C9 74 10 E8 ?? ?? ?? ?? 84 C0 74 07 B0 01 48 83 C4 28 C3 32 C0", PatternType::RelativePointer, LPVOID) AddOffset(g_DayNightCycle, "gamedll_ph_x64_rwdi.dll", "48 8B 0D [?? ?? ?? ?? 48 85 C9 74 10 E8 ?? ?? ?? ?? 84 C0 74 07 B0 01 48 83 C4 28 C3 32 C0", PatternType::RelativePointer, LPVOID)
AddOffset(g_CameraFPPDI, "gamedll_ph_x64_rwdi.dll", "48 89 05 [?? ?? ?? ?? 40 84 FF", PatternType::RelativePointer, PDWORD64) 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) AddOffset(g_FreeCamera, "gamedll_ph_x64_rwdi.dll", "48 89 05 [?? ?? ?? ?? 48 89 4C 24 ??", PatternType::RelativePointer, PDWORD64)
// Functions // Functions
AddOffset(ReadVideoSettingsOffset, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? 48 8D 4C 24 ?? FF 15 ?? ?? ?? ?? 8B 54 24 78", PatternType::RelativePointer, LPVOID) AddOffset(ReadVideoSettingsOffset, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? 48 8D 4C 24 ?? FF 15 ?? ?? ?? ?? 48 C7 C2 ?? ?? ?? ??", PatternType::RelativePointer, LPVOID)
AddOffset(CalculateFreeCamCollisionOffset, "gamedll_ph_x64_rwdi.dll", "E8 [?? ?? ?? ?? 48 8B 06 4C 8D 4C 24 ??", PatternType::RelativePointer, LPVOID) AddOffset(CalculateFreeCamCollisionOffset, "gamedll_ph_x64_rwdi.dll", "E8 [?? ?? ?? ?? 48 8B 06 4C 8D 4C 24 ??", PatternType::RelativePointer, LPVOID)
AddOffset(GetViewCameraOffset, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? 48 85 C0 74 28 48 8B C8", PatternType::RelativePointer, LPVOID) AddOffset(GetViewCameraOffset, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? 48 85 C0 74 28 48 8B C8", PatternType::RelativePointer, LPVOID)
AddOffset(MoveCharacterOffset, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? 80 BB ?? ?? ?? ?? ?? 74 4E", PatternType::RelativePointer, LPVOID) // NOT USING FOR NOW
//AddOffset(MoveCharacterOffset, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? 80 BB ?? ?? ?? ?? ?? 74 4E", PatternType::RelativePointer, LPVOID)
AddOffset(CreatePlayerHealthModuleOffset, "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(CreatePlayerHealthModuleOffset, "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(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(TogglePhotoMode, "gamedll_ph_x64_rwdi.dll", "48 83 EC 48 38 91 ?? ?? ?? ??", PatternType::Address, LPVOID)
AddOffset(GetTimeWeatherSystemOffset, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? 33 D2 48 8B C8 E8 ?? ?? ?? ?? 4C 8B C8", PatternType::RelativePointer, LPVOID) AddOffset(GetTimeWeatherSystemOffset, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? 33 D2 48 8B C8 E8 ?? ?? ?? ?? 49 8D 4F 38", PatternType::RelativePointer, LPVOID)
AddOffset(SetForcedWeatherOffset, "engine_x64_rwdi.dll", "89 51 68 C3 CC CC CC CC CC CC CC CC CC CC CC CC", PatternType::Address, LPVOID) AddOffset(SetForcedWeatherOffset, "engine_x64_rwdi.dll", "89 51 68 C3 CC CC CC CC CC CC CC CC CC CC CC CC", PatternType::Address, LPVOID)
AddOffset(GetCurrentWeatherOffset, "engine_x64_rwdi.dll", "48 8B 41 78 48 85 C0 75 0F", PatternType::Address, LPVOID) AddOffset(GetCurrentWeatherOffset, "engine_x64_rwdi.dll", "48 8B 41 78 48 85 C0 75 0F", PatternType::Address, LPVOID)
}; };
#undef AddFuncCall
#undef AddOffset #undef AddOffset
#undef AddStaticOffset #undef AddStaticOffset

View File

@ -3,6 +3,10 @@
#include "utils.h" #include "utils.h"
namespace Utils { namespace Utils {
bool are_same(float a, float b) {
return abs(a - b) < 0.0001f;
}
bool str_replace(std::string& str, const std::string& from, const std::string& to) { bool str_replace(std::string& str, const std::string& from, const std::string& to) {
const size_t start_pos = str.find(from); const size_t start_pos = str.find(from);
if (start_pos == std::string::npos) if (start_pos == std::string::npos)

View File

@ -8,6 +8,8 @@ enum class WindowsVersion {
}; };
namespace Utils { namespace Utils {
extern bool are_same(float a, float b);
extern bool str_replace(std::string& str, const std::string& from, const std::string& to); extern bool str_replace(std::string& str, const std::string& from, const std::string& to);
extern std::string_view GetDesktopDir(); extern std::string_view GetDesktopDir();

View File

@ -6,3 +6,4 @@ ToggleKey=VK_F5
[Player:PlayerVariables] [Player:PlayerVariables]
LastLoadSCRFilePath= LastLoadSCRFilePath=
LastSaveSCRPath= LastSaveSCRPath=
UseBACKUPPlayerVars=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 KiB