Restart the console on success instead of doing a shutdown

This commit is contained in:
Maschell 2023-01-17 16:04:44 +01:00
parent 7e84b9fa95
commit 91f91852f7
3 changed files with 7 additions and 8 deletions

View File

@ -11,7 +11,7 @@ public:
enum eSubState {
SUBSTATE_RUNNING,
SUBSTATE_RETURN,
SUBSTATE_SHUTDOWN,
SUBSTATE_RESTART,
};
virtual ~ApplicationState() = default;

View File

@ -51,7 +51,6 @@ void MainApplicationState::render() {
printFooter();
}
DrawUtils::endDraw();
}
@ -74,7 +73,7 @@ ApplicationState::eSubState MainApplicationState::update(Input *input) {
} else if (retSubState == SUBSTATE_RETURN) {
this->subState.reset();
this->state = STATE_WELCOME_SCREEN;
} else if (retSubState == SUBSTATE_SHUTDOWN) {
} else if (retSubState == SUBSTATE_RESTART) {
this->subState.reset();
this->state = STATE_SHUTDOWN;
}

View File

@ -30,7 +30,7 @@ void UpdaterState::setError(UpdaterState::eErrorState err) {
this->mErrorState = err;
}
extern "C" void OSShutdown();
extern "C" void OSLaunchTitlel(uint32_t, uint32_t, int, void *);
ApplicationState::eSubState UpdaterState::update(Input *input) {
switch (this->mState) {
@ -150,8 +150,8 @@ ApplicationState::eSubState UpdaterState::update(Input *input) {
}
case STATE_UPDATE_SUCCESS: {
if (buttonPressed(input, Input::BUTTON_A)) {
OSShutdown();
return SUBSTATE_SHUTDOWN;
OSLaunchTitlel(0xffffffff, 0xfffffffe, 0, nullptr);
return SUBSTATE_RESTART;
}
break;
}
@ -253,9 +253,9 @@ void UpdaterState::render() {
case STATE_UPDATE_SUCCESS: {
DrawUtils::setFontSize(20);
DrawUtils::print(16, 80, "All files have been updated successfully.");
DrawUtils::print(16, 100, "The console will now shutdown.");
DrawUtils::print(16, 100, "The console will now restart.");
DrawUtils::setFontSize(18);
DrawUtils::print(SCREEN_WIDTH - 16, SCREEN_HEIGHT - 14, "\ue000 Shutdown", true);
DrawUtils::print(SCREEN_WIDTH - 16, SCREEN_HEIGHT - 14, "\ue000 Restart", true);
break;
}
}