- Fixed player restrictions not working for v1.12.0

- Implemented some checks for v1.12.0
- Improved time/weather interpolation behavior
This commit is contained in:
EricPlayZ
2025-01-26 04:54:57 +02:00
parent cd939c0eab
commit 8f3c694c88
24 changed files with 56 additions and 19 deletions

View File

@ -35,6 +35,7 @@ namespace EGSDK {
{ GetOffsetNameFromClassMember(&GamePH::GameDI_PH::pSessionCooperativeDI), 0xE8 },
{ GetOffsetNameFromClassMember(&GamePH::LocalClientDI::pPlayerDI_PH), 0x88 },
{ GetOffsetNameFromClassMember(&GamePH::PlayerDI_PH::pCoPhysicsProperty), 0xE8 },
{ GetOffsetNameFromClassMember(&GamePH::PlayerDI_PH::pInventoryContainerDI), 0x550 },
{ GetOffsetNameFromClassMember(&GamePH::PlayerDI_PH::restrictionsEnabled), 0x2CF0 },
{ GetOffsetNameFromClassMember(&GamePH::PlayerDI_PH::enableTPPModel1), 0x2DC1 },
{ GetOffsetNameFromClassMember(&GamePH::PlayerDI_PH::enableTPPModel2), 0x2DC2 },
@ -57,6 +58,7 @@ namespace EGSDK {
{ GetOffsetNameFromClassMember(&GamePH::GameDI_PH::pSessionCooperativeDI), 0x130 },
{ GetOffsetNameFromClassMember(&GamePH::LocalClientDI::pPlayerDI_PH), 0x90 },
{ GetOffsetNameFromClassMember(&GamePH::PlayerDI_PH::pCoPhysicsProperty), 0xF0 },
{ GetOffsetNameFromClassMember(&GamePH::PlayerDI_PH::pInventoryContainerDI), 0x470 },
{ GetOffsetNameFromClassMember(&GamePH::PlayerDI_PH::restrictionsEnabled), 0x3520 },
{ GetOffsetNameFromClassMember(&GamePH::PlayerDI_PH::enableTPPModel1), 0x35E9 },
{ GetOffsetNameFromClassMember(&GamePH::PlayerDI_PH::enableTPPModel2), 0x35EA },
@ -71,6 +73,9 @@ namespace EGSDK {
{ "IsNotOutOfMapBounds", { "48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 41 56 41 57 48 83 EC ?? 4C 8B C2", Utils::SigScan::PatternType::Address } },
{ "IsNotOutOfMissionBounds", { "48 89 5C 24 ?? 57 48 83 EC ?? 4C 8B C2 48 8B F9", Utils::SigScan::PatternType::Address } },
{ "PlaySoundEvent", { "4C 8B DC 49 89 5B ?? 49 89 73 ?? 57 48 81 EC ?? ?? ?? ?? 4C 8B 4C 24 ?? 48 8B F9 4D 8B D0 66 C7 84 24 ?? ?? ?? ?? ?? ?? 49 8B C1 66 C7 84 24", Utils::SigScan::PatternType::Address } },
{ "GetPlayerRestrictionsFlags", { "48 89 5C 24 ?? 57 48 83 EC ?? 48 8B F9 48 8B DA 48 8B CA E8 ?? ?? ?? ?? 48 8B 4F", Utils::SigScan::PatternType::Address } },
{ "EnablePlayerRestrictionsSubFunc", { "40 53 48 83 EC ?? 48 8B D9 48 81 C1 ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 8B CB 48 83 C4 ?? 5B E9 ?? ?? ?? ?? CC CC CC CC CC CC CC CC CC CC CC CC CC CC 48 89 4C 24", Utils::SigScan::PatternType::Address } },
{ "DisablePlayerRestrictionsSubFunc", { "48 89 5C 24 ?? 48 89 6C 24 ?? 56 57 41 54 41 56 41 57 48 83 EC ?? 0F B7 81", Utils::SigScan::PatternType::Address } },
{ "HandlePlayerRestrictions", { "40 57 48 83 EC ?? 48 89 5C 24 ?? 48 8B F9 48 89 6C 24 ?? 0F B6 A9", Utils::SigScan::PatternType::Address } }
});
AddPatterns(12001, {
@ -80,6 +85,9 @@ namespace EGSDK {
{ "IsNotOutOfMapBounds", { "48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 41 56 41 57 48 83 EC ?? 4C 8B F9 48 85 D2", Utils::SigScan::PatternType::Address } },
{ "IsNotOutOfMissionBounds", { "48 89 5C 24 ?? 57 48 83 EC ?? 48 8B F9 48 85 D2 74 ?? 48 8D 8A", Utils::SigScan::PatternType::Address } },
{ "PlaySoundEvent", { "4C 8B DC 49 89 5B ?? 49 89 73 ?? 57 48 81 EC ?? ?? ?? ?? 48 8B 44 24 ?? 48 8B F9 48 8B DA", Utils::SigScan::PatternType::Address } },
{ "GetPlayerRestrictionsFlags", { "48 89 5C 24 ?? 57 48 83 EC ?? 48 8B D9 48 8B FA 48 8B CA E8 ?? ?? ?? ?? 48 8B 4B", Utils::SigScan::PatternType::Address } },
{ "EnablePlayerRestrictionsSubFunc", { "40 53 48 83 EC ?? 48 8B D9 48 81 C1 ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 8B CB 48 83 C4 ?? 5B E9 ?? ?? ?? ?? CC CC CC CC CC CC CC CC CC CC CC CC CC CC 40 57", Utils::SigScan::PatternType::Address } },
{ "DisablePlayerRestrictionsSubFunc", { "48 89 5C 24 ?? 48 89 6C 24 ?? 56 57 41 54 41 56 41 57 48 83 EC ?? 0F B6 81", Utils::SigScan::PatternType::Address } },
{ "HandlePlayerRestrictions", { "40 57 48 83 EC ?? 48 89 5C 24 ?? 48 8B F9 48 89 74 24 ?? 0F B6 B1", Utils::SigScan::PatternType::Address } }
});

View File

@ -13,6 +13,7 @@ namespace EGSDK::GamePH {
public:
union {
DynamicField(PlayerDI_PH, Engine::CoPhysicsProperty*, pCoPhysicsProperty);
DynamicField(PlayerDI_PH, InventoryContainerDI*, pInventoryContainerDI);
DynamicField(PlayerDI_PH, bool, restrictionsEnabled);
DynamicField(PlayerDI_PH, bool, enableTPPModel1);
DynamicField(PlayerDI_PH, bool, enableTPPModel2);

View File

@ -1,11 +1,10 @@
#pragma once
#include <EGSDK\GamePH\TimeWeather\ISubsystem.h>
#include <EGSDK\Exports.h>
#include <EGSDK\ClassHelpers.h>
namespace EGSDK::GamePH {
namespace TimeWeather {
class ISubsystem;
class EGameSDK_API CSystem {
public:
union {

View File

@ -12,8 +12,8 @@ namespace EGSDK::GamePH {
ClassHelpers::StaticBuffer<0x14, int> nextWeather;
ClassHelpers::StaticBuffer<0x20, float> deltaBlend;
ClassHelpers::StaticBuffer<0x24, char> hasFinishedFlag;
ClassHelpers::StaticBuffer<0x28, float> deltaBlend2;
ClassHelpers::StaticBuffer<0x2C, float> deltaBlend3;
ClassHelpers::StaticBuffer<0x28, float> blendTime;
ClassHelpers::StaticBuffer<0x2C, float> deltaBlend2;
};
};
}

View File

@ -94,11 +94,11 @@ namespace EGSDK {
AddPattern(HandleInventoryItemsAmount, "gamedll_ph_x64_rwdi.dll", "48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC ?? 8B 29", Utils::SigScan::PatternType::Address, void*)
AddPattern(SetNewWaypointLocation, "gamedll_ph_x64_rwdi.dll", "85 D2 78 ?? 48 89 74 24 ?? 57 48 83 EC ?? 49 8B F8", Utils::SigScan::PatternType::Address, void*)
AddPattern(SetNewWaypointLocationWaypointIsSetBoolInstr, "gamedll_ph_x64_rwdi.dll", "C6 84 33 [?? ?? ?? ?? 01 48 8B 5C 24", Utils::SigScan::PatternType::Address, DWORD*)
AddPattern(GetPlayerRestrictionsFlags, "gamedll_ph_x64_rwdi.dll", "48 89 5C 24 ?? 57 48 83 EC ?? 48 8B D9 48 8B FA 48 8B CA E8 ?? ?? ?? ?? 48 8B 4B", Utils::SigScan::PatternType::Address, void*)
AddDynamicPattern(GetPlayerRestrictionsFlags, "gamedll_ph_x64_rwdi.dll", void*)
AddPattern(mEnablePlayerRestrictions, "gamedll_ph_x64_rwdi.dll", "48 89 5C 24 ?? 57 48 83 EC ?? 48 8B F9 E8 ?? ?? ?? ?? 48 8B C8 E8 ?? ?? ?? ?? 48 8B D8 48 85 C0 74 ?? 48 8D 54 24", Utils::SigScan::PatternType::Address, void*)
AddPattern(mDisablePlayerRestrictions, "gamedll_ph_x64_rwdi.dll", "48 89 5C 24 ?? 56 48 83 EC ?? 48 8B F1 E8 ?? ?? ?? ?? 48 8B C8 E8 ?? ?? ?? ?? 48 8B D8 48 85 C0 74 ?? 48 8D 48 ?? 48 89 7C 24 ?? FF 15 ?? ?? ?? ?? 84 C0 75 ?? 48 8D 4B ?? FF 15 ?? ?? ?? ?? 84 C0 75 ?? 48 8D 96", Utils::SigScan::PatternType::Address, void*)
AddPattern(EnablePlayerRestrictionsSubFunc, "gamedll_ph_x64_rwdi.dll", "40 53 48 83 EC ?? 48 8B D9 48 81 C1 ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 8B CB 48 83 C4 ?? 5B E9 ?? ?? ?? ?? CC CC CC CC CC CC CC CC CC CC CC CC CC CC 40 57", Utils::SigScan::PatternType::Address, void*)
AddPattern(DisablePlayerRestrictionsSubFunc, "gamedll_ph_x64_rwdi.dll", "48 89 5C 24 ?? 48 89 6C 24 ?? 56 57 41 54 41 56 41 57 48 83 EC ?? 0F B6 81", Utils::SigScan::PatternType::Address, void*)
AddDynamicPattern(EnablePlayerRestrictionsSubFunc, "gamedll_ph_x64_rwdi.dll", void*)
AddDynamicPattern(DisablePlayerRestrictionsSubFunc, "gamedll_ph_x64_rwdi.dll", void*)
AddDynamicPattern(HandlePlayerRestrictions, "gamedll_ph_x64_rwdi.dll", void*) // sub func of m_EnableRestrictions sub funcs and m_DisableRestrictions sub funcs
AddPattern(SetIsInCoSafeZone, "gamedll_ph_x64_rwdi.dll", "E8 [?? ?? ?? ?? E8 ?? ?? ?? ?? 48 85 C0 74 ?? E8 ?? ?? ?? ?? 48 8B C8 E8 ?? ?? ?? ?? 48 8B 5C 24 ?? 48 83 C4", Utils::SigScan::PatternType::RelativePointer, void*)
AddPattern(UpdateCVarFloat, "engine_x64_rwdi.dll", "40 53 48 83 EC ?? 8B 51 ?? 49 8B D8 48 8B 4C 24 ?? 41 B8 ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 85 C0 48 8D 0D ?? ?? ?? ?? 48 0F 45 C8 8B 01 89 03 48 83 C4 ?? 5B C3 CC CC CC CC CC CC CC CC CC CC CC CC 40 53 48 83 EC ?? 8B 51 ?? 49 8B D8 48 8B 4C 24 ?? 41 B8 ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 85 C0 48 8D 0D ?? ?? ?? ?? 48 0F 45 C8 F2 0F 10 01", Utils::SigScan::PatternType::Address, void*)

View File

@ -28,10 +28,10 @@ namespace EGSDK::GamePH {
bool didOnPostUpdateHookExecute = false;
Utils::Hook::VTHook<GameDI_PH2*, void(*)(void*), void*> OnPostUpdateHook{ "OnPostUpdate", &GameDI_PH2::Get, [](void* pGameDI_PH2) -> void {
didOnPostUpdateHookExecute = true;
Core::OnPostUpdate();
OnPostUpdateHook.ExecuteCallbacksWithOriginal(pGameDI_PH2);
return OnPostUpdateHook.ExecuteCallbacksWithOriginal(pGameDI_PH2);
didOnPostUpdateHookExecute = true;
} };
#pragma endregion
}

View File

@ -17,7 +17,7 @@ namespace EGSDK::GamePH {
}
static InventoryContainerDI* GetOffset_InventoryContainerDI(PlayerDI_PH* pPlayerDI_PH) {
return reinterpret_cast<InventoryContainerDI*>(*reinterpret_cast<uint64_t*>(reinterpret_cast<uint64_t>(pPlayerDI_PH) + 0x470));
return pPlayerDI_PH->pInventoryContainerDI;
}
InventoryContainerDI* PlayerDI_PH::GetInventoryContainer() {
return ClassHelpers::SafeGetter<InventoryContainerDI>(GetOffset_InventoryContainerDI, false, true, this);

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerCommand>D:\Program Files (x86)\Steam\steamapps\common\Dying Light 2\ph\work\bin\x64\DyingLightGame_x64_rwdi.exe</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>D:\Program Files (x86)\Steam\steamapps\common\Dying Light 2\ph\work\bin\x64</LocalDebuggerWorkingDirectory>
<LocalDebuggerCommand>D:\Program Files (x86)\Steam\steamapps\common\Dying Light 2 E3 Definitive\ph\work\bin\x64\DyingLightGame_x64_rwdi.exe</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>D:\Program Files (x86)\Steam\steamapps\common\Dying Light 2 E3 Definitive\ph\work\bin\x64</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerAttach>false</LocalDebuggerAttach>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerCommand>D:\Program Files (x86)\Steam\steamapps\common\Dying Light 2\ph\work\bin\x64\DyingLightGame_x64_rwdi.exe</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>D:\Program Files (x86)\Steam\steamapps\common\Dying Light 2\ph\work\bin\x64</LocalDebuggerWorkingDirectory>
<LocalDebuggerCommand>D:\Program Files (x86)\Steam\steamapps\common\Dying Light 2 E3 Definitive\ph\work\bin\x64\DyingLightGame_x64_rwdi.exe</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>D:\Program Files (x86)\Steam\steamapps\common\Dying Light 2 E3 Definitive\ph\work\bin\x64</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerAttach>false</LocalDebuggerAttach>
</PropertyGroup>

View File

@ -33,6 +33,7 @@ namespace EGT::Menu {
class Tab : MenuTab {
public:
Tab() : MenuTab("Camera", 2) {}
void Init() override;
void Update() override;
void Render() override;

View File

@ -10,6 +10,7 @@ namespace EGT::Menu {
class Tab : MenuTab {
public:
Tab() : MenuTab("Debug", 6) {}
void Init() override;
void Update() override;
void Render() override;

View File

@ -11,6 +11,7 @@ namespace EGT::Menu {
~MenuTab() { GetInstances()->erase({ tabIndex, this }); }
static std::set<std::pair<int, MenuTab*>>* GetInstances() { static std::set<std::pair<int, MenuTab*>> instances{}; return &instances; };
virtual void Init() {};
virtual void Render() {};
virtual void Update() {};

View File

@ -12,6 +12,7 @@ namespace EGT::Menu {
class Tab : MenuTab {
public:
Tab() : MenuTab("Misc", 4) {}
void Init() override;
void Update() override;
void Render() override;

View File

@ -29,6 +29,7 @@ namespace EGT::Menu {
class Tab : MenuTab {
public:
Tab() : MenuTab("Player", 0) {}
void Init() override;
void Update() override;
void Render() override;

View File

@ -28,6 +28,7 @@ namespace EGT::Menu {
class Tab : MenuTab {
public:
Tab() : MenuTab("Teleport", 3) {}
void Init() override;
void Update() override;
void Render() override;

View File

@ -13,6 +13,7 @@ namespace EGT::Menu {
class Tab : MenuTab {
public:
Tab() : MenuTab("Weapon", 1) {}
void Init() override;
void Update() override;
void Render() override;

View File

@ -16,6 +16,7 @@ namespace EGT::Menu {
class Tab : MenuTab {
public:
Tab() : MenuTab("World", 5) {}
void Init() override;
void Update() override;
void Render() override;

View File

@ -231,8 +231,11 @@ namespace EGT::Core {
}
static void OnPostUpdate(void* pGameDI_PH2) {
for (auto& menuTab : *Menu::MenuTab::GetInstances())
for (auto& menuTab : *Menu::MenuTab::GetInstances()) {
if (!EGSDK::GamePH::Hooks::didOnPostUpdateHookExecute)
menuTab.second->Init();
menuTab.second->Update();
}
static bool mountDataPaksErrorShown = false;
if (!mountDataPaksErrorShown && EGT::Engine::Hooks::mountDataPaksRanWith8Count < 3 && Menu::Misc::increaseDataPAKsLimit.GetValue() && EGSDK::GamePH::PlayerVariables::Get()) {

View File

@ -15,7 +15,7 @@
namespace EGT::Menu {
namespace Camera {
static constexpr float baseFOV = 57;
static float baseFOV = 57;
static constexpr float baseSafezoneFOVReduction = -10.0f;
static constexpr float baseSprintHeadCorrectionFactor = 0.55f;
@ -258,6 +258,14 @@ namespace EGT::Menu {
}
Tab Tab::instance{};
void Tab::Init() {
if (EGSDK::Core::gameVer == 11200) {
baseFOV = 52;
firstPersonFOV = baseFOV;
thirdPersonFOV = baseFOV;
freeCamFOV = baseFOV;
}
}
void Tab::Update() {
UpdateFirstPersonFOV();
FreeCamUpdate();

View File

@ -103,6 +103,7 @@ namespace EGT::Menu {
}
Tab Tab::instance{};
void Tab::Init() {}
void Tab::Update() {}
void Tab::Render() {
ImGui::SeparatorText("Misc##Debug");

View File

@ -82,6 +82,7 @@ namespace EGT::Menu {
}
Tab Tab::instance{};
void Tab::Init() {}
void Tab::Update() {
UpdateDisabledOptions();

View File

@ -499,6 +499,7 @@ namespace EGT::Menu {
}
Tab Tab::instance{};
void Tab::Init() {}
void Tab::Update() {
UpdateDisabledOptions();

View File

@ -271,6 +271,7 @@ namespace EGT::Menu {
}
Tab Tab::instance{};
void Tab::Init() {}
void Tab::Update() {
UpdateTeleportPos();
HotkeysUpdate();

View File

@ -91,6 +91,7 @@ namespace EGT::Menu {
}
Tab Tab::instance{};
void Tab::Init() {}
void Tab::Update() {
if (!Menu::menuToggle.GetValue())
UpdateWeaponDurability(true);

View File

@ -119,13 +119,17 @@ namespace EGT::Menu {
timeWeather->blendTime = 1.0f;
timeWeather->blendTime2 = 1.0f;
if (!EGSDK::Utils::Memory::IsBadReadPtr(timeWeather->nextSubSystem))
timeWeather->nextSubSystem->blendTime = 1.0f;
} else if (!timeWeather->IsFullyBlended()) {
if (!EGSDK::Utils::Values::are_samef(timeWeather->blendTime, 1.0f) || !EGSDK::Utils::Values::are_samef(timeWeather->blendTime2, 1.0f)) {
if (!EGSDK::Utils::Values::are_samef(timeWeather->blendTime, 1.0f) || !EGSDK::Utils::Values::are_samef(timeWeather->blendTime2, 1.0f)) {
previousBlendTime = timeWeather->blendTime;
previousBlendTime2 = timeWeather->blendTime2;
timeWeather->blendTime = 1.0f;
timeWeather->blendTime2 = 1.0f;
if (!EGSDK::Utils::Memory::IsBadReadPtr(timeWeather->nextSubSystem))
timeWeather->nextSubSystem->blendTime = 1.0f;
}
} else {
timeWeather->blendTime = previousBlendTime;
@ -140,6 +144,7 @@ namespace EGT::Menu {
}
Tab Tab::instance{};
void Tab::Init() {}
void Tab::Update() {
UpdateFreezeTime();
UpdateSlowMo();
@ -157,7 +162,7 @@ namespace EGT::Menu {
if (timeSlider) {
requestedTimeWeatherInterpolation = true;
timeBeforeFreeze = time;
UpdateWeatherInterpolation();
//UpdateWeatherInterpolation();
dayNightCycle->SetDaytime(time);
}
@ -181,7 +186,7 @@ namespace EGT::Menu {
ImGui::BeginDisabled(weatherDisabledFlag);
if (ImGui::Combo("Weather", reinterpret_cast<int*>(&weather), weatherItems, IM_ARRAYSIZE(weatherItems))) {
requestedTimeWeatherInterpolation = true;
UpdateWeatherInterpolation();
//UpdateWeatherInterpolation();
timeWeatherSystem->SetForcedWeather(static_cast<EGSDK::GamePH::TimeWeather::EWeather>(weather - 1));
}
ImGui::Text("Current weather: %s", !weatherDisabledFlag ? weatherItems[timeWeatherSystem->GetCurrentWeather() + 1] : "");