增加显示帮助提示

This commit is contained in:
anod 2022-10-15 21:07:43 +08:00
parent 846f0cab23
commit cbd7dfb766
3 changed files with 43 additions and 14 deletions

View File

@ -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

View File

@ -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;

View File

@ -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 )