10
10
#include " Util.h"
11
11
#include " material.h"
12
12
13
-
14
13
// ==========================================================================================================================================
15
14
16
15
typedef struct _LoaderInvocationListener LoaderInvocationListener;
@@ -43,7 +42,7 @@ struct InvocationState {
43
42
std::string* retstr;
44
43
};
45
44
46
- GumAddress minecraftpeBaseAddr;
45
+
47
46
GumAddress ResourcePackManager_ResourcePackManager;
48
47
GumAddress AppPlatform_readAssetFile;
49
48
@@ -59,14 +58,14 @@ void __attribute__((constructor)) init() {
59
58
60
59
gum_init ();
61
60
62
- minecraftpeBaseAddr = gum_module_find_base_address ( " libminecraftpe.so " );
63
-
64
- GumModuleMap* moduleMap = gum_module_map_new ();
65
- const GumModuleDetails* minecraftpeDetails = gum_module_map_find (moduleMap, minecraftpeBaseAddr) ;
66
-
61
+ ModuleRange minecraftpeDetails = get_module_range ( );
62
+ if (minecraftpeDetails. addr == 0 || minecraftpeDetails. len == 0 ) {
63
+ // Failed initialization
64
+ return ;
65
+ }
67
66
#if __arm__
68
67
// ResourcePackManager::ResourcePackManager
69
- ResourcePackManager_ResourcePackManager = FindSignatures (minecraftpeDetails,
68
+ ResourcePackManager_ResourcePackManager = FindSignatures (& minecraftpeDetails,
70
69
// 1.20.50-1.20.81
71
70
// "F0 B5 03 AF 2D E9 00 07 90 B0 05 46 AD 48 98 46 92 46 78 44 00 68 00 68 0F 90 08 69",
72
71
// 1.21.0-1.21.31
@@ -82,7 +81,7 @@ void __attribute__((constructor)) init() {
82
81
);
83
82
84
83
// AppPlatform::readAssetFile
85
- AppPlatform_readAssetFile = FindSignatures (minecraftpeDetails,
84
+ AppPlatform_readAssetFile = FindSignatures (& minecraftpeDetails,
86
85
// 1.20.50.21preview
87
86
// "F0 B5 03 AF 4D F8 04 8D 9C B0 04 46 6E 48 78 44 00 68 00 68 1B 90 00 20 CD E9 08 00",
88
87
// 1.20.50-1.20.73
@@ -103,15 +102,15 @@ void __attribute__((constructor)) init() {
103
102
}
104
103
#elif __aarch64__
105
104
// ResourcePackManager::ResourcePackManager
106
- ResourcePackManager_ResourcePackManager = FindSignatures (minecraftpeDetails,
105
+ ResourcePackManager_ResourcePackManager = FindSignatures (& minecraftpeDetails,
107
106
// 1.20.50-1.21.50
108
107
" FF 03 03 D1 FD 7B 07 A9 FD C3 01 91 F9 43 00 F9 F8 5F 09 A9 F6 57 0A A9 F4 4F 0B A9 59 D0 3B D5 F6 03 03 2A 28 17 40 F9 F5 03 02 AA F3 03 00 AA A8 83 1F F8 28 10 40 F9" ,
109
108
// 1.21.60.21preview
110
109
" FF 83 02 D1 FD 7B 06 A9 FD 83 01 91 F8 5F 07 A9 F6 57 08 A9 F4 4F 09 A9 58 D0 3B D5 F6 03 03 2A 08 17 40 F9 F5 03 02 AA F3 03 00 AA A8 83 1F F8 28 10 40 F9 28 01 00 B4"
111
110
);
112
111
113
112
// AppPlatform::readAssetFile
114
- AppPlatform_readAssetFile = FindSignatures (minecraftpeDetails,
113
+ AppPlatform_readAssetFile = FindSignatures (& minecraftpeDetails,
115
114
// 1.20.50-1.20.73
116
115
" FF 03 04 D1 FD 7B 0C A9 FD 03 03 91 FC 5F 0D A9 F6 57 0E A9 F4 4F 0F A9 57 D0 3B D5 F3 03 08 AA E8 16 40 F9 A8 83 1F F8 FF 7F 02 A9" ,
117
116
// 1.20.80-1.21.50
@@ -129,8 +128,6 @@ void __attribute__((constructor)) init() {
129
128
printf (" AppPlatform::readAssetFile not found\n " );
130
129
}
131
130
#endif
132
-
133
- g_object_unref (moduleMap);
134
131
135
132
interceptor = gum_interceptor_obtain ();
136
133
listener = (GumInvocationListener*) g_object_new (LOADER_TYPE_INVOCATION_LISTENER, NULL );
0 commit comments