diff --git a/misc/ds/Makefile b/misc/ds/Makefile index 57c887ada..1de834b7a 100644 --- a/misc/ds/Makefile +++ b/misc/ds/Makefile @@ -1,8 +1,8 @@ # SPDX-License-Identifier: CC0-1.0 # # SPDX-FileContributor: Antonio Niño Díaz, 2023 -export BLOCKSDS ?= /opt/blocksds/core -export BLOCKSDSEXT ?= /opt/blocksds/external +export BLOCKSDS ?= /opt/wonderful/thirdparty/blocksds/core +export BLOCKSDSEXT ?= /opt/wonderful/thirdparty/blocksds/external NAME := ClassiCube GAME_TITLE := ClassiCube diff --git a/src/Window_NDS.c b/src/Window_NDS.c index 7b23dca59..396e2fa3a 100644 --- a/src/Window_NDS.c +++ b/src/Window_NDS.c @@ -18,6 +18,9 @@ #include #include +#define LAYER_CON 0 +#define LAYER_KB 1 + /*########################################################################################################################* *----------------------------------------------------Onscreen console-----------------------------------------------------* @@ -91,9 +94,9 @@ void consolePrintString(const char* ptr, int len) { } static void consoleLoadFont(int bgId, u16* palette) { - conFontBgMap = (u16*)bgGetMapPtr(bgId); + conFontBgMap = (u16*)bgGetMapPtr(bgId); u16* fontBgGfx = (u16*)bgGetGfxPtr(bgId); - conFontCurPal = 15 << 12; + conFontCurPal = 15 << 12; for (int i = 0; i < FONT_NUM_CHARACTERS * 8; i++) { @@ -117,9 +120,9 @@ static void consoleLoadFont(int bgId, u16* palette) { static void consoleInit(cc_bool onSub) { int bgId; if (onSub) { - bgId = bgInitSub(0, BgType_Text4bpp, BgSize_T_256x256, 22, 2); + bgId = bgInitSub(LAYER_CON, BgType_Text4bpp, BgSize_T_256x256, 22, 2); } else { - bgId = bgInit( 0, BgType_Text4bpp, BgSize_T_256x256, 22, 2); + bgId = bgInit( LAYER_CON, BgType_Text4bpp, BgSize_T_256x256, 22, 2); } consoleLoadFont(bgId, onSub ? BG_PALETTE_SUB : BG_PALETTE); @@ -141,10 +144,16 @@ static void SetupVideo(cc_bool mode) { if (launcherMode == mode) return; launcherMode = mode; + vramSetBankA(VRAM_A_LCD); + vramSetBankB(VRAM_B_LCD); + vramSetBankC(VRAM_C_LCD); + vramSetBankD(VRAM_D_LCD); + vramSetBankH(VRAM_H_LCD); + vramSetBankI(VRAM_I_LCD); + if (launcherMode) { - videoSetModeSub(MODE_0_2D); - vramSetBankH(VRAM_H_SUB_BG); - vramSetBankI(VRAM_I_SUB_BG_0x06208000); + videoSetModeSub(MODE_5_2D); + vramSetBankC(VRAM_C_SUB_BG); videoSetMode(MODE_5_2D); vramSetBankA(VRAM_A_MAIN_BG); @@ -156,7 +165,7 @@ static void SetupVideo(cc_bool mode) { videoSetMode(MODE_0_3D); } - consoleInit(true); + consoleInit(!launcherMode); } void Window_PreInit(void) { @@ -185,8 +194,8 @@ void Window_Init(void) { void Window_Free(void) { } void Window_Create2D(int width, int height) { - SetupVideo(true); - bg_id = bgInit(2, BgType_Bmp16, BgSize_B16_256x256, 2, 0); + SetupVideo(true); + bg_id = bgInitSub(2, BgType_Bmp16, BgSize_B16_256x256, 2, 0); bg_ptr = bgGetGfxPtr(bg_id); } @@ -330,11 +339,12 @@ static void OnKeyPressed(int key) { void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { Keyboard* kbd = keyboardGetDefault(); - videoBgDisableSub(0); // hide console + if (!launcherMode) videoBgDisableSub(LAYER_CON); - keyboardInit(kbd, 3, BgType_Text4bpp, BgSize_T_256x512, + keyboardInit(kbd, LAYER_KB, BgType_Text4bpp, BgSize_T_256x512, 14, 0, false, true); keyboardShow(); + bgSetPriority(4 + LAYER_KB, BG_PRIORITY_0); kbd->OnKeyPressed = OnKeyPressed; String_InitArray(kbText, kbBuffer); @@ -349,7 +359,7 @@ void OnscreenKeyboard_Close(void) { if (!DisplayInfo.ShowingSoftKeyboard) return; DisplayInfo.ShowingSoftKeyboard = false; - videoBgEnableSub(0); // show console + if (!launcherMode) videoBgEnableSub(LAYER_CON); }