From cf30075a41995c66535b55969c0f9b021363afdb Mon Sep 17 00:00:00 2001 From: N2614 Date: Wed, 9 Feb 2011 12:38:26 +0000 Subject: [PATCH] =?UTF-8?q?NIM=E3=81=AE=E3=82=B7=E3=82=B9=E3=83=86?= =?UTF-8?q?=E3=83=A0=E3=82=BB=E3=83=BC=E3=83=96=E3=83=87=E3=83=BC=E3=82=BF?= =?UTF-8?q?=E3=81=AF=E5=90=B8=E5=87=BA=E3=81=97=E5=BE=8C=E5=89=8A=E9=99=A4?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=20=E3=83=AD?= =?UTF-8?q?=E3=82=B0=E5=87=BA=E5=8A=9B=E3=81=AE=E6=95=B4=E7=90=86?= 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@41 385bec56-5757-e545-9c3a-d8741f4650f1 --- .../ConsoleBackup/Controller.cpp | 11 +++++++- .../ConsoleBackup/Exporter.cpp | 25 ++++++++++++++++--- .../ConsoleBackup/Exporter.h | 1 + .../common/CommonLogger.h | 1 + trunk/ConsoleDataMigration/common/FileName.h | 1 + 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/trunk/ConsoleDataMigration/ConsoleBackup/Controller.cpp b/trunk/ConsoleDataMigration/ConsoleBackup/Controller.cpp index 54ee8c4..b5a4663 100644 --- a/trunk/ConsoleDataMigration/ConsoleBackup/Controller.cpp +++ b/trunk/ConsoleDataMigration/ConsoleBackup/Controller.cpp @@ -34,6 +34,7 @@ typedef enum BackupState EXPORT_TWL_SOUND, // TWLサウンド領域の吸出し中 EXPORT_TWL_PHOTO, // TWL写真領域の吸出し中 EXPORT_CTR_NAND, // 吸出し中 + DELETE_NIM, // nimのシステムセーブデータ削除 DONE, // 吸出し完了 FINISHED, // SDカード抜き完了 FAIL // 失敗 @@ -203,7 +204,7 @@ void ControlState(::std::vector& operationMessage, bool& nextStep, if(GetProgress() > 99) { - s_BackupState = DONE; + s_BackupState = DELETE_NIM; } else { @@ -212,6 +213,14 @@ void ControlState(::std::vector& operationMessage, bool& nextStep, } } + break; + + // nimのシステムセーブデータ削除 + case DELETE_NIM: + { + DeleteNimSaveData(); + s_BackupState = DONE; + } break; // 吸出し完了 diff --git a/trunk/ConsoleDataMigration/ConsoleBackup/Exporter.cpp b/trunk/ConsoleDataMigration/ConsoleBackup/Exporter.cpp index 6b851ef..81fad4e 100644 --- a/trunk/ConsoleDataMigration/ConsoleBackup/Exporter.cpp +++ b/trunk/ConsoleDataMigration/ConsoleBackup/Exporter.cpp @@ -60,13 +60,12 @@ wchar_t s_RootName[256]; } -void DeleteTrash() +void DeleteTrash(std::wstring currentDirectory) { // TODO: リードオンリーのファイルが消去できない COMMON_LOGGER("Delete Trash.\n"); - std::wstring currentDirectory = common::SDMC_ROOT_DIRECTORY_PATH; nn::fs::FileInputStream fis; nn::fs::Directory dir; nn::Result result; @@ -353,7 +352,7 @@ void ExportTwlPhotoData() void ExportTwlSoundData() { // 不要なデータを削除する - DeleteTrash(); + DeleteTrash(common::SDMC_ROOT_DIRECTORY_PATH); s_ExportThread.Start(WriteTwlSoundData, s_ExportThreadStack); } @@ -465,6 +464,26 @@ void WritePlayHistory() historyManager.Export(); } +void DeleteNimSaveData() +{ + nn::Result result; + ::std::wstring nimSaveDataPath = + ::std::wstring(common::SDMC_ROOT_DIRECTORY_PATH) + + ::std::wstring(common::SD_SAVEDATA_ROOT_NAME) + + ::std::wstring(s_RootName) + + ::std::wstring(L"/") + + std::wstring(common::NIM_SAVEDATA_DIRECTORY_NAME); + + common::SdMountManager::Mount(); + + NN_LOG("%ls\n", nimSaveDataPath.c_str()); + result = nn::fs::TryDeleteDirectoryRecursively(nimSaveDataPath.c_str()); + COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result); + + common::SdMountManager::Unmount(); +} + + void ExportData() { static bool init = true; diff --git a/trunk/ConsoleDataMigration/ConsoleBackup/Exporter.h b/trunk/ConsoleDataMigration/ConsoleBackup/Exporter.h index 1523c6c..216a277 100644 --- a/trunk/ConsoleDataMigration/ConsoleBackup/Exporter.h +++ b/trunk/ConsoleDataMigration/ConsoleBackup/Exporter.h @@ -24,6 +24,7 @@ namespace ConsoleBackup void ExportTwlPhotoData(); void ExportTwlSoundData(); void ExportData(); +void DeleteNimSaveData(); u32 GetProgress(); bool IsExportFinished(); diff --git a/trunk/ConsoleDataMigration/common/CommonLogger.h b/trunk/ConsoleDataMigration/common/CommonLogger.h index 562ffcd..2105eae 100644 --- a/trunk/ConsoleDataMigration/common/CommonLogger.h +++ b/trunk/ConsoleDataMigration/common/CommonLogger.h @@ -29,6 +29,7 @@ (void)common::Logger::GetLoggerInstance()->PrintResult("Result = %X\n", result.GetPrintableBits()); \ #define COMMON_LOGGER_RESULT_WITH_LINE(result, line, func) \ + (void)nn::dbg::detail::Printf("%s\n", func); \ (void)nn::dbg::detail::Printf("%d\n", line); \ (void)nn::dbg::PrintResult(result); \ (void)common::Logger::GetLoggerInstance()->PrintResult("Func = %s\n", func); \ diff --git a/trunk/ConsoleDataMigration/common/FileName.h b/trunk/ConsoleDataMigration/common/FileName.h index 2bd3496..2f1d023 100644 --- a/trunk/ConsoleDataMigration/common/FileName.h +++ b/trunk/ConsoleDataMigration/common/FileName.h @@ -30,6 +30,7 @@ const wchar_t* const LOG_ROOT_DIRECTORY_PATH = L"sdmc:/CTR_Console_Repair"; const wchar_t* const SD_SAVEDATA_ROOT_NAME = L"CTR_Console_Repair/CTRBackup/"; const wchar_t* const SD_SAVEDATA_TWL_PHOTO_ROOT_NAME = L"CTR_Console_Repair/TWLPhotoBackup/"; const wchar_t* const SD_SAVEDATA_TWL_SOUND_ROOT_NAME = L"CTR_Console_Repair/TWLSoundBackup/"; +const wchar_t* const NIM_SAVEDATA_DIRECTORY_NAME = L"sysdata/0001002c"; const wchar_t* const LOG_PATHNAME = L"CTR_Console_Repair/Migration_Log.txt"; const wchar_t* const LOG_FILENAME = L"Migration_Log.txt"; const wchar_t* const COUNTRY_SETTING_PATHNAME = L"sdmc:/CTR_Console_Repair/CountrySetting.bin";