DS: Don't clear console after showing keyboard, also log if running in DS or DSi mode

This commit is contained in:
UnknownShadow200 2024-04-29 20:36:15 +10:00
parent fec395d3c5
commit 908077203e
2 changed files with 9 additions and 19 deletions

View File

@ -114,7 +114,7 @@ static void GetNativePath(char* str, const cc_string* path) {
}
cc_result Directory_Create(const cc_string* path) {
if (!fat_available) return ENOSYS;
if (!fat_available) return ENOTSUP;
char str[NATIVE_STR_LEN];
GetNativePath(str, path);
@ -186,11 +186,11 @@ cc_result File_Length(cc_file file, cc_uint32* len) {
*len = st.st_size; return 0;
}
static void InitFilesystem(void) {
static void InitFilesystem(cc_bool dsiMode) {
// I don't know why I have to call this function, but if I don't,
// then when running in DSi mode AND an SD card is readable,
// fatInitDefault gets stuck somewhere (in disk_initialize it seems)
if (isDSiMode()) {
if (dsiMode) {
const DISC_INTERFACE* sd_io = get_io_dsisd();
if (sd_io) sd_io->startup();
}
@ -402,7 +402,10 @@ static void InitNetworking(void) {
*--------------------------------------------------------Platform---------------------------------------------------------*
*#########################################################################################################################*/
void Platform_Init(void) {
InitFilesystem();
cc_bool dsiMode = isDSiMode();
Platform_Log1("Running in %c mode", dsiMode ? "DSi" : "DS");
InitFilesystem(dsiMode);
InitNetworking();
cpuStartTiming(1);

View File

@ -110,7 +110,7 @@ static void consoleLoadFont(u16* fontBgGfx) {
}
static void consoleInit(void) {
int bgId = bgInitSub(0, BgType_Text4bpp, BgSize_T_256x256, 14, 0);
int bgId = bgInitSub(0, BgType_Text4bpp, BgSize_T_256x256, 22, 2);
conFontBgMap = (u16*)bgGetMapPtr(bgId);
consoleLoadFont((u16*)bgGetGfxPtr(bgId));
@ -129,17 +129,6 @@ static u16* bg_ptr;
struct _DisplayData DisplayInfo;
struct _WindowData WindowInfo;
// Console and Keyboard combined need more than 32 kb of H VRAM bank
// The simple solution would be to allocate the C VRAM bank, but ClassiCube
// needs as much VRAM as it can get for textures
// So the solution is to share the H VRAM bank between console and keyboard
static void ResetHBank(void) {
// Map all VRAM banks to LCDC mode so that the CPU can access it
vramSetBankH(VRAM_H_LCD);
dmaFillWords(0, VRAM_H, 32 * 1024);
vramSetBankH(VRAM_H_SUB_BG);
}
void Window_Init(void) {
DisplayInfo.Width = SCREEN_WIDTH;
DisplayInfo.Height = SCREEN_HEIGHT;
@ -157,6 +146,7 @@ void Window_Init(void) {
videoSetModeSub(MODE_0_2D);
vramSetBankH(VRAM_H_SUB_BG);
vramSetBankI(VRAM_I_SUB_BG_0x06208000);
setBrightness(2, 0);
consoleInit();
}
@ -309,7 +299,6 @@ void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
Keyboard* kbd = keyboardGetDefault();
videoBgDisableSub(0); // hide console
ResetHBank(); // reset shared VRAM
keyboardInit(kbd, 3, BgType_Text4bpp, BgSize_T_256x512,
14, 0, false, true);
keyboardShow();
@ -330,9 +319,7 @@ void OnscreenKeyboard_Close(void) {
if (!keyboardOpen) return;
keyboardOpen = false;
ResetHBank(); // reset shared VRAM
videoBgEnableSub(0); // show console
consoleInit();
}