Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Tiny Chao Garden Save Fixer
- By atm959
- */
- #include <nds.h>
- #include <stdio.h>
- char fixedValue; //The GBA header's fixed value is loaded to here
- char gameTitle[13]; //The GBA header's game title is loaded to here
- int pressed; //The joypad state is loaded to here
- int i; //Used for FOR loops
- int main(void) {
- defaultExceptionHandler(); //Setup the default exception handler
- consoleDemoInit(); //Init the text console
- //Name and instructions
- iprintf("Tiny Chao Garden Save Fixer\nBy atm959\n\n");
- iprintf("Insert Sonic Advance into Slot 2 and press A\n\n");
- //Wait for A button press
- while(1) {
- scanKeys();
- pressed = keysDown();
- if(pressed & KEY_A) break;
- swiWaitForVBlank();
- }
- fixedValue = *((u8 *)0x80000B2); //Load the fixed value
- //Load the title
- for(i = 0; i < 12; i++){
- gameTitle[i] = *((u8 *)0x80000A0 + i);
- }
- gameTitle[12] = '\0'; //Set the last character to the escape character
- iprintf("Game Title: %s\n\n", gameTitle); //Print the game title
- //Check if Sonic Advance is inserted
- if((fixedValue != 0x96) || (strncmp(gameTitle, "SONICADVANCE", 12) != 0)){
- consoleClear();
- iprintf("Game Title: %s\n\n", gameTitle);
- iprintf("Either a GBA game is not\n inserted, or the inserted GBA\n game is not Sonic Advance!\n\n");
- iprintf("Insert Sonic Advance into Slot 2 and press A\n\n");
- //Loop until Sonic Advance is inserted
- while((fixedValue != 0x96) || (strncmp(gameTitle, "SONICADVANCE", 12) != 0)){
- scanKeys();
- pressed = keysDown();
- if(pressed & KEY_A){
- fixedValue = *((u8 *)0x80000B2); //Load the fixed value
- //Load the title
- for(i = 0; i < 12; i++){
- gameTitle[i] = *((u8 *)0x80000A0 + i);
- }
- gameTitle[12] = '\0'; //Set the last character to the escape character
- //Check if Sonic Advance is inserted
- if((fixedValue != 0x96) || (strncmp(gameTitle, "SONICADVANCE", 12) != 0)){
- consoleClear();
- iprintf("Game Title: %s\n\n", gameTitle);
- iprintf("Either a GBA game is not\n inserted, or the inserted GBA\n game is not Sonic Advance!\n\n");
- iprintf("Insert Sonic Advance into Slot 2 and press A\n\n");
- }
- }
- swiWaitForVBlank();
- }
- }
- consoleClear();
- //Actual writes to the SRAM go here
- iprintf("Done!");
- //Loop until the DS is turned off
- while(1){
- swiWaitForVBlank();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement