Skip to content

Commit

Permalink
reverted back to manually getting offset as things changed and i dont…
Browse files Browse the repository at this point in the history
… know how to do it automatically now :3
  • Loading branch information
EricPlayZ committed Jul 1, 2023
1 parent e5f0811 commit 5171b95
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 78 deletions.
13 changes: 2 additions & 11 deletions DL2FOVOverhaul/source/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,8 @@ DWORD64 WINAPI MainThread(HMODULE hModule) {
std::filesystem::file_time_type configPreviousWriteTime = std::filesystem::last_write_time(configFileName);
std::filesystem::file_time_type configLastWriteTime = configPreviousWriteTime;

// Offsets and similar
// Module stuff
MODULEINFO engineModuleInfo{};
const DWORD64 CLobbySteamInstrOffset = 0x1A;

// Key press delay for holding down the key without the value going vroom
const int keyPressSleepMs = 120;
Expand Down Expand Up @@ -597,15 +596,7 @@ DWORD64 WINAPI MainThread(HMODULE hModule) {
}

if (!IsAddressValid(CLobbySteamLoc)) {
const DWORD64 sigAddr = reinterpret_cast<DWORD64>(FindPattern(reinterpret_cast<PBYTE>(engineModuleInfo.lpBaseOfDll), engineModuleInfo.SizeOfImage, "74 12 4C 8D 05 ? ? ? ? 48 8B D7")); // jz 0x7ffb303616f2; lea r8, [rip+0x5cc831]; mov rdx, rdi;
if (!IsAddressValid(sigAddr))
continue;

const DWORD64 CLobbySteamInstrAddr = sigAddr + CLobbySteamInstrOffset; // mov [rip+0x10e3a54], rax; here we get the address for offset 0x10e3a54, this is the offset we need to get to CLobbySteam
const UINT32 CLobbySteamOffset = *reinterpret_cast<UINT32*>(CLobbySteamInstrAddr); // here we read offset 0x10e3a54 from bytes from the previous addr
const DWORD64 CLobbySteamLocAddr = CLobbySteamInstrAddr + 0x4 + static_cast<DWORD64>(CLobbySteamOffset); // final location for CLobbySteam_loc here is the previous addr + 4 bytes (which gets us to mov rax, rbx) + previous offset we got

CLobbySteamLoc = reinterpret_cast<CLobbySteam_loc*>(CLobbySteamLocAddr);
CLobbySteamLoc = reinterpret_cast<CLobbySteam_loc*>((DWORD64)engineModuleInfo.lpBaseOfDll + 0x2307DF8);
if (!IsAddressValid(CLobbySteamLoc))
continue;
}
Expand Down
78 changes: 11 additions & 67 deletions DL2FOVOverhaul/source/game_classes.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,68 +9,22 @@ class PlayerVariables {
public:
union {
// Type Name Offset
DEFINE_MEMBER_N(float, AggresionPerHit, 0x8);
DEFINE_MEMBER_N(float, DEF_AggresionPerHit, 0xC);
DEFINE_MEMBER_N(float, AggresionCooldownOnMax, 0x20);
DEFINE_MEMBER_N(float, DEF_AggresionCooldownOnMax, 0x24);
DEFINE_MEMBER_N(float, AggresionDecreseTime, 0x38);
DEFINE_MEMBER_N(float, DEF_AggresionDecreseTime, 0x3C);
DEFINE_MEMBER_N(float, AngleToChangeHands, 0x5F8);
DEFINE_MEMBER_N(float, DEF_AngleToChangeHands, 0x5FC);
DEFINE_MEMBER_N(float, CameraDefaultFOV, 0xCC8);
DEFINE_MEMBER_N(float, DEF_CameraDefaultFOV, 0xCCC);
DEFINE_MEMBER_N(float, CameraDefaultFOVReduction, 0xCE0);
DEFINE_MEMBER_N(float, DEF_CameraDefaultFOVReduction, 0xCE4);
DEFINE_MEMBER_N(float, CameraDefaultFOVReducedSpringTime, 0xCF8);
DEFINE_MEMBER_N(float, DEF_CameraDefaultFOVReducedSpringTime, 0xCFC);
DEFINE_MEMBER_N(float, CameraDefaultFOVRemoveReductionSpringTime, 0xD10);
DEFINE_MEMBER_N(float, DEF_CameraDefaultFOVRemoveReductionSpringTime, 0xD14);
DEFINE_MEMBER_N(float, PerfectBlockTimingEnd, 0x4120);
DEFINE_MEMBER_N(float, DEF_PerfectBlockTimingEnd, 0x4124);
DEFINE_MEMBER_N(float, RecoilOnHitBlock, 0x4150);
DEFINE_MEMBER_N(float, DEF_RecoilOnHitBlock, 0x4154);
DEFINE_MEMBER_N(bool, CanBlockWithFistsOtherWeapons, 0x41E8);
DEFINE_MEMBER_N(bool, DEF_CanBlockWithFistsOtherWeapons, 0x41E9);
DEFINE_MEMBER_N(bool, NightVisionEnabled, 0x41F8);
DEFINE_MEMBER_N(bool, DEF_NightVisionEnabled, 0x41F9);
DEFINE_MEMBER_N(float, NightVisionPower, 0x4208);
DEFINE_MEMBER_N(float, DEF_NightVisionPower, 0x420C);
DEFINE_MEMBER_N(bool, GREDetectorWithoutFacility, 0x4740);
DEFINE_MEMBER_N(bool, DEF_GREDetectorWithoutFacility, 0x4741);
DEFINE_MEMBER_N(float, GREDetectorRangeNearby, 0x4750);
DEFINE_MEMBER_N(float, DEF_GREDetectorRangeNearby, 0x4754);
DEFINE_MEMBER_N(float, NightRunnerSegment1StartVal, 0x48E8);
DEFINE_MEMBER_N(float, DEF_NightRunnerSegment1StartVal, 0x48EC);
DEFINE_MEMBER_N(float, ShimmyBackwardRange, 0x56B0);
DEFINE_MEMBER_N(float, DEF_ShimmyBackwardRange, 0x56B4);
DEFINE_MEMBER_N(float, StaminaRegeneration, 0x5D48);
DEFINE_MEMBER_N(float, DEF_StaminaRegeneration, 0x5D4C);
DEFINE_MEMBER_N(bool, StaminaRegenerationRelativeEnabled, 0x5DA8);
DEFINE_MEMBER_N(bool, DEF_StaminaRegenerationRelativeEnabled, 0x5DA9);
DEFINE_MEMBER_N(bool, StaminaRegenerationRelativeForAllWeapons, 0x5DB8);
DEFINE_MEMBER_N(bool, DEF_StaminaRegenerationRelativeForAllWeapons, 0x5DB9);
DEFINE_MEMBER_N(float, StaminaRegenerationFactorSlow, 0x5DC8);
DEFINE_MEMBER_N(float, DEF_StaminaRegenerationFactorSlow, 0x5DCC);
DEFINE_MEMBER_N(float, StaminaRegenerationFromDuck, 0x5DE0);
DEFINE_MEMBER_N(float, DEF_StaminaRegenerationFromDuck, 0x5DE4);
DEFINE_MEMBER_N(float, StaminaRegenerationFactorStand, 0x5DF8);
DEFINE_MEMBER_N(float, DEF_StaminaRegenerationFactorStand, 0x5DFC);
DEFINE_MEMBER_N(float, StaminaRegenerationFactorStandDalay, 0x5E10);
DEFINE_MEMBER_N(float, DEF_StaminaRegenerationFactorStandDalay, 0x5E14);
DEFINE_MEMBER_N(float, WallRunTimeTolleranceFromSprint, 0x67D8);
DEFINE_MEMBER_N(float, DEF_WallRunTimeTolleranceFromSprint, 0x67DC);
DEFINE_MEMBER_N(bool, GrapplePullToEnemyEnabled, 0x7D28);
DEFINE_MEMBER_N(bool, DEF_GrapplePullToEnemyEnabled, 0x7D29);
DEFINE_MEMBER_N(float, VeryLargeJumpDistance, 0x7D50);
DEFINE_MEMBER_N(float, DEF_VeryLargeJumpDistance, 0x7D54);
DEFINE_MEMBER_N(float, CameraDefaultFOV, 0xCD8);
DEFINE_MEMBER_N(float, DEF_CameraDefaultFOV, 0xCDC);
DEFINE_MEMBER_N(float, CameraDefaultFOVReduction, 0xCF0);
DEFINE_MEMBER_N(float, DEF_CameraDefaultFOVReduction, 0xCF4);
DEFINE_MEMBER_N(float, CameraDefaultFOVReducedSpringTime, 0xD08);
DEFINE_MEMBER_N(float, DEF_CameraDefaultFOVReducedSpringTime, 0xD0C);
DEFINE_MEMBER_N(float, CameraDefaultFOVRemoveReductionSpringTime, 0xD20);
DEFINE_MEMBER_N(float, DEF_CameraDefaultFOVRemoveReductionSpringTime, 0xD24);
};
};

class PlayerState {
public:
union {
// Type Name Offset
DEFINE_MEMBER_N(PlayerVariables*, PlayerVariables_ptr, 0x100);
DEFINE_MEMBER_N(PlayerVariables*, PlayerVariables_ptr, 0x278);
};
};

Expand Down Expand Up @@ -130,14 +84,6 @@ class CLevel {
};
};

class CChromeSync {
public:
union {
// Type Name Offset
DEFINE_MEMBER_N(int*, CEngineSyncDI_ptr, 0x20);
};
};

class CVideoSettings {
public:
union {
Expand All @@ -151,9 +97,8 @@ class CGame {
union {
// Type Name Offset
DEFINE_MEMBER_N(CVideoSettings*, CVideoSettings_ptr, 0x28);
DEFINE_MEMBER_N(CChromeSync*, CChromeSync_ptr, 0x340);
DEFINE_MEMBER_N(CLevel*, CLevel_ptr, 0x388);
DEFINE_MEMBER_N(CLevel2*, CLevel2_ptr, 0x648);
DEFINE_MEMBER_N(CLevel*, CLevel_ptr, 0x370);
DEFINE_MEMBER_N(CLevel2*, CLevel2_ptr, 0x630);
};
};

Expand All @@ -170,6 +115,5 @@ class CLobbySteam_loc {
union {
// Type Name Offset
DEFINE_MEMBER_0(CLobbySteam*, CLobbySteam_ptr);
DEFINE_MEMBER_N(CLobbySteam*, CLobbySteam_ptr2, 0x38);
};
};

0 comments on commit 5171b95

Please sign in to comment.