forked from Bad-Scientists/AF-Script-Packet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
console.d
246 lines (193 loc) · 6.05 KB
/
console.d
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
/*
* Initializes console
*/
func void Game_InitConsole () {
//0x00645280 void __cdecl Game_InitConsole(void)
const int Game_InitConsole_G1 = 6574720;
//0x00673470 void __cdecl Game_InitConsole(void)
const int Game_InitConsole_G2 = 6763632;
const int call = 0;
if (CALL_Begin (call)) {
CALL__cdecl (MEMINT_SwitchG1G2 (Game_InitConsole_G1, Game_InitConsole_G2));
call = CALL_End ();
};
};
/*
* Evaluate console command
* - console has to be initialized first with Game_InitConsole
* Usage: zCConsole_Evaluate ("toggle desktop")
*/
func void zCConsole_Evaluate (var string command) {
//0x006DB5D0 public: int __thiscall zCConsole::Evaluate(class zSTRING const &)
const int zCConsole__Evaluate_G1 = 7189968;
//0x00784860 public: int __thiscall zCConsole::Evaluate(class zSTRING const &)
const int zCConsole__Evaluate_G2 = 7882848;
//0x008DC5A0 class zCConsole zcon
//const int zcon_address_G1 = 9291168;
CALL_zStringPtrParam (command);
CALL__thiscall (zcon_address, MEMINT_SwitchG1G2 (zCConsole__Evaluate_G1, zCConsole__Evaluate_G2));
};
/*
* Shows console
*/
func void zCConsole_Show () {
//0x006DA2D0 public: void __thiscall zCConsole::Show(void)
const int zCConsole__Show_G1 = 7185104;
//0x00783460 public: void __thiscall zCConsole::Show(void)
const int zCConsole__Show_G2 = 7877728;
const int call = 0;
if (CALL_Begin (call)) {
CALL__thiscall (_@ (zcon_address), MEMINT_SwitchG1G2 (zCConsole__Show_G1, zCConsole__Show_G2));
call = CALL_End ();
};
};
/*
* Hides console
*/
func void zCConsole_Hide () {
//0x006DA530 public: void __thiscall zCConsole::Hide(void)
const int zCConsole__Hide_G1 = 7185712;
//0x007836B0 public: void __thiscall zCConsole::Hide(void)
const int zCConsole__Hide_G2 = 7878320;
const int call = 0;
if (CALL_Begin (call)) {
CALL__thiscall (_@ (zcon_address), MEMINT_SwitchG1G2 (zCConsole__Hide_G1, zCConsole__Hide_G2));
call = CALL_End ();
};
};
/*
* Emulates test mode key pressing
* Usage: oCGame_TestKeys (KEY_F6)
*/
func void oCGame_TestKeys (var int key) {
//0x00660000 private: int __thiscall oCGame::TestKeys(int)
const int oCGame__TestKeys_G1 = 6684672;
//0x006FD560 private: int __thiscall oCGame::TestKeys(int)
const int oCGame__TestKeys_G2 = 7329120;
var int ptr; ptr = _@ (MEM_Game);
const int call = 0;
if (CALL_Begin (call)) {
CALL_IntParam (_@ (key));
CALL__thiscall (_@ (ptr), MEMINT_SwitchG1G2 (oCGame__TestKeys_G1, oCGame__TestKeys_G2));
call = CALL_End ();
};
};
/*
* Update console
*/
func void zCConsole_Update () {
//0x006DA760 public: void __thiscall zCConsole::Update(void)
const int zCConsole__Update_G1 = 7186272;
//0x007838E0 public: void __thiscall zCConsole::Update(void)
const int zCConsole__Update_G2 = 7878880;
const int call = 0;
if (CALL_Begin (call)) {
CALL__thiscall (_@ (zcon_address), MEMINT_SwitchG1G2 (zCConsole__Update_G1, zCConsole__Update_G2));
call = CALL_End ();
};
};
/*
* Register console command
*/
func void zCConsole_Register (var string commandPrefix, var string description, var int param) {
//0x006D9810 public: void __thiscall zCConsole::Register(class zSTRING const &,class zSTRING const &,int)
const int zCConsole__Register_G1 = 7182352;
//0x007829C0 public: void __thiscall zCConsole::Register(class zSTRING const &,class zSTRING const &,int)
const int zCConsole__Register_G2 = 7875008;
var int descPtr; descPtr = _@s(description);
var int comPtr; comPtr = _@s(commandPrefix);
const int call = 0;
if (CALL_Begin(call)) {
CALL_IntParam(_@(param));
CALL_PtrParam(_@(descPtr));
CALL_PtrParam(_@(comPtr));
CALL__thiscall(_@(zcon_address_lego), MEMINT_SwitchG1G2 (zCConsole__Register_G1, zCConsole__Register_G2));
call = CALL_End();
};
};
/*
* zCConsole_Get_Cur_Console
* - get current console
*/
func int zCConsole_Get_Cur_Console () {
//0x008DC688 private: static class zCConsole * zCConsole::cur_console
const int cur_console__addr_G1 = 9291400;
//0x00AB3944 private: static class zCConsole * zCConsole::cur_console
const int cur_console__addr_G2 = 11221316;
return + MEM_ReadInt (MEMINT_SwitchG1G2 (cur_console__addr_G1, cur_console__addr_G2));
};
/*
* Update type for already existing console commands
*/
func void zCConsole_UpdateType (var string command, var int type) {
var zCConsole console; console = _^ (zcon_address_lego);
var int ptr; ptr = console.wurzel;
var zCConDat dat;
command = STR_Upper (command);
while (ptr);
dat = _^ (ptr);
if (Hlp_StrCmp (dat.name, command)) {
dat.type = type;
return;
};
ptr = dat.next;
end;
};
/*
* Get type for already existing console commands
*/
func int zCConsole_GetType (var string command) {
var zCConsole console; console = _^ (zcon_address_lego);
var int ptr; ptr = console.wurzel;
var zCConDat dat;
command = STR_Upper (command);
while (ptr);
dat = _^ (ptr);
if (Hlp_StrCmp (dat.name, command)) {
return dat.type;
};
ptr = dat.next;
end;
return -1;
};
/*
* zCParser_AutoCompletion
* - default automcompletion used by console (reading symbol table)
*/
func int zCParser_AutoCompletion (var int parserPtr, var int wordPtr) {
//0x006EB440 public: int __thiscall zCParser::AutoCompletion(class zSTRING &)
const int zCParser__AutoCompletion_G1 = 7255104;
//0x00794950 public: int __thiscall zCParser::AutoCompletion(class zSTRING &)
const int zCParser__AutoCompletion_G2 = 7948624;
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PutRetValTo (_@ (retVal));
CALL_PtrParam(_@(wordPtr));
CALL__thiscall(_@(parserPtr), MEMINT_SwitchG1G2 (zCParser__AutoCompletion_G1, zCParser__AutoCompletion_G2));
call = CALL_End();
};
return +retVal;
};
/*
* WayNet_AutoCompletion
* - waypoint AutoCompletion
*/
func int WayNet_AutoCompletion (var int wordPtr) {
//zCListSort
var int ptr; ptr = MEM_WayNet.wplist_next;
var zCListSort list;
var string wpName; wpName = MEM_ReadString (wordPtr);
while (ptr);
list = _^ (ptr);
if (list.data) {
var zCWaypoint wp; wp = _^ (list.data);
if (STR_StartsWith (wp.name, wpName)) {
MEM_WriteString (wordPtr, wp.name);
return TRUE;
};
};
ptr = list.next;
end;
return FALSE;
};