diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-09-24 19:16:47 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-09-24 19:16:47 -0400 |
commit | 433df9a40045288ab70ab4f317bdd5e4e53ecb1b (patch) | |
tree | b8145f33f92fe0c1b901be65a63b80db9b297fa2 | |
parent | b9b9f7c0ca3824c670d525e4c46e52cd72f3a8d3 (diff) | |
download | gen3uploader-433df9a40045288ab70ab4f317bdd5e4e53ecb1b.tar.gz gen3uploader-433df9a40045288ab70ab4f317bdd5e4e53ecb1b.tar.bz2 gen3uploader-433df9a40045288ab70ab4f317bdd5e4e53ecb1b.zip |
Extractor now gets box names
-rw-r--r-- | gba/source/main.c | 20 | ||||
-rw-r--r-- | source/main.c | 23 |
2 files changed, 43 insertions, 0 deletions
diff --git a/gba/source/main.c b/gba/source/main.c index 375adb8..30f11d6 100644 --- a/gba/source/main.c +++ b/gba/source/main.c | |||
@@ -214,6 +214,26 @@ int main(void) | |||
214 | 214 | ||
215 | for (int bi=0; bi<14; bi++) | 215 | for (int bi=0; bi<14; bi++) |
216 | { | 216 | { |
217 | u8* boxName = pc->boxNames[bi]; | ||
218 | |||
219 | u32 bn1 = | ||
220 | (boxName[0] << 24) | ||
221 | | (boxName[1] << 16) | ||
222 | | (boxName[2] << 8) | ||
223 | | (boxName[3]); | ||
224 | |||
225 | u32 bn2 = | ||
226 | (boxName[4] << 24) | ||
227 | | (boxName[5] << 16) | ||
228 | | (boxName[6] << 8) | ||
229 | | (boxName[7]); | ||
230 | |||
231 | sendU32(bn1); | ||
232 | waitForAck(); | ||
233 | |||
234 | sendU32(bn2); | ||
235 | waitForAck(); | ||
236 | |||
217 | struct BoxPokemon* box = pc->boxes[bi]; | 237 | struct BoxPokemon* box = pc->boxes[bi]; |
218 | 238 | ||
219 | for (int si=0; si<30; si++) | 239 | for (int si=0; si<30; si++) |
diff --git a/source/main.c b/source/main.c index de36755..4ce2315 100644 --- a/source/main.c +++ b/source/main.c | |||
@@ -292,6 +292,7 @@ void* extractor(void* userdata) | |||
292 | u32 partyCount = getMsg(); | 292 | u32 partyCount = getMsg(); |
293 | 293 | ||
294 | cJSON* jParty = cJSON_CreateArray(); | 294 | cJSON* jParty = cJSON_CreateArray(); |
295 | cJSON* jBoxes = cJSON_CreateArray(); | ||
295 | 296 | ||
296 | for (u32 i = 0; i < partyCount; i++) | 297 | for (u32 i = 0; i < partyCount; i++) |
297 | { | 298 | { |
@@ -314,8 +315,29 @@ void* extractor(void* userdata) | |||
314 | { | 315 | { |
315 | printf("Getting box %d...\n", i+1); | 316 | printf("Getting box %d...\n", i+1); |
316 | 317 | ||
318 | u8 boxName[8]; | ||
319 | |||
320 | u32 bnd = getMsg(); | ||
321 | boxName[0] = (bnd & 0xFF000000) >> 24; | ||
322 | boxName[1] = (bnd & 0x00FF0000) >> 16; | ||
323 | boxName[2] = (bnd & 0x0000FF00) >> 8; | ||
324 | boxName[3] = (bnd & 0x000000FF); | ||
325 | |||
326 | bnd = getMsg(); | ||
327 | boxName[4] = (bnd & 0xFF000000) >> 24; | ||
328 | boxName[5] = (bnd & 0x00FF0000) >> 16; | ||
329 | boxName[6] = (bnd & 0x0000FF00) >> 8; | ||
330 | boxName[7] = (bnd & 0x000000FF); | ||
331 | |||
332 | char d_boxName[25]; | ||
333 | decodePokemonCharset(boxName, 9, d_boxName, gameLanguage); | ||
334 | |||
335 | cJSON_AddItemToArray(jBoxes, cJSON_CreateString(d_boxName)); | ||
336 | |||
317 | for (int j=0; j<30; j++) | 337 | for (int j=0; j<30; j++) |
318 | { | 338 | { |
339 | usleep(5000); | ||
340 | |||
319 | int isPoke = getMsg(); | 341 | int isPoke = getMsg(); |
320 | 342 | ||
321 | if (isPoke == 1) | 343 | if (isPoke == 1) |
@@ -339,6 +361,7 @@ void* extractor(void* userdata) | |||
339 | } | 361 | } |
340 | } | 362 | } |
341 | 363 | ||
364 | cJSON_AddItemToObject(root, "boxes", jBoxes); | ||
342 | cJSON_AddItemToObject(root, "pokemon", jParty); | 365 | cJSON_AddItemToObject(root, "pokemon", jParty); |
343 | 366 | ||
344 | char *rendered = cJSON_Print(root); | 367 | char *rendered = cJSON_Print(root); |