forked from igroglaz/a2mgr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gui_replace.cpp
296 lines (260 loc) · 4.81 KB
/
gui_replace.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
#include "config.h"
#include <Windows.h>
void __declspec(naked) GUI_setServColumnSize()
{ // 44E9D5
__asm
{
mov eax, [ebp-0x40]
cmp dword ptr [eax+0x03C8], 2
jnz loc_44EB70
push 0x98
mov edx, 0x00401840
call edx
mov [ebp-0x6C], eax
mov [ebp-4], 4
push 0
push 0x0A
push 0x005FA5A4
push 0x005FA5A0
mov eax, 0x00629C88
push [eax]
mov ecx, [ebp-0xBC]
add ecx, 8
mov edx, 0x00402880
call edx
// !!!!
sub eax, 0xC0
// !!!!
push eax
mov ecx, [ebp-0xBC]
add ecx, 8
mov edx, 0x00420220
call edx
// !!!!
sub eax, 0x40
// !!!!
push eax
push 0x5C
push 0x28
push 1
mov ecx, [ebp-0x6C]
mov edx, 0x00453F60
call edx
mov [ebp-0xD0], eax
loc_44EB70:
mov edx, 0x0044EF11
jmp edx
}
}
// write registry from switch option, remap
void __declspec(naked) GUI_softcoreSwitch()
{
__asm
{
push 0x03
mov ecx, [ebp-0x108]
mov edx, 0x004DC183
call edx
mov [ebp-0x11C], eax
mov ebx, [ebp-0x108]
mov ebx, [ebx+0x78]
add ebx, 0x14
push ebx
mov edx, [eax]
mov ecx, eax
call dword ptr [edx+0x3C]
mov eax, [ebp-0x108]
mov eax, [eax+0x78]
add eax, 0x14
// the order has changed
// 0. PvP (hardcore) // was 0
// 1. PvE (softcore) // was 2
// 2. Sandbox // new
// 3. Arena // was 1
cmp dword ptr [eax], 2
jnz not_sand
mov dword ptr [eax], 4
jmp cont
not_sand:
cmp dword ptr [eax], 3
jnz not_arena
jmp cont
//mov dword ptr [eax], 3
//jmp cont
not_arena:
cmp dword ptr [eax], 1
jnz not_pve
mov dword ptr [eax], 2
jmp cont
not_pve:
mov dword ptr [eax], 0
cont:
mov edx, 0x0044C9A9
jmp edx
}
}
// read from registry, remap
void __declspec(naked) GUI_softcoreResetSwitch()
{
__asm
{
mov eax, [ebp-0x18]
mov eax, [eax+0x14]
cmp byte ptr [z_softcore], 1
jnz sc1_no
mov eax, 2
jmp sc2_no
sc1_no:
cmp byte ptr [z_softcore], 2
jnz sc2_no
mov eax, 4
sc2_no:
cmp eax, 3
jnz not_arena
//mov eax, 2
jmp cont
not_arena:
cmp eax, 0
jnz not_pvp
jmp cont // 0 is 0
/*cmp byte ptr [z_softcore], 0
jz cont
mov eax, 2*/
not_pvp:
cmp eax, 2
jnz not_pve
mov eax, 1
jmp cont
not_pve:
cmp eax, 4
jnz not_sandbox
mov eax, 2
jmp cont
not_sandbox:
mov eax, 0
cont:
mov [ebp-0x20], eax
lea eax, [ebp-0x20]
push eax
mov ecx, [ebp-0x10]
mov edx, [ecx]
call dword ptr [edx+0x44]
mov edx, 0x0044CBEC
jmp edx
}
}
unsigned long z_gamemode = 0;
void __declspec(naked) GUI_softcoreSaveSwitch()
{
__asm
{
push [ebp-0x10]
mov eax, [ebp-0x124]
add eax, 0x14
mov ebx, dword ptr [eax]
mov dword ptr [z_gamemode], ebx
lea eax, z_gamemode
cmp ebx, 0
jnz not_pvp
cmp byte ptr [z_softcore], 0
jz not_pvp
cmp byte ptr [z_softcore], 2
jnz not_sand
mov dword ptr [z_gamemode], 4
jmp not_pvp
not_sand:
mov dword ptr [z_gamemode], 2
not_pvp:
push eax
push 4
push 0
push 0x005FA6A4 // offset aDeathmatch // "deathmatch"
mov ecx, [ebp+0x08]
push [ecx]
call ds:RegSetValueExA
mov edx, 0x0043FA64
jmp edx
}
}
void __declspec(naked) GUI_sandboxSwitch()
{
__asm
{ // 44CB2D
push 0
push 0x005FA5A0
mov ecx, 0x00629C88
push [ecx]
push 0xDC // bottom
mov edx, [ebp+0x0C]
push [edx+8] // right
push 0x7C
mov edx, [ebp+0x0C]
push [edx] // left
push 3
mov ecx, [ebp-0x2C]
mov edx, 0x004536F0
call edx
mov [ebp-0x6C], eax
mov [ebp-0x10], eax
mov [ebp-0x30], eax
push 0x68 // hardcore
mov ecx, 0x0062BA40
mov edx, 0x00479BA3
call edx
push eax
mov ecx, [ebp-0x10]
mov edx, 0x00452B30
call edx
push 0xD5 // softcore
mov ecx, 0x0062BA40
mov edx, 0x00479BA3
call edx
push eax
mov ecx, [ebp-0x10]
mov edx, 0x00452B30
call edx
push 0xED // sandbox
mov ecx, 0x0062BA40
mov edx, 0x00479BA3
call edx
push eax
mov ecx, [ebp-0x10]
mov edx, 0x00452B30
call edx
push 0x6D // arena
mov ecx, 0x0062BA40
mov edx, 0x00479BA3
call edx
push eax
mov ecx, [ebp-0x10]
mov edx, 0x00452B30
call edx
mov edx, 0x0044CBBB
jmp edx
}
}
void __declspec(naked) GUI_removeServerList()
{
__asm
{ // 44CC1E
push 0
push 0x005FA5A0
mov ecx, 0x00629C88
push [ecx]
//push 0xF0
push 0x80FFFFC0 // bottom; minus something (a lot)
mov edx, [ebp+0x0C]
push [edx+8]
push 0x80FFFFF0 // top
mov edx, [ebp+0x0C]
push [edx]
push 4
mov ecx, [ebp-0x34]
mov edx, 0x004536F0
call edx
mov [ebp-0x70], eax
mov [eax+0x18], 0 // disabled
mov edx, 0x0044CC51
jmp edx
}
}