NDS: Launcher renders on bottom screen now

This commit is contained in:
UnknownShadow200 2024-09-05 19:48:57 +10:00
parent f4913b6415
commit a74392dbb1
2 changed files with 25 additions and 15 deletions

View File

@ -1,8 +1,8 @@
# SPDX-License-Identifier: CC0-1.0 # SPDX-License-Identifier: CC0-1.0
# #
# SPDX-FileContributor: Antonio Niño Díaz, 2023 # SPDX-FileContributor: Antonio Niño Díaz, 2023
export BLOCKSDS ?= /opt/blocksds/core export BLOCKSDS ?= /opt/wonderful/thirdparty/blocksds/core
export BLOCKSDSEXT ?= /opt/blocksds/external export BLOCKSDSEXT ?= /opt/wonderful/thirdparty/blocksds/external
NAME := ClassiCube NAME := ClassiCube
GAME_TITLE := ClassiCube GAME_TITLE := ClassiCube

View File

@ -18,6 +18,9 @@
#include <nds/system.h> #include <nds/system.h>
#include <fat.h> #include <fat.h>
#define LAYER_CON 0
#define LAYER_KB 1
/*########################################################################################################################* /*########################################################################################################################*
*----------------------------------------------------Onscreen console-----------------------------------------------------* *----------------------------------------------------Onscreen console-----------------------------------------------------*
@ -117,9 +120,9 @@ static void consoleLoadFont(int bgId, u16* palette) {
static void consoleInit(cc_bool onSub) { static void consoleInit(cc_bool onSub) {
int bgId; int bgId;
if (onSub) { if (onSub) {
bgId = bgInitSub(0, BgType_Text4bpp, BgSize_T_256x256, 22, 2); bgId = bgInitSub(LAYER_CON, BgType_Text4bpp, BgSize_T_256x256, 22, 2);
} else { } 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); consoleLoadFont(bgId, onSub ? BG_PALETTE_SUB : BG_PALETTE);
@ -141,10 +144,16 @@ static void SetupVideo(cc_bool mode) {
if (launcherMode == mode) return; if (launcherMode == mode) return;
launcherMode = mode; 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) { if (launcherMode) {
videoSetModeSub(MODE_0_2D); videoSetModeSub(MODE_5_2D);
vramSetBankH(VRAM_H_SUB_BG); vramSetBankC(VRAM_C_SUB_BG);
vramSetBankI(VRAM_I_SUB_BG_0x06208000);
videoSetMode(MODE_5_2D); videoSetMode(MODE_5_2D);
vramSetBankA(VRAM_A_MAIN_BG); vramSetBankA(VRAM_A_MAIN_BG);
@ -156,7 +165,7 @@ static void SetupVideo(cc_bool mode) {
videoSetMode(MODE_0_3D); videoSetMode(MODE_0_3D);
} }
consoleInit(true); consoleInit(!launcherMode);
} }
void Window_PreInit(void) { void Window_PreInit(void) {
@ -186,7 +195,7 @@ void Window_Free(void) { }
void Window_Create2D(int width, int height) { void Window_Create2D(int width, int height) {
SetupVideo(true); SetupVideo(true);
bg_id = bgInit(2, BgType_Bmp16, BgSize_B16_256x256, 2, 0); bg_id = bgInitSub(2, BgType_Bmp16, BgSize_B16_256x256, 2, 0);
bg_ptr = bgGetGfxPtr(bg_id); bg_ptr = bgGetGfxPtr(bg_id);
} }
@ -330,11 +339,12 @@ static void OnKeyPressed(int key) {
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
Keyboard* kbd = keyboardGetDefault(); 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); 14, 0, false, true);
keyboardShow(); keyboardShow();
bgSetPriority(4 + LAYER_KB, BG_PRIORITY_0);
kbd->OnKeyPressed = OnKeyPressed; kbd->OnKeyPressed = OnKeyPressed;
String_InitArray(kbText, kbBuffer); String_InitArray(kbText, kbBuffer);
@ -349,7 +359,7 @@ void OnscreenKeyboard_Close(void) {
if (!DisplayInfo.ShowingSoftKeyboard) return; if (!DisplayInfo.ShowingSoftKeyboard) return;
DisplayInfo.ShowingSoftKeyboard = false; DisplayInfo.ShowingSoftKeyboard = false;
videoBgEnableSub(0); // show console if (!launcherMode) videoBgEnableSub(LAYER_CON);
} }