-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcheatengine.h
More file actions
291 lines (254 loc) · 12.2 KB
/
cheatengine.h
File metadata and controls
291 lines (254 loc) · 12.2 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
/* cheatengine.h
* Header file for the cefive Cheat Engine.
* Author: Sir Gee of Five
*/
#ifndef CHEATENGINE_H
#define CHEATENGINE_H
#include <stdio.h>
#include <pspkerneltypes.h>
#include <pspiofilemgr.h>
#include "cheat.h"
#include "block.h"
#include "cefiveconfig.h"
#include "geelog.h"
/** Indicates success. */
#define CHEATENGINE_SUCCESS (0)
/** Indicates failure. */
#define CHEATENGINE_FAILURE (-1)
/** Indicates a memory error. */
#define CHEATENGINE_MEMORY (-2)
/** Indicates a NULL pointer. */
#define CHEATENGINE_NULLPTR (-3)
/** Indicates an I/O Error. */
#define CHEATENGINE_FILEIO (-4)
/** The maximum number of Cheat structs in the Cheat array. */
#define CHEATENGINE_CHEAT_MAX 512
/** The maximum number of Block structs in the Block array. */
#define CHEATENGINE_BLOCK_MAX 8192
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _CheatEngine {
/** Pointer to the first element of an array of Cheat structs. */
Cheat* cheatlist;
/** Pointer to the first element of an array of Block structs. */
Block* blocklist;
/** Pointer to a CEFiveConfig struct holding configuration settings. */
CEFiveConfig* prConfig;
/** The number of Cheats in the cheatlist array. */
int cheat_count;
/** The number of Blocks in the blocklist array. */
int block_count;
/** The base address of all Cheats and Blocks. */
SceUInt32 base_address;
/** Whether the Cheat Trigger is active (Music Key) */
int trigger_active;
}
/** The CheatEngine struct represents a Cheat Engine. The struct contains
* members to encapsulate logging, Cheats and configuration. Nearly all
* Cheat Engine functions require a pointer to a CheatEngine struct.
*/
CheatEngine;
/** Add a new Block to a Cheat Engine, returning a pointer to the newly
* added Block.
*
* @param prEng Pointer to a CheatEngine struct representing the Cheat
* Engine.
* @return A pointer to a Block struct or NULL is returned.
*/
Block* cheatengine_add_block(CheatEngine* prEng);
/** Add a new Cheat to a Cheat Engine, returning a pointer to the newly
* added Cheat.
*
* @param prEng Pointer to a CheatEngine struct representing the Cheat
* Engine.
* @return A pointer to a Cheat struct or NULL is returned.
*/
Cheat* cheatengine_add_cheat(CheatEngine* prEng);
/** Return a pointer to a Block struct representing the indicated Block.
*
* @param prEng Pointer to a CheatEngine struct representing the Cheat
* Engine.
* @param index int indicating the Block to return.
* @return A pointer to a Block struct or NULL is returned.
*/
Block* cheatengine_get_block(CheatEngine* prEng, const int index);
/** Return a pointer to a Cheat struct representing the indicated Cheat.
*
* @param prEng Pointer to a CheatEngine struct representing the Cheat
* Engine.
* @param index int indicating the Cheat to return.
* @return A pointer to a Cheat struct or NULL is returned.
*/
Cheat* cheatengine_get_cheat(CheatEngine* prEng, const int index);
/** Activate all Cheats that are currently inactive.
*
* @param prEng Pointer to a CheatEngine struct representing the Cheat Engine.
* @return CHEATENGINE_NULLPOTR is returned if the parameter prEng is NULL.
* CHEATENGINE_SUCCESS is returned if the Cheats are activated.
*/
int cheatengineActivateCheats(CheatEngine* prEng);
/** Apply the specified Block to memory.
*
* @param prEng Pointer to a CheatEngine struct representing the Cheat Engine.
* @param index int specifying the Block in the Block array to apply.
* @return CHEATENGINE_NULLPTR is returned if prEng is NULL. CHEATENGINE_FAILURE
* is returned if the specified Block pointer is NULL. CHEATENGINE_SUCCESS is
* returned if the Block is applied to memory.
*/
int cheatengineApplyBlock(CheatEngine *prEng, int index);
/** Apply the specified Cheat to memory.
*
* @param prEng Pointer to a CheatEngine struct representing the Cheat Engine.
* @param index int specifying the Cheat in the Cheat array to apply.
* @return CHEATENGINE_NULLPTR is returned if prEng is NULL.
* CHEATENGINE_FAILURE is returned if the specified Cheat pointer is NULL,
* or if the Cheat could not be applied to memory.
* CHEATENGINE_SUCCESS is returned if the Cheat is applied to memory.
*/
int cheatengineApplyCheat(CheatEngine *prEng, int index);
/** Apply the specified Block to memory as a single byte.
*
* @param prBlock Pointer to a Block struct representing the Cheat Block.
* @return CHEATENGINE_NULLPTR is returned if prBlock is NULL.
* CHEATENGINE_SUCCESS is returned if the value has been applied to memory,
* or if the memory already contains the value that would have been applied.
*/
int cheatengineApplyUChar8Block(Block* prBlock);
/** Apply the specified Block to memory as a 32-bit value.
*
* @param prBlock Pointer to a Block struct representing the Cheat Block.
* @return CHEATENGINE_NULLPTR is returned if prBlock is NULL.
* CHEATENGINE_SUCCESS is returned if the value has been applied to memory,
* or if the memory already contains the value that would have been applied.
*/
int cheatengineApplyUInt32Block(Block* prBlock);
/** Apply the specified Block to memory as a 16-bit value.
*
* @param prBlock Pointer to a Block struct representing the Cheat Block.
* @return CHEATENGINE_NULLPTR is returned if prBlock is NULL.
* CHEATENGINE_SUCCESS is returned if the value has been applied to memory,
* or if the memory already contains the value that would have been applied.
*/
int cheatengineApplyUShort16Block(Block* prBlock);
/** Deactivate all of the currently activated Cheats that are selected.
*
* @paranm prEng Pointer to a CheatEngine struct representing the Cheat Engine.
* @return CHEATENGINE_NULLPTR is returned if prEng is NULL.
* CHEATENGINE_SUCCESS is returned if the Cheats have been deactivated.
*/
int cheatengineDeactivateCheats(CheatEngine* prEng);
/** Return a pointer to the specified Block from a Cheat Engine.
*
* @param prEng Pointer to a CheatEngine struct representing the Cheat Engine.
* @param index int index of the Block to return.
* @return NULL is returned if prEng is NULL, or if the specified index is out
* of bounds. A Pointer to the specified Block struct is returned otherwise.
*/
Block* cheatengineGetBlock(CheatEngine *, int index);
/** Return a pointer to the specified Cheat from a Cheat Engine.
*
* @param prEng Pointer to a CheatEngine struct representing the Cheat Engine.
* @param index int index of the Cheat to return.
* @return NULL is returned if prEng is NULL, or if the specified index is out
* of bounds. A Pointer to the specified Cheat struct is returned otherwise.
*/
Cheat* cheatengineGetCheat(CheatEngine *, int index);
/** Initialize a CheatEngine struct by specifying initial pointers.
*
* @param prEng Pointer to a CheatEngine struct to initialize.
* @param prCfg Pointer to a CEFiveConfig struct containing configuration
* settings.
* @param arCheat Pointer to the first element of an array of Cheat structs.
* @param arBlock Pointer to the first element of an array of Block structs.
* @return CHEATENGINE_NULLPTR is returned if prEng or prCfg are NULL.
* CHEATENGINE_SUCCESS is returned if the struct is initialized.
*/
int cheatengine_init(CheatEngine* prEng, CEFiveConfig* prCfg, Cheat* arCheat,
Block* arBlock);
/** Refresh the specified Cheat Engine, Applying or Resetting cheats as
* necessary.
*
* @param prEng Pointer to a CheatEngine struct representing a Cheat Engine.
* @return CHEATENGINE_NULLPTR is returned if prEng is NULL.
* CHEATENGINE_SUCCESS is returned if the Cheat Engine is refreshed.
*/
int cheatengine_refresh(CheatEngine* prEng);
/** Reset a previously activated Block by specifying the index. A Block that
* is Reset will return memory to it's value when the Block was applied.
*
* @param prEng Pointer to a CheatEngine struct representing the Cheat Engine.
* @param index int index of the Block to reset.
* @return CHEATENGINE_NULLPTR is returned if prEng is NULL.
* CHEATENGINE_FAILURE is returned if the Block pointer specified by index is
* NULL. CHEATENGINE_SUCCESS is returned if the specified Block has been Reset.
*/
int cheatengineResetBlock(CheatEngine *prEng, int index);
/** Reset a previously activated Cheat by specifying the index. A Cheat that
* is Reset will have each of the Blocks belonging to the Cheat Reset.
*
* @param prEng Pointer to a CheatEngine struct representing the Cheat Engine.
* @param index int index of the Cheat to reset.
* @return CHEATENGINE_NULLPTR is returned if prEng is NULL.
* CHEATENGINE_FAILURE is returned if the Cheat pointer specified by index is
* NULL. CHEATENGINE_SUCCESS is returned if the specified Cheat has been Reset.
*/
int cheatengineResetCheat(CheatEngine *prEng, int index);
/** Reset the specified Block by returning the memory to its original value.
* The memory is replaced as an 8-bit value.
*
* @param prBlock Pointer to a Block struct representing the Block to reset.
* @return CHEATENGINE_NULLPTR is returned if prBlock is NULL.
* CHEATENGINE_SUCCESS is returned if the Block is reset.
*/
int cheatengineResetUChar8Block(Block* prBlock);
/** Reset the specified Block by returning the memory to its original value.
* The memory is replaced as a 32-bit value.
*
* @param prBlock Pointer to a Block struct representing the Block to reset.
* @return CHEATENGINE_NULLPTR is returned if prBlock is NULL.
* CHEATENGINE_SUCCESS is returned if the Block is reset.
*/
int cheatengineResetUInt32Block(Block* prBlock);
/** Reset the specified Block by returning the memory to its original value.
* The memory is replaced as a 16-bit value.
*
* @param prBlock Pointer to a Block struct representing the Block to reset.
* @return CHEATENGINE_NULLPTR is returned if prBlock is NULL.
* CHEATENGINE_SUCCESS is returned if the Block is reset.
*/
int cheatengineResetUShort16Block(Block* prBlock);
/** Set a specified Cheat to constant. A constant cheat is activated when a
* Cheat is applied, but is not reset when the Cheat is reset.
*
* @param prEng Pointer to a CheatEngine struct representing the Cheat Engine.
* @param index int index of the Cheat to set constant.
* @return CHEATENGINE_NULLPTR is returned if prEng is NULL.
* CHEATENGINE_FAILURE is returned if the specified Cheat pointer is NULL.
* CHEATENGINE_SUCCESS is returned if the specified Cheat is set to constant.
*/
int cheatengineSetCheatConstant(CheatEngine* prEng, int index);
/** Set a specified Cheat to inactive. An inactive cheat is not applied at any
* time.
*
* @param prEng Pointer to a CheatEngine struct representing the Cheat Engine.
* @param index int index of the Cheat to set inactive.
* @return CHEATENGINE_NULLPTR is returned if prEng is NULL.
* CHEATENGINE_FAILURE is returned if the specified Cheat pointer is NULL.
* CHEATENGINE_SUCCESS is returned if the specified Cheat is set to inactive.
*/
int cheatengineSetCheatInactive(CheatEngine* prEng, int index);
/** Set a specified Cheat to selected. A selected cheat is activated when a
* Cheat is applied, and is reset when the Cheats are reset.
*
* @param prEng Pointer to a CheatEngine struct representing the Cheat Engine.
* @param index int index of the Cheat to set selected.
* @return CHEATENGINE_NULLPTR is returned if prEng is NULL.
* CHEATENGINE_FAILURE is returned if the specified Cheat pointer is NULL.
* CHEATENGINE_SUCCESS is returned if the specified Cheat is set to selected.
*/
int cheatengineSetCheatSelected(CheatEngine* prEng, int index);
#ifdef __cplusplus
}
#endif
#endif