Choosing whether to open or load a zip file in detect core should work now

This commit is contained in:
Timo Strunk 2014-09-20 20:07:26 +02:00
parent 864a5cdc4f
commit 3575f353bf
3 changed files with 82 additions and 113 deletions

View File

@ -69,104 +69,6 @@ static int menu_message_toggle(unsigned action)
return 0;
}
static int menu_load_or_open_zip_iterate(unsigned action)
{
char msg[PATH_MAX];
snprintf(msg, sizeof(msg),
"Opening compressed file\n"
" \n"
" - OK to open as Folder\n"
" - Cancel/Back to Load \n");
if (driver.video_data && driver.menu_ctx &&
driver.menu_ctx->render_messagebox)
{
if (*msg && msg[0] != '\0')
driver.menu_ctx->render_messagebox(msg);
}
if (action == MENU_ACTION_OK)
{
menu_entries_pop(driver.menu->menu_stack);
const char *menu_path;
const char *menu_label;
unsigned int menu_type;
char const* path;
char const* label;
unsigned int type;
file_list_get_last(driver.menu->menu_stack, &menu_path, &menu_label, &menu_type);
if (file_list_get_size(driver.menu->selection_buf) == 0)
return 0;
file_list_get_at_offset(driver.menu->selection_buf,
driver.menu->selection_ptr, &path, &label, &type);
char cat_path[PATH_MAX];
fill_pathname_join(cat_path, menu_path, path, sizeof(cat_path));
menu_entries_push(driver.menu->menu_stack,
cat_path, menu_label, type, driver.menu->selection_ptr);
}
else if (action == MENU_ACTION_CANCEL)
{
menu_entries_pop(driver.menu->menu_stack);
/*const char *menu_path;
const char *menu_label;
unsigned int menu_type;
char const* path;
char const* label;
unsigned int type;
file_list_get_last(driver.menu->menu_stack, &menu_path, &menu_label, &menu_type);
if (file_list_get_size(driver.menu->selection_buf) == 0)
return 0;
file_list_get_at_offset(driver.menu->selection_buf,
driver.menu->selection_ptr, &path, &label, &type);
char cat_path[PATH_MAX];
fill_pathname_join(cat_path, menu_path, path, sizeof(cat_path));
return menu_action_ok(cat_path,menu_label,MENU_FILE_PLAIN); */
/*
menu_entries_push(driver.menu->menu_stack,
cat_path, menu_label, type, driver.menu->selection_ptr);
menu_entries_pop(driver.menu->menu_stack);
const char *menu_path;
const char *menu_label;
unsigned int menu_type;
char const* path;
char const* label;
unsigned int type;
file_list_get_last(driver.menu->menu_stack, &menu_path, &menu_label, &menu_type);
printf("BABBA\n");
return menu_action_ok(menu_path,menu_label,menu_type);
if (file_list_get_size(driver.menu->selection_buf) == 0)
return 0;
file_list_get_at_offset(driver.menu->selection_buf,
driver.menu->selection_ptr, &path, &label, &type);
char cat_path[PATH_MAX];
fill_pathname_join(cat_path, menu_path, path, sizeof(cat_path));
menu_action_ok(driver.menu->menu_stack,
cat_path, menu_label, MENU_FILE_PLAIN, driver.menu->selection_ptr); */
}
return 0;
}
static int menu_info_screen_iterate(unsigned action)
{
char msg[PATH_MAX];
@ -1736,8 +1638,6 @@ static int menu_custom_bind_iterate_keyboard(void *data,
return 0;
}
static void menu_common_load_content(void)
{
rarch_main_command(RARCH_CMD_LOAD_CONTENT);
@ -1745,8 +1645,86 @@ static void menu_common_load_content(void)
driver.menu->msg_force = true;
}
static int menu_action_y(const char * /*menu_path*/,
const char * /*menu_label*/, unsigned /* menu_type */)
static int menu_load_or_open_zip_iterate(unsigned action)
{
char msg[PATH_MAX];
snprintf(msg, sizeof(msg), "Opening compressed file\n"
" \n"
" - OK to open as Folder\n"
" - Cancel/Back to Load \n");
if (driver.video_data && driver.menu_ctx
&& driver.menu_ctx->render_messagebox)
{
if (*msg && msg[0] != '\0')
driver.menu_ctx->render_messagebox(msg);
}
if (action == MENU_ACTION_OK)
{
menu_entries_pop(driver.menu->menu_stack);
const char *menu_path;
const char *menu_label;
unsigned int menu_type;
char const* path;
char const* label;
unsigned int type;
file_list_get_last(driver.menu->menu_stack, &menu_path, &menu_label,
&menu_type);
if (file_list_get_size(driver.menu->selection_buf) == 0)
return 0;
file_list_get_at_offset(driver.menu->selection_buf,
driver.menu->selection_ptr, &path, &label, &type);
char cat_path[PATH_MAX];
fill_pathname_join(cat_path, menu_path, path, sizeof(cat_path));
menu_entries_push(driver.menu->menu_stack, cat_path, menu_label, type,
driver.menu->selection_ptr);
}
else if (action == MENU_ACTION_CANCEL)
{
menu_entries_pop(driver.menu->menu_stack);
const char *menu_path;
const char *menu_label;
unsigned int menu_type;
char const* path;
char const* label;
unsigned int type;
file_list_get_last(driver.menu->menu_stack, &menu_path, &menu_label,
&menu_type);
if (file_list_get_size(driver.menu->selection_buf) == 0)
return 0;
file_list_get_at_offset(driver.menu->selection_buf,
driver.menu->selection_ptr, &path, &label, &type);
int ret = rarch_defer_core(g_extern.core_info, menu_path, path,
driver.menu->deferred_path, sizeof(driver.menu->deferred_path));
if (ret == -1)
{
rarch_main_command(RARCH_CMD_LOAD_CORE);
menu_common_load_content();
return -1;
}
else if (ret == 0)
menu_entries_push(driver.menu->menu_stack,
g_settings.libretro_directory, "deferred_core_list", 0,
driver.menu->selection_ptr);
}
return 0;
}
static int menu_action_y(const char * menu_path,
const char * menu_label, unsigned menu_type )
{
return 0;
}

View File

@ -162,16 +162,8 @@ static void disp_set_label(unsigned *w, unsigned type, unsigned i,
}
else if (type == MENU_FILE_CARCHIVE)
{
if (driver.menu->open_compressed)
{
strlcpy(type_str, "(COMP)", type_str_size);
*w = 6;
}
else
{
strlcpy(type_str, "(FILE)", type_str_size);
*w = 6;
}
strlcpy(type_str, "(COMP)", type_str_size);
*w = 6;
}
else if (type == MENU_FILE_IN_CARCHIVE)
{

View File

@ -70,7 +70,6 @@ typedef struct
uint64_t old_input_state;
uint64_t trigger_state;
bool do_held;
bool open_compressed;
unsigned delay_timer;
unsigned delay_count;