Linux build fix
[dolphin.git] / docs / ActionReplay / CodeTypesGuide.txt
blob88aa4be163b1bd84fc30a9a0c16676cda1a91935
1 omments: 1
3 A Compendium of Gamecube Action Replay Code Types
5 Note: This is note a Complete code type list.
7 The purpose of this document is to catalogue and explain the effects of different AR code types in a clear, concise, and easy to read format. Please note that this document is not intended to explain EVERY code type, only those of interest to the amateur hacker.
9 It would not have been possible to write this document without Kenobi's "GCN AR CODES TYPES EXPLANATION", found at www.GSCentral.com, so a big thank-you goes to Kenobi and Parasyte for their contributions to the GCN hacking scene.
11 Kenobi's documentation is recommended reading as it is very complete, precise, and exact in it's explanations. However, that is also it's main flaw, it's TOO complex and technical for the casual or newbie hacker to understand. If "Address = ((0x0wXXXXXXX) AND 0x01FFFFFF) OR 0x80000000)" makes any sense to you, then I implore you to read Kenobi's guide instead. The intended audience for this document is people who'd rather have things explained in plain English.
13 It should be noted that every decrypted AR code has a basic two-part format that is universal to every code. The first half contains the code type and address to be written to. The second half contains the value to be written.
15 The Gamecube has a memory range of 80000000 - 817FFFFF (cached), or C0000000 - C17FFFFF (uncached). However for the sake of simplicity, the AR uses an offset number in the range of 00000000 - 017FFFFF. The code type identifier is an 8-bit value that is applied to the first two digits of the offset. For example, if your offset is 00012345, and you wish to perform a 32-bit write (04), you simply add (04000000) + (00012345) = 04012345.
17 In order to conserve space and simplicity, only the 8-bit code type identifier and particulars of the second half of the code will be explained below, as the method for procuring the first half has already been described above ;)
19 Terms:
21 8-bit - Byte - 0x12
22 16-bit - Halfword - 0x1234
23 32-bit - Word - 0x12345678
25 ---Writes---
27 (00) - NNNNNNXX
28 8-bit write. X is the value, N is the number of times to repeat.
30 (02) NNNNXXXX
31 16-bit write. X is the value, N is the number of times to repeat.
33 (04) XXXXXXXX
34 32-bit write. X is the value.
36 Examples:
38 00006500 00000312
39 Will write byte 0x12 to 80006500, 80006501, 80006502, 800067503.
41 02006500 00011234
42 Will write halfword 0x1234 to 80006500, 80006502.
44 05006500 12345678
45 Will write word 0x12345678 to 81006500.
48 ---Addition---
50 (80) - 000000XX
51 8-bit Addition. Load the byte at the address, add X to it, and save resulting byte.
53 (82) - 0000XXXX
54 16-bit Addition. Load the halfword at the address, add X to it, and save resulting halfword.
56 (84) - XXXXXXXX
57 32-bit Addition. Load the word at the address, add X to it, and save resulting word.
59 ---Single Line Activators---
61 ***Equal***
62 (08) 000000XX
63 8-bit Equal activator.
65 (0A) 0000XXXX
66 16-bit Equal activator.
68 (0C) XXXXXXXX
69 32-bit Equal activator.
71 X is the value the address must equal to activate the next line of code.
73 ***NOT Equal***
74 (10) 000000XX
75 8-bit NOT Equal activator.
77 (12) 0000XXXX
78 16-bit NOT Equal activator.
80 (14) XXXXXXXX
81 32-bit NOT Equal activator.
83 If the value stored at the address is not equal to X, activate the next line of code.
85 ***If Lower (signed)***
86 (18) 000000XX
87 8-bit If Lower (signed) activator.
89 (1A) 0000XXXX
90 16-bit If Lower (signed) activator.
92 (1C) XXXXXXXX
93 32-bit If Lower (signed) activator.
95 If the value stored at the address is lower than X, activate the next line of code.
97 ***If Higher (signed)***
98 (20) 000000XX
99 8-bit If Higher (signed) activator.
101 (22) 0000XXXX
102 16-bit If Higher (signed) activator.
104 (24) XXXXXXXX
105 32-bit If Higher (signed) activator.
107 If the value stored at the address is higher than X, activate the next line of code.
109 ***If Lower (unsigned)***
110 (28) 000000XX
111 8-bit If Lower (unsigned) activator.
113 (2A) 0000XXXX
114 16-bit If Lower (unsigned) activator.
116 (2C) XXXXXXXX
117 32-bit If Lower (unsigned) activator.
119 If the value stored at the address is lower than X, activate the next line of code.
121 ***If Higher (unsigned)***
122 (30) 000000XX
123 8-bit If Higher (unsigned) activator.
125 (32) 0000XXXX
126 16-bit If Higher (unsigned) activator.
128 (34) XXXXXXXX
129 32-bit If Higher (unsigned) activator.
131 If the value stored at the address is higher than X, activate the next line of code.
133 ---Double Line Activators---
135 ***Equal***
136 (48) 000000XX
137 8-bit activator.
139 (4A) 0000XXXX
140 16-bit activator.
142 (4C) XXXXXXXX
143 32-bit activator.
145 X is the value the address must equal to activate the next two lines of code.
147 ***NOT Equal***
148 (50) 000000XX
149 8-bit NOT Equal activator.
151 (52) 0000XXXX
152 16-bit NOT Equal activator.
154 (54) XXXXXXXX
155 32-bit NOT Equal activator.
157 If the value stored at the address is not equal to X, activate the next two lines of code.
159 ***If Lower (signed)***
160 (58) 000000XX
161 8-bit If Lower (signed) activator.
163 (5A) 0000XXXX
164 16-bit If Lower (signed) activator.
166 (5C) XXXXXXXX
167 32-bit If Lower (signed) activator.
169 If the value stored at the address is lower than X, activate the next two lines of code.
171 ***If Higher (signed)***
172 (60) 000000XX
173 8-bit If Higher (signed) activator.
175 (62) 0000XXXX
176 16-bit If Higher (signed) activator.
178 (64) XXXXXXXX
179 32-bit If Higher (signed) activator.
181 If the value stored at the address is higher than X, activate the next two lines of code.
183 ***If Lower (unsigned)***
184 (68) 000000XX
185 8-bit If Lower (unsigned) activator.
187 (6A) 0000XXXX
188 16-bit If Lower (unsigned) activator.
190 (6C) XXXXXXXX
191 32-bit If Lower (unsigned) activator.
193 If the value stored at the address is lower than X, activate the next two lines of code.
195 ***If Higher (unsigned)***
196 (70) 000000XX
197 8-bit If Higher (unsigned) activator.
199 (72) 0000XXXX
200 16-bit If Higher (unsigned) activator.
202 (74) XXXXXXXX
203 32-bit If Higher (unsigned) activator.
205 If the value stored at the address is higher than X, activate the next two lines of code.
207 ---Multi-Line Activators---
209 Note that all multi-line codes must end with the line 00000000 40000000.
211 ***Equal***
212 (88) 000000XX
213 8-bit activator.
215 (8A) 0000XXXX
216 16-bit activator.
218 (8C) XXXXXXXX
219 32-bit activator.
221 X is the value the address must equal to activate the next lines of code.
223 ***NOT Equal***
224 (90) 000000XX
225 8-bit NOT Equal activator.
227 (92) 0000XXXX
228 16-bit NOT Equal activator.
230 (94) XXXXXXXX
231 32-bit NOT Equal activator.
233 If the value stored at the address is not equal to X, activate the next lines of code.
235 ***If Lower (signed)***
236 (98) 000000XX
237 8-bit If Lower (signed) activator.
239 (9A) 0000XXXX
240 16-bit If Lower (signed) activator.
242 (9C) XXXXXXXX
243 32-bit If Lower (signed) activator.
245 If the value stored at the address is lower than X, activate the next lines of code.
247 ***If Higher (signed)***
248 (A0) 000000XX
249 8-bit If Higher (signed) activator.
251 (A2) 0000XXXX
252 16-bit If Higher (signed) activator.
254 (A4) XXXXXXXX
255 32-bit If Higher (signed) activator.
257 If the value stored at the address is higher than X, activate the next lines of code.
259 ***If Lower (unsigned)***
260 (A8) 000000XX
261 8-bit If Lower (unsigned) activator.
263 (AA) 0000XXXX
264 16-bit If Lower (unsigned) activator.
266 (AC) XXXXXXXX
267 32-bit If Lower (unsigned) activator.
269 If the value stored at the address is lower than X, activate the next lines of code.
271 ***If Higher (unsigned)***
272 (B0) 000000XX
273 8-bit If Higher (unsigned) activator.
275 (B2) 0000XXXX
276 16-bit If Higher (unsigned) activator.
278 (B4) XXXXXXXX
279 32-bit If Higher (unsigned) activator.
281 If the value stored at the address is higher than X, activate the next lines of code.
283 ---Alignment---
285 Codes must be properly aligned depending on the type of code.
286 8-bit codes can be used on ANY address.
287 16-bit codes must have an address that is a multiple of 2: 0,2,4,6,8,A,C,E.
288 32-bit codes must have an address that is a multiple of 4:0,4,8,C.
289 If codes aren't aligned, they may not work, or may cause your AR to spaz out and kill your cat (R.I.P. Snowball).
291 ---Signed & Unsigned Numbers---
293 Unsigned means :
294 For 8-bits : 0x00 -> 0xFF = 0 to 255.
295 For 16-bits: 0x0000 -> 0xFFFF = 0 to 65535.
296 For 32-bits: 0x00000000 -> 0xFFFFFFFF = 0 to 4294967295.
298 Signed means :
299 For 8-bits : 0x00 -> 0x7F = 0 to 127.
300 0x80 -> 0xFF = -127 to -1.
301 For 16-bits: 0x0000 -> 0x7FFF = 0 to 32767.
302 0x8000 -> 0xFFFF = -32768 to -1.
303 For 32-bits: 0x00000000 -> 0x7FFFFFFF = 0 to 2147483647.
304 0x80000000 -> 0xFFFFFFFF = -2147483648 to -1.