diff --git a/source/MainApplicationState.cpp b/source/MainApplicationState.cpp index 63685b7..1504e98 100644 --- a/source/MainApplicationState.cpp +++ b/source/MainApplicationState.cpp @@ -64,6 +64,11 @@ ApplicationState::eSubState MainApplicationState::update(Input *input) { } this->selectedOptionY = 0; } + if (input->data.buttons_d & Input::BUTTON_HOME) { + if (RunningFromMiiMaker()) { + return SUBSTATE_RETURN; + } + } } else if (this->state == STATE_DO_SUBSTATE) { auto retSubState = this->subState->update(input); diff --git a/source/UpdaterCheckEnvironment.cpp b/source/UpdaterCheckEnvironment.cpp index 88dd793..76fb5c3 100644 --- a/source/UpdaterCheckEnvironment.cpp +++ b/source/UpdaterCheckEnvironment.cpp @@ -23,8 +23,9 @@ ApplicationState::eSubState UpdaterState::UpdateCheckEnvironmentDirectory(Input } if (this->mCurEnvironmentPath == DEFAULT_TIRAMISU_ENVIRONMENT_SD_PATH) { - mCurEnvironmentPath = DEFAULT_AROMA_ENVIRONMENT_SD_PATH; - this->mState = STATE_CHECK_VERSIONS; + gDeleteDefaultEnvironmentOnSuccess = true; + mCurEnvironmentPath = DEFAULT_AROMA_ENVIRONMENT_SD_PATH; + this->mState = STATE_CHECK_VERSIONS; return SUBSTATE_RUNNING; } diff --git a/source/common.h b/source/common.h index 7d03afb..1fa7b75 100644 --- a/source/common.h +++ b/source/common.h @@ -1,5 +1,7 @@ #pragma once +#include + #define BACKGROUND_COLOR COLOR_BLACK #define AROMA_DOWNLOAD_URL "https://aroma.foryour.cafe/" @@ -14,3 +16,9 @@ #define UPDATER_VERSION "v0.2.3" #define UPDATER_VERSION_FULL UPDATER_VERSION UPDATER_VERSION_EXTRA + +inline bool RunningFromMiiMaker() { + return (OSGetTitleID() & 0xFFFFFFFFFFFFF0FFull) == 0x000500101004A000ull; +} + +extern bool gDeleteDefaultEnvironmentOnSuccess; \ No newline at end of file diff --git a/source/main.cpp b/source/main.cpp index a3fc5d2..f731956 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include void main_loop() { @@ -34,12 +35,23 @@ void main_loop() { baseInput.combine(wpadInput); } } + baseInput.process(); - state->update(&baseInput); + if (state->update(&baseInput) == ApplicationState::SUBSTATE_RETURN) { + if (RunningFromMiiMaker()) { + // legacy way, just quit + break; + } else { + // launch menu otherwise + SYSLaunchMenu(); + } + } state->render(); } } +bool gDeleteDefaultEnvironmentOnSuccess = false; + int main() { initLogging(); @@ -78,6 +90,9 @@ int main() { IMDisableAPD(); } + if (RunningFromMiiMaker()) { + OSEnableHomeButtonMenu(false); + } main_loop(); if (isAPDEnabled) { @@ -96,6 +111,9 @@ int main() { DrawUtils::DeInit(); AXQuit(); + + WHBProcShutdown(); + deinitLogging();