Skip to content

Commit

Permalink
Update addresses for patch 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
wopss committed Dec 5, 2023
1 parent 7947d3a commit f526785
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
1 change: 1 addition & 0 deletions include/RED4ext/Api/Runtime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion include/RED4ext/Api/v0/Runtime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
15 changes: 7 additions & 8 deletions include/RED4ext/GameEngine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion scripts/find_patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
16 changes: 8 additions & 8 deletions scripts/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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=[
Expand Down Expand Up @@ -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=[
Expand All @@ -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=[
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -204,15 +204,15 @@ 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=[
Item(name='dtor', pattern='48 89 5C 24 ? 57 48 83 EC ? 48 8B D9 E8 ? ? ? ? 84 C0 74 36', expected=1, index=0),
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=[
Expand Down

0 comments on commit f526785

Please sign in to comment.