Skip to content

Commit

Permalink
Add SupportedGames enum for better readability.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrhappyasthma committed Dec 1, 2019
1 parent b31cf22 commit 7f98c8e
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 161 deletions.
27 changes: 14 additions & 13 deletions arm9/source/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "hardware.h"
#include "languages.h"
#include "strings.h"
#include "supported_games.h"

// some more recent versions no longer define this macro...
#ifndef MAXPATHLEN
Expand Down Expand Up @@ -378,7 +379,7 @@ void displayPrintTicketError(int error) {
sleep(5);
}

void displayPrintTickets(int cursor_position, int game, Language language) {
void displayPrintTickets(int cursor_position, SupportedGames games, Language language) {
consoleSelect(&lowerScreen);
consoleSetWindow(&lowerScreen, 0, 0, 32, 24);
consoleClear();
Expand All @@ -387,48 +388,48 @@ void displayPrintTickets(int cursor_position, int game, Language language) {

switch (language) {
case JAPANESE:
switch (game) {
case 0:
switch (games) {
case RUBY_AND_SAPPHIRE:
iprintf(" Eon Ticket\n");
break;
case 1:
case EMERALD:
iprintf(" Eon Ticket\n");
iprintf(" Mystic Ticket 2005\n");
iprintf(" Old Sea Map\n");
break;
case 2:
case FIRE_RED_AND_LEAF_GREEN:
iprintf(" Aurora Ticket 2004\n");
iprintf(" Mystic Ticket 2005\n");
break;
}
break;
case ENGLISH:
switch (game) {
case 0:
switch (games) {
case RUBY_AND_SAPPHIRE:
iprintf(" Eon Ticket (e-card)\n");
iprintf(" Eon Ticket (nintendo Italy)\n");
break;
case 1:
case EMERALD:
iprintf(" Aurora Ticket\n");
iprintf(" Mystic Ticket\n");
iprintf(" Old Sea Map (unofficial)\n");
break;
case 2:
case FIRE_RED_AND_LEAF_GREEN:
iprintf(" Aurora Ticket\n");
iprintf(" Mystic Ticket\n");
break;
}
break;
default:
switch (game) {
case 0:
switch (games) {
case RUBY_AND_SAPPHIRE:
iprintf(" Eon Ticket\n");
break;
case 1:
case EMERALD:
iprintf(" Aurora Ticket\n");
iprintf(" Mystic Ticket (USA)\n");
break;
case 2:
case FIRE_RED_AND_LEAF_GREEN:
iprintf(" Aurora Ticket\n");
iprintf(" Mystic Ticket (USA)\n");
break;
Expand Down
3 changes: 2 additions & 1 deletion arm9/source/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <nds/arm9/console.h>
#include <stdarg.h>

#include "supported_games.h"
#include "languages.h"

extern PrintConsole upperScreen;
Expand All @@ -44,7 +45,7 @@ void displayTitle();
void displayPrintUpper(bool fc = false);
void displayPrintLower(int cursor_position);
void displayPrintTicketError(int error);
void displayPrintTickets(int cursor_position, int game, Language language);
void displayPrintTickets(int cursor_position, SupportedGames games, Language language);
void displayChangeCart(int mode);
void displayLoadingCart();

Expand Down
7 changes: 4 additions & 3 deletions arm9/source/hardware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include "languages.h"
#include "poke.h"
#include "strings.h"
#include "supported_games.h"

using namespace std;

Expand Down Expand Up @@ -986,7 +987,7 @@ void hwRestoreFTP(bool dlp) {
}

// ------------------------------------------------------------
void GBA_read_inject_restore(u8 type, char *ticket, int game, Language language) {
void GBA_read_inject_restore(u8 type, char *ticket, SupportedGames games, Language language) {
// Read savedata
if ((type == 0) || (type > 5)) return;

Expand All @@ -1005,9 +1006,9 @@ void GBA_read_inject_restore(u8 type, char *ticket, int game, Language language)
// Inject selected ticket
int ret = 0;
if (ticket[4] == 0x33 || ticket == NULL) // Mistery Event
ret = me_inject((char *)data, ticket, game, language);
ret = me_inject((char *)data, ticket, games, language);
else
ret = wc_inject((char *)data, ticket, game, language);
ret = wc_inject((char *)data, ticket, games, language);

if (ret != 1) {
displayPrintTicketError(ret);
Expand Down
3 changes: 2 additions & 1 deletion arm9/source/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <sys/unistd.h>

#include "languages.h"
#include "supported_games.h"

#define RS_BACKUP 0x4b434142

Expand Down Expand Up @@ -74,7 +75,7 @@ void hwRestoreDSi();
void hwBackupFTP(bool dlp = false);
void hwRestoreFTP(bool dlp = false);

void GBA_read_inject_restore(u8 type, char* ticket, int game, Language language);
void GBA_read_inject_restore(u8 type, char* ticket, SupportedGames games, Language language);
void hwBackupGBA(u8 type);
void hwRestoreGBA();
void hwEraseGBA();
Expand Down
Loading

0 comments on commit 7f98c8e

Please sign in to comment.