diff --git a/trunk/ConsoleDataMigration/ConsoleRestore/ConsoleRestore.cpp b/trunk/ConsoleDataMigration/ConsoleRestore/ConsoleRestore.cpp index b05ca65..ca6227f 100644 --- a/trunk/ConsoleDataMigration/ConsoleRestore/ConsoleRestore.cpp +++ b/trunk/ConsoleDataMigration/ConsoleRestore/ConsoleRestore.cpp @@ -304,6 +304,8 @@ extern "C" void nnMain(void) for(;;) { bool nextStep = false; + bool specialKey = false; + s_PadReader.ReadLatest(&padStatus); // AまたはSTARTボタンで進行 @@ -342,6 +344,13 @@ extern "C" void nnMain(void) common::Logger::GetLoggerInstance()->ScrollToEnd(); } + // 特殊入力 + if(padStatus.hold & nn::hid::BUTTON_R && + padStatus.hold & nn::hid::BUTTON_L && + padStatus.hold & nn::hid::BUTTON_B) + { + specialKey = true; + } // 情報更新 // バッテリ @@ -361,7 +370,7 @@ extern "C" void nnMain(void) // 進捗確認メッセージを兼ねる? ::std::vector operationMessage; - ControlState(operationMessage, nextStep, continueRestore); + ControlState(operationMessage, nextStep, continueRestore, specialKey); nn::util::FloatColor titleColor; diff --git a/trunk/ConsoleDataMigration/ConsoleRestore/Controller.cpp b/trunk/ConsoleDataMigration/ConsoleRestore/Controller.cpp index 2a8acae..1965f23 100644 --- a/trunk/ConsoleDataMigration/ConsoleRestore/Controller.cpp +++ b/trunk/ConsoleDataMigration/ConsoleRestore/Controller.cpp @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include "Controller.h" #include "FileChecker.h" @@ -52,6 +54,7 @@ typedef enum RestoreState TIME_ADJUST, // 時計あわせを行う WAIT_SD_EJECT, // SDカードぬき待ち ALL_DONE, // すべて完了 + SHUTDOWN, // シャットダウン中 FAIL // 失敗 } RestoreState; @@ -161,7 +164,7 @@ void ExecSyncMcuRtc() } } -void ControlState(::std::vector& operationMessage, bool& nextStep, bool& continueRestore) +void ControlState(::std::vector& operationMessage, bool& nextStep, bool& continueRestore, bool specialKey) { using namespace common; @@ -313,7 +316,12 @@ void ControlState(::std::vector& operationMessage, bool& nextStep, } } - if (nextStep && !error) + if(specialKey) + { + s_RestoreState = SHUTDOWN; + } + + if (nextStep && !error && !specialKey) { if (needsUpdate) { @@ -353,7 +361,12 @@ void ControlState(::std::vector& operationMessage, bool& nextStep, PlaySound(SOUND_ANNOTATION); } - if (nextStep) + if(specialKey) + { + s_RestoreState = SHUTDOWN; + } + + if (nextStep && !specialKey) { s_RestoreState = RESTORE_TWL_SOUND; } @@ -682,6 +695,15 @@ void ControlState(::std::vector& operationMessage, bool& nextStep, } break; + case SHUTDOWN: + { + // 本体初期化を行う + InitializeFileSystem(); + + // シャットダウンする + nn::ptm::CTR::ShutdownAsync(0, nn::fnd::TimeSpan::FromSeconds(0)); + } + } } diff --git a/trunk/ConsoleDataMigration/ConsoleRestore/Controller.h b/trunk/ConsoleDataMigration/ConsoleRestore/Controller.h index 281b31a..e4f37e0 100644 --- a/trunk/ConsoleDataMigration/ConsoleRestore/Controller.h +++ b/trunk/ConsoleDataMigration/ConsoleRestore/Controller.h @@ -25,7 +25,7 @@ namespace ConsoleRestore const u32 RETRY_MAX = 3; -void ControlState(::std::vector& operationMessage, bool& nextStep, bool& continueRestore); +void ControlState(::std::vector& operationMessage, bool& nextStep, bool& continueRestore, bool specialKey); bool InProgress(); bool IsRestoreSucceeded(); bool IsRestoreFailed();