From dd2b5512cdaaa570fef18f9cdb7a37434226a6f2 Mon Sep 17 00:00:00 2001 From: N2614 Date: Tue, 1 Nov 2011 06:47:52 +0000 Subject: [PATCH] =?UTF-8?q?NW=E3=83=87=E3=83=A2=E3=81=A7=E3=81=AE=E6=8F=8F?= =?UTF-8?q?=E7=94=BB=E3=81=AE=E5=89=8D=E3=81=ABDMPGL=E3=81=A7=E3=82=AF?= =?UTF-8?q?=E3=83=AA=E3=82=A2=E3=81=97=E3=81=A6=E3=81=8A=E3=81=8F=20?= =?UTF-8?q?=E9=80=94=E4=B8=AD=E3=81=AE=E3=83=95=E3=83=AC=E3=83=BC=E3=83=A0?= =?UTF-8?q?=E3=81=8B=E3=82=89=E3=82=A2=E3=83=8B=E3=83=A1=E3=83=BC=E3=82=B7?= =?UTF-8?q?=E3=83=A7=E3=83=B3=E3=82=92=E5=86=8D=E7=94=9F=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=81=AE=E3=82=92=E6=AD=A2=E3=82=81=E3=82=8B=20=E7=B5=82?= =?UTF-8?q?=E4=BA=86=E6=99=82=E3=81=AE=E3=82=B7=E3=83=A3=E3=83=83=E3=83=88?= =?UTF-8?q?=E3=83=80=E3=82=A6=E3=83=B3=E5=87=A6=E7=90=86=E3=82=92=E6=AD=A3?= =?UTF-8?q?=E3=81=97=E3=81=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@470 385bec56-5757-e545-9c3a-d8741f4650f1 --- branches/CardCupForNBD/CardCup/Drawer.cpp | 37 ++++---------- branches/CardCupForNBD/CardCup/OMakefile | 4 +- branches/CardCupForNBD/CardCup/main.cpp | 62 ++++++++++++++++++----- 3 files changed, 62 insertions(+), 41 deletions(-) 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(); + } + } }