about summary refs log tree commit diff stats
path: root/source/main.c
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-09-24 19:16:47 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-09-24 19:16:47 -0400
commit433df9a40045288ab70ab4f317bdd5e4e53ecb1b (patch)
treeb8145f33f92fe0c1b901be65a63b80db9b297fa2 /source/main.c
parentb9b9f7c0ca3824c670d525e4c46e52cd72f3a8d3 (diff)
downloadgen3uploader-433df9a40045288ab70ab4f317bdd5e4e53ecb1b.tar.gz
gen3uploader-433df9a40045288ab70ab4f317bdd5e4e53ecb1b.tar.bz2
gen3uploader-433df9a40045288ab70ab4f317bdd5e4e53ecb1b.zip
Extractor now gets box names
Diffstat (limited to 'source/main.c')
-rw-r--r--source/main.c23
1 files changed, 23 insertions, 0 deletions
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);