-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdisassembler.h
More file actions
299 lines (259 loc) · 10.1 KB
/
disassembler.h
File metadata and controls
299 lines (259 loc) · 10.1 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
/* disassembler.h
* The Disassembler Applet for Cheat Engine of Five
* Author: Sir Gee of Five
*
*/
#ifndef DISASSEMBLER_H
#define DISASSEMBLER_H
#include <stdio.h>
#include <pspkerneltypes.h>
#include <pspdebug.h>
#include <psploadcore.h>
#include "appletconfig.h"
#include "colorconfig.h"
#include "cursorpos.h"
#include "dimension.h"
#include "gameinfo.h"
#include "geelog.h"
#include "ggame.h"
#include "glabel.h"
#include "glabelmap.h"
#include "gsegmap.h"
#include "gsegment.h"
#include "memviewpanel.h"
#include "mips.h"
/** Indicates success. */
#define DISASSEMBLER_SUCCESS (0)
/** Indicates failure. */
#define DISASSEMBLER_FAILURE (-1)
/** Indicates a memory error. */
#define DISASSEMBLER_MEMORY (-2)
/** Indicates a NULL pointer. */
#define DISASSEMBLER_NULLPTR (-3)
/** Indicates an address that is out of bounds. */
#define DISASSEMBLER_BADADDR (-4)
/** Default background color. */
#define DISASSEMBLER_DEFBGCOLOR ((u32)0xFFD0D0D0)
/** Default foreground color. */
#define DISASSEMBLER_DEFFGCOLOR ((u32)0xFF000000)
/** The number of elements in the Jump Stack. */
#define DISASSEMBLER_JSLEN 10
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _Disassembler {
/** Memory View Panel struct */
MemViewPanel memViewPanel;
/** Applet Configuration struct pointer */
AppletConfig* prApCfg;
/** Game Info struct pointer */
GameInfo* prGameInfo;
/** Game struct pointer */
GGame* game;
/** Editing indicator */
int editing;
/** Indicates that Disassembler needs redrawing. */
int dirty;
/** Indicates that the GGame has been loaded. */
int gameLoaded;
}
/** The Disassembler struct represents the CeFive Disassembler Applet. */
Disassembler;
int disassembler_analog_input(Disassembler* prDasm, unsigned char x,
unsigned char y);
/** Respond to the user pressing the Circle button.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return 0 indicates success, < 0 indicates failure.
*/
int disassembler_button_circle(Disassembler* prDasm);
/** Respond to the user pressing the Cross (X) button.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return 0 indicates success, < 0 indicates failure.
*/
int disassembler_button_cross(Disassembler* prDasm);
/** Respond to the user pressing the Left Trigger.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return 0 indicates success, < 0 indicates failure.
*/
int disassembler_button_ltrigger(Disassembler* prDasm);
/** Respond to the user pressing the Right Trigger.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return 0 indicates success, < 0 indicates failure.
*/
int disassembler_button_rtrigger(Disassembler* prDasm);
/** Respond to the user pressing the Square button.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return 0 indicates success, < 0 indicates failure.
*/
int disassembler_button_square(Disassembler* prDasm);
/** Respond to the user pressing the Triangle button.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return 0 indicates success, < 0 indicates failure.
*/
int disassembler_button_triangle(Disassembler* prDasm);
/** Respond to the user pressing the D-Pad down.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return 0 indicates success, < 0 indicates failure.
*/
int disassembler_dpad_down(Disassembler* prDasm);
/** Respond to the user pressing the D-Pad left.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return 0 indicates success, < 0 indicates failure.
*/
int disassembler_dpad_left(Disassembler* prDasm);
/** Respond to the user pressing the D-Pad right.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return 0 indicates success, < 0 indicates failure.
*/
int disassembler_dpad_right(Disassembler* prDasm);
/** Respond to the user pressing the D-Pad up.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return 0 indicates success, < 0 indicates failure.
*/
int disassembler_dpad_up(Disassembler* prDasm);
/** Return a pointer to an AppletConfig struct representing the Applet
* Configuration.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return A pointer to an AppletConfig struct or NULL is returned.
*/
AppletConfig* disassembler_get_appletconfig(Disassembler* prDasm);
/** Return a pointer to a ColorConfig struct representing the Cursor
* Color Configuration.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return A pointer to a ColorConfig struct or NULL is returned.
*/
ColorConfig* disassembler_get_cursorcolor(Disassembler* prDasm);
/** Return a pointer to a GGame struct representing the Game.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return A pointer to a GGame struct or NULL is returned.
*/
GGame* disassembler_get_game(Disassembler* prDasm);
/** Return a pointer to a MemViewPanel struct representing the Memory View
* Panel.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return A pointer to a MemViewPanel struct or NULL is returned.
*/
MemViewPanel* disassembler_get_memview(Disassembler* prDasm);
/** Return a pointer to a ColorConfig struct representing the Panel Color
* Configuration.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return A pointer to a ColorConfig struct or NULL is returned.
*/
ColorConfig* disassembler_get_panelcolor(Disassembler* prDasm);
/** Return a pointer to a CursorPos struct representing the position of
* the Disassembler Applet on the Debug Screen.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return A pointer to a CursorPos struct or NULL is returned.
*/
CursorPos* disassembler_get_position(Disassembler* prDasm);
/** Return a pointer to a Dimension struct representing the size of the
* Disassembler Applet on the Debug Screen.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return A pointer to a Dimension struct or NULL is returned.
*/
Dimension* disassembler_get_size(Disassembler* prDasm);
/** Return a pointer to a ColorConfig struct representing the Status Color
* Configuration.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return A pointer to a ColorConfig struct or NULL is returned.
*/
ColorConfig* disassembler_get_statuscolor(Disassembler* prDasm);
/** Initialize a Disassembler Applet.
*
* @param prDasm Pointer to the Disassembler struct to initialize.
* @param prApCfg Pointer to an AppletConfig struct representing the Applet
* Configuration.
* @return 0 indicates success, <0 indicates failure.
*/
int disassembler_init(Disassembler* prDasm, AppletConfig* prApCfg);
/** Return an indication of whether the Disassembler is currently editing.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return 0 indicates not editing, 1 indicates editing.
*/
int disassembler_is_editing(Disassembler* prDasm);
/** Scroll the Disassembler Applet down by a Page.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return 0 indicates success, <0 indicates failure.
*/
int disassembler_page_down(Disassembler* prDasm);
/** Scroll the Disassembler Applet up by a Page.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return 0 indicates success, <0 indicates failure.
*/
int disassembler_page_up(Disassembler* prDasm);
/** Redraw the Disassembler Applet on the Debug Screen.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return 0 indicates success, <0 indicates failure.
*/
int disassembler_redraw(Disassembler* prDasm);
/** Reposition the Disassembler to the indicated offset.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @param offset SceUInt32 containing the address to reposition to.
* @return 0 indicates success, <0 indicates failure.
*/
int disassembler_seek(Disassembler* prDasm, SceUInt32 offset);
/** Assign a Game to a Disassembler.
*
* @param prDasm Pointer to a Dissasembler struct representing the
* Disassembler Applet.
* @param prGame Pointer to a GGame struct representing the Game.
* @return 0 indicates success, <0 indicates failure.
*/
int disassembler_set_game(Disassembler* prDasm, GGame* prGame);
/** Return the current address of a Disassembler Applet.
*
* @param prDasm Pointer to a Disassembler struct representing the
* Disassembler Applet.
* @return SceUInt32 containing the current address.
*/
SceUInt32 disassembler_tell(Disassembler* prDasm);
#ifdef __cplusplus
}
#endif
#endif