From 834f59c0926fff4aa1d4a1766848d509693212f7 Mon Sep 17 00:00:00 2001 From: N2614 Date: Wed, 16 Feb 2011 10:03:38 +0000 Subject: [PATCH] =?UTF-8?q?NUP=E5=B0=82=E7=94=A8=E3=83=A2=E3=83=BC?= =?UTF-8?q?=E3=83=89=E3=81=AE=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@63 385bec56-5757-e545-9c3a-d8741f4650f1 --- .../ConsoleRestore/ConsoleRestore.cpp | 11 +--- .../ConsoleRestore/Controller.cpp | 66 ++++++++++++++----- .../ConsoleRestore/Controller.h | 2 +- .../ConsoleRestore/Importer.cpp | 17 ++++- .../ConsoleRestore/Importer.h | 2 +- 5 files changed, 68 insertions(+), 30 deletions(-) diff --git a/trunk/ConsoleDataMigration/ConsoleRestore/ConsoleRestore.cpp b/trunk/ConsoleDataMigration/ConsoleRestore/ConsoleRestore.cpp index ca6227f..6ce5bee 100644 --- a/trunk/ConsoleDataMigration/ConsoleRestore/ConsoleRestore.cpp +++ b/trunk/ConsoleDataMigration/ConsoleRestore/ConsoleRestore.cpp @@ -304,7 +304,6 @@ extern "C" void nnMain(void) for(;;) { bool nextStep = false; - bool specialKey = false; s_PadReader.ReadLatest(&padStatus); @@ -344,14 +343,6 @@ 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; - } - // 情報更新 // バッテリ mcu.GetBatteryRemain(&batteryRemain); @@ -370,7 +361,7 @@ extern "C" void nnMain(void) // 進捗確認メッセージを兼ねる? ::std::vector operationMessage; - ControlState(operationMessage, nextStep, continueRestore, specialKey); + ControlState(operationMessage, nextStep, continueRestore); nn::util::FloatColor titleColor; diff --git a/trunk/ConsoleDataMigration/ConsoleRestore/Controller.cpp b/trunk/ConsoleDataMigration/ConsoleRestore/Controller.cpp index 12d4fa4..a2f92b7 100644 --- a/trunk/ConsoleDataMigration/ConsoleRestore/Controller.cpp +++ b/trunk/ConsoleDataMigration/ConsoleRestore/Controller.cpp @@ -43,6 +43,8 @@ typedef enum RestoreState SERIAL_IN_SD, // シリアルナンバーの情報を表示 UPDATE_IN_PROGRESS, // アップデート中 UPDATE_DONE, // アップデート完了 + NUP_ONLY_WAIT_SD_EJECT, // NUP_ONLYモードでSDカード抜き待ち + NUP_ONLY_WAIT_NEXT, // NUP_ONLYモードでキー入力待ち RESTORE_TWL_SOUND, // TWLサウンドの書き込み中 RESTORE_TWL_PHOTO, // TWL写真の書き込み中 RESTORE_IN_PROGRESS, // 書き込み中 @@ -66,6 +68,8 @@ RestoreState s_RestoreState = STARTUP; bool s_ReadSettingDone = false; // インターネット設定を読んだ結果 bool s_ReadSettingSuccess = false; +// NUP専用モードかどうか +bool s_NupOnlyMode = false; // APSettingの書式が無い警告サウンドを鳴らしたかどうか bool s_ExistAPSettingAnnotation = false; @@ -114,7 +118,7 @@ bool CheckAndReadAPSetting(::std::vector& operationMessage) if (!s_ReadSettingDone) { s_ReadSettingDone = true; - s_ReadSettingSuccess = ReadSetting(); + s_ReadSettingSuccess = ReadSetting(&s_NupOnlyMode); } if (!s_ReadSettingSuccess) @@ -164,7 +168,7 @@ void ExecSyncMcuRtc() } } -void ControlState(::std::vector& operationMessage, bool& nextStep, bool& continueRestore, bool specialKey) +void ControlState(::std::vector& operationMessage, bool& nextStep, bool& continueRestore) { using namespace common; @@ -184,6 +188,17 @@ void ControlState(::std::vector& operationMessage, bool& nextStep, // SDカードにアップデート完了ファイルがあるか? if (ExistsUpdateCheckedFile()) { + CheckAndReadAPSetting(operationMessage); + if (s_NupOnlyMode) + { + s_RestoreState = NUP_ONLY_WAIT_SD_EJECT; + + // リストア状態チェックファイルをすべて削除 + DeleteAllCheckFiles(); + + break; + } + // SDカードに書き込み完了ファイルがあるか? if (!ExistsWriteFinishedFile()) { @@ -318,12 +333,7 @@ void ControlState(::std::vector& operationMessage, bool& nextStep, } } - if(specialKey) - { - s_RestoreState = SHUTDOWN; - } - - if (nextStep && !error && !specialKey) + if (nextStep && !error) { if (needsUpdate) { @@ -363,12 +373,7 @@ void ControlState(::std::vector& operationMessage, bool& nextStep, PlaySound(SOUND_ANNOTATION); } - if(specialKey) - { - s_RestoreState = SHUTDOWN; - } - - if (nextStep && !specialKey) + if (nextStep) { s_RestoreState = RESTORE_TWL_SOUND; } @@ -701,17 +706,39 @@ void ControlState(::std::vector& operationMessage, bool& nextStep, } break; + case NUP_ONLY_WAIT_SD_EJECT: + { + operationMessage.push_back(::std::string("Update Done. Pull Out SD Card.")); + + // SDカード抜けのみで次の状態に遷移する + if (!s_PlayedSdPullOutCursor) + { + common::PlaySound(common::SOUND_CURSOR); + s_PlayedSdPullOutCursor = true; + } + } + break; + + case NUP_ONLY_WAIT_NEXT: + { + operationMessage.push_back(::std::string("A or START Button to Shutdown.")); + + if(nextStep) + { + s_RestoreState = SHUTDOWN; + } + } + break; + case SHUTDOWN: { - // リストア状態チェックファイルをすべて削除 - DeleteAllCheckFiles(); - // 本体初期化を行う InitializeFileSystem(); // シャットダウンする nn::ptm::CTR::ShutdownAsync(0, nn::fnd::TimeSpan::FromSeconds(0)); } + break; } } @@ -737,6 +764,10 @@ void OnSdEjected() { s_RestoreState = ALL_DONE; } + else if(s_RestoreState == NUP_ONLY_WAIT_SD_EJECT) + { + s_RestoreState = NUP_ONLY_WAIT_NEXT; + } // FAILのときは一旦電源を切らないと動かないようにしておく else if(s_RestoreState != FAIL) { @@ -762,6 +793,7 @@ void InitializeState() s_PlayedStartCursor = false; s_PlayedRebootCursor = false; s_PlayedSdPullOutCursor = false; + s_NupOnlyMode = false; } u32 GetProgress() diff --git a/trunk/ConsoleDataMigration/ConsoleRestore/Controller.h b/trunk/ConsoleDataMigration/ConsoleRestore/Controller.h index e4f37e0..281b31a 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, bool specialKey); +void ControlState(::std::vector& operationMessage, bool& nextStep, bool& continueRestore); bool InProgress(); bool IsRestoreSucceeded(); bool IsRestoreFailed(); diff --git a/trunk/ConsoleDataMigration/ConsoleRestore/Importer.cpp b/trunk/ConsoleDataMigration/ConsoleRestore/Importer.cpp index 4401b99..d6ee97a 100644 --- a/trunk/ConsoleDataMigration/ConsoleRestore/Importer.cpp +++ b/trunk/ConsoleDataMigration/ConsoleRestore/Importer.cpp @@ -831,7 +831,7 @@ bool UpdateNetworkSetting(nn::ac::NetworkSetting& networkSetting) return retval; } -bool ReadSetting() +bool ReadSetting(bool* nupOnly) { nn::Result result; bool retval = true; @@ -1132,6 +1132,21 @@ bool ReadSetting() } + { + if (nupOnly != NULL) + { + if (configfileLoader.ReadAsChar(L"NUP_ONLY") != NULL) + { + s32 num = configfileLoader.ReadAsInteger(L"NUP_ONLY"); + if (num == 1) + { + *nupOnly = true; + COMMON_LOGGER("NUP Only Mode.\n"); + } + } + } + } + configfileLoader.Finalize(); // 書き込み完了しなければfalse diff --git a/trunk/ConsoleDataMigration/ConsoleRestore/Importer.h b/trunk/ConsoleDataMigration/ConsoleRestore/Importer.h index a31a346..1775d87 100644 --- a/trunk/ConsoleDataMigration/ConsoleRestore/Importer.h +++ b/trunk/ConsoleDataMigration/ConsoleRestore/Importer.h @@ -60,7 +60,7 @@ struct TimeZone NN_PADDING3; }; -bool ReadSetting(); +bool ReadSetting(bool* nupOnly); char* GetNtpServerName(); TimeZone GetTimeZone();