diff --git a/trunk/ConsoleDataMigration/ConsoleBackup/ConsoleBackup.cpp b/trunk/ConsoleDataMigration/ConsoleBackup/ConsoleBackup.cpp index 5f70ef3..064683a 100644 --- a/trunk/ConsoleDataMigration/ConsoleBackup/ConsoleBackup.cpp +++ b/trunk/ConsoleDataMigration/ConsoleBackup/ConsoleBackup.cpp @@ -44,6 +44,7 @@ #include "CommonLogger.h" #include "SDMountManager.h" #include "HeapManager.h" +#include "PlayHistoryManager.h" // svnリビジョン埋め込み用 #include "version.h" diff --git a/trunk/ConsoleDataMigration/ConsoleBackup/Exporter.cpp b/trunk/ConsoleDataMigration/ConsoleBackup/Exporter.cpp index 975ca5b..581fa32 100644 --- a/trunk/ConsoleDataMigration/ConsoleBackup/Exporter.cpp +++ b/trunk/ConsoleDataMigration/ConsoleBackup/Exporter.cpp @@ -38,6 +38,7 @@ #include "FileTransfer.h" #include "common_Types.h" #include "Aes_define.h" +#include "PlayHistoryManager.h" namespace ConsoleBackup { @@ -443,6 +444,14 @@ void FinalizeExportThread() s_ExportThread.Finalize(); } +void WritePlayHistory() +{ + common::PlayHistoryManager historyManager; + + COMMON_LOGGER("Export PlayHistory\n"); + historyManager.Export(); +} + void ExportData() { static bool init = true; @@ -473,6 +482,9 @@ void ExportData() // TWLサウンド領域のデータをSDに書き出す WriteTwlSoundData(); + // プレイ履歴をSDに書き出す + WritePlayHistory(); + // RTCをSDに書き出す WriteMcuRtcData(); diff --git a/trunk/ConsoleDataMigration/ConsoleBackup/OMakefile b/trunk/ConsoleDataMigration/ConsoleBackup/OMakefile index b8feb6e..c3bfd6a 100644 --- a/trunk/ConsoleDataMigration/ConsoleBackup/OMakefile +++ b/trunk/ConsoleDataMigration/ConsoleBackup/OMakefile @@ -40,6 +40,7 @@ SOURCES[] = ../common/LogConsole.cpp ../common/CommonLogger.cpp ../common/SdMountManager.cpp + ../common/PlayHistoryManager.cpp CTR_BANNER_SPEC = $(TARGET_PROGRAM).bsf diff --git a/trunk/ConsoleDataMigration/ConsoleRestore/Controller.cpp b/trunk/ConsoleDataMigration/ConsoleRestore/Controller.cpp index 16bf330..1d92abe 100644 --- a/trunk/ConsoleDataMigration/ConsoleRestore/Controller.cpp +++ b/trunk/ConsoleDataMigration/ConsoleRestore/Controller.cpp @@ -45,6 +45,7 @@ typedef enum RestoreState RESTORE_DONE, // 書き込み完了 REBOOTING, // 再起動を行う ERASE, // 削除処理を行う + HISTORY_RECOVER, // プレイ履歴の書き戻しを行う TIME_ADJUST, // 時計あわせを行う WAIT_SD_EJECT, // SDカードぬき待ち ALL_DONE, // すべて完了 @@ -505,10 +506,31 @@ void ControlState(::std::vector& operationMessage, bool& nextStep, case ERASE: { Cleanup(); - s_RestoreState = TIME_ADJUST; + s_RestoreState = HISTORY_RECOVER; } break; + // 削除処理 + case HISTORY_RECOVER: + { + static bool init = true; + if (init) + { + // ptmのセーブデータ移行後に時計を無効化する + nn::ptm::CTR::InvalidateSystemTime(); + + // ptmのセーブデータ移行後にプレイ履歴を移行する + ImportPlayHistory(); + init = false; + } + + if(IsImportFinished()) + { + s_RestoreState = TIME_ADJUST; + } + } + + // 時計あわせ case TIME_ADJUST: { @@ -516,8 +538,6 @@ void ControlState(::std::vector& operationMessage, bool& nextStep, if(init) { COMMON_LOGGER("Adjust Time\n"); - // ptmのセーブデータ移行後に時計を無効化する - nn::ptm::CTR::InvalidateSystemTime(); AdjustTime(); init = false; } diff --git a/trunk/ConsoleDataMigration/ConsoleRestore/Importer.cpp b/trunk/ConsoleDataMigration/ConsoleRestore/Importer.cpp index 5654d1c..012d542 100644 --- a/trunk/ConsoleDataMigration/ConsoleRestore/Importer.cpp +++ b/trunk/ConsoleDataMigration/ConsoleRestore/Importer.cpp @@ -44,6 +44,7 @@ #include "common_Types.h" #include "Aes_define.h" #include "configLoader.h" +#include "PlayHistoryManager.h" #include #include @@ -1172,6 +1173,19 @@ void ClearFileReadReslt() s_ReadSerialNumber = false; } +void ImportPlayHistoryThreadFunc() +{ + common::PlayHistoryManager historyManager; + + COMMON_LOGGER("Import PlayHistory\n"); + historyManager.Import(); +} + +void ImportPlayHistory() +{ + s_ImportThread.Start(ImportPlayHistoryThreadFunc, s_ImportThreadStack); +} + void ImportData() { static bool init = true; diff --git a/trunk/ConsoleDataMigration/ConsoleRestore/Importer.h b/trunk/ConsoleDataMigration/ConsoleRestore/Importer.h index 70dbb8a..d4a37ee 100644 --- a/trunk/ConsoleDataMigration/ConsoleRestore/Importer.h +++ b/trunk/ConsoleDataMigration/ConsoleRestore/Importer.h @@ -66,6 +66,9 @@ void ImportMcuRtc(); void InitializeFileSystem(); void ClearFileReadReslt(); + +// プレイ履歴を読み込みます。ptmのセーブデータ移行後に呼び出す必要があります +void ImportPlayHistory(); } #endif /* IMPORTER_H_ */ diff --git a/trunk/ConsoleDataMigration/ConsoleRestore/OMakefile b/trunk/ConsoleDataMigration/ConsoleRestore/OMakefile index 9c2097b..2470142 100644 --- a/trunk/ConsoleDataMigration/ConsoleRestore/OMakefile +++ b/trunk/ConsoleDataMigration/ConsoleRestore/OMakefile @@ -43,6 +43,7 @@ SOURCES[] = ../common/CommonLogger.cpp ../common/SdMountManager.cpp ../common/configLoader.cpp + ../common/PlayHistoryManager.cpp CTR_BANNER_SPEC = $(TARGET_PROGRAM).bsf diff --git a/trunk/ConsoleDataMigration/common/FileName.h b/trunk/ConsoleDataMigration/common/FileName.h index 7d49ac7..712ebfe 100644 --- a/trunk/ConsoleDataMigration/common/FileName.h +++ b/trunk/ConsoleDataMigration/common/FileName.h @@ -47,6 +47,8 @@ const wchar_t* const WRITE_FINISHED_PATHNAME = L"sdmc:/CTR_Console_Repair/WriteF const wchar_t* const UPDATE_CHECK_PATHNAME = L"sdmc:/CTR_Console_Repair/UpdateFinished"; const wchar_t* const INITIALIZED_CHECK_PATHNAME = L"sdmc:/CTR_Console_Repair/ConsoleInitialized"; const wchar_t* const RTC_SYNC_CHECK_PATHNAME = L"sdmc:/CTR_Console_Repair/RtcSyncFinished"; +const wchar_t* const PLAYHISTORY_PATHNAME = L"sdmc:/CTR_Console_Repair/playhistory.bin"; +const wchar_t* const PLAYHISTORY_COUNT_PATHNAME = L"sdmc:/CTR_Console_Repair/playhistoryCount.bin"; enum TWL_PATHNAME {