diff --git a/trunk/ConsoleDataMigration/sources/tools/PreinstallListUp/main.cpp b/trunk/ConsoleDataMigration/sources/tools/PreinstallListUp/main.cpp index 70739c9..8fbb6a8 100644 --- a/trunk/ConsoleDataMigration/sources/tools/PreinstallListUp/main.cpp +++ b/trunk/ConsoleDataMigration/sources/tools/PreinstallListUp/main.cpp @@ -72,6 +72,7 @@ const u32 CONSOLE_MAX_LINE = 1000; const size_t THREAD_STACK_SIZE = 0x2000; nn::os::Thread s_Thread; nn::os::StackBuffer s_ThreadStack; +demo::RenderSystemDrawing s_RenderSystem; } @@ -117,6 +118,24 @@ void ThreadFunc() COMMON_LOGGER_RETURN_VOID_IF_FAILED(result); } +void FinalizeAll() +{ + common::Logger::GetLoggerInstance()->Finalize(); + // アンマウント + nn::fs::Unmount("nand:"); + nn::fs::Unmount("sdmc:"); + s_RenderSystem.Finalize(); + + nn::ps::Finalize(); + nn::cfg::CTR::system::Finalize(); + nn::cfg::CTR::init::Finalize(); + nn::hid::Finalize(); + nn::fs::Finalize(); + + nn::applet::PrepareToCloseApplication(); + nn::applet::CloseApplication(); +} + extern "C" void nninitSetupDaemons(void) { } @@ -152,7 +171,6 @@ extern "C" void nnMain(void) // RenderSystem の準備 common::HeapManager gxHeap(s_GxHeapSize); uptr heapForGx = reinterpret_cast(gxHeap.GetAddr()); - demo::RenderSystemDrawing s_RenderSystem; s_RenderSystem.Initialize(heapForGx, s_GxHeapSize); // ログ描画の初期化 @@ -201,6 +219,13 @@ extern "C" void nnMain(void) s_RenderSystem.SwapBuffers(); s_RenderSystem.WaitVsync(NN_GX_DISPLAY_BOTH); + + // 電源長押しで終了 + if ( nn::applet::IsExpectedToCloseApplication()) + { + FinalizeAll(); + } + } }