Add MENU_SETTING_CTL_IS_OF_PATH_TYPE

This commit is contained in:
twinaphex 2016-03-18 22:23:51 +01:00
parent 6b01dd86ae
commit 71f2fa531c
3 changed files with 33 additions and 18 deletions

View File

@ -50,7 +50,7 @@ enum menu_entry_type menu_entry_get_type(uint32_t i)
rarch_setting_t *setting = menu_entries_get_setting(i);
/* XXX Really a special kind of ST_ACTION, but this should be changed */
if (menu_setting_is_of_path_type(setting))
if (menu_setting_ctl(MENU_SETTING_CTL_IS_OF_PATH_TYPE, (void*)setting))
return MENU_ENTRY_PATH;
if (setting)
@ -186,7 +186,8 @@ void menu_entry_bind_joyaxis_set(uint32_t i, int32_t value)
void menu_entry_pathdir_selected(uint32_t i)
{
rarch_setting_t *setting = menu_entries_get_setting(i);
if (menu_setting_is_of_path_type(setting))
if (menu_setting_ctl(MENU_SETTING_CTL_IS_OF_PATH_TYPE, (void*)setting))
menu_setting_action_right(setting, false);
}

View File

@ -1821,19 +1821,6 @@ int menu_action_handle_setting(rarch_setting_t *setting,
return -1;
}
bool menu_setting_is_of_path_type(rarch_setting_t *setting)
{
uint64_t flags = menu_setting_get_flags(setting);
if (
setting &&
(menu_setting_get_type(setting) == ST_ACTION) &&
(flags & SD_FLAG_BROWSER_ACTION) &&
(setting->action_right || setting->action_left || setting->action_select) &&
setting->change_handler)
return true;
return false;
}
const char *menu_setting_get_values(rarch_setting_t *setting)
{
if (!setting)
@ -7550,9 +7537,37 @@ error:
bool menu_setting_ctl(enum menu_setting_ctl_state state, void *data)
{
uint64_t flags;
switch (state)
{
case MENU_SETTING_CTL_IS_OF_PATH_TYPE:
{
bool cbs_bound = false;
rarch_setting_t *setting = (rarch_setting_t*)data;
if (!setting)
return false;
flags = menu_setting_get_flags(setting);
if (menu_setting_get_type(setting) != ST_ACTION)
return false;
if (!setting->change_handler)
return false;
cbs_bound = setting->action_right;
cbs_bound = cbs_bound || setting->action_left;
cbs_bound = cbs_bound || setting->action_select;
if (!cbs_bound)
return false;
if (!(flags & SD_FLAG_BROWSER_ACTION))
return false;
}
return true;
case MENU_SETTING_CTL_NONE:
default:
break;

View File

@ -65,7 +65,8 @@ enum setting_flags
enum menu_setting_ctl_state
{
MENU_SETTING_CTL_NONE = 0
MENU_SETTING_CTL_NONE = 0,
MENU_SETTING_CTL_IS_OF_PATH_TYPE
};
enum setting_list_flags
@ -329,8 +330,6 @@ void menu_setting_free(rarch_setting_t *list);
**/
rarch_setting_t* menu_setting_new(void);
bool menu_setting_is_of_path_type(rarch_setting_t *setting);
int menu_action_handle_setting(rarch_setting_t *setting,
unsigned type, unsigned action, bool wraparound);