mirror of
https://github.com/EricPlayZ/EGameTools.git
synced 2026-10-10 21:03:03 +08:00
Changed player variable loading to require manual updating instead of relying on the annoying veh hooking, which was inconsistent and requires updating every game update anyway for backup player vars, which has been also deleted now as it is unnecessary
Added Tools directory for various tools that helps in updating the mod (such as the player variables, to use it you simply decompile the function that loads player variables in IDA, copy the decompiled function code, paste it into the tool and it will automatically extract the names and the type of variable like float or boolean, the functions that load float or bool should be named "LoadPlayerFloatVariable" or "LoadPlayerBoolVariable" respectively, otherwise the tool won't work)
This commit is contained in:
@@ -73,29 +73,6 @@ namespace Core {
|
||||
}
|
||||
}
|
||||
|
||||
static std::unique_ptr<Hook::BreakpointHook> ldrpRoutineBpHook = nullptr;
|
||||
static void HookLdrpInitRoutine() {
|
||||
const WindowsVersion winVer = Utils::GetWindowsVersion();
|
||||
PDWORD64 pLdrpRoutineFunc = nullptr;
|
||||
|
||||
if (winVer != WindowsVersion::Windows7)
|
||||
pLdrpRoutineFunc = Offsets::Get_LdrpCallInitRoutineOffset();
|
||||
else
|
||||
pLdrpRoutineFunc = Offsets::Get_LdrpRunInitializeRoutinesOffset();
|
||||
|
||||
if (!pLdrpRoutineFunc)
|
||||
return;
|
||||
|
||||
ldrpRoutineBpHook = std::make_unique<Hook::BreakpointHook>(pLdrpRoutineFunc, [&](PEXCEPTION_POINTERS info) -> void {
|
||||
DWORD64 entryPoint = info->ContextRecord->R12;
|
||||
|
||||
if (Memory::IsValidPtrMod(entryPoint, "gamedll_ph_x64_rwdi.dll", false)) {
|
||||
ldrpRoutineBpHook->Disable();
|
||||
GamePH::PlayerVariables::RunHooks();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#pragma region GetRendererAPI
|
||||
static bool(*pReadVideoSettings)(LPVOID instance, LPVOID file, bool flag1) = nullptr;
|
||||
static bool(*oReadVideoSettings)(LPVOID instance, LPVOID file, bool flag1) = nullptr;
|
||||
@@ -132,22 +109,11 @@ namespace Core {
|
||||
createdConfigThread = true;
|
||||
}
|
||||
|
||||
if (Menu::Player::useBACKUPPlayerVarsEnabled && GamePH::PlayerVariables::playerVars.empty())
|
||||
GamePH::PlayerVariables::RunHooksBACKUP();
|
||||
if (!GamePH::PlayerVariables::gotPlayerVars)
|
||||
GamePH::PlayerVariables::GetPlayerVars();
|
||||
|
||||
Menu::Player::Update();
|
||||
Menu::Camera::Update();
|
||||
|
||||
//if (GamePH::GameDI_PH::Get()) {
|
||||
// INT64 gameVer = GamePH::GameDI_PH::Get()->GetCurrentGameVersion();
|
||||
// std::cout << "Game Version:" << gameVer << std::endl;
|
||||
//}
|
||||
//if (GamePH::LevelDI::Get()) {
|
||||
// float timePlayed = GamePH::LevelDI::Get()->GetTimePlayed();
|
||||
// std::cout << "Time Played: " << timePlayed << std::endl;
|
||||
//}
|
||||
}
|
||||
|
||||
DWORD64 WINAPI MainThread(HMODULE hModule) {
|
||||
@@ -155,8 +121,8 @@ namespace Core {
|
||||
|
||||
Config::InitConfig();
|
||||
|
||||
if (!Menu::Player::useBACKUPPlayerVarsEnabled)
|
||||
HookLdrpInitRoutine();
|
||||
if (GamePH::PlayerVariables::playerVars.empty())
|
||||
GamePH::PlayerVariables::SortPlayerVars();
|
||||
|
||||
MH_Initialize();
|
||||
LoopHookReadVideoSettings();
|
||||
|
||||
Reference in New Issue
Block a user