From 2102cb0b465ec6183910a1cb4c72d0e17741053f Mon Sep 17 00:00:00 2001 From: root <182859762@qq.com> Date: Mon, 26 Sep 2022 14:43:06 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E5=86=85=E5=AE=B9=EF=BC=8C=E9=9C=80=E8=A6=81=E9=95=BF?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/arm11/filebrowser.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/source/arm11/filebrowser.c b/source/arm11/filebrowser.c index fbfdef1..d89c880 100644 --- a/source/arm11/filebrowser.c +++ b/source/arm11/filebrowser.c @@ -92,10 +92,28 @@ const char *acf_draw(int x, int y, int width, int height, int maxwidth, u16 colo } static const char *page[] = { - "是这里吗?", - "我不知道呢", - "能再看一遍吗?", - "原来是这样啊" + "a ha", + "舍不得璀璨俗世", + "a ha", + "躲不开痴恋的欣慰", + "a ha", + "找不到色相代替", + "a ha", + "参一生参不透这条难题", + "吞风吻雨葬落日", + "未曾彷徨", + "欺山赶海践雪径", + "也未绝望", + "沾花把酒偏折煞", + "世人情狂", + "凭这两眼与百臂", + "或千手不能防", + "天阔阔雪漫漫", + "风随怒航", + "这砂滚滚水皱皱", + "笑着浪荡", + "贪欢一晌偏叫那", + "女儿情长埋葬" }; static atp_error_t test_show( atp_callerdata_t data, atp_counter_t idx, atp_text_t *ptext, atp_itemval_t *pval, atp_color_t *c ) @@ -304,7 +322,7 @@ Result browseFiles(const char *const basePath, char selected[512]) } if( kDown & KEY_X ){ - atp_show( 4, test_show, NULL ); + atp_show( 22, test_show, NULL ); } } From e09f5795891832c45b0e52047380c036a255c185 Mon Sep 17 00:00:00 2001 From: root <182859762@qq.com> Date: Sun, 2 Oct 2022 17:40:23 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E6=8B=BC=E5=86=99=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/arm11/filebrowser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/arm11/filebrowser.c b/source/arm11/filebrowser.c index 6dd48c0..445aa9b 100644 --- a/source/arm11/filebrowser.c +++ b/source/arm11/filebrowser.c @@ -61,7 +61,7 @@ typedef struct const char *acf_draw(int x, int y, int width, int height, int maxwidth, u16 color, const char* text) { - return atf_put_text(x, y, width, height, maxwidth, color, ATP_PLACEMENT_LEFT, text); + return atp_put_text(x, y, width, height, maxwidth, color, ATP_PLACEMENT_LEFT, text); } static const char *page[] = { From acf15d935f0f5d6493a3b7b0b40b90b96a35dd7d Mon Sep 17 00:00:00 2001 From: root <182859762@qq.com> Date: Sun, 2 Oct 2022 19:26:08 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=8A=8Afilebrowser.c=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=89=8D=E6=99=AF=E8=89=B2=E4=BF=AE=E6=94=B9=E4=B8=BA=E6=9E=9A?= =?UTF-8?q?=E4=B8=BE=E5=80=BC=E8=80=8C=E4=B8=8D=E6=98=AFrgb565?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/arm11/atp.c | 4 ++-- source/arm11/filebrowser.c | 22 ++++++++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/source/arm11/atp.c b/source/arm11/atp.c index 691f755..2ecbff1 100644 --- a/source/arm11/atp.c +++ b/source/arm11/atp.c @@ -60,8 +60,8 @@ const char *acf_put_text(int x, int y, int width, int height, int maxwidth, u8 c static void screen_clean() { memset(consoleGet()->frameBuffer, 0, WINDOW_WIDTH*WINDOW_HEIGHT*sizeof(uint16_t)); - acf_put_text( 5, 215, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH-10, ATP_COLOR_BLUE, ATP_PLACEMENT_LEFT, ta ); - acf_put_text( 5, 215, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH-10, ATP_COLOR_BLUE, ATP_PLACEMENT_RIGHT, tb ); + if( ta[0] ) acf_put_text( 5, 215, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH-10, ATP_COLOR_BLUE, ATP_PLACEMENT_LEFT, ta ); + if( tb[0] ) acf_put_text( 5, 215, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH-10, ATP_COLOR_BLUE, ATP_PLACEMENT_RIGHT, tb ); } // wait key pressed, if power key is pressed, return 0 diff --git a/source/arm11/filebrowser.c b/source/arm11/filebrowser.c index c899f0c..a7e516e 100644 --- a/source/arm11/filebrowser.c +++ b/source/arm11/filebrowser.c @@ -59,10 +59,11 @@ typedef struct char *ptrs[MAX_DIR_ENTRIES]; // For fast sorting. } DirList; -const char *acf_put_text(int x, int y, int width, int height, int maxwidth, u8 color, u8 placement, const char* text); +extern const char *acf_put_text(int x, int y, int width, int height, int maxwidth, u8 color, u8 placement, const char* text); + const char *acf_draw(int x, int y, int width, int height, int maxwidth, u8 color, const char* text) { - return atp_put_text(x, y, width, height, maxwidth, color, ATP_PLACEMENT_LEFT, text); + return acf_put_text(x, y, width, height, maxwidth, color, ATP_PLACEMENT_LEFT, text); } static const char *page[] = { @@ -90,7 +91,7 @@ static const char *page[] = { "女儿情长埋葬" }; -static atp_error_t test_show( atp_callerdata_t data, atp_counter_t idx, atp_text_t *ptext, atp_itemval_t *pval, atp_color_t *c, atp_placement_t *p ) +static atp_error_t test_show( atp_callerdata_t , atp_counter_t idx, atp_text_t *ptext, atp_itemval_t *, atp_color_t *, atp_placement_t * ) { if( idx < sizeof(page) ){ *ptext = page[idx]; @@ -184,7 +185,7 @@ static void showDirList(const DirList *const dList, u32 start) //ee_printf(printStr, i - start, &dList->ptrs[i][1]); // TODO: use acf to display 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] ); + acf_draw(CLEFTMARGIN, LINENO_TO_Y(i-start), CWIDTH, CHEIGHT, CLINELIMIT, fg, &dList->ptrs[i][1] ); } } @@ -215,13 +216,13 @@ Result browseFiles(const char *const basePath, char selected[512]) if( oldCursorPos != cursorPos && windowPos <= (u32)oldCursorPos && (u32)oldCursorPos < windowPos + SCREEN_ROWS ) { 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(oldCursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, fg, &dList->ptrs[oldCursorPos][1] ); } - acf_draw( CLEFTMARGIN, LINENO_TO_Y(cursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, consoleGetRGB565Color(3), &dList->ptrs[cursorPos][1] ); + acf_draw( CLEFTMARGIN, LINENO_TO_Y(cursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, 3, &dList->ptrs[cursorPos][1] ); } else { //ee_printf("\x1b[%lu;H\x1b[0m>%.51s", cursorPos - windowPos, ""); - acf_draw( CLEFTMARGIN, LINENO_TO_Y(cursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, consoleGetRGB565Color(7), "" ); + acf_draw( CLEFTMARGIN, LINENO_TO_Y(cursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, 7, "" ); } u32 kDown; @@ -296,7 +297,12 @@ Result browseFiles(const char *const basePath, char selected[512]) } if( kDown & KEY_X ){ - if( atp_show( 22, test_show, NULL ) == 0 ) goto end; + atp_tips(curDir, NULL); + if( atp_show( 22, test_show, NULL ) == ATP_POWER_OFF ) + { + res = RES_NOT_FOUND; + goto end; + } } }