diff --git a/trunk/PersonalDataEraser/main.cpp b/trunk/PersonalDataEraser/main.cpp index 8112f45..72afd55 100644 --- a/trunk/PersonalDataEraser/main.cpp +++ b/trunk/PersonalDataEraser/main.cpp @@ -53,6 +53,7 @@ namespace { const char* const NAND_TWL_ARCHIVE_NAME = "twln:"; const char* const NAND_TWL_KENJ_SAVE_DATA_PATHNAME = "twln:/title/00030004/4b454e4a/data/Public.sav"; const nn::ProgramId NAND_TWL_KENJ_PROGRAM_ID = 0x000480044b454e4aULL; + const nn::ProgramId NAND_TWL_KCVJ_PROGRAM_ID = 0x000480044B43564AULL; // 乱数生成クラス // 線形合同法を用いて乱数を生成する。 @@ -89,6 +90,7 @@ namespace { }; nn::Result DeleteKENJ(void); + bool KCVJExists(); const size_t ERASE_THREAD_STACK_SIZE = 0x1000; nn::os::Thread s_EraseThread; @@ -101,6 +103,7 @@ namespace { bool s_IsSaveDataCleanSuccess = false; bool s_IsAppDeleteSuccess = false; bool s_IsCreditCardExist = false; + bool s_IsKCVJExist = false; nn::Result s_KENJResult = nn::ResultSuccess(); nn::Result s_CreditCardResult = nn::ResultSuccess(); @@ -125,6 +128,10 @@ namespace { s_IsCreditCardExist = true; s_CreditCardResult = nn::nim::Shop::DeleteCreditCardOnSystemSaveData(); } + + // 洞窟物語(KCVJ)の存在を確認する + s_IsKCVJExist = KCVJExists(); + s_IsFinish = true; } @@ -232,6 +239,20 @@ namespace { return result; } + bool KCVJExists() + { + // アプリが存在するかどうか確かめる + nn::am::ProgramInfo info; + nn::Result result = nn::am::GetProgramInfos(&info, nn::fs::MEDIA_TYPE_NAND, &NAND_TWL_KCVJ_PROGRAM_ID, 1); + if(result == nn::am::ResultNotFound()) + { + return false; + } + else + { + return true; + } + } void DrawResultText() { @@ -243,6 +264,7 @@ namespace { s_RenderSystem.DrawText(10.0f, 60.0f, "Initialcode : KENJ"); s_RenderSystem.DrawText(10.0f, 180.0f, "Credit Card :"); + s_RenderSystem.DrawText(10.0f, 200.0f, "KCVJ :"); if( s_KENJResult.IsSuccess() ) { @@ -336,12 +358,24 @@ namespace { s_RenderSystem.DrawText(130.0f, 180.0f, "data not found"); } + if(s_IsKCVJExist) + { + s_RenderSystem.SetColor( RED ); + s_RenderSystem.DrawText(130.0f, 200.0f, "application found"); + } + else + { + s_RenderSystem.SetColor( YELLOW ); + s_RenderSystem.DrawText(130.0f, 200.0f, "application not found"); + + } + } void DrawKENJResultUpper(const f32 red, const f32 green, const f32 blue) { s_RenderSystem.SetColor(red, green, blue); - s_RenderSystem.FillRectangle(0, 0, NN_GX_DISPLAY0_HEIGHT, NN_GX_DISPLAY0_WIDTH / 2); + s_RenderSystem.FillRectangle(0, 0, NN_GX_DISPLAY0_HEIGHT, NN_GX_DISPLAY0_WIDTH / 3); s_RenderSystem.SetColor(BLACK); s_RenderSystem.DrawText(0, 0, "KENJ Result"); } @@ -349,9 +383,17 @@ namespace { void DrawCreditCardResultUpper(const f32 red, const f32 green, const f32 blue) { s_RenderSystem.SetColor(red, green, blue); - s_RenderSystem.FillRectangle(0, NN_GX_DISPLAY0_WIDTH / 2, NN_GX_DISPLAY0_HEIGHT, NN_GX_DISPLAY0_WIDTH / 2); + s_RenderSystem.FillRectangle(0, NN_GX_DISPLAY0_WIDTH / 3, NN_GX_DISPLAY0_HEIGHT, NN_GX_DISPLAY0_WIDTH / 3); s_RenderSystem.SetColor(BLACK); - s_RenderSystem.DrawText(0, NN_GX_DISPLAY0_WIDTH / 2, "Credit Card Result"); + s_RenderSystem.DrawText(0, NN_GX_DISPLAY0_WIDTH / 3, "Credit Card Result"); + } + + void DrawKCVJResultUpper(const f32 red, const f32 green, const f32 blue) + { + s_RenderSystem.SetColor(red, green, blue); + s_RenderSystem.FillRectangle(0, NN_GX_DISPLAY0_WIDTH / 3 * 2, NN_GX_DISPLAY0_HEIGHT, NN_GX_DISPLAY0_WIDTH / 3); + s_RenderSystem.SetColor(BLACK); + s_RenderSystem.DrawText(0, NN_GX_DISPLAY0_WIDTH / 3 * 2, "KCVJ Result"); } } @@ -442,6 +484,16 @@ extern "C" void nnMain(void) } } + // 洞窟物語の結果 + if(s_IsKCVJExist) + { + DrawKCVJResultUpper(RED); + } + else + { + DrawKCVJResultUpper(YELLOW); + } + // バッファへ s_RenderSystem.SwapBuffers();