去掉filebrowser对console的API的调用看看

This commit is contained in:
anod 2022-08-10 13:41:06 +08:00
parent c5e0516ec1
commit d049280d4a
2 changed files with 10 additions and 11 deletions

View File

@ -319,7 +319,7 @@ static int render_unicode(FHandle fd, int *x, unsigned width, unsigned height, u
// maxwidth - 最长绘制多少个像素点填0则忽略此参数
// utf8_line - utf8字符串
// 返回第一个未绘制的字符的位置如果width为0则返回永远是NULL
const char *acf_draw(int x, int y, unsigned width, unsigned height, unsigned maxwidth, const char *utf8_line)
const char *acf_draw(int x, int y, unsigned width, unsigned height, unsigned maxwidth, uint16_t color, const char *utf8_line)
{
FHandle font;
int linex = 0;
@ -357,7 +357,7 @@ const char *acf_draw(int x, int y, unsigned width, unsigned height, unsigned max
// copy back to canvas
uint16_t *frame = consoleGet()->frameBuffer;
uint16_t fg = consoleGetFgColor();
uint16_t fg = color;
for( int i=0; i < gblfont.height; ++i )
{
for( int j=0; j < (int)maxwidth; ++j )

View File

@ -23,11 +23,12 @@
#include "fs.h"
#include "util.h"
#include "arm11/drivers/hid.h"
#include "arm11/console.h"
#include "arm11/fmt.h"
#include "drivers/gfx.h"
#include "arm11/acf.h"
#define screenClean() ee_printf("\x1b[2J\x1b[0m")
#define screenClean() for( uint16_t *vram=consoleGet()->frameBuffer, c=CWIDTH*CHEIGHT; c-->0; vram++ ) *vram=0
// Notes on these settings:
// MAX_ENT_BUF_SIZE should be big enough to hold the average file/dir name length * MAX_DIR_ENTRIES.
@ -141,8 +142,8 @@ 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
ee_printf("\x1b[%dm", *dList -> ptrs[i] == ENT_TYPE_FILE ? 37 : 36);
acf_draw(CLEFTMARGIN, LINENO_TO_Y(i-start), CWIDTH, CHEIGHT, CLINELIMIT, &dList->ptrs[i][1] );
const uint8_t fg = *dList -> ptrs[i] == ENT_TYPE_FILE ? 37 : 36;
acf_draw(CLEFTMARGIN, LINENO_TO_Y(i-start), CWIDTH, CHEIGHT, CLINELIMIT, consoleGetRGB565Color(fg), &dList->ptrs[i][1] );
}
}
@ -172,16 +173,14 @@ Result browseFiles(const char *const basePath, char selected[512])
//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( CLEFTMARGIN, LINENO_TO_Y(oldCursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, &dList->ptrs[oldCursorPos][1] );
const uint8_t fg = *dList -> ptrs[oldCursorPos] == ENT_TYPE_FILE ? 37:36
acf_draw( CLEFTMARGIN, LINENO_TO_Y(oldCursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, consoleGetRGB565Color(fg), &dList->ptrs[oldCursorPos][1] );
}
ee_printf("\x1b[33m");
acf_draw( CLEFTMARGIN, LINENO_TO_Y(cursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, &dList->ptrs[cursorPos][1] );
acf_draw( CLEFTMARGIN, LINENO_TO_Y(cursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, consoleGetRGB565Color(33), &dList->ptrs[cursorPos][1] );
}
else {
//ee_printf("\x1b[%lu;H\x1b[0m>%.51s", cursorPos - windowPos, "<no gba rom>");
ee_printf("\x1b[0m");
acf_draw( CLEFTMARGIN, LINENO_TO_Y(cursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, "<NO GBA ROM>" );
acf_draw( CLEFTMARGIN, LINENO_TO_Y(cursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, consoleGetRGB565Color(7), "<NO GBA ROM>" );
}
u32 kDown;