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::Result s_CheckerResult;
|
||||
NandSavedataChecker* s_pChecker;
|
||||
bool s_CheckErrorOccured = false;
|
||||
|
||||
}
|
||||
|
||||
@ -47,7 +48,7 @@ s32 GetCheckSaveDataProgress()
|
||||
|
||||
}
|
||||
|
||||
void CheckSaveDataThreadFunc()
|
||||
void CheckSaveDataThreadFunc(bool erase)
|
||||
{
|
||||
size_t bufSize = common::GetAllocatableSize();
|
||||
if(bufSize > common::FILE_COPY_HEAP_SIZE)
|
||||
@ -58,7 +59,7 @@ void CheckSaveDataThreadFunc()
|
||||
if (heap.GetAddr() != NULL)
|
||||
{
|
||||
s_pChecker = new NandSavedataChecker(heap.GetAddr(), bufSize);
|
||||
s_CheckerResult = s_pChecker->CleanUp();
|
||||
s_CheckerResult = s_pChecker->CleanUp(erase);
|
||||
}
|
||||
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()
|
||||
@ -85,10 +86,16 @@ void FinalizeSaveDataCheck()
|
||||
|
||||
if(s_pChecker != NULL)
|
||||
{
|
||||
s_CheckErrorOccured = s_pChecker->GetCheckErrorOccured();
|
||||
delete s_pChecker;
|
||||
}
|
||||
}
|
||||
|
||||
bool CheckSaveDataErrorOccured()
|
||||
{
|
||||
return s_CheckErrorOccured;
|
||||
}
|
||||
|
||||
bool CheckSaveDataSucceeded()
|
||||
{
|
||||
COMMON_LOGGER_RETURN_FALSE_IF_FAILED(s_CheckerResult);
|
||||
|
||||
@ -20,9 +20,12 @@ namespace ConsoleBackup
|
||||
{
|
||||
|
||||
s32 GetCheckSaveDataProgress();
|
||||
void StartSaveDataCheck();
|
||||
//!@ brief セーブデータのチェックを開始する
|
||||
//!@ param[in] erase エラー発生時にファイルを削除するかどうか
|
||||
void StartSaveDataCheck(bool erase);
|
||||
bool IsCheckSaveDataFinished();
|
||||
void FinalizeSaveDataCheck();
|
||||
bool CheckSaveDataErrorOccured();
|
||||
bool CheckSaveDataSucceeded();
|
||||
|
||||
}
|
||||
|
||||
@ -155,6 +155,7 @@ extern "C" void nnMain(void)
|
||||
|
||||
bool flip = false;
|
||||
bool continueBackup = false;
|
||||
bool forceDelete = false;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
@ -166,6 +167,10 @@ extern "C" void nnMain(void)
|
||||
padStatus.trigger & nn::hid::BUTTON_START)
|
||||
{
|
||||
nextStep = true;
|
||||
if(padStatus.hold & nn::hid::BUTTON_LEFT)
|
||||
{
|
||||
forceDelete = true;
|
||||
}
|
||||
}
|
||||
|
||||
// LまたはRボタンで上下画面フリップ
|
||||
@ -214,7 +219,7 @@ extern "C" void nnMain(void)
|
||||
// 進捗確認メッセージを兼ねる?
|
||||
::std::vector<std::string> operationMessage;
|
||||
|
||||
ControlState(manager, operationMessage, nextStep, continueBackup);
|
||||
ControlState(manager, operationMessage, nextStep, continueBackup, forceDelete);
|
||||
|
||||
nn::util::FloatColor titleColor;
|
||||
|
||||
@ -239,6 +244,7 @@ extern "C" void nnMain(void)
|
||||
GetProgress(),
|
||||
IsBackupFailed(),
|
||||
IsBackupSucceeded(),
|
||||
IsBackupWarning(),
|
||||
s_HwUtility.GetMacAddress(),
|
||||
operationMessage,
|
||||
s_HwUtility.GetRegion(),
|
||||
@ -246,6 +252,20 @@ extern "C" void nnMain(void)
|
||||
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();
|
||||
|
||||
// デフォルトで下画面に描画するもの
|
||||
@ -254,7 +274,11 @@ extern "C" void nnMain(void)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
@ -39,10 +39,16 @@ typedef enum BackupState
|
||||
DELETE_NIM, // nimのシステムセーブデータ削除
|
||||
DONE, // 吸出し完了
|
||||
FINISHED, // SDカード抜き完了
|
||||
FAIL // 失敗
|
||||
FAIL, // 失敗
|
||||
FAIL_CHECK, // セーブデータのチェック時エラー
|
||||
|
||||
STATE_MAX
|
||||
} BackupState;
|
||||
|
||||
|
||||
// Backupモード管理
|
||||
BackupMode s_BackupMode = BACKUP_MODE_CHECK;
|
||||
|
||||
// APSettingの書式が無い警告サウンドを鳴らしたかどうか
|
||||
bool s_ExistAPSettingAnnotation = false;
|
||||
// SDに書き込みできない警告サウンドを鳴らしたかどうか
|
||||
@ -85,7 +91,7 @@ bool NeedsAcAdapter(common::HardwareStateManager& manager)
|
||||
}
|
||||
|
||||
void ControlState(common::HardwareStateManager& manager, ::std::vector<std::string>& operationMessage, bool& nextStep,
|
||||
bool& continueBackup)
|
||||
bool& continueBackup, bool forceDelete)
|
||||
{
|
||||
// 状態遷移Controller
|
||||
switch (s_BackupState)
|
||||
@ -172,6 +178,10 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
{
|
||||
COMMON_LOGGER("Checking SaveData\n");
|
||||
|
||||
if(forceDelete)
|
||||
{
|
||||
s_BackupMode = BACKUP_MODE_DELETE_IF_FAILED;
|
||||
}
|
||||
s_BackupState = CHECK_SAVEDATA;
|
||||
}
|
||||
}
|
||||
@ -183,7 +193,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
static bool init = true;
|
||||
if (init)
|
||||
{
|
||||
StartSaveDataCheck();
|
||||
StartSaveDataCheck(s_BackupMode == BACKUP_MODE_DELETE_IF_FAILED);
|
||||
init = false;
|
||||
}
|
||||
|
||||
@ -192,6 +202,13 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
if (IsCheckSaveDataFinished())
|
||||
{
|
||||
FinalizeSaveDataCheck();
|
||||
// 削除モードでなければエラーにする
|
||||
if (CheckSaveDataErrorOccured() && !forceDelete)
|
||||
{
|
||||
s_BackupState = FAIL_CHECK;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CheckSaveDataSucceeded())
|
||||
{
|
||||
COMMON_LOGGER("Start Export Data\n");
|
||||
@ -204,6 +221,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@ -401,6 +419,17 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
}
|
||||
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()
|
||||
{
|
||||
return s_BackupState == EXPORT_CTR_NAND;
|
||||
@ -431,13 +466,18 @@ bool IsBackupFailed()
|
||||
return s_BackupState == FAIL;
|
||||
}
|
||||
|
||||
bool IsBackupWarning()
|
||||
{
|
||||
return s_BackupState == FAIL_CHECK;
|
||||
}
|
||||
|
||||
void OnSdEjected()
|
||||
{
|
||||
if(s_BackupState == DONE || s_BackupState == FINISHED)
|
||||
{
|
||||
s_BackupState = FINISHED;
|
||||
}
|
||||
else if(s_BackupState != FAIL)
|
||||
else if(s_BackupState != FAIL && s_BackupState != FAIL_CHECK)
|
||||
{
|
||||
common::InitializeFileCheck();
|
||||
InitializeState();
|
||||
|
||||
@ -23,13 +23,21 @@
|
||||
namespace ConsoleBackup
|
||||
{
|
||||
|
||||
// 状態遷移を管理する
|
||||
// manager ハードウェア情報を取得するためのラッパ
|
||||
// operationMessage 操作情報として表示したい文字列
|
||||
// nextStep 次の状態に遷移してもよいかどうか
|
||||
// continueBackup 処理を続けてもよいかどうか
|
||||
typedef enum BackupMode
|
||||
{
|
||||
BACKUP_MODE_CHECK, // セーブデータのチェック後エラーが無ければ吸出し
|
||||
BACKUP_MODE_DELETE_IF_FAILED // 読み取りエラーのセーブデータを削除後吸出し
|
||||
|
||||
} 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,
|
||||
bool& continueBackup);
|
||||
bool& continueBackup, bool forceDelete);
|
||||
|
||||
// バックアップ処理中かどうか
|
||||
bool InProgress();
|
||||
@ -40,6 +48,9 @@ bool IsBackupSucceeded();
|
||||
// バックアップが失敗したかどうか
|
||||
bool IsBackupFailed();
|
||||
|
||||
// バックアップ時に警告があったかどうか
|
||||
bool IsBackupWarning();
|
||||
|
||||
// SDカードが抜き出されたときに実行したい関数
|
||||
void OnSdEjected();
|
||||
|
||||
@ -49,6 +60,9 @@ void InitializeState();
|
||||
// 進捗を取得する
|
||||
u32 GetProgress();
|
||||
|
||||
// バックアップモードを取得する
|
||||
BackupMode GetBackupMode();
|
||||
|
||||
}
|
||||
|
||||
#endif /* CONTOROLLER_H_ */
|
||||
|
||||
@ -29,7 +29,7 @@ namespace
|
||||
}
|
||||
|
||||
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::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::DirectoryEntry entry;
|
||||
@ -49,9 +49,15 @@ nn::Result SavedataCheckerBase::CleanUpFilesRecursively(bool* modified, std::wst
|
||||
result = dir.TryInitialize(currentDirectory.c_str());
|
||||
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()));
|
||||
m_CheckErrorOccured = 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;
|
||||
}
|
||||
|
||||
@ -62,9 +68,15 @@ nn::Result SavedataCheckerBase::CleanUpFilesRecursively(bool* modified, std::wst
|
||||
if(result.IsFailure())
|
||||
{
|
||||
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()));
|
||||
m_CheckErrorOccured = 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;
|
||||
}
|
||||
|
||||
@ -83,7 +95,7 @@ nn::Result SavedataCheckerBase::CleanUpFilesRecursively(bool* modified, std::wst
|
||||
// ディレクトリの場合
|
||||
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
|
||||
@ -96,9 +108,14 @@ nn::Result SavedataCheckerBase::CleanUpFilesRecursively(bool* modified, std::wst
|
||||
if(result.IsFailure())
|
||||
{
|
||||
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));
|
||||
m_CheckErrorOccured = true;
|
||||
if (erase)
|
||||
{
|
||||
COMMON_LOGGER_WARN("Deleting: %s\n", common::GetCharStr(path));
|
||||
result = nn::fs::TryDeleteFile(path);
|
||||
*modified = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -109,12 +126,17 @@ nn::Result SavedataCheckerBase::CleanUpFilesRecursively(bool* modified, std::wst
|
||||
if(result.IsFailure())
|
||||
{
|
||||
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();
|
||||
file.Finalize();
|
||||
m_CheckErrorOccured = true;
|
||||
if (erase)
|
||||
{
|
||||
COMMON_LOGGER_WARN("Deleting: %s\n", common::GetCharStr(path));
|
||||
result = nn::fs::TryDeleteFile(path);
|
||||
COMMON_LOGGER_RESULT_IF_FAILED(result);
|
||||
*modified = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
@ -202,6 +224,11 @@ s64 SavedataCheckerBase::GetTotalReadSize()
|
||||
return m_TotalReadSize;
|
||||
}
|
||||
|
||||
bool SavedataCheckerBase::GetCheckErrorOccured()
|
||||
{
|
||||
return m_CheckErrorOccured;
|
||||
}
|
||||
|
||||
|
||||
NandSavedataChecker::NandSavedataChecker()
|
||||
{
|
||||
@ -221,17 +248,17 @@ NandSavedataChecker::~NandSavedataChecker()
|
||||
delete m_pSysSaveChecker;
|
||||
}
|
||||
|
||||
nn::Result NandSavedataChecker::CleanUp()
|
||||
nn::Result NandSavedataChecker::CleanUp(bool erase)
|
||||
{
|
||||
nn::Result result;
|
||||
|
||||
m_pSharedExtSaveChecker->CalculateFileSize();
|
||||
m_pSysSaveChecker->CalculateFileSize();
|
||||
|
||||
result = m_pSharedExtSaveChecker->CleanUp();
|
||||
result = m_pSharedExtSaveChecker->CleanUp(erase);
|
||||
COMMON_LOGGER_RETURN_RESULT_IF_FAILED(result);
|
||||
|
||||
result = m_pSysSaveChecker->CleanUp();
|
||||
result = m_pSysSaveChecker->CleanUp(erase);
|
||||
COMMON_LOGGER_RETURN_RESULT_IF_FAILED(result);
|
||||
|
||||
return nn::ResultSuccess();
|
||||
@ -250,6 +277,11 @@ s64 NandSavedataChecker::GetProgress()
|
||||
}
|
||||
}
|
||||
|
||||
bool NandSavedataChecker::GetCheckErrorOccured()
|
||||
{
|
||||
return m_pSharedExtSaveChecker->GetCheckErrorOccured() || m_pSysSaveChecker->GetCheckErrorOccured();
|
||||
}
|
||||
|
||||
SystemSavedataChecker::SystemSavedataChecker()
|
||||
{
|
||||
|
||||
@ -266,7 +298,7 @@ SystemSavedataChecker::~SystemSavedataChecker()
|
||||
|
||||
|
||||
|
||||
nn::Result SystemSavedataChecker::CleanUp()
|
||||
nn::Result SystemSavedataChecker::CleanUp(bool erase)
|
||||
{
|
||||
nn::Result result;
|
||||
|
||||
@ -280,17 +312,24 @@ nn::Result SystemSavedataChecker::CleanUp()
|
||||
if(result <= nn::fs::ResultVerificationFailed())
|
||||
{
|
||||
NN_LOG("Mount Error: %ls\n", SYSTEM_SAVEDATA_COUPLE_LIST[i].name.c_str());
|
||||
COMMON_LOGGER_WARN(
|
||||
"Error Savedata %s\n", common::GetCharStr(SYSTEM_SAVEDATA_COUPLE_LIST[i].name.c_str()));
|
||||
m_CheckErrorOccured = true;
|
||||
if (erase)
|
||||
{
|
||||
COMMON_LOGGER_WARN(
|
||||
"Deleting Savedata %s\n", common::GetCharStr(SYSTEM_SAVEDATA_COUPLE_LIST[i].name.c_str()));
|
||||
// 削除する
|
||||
COMMON_LOGGER_WARN("Delete 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
|
||||
{
|
||||
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);
|
||||
|
||||
if(modified)
|
||||
@ -342,7 +381,7 @@ SharedExtSavedataChecker::~SharedExtSavedataChecker()
|
||||
|
||||
}
|
||||
|
||||
nn::Result SharedExtSavedataChecker::CleanUp()
|
||||
nn::Result SharedExtSavedataChecker::CleanUp(bool erase)
|
||||
{
|
||||
nn::Result result;
|
||||
|
||||
@ -362,7 +401,7 @@ nn::Result SharedExtSavedataChecker::CleanUp()
|
||||
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);
|
||||
|
||||
result = nn::fs::Unmount(SHARED_EXT_SAVEDATA_ARCHIVE_NAME);
|
||||
@ -375,13 +414,17 @@ nn::Result SharedExtSavedataChecker::CleanUp()
|
||||
{
|
||||
NN_LOG("Mount Error: %x\n", IdArray[i]);
|
||||
|
||||
// 削除する
|
||||
COMMON_LOGGER_WARN("Delete Shared-Ext-Savedata %x\n", IdArray[i]);
|
||||
COMMON_LOGGER_WARN("Error Shared-Ext-Savedata %x\n", IdArray[i]);
|
||||
m_CheckErrorOccured = true;
|
||||
if (erase)
|
||||
{
|
||||
COMMON_LOGGER_WARN("Deleting Shared-Ext-Savedata %x\n", IdArray[i]);
|
||||
result = nn::fs::DeleteSharedExtSaveData(IdArray[i]);
|
||||
COMMON_LOGGER_RETURN_RESULT_IF_FAILED(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nn::ResultSuccess();
|
||||
}
|
||||
|
||||
@ -121,7 +121,10 @@ public:
|
||||
SavedataCheckerBase(void* buf, size_t size);
|
||||
~SavedataCheckerBase();
|
||||
|
||||
virtual nn::Result CleanUp() = 0;
|
||||
//! @brief セーブデータを調べて問題があるファイルを削除するインタフェース
|
||||
//! @param[in] erase 問題があるファイルを削除するかどうか
|
||||
virtual nn::Result CleanUp(bool erase) = 0;
|
||||
//! @brief ファイルサイズをチェックするインタフェース
|
||||
virtual nn::Result CalculateFileSize() = 0;
|
||||
|
||||
//! @return 事前に計算したサイズ
|
||||
@ -130,11 +133,16 @@ public:
|
||||
//! @return 読み取ったサイズ
|
||||
s64 GetTotalReadSize();
|
||||
|
||||
//! @brief チェック時にエラーが起こったかどうか調べる
|
||||
//! @return エラーが起こったかどうか
|
||||
bool GetCheckErrorOccured();
|
||||
|
||||
protected:
|
||||
//! @brief ファイルとディレクトリを再帰的にチェックする。エラーがあれば削除する
|
||||
//! @param[out] modified ファイルかディレクトリを削除したかどうか
|
||||
//! @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 ファイルサイズを取得する
|
||||
//! @param[out] size ファイルサイズ
|
||||
@ -154,6 +162,10 @@ protected:
|
||||
//! 累計読み取りサイズ
|
||||
s64 m_TotalReadSize;
|
||||
|
||||
NN_PADDING3;
|
||||
//! @brief チェック時にエラーが起こったかどうか
|
||||
bool m_CheckErrorOccured;
|
||||
NN_PADDING4;
|
||||
};
|
||||
|
||||
|
||||
@ -166,7 +178,8 @@ public:
|
||||
~SystemSavedataChecker();
|
||||
|
||||
//! @brief システムセーブデータを調べて問題があるファイルを削除する
|
||||
virtual nn::Result CleanUp();
|
||||
//! @param[in] erase 問題があるファイルを削除するかどうか
|
||||
virtual nn::Result CleanUp(bool erase);
|
||||
|
||||
//! @brief ファイルサイズをチェックする
|
||||
virtual nn::Result CalculateFileSize();
|
||||
@ -181,7 +194,8 @@ public:
|
||||
~SharedExtSavedataChecker();
|
||||
|
||||
//! @brief 共有拡張セーブデータを調べて問題があるファイルを削除する
|
||||
virtual nn::Result CleanUp();
|
||||
//! @param[in] erase 問題があるファイルを削除するかどうか
|
||||
virtual nn::Result CleanUp(bool erase);
|
||||
|
||||
//! @brief ファイルサイズをチェックする
|
||||
virtual nn::Result CalculateFileSize();
|
||||
@ -195,10 +209,12 @@ public:
|
||||
NandSavedataChecker(void* buf, size_t size);
|
||||
~NandSavedataChecker();
|
||||
|
||||
nn::Result CleanUp();
|
||||
nn::Result CleanUp(bool erase);
|
||||
|
||||
s64 GetProgress();
|
||||
|
||||
bool GetCheckErrorOccured();
|
||||
|
||||
private:
|
||||
SharedExtSavedataChecker* m_pSharedExtSaveChecker;
|
||||
SystemSavedataChecker* m_pSysSaveChecker;
|
||||
|
||||
@ -286,6 +286,7 @@ extern "C" void nnMain(void)
|
||||
GetProgress(),
|
||||
IsRestoreFailed(),
|
||||
IsRestoreSucceeded(),
|
||||
false,
|
||||
s_HwUtility.GetMacAddress(),
|
||||
operationMessage,
|
||||
s_HwUtility.GetRegion(),
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
#define COMMON_LOGGER( ... ) (void)common::Logger::GetLoggerInstance()->Print(__VA_ARGS__)
|
||||
|
||||
#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()->SetTextColor(1.0f, 1.0f, 1.f, 1.f); \
|
||||
|
||||
|
||||
@ -107,8 +107,9 @@ void DrawSystemState
|
||||
u64 deviceId,
|
||||
u64 friendCode,
|
||||
u32 progress,
|
||||
bool isBackupFailed,
|
||||
bool isBackupSucceeded,
|
||||
bool isProcessFailed,
|
||||
bool isProcessSucceeded,
|
||||
bool isProcessWarning,
|
||||
char8* macAddress,
|
||||
::std::vector<std::string>& operationMessage,
|
||||
nn::cfg::CTR::CfgRegionCode region,
|
||||
@ -137,11 +138,15 @@ void DrawSystemState
|
||||
|
||||
// デフォルトで上画面に描画するもの
|
||||
renderSystem.SetRenderTarget(GetRenderTarget(NN_GX_DISPLAY0, flip));
|
||||
if (isBackupSucceeded)
|
||||
if (isProcessSucceeded)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
#define SUCCESS_COLOR 0.f, 0.6f,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 WARN_COLOR 0.43f, 0.43f, 0.f, 1.f
|
||||
|
||||
namespace common
|
||||
{
|
||||
@ -66,8 +67,9 @@ void DrawSystemState
|
||||
u64 deviceId,
|
||||
u64 friendCode,
|
||||
u32 progress,
|
||||
bool isBackupFailed,
|
||||
bool isBackupSucceeded,
|
||||
bool isProcessFailed,
|
||||
bool isProcessSucceeded,
|
||||
bool isProcessWarning,
|
||||
char8* macAddress,
|
||||
::std::vector<std::string>& operationMessage,
|
||||
nn::cfg::CTR::CfgRegionCode region,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user