From a22b7af86d4aadff06da10da8cd88af010587367 Mon Sep 17 00:00:00 2001 From: w3irDv <170813473+w3irDv@users.noreply.github.com> Date: Sat, 3 Aug 2024 13:06:38 +0200 Subject: [PATCH] fix - no black screen when reentering app --- src/utils/DrawUtils.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/utils/DrawUtils.cpp b/src/utils/DrawUtils.cpp index 9c5681d..2cda6b1 100644 --- a/src/utils/DrawUtils.cpp +++ b/src/utils/DrawUtils.cpp @@ -33,6 +33,7 @@ uint32_t DrawUtils::sBufferSizeDRC = 0; static SFT pFont = {}; static Color font_col(0xFFFFFFFF); +static Color black(0x000000FF); void *DrawUtils::sBufferTV = NULL, *DrawUtils::sBufferDRC = NULL; uint32_t DrawUtils::sBufferSizeTV = 0, DrawUtils::sBufferSizeDRC = 0; @@ -52,10 +53,25 @@ DrawUtils::ConsoleProcCallbackAcquired(void *context) sBufferDRC = MEMAllocFromFrmHeapEx(heap, sBufferSizeDRC, 4); } + sConsoleHasForeground = TRUE; - DrawUtils::setRedraw(true); + OSScreenSetBufferEx(SCREEN_TV, sBufferTV); OSScreenSetBufferEx(SCREEN_DRC, sBufferDRC); + DrawUtils::initBuffers(sBufferTV, sBufferDRC); + + OSScreenEnableEx(SCREEN_TV, 1); + OSScreenEnableEx(SCREEN_DRC, 1); + + + for (int i = 0; i<2; i++) // both buffers to black + { + DrawUtils::clear(black); + DrawUtils::endDraw(); + } + + DrawUtils::setRedraw(true); // force a redraw when reentering + return 0; } @@ -77,13 +93,9 @@ DrawUtils::LogConsoleInit() sBufferSizeDRC = OSScreenGetBufferSizeEx(SCREEN_DRC); ConsoleProcCallbackAcquired(NULL); - OSScreenEnableEx(SCREEN_TV, 1); - OSScreenEnableEx(SCREEN_DRC, 1); - + State::registerProcUICallbacks(); - DrawUtils::initBuffers(sBufferTV, sBufferDRC); - return FALSE; }