diff --git a/include/arm11/atp.h b/include/arm11/atp.h index 93a78bb..feeecf1 100644 --- a/include/arm11/atp.h +++ b/include/arm11/atp.h @@ -94,6 +94,7 @@ extern atp_error_t atp_select( INPUT(atp_keyhandler_t) extra_key_handler, INPUT(atp_callerdata_t) some_data_from_caller, INPUT(atp_counter_t) index_of_default_selected_item, + INPUT(atp_boolean_t) ignore_no_action, OUTPUT(atp_itemval_t) value_of_select_item ); diff --git a/source/arm11/atp.c b/source/arm11/atp.c index 4ac572b..7d5a828 100644 --- a/source/arm11/atp.c +++ b/source/arm11/atp.c @@ -223,7 +223,7 @@ static void draw_options( int start_row, int start_idx, int option_cnt, int sele else draw_options( 0, idx_top - title_len, cnt, item_sel, provider, data ); \ } -atp_error_t atp_select( atp_text_t title, atp_counter_t cnt, atp_itemprovider_t provider, atp_keyhandler_t handler, atp_callerdata_t data, atp_counter_t index, atp_itemval_t *res ) +atp_error_t atp_select( atp_text_t title, atp_counter_t cnt, atp_itemprovider_t provider, atp_keyhandler_t handler, atp_callerdata_t data, atp_counter_t index, atp_boolean_t action, atp_itemval_t *res ) { uint8_t title_offset[TITLE_MAX]; int item_sel = index < cnt ? index : 0; @@ -277,7 +277,7 @@ atp_error_t atp_select( atp_text_t title, atp_counter_t cnt, atp_itemprovider_t } else { - return ATP_NO_ACTION; + if( action == 0 ) return ATP_NO_ACTION; } } else if( key & (KEY_X | KEY_Y | KEY_SELECT | KEY_START) ) diff --git a/source/arm11/filebrowser.c b/source/arm11/filebrowser.c index 8137d72..8f289f6 100644 --- a/source/arm11/filebrowser.c +++ b/source/arm11/filebrowser.c @@ -193,12 +193,14 @@ Result browseFiles(const char *const basePath, char selected[512]) atp_boolean_t scan = 0; atp_error_t error; const u32 count = dList->num; - if( count > 0 ) - error = atp_select( curDir, count, display_folder, NULL, (atp_callerdata_t)dList, selecting, &value ); - else error = atp_show( 1, display_empty, NULL ); 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), &value ); + else error = atp_show( 1, display_empty, NULL ); + + if( error == ATP_POWER_OFF ) { res = error;