about summary refs log tree commit diff stats
path: root/gba/source/saveblocks.h
diff options
context:
space:
mode:
Diffstat (limited to 'gba/source/saveblocks.h')
-rw-r--r--gba/source/saveblocks.h338
1 files changed, 333 insertions, 5 deletions
diff --git a/gba/source/saveblocks.h b/gba/source/saveblocks.h index 45c127c..cf0a5c3 100644 --- a/gba/source/saveblocks.h +++ b/gba/source/saveblocks.h
@@ -7,9 +7,337 @@
7 * saveblocks.h: describes saveblock structures for all of Gen 3 (yay!) 7 * saveblocks.h: describes saveblock structures for all of Gen 3 (yay!)
8 */ 8 */
9 9
10// TODO: this entire file. Placeholders for now, fill in later, if I can be bothered. 10// Most of the structures come from pokeruby, FR/LG changes come from my own research / the firered IDB on pokecommunity
11// I don't really want to make a fork of pokeruby's headers for now... 11#include "savestructs.h"
12 12
13typedef u8 SaveBlock1, *pSaveBlock1; 13typedef struct
14typedef u8 SaveBlock2, *pSaveBlock2; 14{
15typedef u8 SaveBlock3, *pSaveBlock3; \ No newline at end of file 15 /*0x00*/ struct Coords16 pos;
16 /*0x04*/ struct WarpData location;
17 /*0x0C*/ struct WarpData warp[4];
18 /*0x2C*/ u16 battleMusic;
19 /*0x2E*/ u8 weather;
20 /*0x2F*/ u8 filler_2F;
21 /*0x30*/ u8 flashUsed;
22 /*0x32*/ u16 mapDataId;
23 /*0x34*/ u16 mapView[0x100];
24 /*0x234*/ u8 playerPartyCount;
25 /*0x238*/ struct Pokemon playerParty[6];
26 /*0x490*/ u32 money;
27 /*0x494*/ u16 coins;
28 /*0x496*/ u16 registeredItem; // registered for use with SELECT button
29 /*0x498*/ struct ItemSlot pcItems[50];
30 /*0x560*/ struct ItemSlot bagPocket_Items[20];
31 /*0x5B0*/ struct ItemSlot bagPocket_KeyItems[20];
32 /*0x600*/ struct ItemSlot bagPocket_PokeBalls[16];
33 /*0x640*/ struct ItemSlot bagPocket_TMHM[64];
34 /*0x740*/ struct ItemSlot bagPocket_Berries[46];
35 /*0x7F8*/ struct Pokeblock pokeblocks[40];
36 /*0x938*/ u8 unk938[52]; // pokedex related
37 /*0x96C*/ u16 berryBlenderRecords[3];
38 /*0x972*/ u8 filler_972[0x6];
39 /*0x978*/ u16 trainerRematchStepCounter;
40 /*0x97A*/ u8 trainerRematches[100];
41 /*0x9E0*/ struct MapObject mapObjects[16];
42 /*0xC20*/ struct MapObjectTemplate mapObjectTemplates[64];
43 /*0x1220*/ u8 flags[0x120];
44 /*0x1340*/ u16 vars[0x100];
45 /*0x1540*/ u32 gameStats[50];
46 /*0x1608*/ struct BerryTree berryTrees[128];
47 /*0x1A08*/ struct SecretBaseRecord secretBases[20];
48 /*0x2688*/ u8 playerRoomDecor[12];
49 /*0x2694*/ u8 playerRoomDecorPos[12];
50 /*0x26A0*/ u8 decorDesk[10];
51 /*0x26AA*/ u8 decorChair[10];
52 /*0x26B4*/ u8 decorPlant[10];
53 /*0x26BE*/ u8 decorOrnament[30];
54 /*0x26DC*/ u8 decorMat[30];
55 /*0x26FA*/ u8 decorPoster[10];
56 /*0x2704*/ u8 decorDoll[40];
57 /*0x272C*/ u8 decorCushion[10];
58 /*0x2736*/ u8 padding_2736[2];
59 /*0x2738*/ TVShow tvShows[24];
60 /*0x2A98*/ u8 filler_2A98[0x64];
61 /*0x2AFC*/ u16 outbreakPokemonSpecies;
62 /*0x2AFE*/ u8 outbreakLocationMapNum;
63 /*0x2AFF*/ u8 outbreakLocationMapGroup;
64 /*0x2B00*/ u8 outbreakPokemonLevel;
65 /*0x2B01*/ u8 outbreakUnk1;
66 /*0x2B02*/ u16 outbreakUnk2;
67 /*0x2B04*/ u16 outbreakPokemonMoves[4];
68 /*0x2B0C*/ u8 outbreakUnk4;
69 /*0x2B0D*/ u8 outbreakPokemonProbability;
70 /*0x2B0E*/ u16 outbreakUnk5;
71 /*0x2B10*/ u8 filler_2B0E[0xC];
72 /*0x2B1C*/ u16 unk2B1C[4];
73 /*0x2B24*/ u8 filler_2B24[0x28];
74 /*0x2B4C*/ struct MailStruct mail[16];
75 /*0x2D8C*/ u8 filler_2D8C[0x8];
76 /*0x2D94*/ OldMan oldMan;
77 /*0x2DC0*/ u8 unk_2DC0[0x14];
78 /*0x2DD4*/ struct EasyChatPair easyChatPairs[5]; //Dewford trend [0] and some other stuff
79 /*0x2DFC*/ u8 filler_2DFC[0x100];
80 /*0x2EFC*/ struct SB1_2EFC_Struct sb1_2EFC_struct[5];
81 /*0x2F9C*/ u8 filler_2F9C[0xA0];
82 /*0x303C*/ u8 filler_303C[0x38];
83 /*0x3074*/ u8 filler_3074[0x42];
84 /*0x30B6*/ u8 filler_30B6;
85 /*0x30B7*/ u8 filler_30B7[0x59];
86 /*0x3110*/ u8 giftRibbons[7];
87 /*0x3117*/ u8 filler_311B[0x2D];
88 /*0x3144*/ struct Roamer roamer;
89 /*0x3158*/ u8 filler_3158[0x8];
90 /*0x3160*/ struct EnigmaBerry enigmaBerry; // this is actually offset by 0x98 ...
91 /*0x3690*/ struct RamScript ramScript;
92 /*0x3A7C*/ u8 filler_3A7C[0x10];
93 /*0x3A8C*/ u8 unk3A8C[52]; //pokedex related
94} SaveBlock1_RS;
95
96typedef struct // Don't rely on the commented offsets, they'll be wrong due to elements removed in FR/LG...
97{
98 /*0x00*/ struct Coords16 pos;
99 /*0x04*/ struct WarpData location;
100 /*0x0C*/ struct WarpData warp[4];
101 /*0x2C*/ u16 battleMusic;
102 /*0x2E*/ u8 weather;
103 /*0x2F*/ u8 filler_2F;
104 /*0x30*/ u8 flashUsed;
105 /*0x32*/ u16 mapDataId;
106// /*0x34*/ u16 mapView[0x100]; // Not in fr/lg
107 /*0x234*/ u8 playerPartyCount;
108 /*0x238*/ struct Pokemon playerParty[6];
109 /*0x490*/ u32 money;
110 /*0x494*/ u16 coins;
111 /*0x496*/ u16 registeredItem; // registered for use with SELECT button
112 /*0x498*/ struct ItemSlot pcItems[30];
113 /*0x560*/ struct ItemSlot bagPocket_Items[42];
114 /*0x5B0*/ struct ItemSlot bagPocket_KeyItems[30];
115 /*0x600*/ struct ItemSlot bagPocket_PokeBalls[13];
116 /*0x640*/ struct ItemSlot bagPocket_TMHM[58];
117 /*0x740*/ struct ItemSlot bagPocket_Berries[43];
118// /*0x7F8*/ struct Pokeblock pokeblocks[40]; // Not in fr/lg
119 /*0x938*/ u8 unk938[52]; // pokedex related
120 /*0x96C*/ u8 unk_62C[12];
121 /*0x972*/ u8 filler_972[0x6];
122 /*0x97A*/ u8 unk_63E[98];
123 /*0x9E0*/ struct MapObject mapObjects[16];
124 /*0xC20*/ struct MapObjectTemplate mapObjectTemplates[64];
125 /*0x1220*/ u8 flags[0x120];
126 /*0x1340*/ u16 vars[0x100];
127 /*0x1540*/ u32 gameStats[64]; // encrypted with saveblock2 xor-key
128 struct QuestStory questlog[4];
129 u8 messages[12][4];
130 struct NPCState npc_states[0x10];
131 u8 unk_2f10[112];
132 struct DaycarePokemon daycare[2];
133 u8 unk_3098[56];
134 struct Roamer roamer;
135 u8 unk_30e4[8];
136 /*0x3160*/ struct EnigmaBerryFRLGE enigmaBerry;
137 u8 unk_3120[0x1C0]; // 4 bytes of CRC16, then 444 bytes of unknown. Mystery Gift related.
138 u8 unk_32E0[0x150]; // 4 bytes of CRC16, then 332 bytes of unknown. Mystery Gift related. "mevent_buffer_1"
139 u8 unk_3430[0x150]; // 4 bytes of CRC16, then 332 bytes of unknown. Mystery Gift related. "mevent_buffer_2"
140 u8 unk_368C[0x9C]; // padding? doesn't seem to be actually used
141 struct RamScript ramScript;
142 u8 unk_3A07[17];
143 u8 pokemon_flags_2[52];
144 u8 rivalName[8];
145 u8 unk_3a54[128];
146 u8 words[21][10];
147 u8 unk_3ba6[570];
148} __attribute__((aligned(1))) SaveBlock1_FRLG;
149
150typedef struct // Don't rely on the commented offsets, they'll be wrong due to elements changed/added in Emerald...
151{
152 /*0x00*/ struct Coords16 pos;
153 /*0x04*/ struct WarpData location;
154 /*0x0C*/ struct WarpData warp[4];
155 /*0x2C*/ u16 battleMusic;
156 /*0x2E*/ u8 weather;
157 /*0x2F*/ u8 filler_2F;
158 /*0x30*/ u8 flashUsed;
159 /*0x32*/ u16 mapDataId;
160 /*0x34*/ u16 mapView[0x100];
161 /*0x234*/ u8 playerPartyCount;
162 /*0x238*/ struct Pokemon playerParty[6];
163 /*0x490*/ u32 money;
164 /*0x494*/ u16 coins;
165 /*0x496*/ u16 registeredItem; // registered for use with SELECT button
166 /*0x498*/ struct ItemSlot pcItems[50];
167 /*0x560*/ struct ItemSlot bagPocket_Items[30];
168 /*0x5D8*/ struct ItemSlot bagPocket_KeyItems[30];
169 /*0x650*/ struct ItemSlot bagPocket_PokeBalls[16];
170 /*0x690*/ struct ItemSlot bagPocket_TMHM[64];
171 /*0x790*/ struct ItemSlot bagPocket_Berries[46];
172 /*0x7F8*/ struct Pokeblock pokeblocks[40]; // every offset is shifted by 0x50 from here on thanks to changed bag-counts
173 /*0x938*/ u8 unk938[52]; // pokedex related
174 /*0x96C*/ u16 berryBlenderRecords[3];
175 /*0x972*/ u8 filler_972[0x6];
176 /*0x978*/ u16 trainerRematchStepCounter;
177 /*0x97A*/ u8 trainerRematches[100];
178 /*0x9E0*/ struct MapObject mapObjects[16];
179 /*0xC20*/ struct MapObjectTemplate mapObjectTemplates[64];
180 /*0x1220*/ u8 flags[0x12C];
181 /*0x1340*/ u16 vars[0x100]; // offsets shifted by 0x5C from here on thanks to added flags
182 /*0x1540*/ u32 gameStats[64]; // encrypted with saveblock2 xor-key
183 /*0x1608*/ struct BerryTree berryTrees[128]; // offsets shifted by 0x94 from here on thanks to added 14 gamestats
184 /*0x1A08*/ struct SecretBaseRecord secretBases[20];
185 /*0x2688*/ u8 playerRoomDecor[12];
186 /*0x2694*/ u8 playerRoomDecorPos[12];
187 /*0x26A0*/ u8 decorDesk[10];
188 /*0x26AA*/ u8 decorChair[10];
189 /*0x26B4*/ u8 decorPlant[10];
190 /*0x26BE*/ u8 decorOrnament[30];
191 /*0x26DC*/ u8 decorMat[30];
192 /*0x26FA*/ u8 decorPoster[10];
193 /*0x2704*/ u8 decorDoll[40];
194 /*0x272C*/ u8 decorCushion[10];
195 // /*0x2736*/ u8 padding_2736[2];
196 /*0x2738*/ TVShow tvShows[24];
197 /*0x2A98*/ u8 filler_2A98[0x64];
198 /*0x2AFC*/ u16 outbreakPokemonSpecies; // offset by 0x94
199 /*0x2AFE*/ u8 outbreakLocationMapNum;
200 /*0x2AFF*/ u8 outbreakLocationMapGroup;
201 /*0x2B00*/ u8 outbreakPokemonLevel;
202 /*0x2B01*/ u8 outbreakUnk1;
203 /*0x2B02*/ u16 outbreakUnk2;
204 /*0x2B04*/ u16 outbreakPokemonMoves[4];
205 /*0x2B0C*/ u8 outbreakUnk4;
206 /*0x2B0D*/ u8 outbreakPokemonProbability;
207 /*0x2B0E*/ u16 outbreakUnk5;
208 /*0x2B10*/ u8 filler_2B0E[0xC];
209 /*0x2B1C*/ u16 unk2B1C[4];
210 /*0x2B24*/ u8 filler_2B24[0x28];
211 /*0x2B4C*/ struct MailStruct mail[16]; // offset by 0x94
212 /*0x2D8C*/ u8 filler_2D8C[0x8];
213 /*0x2D94*/ OldMan oldMan;
214 /*0x2DC0*/ u8 unk_2DC0[0x14];
215 /*0x2DD4*/ struct EasyChatPair easyChatPairs[5]; //Dewford trend [0] and some other stuff
216 // /*0x2DFC*/ u8 filler_2DFC[0x100];
217 /*0x2EFC*/ struct SB1_2EFC_Struct sb1_2EFC_struct[12];
218 u8 unk_3010[0x198]; // no idea if any of this is actually used.
219 /*0x3110*/ u8 giftRibbons[7];
220 /*0x3117*/ u8 filler_311B[0x2D];
221 /*0x3144*/ struct Roamer roamer;
222 /*0x3158*/ u8 filler_3158[0x8];
223 /*0x3160*/ struct EnigmaBerryFRLGE enigmaBerry;
224 u8 unk_322C[0x1C0]; // 4 bytes of CRC16, then 444 bytes of unknown. Mystery Gift related.
225 u8 unk_33EC[0x150]; // 4 bytes of CRC16, then 332 bytes of unknown. Mystery Gift related. "mevent_buffer_1"
226 u8 unk_353C[0x150]; // 4 bytes of CRC16, then 332 bytes of unknown. Mystery Gift related. "mevent_buffer_2"
227 u8 unk_368C[0x9C]; // padding? doesn't seem to be actually used
228 /*0x3690*/ struct RamScript ramScript;
229 /*0x3A7C*/ u8 filler_3A7C[0x10];
230 /*0x3A8C*/ u8 unk3A8C[52]; //pokedex related
231} SaveBlock1_E;
232
233// ---
234
235struct SaveBlock2_Sub
236{
237 /*0x0000, 0x00A8*/ u8 filler_000[0x4AE];
238 /*0x04AE, 0x0556*/ u8 var_4AE;
239 /*0x04AF, 0x0557*/ u8 var_4AF;
240 /*0x04B0, 0x0558*/ u16 var_4B0;
241 /*0x04B2, 0x055A*/ u16 var_4B2;
242 /*0x04B4, 0x055C*/ u16 var_4B4;
243 /*0x04B6, 0x055E*/ u16 var_4B6;
244 /*0x04B8, 0x0560*/ u8 filler_4B8[0x10];
245 /*0x04C8, 0x0570*/ u16 var_4C8;
246 /*0x04CA, 0x0572*/ u16 var_4CA;
247 /*0x04CC, 0x0574*/ u8 filler_4CC[0x31C];
248};
249
250typedef struct
251{
252 /*0x00*/ u8 playerName[8];
253 /*0x08*/ u8 playerGender; // MALE, FEMALE
254 /*0x09*/ u8 specialSaveWarp;
255 /*0x0A*/ u8 playerTrainerId[4];
256 /*0x0E*/ u16 playTimeHours;
257 /*0x10*/ u8 playTimeMinutes;
258 /*0x11*/ u8 playTimeSeconds;
259 /*0x12*/ u8 playTimeVBlanks;
260 /*0x13*/ u8 optionsButtonMode; // OPTIONS_BUTTON_MODE_[NORMAL/LR/L_EQUALS_A]
261 /*0x14*/ u16 optionsTextSpeed:3; // OPTIONS_TEXT_SPEED_[SLOW/MID/FAST]
262 u16 optionsWindowFrameType:5; // Specifies one of the 20 decorative borders for text boxes
263 u16 optionsSound:1; // OPTIONS_SOUND_[MONO/STEREO]
264 u16 optionsBattleStyle:1; // OPTIONS_BATTLE_STYLE_[SHIFT/SET]
265 u16 optionsBattleSceneOff:1; // whether battle animations are disabled
266 u16 regionMapZoom:1; // whether the map is zoomed in
267 /*0x18*/ struct Pokedex pokedex;
268 /*0x90*/ u8 filler_90[0x8];
269 /*0x98*/ struct Time localTimeOffset;
270 /*0xA0*/ struct Time lastBerryTreeUpdate;
271 /*0xA8*/ struct SaveBlock2_Sub filler_A8;
272} SaveBlock2_RS;
273
274typedef struct
275{
276 /*0x00*/ u8 playerName[8];
277 /*0x08*/ u8 playerGender; // MALE, FEMALE
278 /*0x09*/ u8 specialSaveWarp;
279 /*0x0A*/ u8 playerTrainerId[4];
280 /*0x0E*/ u16 playTimeHours;
281 /*0x10*/ u8 playTimeMinutes;
282 /*0x11*/ u8 playTimeSeconds;
283 /*0x12*/ u8 playTimeVBlanks;
284 /*0x13*/ u8 optionsButtonMode; // OPTIONS_BUTTON_MODE_[NORMAL/LR/L_EQUALS_A]
285 /*0x14*/ u16 optionsTextSpeed:3; // OPTIONS_TEXT_SPEED_[SLOW/MID/FAST]
286 u16 optionsWindowFrameType:5; // Specifies one of the 20 decorative borders for text boxes
287 u16 optionsSound:1; // OPTIONS_SOUND_[MONO/STEREO]
288 u16 optionsBattleStyle:1; // OPTIONS_BATTLE_STYLE_[SHIFT/SET]
289 u16 optionsBattleSceneOff:1; // whether battle animations are disabled
290 u16 regionMapZoom:1; // whether the map is zoomed in
291 /*0x18*/ struct Pokedex pokedex;
292 /*0x90*/ u8 filler_90[0x8];
293 /*0x98*/ struct Time localTimeOffset;
294 /*0xA0*/ struct Time lastBerryTreeUpdate;
295 /*0xA8*/ struct SaveBlock2_Sub filler_A8;
296 /*0x890*/ u8 unk_890[8];
297 /*0x898*/ u8 mapdata[0x258];
298 /*0xaf0*/ u16 field_af0;
299 /*0xaf2*/ u16 field_af2;
300 /*0xaf4*/ u16 field_af4;
301 /*0xaf6*/ u16 field_af6;
302 /*0xaf8*/ u8 unk_af8[0x428];
303 /*0xf20*/ u32 xor_key;
304} SaveBlock2_FRLG;
305
306typedef struct
307{
308 /*0x00*/ u8 playerName[8];
309 /*0x08*/ u8 playerGender; // MALE, FEMALE
310 /*0x09*/ u8 specialSaveWarp;
311 /*0x0A*/ u8 playerTrainerId[4];
312 /*0x0E*/ u16 playTimeHours;
313 /*0x10*/ u8 playTimeMinutes;
314 /*0x11*/ u8 playTimeSeconds;
315 /*0x12*/ u8 playTimeVBlanks;
316 /*0x13*/ u8 optionsButtonMode; // OPTIONS_BUTTON_MODE_[NORMAL/LR/L_EQUALS_A]
317 /*0x14*/ u16 optionsTextSpeed:3; // OPTIONS_TEXT_SPEED_[SLOW/MID/FAST]
318 u16 optionsWindowFrameType:5; // Specifies one of the 20 decorative borders for text boxes
319 u16 optionsSound:1; // OPTIONS_SOUND_[MONO/STEREO]
320 u16 optionsBattleStyle:1; // OPTIONS_BATTLE_STYLE_[SHIFT/SET]
321 u16 optionsBattleSceneOff:1; // whether battle animations are disabled
322 u16 regionMapZoom:1; // whether the map is zoomed in
323 /*0x18*/ struct Pokedex pokedex;
324 /*0x90*/ u8 filler_90[0x8];
325 /*0x98*/ struct Time localTimeOffset;
326 /*0xA0*/ struct Time lastBerryTreeUpdate;
327 /*0xA8*/ u32 xor_key;
328 /*0xAC*/ struct SaveBlock2_Sub filler_A8;
329} SaveBlock2_E;
330
331typedef union {
332 SaveBlock1_RS rs;
333 SaveBlock1_FRLG frlg;
334 SaveBlock1_E e;
335} SaveBlock1, *pSaveBlock1;
336
337typedef union {
338 SaveBlock2_RS rs;
339 SaveBlock2_FRLG frlg;
340 SaveBlock2_E e;
341} SaveBlock2, *pSaveBlock2;
342
343typedef struct PokemonStorage SaveBlock3, *pSaveBlock3; \ No newline at end of file