mirror of
https://github.com/EricPlayZ/EGameTools.git
synced 2026-10-10 04:43:03 +08:00
Fixed "God Mode" (Player) not working properly or at all in multiplayer
This commit is contained in:
@@ -58,6 +58,7 @@ Thank you everyone for the support <3)" },
|
||||
- Added "Increase Data PAKs Limit" (Misc; requires game restart to apply) - you can now add more than 8 data PAKs, e.g. data8.pak, data9.pak, data10.pak, etc, up to 200 PAKs in total
|
||||
- Added "Disable Data PAKs CRC Check" (Misc requires game restart to apply) - stops the game from detecting data PAKs, which allows you to use data PAK mods in multiplayer as well
|
||||
- Added "Disable Savegame CRC Check" (Misc requires game restart to apply) - stops the game from falsely saying your savegame is corrupt whenever you modify it
|
||||
- Fixed "God Mode" (Player) not working properly or at all in multiplayer
|
||||
- Changed the config system to only write to the config file whenever there's a change in the mod menu)" }
|
||||
};
|
||||
}
|
||||
@@ -4521,7 +4521,7 @@ namespace Config {
|
||||
}
|
||||
}
|
||||
|
||||
bool CheckForChangesInMem() {
|
||||
static bool CheckForChangesInMem() {
|
||||
try {
|
||||
reader = inih::INIReader(configFileName);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "config\config.h"
|
||||
#include "core.h"
|
||||
#include "game\GamePH\LevelDI.h"
|
||||
#include "game\GamePH\PlayerHealthModule.h"
|
||||
#include "game\GamePH\PlayerVariables.h"
|
||||
#include "game\GamePH\gameph_misc.h"
|
||||
#include "menu\menu.h"
|
||||
@@ -166,6 +167,8 @@ namespace Core {
|
||||
|
||||
for (auto& menuTab : *Menu::MenuTab::GetInstances())
|
||||
menuTab.second->Update();
|
||||
|
||||
GamePH::PlayerHealthModule::UpdateClassAddr();
|
||||
}
|
||||
/*static bool WriteMiniDump(PEXCEPTION_POINTERS pExceptionPointers) {
|
||||
HANDLE hFile = CreateFileA("EGameTools-dump.dmp", GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
#include <pch.h>
|
||||
#include "LevelDI.h"
|
||||
#include "PlayerHealthModule.h"
|
||||
|
||||
namespace GamePH {
|
||||
PlayerHealthModule* PlayerHealthModule::pPlayerHealthModule = nullptr;
|
||||
static PlayerHealthModule* pPlayerHealthModule = nullptr;
|
||||
std::vector<PlayerHealthModule*> PlayerHealthModule::playerHealthModulePtrList{};
|
||||
|
||||
PlayerHealthModule* PlayerHealthModule::Get() {
|
||||
__try {
|
||||
if (!pPlayerHealthModule)
|
||||
@@ -16,4 +19,21 @@ namespace GamePH {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
void PlayerHealthModule::Set(LPVOID instance) { pPlayerHealthModule = reinterpret_cast<PlayerHealthModule*>(instance); }
|
||||
|
||||
void PlayerHealthModule::UpdateClassAddr() {
|
||||
LevelDI* iLevel = LevelDI::Get();
|
||||
if (!iLevel)
|
||||
return;
|
||||
if (PlayerHealthModule::Get() && PlayerHealthModule::Get()->pPlayerDI_PH == iLevel->pPlayerDI_PH)
|
||||
return;
|
||||
|
||||
for (auto& pPlayerHealthModule : PlayerHealthModule::playerHealthModulePtrList) {
|
||||
if (pPlayerHealthModule->pPlayerDI_PH == iLevel->pPlayerDI_PH) {
|
||||
PlayerHealthModule::Set(pPlayerHealthModule);
|
||||
PlayerHealthModule::playerHealthModulePtrList.clear();
|
||||
PlayerHealthModule::playerHealthModulePtrList.emplace_back(pPlayerHealthModule);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,11 @@ namespace GamePH {
|
||||
buffer<0x3C, float> maxHealth;
|
||||
};
|
||||
|
||||
static PlayerHealthModule* pPlayerHealthModule;
|
||||
static std::vector<PlayerHealthModule*> playerHealthModulePtrList;
|
||||
|
||||
static PlayerHealthModule* Get();
|
||||
static void Set(LPVOID instance);
|
||||
|
||||
static void UpdateClassAddr();
|
||||
};
|
||||
}
|
||||
@@ -18,7 +18,8 @@ namespace GamePH {
|
||||
static Utils::Hook::MHook<LPVOID, DWORD64(*)(DWORD64)> CreatePlayerHealthModuleHook{ "CreatePlayerHealthModule", &Offsets::Get_CreatePlayerHealthModule, &detourCreatePlayerHealthModule };
|
||||
|
||||
static DWORD64 detourCreatePlayerHealthModule(DWORD64 playerHealthModule) {
|
||||
PlayerHealthModule::pPlayerHealthModule = reinterpret_cast<PlayerHealthModule*>(playerHealthModule);
|
||||
PlayerHealthModule::playerHealthModulePtrList.emplace_back(reinterpret_cast<PlayerHealthModule*>(playerHealthModule));
|
||||
|
||||
return CreatePlayerHealthModuleHook.pOriginal(playerHealthModule);
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
Reference in New Issue
Block a user