diff --git a/source/arm11/acl.c b/source/arm11/acl.c index 54532c6..87c5bf7 100644 --- a/source/arm11/acl.c +++ b/source/arm11/acl.c @@ -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->setid = 0; - *n = gcount; + if( n != NULL ) *n = gcount; fClose( fd ); 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 ) { CheatLib *inst = &gblcht; + if( chtid == NULL || region == NULL ) return ACHTLIB_SUCCESS; if( inst->serc == 0 ) return ACHTLIB_NOT_OPEN; 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 { CheatCfg *cfg = inst->list; - *chtid = cfg[index].cfgid; - *region = config_type( cfg[index].typeloc ); + if( chtid!=NULL ) *chtid = cfg[index].cfgid; + if( region!=NULL ) *region = config_type( cfg[index].typeloc ); return ACHTLIB_SUCCESS; } } @@ -434,7 +435,7 @@ acl_error_t acl_select_entry( acl_entryid_t id, acl_elemlen_t *count) if( found ) break; } } - *count = gblset.entry.datasz; + if( count!=NULL ) *count = gblset.entry.datasz; acl_error_t r = load_data(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 ) { + if( label == NULL ) return ACHTLIB_SUCCESS; if( gblcht.serc == 0 ) return ACHTLIB_NOT_OPEN; if( gblcht.listc == 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 ) { + if( code == NULL ) return ACHTLIB_SUCCESS; if( gblcht.serc == 0 ) return ACHTLIB_NOT_OPEN; if( gblcht.listc == 0 ) return ACHTLIB_INVALID; if( gblcht.setid == 0 ) return ACHTLIB_INVALID; diff --git a/source/arm11/filebrowser.c b/source/arm11/filebrowser.c index a68979b..d4fbf12 100644 --- a/source/arm11/filebrowser.c +++ b/source/arm11/filebrowser.c @@ -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 char text[16]; - acl_chtid_t sid; 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->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); config->text = text; - config->value = sid; + config->value = index; 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; while( status != DISP_DONE ) { - acl_entryid_t eid; + atp_counter_t defi = 0; + acl_entryid_t eid = 0; 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 ) { - 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 ); 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 ) { 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 ) { eid = (acl_entryid_t)item;