diff --git a/source/arm11/filebrowser.c b/source/arm11/filebrowser.c index d88ee4a..4f1321f 100644 --- a/source/arm11/filebrowser.c +++ b/source/arm11/filebrowser.c @@ -120,7 +120,7 @@ scanEnd: return res; } -static void showDirList(const DirList *const dList, u32 start, u32 current) +static void showDirList(const DirList *const dList, u32 start) { // Clear screen. ee_printf("\x1b[2J"); @@ -128,10 +128,10 @@ static void showDirList(const DirList *const dList, u32 start, u32 current) const u32 listLength = (dList->num - start > SCREEN_ROWS ? start + SCREEN_ROWS : dList->num); for(u32 i = start; i < listLength; i++) { - const char *const printStr = "\x1b[%lu;H\x1b[%dm %.51s"; - bool isfile = *dList->ptrs[i] == ENT_TYPE_FILE; + const char *const printStr = + (*dList->ptrs[i] == ENT_TYPE_FILE ? "\x1b[%lu;H\x1b[37m %.51s" : "\x1b[%lu;H\x1b[36m %.51s"); - ee_printf(printStr, i - start, i==current ? 33 : (isfile ? 37 : 36), &dList->ptrs[i][1]); + ee_printf(printStr, i - start, &dList->ptrs[i][1]); } } @@ -149,7 +149,7 @@ Result browseFiles(const char *const basePath, char selected[512]) Result res; if((res = scanDir(curDir, dList, ".gba")) != RES_OK) goto end; - showDirList(dList, 0, 0); + showDirList(dList, 0); s32 cursorPos = 0; // Within the entire list. u32 windowPos = 0; // Window start position within the list. @@ -157,7 +157,7 @@ Result browseFiles(const char *const basePath, char selected[512]) while(1) { ee_printf("\x1b[%lu;H ", oldCursorPos - windowPos); // Clear old cursor. - ee_printf("\x1b[%lu;H\x1b[37m>", cursorPos - windowPos); // Draw cursor. + ee_printf("\x1b[%lu;H\x1b[33m> %.51s", cursorPos - windowPos, &dList->ptrs[cursorPos][1]); // Draw cursor. u32 kDown; do @@ -193,12 +193,12 @@ Result browseFiles(const char *const basePath, char selected[512]) if((u32)cursorPos < windowPos) { windowPos = cursorPos; - showDirList(dList, windowPos, (u32)cursorPos); + showDirList(dList, windowPos); } if((u32)cursorPos >= windowPos + SCREEN_ROWS) { windowPos = cursorPos - (SCREEN_ROWS - 1); - showDirList(dList, windowPos, (u32)cursorPos); + showDirList(dList, windowPos); } if(kDown & (KEY_A | KEY_B)) @@ -228,7 +228,7 @@ Result browseFiles(const char *const basePath, char selected[512]) if((res = scanDir(curDir, dList, ".gba")) != RES_OK) break; cursorPos = 0; windowPos = 0; - showDirList(dList, 0, 0); + showDirList(dList, 0); } }