Dehardcode some code in menu_entries.c

This commit is contained in:
twinaphex 2014-10-07 22:48:57 +02:00
parent 7270f8982a
commit 0e31f60ad1
4 changed files with 18 additions and 14 deletions

View File

@ -81,6 +81,7 @@ typedef enum
MENU_FILE_SWITCH,
MENU_FILE_CARCHIVE,
MENU_FILE_IN_CARCHIVE,
MENU_FILE_CATEGORY,
MENU_SETTINGS,
} menu_file_type_t;

View File

@ -155,6 +155,8 @@ static int setting_set_flags(rarch_setting_t *setting)
return MENU_FILE_DRIVER;
if (setting->type == ST_PATH)
return MENU_FILE_PATH;
if (setting->flags & SD_FLAG_IS_CATEGORY)
return MENU_FILE_CATEGORY;
return 0;
}
@ -197,19 +199,7 @@ int menu_entries_push_list(menu_handle_t *menu,
setting->name, setting_set_flags(setting), 0);
}
}
else if (
!strcmp(label, "Driver Options") ||
!strcmp(label, "General Options") ||
!strcmp(label, "Overlay Options") ||
!strcmp(label, "Privacy Options") ||
!strcmp(label, "Video Options") ||
!strcmp(label, "Menu Options") ||
!strcmp(label, "Audio Options") ||
!strcmp(label, "Path Options") ||
!strcmp(label, "Font Options") ||
!strcmp(label, "User Options") ||
!strcmp(label, "Netplay Options")
)
else if (menu_type == MENU_FILE_CATEGORY)
{
rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting(setting_data,
label);
@ -250,7 +240,7 @@ int menu_entries_push_list(menu_handle_t *menu,
{
if (setting->type == ST_GROUP)
file_list_push(list, setting->short_description,
setting->name, MENU_FILE_SWITCH, 0);
setting->name, setting_set_flags(setting), 0);
}
}
else if (!strcmp(label, "history_list"))

View File

@ -2436,6 +2436,8 @@ bool setting_data_append_list_driver_options(
rarch_setting_group_info_t subgroup_info;
START_GROUP(group_info, "Driver Options");
settings_list_current_add_flags(list, list_info, SD_FLAG_IS_CATEGORY);
START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info);
CONFIG_STRING(
@ -2564,6 +2566,7 @@ bool setting_data_append_list_general_options(
rarch_setting_group_info_t subgroup_info;
START_GROUP(group_info, "General Options");
settings_list_current_add_flags(list, list_info, SD_FLAG_IS_CATEGORY);
START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info);
CONFIG_BOOL(
@ -2870,6 +2873,7 @@ bool setting_data_append_list_video_options(
rarch_setting_group_info_t subgroup_info;
START_GROUP(group_info, "Video Options");
settings_list_current_add_flags(list, list_info, SD_FLAG_IS_CATEGORY);
START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info);
CONFIG_BOOL(
@ -3463,6 +3467,7 @@ bool setting_data_append_list_font_options(
rarch_setting_group_info_t subgroup_info;
START_GROUP(group_info, "Font Options");
settings_list_current_add_flags(list, list_info, SD_FLAG_IS_CATEGORY);
START_SUB_GROUP(list, list_info, "Messages", group_info.name, subgroup_info);
CONFIG_PATH(
@ -3538,6 +3543,7 @@ bool setting_data_append_list_audio_options(
rarch_setting_group_info_t subgroup_info;
START_GROUP(group_info, "Audio Options");
settings_list_current_add_flags(list, list_info, SD_FLAG_IS_CATEGORY);
START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info);
CONFIG_BOOL(
@ -3925,6 +3931,7 @@ bool setting_data_append_list_overlay_options(
rarch_setting_group_info_t subgroup_info;
START_GROUP(group_info, "Overlay Options");
settings_list_current_add_flags(list, list_info, SD_FLAG_IS_CATEGORY);
START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info);
CONFIG_PATH(
@ -3984,6 +3991,7 @@ bool setting_data_append_list_menu_options(
rarch_setting_group_info_t subgroup_info;
START_GROUP(group_info, "Menu Options");
settings_list_current_add_flags(list, list_info, SD_FLAG_IS_CATEGORY);
START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info);
CONFIG_BOOL(
@ -4027,6 +4035,7 @@ bool setting_data_append_list_netplay_options(
rarch_setting_group_info_t subgroup_info;
START_GROUP(group_info, "Netplay Options");
settings_list_current_add_flags(list, list_info, SD_FLAG_IS_CATEGORY);
START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info);
CONFIG_BOOL(
@ -4114,6 +4123,7 @@ bool setting_data_append_list_user_options(
rarch_setting_group_info_t subgroup_info;
START_GROUP(group_info, "User Options");
settings_list_current_add_flags(list, list_info, SD_FLAG_IS_CATEGORY);
START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info);
CONFIG_STRING(
@ -4160,6 +4170,7 @@ bool setting_data_append_list_path_options(
rarch_setting_group_info_t subgroup_info;
START_GROUP(group_info, "Path Options");
settings_list_current_add_flags(list, list_info, SD_FLAG_IS_CATEGORY);
START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info);
CONFIG_UINT(
@ -4504,6 +4515,7 @@ bool setting_data_append_list_privacy_options(
rarch_setting_group_info_t subgroup_info;
START_GROUP(group_info, "Privacy Options");
settings_list_current_add_flags(list, list_info, SD_FLAG_IS_CATEGORY);
START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info);
CONFIG_BOOL(

View File

@ -55,6 +55,7 @@ enum setting_flags
SD_FLAG_IS_DRIVER = (1 << 7),
SD_FLAG_EXIT = (1 << 8),
SD_FLAG_CMD_APPLY_AUTO = (1 << 9),
SD_FLAG_IS_CATEGORY = (1 << 10),
};
typedef void (*change_handler_t)(void *data);