-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfiles.d
More file actions
389 lines (293 loc) · 9.8 KB
/
files.d
File metadata and controls
389 lines (293 loc) · 9.8 KB
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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
/*
* File functions
*/
var int Files_LookAtVDFS;
/*
* zCOption_ChangeDir
*/
func void zCOption_ChangeDir(var int optionPath) {
//0x00869694 class zCOption * zoptions
const int zoptions_addr_G1 = 8820372;
//0x008CD988 class zCOption * zoptions
const int zoptions_addr_G2 = 9230728;
//0x0045FB00 public: void __thiscall zCOption::ChangeDir(enum zTOptionPaths)
const int zCOption__ChangeDir_G1 = 4586240;
//0x00465160 public: void __thiscall zCOption::ChangeDir(enum zTOptionPaths)
const int zCOption__ChangeDir_G2 = 4608352;
const int call = 0;
if (CALL_Begin(call)) {
var int zoptionsPtr; zoptionsPtr = MEM_ReadInt(MEMINT_SwitchG1G2(zoptions_addr_G1, zoptions_addr_G2));
//zoptions->ChangeDir(DIR_PRESETS);
CALL_IntParam(_@(optionPath));
CALL__thiscall(_@(zoptionsPtr), MEMINT_SwitchG1G2(zCOption__ChangeDir_G1, zCOption__ChangeDir_G2));
call = CALL_End();
};
};
/*
* zCOption_GetDirString
*/
func string zCOption_GetDirString(var int optionPath) {
//0x00869694 class zCOption * zoptions
const int zoptions_addr_G1 = 8820372;
//0x008CD988 class zCOption * zoptions
const int zoptions_addr_G2 = 9230728;
//0x0045FC00 public: class zSTRING & __thiscall zCOption::GetDirString(enum zTOptionPaths)
const int zCOption__GetDirString_G1 = 4586496;
//0x00465260 public: class zSTRING & __thiscall zCOption::GetDirString(enum zTOptionPaths)
const int zCOption__GetDirString_G2 = 4608608;
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
var int zoptionsPtr; zoptionsPtr = MEM_ReadInt(MEMINT_SwitchG1G2(zoptions_addr_G1, zoptions_addr_G2));
CALL_PutRetValTo(_@(retVal));
CALL_IntParam(_@(optionPath));
CALL__thiscall(_@(zoptionsPtr), MEMINT_SwitchG1G2(zCOption__GetDirString_G1, zCOption__GetDirString_G2));
call = CALL_End();
};
if (retVal) {
return MEM_ReadString(retVal);
};
return STR_EMPTY;
};
//-- ZFILE_FILE functions
/*
* zFILE_FILE_GetByFilePath
*/
func int zFILE_FILE_GetByFilePath(var string filePath) {
//0x0043F540 public: __thiscall zFILE_FILE::zFILE_FILE(class zSTRING const &)
const int zFILE_FILE__zFILE_FILE_G1 = 4453696;
//0x00443450 public: __thiscall zFILE_FILE::zFILE_FILE(class zSTRING const &)
const int zFILE_FILE__zFILE_FILE_G2 = 4469840;
//This does not work - we have to allocate memory by ourselves
//var int ptr; ptr = CreateNewInstanceByString("zFILE_FILE");
//Same for G1 & G2A
const int sizeof_zFILE_FILE = 448;
var int ptr; ptr = MEM_Alloc(sizeof_zFILE_FILE);
CALL_zStringPtrParam(filePath);
CALL__thiscall(ptr, MEMINT_SwitchG1G2(zFILE_FILE__zFILE_FILE_G1, zFILE_FILE__zFILE_FILE_G2));
return + ptr;
};
/*
* zFILE_FILE_Exists
*/
func int zFILE_FILE_Exists(var int filePtr) {
//0x0043F7A0 public: virtual bool __thiscall zFILE_FILE::Exists(void)
const int zFILE_FILE__Exists_G1 = 4454304;
//0x004436B0 public: virtual bool __thiscall zFILE_FILE::Exists(void)
const int zFILE_FILE__Exists_G2 = 4470448;
if (!filePtr) { return FALSE; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PutRetValTo(_@(retVal));
CALL__thiscall(_@(filePtr), MEMINT_SwitchG1G2(zFILE_FILE__Exists_G1, zFILE_FILE__Exists_G2));
call = CALL_End();
};
return + retVal;
};
/*
* zFILE_FILE_FileDelete
*/
func int zFILE_FILE_FileDelete(var int filePtr) {
//0x00443880 public: virtual bool __thiscall zFILE_FILE::FileDelete(void)
const int zFILE_FILE__FileDelete_G1 = 4470912;
//0x004477E0 public: virtual bool __thiscall zFILE_FILE::FileDelete(void)
const int zFILE_FILE__FileDelete_G2 = 4487136;
if (!filePtr) { return FALSE; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PutRetValTo(_@(retVal));
CALL__thiscall(_@(filePtr), MEMINT_SwitchG1G2(zFILE_FILE__FileDelete_G1, zFILE_FILE__FileDelete_G2));
call = CALL_End();
};
return + retVal;
};
/*
* zFILE_FILE_Create
*/
func int zFILE_FILE_Create(var int filePtr) {
//0x0043FAE0 public: virtual int __thiscall zFILE_FILE::Create(void)
const int zFILE_FILE__Create_G1 = 4455136;
//0x004439F0 public: virtual int __thiscall zFILE_FILE::Create(void)
const int zFILE_FILE__Create_G2 = 4471280;
if (!filePtr) { return FALSE; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PutRetValTo(_@(retVal));
CALL__thiscall(_@(filePtr), MEMINT_SwitchG1G2(zFILE_FILE__Create_G1, zFILE_FILE__Create_G2));
call = CALL_End();
};
return + retVal;
};
/*
* zFILE_FILE_Open
*/
func int zFILE_FILE_Open(var int filePtr, var int writeMode) {
//0x0043FD80 public: virtual int __thiscall zFILE_FILE::Open(bool)
const int zFILE_FILE__Open_G1 = 4455808;
//0x00443C90 public: virtual int __thiscall zFILE_FILE::Open(bool)
const int zFILE_FILE__Open_G2 = 4471952;
if (!filePtr) { return FALSE; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PutRetValTo(_@(retVal));
CALL_IntParam(_@(writeMode));
CALL__thiscall(_@(filePtr), MEMINT_SwitchG1G2(zFILE_FILE__Open_G1, zFILE_FILE__Open_G2));
call = CALL_End();
};
return + retVal;
};
/*
* zFILE_FILE_Append
*/
func void zFILE_FILE_Append(var int filePtr) {
//0x00440350 public: virtual void __thiscall zFILE_FILE::Append(void)
const int zFILE_FILE__Append_G1 = 4457296;
//0x00444270 public: virtual void __thiscall zFILE_FILE::Append(void)
const int zFILE_FILE__Append_G2 = 4473456;
if (!filePtr) { return; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL__thiscall(_@(filePtr), MEMINT_SwitchG1G2(zFILE_FILE__Append_G1, zFILE_FILE__Append_G2));
call = CALL_End();
};
return;
};
/*
* zFILE_FILE_Close
*/
func int zFILE_FILE_Close(var int filePtr) {
//0x00440100 public: virtual int __thiscall zFILE_FILE::Close(void)
const int zFILE_FILE__Close_G1 = 4456704;
//0x00444010 public: virtual int __thiscall zFILE_FILE::Close(void)
const int zFILE_FILE__Close_G2 = 4472848;
if (!filePtr) { return FALSE; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PutRetValTo(_@(retVal));
CALL__thiscall(_@(filePtr), MEMINT_SwitchG1G2(zFILE_FILE__Close_G1, zFILE_FILE__Close_G2));
call = CALL_End();
};
return + retVal;
};
/*
* zFILE_FILE_Release
*/
func void zFILE_FILE_Release(var int filePtr) {
//0x0043F670 public: virtual __thiscall zFILE_FILE::~zFILE_FILE(void)
const int zFILE_FILE___zFILE_FILE_G1 = 4454000;
//0x00443580 public: virtual __thiscall zFILE_FILE::~zFILE_FILE(void)
const int zFILE_FILE___zFILE_FILE_G2 = 4470144;
if (!filePtr) { return; };
const int call = 0;
if (CALL_Begin(call)) {
CALL__thiscall(_@(filePtr), MEMINT_SwitchG1G2(zFILE_FILE___zFILE_FILE_G1, zFILE_FILE___zFILE_FILE_G2));
call = CALL_End();
};
MEM_Free(filePtr);
};
//-- zFILE_VDFS functions
/*
* zFILE_VDFS_GetByFilePath
*/
func int zFILE_VDFS_GetByFilePath(var string filePath) {
//0x00444D90 public: __thiscall zFILE_VDFS::zFILE_VDFS(class zSTRING const &)
const int zFILE_VDFS__zFILE_VDFS_G1 = 4476304;
//0x00448E20 public: __thiscall zFILE_VDFS::zFILE_VDFS(class zSTRING const &)
const int zFILE_VDFS__zFILE_VDFS_G2 = 4492832;
//This does not work - we have to allocate memory by ourselves
//var int ptr; ptr = CreateNewInstanceByString("zFILE_VDFS");
//Same for G1 & G2A
const int sizeof_zFILE_VDFS = 10808;
var int ptr; ptr = MEM_Alloc(sizeof_zFILE_VDFS);
CALL_zStringPtrParam(filePath);
CALL__thiscall(ptr, MEMINT_SwitchG1G2(zFILE_VDFS__zFILE_VDFS_G1, zFILE_VDFS__zFILE_VDFS_G2));
return + ptr;
};
/*
* zFILE_VDFS_Exists
*/
func int zFILE_VDFS_Exists(var int filePtr) {
//0x00444F90 public: virtual bool __thiscall zFILE_VDFS::Exists(void)
const int zFILE_VDFS__Exists_G1 = 4476816;
//0x00449020 public: virtual bool __thiscall zFILE_VDFS::Exists(void)
const int zFILE_VDFS__Exists_G2 = 4493344;
if (!filePtr) { return FALSE; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PutRetValTo(_@(retVal));
CALL__thiscall(_@(filePtr), MEMINT_SwitchG1G2(zFILE_VDFS__Exists_G1, zFILE_VDFS__Exists_G2));
call = CALL_End();
};
return + retVal;
};
/*
* zFILE_VDFS_Open
*/
func int zFILE_VDFS_Open(var int filePtr, var int writeMode) {
//0x00445090 public: virtual int __thiscall zFILE_VDFS::Open(bool)
const int zFILE_VDFS__Open_G1 = 4477072;
//0x00449120 public: virtual int __thiscall zFILE_VDFS::Open(bool)
const int zFILE_VDFS__Open_G2 = 4493600;
if (!filePtr) { return FALSE; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PutRetValTo(_@(retVal));
CALL_IntParam(_@(writeMode));
CALL__thiscall(_@(filePtr), MEMINT_SwitchG1G2(zFILE_VDFS__Open_G1, zFILE_VDFS__Open_G2));
call = CALL_End();
};
return + retVal;
};
/*
* zFILE_VDFS_Close
*/
func int zFILE_VDFS_Close(var int filePtr) {
//0x00445310 public: virtual int __thiscall zFILE_VDFS::Close(void)
const int zFILE_VDFS__Close_G1 = 4477712;
//0x004493A0 public: virtual int __thiscall zFILE_VDFS::Close(void)
const int zFILE_VDFS__Close_G2 = 4494240;
if (!filePtr) { return FALSE; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PutRetValTo(_@(retVal));
CALL__thiscall(_@(filePtr), MEMINT_SwitchG1G2(zFILE_VDFS__Close_G1, zFILE_VDFS__Close_G2));
call = CALL_End();
};
return + retVal;
};
/*
* zFILE_VDFS_Release
*/
func void zFILE_VDFS_Release(var int filePtr) {
//0x00444E40 public: virtual __thiscall zFILE_VDFS::~zFILE_VDFS(void)
const int zFILE_VDFS___zFILE_VDFS_G1 = 4476480;
//0x00448ED0 public: virtual __thiscall zFILE_VDFS::~zFILE_VDFS(void)
const int zFILE_VDFS___zFILE_VDFS_G2 = 4493008;
if (!filePtr) { return; };
const int call = 0;
if (CALL_Begin(call)) {
CALL__thiscall(_@(filePtr), MEMINT_SwitchG1G2(zFILE_VDFS___zFILE_VDFS_G1, zFILE_VDFS___zFILE_VDFS_G2));
call = CALL_End();
};
MEM_Free(filePtr);
};
/*
* FileExists
* - wrapper function checking if file exists
*/
func int FileExists(var string filePath) {
var int retVal;
var int filePtr; filePtr = zFILE_FILE_GetByFilePath(filePath);
retVal = zFILE_FILE_Exists(filePtr);
zFILE_FILE_Release(filePtr);
return + retVal;
};