From e25aae5a974a6fc300b217f32bcca2f1f812af85 Mon Sep 17 00:00:00 2001 From: plutoo Date: Wed, 21 Feb 2018 08:38:22 +0100 Subject: [PATCH] Workaround for burn in issue --- nx/include/switch/runtime/devices/console.h | 1 + nx/source/runtime/devices/console.c | 23 +++++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/nx/include/switch/runtime/devices/console.h b/nx/include/switch/runtime/devices/console.h index 7c7f3726..9ed7b748 100644 --- a/nx/include/switch/runtime/devices/console.h +++ b/nx/include/switch/runtime/devices/console.h @@ -75,6 +75,7 @@ typedef struct PrintConsole ConsoleFont font; ///< Font of the console u32 *frameBuffer; ///< Framebuffer address + u32 *frameBuffer2; ///< Framebuffer address int cursorX; ///< Current X location of the cursor (as a tile offset by default) int cursorY; ///< Current Y location of the cursor (as a tile offset by default) diff --git a/nx/source/runtime/devices/console.c b/nx/source/runtime/devices/console.c index 8ab6b144..eba57fa6 100644 --- a/nx/source/runtime/devices/console.c +++ b/nx/source/runtime/devices/console.c @@ -47,6 +47,7 @@ PrintConsole defaultConsole = 256 //number of characters in the font set }, (u32*)NULL, + (u32*)NULL, 0,0, //cursorX cursorY 0,0, //prevcursorX prevcursorY 160, //console width @@ -123,6 +124,8 @@ static void consoleCls(char mode) { } } gfxFlushBuffers(); + gfxSwapBuffers(); + gfxWaitForVsync(); } //--------------------------------------------------------------------------------- static void consoleClearLine(char mode) { @@ -176,6 +179,8 @@ static void consoleClearLine(char mode) { } } gfxFlushBuffers(); + gfxSwapBuffers(); + gfxWaitForVsync(); } @@ -547,13 +552,16 @@ PrintConsole* consoleInit(PrintConsole* console) { console->consoleInitialised = 1; - gfxSetMode(GfxMode_TiledSingle); + gfxSetMode(GfxMode_TiledDouble); + + console->frameBuffer = (u32*)gfxGetFramebuffer(NULL, NULL); + gfxSwapBuffers(); + console->frameBuffer2 = (u32*)gfxGetFramebuffer(NULL, NULL); + gfxFlushBuffers(); + gfxSwapBuffers(); gfxWaitForVsync(); - console->frameBuffer = (u32*)gfxGetFramebuffer(NULL, NULL); - - consoleCls('2'); return currentConsole; @@ -625,6 +633,9 @@ static void newRow(void) { to = ¤tConsole->frameBuffer[gfxGetFramebufferDisplayOffset(x + i, y + j)]; from = ¤tConsole->frameBuffer[gfxGetFramebufferDisplayOffset(x + i, y + 8 + j)]; *to = *from; + to = ¤tConsole->frameBuffer2[gfxGetFramebufferDisplayOffset(x + i, y + j)]; + from = ¤tConsole->frameBuffer2[gfxGetFramebufferDisplayOffset(x + i, y + 8 + j)]; + *to = *from; } } @@ -676,6 +687,8 @@ void consoleDrawChar(int c) { for (j=0;j<8;j++) { screen = ¤tConsole->frameBuffer[gfxGetFramebufferDisplayOffset(x + i, y + j)]; if (bval >> (8*j) & mask) { *screen = fg; }else{ *screen = bg; } + screen = ¤tConsole->frameBuffer2[gfxGetFramebufferDisplayOffset(x + i, y + j)]; + if (bval >> (8*j) & mask) { *screen = fg; }else{ *screen = bg; } } mask >>= 1; } @@ -730,6 +743,8 @@ void consolePrintChar(int c) { case 13: currentConsole->cursorX = 0; gfxFlushBuffers(); + gfxSwapBuffers(); + gfxWaitForVsync(); break; default: consoleDrawChar(c);