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";