Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 3a92392

Browse files
committed
SYNTAX
1 parent f448221 commit 3a92392

File tree

2 files changed

+86
-54
lines changed

2 files changed

+86
-54
lines changed

byond-extools/src/core/core.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,15 @@ void Core::Alert(int what)
118118
Alert(std::to_string(what));
119119
}
120120

121-
unsigned int Core::GetStringId(std::string str, bool increment_refcount) {
122-
if (ByondVersion > 513) {
121+
unsigned int Core::GetStringId(std::string str, bool increment_refcount)
122+
{
123+
if (ByondVersion > 513)
124+
{
123125
return GetStringTableIndexUTF8(str.c_str(), 0xFFFFFFFF, 0, 1);
126+
}
124127
else
128+
{
129+
125130
break;
126131
}
127132
return 0;

byond-extools/src/core/find_functions.cpp

Lines changed: 79 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,29 @@
66
#define BYONDCORE "libbyond.so"
77
#endif
88

9-
#define FIND_OR_DIE(name, sig) name = (name##Ptr)Pocket::Sigscan::FindPattern(BYONDCORE, sig); if(!name) { Core::Alert("Failed to locate " #name); failed = true; }
9+
#define FIND_OR_DIE(name, sig) \
10+
name = (name##Ptr)Pocket::Sigscan::FindPattern(BYONDCORE, sig); \
11+
if (!name) \
12+
{ \
13+
Core::Alert("Failed to locate " #name); \
14+
failed = true; \
15+
}
1016
#ifdef _WIN32
11-
#define IMPORT_OR_DIE(name, sig) name = (name##Ptr)GetProcAddress(GetModuleHandleA(BYONDCORE), sig); if(!name) { Core::Alert("Failed to locate " #name " via " #sig); return false; }
17+
#define IMPORT_OR_DIE(name, sig) \
18+
name = (name##Ptr)GetProcAddress(GetModuleHandleA(BYONDCORE), sig); \
19+
if (!name) \
20+
{ \
21+
Core::Alert("Failed to locate " #name " via " #sig); \
22+
return false; \
23+
}
1224
#else
13-
#define IMPORT_OR_DIE(name, sig) name = (name##Ptr)dlsym(dlopen(BYONDCORE, 0), sig); if(!name) { Core::Alert("Failed to locate " #name " via " #sig); return false; }
25+
#define IMPORT_OR_DIE(name, sig) \
26+
name = (name##Ptr)dlsym(dlopen(BYONDCORE, 0), sig); \
27+
if (!name) \
28+
{ \
29+
Core::Alert("Failed to locate " #name " via " #sig); \
30+
return false; \
31+
}
1432
#endif
1533

1634
bool Core::verify_compat()
@@ -28,7 +46,7 @@ bool Core::verify_compat()
2846
ByondBuild = GetByondBuild();
2947
if (ByondVersion < MIN_COMPATIBLE_MAJOR || ByondBuild < MIN_COMPATIBLE_MINOR)
3048
{
31-
Core::Alert("Incompatible BYOND version, must be at least " + std::to_string(MIN_COMPATIBLE_MAJOR) + "." + std::to_string(MIN_COMPATIBLE_MINOR) + " (Current: "+std::to_string(ByondVersion)+"."+std::to_string(ByondBuild)+")");
49+
Core::Alert("Incompatible BYOND version, must be at least " + std::to_string(MIN_COMPATIBLE_MAJOR) + "." + std::to_string(MIN_COMPATIBLE_MINOR) + " (Current: " + std::to_string(ByondVersion) + "." + std::to_string(ByondBuild) + ")");
3250
return false;
3351
}
3452
return true;
@@ -65,7 +83,7 @@ bool Core::find_functions()
6583
}
6684
else
6785
{
68-
FIND_OR_DIE(IsInContainer, "55 8B EC 8B 4D 10 83 EC 38 0F B6 C1 56 57 83 F8 53 0F 87 ?? ?? ?? ?? 0F B6 ?? ?? ?? ?? ?? FF 24 ?? ?? ?? ?? ?? 53 6A 0F FF 75 14 51 E8");
86+
FIND_OR_DIE(IsInContainer, "55 8B EC 8B 4D 10 83 EC 38 0F B6 C1 56 57 83 F8 53 0F 87 ?? ?? ?? ?? 0F B6 ?? ?? ?? ?? ?? FF 24 ?? ?? ?? ?? ?? 53 6A 0F FF 75 14 51 E8");
6987
}
7088
FIND_OR_DIE(ToString, "55 8B EC 6A FF 68 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 50 83 EC 10 53 56 57 A1 ?? ?? ?? ?? 33 C5 50 8D 45 F4 ?? ?? ?? ?? ?? ?? 8B 5D 08 0F B6 C3 48 83 F8 53");
7189
FIND_OR_DIE(TopicFloodCheck, "55 8B EC 6A FF 68 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 50 83 EC 2C 53 56 57 A1 ?? ?? ?? ?? 33 C5 50 8D 45 F4 ?? ?? ?? ?? ?? ?? FF 75 08 E8 ?? ?? ?? ?? 83 C4 04 85 C0");
@@ -82,47 +100,50 @@ bool Core::find_functions()
82100
FIND_OR_DIE(InitializeListFromContext, "55 8B EC 56 FF 75 08 E8 ?? ?? ?? ?? 8B F0 83 C4 04 85 F6 74 2A 8B ?? ?? ?? ?? ?? 0F B7 4E 0C 66 29 4A 42 8B 46 0C");
83101
FIND_OR_DIE(DestroyList, "55 8B EC A1 ?? ?? ?? ?? 56 57 8B 7D 08 8B 34 B8 85 F6 0F 84 ?? ?? ?? ?? 83 7E 10 00 74 1A 6A 0F 57");
84102
FIND_OR_DIE(DestroyDatum, "55 8B EC 8B 55 10 0F B6 C2 83 C0 FE 83 F8 1F 0F 87 ?? ?? ?? ?? 0F B6 ?? ?? ?? ?? ?? FF 24 ?? ?? ?? ?? ?? 8B 4D 14 3B ?? ?? ?? ?? ?? 0F 83 ?? ?? ?? ?? A1 ?? ?? ?? ?? 8B 04 88 85 C0 0F 84");
85-
if(ByondVersion > 513) {
103+
if (ByondVersion > 513)
104+
{
86105
FIND_OR_DIE(GetStringTableIndexUTF8, "55 8B EC 8B 45 ?? 83 EC ?? 53 56 8B 35 ?? ?? ?? ??");
87106
break;
88-
else
89-
break;
90107
}
91-
if(failed) return false;
92-
int offset = *(int*)((char*)TopicFloodCheck + 0x2C);
93-
GetBSocket = (GetBSocketPtr)((char*)TopicFloodCheck + 0x2C + offset + 4); //done this way because pattern scanning would result in a different function
108+
{
109+
else break;
110+
}
111+
|
112+
if (failed) return false;
113+
int offset = *(int *)((char *)TopicFloodCheck + 0x2C);
114+
GetBSocket = (GetBSocketPtr)((char *)TopicFloodCheck + 0x2C + offset + 4); //done this way because pattern scanning would result in a different function
94115

95-
name_table_id_ptr = *(unsigned int**)((char*)GetGlobalByName + 6);
96-
name_table = **(unsigned int***)((char*)GetGlobalByName + 0x6D);
116+
name_table_id_ptr = *(unsigned int **)((char *)GetGlobalByName + 6);
117+
name_table = **(unsigned int ***)((char *)GetGlobalByName + 0x6D);
97118

98-
offset = *(int*)((char*)GetGlobalByName + 11);
99-
GetTableHolderThingyById = (GetTableHolderThingyByIdPtr)((char*)GetGlobalByName + 11 + offset + 4);
119+
offset = *(int *)((char *)GetGlobalByName + 11);
120+
GetTableHolderThingyById = (GetTableHolderThingyByIdPtr)((char *)GetGlobalByName + 11 + offset + 4);
100121

101-
char* x_ref_count_call = (char*)Pocket::Sigscan::FindPattern(BYONDCORE, "3D ?? ?? ?? ?? 74 14 50 E8 ?? ?? ?? ?? FF 75 0C FF 75 08 E8", 20);
102-
DecRefCount = (DecRefCountPtr)(x_ref_count_call + *(int*)x_ref_count_call + 4); //x_ref_count_call points to the relative offset to DecRefCount from the call site
103-
x_ref_count_call = (char*)Pocket::Sigscan::FindPattern(BYONDCORE, "FF 75 10 E8 ?? ?? ?? ?? FF 75 0C 8B F8 FF 75 08 E8 ?? ?? ?? ?? 57", 17);
104-
IncRefCount = (IncRefCountPtr)(x_ref_count_call + *(int*)x_ref_count_call + 4);
122+
char *x_ref_count_call = (char *)Pocket::Sigscan::FindPattern(BYONDCORE, "3D ?? ?? ?? ?? 74 14 50 E8 ?? ?? ?? ?? FF 75 0C FF 75 08 E8", 20);
123+
DecRefCount = (DecRefCountPtr)(x_ref_count_call + *(int *)x_ref_count_call + 4); //x_ref_count_call points to the relative offset to DecRefCount from the call site
124+
x_ref_count_call = (char *)Pocket::Sigscan::FindPattern(BYONDCORE, "FF 75 10 E8 ?? ?? ?? ?? FF 75 0C 8B F8 FF 75 08 E8 ?? ?? ?? ?? 57", 17);
125+
IncRefCount = (IncRefCountPtr)(x_ref_count_call + *(int *)x_ref_count_call + 4);
105126

106-
char* datum_inc_function = (char*)Pocket::Sigscan::FindPattern(BYONDCORE, "55 8b ec 8b 4d 08 3b 0d ?? ?? ?? ?? 73 11 a1 ?? ?? ?? ?? 8b 04 88 85 c0 74 05 ff 40 10 5d c3 6a 21 51 e8 ?? ?? ?? ??");
107-
datum_pointer_table_length = *(unsigned int**)(datum_inc_function + 8);
108-
datum_pointer_table = *(RawDatum****)(datum_inc_function + 15);
127+
char *datum_inc_function = (char *)Pocket::Sigscan::FindPattern(BYONDCORE, "55 8b ec 8b 4d 08 3b 0d ?? ?? ?? ?? 73 11 a1 ?? ?? ?? ?? 8b 04 88 85 c0 74 05 ff 40 10 5d c3 6a 21 51 e8 ?? ?? ?? ??");
128+
datum_pointer_table_length = *(unsigned int **)(datum_inc_function + 8);
129+
datum_pointer_table = *(RawDatum ****)(datum_inc_function + 15);
109130

110131
// the signature below is for a function that fetches a list via the real GetListPointerById and then checks if the list exists, runtiming otherwise
111-
char* get_list_ptr_ptr = (char*)Pocket::Sigscan::FindPattern(BYONDCORE, "55 8B EC FF 75 08 E8 ?? ?? ?? ?? 83 C4 04 85 C0 75 13 68 ?? ?? ?? ?? E8 ?? ?? ?? ?? 83 C4 04 5D E9 ?? ?? ?? ?? 5D C3", 7);
112-
GetListPointerById = (GetListPointerByIdPtr)(get_list_ptr_ptr + *(int*)get_list_ptr_ptr + 4);
132+
char *get_list_ptr_ptr = (char *)Pocket::Sigscan::FindPattern(BYONDCORE, "55 8B EC FF 75 08 E8 ?? ?? ?? ?? 83 C4 04 85 C0 75 13 68 ?? ?? ?? ?? E8 ?? ?? ?? ?? 83 C4 04 5D E9 ?? ?? ?? ?? 5D C3", 7);
133+
GetListPointerById = (GetListPointerByIdPtr)(get_list_ptr_ptr + *(int *)get_list_ptr_ptr + 4);
113134

114-
current_execution_context_ptr = *(ExecutionContext * **)Pocket::Sigscan::FindPattern(BYONDCORE, "A1 ?? ?? ?? ?? 8D ?? ?? ?? ?? ?? 83 C4 08 89 48 28 8D ?? ?? ?? ?? ?? 89 48 2C 83 3D ?? ?? ?? ?? ?? 74 25 8B 00 FF 30 E8 ?? ?? ?? ?? 83 C4 04 FF 30 E8 ?? ?? ?? ?? 83 C4 04 FF 30 68 ?? ?? ?? ?? E8 ?? ?? ?? ?? 83 C4 08 66 ?? ?? ?? ?? ?? ?? A1 ?? ?? ?? ?? 75 28 A8 02 75 24 E8 ?? ?? ?? ?? 85 C0 75 09 50", 1);
115-
misc_entry_table = **(MiscEntry * ***)Pocket::Sigscan::FindPattern(BYONDCORE, "A1 ?? ?? ?? ?? FF 34 B8 FF D6 47 83 C4 04 3B ?? ?? ?? ?? ?? 72 EA FF 35 ?? ?? ?? ?? FF D6 33 FF 83 C4 04 39 ?? ?? ?? ?? ?? 76 1E", 1);
116-
some_flags_including_profile = *(unsigned int**)Pocket::Sigscan::FindPattern(BYONDCORE, "F7 05 ?? ?? ?? ?? ?? ?? ?? ?? 74 34 8B 01 FF 30 E8 ?? ?? ?? ?? 83 C4 04 8B D8 E8 ?? ?? ?? ?? 8B F0 8B FA E8 ?? ?? ?? ?? 85 DB 74 02 FF 03 8B ?? ?? ?? ?? ?? 89 71 70 89 79 74 89 41 78 89 51 7C 83 3D ?? ?? ?? ?? ?? 5B 74 37", 2);
117-
global_var_table = **(Value***)Pocket::Sigscan::FindPattern(BYONDCORE, "C3 8B ?? ?? ?? ?? ?? 8B 04 FA 8B 54 FA 04 5F 5E 5B 8B E5 5D C3", 3);
118-
obj_table = *(TableHolder2**)Pocket::Sigscan::FindPattern(BYONDCORE, "A1 ?? ?? ?? ?? 33 FF C1 E0 02 89 06 89 7D 0C 39 ?? ?? ?? ?? ?? 0F 86 ?? ?? ?? ?? A1 ?? ?? ?? ?? 8B 3C B8 85 FF 74 6A FF 03 83 7F 28 00", 28);
119-
datum_table = *(TableHolder2**)Pocket::Sigscan::FindPattern(BYONDCORE, "A1 ?? ?? ?? ?? 8B 04 88 85 C0 74 1E FF 03 83 78 04 00 74 09 0F B7 40 0A C1 E0 04 EB 02 33 C0", 1);
120-
list_table = *(TableHolder2**)Pocket::Sigscan::FindPattern(BYONDCORE, "A1 ?? ?? ?? ?? 8B 04 B8 89 45 0C 85 C0 74 21 FF 03 FF 70 04", 1);
121-
mob_table = *(TableHolder2**)Pocket::Sigscan::FindPattern(BYONDCORE, "A1 ?? ?? ?? ?? 8B 3C B8 85 FF 0F 84 ?? ?? ?? ?? FF 03 83 7F 28 00 74 09 0F B7 47 2E C1 E0 04", 1);
122-
suspended_proc_list = *(SuspendedProcList**)Pocket::Sigscan::FindPattern(BYONDCORE, "8B 35 ?? ?? ?? ?? 8B 80 88 00 00 00 57 8B 3D ?? ?? ?? ?? 8B D7 89 45 FC A1 ?? ?? ?? ?? 8B D8 89 45 F8 89 75 F4 3B DA", 2);
135+
current_execution_context_ptr = *(ExecutionContext ***)Pocket::Sigscan::FindPattern(BYONDCORE, "A1 ?? ?? ?? ?? 8D ?? ?? ?? ?? ?? 83 C4 08 89 48 28 8D ?? ?? ?? ?? ?? 89 48 2C 83 3D ?? ?? ?? ?? ?? 74 25 8B 00 FF 30 E8 ?? ?? ?? ?? 83 C4 04 FF 30 E8 ?? ?? ?? ?? 83 C4 04 FF 30 68 ?? ?? ?? ?? E8 ?? ?? ?? ?? 83 C4 08 66 ?? ?? ?? ?? ?? ?? A1 ?? ?? ?? ?? 75 28 A8 02 75 24 E8 ?? ?? ?? ?? 85 C0 75 09 50", 1);
136+
misc_entry_table = **(MiscEntry ****)Pocket::Sigscan::FindPattern(BYONDCORE, "A1 ?? ?? ?? ?? FF 34 B8 FF D6 47 83 C4 04 3B ?? ?? ?? ?? ?? 72 EA FF 35 ?? ?? ?? ?? FF D6 33 FF 83 C4 04 39 ?? ?? ?? ?? ?? 76 1E", 1);
137+
some_flags_including_profile = *(unsigned int **)Pocket::Sigscan::FindPattern(BYONDCORE, "F7 05 ?? ?? ?? ?? ?? ?? ?? ?? 74 34 8B 01 FF 30 E8 ?? ?? ?? ?? 83 C4 04 8B D8 E8 ?? ?? ?? ?? 8B F0 8B FA E8 ?? ?? ?? ?? 85 DB 74 02 FF 03 8B ?? ?? ?? ?? ?? 89 71 70 89 79 74 89 41 78 89 51 7C 83 3D ?? ?? ?? ?? ?? 5B 74 37", 2);
138+
global_var_table = **(Value ***)Pocket::Sigscan::FindPattern(BYONDCORE, "C3 8B ?? ?? ?? ?? ?? 8B 04 FA 8B 54 FA 04 5F 5E 5B 8B E5 5D C3", 3);
139+
obj_table = *(TableHolder2 **)Pocket::Sigscan::FindPattern(BYONDCORE, "A1 ?? ?? ?? ?? 33 FF C1 E0 02 89 06 89 7D 0C 39 ?? ?? ?? ?? ?? 0F 86 ?? ?? ?? ?? A1 ?? ?? ?? ?? 8B 3C B8 85 FF 74 6A FF 03 83 7F 28 00", 28);
140+
datum_table = *(TableHolder2 **)Pocket::Sigscan::FindPattern(BYONDCORE, "A1 ?? ?? ?? ?? 8B 04 88 85 C0 74 1E FF 03 83 78 04 00 74 09 0F B7 40 0A C1 E0 04 EB 02 33 C0", 1);
141+
list_table = *(TableHolder2 **)Pocket::Sigscan::FindPattern(BYONDCORE, "A1 ?? ?? ?? ?? 8B 04 B8 89 45 0C 85 C0 74 21 FF 03 FF 70 04", 1);
142+
mob_table = *(TableHolder2 **)Pocket::Sigscan::FindPattern(BYONDCORE, "A1 ?? ?? ?? ?? 8B 3C B8 85 FF 0F 84 ?? ?? ?? ?? FF 03 83 7F 28 00 74 09 0F B7 47 2E C1 E0 04", 1);
143+
suspended_proc_list = *(SuspendedProcList **)Pocket::Sigscan::FindPattern(BYONDCORE, "8B 35 ?? ?? ?? ?? 8B 80 88 00 00 00 57 8B 3D ?? ?? ?? ?? 8B D7 89 45 FC A1 ?? ?? ?? ?? 8B D8 89 45 F8 89 75 F4 3B DA", 2);
123144
#else
124145
FIND_OR_DIE(Suspend, "55 89 E5 57 31 FF 56 89 C6 53 83 EC ?? 89 F0"); //regparm3
125-
FIND_OR_DIE(CrashProc, "55 89 E5 53 83 EC ?? 80 3D ?? ?? ?? ?? ?? 75 ?? C7 04 24 ?? ?? ?? ?? E8 ?? ?? ?? ?? 85 C0 75 ?? C7 04 24 ?? ?? ?? ?? 8D 5D ?? E8 ?? ?? ?? ?? 8B 45 ?? 89 5C 24 ?? C7 04 24 ?? ?? ?? ?? 89 44 24 ?? E8 ?? ?? ?? ?? C7 04 24 ?? ?? ?? ??");
146+
FIND_OR_DIE(CrashProc, "55 89 E5 53 83 EC ?? 80 3D ?? ?? ?? ?? ?? 75 ?? C7 04 24 ?? ?? ?? ?? E8 ?? ?? ?? ?? 85 C0 75 ?? C7 04 24 ?? ?? ?? ?? 8D 5D ?? E8 ?? ?? ?? ?? 8B 45 ?? 89 5C 24 ?? C7 04 24 ?? ?? ?? ?? 89 44 24 ?? E8 ?? ?? ?? ?? C7 04 24 ?? ?? ?? ??");
126147
FIND_OR_DIE(StartTiming, "55 89 E5 83 EC ?? 85 C0 89 5D ?? 89 C3 89 75 ?? 89 7D ?? 74 ?? 8B 50 ??"); //regparm3
127148
FIND_OR_DIE(GetVariable, "55 89 E5 81 EC ?? ?? ?? ?? 8B 55 ?? 89 5D ?? 8B 5D ?? 89 75 ?? 8B 75 ??");
128149
FIND_OR_DIE(GetProcArrayEntry, "55 31 C0 89 E5 8B 55 ?? 39 15 ?? ?? ?? ?? 76 ?? 8D 04 D2");
@@ -145,9 +166,12 @@ bool Core::find_functions()
145166
FIND_OR_DIE(AppendToContainer, "55 89 E5 83 EC ?? 3C ?? 89 5D ?? 8B 5D ?? 89 75 ?? 8B 75 ?? 89 7D ?? 76 ??");
146167
FIND_OR_DIE(DisconnectClient1, "55 89 E5 81 EC ?? ?? ?? ?? 89 75 ?? 8D B5 ?? ?? ?? ?? 89 5D ?? 89 D3");
147168
FIND_OR_DIE(GetListPointerById, "55 89 E5 83 EC ?? 89 04 24 E8 ?? ?? ?? ??");
148-
if(ByondBuild >= 1523) {
169+
if (ByondBuild >= 1523)
170+
{
149171
FIND_OR_DIE(SetAssocElement2, "55 B9 ?? ?? ?? ?? 89 E5 83 EC ?? 89 7D ??");
150-
} else {
172+
}
173+
else
174+
{
151175
FIND_OR_DIE(SetAssocElement1, "55 B9 ?? ?? ?? ?? 89 E5 83 EC ?? 89 75 ??");
152176
}
153177
FIND_OR_DIE(CallProcByName, "55 89 E5 83 EC ?? 89 5D ?? 89 D3 8B 55 ?? 89 45 ?? 0F B6 45 ?? 89 75 ?? 89 CE 8B 4D ?? 89 7D ?? 89 14 24 8B 55 ?? 88 45 ?? 0F B6 F8 8D 45 ?? 89 44 24 ?? 89 F8 89 4C 24 ?? 31 C9 C6 45 ?? ?? C7 44 24 ?? ?? ?? ?? ?? E8 ?? ?? ?? ?? 80 7D ?? ?? 0F 84 ?? ?? ?? ?? 3D ?? ?? ?? ?? 74 ?? 8B 4D ?? 8B 55 ?? 89 44 24 ?? 8D 45 ?? C7 44 24 ?? ?? ?? ?? ?? 89 4C 24 ?? 8B 4D ?? 89 54 24 ?? 8B 55 ?? 89 3C 24 89 4C 24 ?? 89 F1 89 54 24 ?? 89 DA E8 ?? ?? ?? ?? 8B 45 ?? 8B 55 ?? 8B 4D ?? 89 01 89 51 ?? 8D B6 ?? ?? ?? ?? 8B 45 ?? 8B 5D ?? 8B 75 ?? 8B 7D ?? 89 EC 5D C3 F7 C7 ?? ?? ?? ?? 74 ?? 80 7D ?? ?? 0F 84 ?? ?? ?? ?? 8B 4D ?? C7 01 ?? ?? ?? ?? C7 41 ?? ?? ?? ?? ?? 8B 45 ?? 8B 55 ?? 89 44 24 ?? 89 14 24 E8 ?? ?? ?? ?? 80 7D ?? ?? 74 ?? C7 04 24 ?? ?? ?? ?? E8 ?? ?? ?? ?? C7 44 24 ?? ?? ?? ?? ?? C7 04 24 ?? ?? ?? ?? E8 ?? ?? ?? ?? 8B 45 ?? 8B 55 ?? C7 44 24 ?? ?? ?? ?? ?? C7 44 24 ?? ?? ?? ?? ?? 89 04 24 89 54 24 ?? E8 ?? ?? ?? ?? 8B 55 ?? 89 14 24 E8 ?? ?? ?? ?? 8B 18 C7 44 24 ?? ?? ?? ?? ?? C7 04 24 ?? ?? ?? ?? E8 ?? ?? ?? ?? 89 5C 24 ?? 89 04 24 E8 ?? ?? ?? ?? C7 44 24 ?? ?? ?? ?? ?? 89 04 24 E8 ?? ?? ?? ?? C7 04 24 ?? ?? ?? ?? E8 ?? ?? ?? ?? A1 ?? ?? ?? ?? 89 04 24 E8 ?? ?? ?? ??"); // OH DEAR GOD
@@ -162,25 +186,28 @@ bool Core::find_functions()
162186
#warning TODO: GetTableHolderThingyById
163187
#warning TODO: GetBSocket
164188
#warning TODO: name_table
165-
switch(ByondVersion) {
166-
case 512:
167-
FIND_OR_DIE(SetVariable, "55 89 E5 81 EC ?? ?? ?? ?? 89 75 ?? 8B 55 ?? 8B 75 ??");
168-
FIND_OR_DIE(GetStringTableIndex, "55 89 E5 57 56 53 89 D3 83 EC ?? 85 C0"); // regparm3
169-
break;
170-
case 513:
171-
FIND_OR_DIE(SetVariable, "55 89 E5 81 EC ?? ?? ?? ?? 8B 55 ?? 8B 45 ??");
172-
FIND_OR_DIE(GetStringTableIndexUTF8, "55 89 E5 57 56 89 CE 53 89 D3 83 EC ?? 8B 55 ?? 85 C0") // regparm3
173-
break;
174-
default: break;
189+
switch (ByondVersion)
190+
{
191+
case 512:
192+
FIND_OR_DIE(SetVariable, "55 89 E5 81 EC ?? ?? ?? ?? 89 75 ?? 8B 55 ?? 8B 75 ??");
193+
FIND_OR_DIE(GetStringTableIndex, "55 89 E5 57 56 53 89 D3 83 EC ?? 85 C0"); // regparm3
194+
break;
195+
case 513:
196+
FIND_OR_DIE(SetVariable, "55 89 E5 81 EC ?? ?? ?? ?? 8B 55 ?? 8B 45 ??");
197+
FIND_OR_DIE(GetStringTableIndexUTF8, "55 89 E5 57 56 89 CE 53 89 D3 83 EC ?? 8B 55 ?? 85 C0") // regparm3
198+
break;
199+
default:
200+
break;
175201
}
176-
if(failed) return false;
202+
if (failed)
203+
return false;
177204

178-
datum_pointer_table_length = *(unsigned int**)((char*)DelDatum + 12);
179-
datum_pointer_table = *(RawDatum****)((char*)DelDatum + 20);
205+
datum_pointer_table_length = *(unsigned int **)((char *)DelDatum + 12);
206+
datum_pointer_table = *(RawDatum ****)((char *)DelDatum + 20);
180207

181-
current_execution_context_ptr = *(ExecutionContext * **)Pocket::Sigscan::FindPattern(BYONDCORE, "A1 ?? ?? ?? ?? 8D 7D ?? 89 78 ??", 1);
182-
misc_entry_table = **(MiscEntry * ***)Pocket::Sigscan::FindPattern(BYONDCORE, "A1 ?? ?? ?? ?? 8B 04 98 85 C0 74 ?? 89 04 24 E8 ?? ?? ?? ?? 8B 15 ?? ?? ?? ??", 1);
183-
some_flags_including_profile = *(unsigned int**)Pocket::Sigscan::FindPattern(BYONDCORE, "A1 ?? ?? ?? ?? A8 ?? 0F 85 ?? ?? ?? ??", 2);
208+
current_execution_context_ptr = *(ExecutionContext ***)Pocket::Sigscan::FindPattern(BYONDCORE, "A1 ?? ?? ?? ?? 8D 7D ?? 89 78 ??", 1);
209+
misc_entry_table = **(MiscEntry ****)Pocket::Sigscan::FindPattern(BYONDCORE, "A1 ?? ?? ?? ?? 8B 04 98 85 C0 74 ?? 89 04 24 E8 ?? ?? ?? ?? 8B 15 ?? ?? ?? ??", 1);
210+
some_flags_including_profile = *(unsigned int **)Pocket::Sigscan::FindPattern(BYONDCORE, "A1 ?? ?? ?? ?? A8 ?? 0F 85 ?? ?? ?? ??", 2);
184211
#endif
185212
return !failed;
186213
}

0 commit comments

Comments
 (0)