mirror of
https://github.com/rvtr/ctr_Repair.git
synced 2025-10-31 13:51:08 -04:00
NWデモでの描画の前にDMPGLでクリアしておく
途中のフレームからアニメーションを再生するのを止める 終了時のシャットダウン処理を正しく 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
This commit is contained in:
parent
7e7758a037
commit
dd2b5512cd
@ -432,13 +432,6 @@ void FinalizeDrawerThread()
|
|||||||
s_DrawerThread.Finalize();
|
s_DrawerThread.Finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RestoreGraphics()
|
|
||||||
{
|
|
||||||
// GPU レジスタ設定の復帰
|
|
||||||
nngxUpdateState(NN_GX_STATE_ALL);
|
|
||||||
nngxValidateState(NN_GX_STATE_ALL,GL_TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void NotifyFailed(s32 error)
|
void NotifyFailed(s32 error)
|
||||||
{
|
{
|
||||||
s_ErrorCode = error;
|
s_ErrorCode = error;
|
||||||
@ -460,17 +453,15 @@ void ShowError()
|
|||||||
// 設定構造体初期化
|
// 設定構造体初期化
|
||||||
nn::erreula::InitializeConfig(&ere_param.config);
|
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.errorCode = s_ErrorCode;
|
||||||
ere_param.config.upperScreenFlag = nn::erreula::UPPER_SCREEN_NORMAL;
|
ere_param.config.upperScreenFlag = nn::erreula::UPPER_SCREEN_NORMAL;
|
||||||
ere_param.config.homeButton = true;
|
ere_param.config.homeButton = true;
|
||||||
ere_param.config.softwareReset = false;
|
ere_param.config.softwareReset = false;
|
||||||
ere_param.config.appJump = false;
|
ere_param.config.appJump = false;
|
||||||
|
std::wcscpy(ere_param.config.errorText, L"");
|
||||||
|
|
||||||
nn::erreula::StartErrEulaApplet(&wstate, &ere_param);
|
nn::erreula::StartErrEulaApplet(&wstate, &ere_param);
|
||||||
|
|
||||||
// GPU レジスタ設定の復帰
|
|
||||||
RestoreGraphics();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
@ -628,8 +619,7 @@ DrawThreadMain()
|
|||||||
|
|
||||||
// フレームの更新
|
// フレームの更新
|
||||||
f32 step = 1.0f;
|
f32 step = 1.0f;
|
||||||
if (animFrame < pUpperLayoutAnim->pAnimTrans[upperLayoutAnimIndex.animIndex]->GetFrameMax() &&
|
if (animFrame < pUpperLayoutAnim->pAnimTrans[upperLayoutAnimIndex.animIndex]->GetFrameMax())
|
||||||
(drawState == DRAW_STATE_LOGO_FADE_OUT && animFrame < 10.0f))
|
|
||||||
{
|
{
|
||||||
animFrame = nw::ut::Min(pUpperLayoutAnim->pAnimTrans[upperLayoutAnimIndex.animIndex]->GetFrameMax(),
|
animFrame = nw::ut::Min(pUpperLayoutAnim->pAnimTrans[upperLayoutAnimIndex.animIndex]->GetFrameMax(),
|
||||||
animFrame + step);
|
animFrame + step);
|
||||||
@ -638,6 +628,9 @@ DrawThreadMain()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (drawState < DRAW_STATE_FADE_OUT)
|
if (drawState < DRAW_STATE_FADE_OUT)
|
||||||
|
{
|
||||||
|
// 終了処理を依頼されたときのみロゴフェードアウト以降に進む
|
||||||
|
if (drawState < DRAW_STATE_LOGO_DRAW || s_IsExpectedToFinalize)
|
||||||
{
|
{
|
||||||
// 次のアニメーションへ遷移
|
// 次のアニメーションへ遷移
|
||||||
GetNextLayoutAnimationIndex(upperLayoutAnimIndex, drawState, demoApp.DISPLAY0);
|
GetNextLayoutAnimationIndex(upperLayoutAnimIndex, drawState, demoApp.DISPLAY0);
|
||||||
@ -645,23 +638,13 @@ DrawThreadMain()
|
|||||||
pUpperLayoutAnim = &layoutAnim[upperLayoutAnimIndex.layoutType];
|
pUpperLayoutAnim = &layoutAnim[upperLayoutAnimIndex.layoutType];
|
||||||
pLowerLayoutAnim = &layoutAnim[lowerLayoutAnimIndex.layoutType];
|
pLowerLayoutAnim = &layoutAnim[lowerLayoutAnimIndex.layoutType];
|
||||||
|
|
||||||
// 終了処理を依頼されたときのみロゴフェードアウト移行に進む
|
|
||||||
if (drawState < DRAW_STATE_LOGO_DRAW || s_IsExpectedToFinalize)
|
|
||||||
{
|
|
||||||
drawState++;
|
drawState++;
|
||||||
NN_LOG("State = %d\n", drawState);
|
NN_LOG("State = %d\n", drawState);
|
||||||
NN_LOG(
|
NN_LOG(
|
||||||
"Upper: layout: %d, anim: %d\n", upperLayoutAnimIndex.layoutType, upperLayoutAnimIndex.animIndex);
|
"Upper: layout: %d, anim: %d\n", upperLayoutAnimIndex.layoutType, upperLayoutAnimIndex.animIndex);
|
||||||
NN_LOG(
|
NN_LOG(
|
||||||
"Lower: layout: %d, anim: %d\n\n", lowerLayoutAnimIndex.layoutType, lowerLayoutAnimIndex.animIndex);
|
"Lower: layout: %d, anim: %d\n\n", lowerLayoutAnimIndex.layoutType, lowerLayoutAnimIndex.animIndex);
|
||||||
}
|
|
||||||
|
|
||||||
if (drawState == DRAW_STATE_LOGO_FADE_IN)
|
|
||||||
{
|
|
||||||
animFrame = 11.f;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
animFrame = 0;
|
animFrame = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,9 +15,11 @@
|
|||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
CTR_APPTYPE=CARD
|
CTR_APPTYPE=CARD
|
||||||
|
|
||||||
SUPPORTED_TARGETS = CTR-T*.Process.MPCore.*
|
SUPPORTED_TARGETS = CTR-T*.Process.MPCore.fast
|
||||||
|
|
||||||
INCLUDES += $(NW4C_ROOT)/include
|
INCLUDES += $(NW4C_ROOT)/include
|
||||||
|
SAMPLED_DEMOS_COMMON_INCLUDE_DIR = $(dir $(HORIZON_ROOT)/../CTR/SampleDemos/common/include)
|
||||||
|
INCLUDES += $(SAMPLED_DEMOS_COMMON_INCLUDE_DIR)
|
||||||
|
|
||||||
SOURCES[] =
|
SOURCES[] =
|
||||||
main.cpp
|
main.cpp
|
||||||
|
|||||||
@ -31,11 +31,37 @@
|
|||||||
#include <nn/cup.h>
|
#include <nn/cup.h>
|
||||||
|
|
||||||
#include "Drawer.h"
|
#include "Drawer.h"
|
||||||
|
#include "demo.h"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
char s_updaterBuffer[1<<20] NN_ATTRIBUTE_ALIGN(4096);
|
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<uptr>(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()
|
void Initialize()
|
||||||
{
|
{
|
||||||
@ -61,6 +87,9 @@ namespace
|
|||||||
nn::applet::Enable();
|
nn::applet::Enable();
|
||||||
|
|
||||||
nn::cfg::Initialize();
|
nn::cfg::Initialize();
|
||||||
|
|
||||||
|
// DMPGLでクリアしておく
|
||||||
|
ClearDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::Result UpdateCore()
|
nn::Result UpdateCore()
|
||||||
@ -194,6 +223,11 @@ extern "C" void nnMain()
|
|||||||
// TODO:HOMEメニューが無いエラーをエラーアプレットで表示する
|
// TODO:HOMEメニューが無いエラーをエラーアプレットで表示する
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(result.IsSuccess() || result == nn::cup::CTR::ResultUpdateNotRequired()))
|
||||||
|
{
|
||||||
|
NotifyFailed(0);
|
||||||
|
}
|
||||||
|
|
||||||
nn::os::Tick before = nn::os::Tick::GetSystemCurrent();
|
nn::os::Tick before = nn::os::Tick::GetSystemCurrent();
|
||||||
const u8 SHUTDOWN_WAIT_SECONDS = 2;
|
const u8 SHUTDOWN_WAIT_SECONDS = 2;
|
||||||
for(;;)
|
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())
|
if (nn::applet::IsExpectedToProcessPowerButton())
|
||||||
{
|
{
|
||||||
@ -232,7 +255,20 @@ extern "C" void nnMain()
|
|||||||
}
|
}
|
||||||
|
|
||||||
FinalizeDrawerThread();
|
FinalizeDrawerThread();
|
||||||
|
|
||||||
nn::ns::ShutdownAsync();
|
nn::ns::ShutdownAsync();
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
if (nn::applet::IsExpectedToCloseApplication())
|
||||||
|
{
|
||||||
|
nn::cfg::Finalize();
|
||||||
|
nn::fs::Finalize();
|
||||||
|
nn::am::FinalizeForSystemMenu();
|
||||||
|
nn::ndm::Finalize();
|
||||||
nn::ns::FinalizeForShell();
|
nn::ns::FinalizeForShell();
|
||||||
|
|
||||||
|
nn::applet::PrepareToCloseApplication();
|
||||||
|
nn::applet::CloseApplication();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user