为选择金手指添加记忆选中项

This commit is contained in:
anod 2023-01-19 20:02:06 +08:00
parent 2035b4e8c4
commit a1d3751670
2 changed files with 16 additions and 11 deletions

View File

@ -250,7 +250,7 @@ acl_error_t acl_select_game( acl_text_t game, acl_boolean_t filter, acl_count_t
inst->listc = gcount; inst->listc = gcount;
inst->setid = 0; inst->setid = 0;
*n = gcount; if( n != NULL ) *n = gcount;
fClose( fd ); fClose( fd );
return ACHTLIB_SUCCESS; return ACHTLIB_SUCCESS;
@ -259,6 +259,7 @@ acl_error_t acl_select_game( acl_text_t game, acl_boolean_t filter, acl_count_t
acl_error_t acl_query_cheat_set( acl_index_t index, acl_chtid_t *chtid, acl_region_t *region ) acl_error_t acl_query_cheat_set( acl_index_t index, acl_chtid_t *chtid, acl_region_t *region )
{ {
CheatLib *inst = &gblcht; CheatLib *inst = &gblcht;
if( chtid == NULL || region == NULL ) return ACHTLIB_SUCCESS;
if( inst->serc == 0 ) return ACHTLIB_NOT_OPEN; if( inst->serc == 0 ) return ACHTLIB_NOT_OPEN;
if( inst->listc == 0 ) return ACHTLIB_INVALID; if( inst->listc == 0 ) return ACHTLIB_INVALID;
@ -266,8 +267,8 @@ acl_error_t acl_query_cheat_set( acl_index_t index, acl_chtid_t *chtid, acl_regi
else else
{ {
CheatCfg *cfg = inst->list; CheatCfg *cfg = inst->list;
*chtid = cfg[index].cfgid; if( chtid!=NULL ) *chtid = cfg[index].cfgid;
*region = config_type( cfg[index].typeloc ); if( region!=NULL ) *region = config_type( cfg[index].typeloc );
return ACHTLIB_SUCCESS; return ACHTLIB_SUCCESS;
} }
} }
@ -434,7 +435,7 @@ acl_error_t acl_select_entry( acl_entryid_t id, acl_elemlen_t *count)
if( found ) break; if( found ) break;
} }
} }
*count = gblset.entry.datasz; if( count!=NULL ) *count = gblset.entry.datasz;
acl_error_t r = load_data(fd); acl_error_t r = load_data(fd);
fClose( fd ); fClose( fd );
@ -443,6 +444,7 @@ acl_error_t acl_select_entry( acl_entryid_t id, acl_elemlen_t *count)
acl_error_t acl_entry_get_label( acl_index_t index, acl_text_t *label ) acl_error_t acl_entry_get_label( acl_index_t index, acl_text_t *label )
{ {
if( label == NULL ) return ACHTLIB_SUCCESS;
if( gblcht.serc == 0 ) return ACHTLIB_NOT_OPEN; if( gblcht.serc == 0 ) return ACHTLIB_NOT_OPEN;
if( gblcht.listc == 0 ) return ACHTLIB_INVALID; if( gblcht.listc == 0 ) return ACHTLIB_INVALID;
if( gblcht.setid == 0 ) return ACHTLIB_INVALID; if( gblcht.setid == 0 ) return ACHTLIB_INVALID;
@ -458,6 +460,7 @@ acl_error_t acl_entry_get_label( acl_index_t index, acl_text_t *label )
acl_error_t acl_entry_get_armcode( acl_index_t index, acl_armcode_t *code ) acl_error_t acl_entry_get_armcode( acl_index_t index, acl_armcode_t *code )
{ {
if( code == NULL ) return ACHTLIB_SUCCESS;
if( gblcht.serc == 0 ) return ACHTLIB_NOT_OPEN; if( gblcht.serc == 0 ) return ACHTLIB_NOT_OPEN;
if( gblcht.listc == 0 ) return ACHTLIB_INVALID; if( gblcht.listc == 0 ) return ACHTLIB_INVALID;
if( gblcht.setid == 0 ) return ACHTLIB_INVALID; if( gblcht.setid == 0 ) return ACHTLIB_INVALID;

View File

@ -238,9 +238,8 @@ static atp_error_t disp_str( atp_callerdata_t data, atp_counter_t, atp_linecfg_t
static atp_error_t select_region( atp_callerdata_t, atp_counter_t index, atp_itemcfg_t *config ) static atp_error_t select_region( atp_callerdata_t, atp_counter_t index, atp_itemcfg_t *config )
{ {
static char text[16]; static char text[16];
acl_chtid_t sid;
acl_region_t sreg; acl_region_t sreg;
if( ACHTLIB_SUCCESS != acl_query_cheat_set(index, &sid, &sreg) ) if( ACHTLIB_SUCCESS != acl_query_cheat_set(index, NULL, &sreg) )
{ {
config->text = "无效数据"; config->text = "无效数据";
config->value = index; config->value = index;
@ -260,7 +259,7 @@ static atp_error_t select_region( atp_callerdata_t, atp_counter_t index, atp_ite
} }
ee_sprintf(text, "%c-%s", 'A'+(char)index, t); ee_sprintf(text, "%c-%s", 'A'+(char)index, t);
config->text = text; config->text = text;
config->value = sid; config->value = index;
return ATP_SUCCESS; return ATP_SUCCESS;
} }
@ -380,13 +379,16 @@ 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;
while( status != DISP_DONE ) while( status != DISP_DONE )
{ {
acl_entryid_t eid; atp_counter_t defi = 0;
acl_entryid_t eid = 0;
if( status == DISP_REGION ) if( status == DISP_REGION )
{ {
res = atp_select("选择一个金手指配置", len, select_region, NULL, NULL, 0, 0, &item ); res = atp_select("选择一个金手指配置", len, select_region, NULL, NULL, defi, 0, &item );
if( res == ATP_SUCCESS ) if( res == ATP_SUCCESS )
{ {
acl_chtid_t sid = (acl_chtid_t)item; defi = item;
acl_chtid_t sid;
acl_query_cheat_set((acl_index_t)item, &sid, NULL );
acl_select_cheat_set( sid ); acl_select_cheat_set( sid );
status = DISP_HOLES; status = DISP_HOLES;
} }
@ -399,7 +401,7 @@ static atp_pageopt_t serve_on_key( atp_callerdata_t data, atp_counter_t index, a
else if( status == DISP_HOLES ) else if( status == DISP_HOLES )
{ {
acl_select_entry(0, &cnt); acl_select_entry(0, &cnt);
res = atp_select("选择一个金手指项目", cnt, select_holes, NULL, NULL, 0, 0, &item); res = atp_select("选择一个金手指项目", cnt, select_holes, NULL, NULL, eid > 0 ? (eid&0xff)-1 : 0, 0, &item);
if( res == ATP_SUCCESS ) if( res == ATP_SUCCESS )
{ {
eid = (acl_entryid_t)item; eid = (acl_entryid_t)item;