diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/link.c | 2 | ||||
-rw-r--r-- | source/main.c | 54 |
2 files changed, 55 insertions, 1 deletions
diff --git a/source/link.c b/source/link.c index f63f4a5..27837f8 100644 --- a/source/link.c +++ b/source/link.c | |||
@@ -99,7 +99,7 @@ void getMsgArr(u32* arr, int len) | |||
99 | { | 99 | { |
100 | for (int i=0; i<len; i++) | 100 | for (int i=0; i<len; i++) |
101 | { | 101 | { |
102 | *(vu32*)(arr+i) = __builtin_bswap32(recv()); | 102 | *(vu32*)(arr+i) = recv(); |
103 | } | 103 | } |
104 | } | 104 | } |
105 | 105 | ||
diff --git a/source/main.c b/source/main.c index 81f30a3..ceb24d5 100644 --- a/source/main.c +++ b/source/main.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include "link.h" | 13 | #include "link.h" |
14 | #include "encoding.h" | 14 | #include "encoding.h" |
15 | #include "multiboot.h" | 15 | #include "multiboot.h" |
16 | #include "pokemon.h" | ||
16 | 17 | ||
17 | void printmain() | 18 | void printmain() |
18 | { | 19 | { |
@@ -204,6 +205,59 @@ void* extractor(void* userdata) | |||
204 | 205 | ||
205 | printf("\n"); | 206 | printf("\n"); |
206 | 207 | ||
208 | sendMsg(1); | ||
209 | |||
210 | // Start receiving party pokémon. | ||
211 | printf("Getting party...\n"); | ||
212 | |||
213 | u32 partyCount = getMsg(); | ||
214 | |||
215 | for (u32 i = 0; i < partyCount; i++) | ||
216 | { | ||
217 | u32 rawdata[sizeof(struct PokemonIntermediate) / 4]; | ||
218 | getMsgArr(rawdata, sizeof(struct PokemonIntermediate) / 4); | ||
219 | |||
220 | struct PokemonIntermediate* pki = (struct PokemonIntermediate*)(&rawdata); | ||
221 | |||
222 | printf("Species: %d\n", __builtin_bswap16(pki->species)); | ||
223 | |||
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 | |||
237 | printf("\nOT: "); | ||
238 | |||
239 | for (int i=0; i<7; i++) | ||
240 | { | ||
241 | if (pki->otName[i] == 0xFF) | ||
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); | ||
251 | printf("HP: %ld\n", __builtin_bswap32(pki->hp)); | ||
252 | printf("Attack: %ld\n", __builtin_bswap32(pki->attack)); | ||
253 | printf("Defense: %ld\n", __builtin_bswap32(pki->defense)); | ||
254 | printf("Special Attack: %ld\n", __builtin_bswap32(pki->spAttack)); | ||
255 | printf("Special Defense: %ld\n", __builtin_bswap32(pki->spDefense)); | ||
256 | printf("Speed: %ld\n", __builtin_bswap32(pki->speed)); | ||
257 | |||
258 | printf("\n"); | ||
259 | } | ||
260 | |||
207 | waitForButtons(PAD_BUTTON_START); | 261 | waitForButtons(PAD_BUTTON_START); |
208 | } | 262 | } |
209 | 263 | ||