From cbd7dfb7660fb45826290def6589c830513d4702 Mon Sep 17 00:00:00 2001 From: anod <182859762@qq.com> Date: Sat, 15 Oct 2022 21:07:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=98=BE=E7=A4=BA=E5=B8=AE?= =?UTF-8?q?=E5=8A=A9=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/arm11/atp.h | 3 +-- source/arm11/atp.c | 12 ++++------- source/arm11/filebrowser.c | 42 ++++++++++++++++++++++++++++++++++---- 3 files changed, 43 insertions(+), 14 deletions(-) diff --git a/include/arm11/atp.h b/include/arm11/atp.h index feeecf1..1a507e7 100644 --- a/include/arm11/atp.h +++ b/include/arm11/atp.h @@ -100,8 +100,7 @@ extern atp_error_t atp_select( ); extern atp_error_t atp_tips( - INPUT(atp_text_t) text_at_left_bottom, - INPUT(atp_text_t) text_at_right_bottom + INPUT(atp_text_t) tips ); #undef INPUT diff --git a/source/arm11/atp.c b/source/arm11/atp.c index 7d5a828..7ced98a 100644 --- a/source/arm11/atp.c +++ b/source/arm11/atp.c @@ -353,16 +353,12 @@ atp_error_t atp_select( atp_text_t title, atp_counter_t cnt, atp_itemprovider_t } } -atp_error_t atp_tips( atp_text_t tipsA, atp_text_t tipsB ) + +atp_error_t atp_tips( atp_text_t tips ) { - if( tipsA != NULL ) + if( tips != NULL ) { - strncpy( ta, tipsA, TIPS_MAX-1 ); - ta[TIPS_MAX-1] = 0; - } - if( tipsB != NULL ) - { - strncpy( tb, tipsB, TIPS_MAX-1 ); + strncpy( tb, tips, TIPS_MAX-1 ); tb[TIPS_MAX-1] = 0; } return ATP_SUCCESS; diff --git a/source/arm11/filebrowser.c b/source/arm11/filebrowser.c index a1dcba8..fdcd242 100644 --- a/source/arm11/filebrowser.c +++ b/source/arm11/filebrowser.c @@ -142,7 +142,19 @@ scanEnd: return res; } -atp_error_t display_folder( atp_callerdata_t data, atp_counter_t index, atp_itemcfg_t *config ) +const atp_text_t folder_help[] = { + "操 作 说 明", + "蓝色 --- 文件夹", + "白色 --- 游戏文件", + "A 键 --- 查看文件夹/运行游戏", + "B 键 --- 上层文件夹", + "X 键 --- 金手指", + "Y 键 --- 文件配置", + "START --- 查看说明", + "SELECT --- 系统设置" +}; + +static atp_error_t display_folder( atp_callerdata_t data, atp_counter_t index, atp_itemcfg_t *config ) { DirList *const dList = (DirList*)data; u8 type = *dList->ptrs[index]; @@ -153,7 +165,7 @@ atp_error_t display_folder( atp_callerdata_t data, atp_counter_t index, atp_item return ATP_SUCCESS; } -atp_error_t display_empty( atp_callerdata_t, atp_counter_t, atp_linecfg_t *config ) +static atp_error_t display_empty( atp_callerdata_t, atp_counter_t, atp_linecfg_t *config ) { config->text = "没有合适的文件"; config->text_align = ATP_PLACEMENT_CENTER; @@ -161,6 +173,21 @@ atp_error_t display_empty( atp_callerdata_t, atp_counter_t, atp_linecfg_t *confi return ATP_SUCCESS; } +static atp_error_t display_help( atp_callerdata_t table, atp_counter_t index, atp_linecfg_t *config ) +{ + atp_text_t *list = (atp_text_t*)table; + config->text_align = index == 0 ? ATP_PLACEMENT_CENTER : ATP_PLACEMENT_LEFT; + config->text_color = index == 0 ? ATP_COLOR_MAGENTA : ATP_COLOR_LIGHT; + config->text = table[index]; + return ATP_SUCCESS; +} + +static void help_page( atp_text_t *wording, atp_counter_t length ) +{ + atp_tips( "返回:按A/B" ); + atp_show( length, display_help, (atp_callerdata_t)wording ); +} + #define DIRBUFFSIZE 512 #define DIRUP { \ char *tmpPathPtr = curDir + pathLen; \ @@ -197,7 +224,10 @@ Result browseFiles(const char *const basePath, char selected[512]) u32 pathLen = strlen(curDir); if( count > 0 ) - error = atp_select( curDir, count, display_folder, NULL, (atp_callerdata_t)dList, selecting, strcmp(curDir, FS_DRIVE_NAMES)==0, &value ); + { + atp_tips( "指引:按START" ); + error = atp_select( curDir, count, display_folder, NULL, (atp_callerdata_t)dList, selecting, 0, &value ); + } else error = atp_show( 1, display_empty, NULL ); @@ -238,7 +268,11 @@ Result browseFiles(const char *const basePath, char selected[512]) } else if( error == ATP_NO_ACTION ) {// 上层目录 - DIRUP; + if( strcmp(curDir, FS_DRIVE_NAMES) == 0 ) + { + help_page( folder_help, sizeof(folder_help)/sizeof(atp_text_t) ); + } + else DIRUP; } if( scan )