From a39890ef48606805c3fe9858c4f76b3ff3da3eaf Mon Sep 17 00:00:00 2001 From: Dave Murphy Date: Fri, 12 Dec 2014 13:43:40 +0000 Subject: [PATCH] allow console on either screen --- libctru/include/3ds/console.h | 3 ++- libctru/source/console.c | 13 +++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libctru/include/3ds/console.h b/libctru/include/3ds/console.h index fe694bf..f8bcde6 100644 --- a/libctru/include/3ds/console.h +++ b/libctru/include/3ds/console.h @@ -123,10 +123,11 @@ PrintConsole* consoleGetDefault(void); PrintConsole *consoleSelect(PrintConsole* console); /*! \brief Initialise the console. + \param screen The screen to use for the console \param console A pointer to the console data to initialze (if it's NULL, the default console will be used) \return A pointer to the current console. */ -PrintConsole* consoleInit(PrintConsole* console); +PrintConsole* consoleInit(gfxScreen_t screen, PrintConsole* console); //! Clears the screan by using iprintf("\x1b[2J"); void consoleClear(void); diff --git a/libctru/source/console.c b/libctru/source/console.c index 040955b..087bce7 100644 --- a/libctru/source/console.c +++ b/libctru/source/console.c @@ -342,7 +342,7 @@ static const devoptab_t dotab_null = { }; //--------------------------------------------------------------------------------- -PrintConsole* consoleInit(PrintConsole* console) { +PrintConsole* consoleInit(gfxScreen_t screen, PrintConsole* console) { //--------------------------------------------------------------------------------- static bool firstConsoleInit = true; @@ -367,9 +367,14 @@ PrintConsole* consoleInit(PrintConsole* console) { console->consoleInitialised = 1; - gfxSetScreenFormat(GFX_BOTTOM,GSP_RGB565_OES); - gfxSetDoubleBuffering(GFX_BOTTOM,false); - console->frameBuffer = (u16*)gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL); + gfxSetScreenFormat(screen,GSP_RGB565_OES); + gfxSetDoubleBuffering(screen,false); + console->frameBuffer = (u16*)gfxGetFramebuffer(screen, GFX_LEFT, NULL, NULL); + + if(screen==GFX_TOP) { + console->consoleWidth = 50; + console->windowWidth = 50; + } consoleCls('2');