- 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
This commit is contained in:
EricPlayZ
2024-07-14 16:49:53 +03:00
parent f6848f37c7
commit d907cf0b0d
11 changed files with 6594 additions and 4158 deletions

View File

@ -273,6 +273,9 @@
</IntrinsicFunctions>
<AdditionalIncludeDirectories>pch;source\spdlog\include;source\ImGui\freetype\include;source\ImGui;source\MinHook;</AdditionalIncludeDirectories>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName)_$(PlatformTarget).pch</PrecompiledHeaderOutputFile>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<MultiProcessorCompilation>
</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@ -283,7 +286,11 @@
</OptimizeReferences>
<EnableCOMDATFolding>
</EnableCOMDATFolding>
<AdditionalLibraryDirectories>source\spdlog\lib;source\ImGui\freetype\lib;source\MinHook\lib;</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>source\spdlog\lib;source\ImGui\freetype\lib;source\MinHook\lib;source\CrashRpt\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>
@ -302,21 +309,23 @@
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpplatest</LanguageStandard>
<AdditionalIncludeDirectories>pch;source\spdlog\include;source\ImGui\freetype\include;source\ImGui;source\MinHook;%(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>
<AdditionalLibraryDirectories>source\spdlog\lib;source\ImGui\freetype\lib;source\MinHook\lib;source\CrashRpt\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

@ -109,7 +109,7 @@ With all of that said, here is finally what this update brings:
- Added "Teleport to Waypoint" (Teleport)
- WARNING: if the waypoint is selected to track an object/item on the map, Teleport to Waypoint will not work, if so just set the waypoint nearby instead
- WARNING: your player height won't change when teleporting, so make sure you catch yourself if you fall under the map because of the teleportation
- Added "Saved Locations" in Teleport menu, with the ability of saving, deleting and teleporting to said locations; these locations are saved in the config file and will contain a name and a set of coordinates for each location; to reset back to the default list, remove the list from inside the config file and go back into the game
- Added "Saved Locations" in Teleport menu, with the ability of saving, deleting and teleporting to said locations; these locations are saved in the config file and will contain a name and a set of coordinates for each location; to reset back to the default list, remove the list from inside the config file and go back into the game; thank you to @Synsteric on Discord for helping me make the default list!
- 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 scanning 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
@ -132,6 +132,14 @@ NOTE: Any mods that are put inside "EGameTools\UserModFiles" as a regular file (
I'm soon starting my exams and won't really have the time to update the mod the way I did right now. I had a 2 week leave and so I had plenty of time to further develop this mod.
If anyone is looking to help with development, I'm all eyes and ears! Thank you!)" }
If anyone is looking to help with development, I'm all eyes and ears! Thank you!)" },
{ "v1.2.1",
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!)" }
};
}

File diff suppressed because it is too large Load Diff

View File

@ -171,7 +171,7 @@ namespace Core {
GamePH::PlayerHealthModule::UpdateClassAddr();
GamePH::PlayerInfectionModule::UpdateClassAddr();
}
/*static bool WriteMiniDump(PEXCEPTION_POINTERS pExceptionPointers) {
static bool WriteMiniDump(PEXCEPTION_POINTERS pExceptionPointers) {
HANDLE hFile = CreateFileA("EGameTools-dump.dmp", GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
return false;
@ -181,21 +181,27 @@ namespace Core {
mdei.ExceptionPointers = pExceptionPointers;
mdei.ClientPointers = false;
int success = MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &mdei, nullptr, nullptr);
int success = MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, (pExceptionPointers ? &mdei : nullptr), nullptr, nullptr);
CloseHandle(hFile);
return success;
}
static long WINAPI VectoredExceptionHandler(PEXCEPTION_POINTERS ExceptionInfo) {
spdlog::error("VEH threw an exception with code {}. Trying to continue execution, writing mini-dump in the mean time.", ExceptionInfo->ExceptionRecord->ExceptionCode);
static long WINAPI CrashHandler(PEXCEPTION_POINTERS ExceptionInfo) {
spdlog::error("Crash Handler threw an exception with code {}. Game is exiting, writing mini-dump in the mean time.", ExceptionInfo->ExceptionRecord->ExceptionCode);
std::string errorMsg = "";
if (WriteMiniDump(ExceptionInfo))
if (WriteMiniDump(ExceptionInfo)) {
spdlog::info("Mini-dump written to \"EGameTools-dump.dmp\". Please send this to mod author for further help!");
else
errorMsg = "EGameTools encountered a fatal error that caused the game to crash.\n\nA file \"" + Utils::Files::GetCurrentProcDirectory() + "\\EGameTools-dump.dmp\" has been generated. Please send this file to the author of the mod!\n\nThe game will now close once you press OK.";
}
else {
spdlog::error("Failed to write mini-dump.");
errorMsg = "EGameTools encountered a fatal error that caused the game to crash.\n\nEGameTools failed to generate a crash dump file unfortunately, which means it is harder to find the cause of the crash.\n\nThe game will now close once you press OK.";
}
return EXCEPTION_CONTINUE_EXECUTION;
}*/
MessageBoxA(nullptr, errorMsg.c_str(), "Fatal game error", MB_ICONERROR | MB_OK | MB_SETFOREGROUND);
exit(0);
}
static void GameVersionCheck() {
try {
gameVer = GamePH::GetCurrentGameVersion();
@ -214,7 +220,7 @@ namespace Core {
EnableConsole();
InitLogger();
//AddVectoredExceptionHandler(0, &VectoredExceptionHandler);
SetUnhandledExceptionFilter(CrashHandler);
spdlog::warn("Getting game version");
GameVersionCheck();

View File

@ -16,9 +16,9 @@
#define VK_MWHEELUP 0x101
#endif
constexpr const char* MOD_VERSION_STR = "v1.2.0";
constexpr DWORD MOD_VERSION = 10200;
constexpr DWORD GAME_VER_COMPAT = 11602;
constexpr const char* MOD_VERSION_STR = "v1.2.1";
constexpr DWORD MOD_VERSION = 10201;
constexpr DWORD GAME_VER_COMPAT = 11702;
struct Key {
constexpr Key(std::string_view name, int code, ImGuiKey imGuiCode) : name(name), code(code), imGuiCode(imGuiCode) {}

View File

@ -7,7 +7,7 @@ namespace GamePH {
class PlayerState {
public:
union {
buffer<0x2B0, PlayerVariables*> playerVars;
buffer<0x2C8, PlayerVariables*> playerVars;
};
static PlayerState* 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

@ -1,12 +1,12 @@
#pragma once
#pragma once
#include "..\buffer.h"
namespace GamePH {
class gen_TPPModel {
public:
union {
buffer<0x2DB9, bool> enableTPPModel1;
buffer<0x2DBA, bool> enableTPPModel2;
buffer<0x35E1, bool> enableTPPModel1;
buffer<0x35E2, bool> enableTPPModel2;
};
static gen_TPPModel* Get();

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()) {
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();
}

View File

@ -11,7 +11,7 @@ LensDistortion=20
DistanceBehindPlayer=2
Enabled=0
HeightAbovePlayer=1.35
HorizontalDistanceFromPlayer=0
HorizontalDistanceFromPlayer=-0.75
UseTPPModel=1
[Menu]
FirstTimeRunning=1