Adapt code to follow project style

This commit is contained in:
Nightkingale 2024-05-17 20:42:51 -06:00
parent 4891c35a68
commit d66e201d3a
3 changed files with 30 additions and 30 deletions

View File

@ -1,15 +1,19 @@
#ifndef START_SCREEN_HPP
#define START_SCREEN_HPP
enum Screens
enum screens
{
Start,
Unlink,
Backup,
Swap,
Overwrite
START_SCREEN,
UNLINK_SCREEN,
BACKUP_SCREEN,
SWAP_SCREEN,
OVERWRITE_SCREEN
};
extern Screens CurrentScreen;
extern screens current_screen;
void draw_start_screen(int selected_menu_item);
void process_start_screen();

View File

@ -129,7 +129,7 @@ backup_account()
// Check if the backup file exists.
std::ifstream ifile(backup_path);
CurrentScreen = Overwrite;
current_screen = OVERWRITE_SCREEN;
if (ifile) {
backup_confirm = false;
@ -152,20 +152,20 @@ backup_account()
backup_confirm = true;
}
CurrentScreen = Backup;
current_screen = BACKUP_SCREEN;
// Write the backup file.
if (backup_confirm) {
if (write_backup(account, backup_path, buffer))
{
handle_cleanup(account, NULL, buffer, false);
CurrentScreen = Start;
current_screen = START_SCREEN;
}
return true;
}
handle_cleanup(account, NULL, buffer, !backup_confirm);
CurrentScreen = Start;
current_screen = START_SCREEN;
return true;

View File

@ -30,7 +30,7 @@
int selected_option = 0;
const int NUM_OPTIONS = 4;
Screens CurrentScreen = Start;
screens current_screen = START_SCREEN;
bool
swap_account_action(const char* account_backup, const char* account_type)
@ -41,7 +41,7 @@ swap_account_action(const char* account_backup, const char* account_type)
return true;
}
CurrentScreen = Start;
current_screen = START_SCREEN;
return false;
}
@ -56,11 +56,11 @@ backup_account_action()
if (button & VPAD_BUTTON_A) {
backup_account();
CurrentScreen = Start;
current_screen = START_SCREEN;
return true;
} else if (button & VPAD_BUTTON_B)
{
CurrentScreen = Start;
current_screen = START_SCREEN;
return true;
}
return false;
@ -83,7 +83,7 @@ unlink_account_action()
}
else if (button & VPAD_BUTTON_B)
{
CurrentScreen = Start;
current_screen = START_SCREEN;
return true;
}
return false;
@ -154,19 +154,19 @@ process_start_screen()
} else if (button & VPAD_BUTTON_A) {
switch (selected_option) {
case 0:
CurrentScreen = Swap;
current_screen = SWAP_SCREEN;
//swap_account_action(NNID_BACKUP.c_str(), "Nintendo");
break;
case 1:
CurrentScreen = Swap;
current_screen = SWAP_SCREEN;
//swap_account_action(PNID_BACKUP.c_str(), "Pretendo");
break;
case 2:
CurrentScreen = Backup;
current_screen = BACKUP_SCREEN;
//backup_account_action();
break;
case 3:
CurrentScreen = Unlink;
current_screen = UNLINK_SCREEN;
//unlink_account_action();
break;
}
@ -177,28 +177,24 @@ process_start_screen()
void process_screens()
{
switch(CurrentScreen)
switch(current_screen)
{
case Start:
case START_SCREEN:
process_start_screen();
break;
case Unlink:
case UNLINK_SCREEN:
unlink_account_action();
break;
case Swap:
case SWAP_SCREEN:
if(selected_option == 0)
{
swap_account_action(NNID_BACKUP.c_str(), "Nintendo");
}
else
{
swap_account_action(PNID_BACKUP.c_str(), "Pretendo");
}
break;
case Backup:
case BACKUP_SCREEN:
backup_account_action();
break;
case Overwrite:
case OVERWRITE_SCREEN:
break;
}
}