Skip to content

Commit

Permalink
Workaround for burn in issue
Browse files Browse the repository at this point in the history
  • Loading branch information
plutoo committed Feb 21, 2018
1 parent 842ce50 commit e25aae5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions nx/include/switch/runtime/devices/console.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
23 changes: 19 additions & 4 deletions nx/source/runtime/devices/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -123,6 +124,8 @@ static void consoleCls(char mode) {
}
}
gfxFlushBuffers();
gfxSwapBuffers();
gfxWaitForVsync();
}
//---------------------------------------------------------------------------------
static void consoleClearLine(char mode) {
Expand Down Expand Up @@ -176,6 +179,8 @@ static void consoleClearLine(char mode) {
}
}
gfxFlushBuffers();
gfxSwapBuffers();
gfxWaitForVsync();
}


Expand Down Expand Up @@ -547,12 +552,15 @@ PrintConsole* consoleInit(PrintConsole* console) {

console->consoleInitialised = 1;

gfxSetMode(GfxMode_TiledSingle);
gfxFlushBuffers();
gfxWaitForVsync();
gfxSetMode(GfxMode_TiledDouble);

console->frameBuffer = (u32*)gfxGetFramebuffer(NULL, NULL);
console->frameBuffer = (u32*)gfxGetFramebuffer(NULL, NULL);
gfxSwapBuffers();
console->frameBuffer2 = (u32*)gfxGetFramebuffer(NULL, NULL);

gfxFlushBuffers();
gfxSwapBuffers();
gfxWaitForVsync();

consoleCls('2');

Expand Down Expand Up @@ -625,6 +633,9 @@ static void newRow(void) {
to = &currentConsole->frameBuffer[gfxGetFramebufferDisplayOffset(x + i, y + j)];
from = &currentConsole->frameBuffer[gfxGetFramebufferDisplayOffset(x + i, y + 8 + j)];
*to = *from;
to = &currentConsole->frameBuffer2[gfxGetFramebufferDisplayOffset(x + i, y + j)];
from = &currentConsole->frameBuffer2[gfxGetFramebufferDisplayOffset(x + i, y + 8 + j)];
*to = *from;
}
}

Expand Down Expand Up @@ -676,6 +687,8 @@ void consoleDrawChar(int c) {
for (j=0;j<8;j++) {
screen = &currentConsole->frameBuffer[gfxGetFramebufferDisplayOffset(x + i, y + j)];
if (bval >> (8*j) & mask) { *screen = fg; }else{ *screen = bg; }
screen = &currentConsole->frameBuffer2[gfxGetFramebufferDisplayOffset(x + i, y + j)];
if (bval >> (8*j) & mask) { *screen = fg; }else{ *screen = bg; }
}
mask >>= 1;
}
Expand Down Expand Up @@ -730,6 +743,8 @@ void consolePrintChar(int c) {
case 13:
currentConsole->cursorX = 0;
gfxFlushBuffers();
gfxSwapBuffers();
gfxWaitForVsync();
break;
default:
consoleDrawChar(c);
Expand Down

0 comments on commit e25aae5

Please sign in to comment.