diff options
Diffstat (limited to 'source/main.c')
| -rw-r--r-- | source/main.c | 51 |
1 files changed, 14 insertions, 37 deletions
| diff --git a/source/main.c b/source/main.c index ceb24d5..1355533 100644 --- a/source/main.c +++ b/source/main.c | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include <stdio.h> | 10 | #include <stdio.h> |
| 11 | #include <stdlib.h> | 11 | #include <stdlib.h> |
| 12 | #include <unistd.h> | 12 | #include <unistd.h> |
| 13 | #include <string.h> | ||
| 13 | #include "link.h" | 14 | #include "link.h" |
| 14 | #include "encoding.h" | 15 | #include "encoding.h" |
| 15 | #include "multiboot.h" | 16 | #include "multiboot.h" |
| @@ -117,6 +118,7 @@ void* extractor(void* userdata) | |||
| 117 | 118 | ||
| 118 | printf("\n"); | 119 | printf("\n"); |
| 119 | VIDEO_WaitVSync(); | 120 | VIDEO_WaitVSync(); |
| 121 | sleep(1); | ||
| 120 | 122 | ||
| 121 | u32 isValid = getMsg(); | 123 | u32 isValid = getMsg(); |
| 122 | if (isValid == -1) | 124 | if (isValid == -1) |
| @@ -144,19 +146,13 @@ void* extractor(void* userdata) | |||
| 144 | // Get trainer ID | 146 | // Get trainer ID |
| 145 | u32 trainerId = getMsg(); | 147 | u32 trainerId = getMsg(); |
| 146 | 148 | ||
| 147 | printf("Trainer: "); | 149 | // Get game language. |
| 150 | enum PokemonLanguage gameLanguage = getMsg(); | ||
| 148 | 151 | ||
| 149 | for (int i = 0; i < 8; i++) | 152 | char d_trainerName[25]; |
| 150 | { | 153 | decodePokemonCharset(trainerName, 8, d_trainerName, gameLanguage); |
| 151 | if (trainerName[i] == 0xFF) | ||
| 152 | { | ||
| 153 | break; | ||
| 154 | } else { | ||
| 155 | printf("%c", debugGen3Decode(trainerName[i])); | ||
| 156 | } | ||
| 157 | } | ||
| 158 | 154 | ||
| 159 | printf(" (%ld)\n", trainerId); | 155 | printf("Trainer: %s (%ld)\n", d_trainerName, trainerId); |
| 160 | 156 | ||
| 161 | // Wait for confirmation. | 157 | // Wait for confirmation. |
| 162 | printf("Press A to import the data from this game.\n"); | 158 | printf("Press A to import the data from this game.\n"); |
| @@ -219,34 +215,15 @@ void* extractor(void* userdata) | |||
| 219 | 215 | ||
| 220 | struct PokemonIntermediate* pki = (struct PokemonIntermediate*)(&rawdata); | 216 | struct PokemonIntermediate* pki = (struct PokemonIntermediate*)(&rawdata); |
| 221 | 217 | ||
| 222 | printf("Species: %d\n", __builtin_bswap16(pki->species)); | 218 | char d_pokename[31]; |
| 223 | 219 | decodePokemonCharset(pki->nickname, 10, d_pokename, pki->language); | |
| 224 | u8* pokename = pki->nickname; | ||
| 225 | printf("Nickname: "); | ||
| 226 | |||
| 227 | for (int i = 0; i < 10; i++) | ||
| 228 | { | ||
| 229 | if (pokename[i] == 0xFF) | ||
| 230 | { | ||
| 231 | break; | ||
| 232 | } else { | ||
| 233 | printf("%c", debugGen3Decode(pokename[i])); | ||
| 234 | } | ||
| 235 | } | ||
| 236 | 220 | ||
| 237 | printf("\nOT: "); | 221 | char d_otName[22]; |
| 222 | decodePokemonCharset(pki->otName, 7, d_otName, pki->language); | ||
| 238 | 223 | ||
| 239 | for (int i=0; i<7; i++) | 224 | printf("Species: %d\n", __builtin_bswap16(pki->species)); |
| 240 | { | 225 | printf("Nickname: %s\n", d_pokename); |
| 241 | if (pki->otName[i] == 0xFF) | 226 | printf("OT: %s\n", d_otName); |
| 242 | { | ||
| 243 | break; | ||
| 244 | } else { | ||
| 245 | printf("%c", debugGen3Decode(pki->otName[i])); | ||
| 246 | } | ||
| 247 | } | ||
| 248 | |||
| 249 | printf("\n"); | ||
| 250 | printf("Level: %d\n", pki->level); | 227 | printf("Level: %d\n", pki->level); |
| 251 | printf("HP: %ld\n", __builtin_bswap32(pki->hp)); | 228 | printf("HP: %ld\n", __builtin_bswap32(pki->hp)); |
| 252 | printf("Attack: %ld\n", __builtin_bswap32(pki->attack)); | 229 | printf("Attack: %ld\n", __builtin_bswap32(pki->attack)); |
