-
Notifications
You must be signed in to change notification settings - Fork 0
/
hack.h
231 lines (210 loc) · 4.62 KB
/
hack.h
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
#pragma once
#include <float.h>
#include <ipipe/c.h>
OPEN_C
#ifdef _MSC_VER
#define snprintf sprintf_s
#endif
#define JK_CTRL 0x10000000
#define JK_ALT 0x20000000
#define JK_SHIFT 0x40000000
#define JK_CMD 0x80000000
#define JK_GAMEP 0x08000000
// Game Controller Input
#define JK_L2 0x00000001
#define JK_R2 0x00000002
#define JK_L1 0x00000004
#define JK_R1 0x00000008
#define JK_T 0x00000010
#define JK_C 0x00000020
#define JK_X 0x00000040
#define JK_S 0x00000080
#define JK_SELECT 0x00000100
#define JK_L3 0x00000200
#define JK_R3 0x00000400
#define JK_START 0x00000800
// Hatch Switch: Up, Right, Down, Left
#define JK_HS_U 0x00001000
#define JK_HS_R 0x00002000
#define JK_HS_D 0x00004000
#define JK_HS_L 0x00008000
typedef union _RLN
{
ulint u[ ( sizeof( lpn ) / sizeof( lint ) ) + ( ( sizeof( lpn ) % sizeof(
lint ) ) ? 1 : 0 ) ];
lint s[ ( sizeof( lpn ) / sizeof( lint ) ) + ( ( sizeof( lpn ) % sizeof(
lint ) ) ? 1 : 0 ) ];
lpn r;
} RLN;
typedef union _RLD
{
ulint u;
lint s;
dpn r;
} RLD;
typedef union _RLF
{
ulong u;
long s;
float r;
} RLF;
typedef struct _BASE
{
ulint addr;
ulint size;
uchar depth;
} BASE;
#define BASES_COUNT 0x10
#define BASES_LAST 0xf
typedef struct _BASES
{
uchar c;
BASE a[ BASES_COUNT ];
} BASES;
typedef ushort hack_t;
#define HACK_T_MAX USHRT_MAX
/**
\brief Holds relative information about a hack
\param use 1 = Use during hook, 0 = Do NOT use during hook
\param irl If immeadiate children are not folders: 1 = radio, 0 = check
\param cid Codelist ID
\param coi Codelist Owner ID
\param id Index
\param ui List Index
\param oi Owner Index
\param fi First Child Index
\param ni Next Sibling Index
\param pi Prev Sibling Index
**/
typedef struct struct_HACK
{
uchar use : 1;
// Is Radio List
uchar irl : 1;
// ID (codelist file usage only)
ushort cid;
// Owner ID (codelist file usage only)
ushort coi;
// Current Index
hack_t id;
// UI Index
hack_t ui;
// Owner Index
hack_t oi;
// 1st Child Index
hack_t fi;
// Next Sibling Index
hack_t ni;
// Prev Sibling Index
hack_t pi;
} HACK;
typedef struct VHACKS_
{
hack_t count;
hack_t total;
size_t bytes;
hack_t index;
} VHACKS;
typedef struct HACKS_
{
VHACKS size;
HACK a[1];
} HACKS;
#define DIV_SIZE( T1, T2 ) (sizeof(T1) / sizeof(T2))
#define MOD_SIZE( T1, T2 ) (sizeof(T1) % sizeof(T2))
#define NODES_NEEDED( T1, T2 ) (DIV_SIZE(T1,T2) + (MOD_SIZE(T1,T2) ? 1 : 0))
static uchar const NUM_d_buff_size = NODES_NEEDED( lpn, dpn );
static uchar const NUM_f_buff_size = NODES_NEEDED( lpn, fpn );
static uchar const NUM_lint_buff_size = NODES_NEEDED( lpn, lint );
static uchar const NUM_long_buff_size = NODES_NEEDED( lpn, long );
static uchar const NUM_int_buff_size = NODES_NEEDED( lpn, int );
static uchar const NUM_short_buff_size = NODES_NEEDED( lpn, short );
typedef union _NUM
{
lpn l;
dpn d[ NODES_NEEDED( lpn, dpn ) ];
fpn f[ NODES_NEEDED( lpn, fpn ) ];
ulint _ulint[ NODES_NEEDED( lpn, lint ) ];
lint _lint[ NODES_NEEDED( lpn, lint ) ];
ulong _ulong[ NODES_NEEDED( lpn, long ) ];
long _long[ NODES_NEEDED( lpn, long ) ];
uint _uint[ NODES_NEEDED( lpn, int ) ];
int _int[ NODES_NEEDED( lpn, int ) ];
ushort _ushort[ NODES_NEEDED( lpn, short ) ];
short _short[ NODES_NEEDED( lpn, short ) ];
uchar _uchar[ sizeof( lpn ) ];
schar _schar[ sizeof( lpn ) ];
} NUM;
typedef enum _MECMP
{
CMP_DUMP = -1,
/* ==, != */
CMP_EQ, CMP_NE,
/* >, >= */
CMP_MT, CMP_ME,
/* <, <= */
CMP_LT, CMP_LE,
/* &, !& */
CMP_IA, CMP_NA,
/* |, !| */
CMP_IO, CMP_NO,
/* ^, !^ */
CMP_IX, CMP_NX,
CMP_COUNT,
CMP_UNDO,
CMP_REDO
} MECMP_T;
typedef enum _CODE_T
{
CODE_W = 0,
CODE_CPY,
CODE_INC,
CODE_DEC,
CODE_CMP,
CODE_JOKER,
CODE_MASTER,
CODE_COUNT
} CODE_T;
#define CODEV_COUNT 20
#define CODEV_LAST 19
typedef struct _CODE
{
uchar type : 4;
uchar size : 4;
// 'i', 'u', 'f', 'x', 'o', 'B' (binary), 'b' (boolean)
char format;
ulint addr[3];
NUM a[CODEV_COUNT];
ulong loop;
uchar info;
uchar _ci;
uchar _ni;
uchar _fi;
uchar _pi;
uchar _tm : 4;
} CODE;
#define CODES_COUNT 30
#define CODES_LAST 29
typedef struct VCODES_
{
uchar count;
uchar total;
size_t bytes;
uchar index;
} VCODES;
typedef struct CODES_
{
VCODES size;
CODE a[1];
} CODES;
/*
This is merely for %TMP%\PROC_ID\info.bin, it ensures a consistent data
format for the GUI to write and the injected functions to read
*/
typedef struct _HACKINFO
{
BASES bases;
HACKS hacks;
CODES codes;
} HACKINFO;
SHUT_C