diff --git a/branches/CardCupForNBD/CardCup/Drawer.cpp b/branches/CardCupForNBD/CardCup/Drawer.cpp index 41fdba8..bed2445 100644 --- a/branches/CardCupForNBD/CardCup/Drawer.cpp +++ b/branches/CardCupForNBD/CardCup/Drawer.cpp @@ -432,13 +432,6 @@ void FinalizeDrawerThread() s_DrawerThread.Finalize(); } -void RestoreGraphics() -{ - // GPU レジスタ設定の復帰 - nngxUpdateState(NN_GX_STATE_ALL); - nngxValidateState(NN_GX_STATE_ALL,GL_TRUE); -} - void NotifyFailed(s32 error) { s_ErrorCode = error; @@ -460,17 +453,15 @@ void ShowError() // 設定構造体初期化 nn::erreula::InitializeConfig(&ere_param.config); - ere_param.config.errorType = nn::erreula::ERROR_TYPE_ERROR_CODE; + ere_param.config.errorType = nn::erreula::ERROR_TYPE_ERROR_TEXT; ere_param.config.errorCode = s_ErrorCode; ere_param.config.upperScreenFlag = nn::erreula::UPPER_SCREEN_NORMAL; ere_param.config.homeButton = true; ere_param.config.softwareReset = false; ere_param.config.appJump = false; + std::wcscpy(ere_param.config.errorText, L""); nn::erreula::StartErrEulaApplet(&wstate, &ere_param); - - // GPU レジスタ設定の復帰 - RestoreGraphics(); } /*---------------------------------------------------------------------------* @@ -628,8 +619,7 @@ DrawThreadMain() // フレームの更新 f32 step = 1.0f; - if (animFrame < pUpperLayoutAnim->pAnimTrans[upperLayoutAnimIndex.animIndex]->GetFrameMax() && - (drawState == DRAW_STATE_LOGO_FADE_OUT && animFrame < 10.0f)) + if (animFrame < pUpperLayoutAnim->pAnimTrans[upperLayoutAnimIndex.animIndex]->GetFrameMax()) { animFrame = nw::ut::Min(pUpperLayoutAnim->pAnimTrans[upperLayoutAnimIndex.animIndex]->GetFrameMax(), animFrame + step); @@ -639,29 +629,22 @@ DrawThreadMain() { if (drawState < DRAW_STATE_FADE_OUT) { - // 次のアニメーションへ遷移 - GetNextLayoutAnimationIndex(upperLayoutAnimIndex, drawState, demoApp.DISPLAY0); - GetNextLayoutAnimationIndex(lowerLayoutAnimIndex, drawState, demoApp.DISPLAY1); - pUpperLayoutAnim = &layoutAnim[upperLayoutAnimIndex.layoutType]; - pLowerLayoutAnim = &layoutAnim[lowerLayoutAnimIndex.layoutType]; - - // 終了処理を依頼されたときのみロゴフェードアウト移行に進む + // 終了処理を依頼されたときのみロゴフェードアウト以降に進む if (drawState < DRAW_STATE_LOGO_DRAW || s_IsExpectedToFinalize) { + // 次のアニメーションへ遷移 + GetNextLayoutAnimationIndex(upperLayoutAnimIndex, drawState, demoApp.DISPLAY0); + GetNextLayoutAnimationIndex(lowerLayoutAnimIndex, drawState, demoApp.DISPLAY1); + pUpperLayoutAnim = &layoutAnim[upperLayoutAnimIndex.layoutType]; + pLowerLayoutAnim = &layoutAnim[lowerLayoutAnimIndex.layoutType]; + drawState++; NN_LOG("State = %d\n", drawState); NN_LOG( "Upper: layout: %d, anim: %d\n", upperLayoutAnimIndex.layoutType, upperLayoutAnimIndex.animIndex); NN_LOG( "Lower: layout: %d, anim: %d\n\n", lowerLayoutAnimIndex.layoutType, lowerLayoutAnimIndex.animIndex); - } - if (drawState == DRAW_STATE_LOGO_FADE_IN) - { - animFrame = 11.f; - } - else - { animFrame = 0; } } diff --git a/branches/CardCupForNBD/CardCup/OMakefile b/branches/CardCupForNBD/CardCup/OMakefile index 7e3e283..23eabde 100644 --- a/branches/CardCupForNBD/CardCup/OMakefile +++ b/branches/CardCupForNBD/CardCup/OMakefile @@ -15,9 +15,11 @@ #---------------------------------------------------------------------------- CTR_APPTYPE=CARD -SUPPORTED_TARGETS = CTR-T*.Process.MPCore.* +SUPPORTED_TARGETS = CTR-T*.Process.MPCore.fast INCLUDES += $(NW4C_ROOT)/include +SAMPLED_DEMOS_COMMON_INCLUDE_DIR = $(dir $(HORIZON_ROOT)/../CTR/SampleDemos/common/include) +INCLUDES += $(SAMPLED_DEMOS_COMMON_INCLUDE_DIR) SOURCES[] = main.cpp diff --git a/branches/CardCupForNBD/CardCup/main.cpp b/branches/CardCupForNBD/CardCup/main.cpp index fa3f1f8..b3df6fb 100644 --- a/branches/CardCupForNBD/CardCup/main.cpp +++ b/branches/CardCupForNBD/CardCup/main.cpp @@ -31,11 +31,37 @@ #include #include "Drawer.h" +#include "demo.h" namespace { char s_updaterBuffer[1<<20] NN_ATTRIBUTE_ALIGN(4096); + const s32 s_GxHeapSize = 0x800000; + nn::fnd::ExpHeap s_appHeap; + demo::RenderSystemDrawing s_RenderSystem; + + void ClearDisplay() + { + // ヒープの初期化 + s_appHeap.Initialize(nn::os::GetDeviceMemoryAddress(), nn::os::GetDeviceMemorySize(), nn::os::ALLOCATE_OPTION_LINEAR); + + // 描画クリア + void* gxHeap = s_appHeap.Allocate(s_GxHeapSize); + s_RenderSystem.Initialize(reinterpret_cast(gxHeap), s_GxHeapSize); + s_RenderSystem.SetClearColor(NN_GX_DISPLAY0, 0, 0, 0, 1); + s_RenderSystem.SetClearColor(NN_GX_DISPLAY1, 0, 0, 0, 1); + s_RenderSystem.SetRenderTarget(NN_GX_DISPLAY0); + s_RenderSystem.Clear(); + s_RenderSystem.SwapBuffers(); + s_RenderSystem.SetRenderTarget(NN_GX_DISPLAY1); + s_RenderSystem.Clear(); + s_RenderSystem.SwapBuffers(); + + s_RenderSystem.Finalize(); + s_appHeap.Free(gxHeap); + } + // デモの初期化 void Initialize() { @@ -61,6 +87,9 @@ namespace nn::applet::Enable(); nn::cfg::Initialize(); + + // DMPGLでクリアしておく + ClearDisplay(); } nn::Result UpdateCore() @@ -194,6 +223,11 @@ extern "C" void nnMain() // TODO:HOMEメニューが無いエラーをエラーアプレットで表示する } + if (!(result.IsSuccess() || result == nn::cup::CTR::ResultUpdateNotRequired())) + { + NotifyFailed(0); + } + nn::os::Tick before = nn::os::Tick::GetSystemCurrent(); const u8 SHUTDOWN_WAIT_SECONDS = 2; for(;;) @@ -210,17 +244,6 @@ extern "C" void nnMain() } } - else - { - // 失敗したのでエラー表示を続ける - NotifyFailed(0); - } - - if (nn::applet::IsExpectedToCloseApplication()) - { - nn::applet::PrepareToCloseApplication(); - nn::applet::CloseApplication(); - } if (nn::applet::IsExpectedToProcessPowerButton()) { @@ -232,7 +255,20 @@ extern "C" void nnMain() } FinalizeDrawerThread(); - nn::ns::ShutdownAsync(); - nn::ns::FinalizeForShell(); + + for (;;) + { + if (nn::applet::IsExpectedToCloseApplication()) + { + nn::cfg::Finalize(); + nn::fs::Finalize(); + nn::am::FinalizeForSystemMenu(); + nn::ndm::Finalize(); + nn::ns::FinalizeForShell(); + + nn::applet::PrepareToCloseApplication(); + nn::applet::CloseApplication(); + } + } }