about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-09-30 08:15:49 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-09-30 08:15:49 -0400
commitde39982228cc445fb02ca061e6484f7030104b7c (patch)
tree75b70bbf9e6b71d04863bc5c46f7399bcb1fc032
parent62be650076d6ea83e9822be56eaa59ab4195202c (diff)
downloadgen3uploader-de39982228cc445fb02ca061e6484f7030104b7c.tar.gz
gen3uploader-de39982228cc445fb02ca061e6484f7030104b7c.tar.bz2
gen3uploader-de39982228cc445fb02ca061e6484f7030104b7c.zip
Extractor now gets gift ribbon descriptions
Also fixed offsets of gift ribbon descriptions in the RSE save data, and
added the offset for FRLG.
-rw-r--r--gba/source/main.c30
-rw-r--r--gba/source/saveblocks.h53
-rw-r--r--source/main.c49
3 files changed, 106 insertions, 26 deletions
diff --git a/gba/source/main.c b/gba/source/main.c index 30f11d6..71db50d 100644 --- a/gba/source/main.c +++ b/gba/source/main.c
@@ -130,6 +130,36 @@ int main(void)
130 return 0; 130 return 0;
131 } 131 }
132 132
133 // Send gift ribbon descriptions
134 u8* giftRibbons = 0;
135 if (GAME_RS)
136 {
137 giftRibbons = gameData.SaveBlock1->rs.giftRibbons;
138 } else if (GAME_FRLG)
139 {
140 giftRibbons = gameData.SaveBlock1->frlg.giftRibbons;
141 } else if (GAME_EM)
142 {
143 giftRibbons = gameData.SaveBlock1->e.giftRibbons;
144 }
145
146 u32 gn1 =
147 (giftRibbons[0] << 24)
148 | (giftRibbons[1] << 16)
149 | (giftRibbons[2] << 8)
150 | (giftRibbons[3]);
151
152 u32 gn2 =
153 (giftRibbons[4] << 24)
154 | (giftRibbons[5] << 16)
155 | (giftRibbons[6] << 8);
156
157 sendU32(gn1);
158 waitForAck();
159
160 sendU32(gn2);
161 waitForAck();
162
133 // Send Pokédex data 163 // Send Pokédex data
134 u8* pokedexSeen = 0; 164 u8* pokedexSeen = 0;
135 if (GAME_RS) 165 if (GAME_RS)
diff --git a/gba/source/saveblocks.h b/gba/source/saveblocks.h index cf0a5c3..7879cd1 100644 --- a/gba/source/saveblocks.h +++ b/gba/source/saveblocks.h
@@ -82,9 +82,9 @@ typedef struct
82 /*0x303C*/ u8 filler_303C[0x38]; 82 /*0x303C*/ u8 filler_303C[0x38];
83 /*0x3074*/ u8 filler_3074[0x42]; 83 /*0x3074*/ u8 filler_3074[0x42];
84 /*0x30B6*/ u8 filler_30B6; 84 /*0x30B6*/ u8 filler_30B6;
85 /*0x30B7*/ u8 filler_30B7[0x59]; 85 /*0x30B7*/ u8 filler_30B7[0x5B];
86 /*0x3110*/ u8 giftRibbons[7]; 86 /*0x3112*/ u8 giftRibbons[7];
87 /*0x3117*/ u8 filler_311B[0x2D]; 87 /*0x3119*/ u8 filler_311B[0x2B];
88 /*0x3144*/ struct Roamer roamer; 88 /*0x3144*/ struct Roamer roamer;
89 /*0x3158*/ u8 filler_3158[0x8]; 89 /*0x3158*/ u8 filler_3158[0x8];
90 /*0x3160*/ struct EnigmaBerry enigmaBerry; // this is actually offset by 0x98 ... 90 /*0x3160*/ struct EnigmaBerry enigmaBerry; // this is actually offset by 0x98 ...
@@ -103,24 +103,23 @@ typedef struct // Don't rely on the commented offsets, they'll be wrong due to e
103 /*0x2F*/ u8 filler_2F; 103 /*0x2F*/ u8 filler_2F;
104 /*0x30*/ u8 flashUsed; 104 /*0x30*/ u8 flashUsed;
105 /*0x32*/ u16 mapDataId; 105 /*0x32*/ u16 mapDataId;
106// /*0x34*/ u16 mapView[0x100]; // Not in fr/lg 106 /*0x34*/ u8 playerPartyCount;
107 /*0x234*/ u8 playerPartyCount; 107 /*0x38*/ struct Pokemon playerParty[6];
108 /*0x238*/ struct Pokemon playerParty[6]; 108 /*0x290*/ u32 money;
109 /*0x490*/ u32 money; 109 /*0x294*/ u16 coins;
110 /*0x494*/ u16 coins; 110 /*0x296*/ u16 registeredItem; // registered for use with SELECT button
111 /*0x496*/ u16 registeredItem; // registered for use with SELECT button 111 /*0x298*/ struct ItemSlot pcItems[30];
112 /*0x498*/ struct ItemSlot pcItems[30]; 112 /*0x360*/ struct ItemSlot bagPocket_Items[42];
113 /*0x560*/ struct ItemSlot bagPocket_Items[42]; 113 /*0x3B0*/ struct ItemSlot bagPocket_KeyItems[30];
114 /*0x5B0*/ struct ItemSlot bagPocket_KeyItems[30]; 114 /*0x400*/ struct ItemSlot bagPocket_PokeBalls[13];
115 /*0x600*/ struct ItemSlot bagPocket_PokeBalls[13]; 115 /*0x440*/ struct ItemSlot bagPocket_TMHM[58];
116 /*0x640*/ struct ItemSlot bagPocket_TMHM[58]; 116 /*0x540*/ struct ItemSlot bagPocket_Berries[43];
117 /*0x740*/ struct ItemSlot bagPocket_Berries[43]; 117 /*0x5EA*/ u8 unk938[52]; // pokedex related
118// /*0x7F8*/ struct Pokeblock pokeblocks[40]; // Not in fr/lg 118 /*0x61E*/ u8 unk_62C[12];
119 /*0x938*/ u8 unk938[52]; // pokedex related 119 /*0x62A*/ u8 filler_972[0x6];
120 /*0x96C*/ u8 unk_62C[12]; 120 /*0x630*/ u8 unk_63E[98];
121 /*0x972*/ u8 filler_972[0x6]; 121 /*0x692*/ struct MapObject mapObjects[16];
122 /*0x97A*/ u8 unk_63E[98]; 122 // offsets are mostly wrong below here
123 /*0x9E0*/ struct MapObject mapObjects[16];
124 /*0xC20*/ struct MapObjectTemplate mapObjectTemplates[64]; 123 /*0xC20*/ struct MapObjectTemplate mapObjectTemplates[64];
125 /*0x1220*/ u8 flags[0x120]; 124 /*0x1220*/ u8 flags[0x120];
126 /*0x1340*/ u16 vars[0x100]; 125 /*0x1340*/ u16 vars[0x100];
@@ -130,11 +129,13 @@ typedef struct // Don't rely on the commented offsets, they'll be wrong due to e
130 struct NPCState npc_states[0x10]; 129 struct NPCState npc_states[0x10];
131 u8 unk_2f10[112]; 130 u8 unk_2f10[112];
132 struct DaycarePokemon daycare[2]; 131 struct DaycarePokemon daycare[2];
133 u8 unk_3098[56]; 132 u8 unk_3098[4];
133 u8 giftRibbons[7];
134 u8 unk_30A3[45];
134 struct Roamer roamer; 135 struct Roamer roamer;
135 u8 unk_30e4[8]; 136 u8 unk_30e4[8];
136 /*0x3160*/ struct EnigmaBerryFRLGE enigmaBerry; 137 /*0x3160*/ struct EnigmaBerryFRLGE enigmaBerry;
137 u8 unk_3120[0x1C0]; // 4 bytes of CRC16, then 444 bytes of unknown. Mystery Gift related. 138 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_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_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 u8 unk_368C[0x9C]; // padding? doesn't seem to be actually used
@@ -215,9 +216,9 @@ typedef struct // Don't rely on the commented offsets, they'll be wrong due to e
215 /*0x2DD4*/ struct EasyChatPair easyChatPairs[5]; //Dewford trend [0] and some other stuff 216 /*0x2DD4*/ struct EasyChatPair easyChatPairs[5]; //Dewford trend [0] and some other stuff
216 // /*0x2DFC*/ u8 filler_2DFC[0x100]; 217 // /*0x2DFC*/ u8 filler_2DFC[0x100];
217 /*0x2EFC*/ struct SB1_2EFC_Struct sb1_2EFC_struct[12]; 218 /*0x2EFC*/ struct SB1_2EFC_Struct sb1_2EFC_struct[12];
218 u8 unk_3010[0x198]; // no idea if any of this is actually used. 219 u8 unk_3010[0x19A]; // no idea if any of this is actually used.
219 /*0x3110*/ u8 giftRibbons[7]; 220 /*0x310E*/ u8 giftRibbons[7];
220 /*0x3117*/ u8 filler_311B[0x2D]; 221 /*0x3115*/ u8 filler_311B[0x2B];
221 /*0x3144*/ struct Roamer roamer; 222 /*0x3144*/ struct Roamer roamer;
222 /*0x3158*/ u8 filler_3158[0x8]; 223 /*0x3158*/ u8 filler_3158[0x8];
223 /*0x3160*/ struct EnigmaBerryFRLGE enigmaBerry; 224 /*0x3160*/ struct EnigmaBerryFRLGE enigmaBerry;
diff --git a/source/main.c b/source/main.c index 316ebf7..6c97255 100644 --- a/source/main.c +++ b/source/main.c
@@ -257,6 +257,55 @@ void* extractor(void* userdata)
257 cJSON_AddNumberToObject(root, "gameId", gameId); 257 cJSON_AddNumberToObject(root, "gameId", gameId);
258 cJSON_AddNumberToObject(root, "language", gameLanguage); 258 cJSON_AddNumberToObject(root, "language", gameLanguage);
259 259
260 // Get gift ribbon descriptions.
261 u8 giftRibbons[7];
262
263 tnd = getMsg();
264 giftRibbons[0] = (tnd & 0xFF000000) >> 24;
265 giftRibbons[1] = (tnd & 0x00FF0000) >> 16;
266 giftRibbons[2] = (tnd & 0x0000FF00) >> 8;
267 giftRibbons[3] = (tnd & 0x000000FF);
268
269 tnd = getMsg();
270 giftRibbons[4] = (tnd & 0xFF000000) >> 24;
271 giftRibbons[5] = (tnd & 0x00FF0000) >> 16;
272 giftRibbons[6] = (tnd & 0x0000FF00) >> 8;
273
274 if (giftRibbons[0])
275 {
276 cJSON_AddNumberToObject(root, "marineRibbon", giftRibbons[0]);
277 }
278
279 if (giftRibbons[1])
280 {
281 cJSON_AddNumberToObject(root, "landRibbon", giftRibbons[1]);
282 }
283
284 if (giftRibbons[2])
285 {
286 cJSON_AddNumberToObject(root, "skyRibbon", giftRibbons[2]);
287 }
288
289 if (giftRibbons[3])
290 {
291 cJSON_AddNumberToObject(root, "countryRibbon", giftRibbons[3]);
292 }
293
294 if (giftRibbons[4])
295 {
296 cJSON_AddNumberToObject(root, "nationalRibbon", giftRibbons[4]);
297 }
298
299 if (giftRibbons[5])
300 {
301 cJSON_AddNumberToObject(root, "earthRibbon", giftRibbons[5]);
302 }
303
304 if (giftRibbons[6])
305 {
306 cJSON_AddNumberToObject(root, "worldRibbon", giftRibbons[6]);
307 }
308
260 // Get Pokédex data 309 // Get Pokédex data
261 u32 pokedexSeen[13]; 310 u32 pokedexSeen[13];
262 u32 pokedexCaught[13]; 311 u32 pokedexCaught[13];