diff options
Diffstat (limited to 'gba/source')
| -rw-r--r-- | gba/source/gamedata.c | 2 | ||||
| -rw-r--r-- | gba/source/main.c | 64 | 
2 files changed, 42 insertions, 24 deletions
| diff --git a/gba/source/gamedata.c b/gba/source/gamedata.c index 19d5100..8e63232 100644 --- a/gba/source/gamedata.c +++ b/gba/source/gamedata.c | |||
| @@ -493,7 +493,7 @@ bool initSaveData( | |||
| 493 | } | 493 | } | 
| 494 | 494 | ||
| 495 | loadsave(0); | 495 | loadsave(0); | 
| 496 | 496 | // sendS32(-1); | |
| 497 | // now the save is loaded, we can do what we want with the loaded blocks. | 497 | // now the save is loaded, we can do what we want with the loaded blocks. | 
| 498 | // first, we're going to want to decrypt the parts that are crypted, if applicable. | 498 | // first, we're going to want to decrypt the parts that are crypted, if applicable. | 
| 499 | decryptSaveStructures(gSaveBlock1,gSaveBlock2,gSaveBlock3); | 499 | decryptSaveStructures(gSaveBlock1,gSaveBlock2,gSaveBlock3); | 
| diff --git a/gba/source/main.c b/gba/source/main.c index 104866a..94d4c2b 100644 --- a/gba/source/main.c +++ b/gba/source/main.c | |||
| @@ -96,31 +96,53 @@ int main(void) | |||
| 96 | m3_fill(RGB15(31,31,31)); | 96 | m3_fill(RGB15(31,31,31)); | 
| 97 | plot_sqr( 4, 4, RGB15(31, 0, 0) ); // or CLR_RED | 97 | plot_sqr( 4, 4, RGB15(31, 0, 0) ); // or CLR_RED | 
| 98 | 98 | ||
| 99 | 99 | /* | |
| 100 | 100 | ||
| 101 | //*(vu16 *)(REG_BASE + 0x84) = 0x8f; | 101 | //*(vu16 *)(REG_BASE + 0x84) = 0x8f; | 
| 102 | //REG_IME = 1; | 102 | //REG_IME = 1; | 
| 103 | // the vblank interrupt must be enabled for VBlankIntrWait() to work | 103 | // the vblank interrupt must be enabled for VBlankIntrWait() to work | 
| 104 | // since the default dispatcher handles the bios flags no vblank handler | 104 | // since the default dispatcher handles the bios flags no vblank handler | 
| 105 | // is required | 105 | // is required | 
| 106 | //irqInit(); | 106 | irqInit(); | 
| 107 | //irqEnable(IRQ_VBLANK); | 107 | irqEnable(IRQ_VBLANK); | 
| 108 | 108 | ||
| 109 | //consoleDemoInit(); | 109 | consoleDemoInit(); | 
| 110 | //REG_JOYTR = 0; | 110 | //REG_JOYTR = 0; | 
| 111 | 111 | ||
| 112 | // ansi escape sequence to set print co-ordinates | 112 | // ansi escape sequence to set print co-ordinates | 
| 113 | // /x1b[line;columnH | 113 | // /x1b[line;columnH | 
| 114 | //u32 i; | 114 | //u32 i; | 
| 115 | //iprintf("\x1b[9;2HPokemon Gen III Data Extractor\n"); | 115 | iprintf("\x1b[9;2HPokemon Gen III Data Extractor\n"); | 
| 116 | //iprintf("\x1b[10;4HPlease look at the TV\n"); | 116 | iprintf("\x1b[10;4HPlease look at the TV\n"); | 
| 117 | 117 | ||
| 118 | // disable this, needs power | 118 | // disable this, needs power | 
| 119 | //SNDSTAT = 0; | 119 | SNDSTAT = 0; | 
| 120 | //SNDBIAS = 0; | 120 | SNDBIAS = 0; | 
| 121 | 121 | ||
| 122 | // Set up waitstates for EEPROM access etc. | 122 | // Set up waitstates for EEPROM access etc. | 
| 123 | //REG_WAITCNT = 0x0317; | 123 | REG_WAITCNT = 0x0317; | 
| 124 | |||
| 125 | s32 gamesize = getGameSize(); | ||
| 126 | u32 savesize = SaveSize(save_data,gamesize); | ||
| 127 | switch (savesize){ | ||
| 128 | case 0x200: | ||
| 129 | GetSave_EEPROM_512B(save_data); | ||
| 130 | break; | ||
| 131 | case 0x2000: | ||
| 132 | GetSave_EEPROM_8KB(save_data); | ||
| 133 | break; | ||
| 134 | case 0x8000: | ||
| 135 | GetSave_SRAM_32KB(save_data); | ||
| 136 | break; | ||
| 137 | case 0x10000: | ||
| 138 | GetSave_FLASH_64KB(save_data); | ||
| 139 | break; | ||
| 140 | case 0x20000: | ||
| 141 | GetSave_FLASH_128KB(save_data); | ||
| 142 | break; | ||
| 143 | default: | ||
| 144 | break; | ||
| 145 | }*/ | ||
| 124 | 146 | ||
| 125 | //clear out previous messages | 147 | //clear out previous messages | 
| 126 | REG_HS_CTRL |= JOY_RW; | 148 | REG_HS_CTRL |= JOY_RW; | 
| @@ -172,10 +194,12 @@ int main(void) | |||
| 172 | plot_sqr( 5, 4, RGB15( 31, 0,31) ); | 194 | plot_sqr( 5, 4, RGB15( 31, 0,31) ); | 
| 173 | waitForAck(); | 195 | waitForAck(); | 
| 174 | plot_sqr( 5, 5, RGB15( 16, 16,16) ); | 196 | plot_sqr( 5, 5, RGB15( 16, 16,16) ); | 
| 197 | |||
| 175 | // Get access to save data. | 198 | // Get access to save data. | 
| 176 | pSaveBlock1 SaveBlock1; | 199 | pSaveBlock1 SaveBlock1; | 
| 177 | pSaveBlock2 SaveBlock2; | 200 | pSaveBlock2 SaveBlock2; | 
| 178 | pSaveBlock3 SaveBlock3; | 201 | pSaveBlock3 SaveBlock3; | 
| 202 | //iprintf("gonna check thing\n"); | ||
| 179 | if (!initSaveData(&SaveBlock1, &SaveBlock2, &SaveBlock3)) | 203 | if (!initSaveData(&SaveBlock1, &SaveBlock2, &SaveBlock3)) | 
| 180 | { | 204 | { | 
| 181 | // Unsupported game version. | 205 | // Unsupported game version. | 
| @@ -187,12 +211,13 @@ int main(void) | |||
| 187 | 211 | ||
| 188 | continue; | 212 | continue; | 
| 189 | } | 213 | } | 
| 214 | //iprintf("success\n"); | ||
| 190 | plot_sqr( 5, 6, RGB15( 0, 31,16) ); | 215 | plot_sqr( 5, 6, RGB15( 0, 31,16) ); | 
| 191 | sendS32(1); | 216 | sendS32(1); | 
| 192 | waitForAck(); | 217 | waitForAck(); | 
| 193 | /* | 218 | |
| 194 | // Send trainer name. | 219 | // Send trainer name. | 
| 195 | u8* trainerName; | 220 | u8* trainerName = 0; | 
| 196 | 221 | ||
| 197 | if (GAME_RS) | 222 | if (GAME_RS) | 
| 198 | { | 223 | { | 
| @@ -204,14 +229,6 @@ int main(void) | |||
| 204 | { | 229 | { | 
| 205 | trainerName = SaveBlock2->e.playerName; | 230 | trainerName = SaveBlock2->e.playerName; | 
| 206 | } | 231 | } | 
| 207 | iprintf("%d\n", trainerName[0]); | ||
| 208 | iprintf("%d\n", trainerName[1]); | ||
| 209 | iprintf("%d\n", trainerName[2]); | ||
| 210 | iprintf("%d\n", trainerName[3]); | ||
| 211 | iprintf("%d\n", trainerName[4]); | ||
| 212 | iprintf("%d\n", trainerName[5]); | ||
| 213 | iprintf("%d\n", trainerName[6]); | ||
| 214 | iprintf("%d\n", trainerName[7]); | ||
| 215 | 232 | ||
| 216 | u32 tn1 = | 233 | u32 tn1 = | 
| 217 | (trainerName[0] << 24) | 234 | (trainerName[0] << 24) | 
| @@ -230,10 +247,10 @@ int main(void) | |||
| 230 | 247 | ||
| 231 | sendU32(tn2); | 248 | sendU32(tn2); | 
| 232 | waitForAck(); | 249 | waitForAck(); | 
| 233 | */ | 250 | |
| 234 | // Send trainer ID. | 251 | // Send trainer ID. | 
| 252 | |||
| 235 | u8* trainerId = 0; | 253 | u8* trainerId = 0; | 
| 236 | |||
| 237 | if (GAME_RS) | 254 | if (GAME_RS) | 
| 238 | { | 255 | { | 
| 239 | trainerId = SaveBlock2->rs.playerTrainerId; | 256 | trainerId = SaveBlock2->rs.playerTrainerId; | 
| @@ -246,9 +263,10 @@ int main(void) | |||
| 246 | } | 263 | } | 
| 247 | 264 | ||
| 248 | u32 tti = | 265 | u32 tti = | 
| 249 | (trainerId[2] << 8) | 266 | (trainerId[1] << 8) | 
| 250 | | (trainerId[3]); | 267 | | (trainerId[0]); | 
| 251 | 268 | ||
| 269 | //iprintf("sending trainer id %ld\n", tti); | ||
| 252 | sendU32(tti); | 270 | sendU32(tti); | 
| 253 | waitForAck(); | 271 | waitForAck(); | 
| 254 | 272 | ||
