- Improved MountDataPaks hook error detection (the error related to MountDataPaks should not show up in the console as often anymore)

This commit is contained in:
EricPlayZ
2024-11-03 19:46:41 +02:00
parent c163301344
commit 7993931f88
4 changed files with 13 additions and 7 deletions

View File

@ -149,6 +149,7 @@ I have some things planned for the next updates, but time will decide when I'll
{ "v1.2.4",
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 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))" }
};
}

View File

@ -1,6 +1,7 @@
#include <pch.h>
#include "config\config.h"
#include "core.h"
#include "game\Engine\engine_hooks.h"
#include "game\GamePH\LevelDI.h"
#include "game\GamePH\PlayerHealthModule.h"
#include "game\GamePH\PlayerInfectionModule.h"
@ -174,6 +175,12 @@ namespace Core {
GamePH::PlayerHealthModule::UpdateClassAddr();
GamePH::PlayerInfectionModule::UpdateClassAddr();
static bool mountDataPaksErrorShown = false;
if (!mountDataPaksErrorShown && Engine::Hooks::mountDataPaksRanWith8Count < 3 && GamePH::PlayerVariables::Get()) {
spdlog::error("MountDataPaks hook ran less than 3 times with the data PAKs limit set to 8. This means the increased data PAKs limit might not work correctly! If this error message appears and your data PAKs past \"data7.pak\" have not loaded, please contact author.");
mountDataPaksErrorShown = true;
}
}
#ifndef EXCP_HANDLER_DISABLE_DEBUG
static bool WriteMiniDump(PEXCEPTION_POINTERS pExceptionPointers) {

View File

@ -201,18 +201,15 @@ namespace Engine {
#pragma endregion
#pragma region MountDataPaks
int mountDataPaksRanWith8Count = 0;
static DWORD64 detourMountDataPaks(DWORD64 a1, UINT a2, UINT a3, DWORD64* a4, DWORD64(*a5)(DWORD64, DWORD, DWORD64, char*, int), INT16 a6, DWORD64 a7, UINT a8);
Utils::Hook::MHook<LPVOID, DWORD64(*)(DWORD64, UINT, UINT, DWORD64*, DWORD64(*)(DWORD64, DWORD, DWORD64, char*, int), INT16, DWORD64, UINT)> MountDataPaksHook{ "MountDataPaks", &Offsets::Get_MountDataPaks, &detourMountDataPaks };
static DWORD64 detourMountDataPaks(DWORD64 a1, UINT a2, UINT a3, DWORD64* a4, DWORD64(*a5)(DWORD64, DWORD, DWORD64, char*, int), INT16 a6, DWORD64 a7, UINT a8) {
if (Menu::Misc::increaseDataPAKsLimit.GetValue()) {
static int i = 0;
if (a8 == 8)
i++;
else if (i < 3) {
i++;
spdlog::error("MountDataPaks hook ran less than 3 times with the data PAKs limit set to 8. This means the increased data PAKs limit might not work correctly! If this error message appears and your data PAKs past \"data7.pak\" have not loaded, please contact author.");
}
mountDataPaksRanWith8Count++;
a8 = 200;
}

View File

@ -7,5 +7,6 @@ namespace Engine {
namespace Hooks {
extern bool switchedFreeCamByGamePause;
extern Vector3 freeCamPosBeforeGamePause;
extern int mountDataPaksRanWith8Count;
}
}