Skip to content

Commit

Permalink
Adapt code to follow project style
Browse files Browse the repository at this point in the history
  • Loading branch information
Nightkingale committed May 18, 2024
1 parent 4891c35 commit d66e201
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
18 changes: 11 additions & 7 deletions include/start_screen.hpp
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
8 changes: 4 additions & 4 deletions source/backup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;


Expand Down
34 changes: 15 additions & 19 deletions source/start_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
}
Expand All @@ -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;
Expand All @@ -83,7 +83,7 @@ unlink_account_action()
}
else if (button & VPAD_BUTTON_B)
{
CurrentScreen = Start;
current_screen = START_SCREEN;
return true;
}
return false;
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
}

0 comments on commit d66e201

Please sign in to comment.