From 581aa062361c5cd29dfc1632328f7cd9767f3c00 Mon Sep 17 00:00:00 2001 From: N2614 Date: Wed, 23 Feb 2011 10:51:17 +0000 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E8=A1=8C=E5=85=83=E6=9C=AC=E4=BD=93?= =?UTF-8?q?=E3=81=A7NUP=E3=81=97=E3=81=A6=E3=81=84=E3=82=8B=E6=99=82?= =?UTF-8?q?=E3=81=AE=E3=81=BFNUP=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB?= 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@79 385bec56-5757-e545-9c3a-d8741f4650f1 --- .../ConsoleRestore/Controller.cpp | 51 ++++++++++++++++++- .../ConsoleRestore/Importer.cpp | 6 +++ .../ConsoleRestore/Importer.h | 3 ++ 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/trunk/ConsoleDataMigration/ConsoleRestore/Controller.cpp b/trunk/ConsoleDataMigration/ConsoleRestore/Controller.cpp index 04aea77..240d033 100644 --- a/trunk/ConsoleDataMigration/ConsoleRestore/Controller.cpp +++ b/trunk/ConsoleDataMigration/ConsoleRestore/Controller.cpp @@ -86,6 +86,10 @@ bool s_PlayedStartCursor = false; bool s_PlayedRebootCursor = false; // SD抜き出し前サウンドを鳴らしたかどうか bool s_PlayedSdPullOutCursor = false; +// バージョンデータが無い警告サウンドを鳴らしたかどうか +bool s_ExistsVersionDataAnnotation = false; +// バージョンデータを読んだかどうか +bool s_ReadVersionDone = false; // ネットワークアップデートを開始したかどうか bool s_ExecuteFgNup = false; @@ -141,6 +145,31 @@ bool CheckAndReadAPSetting(::std::vector& operationMessage) return s_ReadSettingSuccess; } +bool CheckAndReadVersionData(::std::vector& operationMessage) +{ + using namespace common; + + if (!ExistsVersionData()) + { + if(!s_ExistsVersionDataAnnotation) + { + s_ExistsVersionDataAnnotation = true; + common::PlaySound(common::SOUND_ANNOTATION); + } + operationMessage.push_back(::std::string("Version Data does not exist!")); + return false; + } + + // バージョン情報ファイルを読み込む + if (!s_ReadVersionDone) + { + s_ReadVersionDone = true; + ReadVersionData(); + } + + return s_ReadSettingSuccess; +} + void PutAliveMessage(::std::vector& operationMessage, const char* str) { std::string message = std::string(str); @@ -174,6 +203,21 @@ void ExecSyncMcuRtc() } } +// Zero NUP限定コード +bool NeedsNup() +{ + if(AlreadyExecutedNup()) + { + NN_LOG("Need NUP\n"); + return common::ExistsUpdateCheckedFile(); + } + else + { + NN_LOG("No need NUP\n"); + return false; + } +} + void ControlState(::std::vector& operationMessage, bool& nextStep, bool& continueRestore) { using namespace common; @@ -192,8 +236,10 @@ void ControlState(::std::vector& operationMessage, bool& nextStep, // SDカードが挿入されているか? if (nn::fs::IsSdmcInserted()) { - // SDカードにアップデート完了ファイルがあるか? - if (ExistsUpdateCheckedFile()) + CheckAndReadVersionData(operationMessage); + + // NUPが必要か? + if (!NeedsNup()) { validApSetting = CheckAndReadAPSetting(operationMessage); if (s_NupOnlyMode) @@ -810,6 +856,7 @@ void InitializeState() s_PlayedRebootCursor = false; s_PlayedSdPullOutCursor = false; s_NupOnlyMode = false; + s_ReadVersionDone = false; } u32 GetProgress() diff --git a/trunk/ConsoleDataMigration/ConsoleRestore/Importer.cpp b/trunk/ConsoleDataMigration/ConsoleRestore/Importer.cpp index de42f4a..c96f19f 100644 --- a/trunk/ConsoleDataMigration/ConsoleRestore/Importer.cpp +++ b/trunk/ConsoleDataMigration/ConsoleRestore/Importer.cpp @@ -743,6 +743,12 @@ void ReadVersionData() COMMON_LOGGER("Failed Allocate Heap!!\n"); } } + +bool AlreadyExecutedNup() +{ + return s_SDVersionData.nup.majorVersion != 0; +} + void Cleanup() { nn::Result result; diff --git a/trunk/ConsoleDataMigration/ConsoleRestore/Importer.h b/trunk/ConsoleDataMigration/ConsoleRestore/Importer.h index 950c429..7a82222 100644 --- a/trunk/ConsoleDataMigration/ConsoleRestore/Importer.h +++ b/trunk/ConsoleDataMigration/ConsoleRestore/Importer.h @@ -88,6 +88,9 @@ void InitializeHardwareDependentSetting(); // SDカード上のバージョン情報を読みます void ReadVersionData(); +// 移行元本体がNUP済みかどうか +bool AlreadyExecutedNup(); + } #endif /* IMPORTER_H_ */