Skip to content

Commit a625d90

Browse files
ApacheThunderlifehackerhansol
authored andcommitted
Add UI changes...
* Added background graphics for bottom screen console * Used new font for bottom screen. A stripped down version of the misaki-gothic used by GodMode9i -> https://github.com/DS-Homebrew/GodMode9i/tree/master/resources/fonts
1 parent b95b02d commit a625d90

File tree

6 files changed

+62
-18
lines changed

6 files changed

+62
-18
lines changed

gfx/font.grit

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#-------------------------------------------------------
2+
# graphics in tile format
3+
#-------------------------------------------------------
4+
-gt
5+
6+
#-------------------------------------------------------
7+
# output first 16 colors of the palette
8+
#-------------------------------------------------------
9+
-pw16
10+
11+
#-------------------------------------------------------
12+
# no tile reduction
13+
#-------------------------------------------------------
14+
-mR!
15+
16+
#-------------------------------------------------------
17+
# no map output
18+
#-------------------------------------------------------
19+
-m!
20+
21+
#-------------------------------------------------------
22+
# graphics bit depth is 4 (16 color)
23+
#-------------------------------------------------------
24+
-gB4
25+

gfx/font.png

688 Bytes
Loading

gfx/hbmenu_consolebg.grit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# 8 bit bitmap
2+
-gB8
3+
4+
# bitmap format
5+
-gb

gfx/hbmenu_consolebg.png

1.13 KB
Loading

source/file_browse.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232

3333
#include "iconTitle.h"
3434

35-
#define SCREEN_COLS 32
36-
#define ENTRIES_PER_SCREEN 22
35+
#define SCREEN_COLS 30
36+
#define ENTRIES_PER_SCREEN 20
3737
#define ENTRIES_START_ROW 2
3838
#define ENTRY_PAGE_LENGTH 10
3939

@@ -114,8 +114,8 @@ void showDirectoryContents (const vector<DirEntry>& dirContents, int startRow) {
114114
getcwd(path, PATH_MAX);
115115

116116
// Clear the screen
117-
iprintf ("\x1b[2J");
118-
117+
consoleClear();
118+
119119
// Print the path
120120
if (strlen(path) < SCREEN_COLS) {
121121
iprintf ("%s", path);
@@ -126,7 +126,7 @@ void showDirectoryContents (const vector<DirEntry>& dirContents, int startRow) {
126126
// Move to 2nd row
127127
iprintf ("\x1b[1;0H");
128128
// Print line of dashes
129-
iprintf ("--------------------------------");
129+
iprintf ("------------------------------");
130130

131131
// Print directory listing
132132
for (int i = 0; i < ((int)dirContents.size() - startRow) && i < ENTRIES_PER_SCREEN; i++) {
@@ -204,7 +204,7 @@ string browseForFile (const vector<string>& extensionList) {
204204
showDirectoryContents (dirContents, screenOffset);
205205
} else {
206206
// Clear the screen
207-
iprintf ("\x1b[2J");
207+
consoleClear();
208208
// Return the chosen file
209209
return entry->name;
210210
}

source/main.cpp

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,36 @@
3030

3131
#include "args.h"
3232
#include "file_browse.h"
33-
#include "hbmenu_banner.h"
33+
#include "font.h"
34+
#include "hbmenu_consolebg.h"
3435
#include "iconTitle.h"
3536
#include "nds_loader_arm9.h"
3637

3738

3839
using namespace std;
3940

41+
void InitGUI(void) {
42+
iconTitleInit();
43+
videoSetModeSub(MODE_4_2D);
44+
vramSetBankC(VRAM_C_SUB_BG);
45+
int bgSub = bgInitSub(3, BgType_Bmp8, BgSize_B8_256x256, 1, 0);
46+
PrintConsole *console = consoleInit(0, 0, BgType_Text4bpp, BgSize_T_256x256, 4, 6, false, false);
47+
dmaCopy(hbmenu_consolebgBitmap, bgGetGfxPtr(bgSub), 256*256);
48+
ConsoleFont font;
49+
font.gfx = (u16*)fontTiles;
50+
font.pal = (u16*)fontPal;
51+
font.numChars = 95;
52+
font.numColors = (fontPalLen / 2);
53+
font.bpp = 4;
54+
font.asciiOffset = 32;
55+
font.convertSingleColor = true;
56+
consoleSetFont(console, &font);
57+
dmaCopy(hbmenu_consolebgPal, BG_PALETTE_SUB, 256*2);
58+
BG_PALETTE_SUB[255] = RGB15(31,31,31);
59+
keysSetRepeat(25,5);
60+
consoleSetWindow(console, 1, 1, 30, 22);
61+
}
62+
4063
//---------------------------------------------------------------------------------
4164
void stop (void) {
4265
//---------------------------------------------------------------------------------
@@ -53,21 +76,12 @@ int main(int argc, char **argv) {
5376
// so tapping power on DSi returns to DSi menu
5477
extern u64 *fake_heap_end;
5578
*fake_heap_end = 0;
56-
57-
iconTitleInit();
58-
59-
// Subscreen as a console
60-
videoSetModeSub(MODE_0_2D);
61-
vramSetBankH(VRAM_H_SUB_BG);
62-
consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 15, 0, false, true);
63-
79+
InitGUI();
6480
if (!fatInitDefault()) {
65-
iprintf ("fatinitDefault failed!\n");
81+
iprintf ("\n\nfatinitDefault failed!\n");
6682
stop();
6783
}
6884

69-
keysSetRepeat(25,5);
70-
7185
vector<string> extensionList = argsGetExtensionList();
7286

7387
if(!access("/ROMs/gba", F_OK)) {

0 commit comments

Comments
 (0)