Re-init both console outputs after renaming or creating folder

This commit is contained in:
RocketRobz 2020-02-04 19:44:03 -07:00
parent 35987ae0e1
commit 14cd945b16
2 changed files with 30 additions and 5 deletions

View File

@ -45,12 +45,13 @@
#define OPTIONS_ENTRIES_START_ROW 2
#define ENTRY_PAGE_LENGTH 10
bool bigJump = false;
extern PrintConsole topConsole, bottomConsoleBG, bottomConsole;
extern PrintConsole topConsole, bottomConsole;
extern void printBorderTop(void);
extern void printBorderBottom(void);
extern void clearBorderTop(void);
extern void clearBorderBottom(void);
extern void reinitConsoles(void);
static char path[PATH_MAX];
@ -614,8 +615,7 @@ string browseForFile (void) {
keyboardHide();
consoleClear();
consoleInit(&bottomConsoleBG, 1, BgType_Text4bpp, BgSize_T_256x256, 7, 0, false, true);
consoleInit(&bottomConsole, 0, BgType_Text4bpp, BgSize_T_256x256, 15, 0, false, true);
reinitConsoles();
if (newName[0] != '\0') {
// Check for unsupported characters
@ -725,8 +725,7 @@ string browseForFile (void) {
keyboardHide();
consoleClear();
consoleInit(&bottomConsoleBG, 1, BgType_Text4bpp, BgSize_T_256x256, 7, 0, false, true);
consoleInit(&bottomConsole, 0, BgType_Text4bpp, BgSize_T_256x256, 15, 0, false, true);
reinitConsoles();
if (newName[0] != '\0') {
// Check for unsupported characters

View File

@ -98,6 +98,32 @@ void clearBorderBottom(void) {
consoleClear();
}
void reinitConsoles(void) {
// Subscreen as a console
videoSetModeSub(MODE_0_2D);
vramSetBankH(VRAM_H_SUB_BG);
consoleInit(&bottomConsoleBG, 1, BgType_Text4bpp, BgSize_T_256x256, 7, 0, false, true);
consoleInit(&bottomConsole, 0, BgType_Text4bpp, BgSize_T_256x256, 15, 0, false, true);
// Top screen as a console
videoSetMode(MODE_0_2D);
vramSetBankG(VRAM_G_MAIN_BG);
consoleInit(&topConsoleBG, 1, BgType_Text4bpp, BgSize_T_256x256, 7, 0, true, true);
consoleInit(&topConsole, 0, BgType_Text4bpp, BgSize_T_256x256, 15, 0, true, true);
// Overwrite background white color
BG_PALETTE[15+(7*16)] = 0x656A;
BG_PALETTE_SUB[15+(7*16)] = 0x656A;
// Overwrite 2nd smiley face with filled tile
for (int i = 0; i < 8*8; i++) {
*(u8*)(0x6000040+i) = 0xFF; // Top screen
*(u8*)(0x6200040+i) = 0xFF; // Bottom screen
}
printBorderTop();
}
//---------------------------------------------------------------------------------
int main(int argc, char **argv) {
//---------------------------------------------------------------------------------