修改atp_tips的范围,只负责右下角不再处理左下角

This commit is contained in:
anod 2023-04-29 23:30:19 +08:00
parent b295977380
commit af2e807134
5 changed files with 43 additions and 28 deletions

View File

@ -107,8 +107,8 @@ extern atp_error_t atp_select(
); );
extern atp_error_t atp_tips( extern atp_error_t atp_tips(
INPUT(atp_text_t) tips_at_bottom_left, INPUT(atp_text_t) tips_string,
INPUT(atp_text_t) tips_at_bottom_right OUTPUT(atp_text_t) tips_before
); );
#undef INPUT #undef INPUT

View File

@ -7,8 +7,8 @@
#define TITLE_MAX 8 #define TITLE_MAX 8
#define TIPS_MAX 64 #define TIPS_MAX 64
static char ta[TIPS_MAX] = {'\0'}; static char dymt[TIPS_MAX] = {'\0'};
static char tb[TIPS_MAX] = {'\0'}; static atp_text_t stct = NULL;
#define ATP_COLOR_SIZE (ATP_COLOR_WHITE+1) #define ATP_COLOR_SIZE (ATP_COLOR_WHITE+1)
@ -79,8 +79,8 @@ const char *acf_put_text(int x, int y, int width, int height, int maxwidth, u8 c
static void screen_clean() static void screen_clean()
{ {
memset(consoleGet()->frameBuffer, 0, WINDOW_WIDTH*WINDOW_HEIGHT*sizeof(uint16_t)); memset(consoleGet()->frameBuffer, 0, WINDOW_WIDTH*WINDOW_HEIGHT*sizeof(uint16_t));
if( ta[0] ) acf_put_text( 5, 215, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH-10, ATP_COLOR_CYAN, ATP_PLACEMENT_LEFT, ta ); if( dymt[0] ) acf_put_text( 5, 215, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH-10, ATP_COLOR_CYAN, ATP_PLACEMENT_LEFT, dymt );
if( tb[0] ) acf_put_text( 5, 215, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH-10, ATP_COLOR_CYAN, ATP_PLACEMENT_RIGHT, tb ); if( stct[0] ) acf_put_text( 5, 215, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH-10, ATP_COLOR_CYAN, ATP_PLACEMENT_RIGHT, stct );
} }
static void screen_clean_zone( int x, int y, int w, int h ) static void screen_clean_zone( int x, int y, int w, int h )
@ -108,6 +108,13 @@ static uint32_t waitKey()
return down; return down;
} }
static atp_error_t dynamic_tips( atp_text_t tips )
{
if( strlen(tips) > TIPS_MAX-1 ) return ATP_INDEX_OUTOFRANGE;
strcpy( dymt, tips );
return ATP_SUCCESS;
}
#define easy_put(text, align, color, row) acf_put_text( \ #define easy_put(text, align, color, row) acf_put_text( \
CONTAINER_LEFTTOP_X, \ CONTAINER_LEFTTOP_X, \
CONTAINER_LEFTTOP_Y+FONT_HEIGHT*(row), \ CONTAINER_LEFTTOP_Y+FONT_HEIGHT*(row), \
@ -144,6 +151,8 @@ static void container_paint( atp_lineprovider_t provider, atp_callerdata_t data,
atp_error_t atp_show( atp_counter_t cnt, atp_lineprovider_t provider, atp_callerdata_t data ) atp_error_t atp_show( atp_counter_t cnt, atp_lineprovider_t provider, atp_callerdata_t data )
{ {
int idx_top = 0; int idx_top = 0;
dynamic_tips("");
screen_clean(); screen_clean();
container_paint( provider, data, cnt, idx_top ); container_paint( provider, data, cnt, idx_top );
@ -197,7 +206,7 @@ static void set_paging( int top, int len )
unsigned current = top / CONTAINER_MAX_LINES; unsigned current = top / CONTAINER_MAX_LINES;
char buf[32]; char buf[32];
ee_snprintf( buf, sizeof(buf), "页码:%d/%d", current+1, total ); ee_snprintf( buf, sizeof(buf), "页码:%d/%d", current+1, total );
atp_tips( buf, NULL ); dynamic_tips( buf );
screen_clean(); screen_clean();
} }
@ -384,17 +393,17 @@ 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, atp_text_t *old )
{ {
if( tipsA != NULL ) if( old != NULL )
*old = stct;
if( tips != NULL )
{ {
strncpy( ta, tipsA, TIPS_MAX-1 ); if( strlen(tips) > TIPS_MAX-1 )
ta[TIPS_MAX-1] = 0; return ATP_INDEX_OUTOFRANGE;
}
if( tipsB != NULL ) stct = tips;
{
strncpy( tb, tipsB, TIPS_MAX-1 );
tb[TIPS_MAX-1] = 0;
} }
return ATP_SUCCESS; return ATP_SUCCESS;
} }

View File

@ -181,7 +181,7 @@ static atp_text_t folder_help[] = {
"A键      查看目录或启动游戏", "A键      查看目录或启动游戏",
"B键          上层文件夹", "B键          上层文件夹",
"X键            金手指", "X键            金手指",
"Y键           暂不使用", "Y键         配置游戏键位",
"START        查看说明", "START        查看说明",
"SELECT       系统设置" "SELECT       系统设置"
}; };
@ -233,9 +233,10 @@ static atp_error_t display_help( atp_callerdata_t table, atp_counter_t index, at
atp_error_t help_page( atp_text_t *wording, atp_counter_t length ) atp_error_t help_page( atp_text_t *wording, atp_counter_t length )
{ {
atp_tips( NULL, "返回按A/B" ); atp_text_t current;
atp_tips( "返回按A/B", &current );
atp_error_t res = atp_show( length, display_help, (atp_callerdata_t)wording ); atp_error_t res = atp_show( length, display_help, (atp_callerdata_t)wording );
atp_tips( NULL, "指引按START" ); atp_tips( current, NULL );
return res; return res;
} }
@ -658,7 +659,6 @@ static atp_pageopt_t serve_on_key( atp_callerdata_t data, atp_counter_t index, a
{ {
if( start ) if( start )
{ {
atp_tips( "", NULL );
return WAIT_ON_ACT( help_page( folder_help, sizeof(folder_help)/sizeof(atp_text_t) ) ); return WAIT_ON_ACT( help_page( folder_help, sizeof(folder_help)/sizeof(atp_text_t) ) );
} }
else if( select ) else if( select )
@ -736,7 +736,8 @@ static atp_pageopt_t serve_on_key( atp_callerdata_t data, atp_counter_t index, a
uint8_t status = DISP_REGION; uint8_t status = DISP_REGION;
atp_counter_t defi = 0; atp_counter_t defi = 0;
acl_entryid_t eid = 0; acl_entryid_t eid = 0;
atp_tips(NULL, "确定A/取消B"); atp_text_t oldtips;
atp_tips("确定A/取消B", &oldtips);
while( status != DISP_DONE ) while( status != DISP_DONE )
{ {
@ -812,7 +813,7 @@ static atp_pageopt_t serve_on_key( atp_callerdata_t data, atp_counter_t index, a
} }
acl_close_lib(); acl_close_lib();
atp_tips( NULL, "指引按START" ); atp_tips( oldtips, NULL );
return WAIT_ON_ACT( res ); return WAIT_ON_ACT( res );
} }
else if( y ) else if( y )
@ -823,6 +824,8 @@ static atp_pageopt_t serve_on_key( atp_callerdata_t data, atp_counter_t index, a
#endif #endif
atp_itemval_t position=0, field=0, value; atp_itemval_t position=0, field=0, value;
atp_error_t res; atp_error_t res;
atp_text_t oldtips;
atp_tips( "确定A/取消B", oldtips );
#define DISP_KPOS 1 #define DISP_KPOS 1
#define DISP_SETK 2 // SET KEY #define DISP_SETK 2 // SET KEY
@ -967,6 +970,7 @@ static atp_pageopt_t serve_on_key( atp_callerdata_t data, atp_counter_t index, a
else break; else break;
} }
} }
atp_tips( oldtips, NULL );
return WAIT_ON_ACT(res); return WAIT_ON_ACT(res);
} }
@ -1022,7 +1026,7 @@ Result browseFiles(const char *const basePath, char selected[512])
{ {
GFX_waitForVBlank0(); GFX_waitForVBlank0();
hidScanInput(); hidScanInput();
atp_tips( NULL, "指引按START" ); atp_tips( "指引按START", NULL );
void *cust[2] = {dList, curDir}; void *cust[2] = {dList, curDir};
error = atp_select( curDir, count, display_folder, serve_on_key, (atp_callerdata_t)cust, selecting, 0, &value ); error = atp_select( curDir, count, display_folder, serve_on_key, (atp_callerdata_t)cust, selecting, 0, &value );
} }
@ -1067,9 +1071,7 @@ Result browseFiles(const char *const basePath, char selected[512])
{// 上层目录 {// 上层目录
if( strcmp(curDir, FS_DRIVE_NAMES) == 0 ) if( strcmp(curDir, FS_DRIVE_NAMES) == 0 )
{ {
atp_tips("没有上层目录", NULL); atp_show(1, disp_str, "没有上层目录");
help_page( folder_help, sizeof(folder_help)/sizeof(atp_text_t) );
atp_tips("", NULL);
} }
else DIRUP; else DIRUP;
} }

View File

@ -43,7 +43,9 @@ void keyremix_freeze()
temp[0].game_keys = p->game_keys; temp[0].game_keys = p->game_keys;
has_cheat = 1; has_cheat = 1;
} }
else if( p->remix_type != REMIX_TYPE_NONE ) else if( p->remix_type != REMIX_TYPE_NONE
&& p->device_keys != 0
&& p->game_keys != 0 )
{ {
temp[j].remix_type = p->remix_type; temp[j].remix_type = p->remix_type;
temp[j].device_keys = p->device_keys; temp[j].device_keys = p->device_keys;

View File

@ -278,7 +278,6 @@ static atp_pageopt_t config_adjust( atp_callerdata_t, atp_counter_t index, atp_b
} }
else if( start ) else if( start )
{ {
atp_tips("", NULL);
return ATP_POWER_OFF == help_page( config_help, sizeof(config_help)/sizeof(atp_text_t) ) return ATP_POWER_OFF == help_page( config_help, sizeof(config_help)/sizeof(atp_text_t) )
? ATP_POWER_OFF : ATP_PAGE_REFRESH; ? ATP_POWER_OFF : ATP_PAGE_REFRESH;
} }
@ -305,12 +304,15 @@ atp_error_t oaf_config_page()
static char title[210]; static char title[210];
memcpy( base, &g_oafConfig, sizeof(g_oafConfig) ); memcpy( base, &g_oafConfig, sizeof(g_oafConfig) );
OafConfig *prev = (OafConfig*)&base[0]; OafConfig *prev = (OafConfig*)&base[0];
atp_text_t oldtips;
atp_tips("保存X/确定A/取消B", &oldtips);
ee_snprintf( ee_snprintf(
title, sizeof(title), title, sizeof(title),
"参数配置           当前电量:%3d%%" "参数配置           当前电量:%3d%%"
"每次开机存档方案重置为“和卡带序列号一致”,这个方案会优先使用游戏最后一次启动时设置的存档类型", MCU_getBatteryLevel()); "每次开机存档方案重置为“和卡带序列号一致”,这个方案会优先使用游戏最后一次启动时设置的存档类型", MCU_getBatteryLevel());
atp_error_t res = atp_select( title, 5, config_item, config_adjust, NULL, 0, 0, NULL ); atp_error_t res = atp_select( title, 5, config_item, config_adjust, NULL, 0, 0, NULL );
atp_tips( oldtips, NULL );
if( res == ATP_NO_ACTION ) if( res == ATP_NO_ACTION )
{ {
memcpy( &g_oafConfig, prev, sizeof(g_oafConfig) ); memcpy( &g_oafConfig, prev, sizeof(g_oafConfig) );