mirror of
https://github.com/rvtr/ctr_Repair.git
synced 2025-10-31 13:51:08 -04:00
警告ログ出力のフォント色変更
A or START入力ならばセーブデータチェック後エラー画面に遷移するように 左+A or START入力で削除後吸出しに遷移するように git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@441 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
parent
86548396f2
commit
32d798b269
@ -31,6 +31,7 @@ nn::os::Thread s_CheckerThread;
|
|||||||
nn::os::StackBuffer<CHECKER_STACK_SIZE> s_CheckerThreadStackSize;
|
nn::os::StackBuffer<CHECKER_STACK_SIZE> s_CheckerThreadStackSize;
|
||||||
nn::Result s_CheckerResult;
|
nn::Result s_CheckerResult;
|
||||||
NandSavedataChecker* s_pChecker;
|
NandSavedataChecker* s_pChecker;
|
||||||
|
bool s_CheckErrorOccured = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ s32 GetCheckSaveDataProgress()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckSaveDataThreadFunc()
|
void CheckSaveDataThreadFunc(bool erase)
|
||||||
{
|
{
|
||||||
size_t bufSize = common::GetAllocatableSize();
|
size_t bufSize = common::GetAllocatableSize();
|
||||||
if(bufSize > common::FILE_COPY_HEAP_SIZE)
|
if(bufSize > common::FILE_COPY_HEAP_SIZE)
|
||||||
@ -58,7 +59,7 @@ void CheckSaveDataThreadFunc()
|
|||||||
if (heap.GetAddr() != NULL)
|
if (heap.GetAddr() != NULL)
|
||||||
{
|
{
|
||||||
s_pChecker = new NandSavedataChecker(heap.GetAddr(), bufSize);
|
s_pChecker = new NandSavedataChecker(heap.GetAddr(), bufSize);
|
||||||
s_CheckerResult = s_pChecker->CleanUp();
|
s_CheckerResult = s_pChecker->CleanUp(erase);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -68,9 +69,9 @@ void CheckSaveDataThreadFunc()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartSaveDataCheck()
|
void StartSaveDataCheck(bool erase)
|
||||||
{
|
{
|
||||||
s_CheckerThread.Start(CheckSaveDataThreadFunc, s_CheckerThreadStackSize);
|
s_CheckerThread.Start(CheckSaveDataThreadFunc, erase, s_CheckerThreadStackSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsCheckSaveDataFinished()
|
bool IsCheckSaveDataFinished()
|
||||||
@ -85,10 +86,16 @@ void FinalizeSaveDataCheck()
|
|||||||
|
|
||||||
if(s_pChecker != NULL)
|
if(s_pChecker != NULL)
|
||||||
{
|
{
|
||||||
|
s_CheckErrorOccured = s_pChecker->GetCheckErrorOccured();
|
||||||
delete s_pChecker;
|
delete s_pChecker;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CheckSaveDataErrorOccured()
|
||||||
|
{
|
||||||
|
return s_CheckErrorOccured;
|
||||||
|
}
|
||||||
|
|
||||||
bool CheckSaveDataSucceeded()
|
bool CheckSaveDataSucceeded()
|
||||||
{
|
{
|
||||||
COMMON_LOGGER_RETURN_FALSE_IF_FAILED(s_CheckerResult);
|
COMMON_LOGGER_RETURN_FALSE_IF_FAILED(s_CheckerResult);
|
||||||
|
|||||||
@ -20,9 +20,12 @@ namespace ConsoleBackup
|
|||||||
{
|
{
|
||||||
|
|
||||||
s32 GetCheckSaveDataProgress();
|
s32 GetCheckSaveDataProgress();
|
||||||
void StartSaveDataCheck();
|
//!@ brief セーブデータのチェックを開始する
|
||||||
|
//!@ param[in] erase エラー発生時にファイルを削除するかどうか
|
||||||
|
void StartSaveDataCheck(bool erase);
|
||||||
bool IsCheckSaveDataFinished();
|
bool IsCheckSaveDataFinished();
|
||||||
void FinalizeSaveDataCheck();
|
void FinalizeSaveDataCheck();
|
||||||
|
bool CheckSaveDataErrorOccured();
|
||||||
bool CheckSaveDataSucceeded();
|
bool CheckSaveDataSucceeded();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -155,6 +155,7 @@ extern "C" void nnMain(void)
|
|||||||
|
|
||||||
bool flip = false;
|
bool flip = false;
|
||||||
bool continueBackup = false;
|
bool continueBackup = false;
|
||||||
|
bool forceDelete = false;
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
@ -166,6 +167,10 @@ extern "C" void nnMain(void)
|
|||||||
padStatus.trigger & nn::hid::BUTTON_START)
|
padStatus.trigger & nn::hid::BUTTON_START)
|
||||||
{
|
{
|
||||||
nextStep = true;
|
nextStep = true;
|
||||||
|
if(padStatus.hold & nn::hid::BUTTON_LEFT)
|
||||||
|
{
|
||||||
|
forceDelete = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// LまたはRボタンで上下画面フリップ
|
// LまたはRボタンで上下画面フリップ
|
||||||
@ -214,7 +219,7 @@ extern "C" void nnMain(void)
|
|||||||
// 進捗確認メッセージを兼ねる?
|
// 進捗確認メッセージを兼ねる?
|
||||||
::std::vector<std::string> operationMessage;
|
::std::vector<std::string> operationMessage;
|
||||||
|
|
||||||
ControlState(manager, operationMessage, nextStep, continueBackup);
|
ControlState(manager, operationMessage, nextStep, continueBackup, forceDelete);
|
||||||
|
|
||||||
nn::util::FloatColor titleColor;
|
nn::util::FloatColor titleColor;
|
||||||
|
|
||||||
@ -239,6 +244,7 @@ extern "C" void nnMain(void)
|
|||||||
GetProgress(),
|
GetProgress(),
|
||||||
IsBackupFailed(),
|
IsBackupFailed(),
|
||||||
IsBackupSucceeded(),
|
IsBackupSucceeded(),
|
||||||
|
IsBackupWarning(),
|
||||||
s_HwUtility.GetMacAddress(),
|
s_HwUtility.GetMacAddress(),
|
||||||
operationMessage,
|
operationMessage,
|
||||||
s_HwUtility.GetRegion(),
|
s_HwUtility.GetRegion(),
|
||||||
@ -246,6 +252,20 @@ extern "C" void nnMain(void)
|
|||||||
s_HwUtility.HasReadFriendCode()
|
s_HwUtility.HasReadFriendCode()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (GetBackupMode() == BACKUP_MODE_DELETE_IF_FAILED)
|
||||||
|
{
|
||||||
|
const u8 spaceSize = 10;
|
||||||
|
const u8 lineBottom = 23;
|
||||||
|
const u32 screenWidth = 400;
|
||||||
|
|
||||||
|
renderSystem.SetColor(1.f, 1.f, 1.f);
|
||||||
|
renderSystem.DrawText(0, lineBottom * spaceSize, "Delete Error File Mode");
|
||||||
|
|
||||||
|
renderSystem.SetColor(titleColor.r, titleColor.g, titleColor.b);
|
||||||
|
renderSystem.FillRectangle(0, lineBottom * spaceSize, screenWidth, spaceSize);
|
||||||
|
renderSystem.SetColor(1.f, 1.f, 1.f);
|
||||||
|
}
|
||||||
|
|
||||||
renderSystem.SwapBuffers();
|
renderSystem.SwapBuffers();
|
||||||
|
|
||||||
// デフォルトで下画面に描画するもの
|
// デフォルトで下画面に描画するもの
|
||||||
@ -254,7 +274,11 @@ extern "C" void nnMain(void)
|
|||||||
{
|
{
|
||||||
renderSystem.SetClearColor(common::GetRenderTarget(NN_GX_DISPLAY1, flip), SUCCESS_COLOR);
|
renderSystem.SetClearColor(common::GetRenderTarget(NN_GX_DISPLAY1, flip), SUCCESS_COLOR);
|
||||||
}
|
}
|
||||||
if(IsBackupFailed())
|
if(IsBackupWarning())
|
||||||
|
{
|
||||||
|
renderSystem.SetClearColor(common::GetRenderTarget(NN_GX_DISPLAY1, flip), WARN_COLOR);
|
||||||
|
}
|
||||||
|
else if(IsBackupFailed())
|
||||||
{
|
{
|
||||||
renderSystem.SetClearColor(common::GetRenderTarget(NN_GX_DISPLAY1, flip), FAIL_COLOR);
|
renderSystem.SetClearColor(common::GetRenderTarget(NN_GX_DISPLAY1, flip), FAIL_COLOR);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,10 +39,16 @@ typedef enum BackupState
|
|||||||
DELETE_NIM, // nimのシステムセーブデータ削除
|
DELETE_NIM, // nimのシステムセーブデータ削除
|
||||||
DONE, // 吸出し完了
|
DONE, // 吸出し完了
|
||||||
FINISHED, // SDカード抜き完了
|
FINISHED, // SDカード抜き完了
|
||||||
FAIL // 失敗
|
FAIL, // 失敗
|
||||||
|
FAIL_CHECK, // セーブデータのチェック時エラー
|
||||||
|
|
||||||
|
STATE_MAX
|
||||||
} BackupState;
|
} BackupState;
|
||||||
|
|
||||||
|
|
||||||
|
// Backupモード管理
|
||||||
|
BackupMode s_BackupMode = BACKUP_MODE_CHECK;
|
||||||
|
|
||||||
// APSettingの書式が無い警告サウンドを鳴らしたかどうか
|
// APSettingの書式が無い警告サウンドを鳴らしたかどうか
|
||||||
bool s_ExistAPSettingAnnotation = false;
|
bool s_ExistAPSettingAnnotation = false;
|
||||||
// SDに書き込みできない警告サウンドを鳴らしたかどうか
|
// SDに書き込みできない警告サウンドを鳴らしたかどうか
|
||||||
@ -85,7 +91,7 @@ bool NeedsAcAdapter(common::HardwareStateManager& manager)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ControlState(common::HardwareStateManager& manager, ::std::vector<std::string>& operationMessage, bool& nextStep,
|
void ControlState(common::HardwareStateManager& manager, ::std::vector<std::string>& operationMessage, bool& nextStep,
|
||||||
bool& continueBackup)
|
bool& continueBackup, bool forceDelete)
|
||||||
{
|
{
|
||||||
// 状態遷移Controller
|
// 状態遷移Controller
|
||||||
switch (s_BackupState)
|
switch (s_BackupState)
|
||||||
@ -93,89 +99,93 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
|||||||
|
|
||||||
// 起動時
|
// 起動時
|
||||||
case STARTUP:
|
case STARTUP:
|
||||||
{
|
|
||||||
bool error = false;
|
|
||||||
// 完全性検証SEEDを読めるか?
|
|
||||||
if (manager.CanReadIvs())
|
|
||||||
{
|
{
|
||||||
// SDカードが挿入されているか?
|
bool error = false;
|
||||||
if (nn::fs::IsSdmcInserted())
|
// 完全性検証SEEDを読めるか?
|
||||||
|
if (manager.CanReadIvs())
|
||||||
{
|
{
|
||||||
// SDカードに書き込みできるか?
|
// SDカードが挿入されているか?
|
||||||
if (!nn::fs::IsSdmcWritable())
|
if (nn::fs::IsSdmcInserted())
|
||||||
{
|
{
|
||||||
if (!s_SdWriteProetctAnnotation)
|
// SDカードに書き込みできるか?
|
||||||
|
if (!nn::fs::IsSdmcWritable())
|
||||||
{
|
{
|
||||||
s_SdWriteProetctAnnotation = true;
|
if (!s_SdWriteProetctAnnotation)
|
||||||
common::PlaySound(common::SOUND_ANNOTATION);
|
|
||||||
}
|
|
||||||
operationMessage.push_back(::std::string("Can*t Write SD Card!!\n"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 無線設定ファイルがあるか?
|
|
||||||
if (common::ExistsAPSetting())
|
|
||||||
{
|
|
||||||
// 書き込み中に抜かないように
|
|
||||||
if (nextStep)
|
|
||||||
{
|
|
||||||
// シリアルナンバーを読み取れるか?
|
|
||||||
if (!manager.CanReadSerialNumber())
|
|
||||||
{
|
{
|
||||||
|
s_SdWriteProetctAnnotation = true;
|
||||||
common::PlaySound(common::SOUND_ANNOTATION);
|
common::PlaySound(common::SOUND_ANNOTATION);
|
||||||
COMMON_LOGGER("Can't Read Serial Number\n");
|
|
||||||
}
|
}
|
||||||
|
operationMessage.push_back(::std::string("Can*t Write SD Card!!\n"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 無線設定ファイルがあるか?
|
||||||
|
if (common::ExistsAPSetting())
|
||||||
|
{
|
||||||
|
// 書き込み中に抜かないように
|
||||||
|
if (nextStep)
|
||||||
|
{
|
||||||
|
// シリアルナンバーを読み取れるか?
|
||||||
|
if (!manager.CanReadSerialNumber())
|
||||||
|
{
|
||||||
|
common::PlaySound(common::SOUND_ANNOTATION);
|
||||||
|
COMMON_LOGGER("Can't Read Serial Number\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
error = true;
|
||||||
|
if (!s_ExistAPSettingAnnotation)
|
||||||
|
{
|
||||||
|
s_ExistAPSettingAnnotation = true;
|
||||||
|
common::PlaySound(common::SOUND_ANNOTATION);
|
||||||
|
}
|
||||||
|
operationMessage.push_back(::std::string("Accsess_Point_Setting does not exist!"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
error = true;
|
error = true;
|
||||||
if (!s_ExistAPSettingAnnotation)
|
operationMessage.push_back(::std::string("Insert SD Card!!"));
|
||||||
{
|
|
||||||
s_ExistAPSettingAnnotation = true;
|
|
||||||
common::PlaySound(common::SOUND_ANNOTATION);
|
|
||||||
}
|
|
||||||
operationMessage.push_back(::std::string("Accsess_Point_Setting does not exist!"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
error = true;
|
error = true;
|
||||||
operationMessage.push_back(::std::string("Insert SD Card!!"));
|
operationMessage.push_back(::std::string("Can't Read SDCI!!"));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
error = true;
|
|
||||||
operationMessage.push_back(::std::string("Can't Read SDCI!!"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// ACアダプタが必要か?
|
// ACアダプタが必要か?
|
||||||
if (NeedsAcAdapter(manager))
|
if (NeedsAcAdapter(manager))
|
||||||
{
|
|
||||||
error = true;
|
|
||||||
operationMessage.push_back(::std::string("Connect AC Adapter!!"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// エラーが無ければ進行用メッセージ表示
|
|
||||||
if(!error)
|
|
||||||
{
|
|
||||||
operationMessage.push_back(::std::string("Push A or START Button"));
|
|
||||||
if(!s_PlayedStartCursor)
|
|
||||||
{
|
{
|
||||||
common::PlaySound(common::SOUND_CURSOR);
|
error = true;
|
||||||
s_PlayedStartCursor = true;
|
operationMessage.push_back(::std::string("Connect AC Adapter!!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// エラーが無ければ進行用メッセージ表示
|
||||||
|
if (!error)
|
||||||
|
{
|
||||||
|
operationMessage.push_back(::std::string("Push A or START Button"));
|
||||||
|
if (!s_PlayedStartCursor)
|
||||||
|
{
|
||||||
|
common::PlaySound(common::SOUND_CURSOR);
|
||||||
|
s_PlayedStartCursor = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nextStep && !error)
|
||||||
|
{
|
||||||
|
COMMON_LOGGER("Checking SaveData\n");
|
||||||
|
|
||||||
|
if(forceDelete)
|
||||||
|
{
|
||||||
|
s_BackupMode = BACKUP_MODE_DELETE_IF_FAILED;
|
||||||
|
}
|
||||||
|
s_BackupState = CHECK_SAVEDATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
if (nextStep && !error)
|
|
||||||
{
|
|
||||||
COMMON_LOGGER("Checking SaveData\n");
|
|
||||||
|
|
||||||
s_BackupState = CHECK_SAVEDATA;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
case CHECK_SAVEDATA:
|
case CHECK_SAVEDATA:
|
||||||
@ -183,7 +193,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
|||||||
static bool init = true;
|
static bool init = true;
|
||||||
if (init)
|
if (init)
|
||||||
{
|
{
|
||||||
StartSaveDataCheck();
|
StartSaveDataCheck(s_BackupMode == BACKUP_MODE_DELETE_IF_FAILED);
|
||||||
init = false;
|
init = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,11 +202,86 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
|||||||
if (IsCheckSaveDataFinished())
|
if (IsCheckSaveDataFinished())
|
||||||
{
|
{
|
||||||
FinalizeSaveDataCheck();
|
FinalizeSaveDataCheck();
|
||||||
if (CheckSaveDataSucceeded())
|
// 削除モードでなければエラーにする
|
||||||
|
if (CheckSaveDataErrorOccured() && !forceDelete)
|
||||||
{
|
{
|
||||||
COMMON_LOGGER("Start Export Data\n");
|
s_BackupState = FAIL_CHECK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (CheckSaveDataSucceeded())
|
||||||
|
{
|
||||||
|
COMMON_LOGGER("Start Export Data\n");
|
||||||
|
|
||||||
s_BackupState = EXPORT_TWL_NAND;
|
s_BackupState = EXPORT_TWL_NAND;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s_BackupState = FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
// TWLセーブデータ領域の吸出し中
|
||||||
|
case EXPORT_TWL_NAND:
|
||||||
|
{
|
||||||
|
static bool init = true;
|
||||||
|
if (init)
|
||||||
|
{
|
||||||
|
// コンテキストを初期化する
|
||||||
|
InitializeFileListContext();
|
||||||
|
|
||||||
|
// データを書き込む
|
||||||
|
if (ExportTwlSaveData().IsFailure())
|
||||||
|
{
|
||||||
|
s_BackupState = FAIL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
init = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
PutAliveMessage(operationMessage, "Exporting TWL SaveData");
|
||||||
|
|
||||||
|
// 処理が完了した
|
||||||
|
if (IsExportThreadFinished())
|
||||||
|
{
|
||||||
|
FinalizeExportThread();
|
||||||
|
if (IsExportSucceeded())
|
||||||
|
{
|
||||||
|
s_BackupState = EXPORT_TWL_SOUND;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s_BackupState = FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
// TWLサウンド領域の吸出し中
|
||||||
|
case EXPORT_TWL_SOUND:
|
||||||
|
{
|
||||||
|
static bool init = true;
|
||||||
|
if (init)
|
||||||
|
{
|
||||||
|
// データを書き込む
|
||||||
|
ExportTwlSoundData();
|
||||||
|
init = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
PutAliveMessage(operationMessage, "Exporting TWL Sound Data");
|
||||||
|
|
||||||
|
// 処理が完了した
|
||||||
|
if (IsExportThreadFinished())
|
||||||
|
{
|
||||||
|
FinalizeExportThread();
|
||||||
|
if (IsExportSucceeded())
|
||||||
|
{
|
||||||
|
s_BackupState = EXPORT_TWL_PHOTO;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -206,200 +291,144 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// TWL写真領域の吸出し中
|
||||||
// TWLセーブデータ領域の吸出し中
|
|
||||||
case EXPORT_TWL_NAND:
|
|
||||||
{
|
|
||||||
static bool init = true;
|
|
||||||
if(init)
|
|
||||||
{
|
|
||||||
// コンテキストを初期化する
|
|
||||||
InitializeFileListContext();
|
|
||||||
|
|
||||||
// データを書き込む
|
|
||||||
if(ExportTwlSaveData().IsFailure())
|
|
||||||
{
|
|
||||||
s_BackupState = FAIL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
init = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
PutAliveMessage(operationMessage, "Exporting TWL SaveData");
|
|
||||||
|
|
||||||
// 処理が完了した
|
|
||||||
if (IsExportThreadFinished())
|
|
||||||
{
|
|
||||||
FinalizeExportThread();
|
|
||||||
if(IsExportSucceeded())
|
|
||||||
{
|
|
||||||
s_BackupState = EXPORT_TWL_SOUND;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
s_BackupState = FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
// TWLサウンド領域の吸出し中
|
|
||||||
case EXPORT_TWL_SOUND:
|
|
||||||
{
|
|
||||||
static bool init = true;
|
|
||||||
if(init)
|
|
||||||
{
|
|
||||||
// データを書き込む
|
|
||||||
ExportTwlSoundData();
|
|
||||||
init = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
PutAliveMessage(operationMessage, "Exporting TWL Sound Data");
|
|
||||||
|
|
||||||
// 処理が完了した
|
|
||||||
if (IsExportThreadFinished())
|
|
||||||
{
|
|
||||||
FinalizeExportThread();
|
|
||||||
if(IsExportSucceeded())
|
|
||||||
{
|
|
||||||
s_BackupState = EXPORT_TWL_PHOTO;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
s_BackupState = FAIL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
// TWL写真領域の吸出し中
|
|
||||||
case EXPORT_TWL_PHOTO:
|
case EXPORT_TWL_PHOTO:
|
||||||
{
|
|
||||||
static bool init = true;
|
|
||||||
if(init)
|
|
||||||
{
|
{
|
||||||
// データを書き込む
|
static bool init = true;
|
||||||
ExportTwlPhotoData();
|
if (init)
|
||||||
init = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
PutAliveMessage(operationMessage, "Exporting TWL Photo Data");
|
|
||||||
|
|
||||||
// 処理が完了した
|
|
||||||
if (IsExportThreadFinished())
|
|
||||||
{
|
|
||||||
FinalizeExportThread();
|
|
||||||
if(IsExportSucceeded())
|
|
||||||
{
|
{
|
||||||
s_BackupState = EXPORT_CTR_NAND;
|
// データを書き込む
|
||||||
|
ExportTwlPhotoData();
|
||||||
|
init = false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
s_BackupState = FAIL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
// 吸出し中
|
PutAliveMessage(operationMessage, "Exporting TWL Photo Data");
|
||||||
case EXPORT_CTR_NAND:
|
|
||||||
{
|
|
||||||
continueBackup = true;
|
|
||||||
|
|
||||||
// ACアダプタが必要か?
|
|
||||||
if (NeedsAcAdapter(manager))
|
|
||||||
{
|
|
||||||
continueBackup = false;
|
|
||||||
operationMessage.push_back(::std::string("Connect AC Adapter!!"));
|
|
||||||
}
|
|
||||||
|
|
||||||
PutAliveMessage(operationMessage, "Exporting Nand Data");
|
|
||||||
|
|
||||||
// データを書き込む
|
|
||||||
if (!ExportData(manager))
|
|
||||||
{
|
|
||||||
s_BackupState = FAIL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// 処理が完了した
|
// 処理が完了した
|
||||||
if (continueBackup && IsExportThreadFinished())
|
if (IsExportThreadFinished())
|
||||||
{
|
{
|
||||||
FinalizeExportThread();
|
FinalizeExportThread();
|
||||||
if (IsExportSucceeded())
|
if (IsExportSucceeded())
|
||||||
{
|
{
|
||||||
COMMON_LOGGER("Export NAND Data Finished.\n");
|
s_BackupState = EXPORT_CTR_NAND;
|
||||||
|
|
||||||
if (GetExportProgress() > 99)
|
|
||||||
{
|
|
||||||
s_BackupState = DELETE_NIM;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
s_BackupState = FAIL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s_BackupState = FAIL;
|
s_BackupState = FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
// nimのシステムセーブデータ削除
|
// 吸出し中
|
||||||
|
case EXPORT_CTR_NAND:
|
||||||
|
{
|
||||||
|
continueBackup = true;
|
||||||
|
|
||||||
|
// ACアダプタが必要か?
|
||||||
|
if (NeedsAcAdapter(manager))
|
||||||
|
{
|
||||||
|
continueBackup = false;
|
||||||
|
operationMessage.push_back(::std::string("Connect AC Adapter!!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
PutAliveMessage(operationMessage, "Exporting Nand Data");
|
||||||
|
|
||||||
|
// データを書き込む
|
||||||
|
if (!ExportData(manager))
|
||||||
|
{
|
||||||
|
s_BackupState = FAIL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 処理が完了した
|
||||||
|
if (continueBackup && IsExportThreadFinished())
|
||||||
|
{
|
||||||
|
FinalizeExportThread();
|
||||||
|
if (IsExportSucceeded())
|
||||||
|
{
|
||||||
|
COMMON_LOGGER("Export NAND Data Finished.\n");
|
||||||
|
|
||||||
|
if (GetExportProgress() > 99)
|
||||||
|
{
|
||||||
|
s_BackupState = DELETE_NIM;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s_BackupState = FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s_BackupState = FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
// nimのシステムセーブデータ削除
|
||||||
case DELETE_NIM:
|
case DELETE_NIM:
|
||||||
{
|
|
||||||
if(DeleteNimSaveData())
|
|
||||||
{
|
{
|
||||||
s_BackupState = DONE;
|
if (DeleteNimSaveData())
|
||||||
}
|
{
|
||||||
else
|
s_BackupState = DONE;
|
||||||
{
|
}
|
||||||
s_BackupState = FAIL;
|
else
|
||||||
}
|
{
|
||||||
|
s_BackupState = FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// 吸出し完了
|
// 吸出し完了
|
||||||
case DONE:
|
case DONE:
|
||||||
{
|
|
||||||
operationMessage.push_back(::std::string("Backup Done. Pull Out SD Card."));
|
|
||||||
if(!s_PlayedSdPullOutCursor)
|
|
||||||
{
|
{
|
||||||
common::PlaySound(common::SOUND_CURSOR);
|
operationMessage.push_back(::std::string("Backup Done. Pull Out SD Card."));
|
||||||
s_PlayedSdPullOutCursor = true;
|
if (!s_PlayedSdPullOutCursor)
|
||||||
|
{
|
||||||
|
common::PlaySound(common::SOUND_CURSOR);
|
||||||
|
s_PlayedSdPullOutCursor = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
// SDカード抜き完了
|
// SDカード抜き完了
|
||||||
case FINISHED:
|
case FINISHED:
|
||||||
{
|
|
||||||
operationMessage.push_back(::std::string("Backup Succeeded!!\n"));
|
|
||||||
if(!s_PlayedFinishedSound)
|
|
||||||
{
|
{
|
||||||
common::PlaySound(common::SOUND_OK);
|
operationMessage.push_back(::std::string("Backup Succeeded!!\n"));
|
||||||
s_PlayedFinishedSound = true;
|
if (!s_PlayedFinishedSound)
|
||||||
|
{
|
||||||
|
common::PlaySound(common::SOUND_OK);
|
||||||
|
s_PlayedFinishedSound = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
// 吸出し失敗
|
// 吸出し失敗
|
||||||
case FAIL:
|
case FAIL:
|
||||||
{
|
|
||||||
operationMessage.push_back(::std::string("Backup Failed."));
|
|
||||||
if(!s_PlayedFailSound)
|
|
||||||
{
|
{
|
||||||
common::PlaySound(common::SOUND_NG);
|
operationMessage.push_back(::std::string("Backup Failed."));
|
||||||
s_PlayedFailSound = true;
|
if (!s_PlayedFailSound)
|
||||||
|
{
|
||||||
|
common::PlaySound(common::SOUND_NG);
|
||||||
|
s_PlayedFailSound = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
|
case FAIL_CHECK:
|
||||||
|
{
|
||||||
|
operationMessage.push_back(::std::string("Check Error."));
|
||||||
|
if (!s_PlayedFailSound)
|
||||||
|
{
|
||||||
|
common::PlaySound(common::SOUND_NG);
|
||||||
|
s_PlayedFailSound = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -416,6 +445,12 @@ u32 GetProgress()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// バックアップモードを取得する
|
||||||
|
BackupMode GetBackupMode()
|
||||||
|
{
|
||||||
|
return s_BackupMode;
|
||||||
|
}
|
||||||
|
|
||||||
bool InProgress()
|
bool InProgress()
|
||||||
{
|
{
|
||||||
return s_BackupState == EXPORT_CTR_NAND;
|
return s_BackupState == EXPORT_CTR_NAND;
|
||||||
@ -431,13 +466,18 @@ bool IsBackupFailed()
|
|||||||
return s_BackupState == FAIL;
|
return s_BackupState == FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsBackupWarning()
|
||||||
|
{
|
||||||
|
return s_BackupState == FAIL_CHECK;
|
||||||
|
}
|
||||||
|
|
||||||
void OnSdEjected()
|
void OnSdEjected()
|
||||||
{
|
{
|
||||||
if(s_BackupState == DONE || s_BackupState == FINISHED)
|
if(s_BackupState == DONE || s_BackupState == FINISHED)
|
||||||
{
|
{
|
||||||
s_BackupState = FINISHED;
|
s_BackupState = FINISHED;
|
||||||
}
|
}
|
||||||
else if(s_BackupState != FAIL)
|
else if(s_BackupState != FAIL && s_BackupState != FAIL_CHECK)
|
||||||
{
|
{
|
||||||
common::InitializeFileCheck();
|
common::InitializeFileCheck();
|
||||||
InitializeState();
|
InitializeState();
|
||||||
|
|||||||
@ -23,13 +23,21 @@
|
|||||||
namespace ConsoleBackup
|
namespace ConsoleBackup
|
||||||
{
|
{
|
||||||
|
|
||||||
// 状態遷移を管理する
|
typedef enum BackupMode
|
||||||
// manager ハードウェア情報を取得するためのラッパ
|
{
|
||||||
// operationMessage 操作情報として表示したい文字列
|
BACKUP_MODE_CHECK, // セーブデータのチェック後エラーが無ければ吸出し
|
||||||
// nextStep 次の状態に遷移してもよいかどうか
|
BACKUP_MODE_DELETE_IF_FAILED // 読み取りエラーのセーブデータを削除後吸出し
|
||||||
// continueBackup 処理を続けてもよいかどうか
|
|
||||||
|
} BackupMode;
|
||||||
|
|
||||||
|
//! @brief 状態遷移を管理する
|
||||||
|
//! @param[in] manager ハードウェア情報を取得するためのラッパ
|
||||||
|
//! @param[in] operationMessage 操作情報として表示したい文字列
|
||||||
|
//! @param[in] nextStep 次の状態に遷移してもよいかどうか
|
||||||
|
//! @param[in] continueBackup 処理を続けてもよいかどうか
|
||||||
|
//! @param[in] forceDelete チェックエラー発生時に削除を実行してもよいかどうか
|
||||||
void ControlState(common::HardwareStateManager& manager, ::std::vector<std::string>& operationMessage, bool& nextStep,
|
void ControlState(common::HardwareStateManager& manager, ::std::vector<std::string>& operationMessage, bool& nextStep,
|
||||||
bool& continueBackup);
|
bool& continueBackup, bool forceDelete);
|
||||||
|
|
||||||
// バックアップ処理中かどうか
|
// バックアップ処理中かどうか
|
||||||
bool InProgress();
|
bool InProgress();
|
||||||
@ -40,6 +48,9 @@ bool IsBackupSucceeded();
|
|||||||
// バックアップが失敗したかどうか
|
// バックアップが失敗したかどうか
|
||||||
bool IsBackupFailed();
|
bool IsBackupFailed();
|
||||||
|
|
||||||
|
// バックアップ時に警告があったかどうか
|
||||||
|
bool IsBackupWarning();
|
||||||
|
|
||||||
// SDカードが抜き出されたときに実行したい関数
|
// SDカードが抜き出されたときに実行したい関数
|
||||||
void OnSdEjected();
|
void OnSdEjected();
|
||||||
|
|
||||||
@ -49,6 +60,9 @@ void InitializeState();
|
|||||||
// 進捗を取得する
|
// 進捗を取得する
|
||||||
u32 GetProgress();
|
u32 GetProgress();
|
||||||
|
|
||||||
|
// バックアップモードを取得する
|
||||||
|
BackupMode GetBackupMode();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONTOROLLER_H_ */
|
#endif /* CONTOROLLER_H_ */
|
||||||
|
|||||||
@ -29,7 +29,7 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
SavedataCheckerBase::SavedataCheckerBase(void* buf, size_t size) :
|
SavedataCheckerBase::SavedataCheckerBase(void* buf, size_t size) :
|
||||||
m_Buf(buf), m_Bufsize(size), m_CalculatedFileSize(0), m_TotalReadSize(0)
|
m_Buf(buf), m_Bufsize(size), m_CalculatedFileSize(0), m_TotalReadSize(0), m_CheckErrorOccured(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -39,7 +39,7 @@ SavedataCheckerBase::~SavedataCheckerBase()
|
|||||||
NN_LOG("m_TotalReadSize = %lld\n", m_TotalReadSize);
|
NN_LOG("m_TotalReadSize = %lld\n", m_TotalReadSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::Result SavedataCheckerBase::CleanUpFilesRecursively(bool* modified, std::wstring currentDirectory)
|
nn::Result SavedataCheckerBase::CleanUpFilesRecursively(bool* modified, std::wstring currentDirectory, bool erase)
|
||||||
{
|
{
|
||||||
nn::fs::Directory dir;
|
nn::fs::Directory dir;
|
||||||
nn::fs::DirectoryEntry entry;
|
nn::fs::DirectoryEntry entry;
|
||||||
@ -49,9 +49,15 @@ nn::Result SavedataCheckerBase::CleanUpFilesRecursively(bool* modified, std::wst
|
|||||||
result = dir.TryInitialize(currentDirectory.c_str());
|
result = dir.TryInitialize(currentDirectory.c_str());
|
||||||
if(result.IsFailure())
|
if(result.IsFailure())
|
||||||
{
|
{
|
||||||
COMMON_LOGGER_WARN("Delete Directory %s\n", common::GetCharStr(currentDirectory.c_str()));
|
COMMON_LOGGER_WARN("Error: %s\n", common::GetCharStr(currentDirectory.c_str()));
|
||||||
result = nn::fs::TryDeleteDirectory(currentDirectory.c_str());
|
m_CheckErrorOccured = true;
|
||||||
*modified = true;
|
if (erase)
|
||||||
|
{
|
||||||
|
COMMON_LOGGER_WARN("Deleting: %s\n", common::GetCharStr(currentDirectory.c_str()));
|
||||||
|
result = nn::fs::TryDeleteDirectory(currentDirectory.c_str());
|
||||||
|
COMMON_LOGGER_RETURN_RESULT_IF_FAILED(result);
|
||||||
|
*modified = true;
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,9 +68,15 @@ nn::Result SavedataCheckerBase::CleanUpFilesRecursively(bool* modified, std::wst
|
|||||||
if(result.IsFailure())
|
if(result.IsFailure())
|
||||||
{
|
{
|
||||||
dir.Finalize();
|
dir.Finalize();
|
||||||
COMMON_LOGGER_WARN("Delete Directory %s\n", common::GetCharStr(currentDirectory.c_str()));
|
COMMON_LOGGER_WARN("Error: %s\n", common::GetCharStr(currentDirectory.c_str()));
|
||||||
result = nn::fs::TryDeleteDirectoryRecursively(currentDirectory.c_str());
|
m_CheckErrorOccured = true;
|
||||||
*modified = true;
|
if (erase)
|
||||||
|
{
|
||||||
|
COMMON_LOGGER_WARN("Deleting: %s\n", common::GetCharStr(currentDirectory.c_str()));
|
||||||
|
result = nn::fs::TryDeleteDirectoryRecursively(currentDirectory.c_str());
|
||||||
|
COMMON_LOGGER_RETURN_RESULT_IF_FAILED(result);
|
||||||
|
*modified = true;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +95,7 @@ nn::Result SavedataCheckerBase::CleanUpFilesRecursively(bool* modified, std::wst
|
|||||||
// ディレクトリの場合
|
// ディレクトリの場合
|
||||||
if (entry.attributes.isDirectory)
|
if (entry.attributes.isDirectory)
|
||||||
{
|
{
|
||||||
return CleanUpFilesRecursively(modified, currentDirectory + std::wstring(entry.entryName) + std::wstring(L"/"));
|
return CleanUpFilesRecursively(modified, currentDirectory + std::wstring(entry.entryName) + std::wstring(L"/"), erase);
|
||||||
}
|
}
|
||||||
// ファイルの場合
|
// ファイルの場合
|
||||||
else
|
else
|
||||||
@ -96,9 +108,14 @@ nn::Result SavedataCheckerBase::CleanUpFilesRecursively(bool* modified, std::wst
|
|||||||
if(result.IsFailure())
|
if(result.IsFailure())
|
||||||
{
|
{
|
||||||
nn::dbg::PrintResult(result);
|
nn::dbg::PrintResult(result);
|
||||||
COMMON_LOGGER_WARN("Cannot Initialize %s, delete.\n", common::GetCharStr(entry.entryName));
|
COMMON_LOGGER_WARN("Error: %s\n", common::GetCharStr(path));
|
||||||
result = nn::fs::TryDeleteFile(path);
|
m_CheckErrorOccured = true;
|
||||||
*modified = true;
|
if (erase)
|
||||||
|
{
|
||||||
|
COMMON_LOGGER_WARN("Deleting: %s\n", common::GetCharStr(path));
|
||||||
|
result = nn::fs::TryDeleteFile(path);
|
||||||
|
*modified = true;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,12 +126,17 @@ nn::Result SavedataCheckerBase::CleanUpFilesRecursively(bool* modified, std::wst
|
|||||||
if(result.IsFailure())
|
if(result.IsFailure())
|
||||||
{
|
{
|
||||||
nn::dbg::PrintResult(result);
|
nn::dbg::PrintResult(result);
|
||||||
COMMON_LOGGER_WARN("Cannot read %s, delete.\n", common::GetCharStr(entry.entryName));
|
COMMON_LOGGER_WARN("Error: %s\n", common::GetCharStr(path));
|
||||||
m_TotalReadSize += file.GetSize();
|
m_TotalReadSize += file.GetSize();
|
||||||
file.Finalize();
|
file.Finalize();
|
||||||
result = nn::fs::TryDeleteFile(path);
|
m_CheckErrorOccured = true;
|
||||||
COMMON_LOGGER_RESULT_IF_FAILED(result);
|
if (erase)
|
||||||
*modified = true;
|
{
|
||||||
|
COMMON_LOGGER_WARN("Deleting: %s\n", common::GetCharStr(path));
|
||||||
|
result = nn::fs::TryDeleteFile(path);
|
||||||
|
COMMON_LOGGER_RESULT_IF_FAILED(result);
|
||||||
|
*modified = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -202,6 +224,11 @@ s64 SavedataCheckerBase::GetTotalReadSize()
|
|||||||
return m_TotalReadSize;
|
return m_TotalReadSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SavedataCheckerBase::GetCheckErrorOccured()
|
||||||
|
{
|
||||||
|
return m_CheckErrorOccured;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NandSavedataChecker::NandSavedataChecker()
|
NandSavedataChecker::NandSavedataChecker()
|
||||||
{
|
{
|
||||||
@ -221,17 +248,17 @@ NandSavedataChecker::~NandSavedataChecker()
|
|||||||
delete m_pSysSaveChecker;
|
delete m_pSysSaveChecker;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::Result NandSavedataChecker::CleanUp()
|
nn::Result NandSavedataChecker::CleanUp(bool erase)
|
||||||
{
|
{
|
||||||
nn::Result result;
|
nn::Result result;
|
||||||
|
|
||||||
m_pSharedExtSaveChecker->CalculateFileSize();
|
m_pSharedExtSaveChecker->CalculateFileSize();
|
||||||
m_pSysSaveChecker->CalculateFileSize();
|
m_pSysSaveChecker->CalculateFileSize();
|
||||||
|
|
||||||
result = m_pSharedExtSaveChecker->CleanUp();
|
result = m_pSharedExtSaveChecker->CleanUp(erase);
|
||||||
COMMON_LOGGER_RETURN_RESULT_IF_FAILED(result);
|
COMMON_LOGGER_RETURN_RESULT_IF_FAILED(result);
|
||||||
|
|
||||||
result = m_pSysSaveChecker->CleanUp();
|
result = m_pSysSaveChecker->CleanUp(erase);
|
||||||
COMMON_LOGGER_RETURN_RESULT_IF_FAILED(result);
|
COMMON_LOGGER_RETURN_RESULT_IF_FAILED(result);
|
||||||
|
|
||||||
return nn::ResultSuccess();
|
return nn::ResultSuccess();
|
||||||
@ -250,6 +277,11 @@ s64 NandSavedataChecker::GetProgress()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NandSavedataChecker::GetCheckErrorOccured()
|
||||||
|
{
|
||||||
|
return m_pSharedExtSaveChecker->GetCheckErrorOccured() || m_pSysSaveChecker->GetCheckErrorOccured();
|
||||||
|
}
|
||||||
|
|
||||||
SystemSavedataChecker::SystemSavedataChecker()
|
SystemSavedataChecker::SystemSavedataChecker()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -266,7 +298,7 @@ SystemSavedataChecker::~SystemSavedataChecker()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
nn::Result SystemSavedataChecker::CleanUp()
|
nn::Result SystemSavedataChecker::CleanUp(bool erase)
|
||||||
{
|
{
|
||||||
nn::Result result;
|
nn::Result result;
|
||||||
|
|
||||||
@ -280,17 +312,24 @@ nn::Result SystemSavedataChecker::CleanUp()
|
|||||||
if(result <= nn::fs::ResultVerificationFailed())
|
if(result <= nn::fs::ResultVerificationFailed())
|
||||||
{
|
{
|
||||||
NN_LOG("Mount Error: %ls\n", SYSTEM_SAVEDATA_COUPLE_LIST[i].name.c_str());
|
NN_LOG("Mount Error: %ls\n", SYSTEM_SAVEDATA_COUPLE_LIST[i].name.c_str());
|
||||||
// 削除する
|
COMMON_LOGGER_WARN(
|
||||||
COMMON_LOGGER_WARN("Delete Savedata %s\n", common::GetCharStr(SYSTEM_SAVEDATA_COUPLE_LIST[i].name.c_str()));
|
"Error Savedata %s\n", common::GetCharStr(SYSTEM_SAVEDATA_COUPLE_LIST[i].name.c_str()));
|
||||||
result = nn::fs::DeleteSystemSaveData(SYSTEM_SAVEDATA_COUPLE_LIST[i].id);
|
m_CheckErrorOccured = true;
|
||||||
COMMON_LOGGER_RETURN_RESULT_IF_FAILED(result);
|
if (erase)
|
||||||
|
{
|
||||||
|
COMMON_LOGGER_WARN(
|
||||||
|
"Deleting Savedata %s\n", common::GetCharStr(SYSTEM_SAVEDATA_COUPLE_LIST[i].name.c_str()));
|
||||||
|
// 削除する
|
||||||
|
result = nn::fs::DeleteSystemSaveData(SYSTEM_SAVEDATA_COUPLE_LIST[i].id);
|
||||||
|
COMMON_LOGGER_RETURN_RESULT_IF_FAILED(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NN_LOG("Mount %ls\n", SYSTEM_SAVEDATA_COUPLE_LIST[i].name.c_str());
|
NN_LOG("Mount %ls\n", SYSTEM_SAVEDATA_COUPLE_LIST[i].name.c_str());
|
||||||
// ファイルを個別にチェックする
|
// ファイルを個別にチェックする
|
||||||
result = CleanUpFilesRecursively(&modified, L"ssave:/");
|
result = CleanUpFilesRecursively(&modified, L"ssave:/", erase);
|
||||||
COMMON_LOGGER_RETURN_RESULT_IF_FAILED(result);
|
COMMON_LOGGER_RETURN_RESULT_IF_FAILED(result);
|
||||||
|
|
||||||
if(modified)
|
if(modified)
|
||||||
@ -342,7 +381,7 @@ SharedExtSavedataChecker::~SharedExtSavedataChecker()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::Result SharedExtSavedataChecker::CleanUp()
|
nn::Result SharedExtSavedataChecker::CleanUp(bool erase)
|
||||||
{
|
{
|
||||||
nn::Result result;
|
nn::Result result;
|
||||||
|
|
||||||
@ -362,7 +401,7 @@ nn::Result SharedExtSavedataChecker::CleanUp()
|
|||||||
NN_LOG("Mount %x\n", IdArray[i]);
|
NN_LOG("Mount %x\n", IdArray[i]);
|
||||||
|
|
||||||
// アーカイブ内のファイル・ディレクトリをチェックする
|
// アーカイブ内のファイル・ディレクトリをチェックする
|
||||||
result = CleanUpFilesRecursively(&modified, L"shext:/");
|
result = CleanUpFilesRecursively(&modified, L"shext:/", erase);
|
||||||
COMMON_LOGGER_RETURN_RESULT_IF_FAILED(result);
|
COMMON_LOGGER_RETURN_RESULT_IF_FAILED(result);
|
||||||
|
|
||||||
result = nn::fs::Unmount(SHARED_EXT_SAVEDATA_ARCHIVE_NAME);
|
result = nn::fs::Unmount(SHARED_EXT_SAVEDATA_ARCHIVE_NAME);
|
||||||
@ -375,10 +414,14 @@ nn::Result SharedExtSavedataChecker::CleanUp()
|
|||||||
{
|
{
|
||||||
NN_LOG("Mount Error: %x\n", IdArray[i]);
|
NN_LOG("Mount Error: %x\n", IdArray[i]);
|
||||||
|
|
||||||
// 削除する
|
COMMON_LOGGER_WARN("Error Shared-Ext-Savedata %x\n", IdArray[i]);
|
||||||
COMMON_LOGGER_WARN("Delete Shared-Ext-Savedata %x\n", IdArray[i]);
|
m_CheckErrorOccured = true;
|
||||||
result = nn::fs::DeleteSharedExtSaveData(IdArray[i]);
|
if (erase)
|
||||||
COMMON_LOGGER_RETURN_RESULT_IF_FAILED(result);
|
{
|
||||||
|
COMMON_LOGGER_WARN("Deleting Shared-Ext-Savedata %x\n", IdArray[i]);
|
||||||
|
result = nn::fs::DeleteSharedExtSaveData(IdArray[i]);
|
||||||
|
COMMON_LOGGER_RETURN_RESULT_IF_FAILED(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -121,7 +121,10 @@ public:
|
|||||||
SavedataCheckerBase(void* buf, size_t size);
|
SavedataCheckerBase(void* buf, size_t size);
|
||||||
~SavedataCheckerBase();
|
~SavedataCheckerBase();
|
||||||
|
|
||||||
virtual nn::Result CleanUp() = 0;
|
//! @brief セーブデータを調べて問題があるファイルを削除するインタフェース
|
||||||
|
//! @param[in] erase 問題があるファイルを削除するかどうか
|
||||||
|
virtual nn::Result CleanUp(bool erase) = 0;
|
||||||
|
//! @brief ファイルサイズをチェックするインタフェース
|
||||||
virtual nn::Result CalculateFileSize() = 0;
|
virtual nn::Result CalculateFileSize() = 0;
|
||||||
|
|
||||||
//! @return 事前に計算したサイズ
|
//! @return 事前に計算したサイズ
|
||||||
@ -130,11 +133,16 @@ public:
|
|||||||
//! @return 読み取ったサイズ
|
//! @return 読み取ったサイズ
|
||||||
s64 GetTotalReadSize();
|
s64 GetTotalReadSize();
|
||||||
|
|
||||||
|
//! @brief チェック時にエラーが起こったかどうか調べる
|
||||||
|
//! @return エラーが起こったかどうか
|
||||||
|
bool GetCheckErrorOccured();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! @brief ファイルとディレクトリを再帰的にチェックする。エラーがあれば削除する
|
//! @brief ファイルとディレクトリを再帰的にチェックする。エラーがあれば削除する
|
||||||
//! @param[out] modified ファイルかディレクトリを削除したかどうか
|
//! @param[out] modified ファイルかディレクトリを削除したかどうか
|
||||||
//! @param[in] currentDirectory チェックを開始するディレクトリ。スラッシュで終端すること。
|
//! @param[in] currentDirectory チェックを開始するディレクトリ。スラッシュで終端すること。
|
||||||
nn::Result CleanUpFilesRecursively(bool* modified, std::wstring currentDirectory);
|
//! @param[in] erase ファイルかディレクトリを削除するかどうか
|
||||||
|
nn::Result CleanUpFilesRecursively(bool* modified, std::wstring currentDirectory, bool erase);
|
||||||
|
|
||||||
//! @brief ファイルサイズを取得する
|
//! @brief ファイルサイズを取得する
|
||||||
//! @param[out] size ファイルサイズ
|
//! @param[out] size ファイルサイズ
|
||||||
@ -154,6 +162,10 @@ protected:
|
|||||||
//! 累計読み取りサイズ
|
//! 累計読み取りサイズ
|
||||||
s64 m_TotalReadSize;
|
s64 m_TotalReadSize;
|
||||||
|
|
||||||
|
NN_PADDING3;
|
||||||
|
//! @brief チェック時にエラーが起こったかどうか
|
||||||
|
bool m_CheckErrorOccured;
|
||||||
|
NN_PADDING4;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -166,7 +178,8 @@ public:
|
|||||||
~SystemSavedataChecker();
|
~SystemSavedataChecker();
|
||||||
|
|
||||||
//! @brief システムセーブデータを調べて問題があるファイルを削除する
|
//! @brief システムセーブデータを調べて問題があるファイルを削除する
|
||||||
virtual nn::Result CleanUp();
|
//! @param[in] erase 問題があるファイルを削除するかどうか
|
||||||
|
virtual nn::Result CleanUp(bool erase);
|
||||||
|
|
||||||
//! @brief ファイルサイズをチェックする
|
//! @brief ファイルサイズをチェックする
|
||||||
virtual nn::Result CalculateFileSize();
|
virtual nn::Result CalculateFileSize();
|
||||||
@ -181,7 +194,8 @@ public:
|
|||||||
~SharedExtSavedataChecker();
|
~SharedExtSavedataChecker();
|
||||||
|
|
||||||
//! @brief 共有拡張セーブデータを調べて問題があるファイルを削除する
|
//! @brief 共有拡張セーブデータを調べて問題があるファイルを削除する
|
||||||
virtual nn::Result CleanUp();
|
//! @param[in] erase 問題があるファイルを削除するかどうか
|
||||||
|
virtual nn::Result CleanUp(bool erase);
|
||||||
|
|
||||||
//! @brief ファイルサイズをチェックする
|
//! @brief ファイルサイズをチェックする
|
||||||
virtual nn::Result CalculateFileSize();
|
virtual nn::Result CalculateFileSize();
|
||||||
@ -195,10 +209,12 @@ public:
|
|||||||
NandSavedataChecker(void* buf, size_t size);
|
NandSavedataChecker(void* buf, size_t size);
|
||||||
~NandSavedataChecker();
|
~NandSavedataChecker();
|
||||||
|
|
||||||
nn::Result CleanUp();
|
nn::Result CleanUp(bool erase);
|
||||||
|
|
||||||
s64 GetProgress();
|
s64 GetProgress();
|
||||||
|
|
||||||
|
bool GetCheckErrorOccured();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SharedExtSavedataChecker* m_pSharedExtSaveChecker;
|
SharedExtSavedataChecker* m_pSharedExtSaveChecker;
|
||||||
SystemSavedataChecker* m_pSysSaveChecker;
|
SystemSavedataChecker* m_pSysSaveChecker;
|
||||||
|
|||||||
@ -286,6 +286,7 @@ extern "C" void nnMain(void)
|
|||||||
GetProgress(),
|
GetProgress(),
|
||||||
IsRestoreFailed(),
|
IsRestoreFailed(),
|
||||||
IsRestoreSucceeded(),
|
IsRestoreSucceeded(),
|
||||||
|
false,
|
||||||
s_HwUtility.GetMacAddress(),
|
s_HwUtility.GetMacAddress(),
|
||||||
operationMessage,
|
operationMessage,
|
||||||
s_HwUtility.GetRegion(),
|
s_HwUtility.GetRegion(),
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
#define COMMON_LOGGER( ... ) (void)common::Logger::GetLoggerInstance()->Print(__VA_ARGS__)
|
#define COMMON_LOGGER( ... ) (void)common::Logger::GetLoggerInstance()->Print(__VA_ARGS__)
|
||||||
|
|
||||||
#define COMMON_LOGGER_WARN( ... ) \
|
#define COMMON_LOGGER_WARN( ... ) \
|
||||||
(void)common::Logger::GetLoggerInstance()->SetTextColor(1.0f, 1.0f, 0.f, 1.f); \
|
(void)common::Logger::GetLoggerInstance()->SetTextColor(1.0f, 0.f, 0.f, 1.f); \
|
||||||
(void)common::Logger::GetLoggerInstance()->Print(__VA_ARGS__); \
|
(void)common::Logger::GetLoggerInstance()->Print(__VA_ARGS__); \
|
||||||
(void)common::Logger::GetLoggerInstance()->SetTextColor(1.0f, 1.0f, 1.f, 1.f); \
|
(void)common::Logger::GetLoggerInstance()->SetTextColor(1.0f, 1.0f, 1.f, 1.f); \
|
||||||
|
|
||||||
|
|||||||
@ -107,8 +107,9 @@ void DrawSystemState
|
|||||||
u64 deviceId,
|
u64 deviceId,
|
||||||
u64 friendCode,
|
u64 friendCode,
|
||||||
u32 progress,
|
u32 progress,
|
||||||
bool isBackupFailed,
|
bool isProcessFailed,
|
||||||
bool isBackupSucceeded,
|
bool isProcessSucceeded,
|
||||||
|
bool isProcessWarning,
|
||||||
char8* macAddress,
|
char8* macAddress,
|
||||||
::std::vector<std::string>& operationMessage,
|
::std::vector<std::string>& operationMessage,
|
||||||
nn::cfg::CTR::CfgRegionCode region,
|
nn::cfg::CTR::CfgRegionCode region,
|
||||||
@ -137,11 +138,15 @@ void DrawSystemState
|
|||||||
|
|
||||||
// デフォルトで上画面に描画するもの
|
// デフォルトで上画面に描画するもの
|
||||||
renderSystem.SetRenderTarget(GetRenderTarget(NN_GX_DISPLAY0, flip));
|
renderSystem.SetRenderTarget(GetRenderTarget(NN_GX_DISPLAY0, flip));
|
||||||
if (isBackupSucceeded)
|
if (isProcessSucceeded)
|
||||||
{
|
{
|
||||||
renderSystem.SetClearColor(GetRenderTarget(NN_GX_DISPLAY0, flip), SUCCESS_COLOR);
|
renderSystem.SetClearColor(GetRenderTarget(NN_GX_DISPLAY0, flip), SUCCESS_COLOR);
|
||||||
}
|
}
|
||||||
else if (isBackupFailed)
|
if (isProcessWarning)
|
||||||
|
{
|
||||||
|
renderSystem.SetClearColor(GetRenderTarget(NN_GX_DISPLAY0, flip), WARN_COLOR);
|
||||||
|
}
|
||||||
|
else if (isProcessFailed)
|
||||||
{
|
{
|
||||||
renderSystem.SetClearColor(GetRenderTarget(NN_GX_DISPLAY0, flip), FAIL_COLOR);
|
renderSystem.SetClearColor(GetRenderTarget(NN_GX_DISPLAY0, flip), FAIL_COLOR);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,6 +39,7 @@
|
|||||||
#define SUCCESS_COLOR 0.f, 0.6f,0.f, 1.f
|
#define SUCCESS_COLOR 0.f, 0.6f,0.f, 1.f
|
||||||
#define FAIL_COLOR 0.6f, 0.f,0.f, 1.f
|
#define FAIL_COLOR 0.6f, 0.f,0.f, 1.f
|
||||||
#define NORMAL_COLOR 0.f, 0.f, 0.f, 1.f
|
#define NORMAL_COLOR 0.f, 0.f, 0.f, 1.f
|
||||||
|
#define WARN_COLOR 0.43f, 0.43f, 0.f, 1.f
|
||||||
|
|
||||||
namespace common
|
namespace common
|
||||||
{
|
{
|
||||||
@ -66,8 +67,9 @@ void DrawSystemState
|
|||||||
u64 deviceId,
|
u64 deviceId,
|
||||||
u64 friendCode,
|
u64 friendCode,
|
||||||
u32 progress,
|
u32 progress,
|
||||||
bool isBackupFailed,
|
bool isProcessFailed,
|
||||||
bool isBackupSucceeded,
|
bool isProcessSucceeded,
|
||||||
|
bool isProcessWarning,
|
||||||
char8* macAddress,
|
char8* macAddress,
|
||||||
::std::vector<std::string>& operationMessage,
|
::std::vector<std::string>& operationMessage,
|
||||||
nn::cfg::CTR::CfgRegionCode region,
|
nn::cfg::CTR::CfgRegionCode region,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user