merge previous master commits to dev, change config player_variables.scr, change changelog

This commit is contained in:
EricPlayZ
2024-11-03 18:24:33 +02:00
parent 0ee417db70
commit 8b4e3c4b75
17 changed files with 6843 additions and 4165 deletions

View File

@ -281,6 +281,9 @@
</IntrinsicFunctions>
<AdditionalIncludeDirectories>pch;source\spdlog\include;source\ImGui\freetype\include;source\ImGui;source\MinHook;source\memscan;</AdditionalIncludeDirectories>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName)_$(PlatformTarget).pch</PrecompiledHeaderOutputFile>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<MultiProcessorCompilation>
</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@ -292,6 +295,10 @@
<EnableCOMDATFolding>
</EnableCOMDATFolding>
<AdditionalLibraryDirectories>source\spdlog\lib;source\ImGui\freetype\lib;source\MinHook\lib;</AdditionalLibraryDirectories>
<AssemblyDebug>true</AssemblyDebug>
<ImportLibrary />
<FixedBaseAddress>
</FixedBaseAddress>
</Link>
<PostBuildEvent>
<Command>copy /Y "$(SolutionDir)Extra Files\Default Config\EGameTools.ini" "$(SolutionDir)$(PlatformShortName)\$(Configuration)\EGameTools.ini"</Command>
@ -310,21 +317,23 @@
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpplatest</LanguageStandard>
<AdditionalIncludeDirectories>pch;source\spdlog\include;source\ImGui\freetype\include;source\ImGui;source\MinHook;source\memscan;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>None</DebugInformationFormat>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName)_$(PlatformTarget).pch</PrecompiledHeaderOutputFile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>false</GenerateDebugInformation>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalLibraryDirectories>source\spdlog\lib;source\ImGui\freetype\lib;source\MinHook\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>DbgHelp.lib;Version.lib;spdlog-mt.lib;freetype-mt.lib;libMinHook-x64-v141-mtd.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
<ImportLibrary />
<AdditionalOptions>/NOIMPLIB /NOEXP %(AdditionalOptions)</AdditionalOptions>
<AssemblyDebug>true</AssemblyDebug>
</Link>
<PostBuildEvent>
<Command>copy /Y "$(SolutionDir)Extra Files\Default Config\EGameTools.ini" "$(SolutionDir)$(PlatformShortName)\$(Configuration)\EGameTools.ini"</Command>

View File

@ -137,7 +137,18 @@ If anyone is looking to help with development, I'm all eyes and ears! Thank you!
R"(- Added compatibility with v1.17.2 Tower Raid update
- Added a .PDB file included by default with the mod, for debugging purposes in case the game crashes, now I can more easily detect the cause of a game crash!
- Added a crash handler which handles game crashes and generates a "EGameTools-dump.dmp" file in the game's exe directory for debugging purposes; if you encounter a crash and this file gets generated, please send it to me anywhere you can, for example on Discord, so I can try to find out the cause of the game crash!
- Fixed "Game Speed" (World) not getting applied with the mod menu opened while having another tab selected other than the World tab
I have some things planned for the next updates, but time will decide when I'll be able to work on the updates. I'm almost done with my exams!)" }
I have some things planned for the next updates, but time will decide when I'll be able to work on the updates. I'm almost done with my exams!)" },
{ "v1.2.2",
R"(- Added compatibility with v1.18.0 "Community QoL" update
- Fixed an issue with classes not always getting detected correctly for everyone (Debug tab; if you still run into issues, please open a bug report!))" },
{ "v1.2.3",
R"(- Fixed co-op issues related to Player and Weapon options, such as God Mode, Player Health, Player Immunity, Weapon Durability sliders not working (if you still run into issues, please open a bug report!))" },
{ "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!)" }
};
}

File diff suppressed because it is too large Load Diff

View File

@ -180,6 +180,7 @@ namespace Core {
return false;
MINIDUMP_EXCEPTION_INFORMATION mdei{};
mdei.ThreadId = GetCurrentThreadId();
mdei.ExceptionPointers = pExceptionPointers;
mdei.ClientPointers = false;
@ -223,7 +224,7 @@ namespace Core {
InitLogger();
#ifndef EXCP_HANDLER_DISABLE_DEBUG
AddVectoredExceptionHandler(0, &VectoredExceptionHandler);
SetUnhandledExceptionFilter(CrashHandler);
#endif
spdlog::warn("Getting game version");

View File

@ -11,10 +11,6 @@ namespace GamePH {
class LevelDI {
public:
union {
buffer<0x160, PlayerDI_PH*> pPlayerDI_PH;
};
bool IsLoading();
bool IsLoaded();
LPVOID GetViewCamera();

View File

@ -2,12 +2,12 @@
#include "..\buffer.h"
namespace GamePH {
class PlayerObjProperties;
class PlayerDI_PH;
class LocalClientDI {
public:
union {
buffer<0x90, PlayerObjProperties*> pPlayerObjProperties;
buffer<0x90, PlayerDI_PH*> pPlayerDI_PH;
};
static LocalClientDI* Get();

View File

@ -2,17 +2,17 @@
#include "..\offsets.h"
#include "InventoryContainerDI.h"
#include "InventoryItem.h"
#include "LevelDI.h"
#include "LocalClientDI.h"
#include "PlayerDI_PH.h"
namespace GamePH {
PlayerDI_PH* PlayerDI_PH::Get() {
__try {
LevelDI* iLevel = LevelDI::Get();
if (!iLevel)
LocalClientDI* localClient = LocalClientDI::Get();
if (!localClient)
return nullptr;
PlayerDI_PH* ptr = iLevel->pPlayerDI_PH;
PlayerDI_PH* ptr = localClient->pPlayerDI_PH;
if (!Utils::Memory::IsValidPtrMod(ptr, "gamedll_ph_x64_rwdi.dll"))
return nullptr;
if (*reinterpret_cast<DWORD64**>(ptr) != Offsets::GetVT_PlayerDI_PH())
@ -41,7 +41,6 @@ namespace GamePH {
return nullptr;
}
}
InventoryContainerDI* PlayerDI_PH::GetInventoryContainer() {
__try {
InventoryContainerDI* ptr = reinterpret_cast<InventoryContainerDI*>(*reinterpret_cast<DWORD64*>(reinterpret_cast<DWORD64>(this) + 0x470));

View File

@ -6,6 +6,11 @@
namespace GamePH {
class PlayerDI_PH {
public:
union {
buffer<0x35E9, bool> enableTPPModel1;
buffer<0x35EA, bool> enableTPPModel2;
};
static PlayerDI_PH* Get();
InventoryItem* GetCurrentWeapon(UINT indexMaybe);

View File

@ -1,5 +1,5 @@
#include <pch.h>
#include "LevelDI.h"
#include "PlayerDI_PH.h"
#include "PlayerHealthModule.h"
namespace GamePH {
@ -23,14 +23,14 @@ namespace GamePH {
void PlayerHealthModule::Set(LPVOID instance) { pPlayerHealthModule = reinterpret_cast<PlayerHealthModule*>(instance); }
void PlayerHealthModule::UpdateClassAddr() {
LevelDI* iLevel = LevelDI::Get();
if (!iLevel)
PlayerDI_PH* pPlayerDI_PH = PlayerDI_PH::Get();
if (!pPlayerDI_PH)
return;
if (PlayerHealthModule::Get() && PlayerHealthModule::Get()->pPlayerDI_PH == iLevel->pPlayerDI_PH)
if (PlayerHealthModule::Get() && PlayerHealthModule::Get()->pPlayerDI_PH == pPlayerDI_PH)
return;
for (auto& pPlayerHealthModule : PlayerHealthModule::playerHealthModulePtrList) {
if (pPlayerHealthModule->pPlayerDI_PH == iLevel->pPlayerDI_PH) {
if (pPlayerHealthModule->pPlayerDI_PH == pPlayerDI_PH) {
PlayerHealthModule::Set(pPlayerHealthModule);
PlayerHealthModule::playerHealthModulePtrList.clear();
PlayerHealthModule::playerHealthModulePtrList.emplace_back(pPlayerHealthModule);

View File

@ -1,5 +1,5 @@
#include <pch.h>
#include "LevelDI.h"
#include "PlayerDI_PH.h"
#include "PlayerInfectionModule.h"
namespace GamePH {
@ -23,14 +23,14 @@ namespace GamePH {
void PlayerInfectionModule::Set(LPVOID instance) { pPlayerInfectionModule = reinterpret_cast<PlayerInfectionModule*>(instance); }
void PlayerInfectionModule::UpdateClassAddr() {
LevelDI* iLevel = LevelDI::Get();
if (!iLevel)
PlayerDI_PH* pPlayerDI_PH = PlayerDI_PH::Get();
if (!pPlayerDI_PH)
return;
if (PlayerInfectionModule::Get() && PlayerInfectionModule::Get()->pPlayerDI_PH == iLevel->pPlayerDI_PH)
if (PlayerInfectionModule::Get() && PlayerInfectionModule::Get()->pPlayerDI_PH == pPlayerDI_PH)
return;
for (auto& pPlayerInfectionModule : PlayerInfectionModule::playerInfectionModulePtrList) {
if (pPlayerInfectionModule->pPlayerDI_PH == iLevel->pPlayerDI_PH) {
if (pPlayerInfectionModule->pPlayerDI_PH == pPlayerDI_PH) {
PlayerInfectionModule::Set(pPlayerInfectionModule);
PlayerInfectionModule::playerInfectionModulePtrList.clear();
PlayerInfectionModule::playerInfectionModulePtrList.emplace_back(pPlayerInfectionModule);

View File

@ -12,8 +12,6 @@ namespace GamePH {
buffer<0xF0, Engine::CoPhysicsProperty*> pCoPhysicsProperty;
//buffer<0x2E80, bool> isOutOfBounds;
//buffer<0x2E84, float> outOfBoundsTimer;
buffer<0x35E9, bool> enableTPPModel1;
buffer<0x35EA, bool> enableTPPModel2;
};
static PlayerObjProperties* Get();

View File

@ -101,7 +101,7 @@ namespace GamePH {
static const size_t MAX_FUNC_SIZE = 500000;
static const size_t MAX_LOAD_VAR_FUNC_SIZE = 2000;
const char* getPlayerVarName(BYTE*& funcAddress, DWORD64 startOfFunc) {
static const char* getPlayerVarName(BYTE*& funcAddress, DWORD64 startOfFunc) {
const char* playerVarName = nullptr;
while (!playerVarName && !isRetInstruction(funcAddress) && isBelowFuncSizeLimit(funcAddress, startOfFunc, MAX_FUNC_SIZE)) {
// lea r8, varNameString

View File

@ -37,6 +37,9 @@ namespace GamePH {
template <typename T> static T GetPlayerVar(const std::string& playerVar) {
static_assert(std::is_same<T, bool>::value || std::is_same<T, float>::value || std::is_same<T, std::string>::value, "Invalid type: value must be bool, float or string");
if (!gotPlayerVars)
return getDefaultValue<T>();
auto it = std::find_if(PlayerVariables::playerVars.begin(), PlayerVariables::playerVars.end(), [&playerVar](const auto& pair) {
return pair.first == playerVar;
});

View File

@ -11,7 +11,7 @@
#include "LevelDI.h"
#include "PlayerHealthModule.h"
#include "PlayerInfectionModule.h"
#include "PlayerObjProperties.h"
#include "PlayerDI_PH.h"
namespace GamePH {
namespace Hooks {
@ -161,20 +161,20 @@ namespace GamePH {
static Utils::Hook::MHook<LPVOID, void(*)(DWORD64, bool)> ShowTPPModelFunc3Hook{ "ShowTPPModelFunc3", &Offsets::Get_ShowTPPModelFunc3, &detourShowTPPModelFunc3 };
static void detourShowTPPModelFunc3(DWORD64 tppFunc2Addr, bool showTPPModel) {
PlayerObjProperties* playerObjProperties = PlayerObjProperties::Get();
if (!playerObjProperties) {
PlayerDI_PH* pPlayerDI_PH = PlayerDI_PH::Get();
if (!pPlayerDI_PH) {
ShowTPPModelFunc3Hook.pOriginal(tppFunc2Addr, showTPPModel);
return;
}
if (!showTPPModel && prevUseTPPModel) {
playerObjProperties->enableTPPModel2 = true;
playerObjProperties->enableTPPModel1 = true;
pPlayerDI_PH->enableTPPModel2 = true;
pPlayerDI_PH->enableTPPModel1 = true;
}
ShowTPPModelFunc3Hook.pOriginal(tppFunc2Addr, showTPPModel);
if (showTPPModel && prevUseTPPModel) {
playerObjProperties->enableTPPModel2 = false;
playerObjProperties->enableTPPModel1 = false;
pPlayerDI_PH->enableTPPModel2 = false;
pPlayerDI_PH->enableTPPModel1 = false;
} else
prevUseTPPModel = showTPPModel;
}

View File

@ -1,7 +1,7 @@
#include <pch.h>
#include "..\offsets.h"
#include "GameDI_PH.h"
#include "PlayerObjProperties.h"
#include "PlayerDI_PH.h"
namespace GamePH {
const DWORD GetCurrentGameVersion() {
@ -59,8 +59,8 @@ namespace GamePH {
void(*pShowTPPModelFunc3)(DWORD64 tppFunc2Addr, bool showTPPModel) = (decltype(pShowTPPModelFunc3))Offsets::Get_ShowTPPModelFunc3();
if (!pShowTPPModelFunc3)
return;
PlayerObjProperties* playerObjProperties = PlayerObjProperties::Get();
if (!playerObjProperties)
PlayerDI_PH* pPlayerDI_PH = PlayerDI_PH::Get();
if (!pPlayerDI_PH)
return;
pShowTPPModelFunc3(tppFunc2Addr, showTPPModel);

View File

@ -180,7 +180,6 @@ namespace Menu {
lensDistortionJustEnabled = false;
}
GamePH::PlayerVariables::ChangePlayerVar("FOVCorrection", goProMode.GetValue() ? (altLensDistortion / 100.0f) : (lensDistortion / 100.0f));
GamePH::PlayerVariables::ManagePlayerVarOption("HeadBobFactor", 1.25f, 1.0f, &goProMode, true);
GamePH::PlayerVariables::ManagePlayerVarOption("SprintHeadCorrectionFactor", 0.0f, baseSprintHeadCorrectionFactor, goProMode.GetValue() ? &goProMode : &disableHeadCorrection, true);
}

View File

@ -11,6 +11,7 @@ namespace Menu {
float time = 0.0f;
static float timeBeforeFreeze = 0.0f;
float gameSpeed = 1.0f;
static bool isModifyingGameSpeed = false;
static float actualGameSpeed = gameSpeed;
static float gameSpeedBeforeSlowMo = gameSpeed;
KeyBindOption freezeTime{ VK_NONE };
@ -89,7 +90,7 @@ namespace Menu {
if (freezeTime.GetValue() && !Utils::Values::are_samef(time, timeBeforeFreeze, 0.0095f))
dayNightCycle->SetDaytime(timeBeforeFreeze);
if (!menuToggle.GetValue() || Menu::currentTabIndex != World::Tab::tabIndex) {
if (!isModifyingGameSpeed) {
if (!slowMotion.GetValue() && !slowMotion.HasChanged() && !Utils::Values::are_samef(gameSpeed, 1.0f))
iLevel->TimerSetSpeedUp(gameSpeed);
actualGameSpeed = iLevel->TimerGetSpeedUp();
@ -110,8 +111,7 @@ namespace Menu {
timeBeforeFreeze = time;
dayNightCycle->SetDaytime(time);
}
else if (iLevel && iLevel->IsLoaded() && dayNightCycle) {
} else if (iLevel && iLevel->IsLoaded() && dayNightCycle) {
if (!haveResetAntizinDrainBlocked) {
GamePH::PlayerVariables::ChangePlayerVar("AntizinDrainBlocked", previousAntizinDrainBlocked);
haveResetAntizinDrainBlocked = true;
@ -119,13 +119,9 @@ namespace Menu {
}
ImGui::BeginDisabled(slowMotion.GetValue()); {
if (ImGui::SliderFloat("Game Speed", &gameSpeed, 0.0f, 2.0f, "%.2fx"))
isModifyingGameSpeed = ImGui::SliderFloat("Game Speed", &gameSpeed, 0.0f, 2.0f, "%.2fx");
if (isModifyingGameSpeed)
iLevel->TimerSetSpeedUp(gameSpeed);
else if (iLevel && iLevel->IsLoaded()) {
if (!slowMotion.GetValue() && !slowMotion.HasChanged() && !Utils::Values::are_samef(gameSpeed, 1.0f))
iLevel->TimerSetSpeedUp(gameSpeed);
actualGameSpeed = iLevel->TimerGetSpeedUp();
}
ImGui::EndDisabled();
}