diff --git a/source/arm11/acf.c b/source/arm11/acf.c index fcf3009..6cc1b14 100644 --- a/source/arm11/acf.c +++ b/source/arm11/acf.c @@ -342,7 +342,10 @@ const char *acf_draw(int x, int y, unsigned width, unsigned height, unsigned max next = next_unicode(utf8_line, &unicode)) { int error = render_unicode(font, &linex, maxwidth, height, unicode, option, localram); - if (error) + if (error > 0 ) break; + else if(error < 0 ) error = render_unicode(font, &linex, maxwidth, height, '?', option, localram); + + if( error ) { free( localram ); fClose(font); diff --git a/source/arm11/filebrowser.c b/source/arm11/filebrowser.c index 47d2c78..a068bbe 100644 --- a/source/arm11/filebrowser.c +++ b/source/arm11/filebrowser.c @@ -40,9 +40,11 @@ #define SCREEN_COLS 19 #define SCREEN_ROWS 14u -#define LINENO_TO_Y(y) 4+(y)*15 +#define LINENO_TO_Y(y) 15+(y)*15 #define CWIDTH 320u #define CHEIGHT 240u +#define CLEFTMARGIN 20u +#define CLINELIMIT 282u #define ENT_TYPE_FILE (0) #define ENT_TYPE_DIR (1) @@ -140,7 +142,7 @@ static void showDirList(const DirList *const dList, u32 start) //ee_printf(printStr, i - start, &dList->ptrs[i][1]); // TODO: use acf to display ee_printf("\x1b[%dm", *dList -> ptrs[i] == ENT_TYPE_FILE ? 37 : 36); - acf_draw(20, LINENO_TO_Y(i-start), CWIDTH, CHEIGHT, 292, &dList->ptrs[i][1] ); + acf_draw(CLEFTMARGIN, LINENO_TO_Y(i-start), CWIDTH, CHEIGHT, CLINELIMIT, &dList->ptrs[i][1] ); } } @@ -165,22 +167,21 @@ Result browseFiles(const char *const basePath, char selected[512]) s32 oldCursorPos = 0; while(1) { - // TODO: use acf to display if( dList->num > 0 ){ //ee_printf(*dList->ptrs[oldCursorPos] == ENT_TYPE_FILE ? "\x1b[%lu;H\x1b[37m %.51s" : "\x1b[%lu;H\x1b[36m %.51s", oldCursorPos - windowPos, &dList->ptrs[oldCursorPos][1]); // Clear old cursor. //ee_printf("\x1b[%lu;H\x1b[33m>%.51s", cursorPos - windowPos, &dList->ptrs[cursorPos][1]); // Draw cursor. if( oldCursorPos != cursorPos ) { ee_printf("\x1b[%dm", *dList -> ptrs[oldCursorPos] == ENT_TYPE_FILE ? 37:36); - acf_draw( 20, LINENO_TO_Y(oldCursorPos-windowPos), CWIDTH, CHEIGHT, 292, &dList->ptrs[oldCursorPos][1] ); + acf_draw( CLEFTMARGIN, LINENO_TO_Y(oldCursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, &dList->ptrs[oldCursorPos][1] ); } ee_printf("\x1b[33m"); - acf_draw( 20, LINENO_TO_Y(cursorPos-windowPos), CWIDTH, CHEIGHT, 292, &dList->ptrs[cursorPos][1] ); + acf_draw( CLEFTMARGIN, LINENO_TO_Y(cursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, &dList->ptrs[cursorPos][1] ); } else { //ee_printf("\x1b[%lu;H\x1b[0m>%.51s", cursorPos - windowPos, ""); ee_printf("\x1b[0m"); - acf_draw( 20, LINENO_TO_Y(cursorPos-windowPos), CWIDTH, CHEIGHT, 292, "" ); + acf_draw( CLEFTMARGIN, LINENO_TO_Y(cursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, "" ); } u32 kDown; diff --git a/source/arm11/open_agb_firm.c b/source/arm11/open_agb_firm.c index b9794bb..26b9462 100644 --- a/source/arm11/open_agb_firm.c +++ b/source/arm11/open_agb_firm.c @@ -684,7 +684,7 @@ Result oafParseConfigEarly(void) // Create the saves folder. if((res = fMkdir(OAF_SAVE_DIR)) != RES_OK && res != RES_FR_EXIST) break; - if((res = acf_set_font("wqy11.acf")) != RES_OK ) break; + if((res = acf_set_font("wqy11.fnt")) != RES_OK ) break; // Parse the config. res = parseOafConfig("config.ini", true);