Fix exiting HOME Menu behavior

This commit is contained in:
Nightkingale 2024-04-13 08:37:23 -06:00
parent b4174dea8f
commit 0e4878be78
4 changed files with 18 additions and 4 deletions

View File

@ -57,6 +57,9 @@ void writeBackup(FILE* account, const std::string& backupPath, char* buffer) {
}
void backupAccount() {
// Disable the HOME Button temporarily.
OSEnableHomeButtonMenu(0);
// Inform the user that the backup process has started.
WHBLogConsoleSetColor(0x00009900);
WHBLogPrintf("Backup: A Network ID backup will be created.");
WHBLogPrint("---------------------------------------------------------");
@ -119,13 +122,12 @@ void backupAccount() {
WHBLogConsoleDraw();
std::ifstream ifile(backupPath);
if (ifile) {
printOverwriteMenu(backupPath.c_str());
VPADStatus input;
VPADReadError error;
backupConfirm = false;
while (WHBProcIsRunning()) {
printOverwriteMenu(backupPath.c_str());
VPADRead(VPAD_CHAN_0, &input, 1, &error);
if (input.trigger == VPAD_BUTTON_A) {
backupConfirm = true;
@ -152,6 +154,8 @@ void backupAccount() {
if (backupConfirm) {
OSSleepTicks(OSMillisecondsToTicks(5000));
}
// Re-enable the HOME Button.
OSEnableHomeButtonMenu(1);
// Print the main menu to the screen.
printMainMenu();
}

View File

@ -81,6 +81,7 @@ int main() {
// Print the main menu to the screen.
printMainMenu();
while (WHBProcIsRunning()) {
printMainMenu();
// Watch the Wii U GamePad for button presses.
VPADRead(VPAD_CHAN_0, &input, 1, &error);
// If the A button is pressed, switch to the Nintendo Network ID account.dat.
@ -93,8 +94,8 @@ int main() {
}
// If the + button is pressed, backup the current account.dat.
else if (input.trigger & VPAD_BUTTON_PLUS) {
printBackupMenu();
while (WHBProcIsRunning()) {
printBackupMenu();
VPADRead(VPAD_CHAN_0, &input, 1, &error);
if (input.trigger & VPAD_BUTTON_A) {
backupAccount();
@ -108,8 +109,8 @@ int main() {
}
// If the X button is pressed, unlink the account locally.
else if (input.trigger & VPAD_BUTTON_MINUS) {
printUnlinkMenu();
while (WHBProcIsRunning()) {
printUnlinkMenu();
VPADRead(VPAD_CHAN_0, &input, 1, &error);
if (input.trigger & VPAD_BUTTON_A) {
unlinkAccount();

View File

@ -16,6 +16,9 @@
void switchAccount(const char* backupFile, const char* accountType) {
// Disable the HOME Button temporarily.
OSEnableHomeButtonMenu(0);
// Print the account type and the switch message.
WHBLogConsoleSetColor(0x00009900);
WHBLogPrintf("Switch: You will be swapped to a %s.", accountType);
WHBLogPrint("---------------------------------------------------------");
@ -93,6 +96,8 @@ void switchAccount(const char* backupFile, const char* accountType) {
free(buffer);
fclose(backup);
OSSleepTicks(OSMillisecondsToTicks(5000));
// Re-enable the HOME Button.
OSEnableHomeButtonMenu(1);
// Soft reset the console.
OSForceFullRelaunch();
SYSLaunchMenu();

View File

@ -58,6 +58,8 @@ void unlinkAccount() {
{"MiiImageLastModifiedDate", "Sat, 01 Jan 2000 00:00:00 GMT"},
{"IsCommitted", "1"}
};
// Disable the HOME Button temporarily.
OSEnableHomeButtonMenu(0);
// Inform the user that the unlink process has started.
WHBLogConsoleSetColor(0x00009900);
WHBLogPrintf("Unlinking: Default settings will be applied.");
@ -99,6 +101,8 @@ void unlinkAccount() {
WHBLogPrint("---------------------------------------------------------");
// Wait 5 seconds, then soft reboot the console.
OSSleepTicks(OSMillisecondsToTicks(5000));
// Re-enable the HOME Button.
OSEnableHomeButtonMenu(1);
OSForceFullRelaunch();
SYSLaunchMenu();
deinitialize();