mirror of
https://github.com/suloku/savegame-manager.git
synced 2026-09-07 10:45:36 -05:00
Support switching cartridges.
This commit is contained in:
@@ -330,15 +330,18 @@ void displayPrintUpper(bool fc)
|
||||
iprintf(name);
|
||||
}
|
||||
|
||||
void displayChangeCart()
|
||||
void displayChangeCart(int mode)
|
||||
{
|
||||
consoleSelect(&lowerScreen);
|
||||
consoleSetWindow(&lowerScreen, 0, 0, 32, 24);
|
||||
consoleClear();
|
||||
|
||||
iprintf("\n\n");
|
||||
iprintf("Inserted cartridge is not valid.\n\n");
|
||||
iprintf("Please insert one of these:\n");
|
||||
if (mode)
|
||||
printf("Inserted cartridge is not valid!\n\n");
|
||||
else
|
||||
printf("\n\n");
|
||||
iprintf("Please insert one of these and\npress START:\n\n");
|
||||
iprintf(" - Pokemon Rubi\n");
|
||||
iprintf(" - Pokemon Saphire\n");
|
||||
iprintf(" - Pokemon Emerald\n");
|
||||
@@ -346,6 +349,14 @@ void displayChangeCart()
|
||||
iprintf(" - Pokemon LeafGreen\n");
|
||||
}
|
||||
|
||||
void displayLoadingCart()
|
||||
{
|
||||
consoleSelect(&lowerScreen);
|
||||
consoleSetWindow(&lowerScreen, 0, 0, 32, 24);
|
||||
consoleClear();
|
||||
printf("Loading cartridge....");
|
||||
}
|
||||
|
||||
void sleep(int seconds)
|
||||
{
|
||||
time_t calltime = time(NULL);
|
||||
@@ -441,6 +452,7 @@ void displayPrintTickets( int cursor_position, int game, int language )
|
||||
}
|
||||
break;
|
||||
}
|
||||
printf("\n\nPress START to change cartridge");
|
||||
//Print cursor
|
||||
consoleSetWindow(&lowerScreen, 0, 0, 32, 24);
|
||||
iprintf("\n\n");
|
||||
@@ -448,6 +460,8 @@ void displayPrintTickets( int cursor_position, int game, int language )
|
||||
for (i=0; i<cursor_position;i++)
|
||||
{iprintf("\n");}
|
||||
iprintf("-->");
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,8 @@ void displayPrintUpper(bool fc = false);
|
||||
void displayPrintLower(int cursor_position);
|
||||
void displayPrintTicketError( int error );
|
||||
void displayPrintTickets( int cursor_position, int game, int language );
|
||||
void displayChangeCart();
|
||||
void displayChangeCart(int mode);
|
||||
void displayLoadingCart();
|
||||
|
||||
void displayMessageF(int id, ...);
|
||||
void displayMessage2F(int id, ...);
|
||||
|
||||
@@ -225,12 +225,16 @@ void mode_gba()
|
||||
{
|
||||
// This function takes some time, since it needs to parse the entire GBA module
|
||||
// for a magic string. It is only called when truly necessary. (i.e. once for now)
|
||||
|
||||
reload_cart:
|
||||
|
||||
u8 gbatype = gbaGetSaveType();
|
||||
|
||||
// use 3in1 to buffer data
|
||||
displayStateF(STR_EMPTY);
|
||||
gbatype = gbaGetSaveType();
|
||||
displayPrintUpper(true);
|
||||
displayLoadingCart();
|
||||
|
||||
//Get game/language from GAME ID
|
||||
int language = 0;
|
||||
@@ -349,6 +353,22 @@ void mode_gba()
|
||||
if (cursor_position < 0) { cursor_position = maxoptions; }
|
||||
if (cursor_position > maxoptions) { cursor_position = 0; }
|
||||
|
||||
if (keys & KEY_START)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
swiWaitForVBlank();
|
||||
displayChangeCart(0);
|
||||
scanKeys();
|
||||
uint32 keys = keysDown();
|
||||
if (keys & KEY_START)
|
||||
{
|
||||
displayLoadingCart();
|
||||
goto reload_cart;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (keys & KEY_A) {
|
||||
displayPrintUpper();
|
||||
|
||||
@@ -492,7 +512,18 @@ void mode_gba()
|
||||
}
|
||||
else
|
||||
{
|
||||
displayChangeCart();
|
||||
while(1)
|
||||
{
|
||||
swiWaitForVBlank();
|
||||
displayChangeCart(1);
|
||||
scanKeys();
|
||||
uint32 keys = keysDown();
|
||||
if (keys & KEY_START)
|
||||
{
|
||||
displayLoadingCart();
|
||||
goto reload_cart;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -755,7 +786,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
// Init the screens
|
||||
displayTitle();
|
||||
|
||||
mode = 1;
|
||||
mode_gba();
|
||||
/*
|
||||
// okay, we got our HW identified; now branch to the corresponding main function/event handler
|
||||
|
||||
Reference in New Issue
Block a user