diff --git a/include/arm11/acf.h b/include/arm11/acf.h index 2d3c18f..4280090 100644 --- a/include/arm11/acf.h +++ b/include/arm11/acf.h @@ -13,7 +13,7 @@ #define ACFONT_MEM_EMPTY 5 extern int acf_set_font(const char *); -extern const char *acf_draw(int, int, unsigned, unsigned, unsigned, const char *); +extern const char *acf_draw(int, int, unsigned, unsigned, unsigned, uint16_t, const char *); #define ACF_LIT_POINT(x, y, w, h, islit) \ { \ diff --git a/source/arm11/filebrowser.c b/source/arm11/filebrowser.c index 83fa4a3..aa10ddd 100644 --- a/source/arm11/filebrowser.c +++ b/source/arm11/filebrowser.c @@ -28,7 +28,7 @@ #include "drivers/gfx.h" #include "arm11/acf.h" -#define screenClean() for( uint16_t *vram=consoleGet()->frameBuffer, c=CWIDTH*CHEIGHT; c-->0; vram++ ) *vram=0 +#define screenClean() memset(consoleGet()->frameBuffer, 0, CWIDTH*CHEIGHT*sizeof(uint16_t)) // Notes on these settings: // MAX_ENT_BUF_SIZE should be big enough to hold the average file/dir name length * MAX_DIR_ENTRIES. @@ -142,7 +142,7 @@ static void showDirList(const DirList *const dList, u32 start) // (*dList->ptrs[i] == ENT_TYPE_FILE ? "\x1b[%lu;H\x1b[37m %.51s" : "\x1b[%lu;H\x1b[36m %.51s"); //ee_printf(printStr, i - start, &dList->ptrs[i][1]); // TODO: use acf to display - const uint8_t fg = *dList -> ptrs[i] == ENT_TYPE_FILE ? 37 : 36; + const uint8_t fg = *dList -> ptrs[i] == ENT_TYPE_FILE ? 7 : 6; acf_draw(CLEFTMARGIN, LINENO_TO_Y(i-start), CWIDTH, CHEIGHT, CLINELIMIT, consoleGetRGB565Color(fg), &dList->ptrs[i][1] ); } } @@ -171,12 +171,12 @@ Result browseFiles(const char *const basePath, char selected[512]) 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 ) + if( oldCursorPos != cursorPos && windowPos <= oldCursorPos && oldCursorPos < windowPos + SCREEN_ROWS ) { - const uint8_t fg = *dList -> ptrs[oldCursorPos] == ENT_TYPE_FILE ? 37:36 + const uint8_t fg = *dList -> ptrs[oldCursorPos] == ENT_TYPE_FILE ? 7:6; acf_draw( CLEFTMARGIN, LINENO_TO_Y(oldCursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, consoleGetRGB565Color(fg), &dList->ptrs[oldCursorPos][1] ); } - acf_draw( CLEFTMARGIN, LINENO_TO_Y(cursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, consoleGetRGB565Color(33), &dList->ptrs[cursorPos][1] ); + acf_draw( CLEFTMARGIN, LINENO_TO_Y(cursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, consoleGetRGB565Color(3), &dList->ptrs[cursorPos][1] ); } else { //ee_printf("\x1b[%lu;H\x1b[0m>%.51s", cursorPos - windowPos, "");