-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcheat.h
More file actions
233 lines (200 loc) · 8.76 KB
/
cheat.h
File metadata and controls
233 lines (200 loc) · 8.76 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
/* cheat.h
* The Cheat struct and related functions.
* Originally adapted from crt0_prx.c
*
* Author: Sir Gee of Five
*/
#ifndef CHEAT_H
#define CHEAT_H
#include <stdio.h>
/** Indicates Cheat is selected. */
#define CHEAT_FLAG_SELECTED (1<<0)
/** Indicates Cheat is constant. */
#define CHEAT_FLAG_CONSTANT (1<<1)
/** Indicates Cheat was recently activated or reset. */
#define CHEAT_FLAG_FRESH (1<<2)
/** Indicates Success of a function. */
#define CHEAT_SUCCESS (0)
/** Indicates Failure of a function. */
#define CHEAT_FAILURE (-1)
/** Indicates a NULL pointer. */
#define CHEAT_NULLPTR (-2)
/** Indicates a Memory allocation fault in a function. */
#define CHEAT_MEMORY (-3)
/** The maximum number of characters in a Cheat Name. */
#define CHEAT_NAME_LEN (32)
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _Cheat {
/** The first Block index of a Cheat. */
unsigned short block;
/** The number of Blocks belonging to the Cheat. */
unsigned short len;
/** Cheat Flags */
unsigned char flags;
/** Display Name of the Cheat */
unsigned char name[CHEAT_NAME_LEN + 1];
}
/** The Cheat struct is used to hold a single Cheat in the Cheat Engine.
* The structure contains members for the block index, number of blocks,
* flags and the name of the Cheat. The structure maintains compatibility
* with the previous NitePr struct by the same name.
*/
Cheat;
/** Clear all of the flags in the specified Cheat.
*
* @param prCheat Pointer to a Cheat struct to clear.
* @return CHEAT_MEMORY is returned if the specified Cheat pointer is NULL.
* CHEAT_SUCCESS is returned if the flags are cleared.
*/
int cheat_clear_flags(Cheat* prCheat);
/** Clear the CONSTANT cheat flag in the specified Cheat.
*
* @param prCheat Pointer to a Cheat struct containing the Cheat to clear.
* @return CHEAT_MEMORY is returned if the specified Cheat pointer is NULL.
* CHEAT_SUCCESS is returned if the flags are cleared.
*/
int cheat_clearflag_constant(Cheat* prCheat);
/** Clear the FRESH cheat flag in the specified Cheat.
*
* @param prCheat Pointer to a Cheat struct containing the Cheat to clear.
* @return CHEAT_MEMORY is returned if the specified Cheat pointer is NULL.
* CHEAT_SUCCESS is returned if the flags are cleared.
*/
int cheat_clearflag_fresh(Cheat* prCheat);
/** Clear the SELECTED cheat flag in the specified Cheat.
*
* @param prCheat Pointer to a Cheat struct containing the Cheat to clear.
* @return CHEAT_MEMORY is returned if the specified Cheat pointer is NULL.
* CHEAT_SUCCESS is returned if the flags are cleared.
*/
int cheat_clearflag_selected(Cheat* prCheat);
/** Return the index of the first Block that belongs to the specified Cheat.
*
* @param prCheat Pointer to a Cheat struct representing the Cheat
* @return An unsigned integer containing the index within the Block array
* of the first Block belonging to the Cheat.
*/
unsigned int cheat_get_block(Cheat* prCheat);
/** Return the number of Block structs in the Block array that belong to the
* specified Cheat.
*
* @param prCheat Pointer to a Cheat struct representing the Cheat
* @return An unsigned integer containing the number of Blocks in the Block
* array that belong to the Cheat.
*/
unsigned int cheat_get_length(Cheat *prCheat);
/** Initialize a Cheat struct.
*
* @param prCheat Pointer to the Cheat struct to initialize.
* @return 0 indicates usccess, less than 0 indicates failure.
*/
int cheat_init(Cheat* prCheat);
/** Return an integer indicating whether the CONSTANT flag of the specified
* Cheat is set.
*
* @param prCheat Pointer to a Cheat struct to return flag indications for.
* @return 1 is returned if the flag is set, 0 is returned if the flag is
* clear.
*/
int cheat_is_constant(Cheat* prCheat);
/** Return an integer indicating whether the FRESH flag of the specified
* Cheat is set.
*
* @param prCheat Pointer to a Cheat struct to return flag indications for.
* @return 1 is returned if the flag is set, 0 is returned if the flag is
* clear.
*/
int cheat_is_fresh(Cheat* prCheat);
/** Return an integer indicating whether the CONSTANT flag and the SELECTED
* flag of the specified Cheat is set.
*
* @param prCheat Pointer to a Cheat struct to return flag indications for.
* @return 1 is returned if the flag is set, 0 is returned if the flag is
* clear.
*/
int cheat_is_inactive(Cheat* prCheat);
/** Return an integer indicating whether the SELECTED flag of the specified
* Cheat is set.
*
* @param prCheat Pointer to a Cheat struct to return flag indications for.
* @return 1 is returned if the flag is set, 0 is returned if the flag is
* clear.
*/
int cheat_is_selected(Cheat* prCheat);
/** Assign the index of the first Block in the Block array that belongs to
* the specified Cheat.
*
* @param prCheat Pointer to a Cheat struct to assign the Block index for.
* @param block unsigned int containing the index to assign.
* @return CHEAT_MEMORY is returned if the specified Cheat pointer is NULL.
* CHEAT_SUCCESS is returned if the block index is assigned.
*/
int cheat_set_block(Cheat* prCheat, unsigned int block);
/** Sets the specified Cheat to a Constant Cheat. A Constant Cheat is a
* cheat that activates when the Cheat Engine is activated, but remains
* active when the Cheat Engine is deactivated.
*
* @param prCheat Pointer to the Cheat Struct to set the flag state for.
* @return CHEAT_MEMORY is returned if the specified Cheat pointer is NULL.
* CHEAT_SUCCESS is returned if the flag is set.
*/
int cheat_set_constant(Cheat* prCheat);
/** Sets the specified Cheat to an inactive Cheat. An Inactive Cheat is a
* cheat that is not copied to memory at any time. If it has already been
* applied to memory, an Inactive Cheat is removed from memory.
*
* @param prCheat Pointer to the Cheat Struct to set the flag state for.
* @return CHEAT_MEMORY is returned if the specified Cheat pointer is NULL.
* CHEAT_SUCCESS is returned if the flag is set.
*/
int cheat_set_inactive(Cheat* prCheat);
/** Assign the number of Blocks in the Block array belong to the specified
* Cheat.
*
* @param prCheat Pointer to a Cheat struct to assign the Block index for.
* @param length The number of Blocks in the Block array to assign.
* @return CHEAT_MEMORY is returned if the specified Cheat pointer is NULL.
* CHEAT_SUCCESS is returned if the block length is assigned.
*/
int cheat_set_length(Cheat* prCheat, unsigned int length);
/** Sets the specified Cheat to a Selected Cheat. A Selected Cheat is a
* cheat that activates when the Cheat Engine is activated, and is removed
* from memory when the Cheat Engine is deactivated.
*
* @param prCheat Pointer to the Cheat Struct to set the flag state for.
* @return CHEAT_MEMORY is returned if the specified Cheat pointer is NULL.
* CHEAT_SUCCESS is returned if the flag is set.
*/
int cheat_set_selected(Cheat* prCheat);
/** Set the CONSTANT flag for the specified Cheat. The CONSTANT flag
* indicates whether a particular Cheat is considered active at all times,
* or active only when Cheats are toggled on in the Cheat Engine.
*
* @param prCheat Pointer to the Cheat Struct to set the flag state for.
* @return CHEAT_MEMORY is returned if the specified Cheat pointer is NULL.
* CHEAT_SUCCESS is returned if the flag is set.
*/
int cheat_setflag_constant(Cheat* prCheat);
/** Set the FRESH flag for the specified Cheat. The FRESH flag indicates
* whether a Cheat has been applied to active memory.
*
* @param prCheat Pointer to the Cheat Struct to set the flag state for.
* @return CHEAT_MEMORY is returned if the specified Cheat pointer is NULL.
* CHEAT_SUCCESS is returned if the flag is set.
*/
int cheat_setflag_fresh(Cheat* prCheat);
/** Set the SELECTED flag for the specified Cheat. The SELECTED flag
* indicates whether a particular Cheat is considered active when Cheats
* are toggled on in the Cheat Engine.
*
* @param prCheat Pointer to the Cheat Struct to set the flag state for.
* @return CHEAT_MEMORY is returned if the specified Cheat pointer is NULL.
* CHEAT_SUCCESS is returned if the flag is set.
*/
int cheat_setflag_selected(Cheat* prCheat);
#ifdef __cplusplus
}
#endif
#endif