diff --git a/trunk/ConsoleDataMigration/ConsoleBackup/ConsoleBackup.cpp b/trunk/ConsoleDataMigration/ConsoleBackup/ConsoleBackup.cpp index a129e7b..75a3188 100644 --- a/trunk/ConsoleDataMigration/ConsoleBackup/ConsoleBackup.cpp +++ b/trunk/ConsoleDataMigration/ConsoleBackup/ConsoleBackup.cpp @@ -191,6 +191,9 @@ extern "C" void nnMain(void) // RenderSystemを作ってからログが出せる common::Logger::InitializeEjectThread(); common::Logger::SetEjectHandler(OnSdEjected); + // 起動時に削除 + common::Logger::GetLoggerInstance()->ClearLog(); + COMMON_LOGGER("\n"); COMMON_LOGGER("CTR Console Backup start\n"); diff --git a/trunk/ConsoleDataMigration/common/CommonLogger.cpp b/trunk/ConsoleDataMigration/common/CommonLogger.cpp index c75a924..cb31ac5 100644 --- a/trunk/ConsoleDataMigration/common/CommonLogger.cpp +++ b/trunk/ConsoleDataMigration/common/CommonLogger.cpp @@ -91,6 +91,12 @@ void CommonLogger::PrintResultIfFailed(nn::Result result, u32 line) } } +void CommonLogger::ClearLog() +{ + nn::os::CriticalSection::ScopedLock lock(m_CriticalSection); + GetSdInstance()->Clear(); +} + void CommonLogger::ScrollUp() { GetConsoleInstance()->ScrollUp(); diff --git a/trunk/ConsoleDataMigration/common/CommonLogger.h b/trunk/ConsoleDataMigration/common/CommonLogger.h index 4018a3b..b413c17 100644 --- a/trunk/ConsoleDataMigration/common/CommonLogger.h +++ b/trunk/ConsoleDataMigration/common/CommonLogger.h @@ -28,6 +28,7 @@ (void)common::Logger::GetLoggerInstance()->PrintResult("Result = %X\n", result.GetPrintableBits()); \ #define COMMON_LOGGER_RESULT_WITH_LINE(result, line) \ + (void)nn::dbg::detail::Printf("%d\n", line); \ (void)nn::dbg::PrintResult(result); \ (void)common::Logger::GetLoggerInstance()->PrintResult("line = %d\n", line); \ (void)common::Logger::GetLoggerInstance()->PrintResult("Result = %X\n", result.GetPrintableBits()); \ @@ -62,6 +63,7 @@ public: void Print(const char* fmt, ...); void PrintResult(const char* fmt, ...); void PrintResultIfFailed(nn::Result result, u32 line = 0); + void ClearLog(); void ScrollUp(); void ScrollDown(); void ScrollToBegin(); diff --git a/trunk/ConsoleDataMigration/common/SdLogger.cpp b/trunk/ConsoleDataMigration/common/SdLogger.cpp index 86042f2..db2b6c9 100644 --- a/trunk/ConsoleDataMigration/common/SdLogger.cpp +++ b/trunk/ConsoleDataMigration/common/SdLogger.cpp @@ -189,6 +189,23 @@ void SdLogger::Print(const char* fmt, ::std::va_list arg) SdMountManager::Unmount(); } +void SdLogger::Clear() +{ + nn::Result result; + SdMountManager::Mount(); + + ::std::wstring log(SDMC_ROOT_NAME); + log += LOG_FILENAME; + + result = nn::fs::TryDeleteFile(log.c_str()); + if(result.IsFailure()) + { + nn::dbg::PrintResult(result); + } + + SdMountManager::Unmount(); +} + } // namespace Logger } // namespace ConsoleBackup diff --git a/trunk/ConsoleDataMigration/common/SdLogger.h b/trunk/ConsoleDataMigration/common/SdLogger.h index 4c15ae9..f770f35 100644 --- a/trunk/ConsoleDataMigration/common/SdLogger.h +++ b/trunk/ConsoleDataMigration/common/SdLogger.h @@ -36,6 +36,7 @@ public: ~SdLogger() {}; void Print(const char* fmt, ::std::va_list arg); + void Clear(); private: nn::fs::FileOutputStream sd;