From f5267854b3ffcfdfe63c359e2d4fb9f39f5e52df Mon Sep 17 00:00:00 2001 From: Octavian Dima <3403191+WopsS@users.noreply.github.com> Date: Tue, 5 Dec 2023 15:50:14 +0200 Subject: [PATCH] Update addresses for patch 2.1 --- include/RED4ext/Api/Runtime.hpp | 1 + include/RED4ext/Api/v0/Runtime.hpp | 3 ++- include/RED4ext/GameEngine.hpp | 15 +++++++-------- scripts/find_patterns.py | 2 +- scripts/patterns.py | 16 ++++++++-------- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/include/RED4ext/Api/Runtime.hpp b/include/RED4ext/Api/Runtime.hpp index e1585cea8..a3ee67f0b 100644 --- a/include/RED4ext/Api/Runtime.hpp +++ b/include/RED4ext/Api/Runtime.hpp @@ -17,6 +17,7 @@ #define RED4EXT_RUNTIME_2_00 RED4EXT_V0_RUNTIME_2_00 #define RED4EXT_RUNTIME_2_01 RED4EXT_V0_RUNTIME_2_01 #define RED4EXT_RUNTIME_2_02 RED4EXT_V0_RUNTIME_2_02 +#define RED4EXT_RUNTIME_2_10 RED4EXT_V0_RUNTIME_2_10 /** * @brief Supports all game versions. diff --git a/include/RED4ext/Api/v0/Runtime.hpp b/include/RED4ext/Api/v0/Runtime.hpp index a421fedce..2432ed83a 100644 --- a/include/RED4ext/Api/v0/Runtime.hpp +++ b/include/RED4ext/Api/v0/Runtime.hpp @@ -27,6 +27,7 @@ #define RED4EXT_V0_RUNTIME_2_00 RED4EXT_V0_FILEVER(3, 0, 74, 53121) #define RED4EXT_V0_RUNTIME_2_01 RED4EXT_V0_FILEVER(3, 0, 74, 63017) #define RED4EXT_V0_RUNTIME_2_02 RED4EXT_V0_FILEVER(3, 0, 75, 25522) +#define RED4EXT_V0_RUNTIME_2_10 RED4EXT_V0_FILEVER(3, 0, 76, 4238) /** * @brief Supports all game versions. @@ -37,4 +38,4 @@ /* * @brief The latest game version. */ -#define RED4EXT_V0_RUNTIME_LATEST RED4EXT_V0_RUNTIME_2_02 +#define RED4EXT_V0_RUNTIME_LATEST RED4EXT_V0_RUNTIME_2_10 diff --git a/include/RED4ext/GameEngine.hpp b/include/RED4ext/GameEngine.hpp index 0a93d3d43..64ca15f06 100644 --- a/include/RED4ext/GameEngine.hpp +++ b/include/RED4ext/GameEngine.hpp @@ -53,23 +53,22 @@ RED4EXT_ASSERT_SIZE(GameInstance, 0x138); struct CBaseEngine { - // https://github.com/yamashi/RED4ext/commit/2d30f32826276458f86da8b4c26940924044564d struct UnkD0 { uint8_t pad0[0x140]; uint32_t unk140; - uint8_t pad144[0x154 - 0x144]; - uint32_t unk154; - uint8_t pad158[0x164 - 0x158]; + uint8_t pad144[0x164 - 0x144]; uint32_t unk164; + uint8_t pad158[0x164 - 0x158]; + uint32_t unk174; void* hWnd; - uint8_t pad170[0x9]; + uint8_t pad180[0x9]; uint8_t isClipped; }; - RED4EXT_ASSERT_OFFSET(UnkD0, unk154, 0x154); RED4EXT_ASSERT_OFFSET(UnkD0, unk164, 0x164); - RED4EXT_ASSERT_OFFSET(UnkD0, hWnd, 0x168); - RED4EXT_ASSERT_OFFSET(UnkD0, isClipped, 0x179); + RED4EXT_ASSERT_OFFSET(UnkD0, unk174, 0x174); + RED4EXT_ASSERT_OFFSET(UnkD0, hWnd, 0x178); + RED4EXT_ASSERT_OFFSET(UnkD0, isClipped, 0x189); struct Unk108 { diff --git a/scripts/find_patterns.py b/scripts/find_patterns.py index 68f15845f..e3d5afd36 100644 --- a/scripts/find_patterns.py +++ b/scripts/find_patterns.py @@ -81,7 +81,7 @@ def find_ptr(pattern: str, expected: int = 1, index: int = 0, offset: int = 0) - groups.sort(key=lambda g: g.name.lower()) - addr = find_ptr(pattern='4C 8D 05 ? ? ? ? 48 89 ? ? ? 00 00', expected=9, index=4, offset=3) + addr = find_ptr(pattern='48 8D ? ? ? ? ? 49 8D 4E ? E8 ? ? ? ? 48 8D 4C ? ?', expected=2, index=1, offset=3) if addr == ida_idaapi.BADADDR: raise Exception('The pattern for game\'s version is not found') diff --git a/scripts/patterns.py b/scripts/patterns.py index 2b656ddd0..fb003e3fb 100644 --- a/scripts/patterns.py +++ b/scripts/patterns.py @@ -46,9 +46,9 @@ def get_groups() -> List[Group]: Group(name='CClass', functions=[ Item(name='Unserialize', pattern='48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC ? 4C 8B 15 ? ? ? ?', expected=1, index=0), - Item(name='ToString', pattern='48 89 5C 24 ? 48 89 74 24 ? 55 57 41 56 48 8D 6C 24 ? 48 81 EC ? ? ? ?', expected=341, index=104), + Item(name='ToString', pattern='48 89 5C 24 ? 48 89 74 24 ? 55 57 41 56 48 8D 6C 24 ? 48 81 EC ? ? ? ? 48 8B 41 ?', expected=11, index=2), Item(name='sub_80', pattern='48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 41 54 41 55 41 56 41 57 48 83 EC ? F6 41 70 ?', expected=1, index=0), - Item(name='sub_88', pattern='48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC ? 48 8B 02', expected=65, index=34), + Item(name='sub_88', pattern='48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC ? 48 8B 02 48 8B F1 48 8B CA', expected=5, index=4), Item(name='sub_90', pattern='48 89 5C 24 ? 48 89 74 24 ? 57 41 56 41 57 48 81 EC ? ? ? ?', expected=3, index=1), Item(name='sub_98', pattern='48 89 5C 24 ? 48 89 74 24 ? 57 41 56 41 57 48 81 EC ? ? ? ?', expected=3, index=2), Item(name='sub_A0', pattern='48 89 5C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 55 41 56 41 57 48 8B EC 48 83 EC 70 41 F7 40 14 FF FF FF 3F', expected=1, index=0), @@ -67,7 +67,7 @@ def get_groups() -> List[Group]: ]), Group(name='TTypedClass', functions=[ - Item(name='IsEqual', pattern='48 8B C4 48 89 58 ? 48 89 68 ? 48 89 70 ? 48 89 78 ? 41 54 41 56', expected=876, index=27) + Item(name='IsEqual', pattern='48 8B C4 48 89 58 ? 48 89 68 ? 48 89 70 ? 48 89 78 ? 41 54 41 56', expected=876, index=13) ]), Group(name='CEnum', functions=[ @@ -110,7 +110,7 @@ def get_groups() -> List[Group]: ]), Group(name='CRTTIRegistrator', pointers=[ - Item(name='RTTIAsyncId', pattern='F0 0F C1 05 ? ? ? ? FF C0 48 8D 0D ? ? ? ? 89 05 ? ? ? ? E8 ? ? ? ?', expected=11822, index=0, offset=4) + Item(name='RTTIAsyncId', pattern='F0 0F C1 05 ? ? ? ? FF C0 48 8D 0D ? ? ? ? 89 05 ? ? ? ? E8 ? ? ? ?', expected=11821, index=0, offset=4) ]), Group(name='CRTTISystem', functions=[ @@ -129,7 +129,7 @@ def get_groups() -> List[Group]: ]), Group(name='DynArray', functions=[ - Item(name='Realloc', pattern='48 89 5C 24 ? 44 89 4C 24 ? 55 56 57 41 54 41 55 41 56 41 57', expected=18, index=0) + Item(name='Realloc', pattern='48 89 5C 24 ? 44 89 4C 24 ? 55 56 57 41 54 41 55 41 56 41 57', expected=17, index=0) ]), Group(name='Handle', functions=[ @@ -175,7 +175,7 @@ def get_groups() -> List[Group]: Item(name='Vault', pattern='C6 04 0A 01 48 8D 0D ? ? ? ? 8B 50 ? 48 8B C1', offset=7, expected=2, index=0), ], functions=[ - Item(name='Vault::Alloc', pattern='48 8B C4 48 89 58 ? 48 89 68 ? 48 89 70 ? 48 89 78 ? 41 54 41 56 41 57', expected=876, index=9), + Item(name='Vault::Alloc', pattern='48 8B C4 48 89 58 ? 48 89 68 ? 48 89 70 ? 48 89 78 ? 41 54 41 56 41 57 48 83 EC 60 48 B8 00 00 00 00 02 00 00 00', expected=1, index=0), Item(name='Vault::AllocAligned', pattern='48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 41 54 41 55 41 56 41 57', expected=1039, index=14), Item(name='Vault::Realloc', pattern='40 53 48 83 EC ? 4D 8B D8 48 8B DA 4C 8B D1', expected=1, index=0), Item(name='Vault::ReallocAligned', pattern='48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 41 54 41 55 41 56 41 57', expected=1039, index=16), @@ -204,7 +204,7 @@ def get_groups() -> List[Group]: Group(name='ResourceReference', functions=[ Item(name='Load', pattern='40 53 48 83 EC ? 48 8D 59 ? 4C 8B C1 48 8B 0B', expected=1, index=0), Item(name='Fetch', pattern='40 53 48 83 EC ? 48 8B D9 E8 ? ? ? ? 48 8B 43 ? 48 85 C0', expected=2, index=0), - Item(name='Reset', pattern='48 83 EC ? 48 8B 41 ? 48 83 61 ? ? 48 89 44 24 ? 48 8B 01 48 83 21 ?', expected=27, index=5) + Item(name='Reset', pattern='48 83 EC ? 48 8B 41 ? 48 83 61 ? ? 48 89 44 24 ? 48 8B 01 48 83 21 ?', expected=27, index=6) ]), Group(name='ResourceToken', functions=[ @@ -212,7 +212,7 @@ def get_groups() -> List[Group]: Item(name='Fetch', pattern='40 53 48 83 EC 50 48 8B D9 E8 ? ? ? ? 84 C0 74 0A 48 8D 43 28'), Item(name='OnLoaded', pattern='48 8B C4 48 89 58 ? 48 89 70 ? 48 89 78 ? 55 48 8D 68 ? 48 81 EC ? ? ? ? 48 8B F2 48 8B D9 48 8B D1', expected=2, index=0), Item(name='CancelUnk38', pattern='F6 05 ? ? ? ? ? 75 ? 48 83 79 68 FF 75 ? C3'), - Item(name='DestructUnk38', pattern='40 53 48 83 EC 30 48 8B D9 E8 ? ? ? ? 84 C0 75 ? 48 83 C4 30 5B C3', expected=194, index=27) + Item(name='DestructUnk38', pattern='40 53 48 83 EC 30 48 8B D9 E8 ? ? ? ? 84 C0 75 ? 48 83 C4 30 5B C3', expected=194, index=26) ]), Group(name='UpdateRegistrar', functions=[