- Refactor menu_entries_push_list

- Add SD_FLAG_PUSH_ACTIOn
This commit is contained in:
twinaphex 2014-09-09 03:32:06 +02:00
parent 4790ffda7d
commit 590a1c2434
3 changed files with 39 additions and 40 deletions

View File

@ -149,6 +149,8 @@ static int setting_set_flags(rarch_setting_t *setting)
{
if (setting->flags & SD_FLAG_ALLOW_INPUT)
return MENU_FILE_LINEFEED;
if (setting->flags & SD_FLAG_PUSH_ACTION)
return MENU_FILE_SWITCH;
return 0;
}
@ -173,31 +175,23 @@ int menu_entries_push_list(menu_handle_t *menu,
if (!strcmp(label, "mainmenu"))
{
setting_data = (rarch_setting_t *)setting_data_get_mainmenu(true);
rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting(setting_data,
"Main Menu");
file_list_clear(list);
add_setting_entry(menu,list,"core_list", MENU_FILE_SWITCH, setting_data);
add_setting_entry(menu,list,"history_list", MENU_FILE_SWITCH, setting_data);
add_setting_entry(menu,list,"detect_core_list", MENU_FILE_SWITCH, setting_data);
add_setting_entry(menu,list,"load_content", MENU_FILE_SWITCH, setting_data);
add_setting_entry(menu,list,"core_options", MENU_FILE_SWITCH, setting_data);
add_setting_entry(menu,list,"core_information", MENU_FILE_SWITCH, setting_data);
if (g_extern.main_is_init && !g_extern.libretro_dummy)
for (; setting->type != ST_END_GROUP; setting++)
{
if (g_extern.system.disk_control.get_num_images)
file_list_push(list, "Core Disk Options", "disk_options",
MENU_FILE_SWITCH, 0);
if (
setting->type == ST_GROUP ||
setting->type == ST_SUB_GROUP ||
setting->type == ST_END_SUB_GROUP
)
continue;
file_list_push(list, setting->short_description,
setting->name, setting_set_flags(setting), 0);
}
add_setting_entry(menu,list,"settings", MENU_FILE_SWITCH, setting_data);
add_setting_entry(menu,list,"performance_counters", MENU_FILE_SWITCH, setting_data);
add_setting_entry(menu,list,"savestate", 0, setting_data);
add_setting_entry(menu,list,"loadstate", 0, setting_data);
add_setting_entry(menu,list,"take_screenshot", MENU_FILE_SWITCH, setting_data);
add_setting_entry(menu,list,"resume_content", MENU_FILE_SWITCH, setting_data);
add_setting_entry(menu,list,"restart_content", MENU_FILE_SWITCH, setting_data);
add_setting_entry(menu,list,"restart_retroarch", MENU_FILE_SWITCH, setting_data);
add_setting_entry(menu,list,"configurations", 0, setting_data);
add_setting_entry(menu,list,"save_new_config", MENU_FILE_SWITCH, setting_data);
add_setting_entry(menu,list,"help", MENU_FILE_SWITCH, setting_data);
add_setting_entry(menu,list,"quit_retroarch", MENU_FILE_SWITCH, setting_data);
}
else if (
!strcmp(label, "Driver Options") ||

View File

@ -2219,39 +2219,43 @@ rarch_setting_t *setting_data_get_mainmenu(bool regenerate)
START_GROUP("Main Menu")
START_SUB_GROUP("State")
#if defined(HAVE_DYNAMIC) || defined(HAVE_LIBRETRO_MANAGEMENT)
CONFIG_BOOL(lists[0], "core_list", "Core", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[0], "core_list", "Core", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
#endif
if (g_extern.history)
{
CONFIG_BOOL(lists[1], "history_list", "Load Content (History)", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[1], "history_list", "Load Content (History)", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
}
if (driver.menu && g_extern.core_info && core_info_list_num_info_files(g_extern.core_info))
{
CONFIG_BOOL(lists[2], "detect_core_list", "Load Content (Detect Core)", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[2], "detect_core_list", "Load Content (Detect Core)", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
}
CONFIG_BOOL(lists[3], "load_content", "Load Content", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[4], "core_options", "Core Options", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[5], "core_information", "Core Information", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[6], "settings", "Settings", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[3], "load_content", "Load Content", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
CONFIG_BOOL(lists[4], "core_options", "Core Options", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
CONFIG_BOOL(lists[5], "core_information", "Core Information", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
if (g_extern.main_is_init && !g_extern.libretro_dummy)
{
CONFIG_BOOL(lists[6], "disk_options", "Core Disk Options", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
}
CONFIG_BOOL(lists[7], "settings", "Settings", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
if (g_extern.perfcnt_enable)
{
CONFIG_BOOL(lists[7], "performance_counters", "Performance Counters", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[8], "performance_counters", "Performance Counters", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
}
if (g_extern.main_is_init && !g_extern.libretro_dummy)
{
CONFIG_BOOL(lists[8], "savestate", "Save State", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[9], "loadstate", "Load State", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[10], "take_screenshot", "Take Screenshot", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[11], "resume_content", "Resume Content", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[12], "restart_content", "Restart Content", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[9], "savestate", "Save State", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[10], "loadstate", "Load State", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[11], "take_screenshot", "Take Screenshot", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
CONFIG_BOOL(lists[12], "resume_content", "Resume Content", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
CONFIG_BOOL(lists[13], "restart_content", "Restart Content", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
}
#ifndef HAVE_DYNAMIC
CONFIG_BOOL(lists[13], "restart_retroarch", "Restart RetroArch", false, "", "",GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[14], "restart_retroarch", "Restart RetroArch", false, "", "",GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
#endif
CONFIG_BOOL(lists[14], "configurations", "Configurations", false, "", "",GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[15], "save_new_config", "Save New Config", false, "", "",GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[16], "help", "Help", false, "", "",GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[17], "quit_retroarch", "Quit RetroArch", false, "", "",GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[15], "configurations", "Configurations", false, "", "",GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[16], "save_new_config", "Save New Config", false, "", "",GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
CONFIG_BOOL(lists[17], "help", "Help", false, "", "",GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
CONFIG_BOOL(lists[18], "quit_retroarch", "Quit RetroArch", false, "", "",GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
END_SUB_GROUP()
END_GROUP()

View File

@ -53,6 +53,7 @@ enum setting_flags
SD_FLAG_VALUE_DESC = (1 << 3),
SD_FLAG_HAS_RANGE = (1 << 4),
SD_FLAG_ALLOW_INPUT = (1 << 5),
SD_FLAG_PUSH_ACTION = (1 << 6),
};
typedef struct rarch_setting_t