mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-18 00:32:46 +00:00
Create setting_list.c/setting_list.h
This commit is contained in:
parent
655a56754b
commit
9af900a1d1
@ -155,6 +155,7 @@ OBJ += frontend/frontend.o \
|
||||
libretro-common/lists/string_list.o \
|
||||
libretro-common/string/stdstring.o \
|
||||
libretro-common/memmap/memalign.o \
|
||||
setting_list.o \
|
||||
list_special.o \
|
||||
libretro-common/file/nbio/nbio_stdio.o \
|
||||
libretro-common/file/file_path.o \
|
||||
|
@ -685,6 +685,7 @@ FILE
|
||||
#include "../libretro-common/lists/dir_list.c"
|
||||
#include "../libretro-common/lists/string_list.c"
|
||||
#include "../libretro-common/lists/file_list.c"
|
||||
#include "../setting_list.c"
|
||||
#include "../libretro-common/file/retro_dirent.c"
|
||||
#include "../libretro-common/streams/file_stream.c"
|
||||
#include "../libretro-common/streams/interface_stream.c"
|
||||
|
@ -263,7 +263,7 @@ static int action_left_shader_filter_default(unsigned type, const char *label,
|
||||
if (!setting)
|
||||
return menu_cbs_exit();
|
||||
return menu_action_handle_setting(setting,
|
||||
menu_setting_get_type(setting), MENU_ACTION_LEFT, wraparound);
|
||||
setting_get_type(setting), MENU_ACTION_LEFT, wraparound);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
@ -407,7 +407,7 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs,
|
||||
const char *parent_group = menu_setting_get_parent_group(cbs->setting);
|
||||
|
||||
if (string_is_equal(parent_group, msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU))
|
||||
&& (menu_setting_get_type(cbs->setting) == ST_GROUP))
|
||||
&& (setting_get_type(cbs->setting) == ST_GROUP))
|
||||
{
|
||||
BIND_ACTION_LEFT(cbs, action_left_mainmenu);
|
||||
return 0;
|
||||
|
@ -1343,7 +1343,7 @@ static int generic_action_ok(const char *path,
|
||||
|
||||
if (setting)
|
||||
{
|
||||
menu_setting_set_with_string_representation(
|
||||
setting_set_with_string_representation(
|
||||
setting, action_path);
|
||||
ret = menu_setting_generic(setting, false);
|
||||
}
|
||||
@ -1496,7 +1496,7 @@ static void menu_input_st_string_cb_save_preset(void *userdata,
|
||||
|
||||
if (setting)
|
||||
{
|
||||
menu_setting_set_with_string_representation(setting, str);
|
||||
setting_set_with_string_representation(setting, str);
|
||||
menu_setting_generic(setting, false);
|
||||
}
|
||||
else if (!string_is_empty(label))
|
||||
@ -1626,7 +1626,7 @@ static void menu_input_st_string_cb_cheat_file_save_as(
|
||||
|
||||
if (setting)
|
||||
{
|
||||
menu_setting_set_with_string_representation(setting, str);
|
||||
setting_set_with_string_representation(setting, str);
|
||||
menu_setting_generic(setting, false);
|
||||
}
|
||||
else if (!string_is_empty(label))
|
||||
@ -1870,7 +1870,7 @@ static int action_ok_file_load(const char *path,
|
||||
|
||||
setting = menu_setting_find(menu_label);
|
||||
|
||||
if (menu_setting_get_type(setting) == ST_PATH)
|
||||
if (setting_get_type(setting) == ST_PATH)
|
||||
return action_ok_set_path(path, label, type, idx, entry_idx);
|
||||
|
||||
strlcpy(menu_path_new, menu_path, sizeof(menu_path_new));
|
||||
|
@ -277,7 +277,7 @@ static int action_right_shader_filter_default(unsigned type, const char *label,
|
||||
rarch_setting_t *setting = menu_setting_find_enum(MENU_ENUM_LABEL_VIDEO_SMOOTH);
|
||||
if (!setting)
|
||||
return menu_cbs_exit();
|
||||
return menu_action_handle_setting(setting, menu_setting_get_type(setting), MENU_ACTION_RIGHT,
|
||||
return menu_action_handle_setting(setting, setting_get_type(setting), MENU_ACTION_RIGHT,
|
||||
wraparound);
|
||||
#else
|
||||
return 0;
|
||||
@ -516,7 +516,7 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs,
|
||||
const char *parent_group = menu_setting_get_parent_group(cbs->setting);
|
||||
|
||||
if (string_is_equal(parent_group, msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU))
|
||||
&& (menu_setting_get_type(cbs->setting) == ST_GROUP))
|
||||
&& (setting_get_type(cbs->setting) == ST_GROUP))
|
||||
{
|
||||
BIND_ACTION_RIGHT(cbs, action_right_scroll);
|
||||
return 0;
|
||||
|
@ -44,7 +44,7 @@ static int action_select_default(const char *path, const char *label, unsigned t
|
||||
if (!cbs)
|
||||
return -1;
|
||||
|
||||
switch (menu_setting_get_type(cbs->setting))
|
||||
switch (setting_get_type(cbs->setting))
|
||||
{
|
||||
case ST_BOOL:
|
||||
case ST_INT:
|
||||
@ -194,7 +194,7 @@ int menu_cbs_init_bind_select(menu_file_list_cbs_t *cbs,
|
||||
|
||||
if (cbs->setting)
|
||||
{
|
||||
uint64_t flags = menu_setting_get_flags(cbs->setting);
|
||||
uint64_t flags = setting_get_flags(cbs->setting);
|
||||
|
||||
if (flags & SD_FLAG_IS_DRIVER)
|
||||
{
|
||||
|
@ -873,7 +873,7 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
|
||||
const char *parent_group = menu_setting_get_parent_group(cbs->setting);
|
||||
|
||||
if (string_is_equal(parent_group, msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU))
|
||||
&& menu_setting_get_type(cbs->setting) == ST_GROUP)
|
||||
&& setting_get_type(cbs->setting) == ST_GROUP)
|
||||
{
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_title_group_settings);
|
||||
return 0;
|
||||
|
@ -2181,7 +2181,7 @@ static int menu_displaylist_parse_settings_internal(void *data,
|
||||
enum setting_type precond;
|
||||
size_t count = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
uint64_t flags = menu_setting_get_flags(setting);
|
||||
uint64_t flags = setting_get_flags(setting);
|
||||
|
||||
if (!setting)
|
||||
return -1;
|
||||
@ -2237,7 +2237,7 @@ static int menu_displaylist_parse_settings_internal(void *data,
|
||||
const char *short_description =
|
||||
menu_setting_get_short_description(setting);
|
||||
const char *name = menu_setting_get_name(setting);
|
||||
enum setting_type type = menu_setting_get_type(setting);
|
||||
enum setting_type type = setting_get_type(setting);
|
||||
|
||||
switch (parse_type)
|
||||
{
|
||||
@ -2322,7 +2322,7 @@ loop:
|
||||
case PARSE_GROUP:
|
||||
case PARSE_ONLY_GROUP:
|
||||
case PARSE_SUB_GROUP:
|
||||
if (menu_setting_get_type(setting) == precond)
|
||||
if (setting_get_type(setting) == precond)
|
||||
time_to_exit = true;
|
||||
break;
|
||||
case PARSE_ONLY_BIND:
|
||||
@ -2366,7 +2366,7 @@ static int menu_displaylist_parse_settings_internal_enum(void *data,
|
||||
enum setting_type precond;
|
||||
size_t count = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
uint64_t flags = menu_setting_get_flags(setting);
|
||||
uint64_t flags = setting_get_flags(setting);
|
||||
|
||||
if (!setting)
|
||||
return -1;
|
||||
@ -2422,7 +2422,7 @@ static int menu_displaylist_parse_settings_internal_enum(void *data,
|
||||
const char *short_description =
|
||||
menu_setting_get_short_description(setting);
|
||||
const char *name = menu_setting_get_name(setting);
|
||||
enum setting_type type = menu_setting_get_type(setting);
|
||||
enum setting_type type = setting_get_type(setting);
|
||||
|
||||
switch (parse_type)
|
||||
{
|
||||
@ -2507,7 +2507,7 @@ loop:
|
||||
case PARSE_GROUP:
|
||||
case PARSE_ONLY_GROUP:
|
||||
case PARSE_SUB_GROUP:
|
||||
if (menu_setting_get_type(setting) == precond)
|
||||
if (setting_get_type(setting) == precond)
|
||||
time_to_exit = true;
|
||||
break;
|
||||
case PARSE_ONLY_BIND:
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include "menu_display.h"
|
||||
#include "menu_navigation.h"
|
||||
|
||||
#include "../setting_list.h"
|
||||
|
||||
/* This file provides an abstraction of the currently displayed
|
||||
* menu.
|
||||
*
|
||||
@ -44,8 +46,7 @@ enum menu_entry_type menu_entry_get_type(uint32_t i)
|
||||
|
||||
if (setting)
|
||||
{
|
||||
enum setting_type setting_type =
|
||||
menu_setting_get_type(setting);
|
||||
enum setting_type setting_type = setting_get_type(setting);
|
||||
|
||||
switch (setting_type)
|
||||
{
|
||||
@ -143,13 +144,13 @@ struct string_list *menu_entry_enum_values(uint32_t i)
|
||||
void menu_entry_enum_set_value_with_string(uint32_t i, const char *s)
|
||||
{
|
||||
rarch_setting_t *setting = menu_entries_get_setting(i);
|
||||
menu_setting_set_with_string_representation(setting, s);
|
||||
setting_set_with_string_representation(setting, s);
|
||||
}
|
||||
|
||||
int32_t menu_entry_bind_index(uint32_t i)
|
||||
{
|
||||
rarch_setting_t *setting = menu_entries_get_setting(i);
|
||||
uint32_t index = menu_setting_get_index(setting);
|
||||
uint32_t index = setting_get_index(setting);
|
||||
|
||||
if (index)
|
||||
return index - 1;
|
||||
@ -194,7 +195,7 @@ void menu_entry_pathdir_selected(uint32_t i)
|
||||
bool menu_entry_pathdir_allow_empty(uint32_t i)
|
||||
{
|
||||
rarch_setting_t *setting = menu_entries_get_setting(i);
|
||||
uint64_t flags = menu_setting_get_flags(setting);
|
||||
uint64_t flags = setting_get_flags(setting);
|
||||
|
||||
return flags & SD_FLAG_ALLOW_EMPTY;
|
||||
}
|
||||
@ -202,7 +203,7 @@ bool menu_entry_pathdir_allow_empty(uint32_t i)
|
||||
uint32_t menu_entry_pathdir_for_directory(uint32_t i)
|
||||
{
|
||||
rarch_setting_t *setting = menu_entries_get_setting(i);
|
||||
uint64_t flags = menu_setting_get_flags(setting);
|
||||
uint64_t flags = setting_get_flags(setting);
|
||||
|
||||
return flags & SD_FLAG_PATH_DIR;
|
||||
}
|
||||
@ -243,13 +244,13 @@ void menu_entry_get_value(uint32_t i, char *s, size_t len)
|
||||
void menu_entry_set_value(uint32_t i, const char *s)
|
||||
{
|
||||
rarch_setting_t *setting = menu_entries_get_setting(i);
|
||||
menu_setting_set_with_string_representation(setting, s);
|
||||
setting_set_with_string_representation(setting, s);
|
||||
}
|
||||
|
||||
uint32_t menu_entry_num_has_range(uint32_t i)
|
||||
{
|
||||
rarch_setting_t *setting = menu_entries_get_setting(i);
|
||||
uint64_t flags = menu_setting_get_flags(setting);
|
||||
uint64_t flags = setting_get_flags(setting);
|
||||
|
||||
return (flags & SD_FLAG_HAS_RANGE);
|
||||
}
|
||||
@ -257,14 +258,14 @@ uint32_t menu_entry_num_has_range(uint32_t i)
|
||||
float menu_entry_num_min(uint32_t i)
|
||||
{
|
||||
rarch_setting_t *setting = menu_entries_get_setting(i);
|
||||
double min = menu_setting_get_min(setting);
|
||||
double min = setting_get_min(setting);
|
||||
return (float)min;
|
||||
}
|
||||
|
||||
float menu_entry_num_max(uint32_t i)
|
||||
{
|
||||
rarch_setting_t *setting = menu_entries_get_setting(i);
|
||||
double max = menu_setting_get_max(setting);
|
||||
double max = setting_get_max(setting);
|
||||
return (float)max;
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ void menu_input_st_uint_cb(void *userdata, const char *str)
|
||||
menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_LABEL_SETTING, &label);
|
||||
|
||||
setting = menu_setting_find(label);
|
||||
menu_setting_set_with_string_representation(setting, str);
|
||||
setting_set_with_string_representation(setting, str);
|
||||
}
|
||||
|
||||
menu_input_key_end_line();
|
||||
@ -255,7 +255,7 @@ static int menu_input_key_bind_set_mode_common(
|
||||
if (!setting)
|
||||
return -1;
|
||||
|
||||
index_offset = menu_setting_get_index_offset(setting);
|
||||
index_offset = setting_get_index_offset(setting);
|
||||
menu_stack = menu_entries_get_menu_stack_ptr(0);
|
||||
|
||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
|
||||
@ -270,7 +270,7 @@ static int menu_input_key_bind_set_mode_common(
|
||||
if (!keybind)
|
||||
return -1;
|
||||
|
||||
bind_type = menu_setting_get_bind_type(setting);
|
||||
bind_type = setting_get_bind_type(setting);
|
||||
|
||||
menu_input->binds.begin = bind_type;
|
||||
menu_input->binds.last = bind_type;
|
||||
@ -416,7 +416,7 @@ static bool menu_input_key_bind_set_mode(
|
||||
if (menu_input_key_bind_set_mode_common(state, setting) == -1)
|
||||
return false;
|
||||
|
||||
index_offset = menu_setting_get_index_offset(setting);
|
||||
index_offset = setting_get_index_offset(setting);
|
||||
bind_port = settings->input.joypad_map[index_offset];
|
||||
|
||||
menu_input_key_bind_poll_bind_get_rested_axes(
|
||||
|
1942
menu/menu_setting.c
1942
menu/menu_setting.c
File diff suppressed because it is too large
Load Diff
@ -25,53 +25,12 @@
|
||||
|
||||
#include "../command.h"
|
||||
#include "../input/input_driver.h"
|
||||
#include "../setting_list.h"
|
||||
|
||||
#include "../msg_hash.h"
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
enum setting_type
|
||||
{
|
||||
ST_NONE = 0,
|
||||
ST_ACTION,
|
||||
ST_BOOL,
|
||||
ST_INT,
|
||||
ST_UINT,
|
||||
ST_FLOAT,
|
||||
ST_PATH,
|
||||
ST_DIR,
|
||||
ST_STRING,
|
||||
ST_STRING_OPTIONS,
|
||||
ST_HEX,
|
||||
ST_BIND,
|
||||
ST_GROUP,
|
||||
ST_SUB_GROUP,
|
||||
ST_END_GROUP,
|
||||
ST_END_SUB_GROUP
|
||||
};
|
||||
|
||||
enum setting_flags
|
||||
{
|
||||
SD_FLAG_NONE = 0,
|
||||
SD_FLAG_PATH_DIR = (1 << 0),
|
||||
SD_FLAG_PATH_FILE = (1 << 1),
|
||||
SD_FLAG_ALLOW_EMPTY = (1 << 2),
|
||||
SD_FLAG_HAS_RANGE = (1 << 3),
|
||||
SD_FLAG_ALLOW_INPUT = (1 << 4),
|
||||
SD_FLAG_IS_DRIVER = (1 << 5),
|
||||
SD_FLAG_EXIT = (1 << 6),
|
||||
SD_FLAG_CMD_APPLY_AUTO = (1 << 7),
|
||||
SD_FLAG_BROWSER_ACTION = (1 << 8),
|
||||
SD_FLAG_ADVANCED = (1 << 9)
|
||||
};
|
||||
|
||||
enum settings_free_flags
|
||||
{
|
||||
SD_FREE_FLAG_VALUES = (1 << 0),
|
||||
SD_FREE_FLAG_NAME = (1 << 1),
|
||||
SD_FREE_FLAG_SHORT = (1 << 2)
|
||||
};
|
||||
|
||||
enum menu_setting_ctl_state
|
||||
{
|
||||
MENU_SETTING_CTL_NONE = 0,
|
||||
@ -115,164 +74,8 @@ enum setting_list_flags
|
||||
SL_FLAG_SETTINGS_ALL = (1 << 30)
|
||||
};
|
||||
|
||||
typedef struct rarch_setting_group_info rarch_setting_group_info_t;
|
||||
typedef struct rarch_setting rarch_setting_t;
|
||||
typedef struct rarch_setting_info rarch_setting_info_t;
|
||||
|
||||
typedef void (*change_handler_t )(void *data);
|
||||
typedef int (*action_left_handler_t )(void *data, bool wraparound);
|
||||
typedef int (*action_right_handler_t )(void *data, bool wraparound);
|
||||
typedef int (*action_up_handler_t )(void *data);
|
||||
typedef int (*action_down_handler_t )(void *data);
|
||||
typedef int (*action_start_handler_t )(void *data);
|
||||
typedef int (*action_cancel_handler_t )(void *data);
|
||||
typedef int (*action_ok_handler_t )(void *data, bool wraparound);
|
||||
typedef int (*action_select_handler_t )(void *data, bool wraparound);
|
||||
typedef void (*get_string_representation_t )(void *data, char *s, size_t len);
|
||||
|
||||
#define SL_FLAG_SETTINGS_GROUP_ALL (SL_FLAG_SETTINGS_ALL - SL_FLAG_MAIN_MENU)
|
||||
|
||||
bool START_GROUP(rarch_setting_t **list, rarch_setting_info_t *list_info,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
const char *name, const char *parent_group);
|
||||
|
||||
bool END_GROUP(rarch_setting_t **list, rarch_setting_info_t *list_info,
|
||||
const char *parent_group);
|
||||
|
||||
bool START_SUB_GROUP(rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info, const char *name,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group);
|
||||
|
||||
bool END_SUB_GROUP(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
const char *parent_group);
|
||||
|
||||
bool CONFIG_ACTION(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
const char *name, const char *SHORT,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group);
|
||||
|
||||
bool CONFIG_BOOL(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
bool *target,
|
||||
const char *name, const char *SHORT,
|
||||
bool default_value,
|
||||
const char *off, const char *on,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group,
|
||||
change_handler_t change_handler,
|
||||
change_handler_t read_handler,
|
||||
uint32_t flags
|
||||
);
|
||||
|
||||
bool CONFIG_INT(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
int *target,
|
||||
const char *name, const char *SHORT,
|
||||
int default_value,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group,
|
||||
change_handler_t change_handler, change_handler_t read_handler);
|
||||
|
||||
bool CONFIG_UINT(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
unsigned int *target,
|
||||
const char *name, const char *SHORT,
|
||||
unsigned int default_value,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group,
|
||||
change_handler_t change_handler, change_handler_t read_handler);
|
||||
|
||||
bool CONFIG_FLOAT(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
float *target,
|
||||
const char *name, const char *SHORT,
|
||||
float default_value, const char *rounding,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group,
|
||||
change_handler_t change_handler, change_handler_t read_handler);
|
||||
|
||||
bool CONFIG_PATH(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
char *target, size_t len,
|
||||
const char *name, const char *SHORT,
|
||||
const char *default_value,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group,
|
||||
change_handler_t change_handler, change_handler_t read_handler);
|
||||
|
||||
bool CONFIG_DIR(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
char *target, size_t len,
|
||||
const char *name, const char *SHORT,
|
||||
const char *default_value, const char *empty,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group,
|
||||
change_handler_t change_handler, change_handler_t read_handler);
|
||||
|
||||
bool CONFIG_STRING(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
char *target, size_t len,
|
||||
const char *name, const char *SHORT,
|
||||
const char *default_value,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group,
|
||||
change_handler_t change_handler, change_handler_t read_handler);
|
||||
|
||||
bool CONFIG_STRING_OPTIONS(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
char *target, size_t len,
|
||||
const char *name, const char *SHORT,
|
||||
const char *default_value, const char *values,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group,
|
||||
change_handler_t change_handler, change_handler_t read_handler);
|
||||
|
||||
bool CONFIG_HEX(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
unsigned int *target,
|
||||
const char *name, const char *SHORT,
|
||||
unsigned int default_value,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group,
|
||||
change_handler_t change_handler, change_handler_t read_handler);
|
||||
|
||||
/* Please strdup() NAME and SHORT */
|
||||
bool CONFIG_BIND(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
struct retro_keybind *target,
|
||||
uint32_t player, uint32_t player_offset,
|
||||
const char *name, const char *SHORT,
|
||||
const struct retro_keybind *default_value,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group);
|
||||
|
||||
int menu_setting_generic(rarch_setting_t *setting, bool wraparound);
|
||||
|
||||
int menu_setting_set_flags(rarch_setting_t *setting);
|
||||
@ -292,17 +95,6 @@ rarch_setting_t *menu_setting_find(const char *label);
|
||||
|
||||
rarch_setting_t *menu_setting_find_enum(enum msg_hash_enums enum_idx);
|
||||
|
||||
/**
|
||||
* setting_set_with_string_representation:
|
||||
* @setting : pointer to setting
|
||||
* @value : value for the setting (string)
|
||||
*
|
||||
* Set a settings' value with a string. It is assumed
|
||||
* that the string has been properly formatted.
|
||||
**/
|
||||
int menu_setting_set_with_string_representation(
|
||||
rarch_setting_t* setting, const char *value);
|
||||
|
||||
/**
|
||||
* setting_get_string_representation:
|
||||
* @setting : pointer to setting
|
||||
@ -335,8 +127,6 @@ void menu_setting_get_label(void *data, char *s,
|
||||
int menu_action_handle_setting(rarch_setting_t *setting,
|
||||
unsigned type, unsigned action, bool wraparound);
|
||||
|
||||
enum setting_type menu_setting_get_type(rarch_setting_t *setting);
|
||||
|
||||
enum setting_type menu_setting_get_browser_selection_type(rarch_setting_t *setting);
|
||||
|
||||
enum msg_hash_enums menu_setting_get_enum_idx(rarch_setting_t *setting);
|
||||
@ -347,20 +137,10 @@ const char *menu_setting_get_name(rarch_setting_t *setting);
|
||||
|
||||
const char *menu_setting_get_short_description(rarch_setting_t *setting);
|
||||
|
||||
uint64_t menu_setting_get_flags(rarch_setting_t *setting);
|
||||
|
||||
const char *menu_setting_get_parent_group(rarch_setting_t *setting);
|
||||
|
||||
double menu_setting_get_min(rarch_setting_t *setting);
|
||||
|
||||
double menu_setting_get_max(rarch_setting_t *setting);
|
||||
|
||||
unsigned menu_setting_get_bind_type(rarch_setting_t *setting);
|
||||
|
||||
uint32_t menu_setting_get_index(rarch_setting_t *setting);
|
||||
|
||||
unsigned menu_setting_get_index_offset(rarch_setting_t *setting);
|
||||
|
||||
void *setting_get_ptr(rarch_setting_t *setting);
|
||||
|
||||
void menu_settings_list_increment(rarch_setting_t **list);
|
||||
@ -397,6 +177,9 @@ void menu_settings_list_current_add_enum_idx(
|
||||
|
||||
bool menu_setting_free(void *data);
|
||||
|
||||
bool settings_list_append(rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info);
|
||||
|
||||
bool menu_setting_ctl(enum menu_setting_ctl_state state, void *data);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
1732
setting_list.c
Normal file
1732
setting_list.c
Normal file
File diff suppressed because it is too large
Load Diff
365
setting_list.h
Normal file
365
setting_list.h
Normal file
@ -0,0 +1,365 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __SETTING_LIST_H
|
||||
#define __SETTING_LIST_H
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <retro_common_api.h>
|
||||
|
||||
#include "command.h"
|
||||
#include "msg_hash.h"
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
enum setting_type
|
||||
{
|
||||
ST_NONE = 0,
|
||||
ST_ACTION,
|
||||
ST_BOOL,
|
||||
ST_INT,
|
||||
ST_UINT,
|
||||
ST_FLOAT,
|
||||
ST_PATH,
|
||||
ST_DIR,
|
||||
ST_STRING,
|
||||
ST_STRING_OPTIONS,
|
||||
ST_HEX,
|
||||
ST_BIND,
|
||||
ST_GROUP,
|
||||
ST_SUB_GROUP,
|
||||
ST_END_GROUP,
|
||||
ST_END_SUB_GROUP
|
||||
};
|
||||
|
||||
enum setting_flags
|
||||
{
|
||||
SD_FLAG_NONE = 0,
|
||||
SD_FLAG_PATH_DIR = (1 << 0),
|
||||
SD_FLAG_PATH_FILE = (1 << 1),
|
||||
SD_FLAG_ALLOW_EMPTY = (1 << 2),
|
||||
SD_FLAG_HAS_RANGE = (1 << 3),
|
||||
SD_FLAG_ALLOW_INPUT = (1 << 4),
|
||||
SD_FLAG_IS_DRIVER = (1 << 5),
|
||||
SD_FLAG_EXIT = (1 << 6),
|
||||
SD_FLAG_CMD_APPLY_AUTO = (1 << 7),
|
||||
SD_FLAG_BROWSER_ACTION = (1 << 8),
|
||||
SD_FLAG_ADVANCED = (1 << 9)
|
||||
};
|
||||
|
||||
enum settings_free_flags
|
||||
{
|
||||
SD_FREE_FLAG_VALUES = (1 << 0),
|
||||
SD_FREE_FLAG_NAME = (1 << 1),
|
||||
SD_FREE_FLAG_SHORT = (1 << 2)
|
||||
};
|
||||
|
||||
typedef struct rarch_setting rarch_setting_t;
|
||||
typedef struct rarch_setting_info rarch_setting_info_t;
|
||||
typedef struct rarch_setting_group_info rarch_setting_group_info_t;
|
||||
|
||||
typedef void (*change_handler_t )(void *data);
|
||||
typedef int (*action_left_handler_t )(void *data, bool wraparound);
|
||||
typedef int (*action_right_handler_t )(void *data, bool wraparound);
|
||||
typedef int (*action_up_handler_t )(void *data);
|
||||
typedef int (*action_down_handler_t )(void *data);
|
||||
typedef int (*action_start_handler_t )(void *data);
|
||||
typedef int (*action_cancel_handler_t )(void *data);
|
||||
typedef int (*action_ok_handler_t )(void *data, bool wraparound);
|
||||
typedef int (*action_select_handler_t )(void *data, bool wraparound);
|
||||
typedef void (*get_string_representation_t )(void *data, char *s, size_t len);
|
||||
|
||||
struct rarch_setting_group_info
|
||||
{
|
||||
const char *name;
|
||||
};
|
||||
|
||||
struct rarch_setting
|
||||
{
|
||||
enum msg_hash_enums enum_idx;
|
||||
enum setting_type type;
|
||||
|
||||
uint32_t size;
|
||||
|
||||
const char *name;
|
||||
uint32_t name_hash;
|
||||
const char *short_description;
|
||||
const char *group;
|
||||
const char *subgroup;
|
||||
const char *parent_group;
|
||||
const char *values;
|
||||
|
||||
uint32_t index;
|
||||
unsigned index_offset;
|
||||
|
||||
double min;
|
||||
double max;
|
||||
|
||||
uint64_t flags;
|
||||
uint64_t free_flags;
|
||||
|
||||
change_handler_t change_handler;
|
||||
change_handler_t read_handler;
|
||||
action_start_handler_t action_start;
|
||||
action_left_handler_t action_left;
|
||||
action_right_handler_t action_right;
|
||||
action_up_handler_t action_up;
|
||||
action_down_handler_t action_down;
|
||||
action_cancel_handler_t action_cancel;
|
||||
action_ok_handler_t action_ok;
|
||||
action_select_handler_t action_select;
|
||||
get_string_representation_t get_string_representation;
|
||||
|
||||
union
|
||||
{
|
||||
bool boolean;
|
||||
int integer;
|
||||
unsigned int unsigned_integer;
|
||||
float fraction;
|
||||
const char *string;
|
||||
const struct retro_keybind *keybind;
|
||||
} default_value;
|
||||
|
||||
struct
|
||||
{
|
||||
union
|
||||
{
|
||||
bool *boolean;
|
||||
int *integer;
|
||||
unsigned int *unsigned_integer;
|
||||
float *fraction;
|
||||
char *string;
|
||||
struct retro_keybind *keybind;
|
||||
} target;
|
||||
} value;
|
||||
|
||||
union
|
||||
{
|
||||
bool boolean;
|
||||
int integer;
|
||||
unsigned int unsigned_integer;
|
||||
float fraction;
|
||||
} original_value;
|
||||
|
||||
struct
|
||||
{
|
||||
const char *empty_path;
|
||||
} dir;
|
||||
|
||||
struct
|
||||
{
|
||||
enum event_command idx;
|
||||
bool triggered;
|
||||
} cmd_trigger;
|
||||
|
||||
struct
|
||||
{
|
||||
const char *off_label;
|
||||
const char *on_label;
|
||||
} boolean;
|
||||
|
||||
unsigned bind_type;
|
||||
enum setting_type browser_selection_type;
|
||||
float step;
|
||||
const char *rounding_fraction;
|
||||
bool enforce_minrange;
|
||||
bool enforce_maxrange;
|
||||
};
|
||||
|
||||
struct rarch_setting_info
|
||||
{
|
||||
int index;
|
||||
int size;
|
||||
};
|
||||
|
||||
bool START_GROUP(rarch_setting_t **list, rarch_setting_info_t *list_info,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
const char *name, const char *parent_group);
|
||||
|
||||
bool END_GROUP(rarch_setting_t **list, rarch_setting_info_t *list_info,
|
||||
const char *parent_group);
|
||||
|
||||
bool START_SUB_GROUP(rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info, const char *name,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group);
|
||||
|
||||
bool END_SUB_GROUP(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
const char *parent_group);
|
||||
|
||||
bool CONFIG_ACTION(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
const char *name, const char *SHORT,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group);
|
||||
|
||||
bool CONFIG_BOOL(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
bool *target,
|
||||
const char *name, const char *SHORT,
|
||||
bool default_value,
|
||||
const char *off, const char *on,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group,
|
||||
change_handler_t change_handler,
|
||||
change_handler_t read_handler,
|
||||
uint32_t flags
|
||||
);
|
||||
|
||||
bool CONFIG_INT(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
int *target,
|
||||
const char *name, const char *SHORT,
|
||||
int default_value,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group,
|
||||
change_handler_t change_handler, change_handler_t read_handler);
|
||||
|
||||
bool CONFIG_UINT(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
unsigned int *target,
|
||||
const char *name, const char *SHORT,
|
||||
unsigned int default_value,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group,
|
||||
change_handler_t change_handler, change_handler_t read_handler);
|
||||
|
||||
bool CONFIG_FLOAT(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
float *target,
|
||||
const char *name, const char *SHORT,
|
||||
float default_value, const char *rounding,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group,
|
||||
change_handler_t change_handler, change_handler_t read_handler);
|
||||
|
||||
bool CONFIG_PATH(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
char *target, size_t len,
|
||||
const char *name, const char *SHORT,
|
||||
const char *default_value,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group,
|
||||
change_handler_t change_handler, change_handler_t read_handler);
|
||||
|
||||
bool CONFIG_DIR(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
char *target, size_t len,
|
||||
const char *name, const char *SHORT,
|
||||
const char *default_value, const char *empty,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group,
|
||||
change_handler_t change_handler, change_handler_t read_handler);
|
||||
|
||||
bool CONFIG_STRING(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
char *target, size_t len,
|
||||
const char *name, const char *SHORT,
|
||||
const char *default_value,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group,
|
||||
change_handler_t change_handler, change_handler_t read_handler);
|
||||
|
||||
bool CONFIG_STRING_OPTIONS(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
char *target, size_t len,
|
||||
const char *name, const char *SHORT,
|
||||
const char *default_value, const char *values,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group,
|
||||
change_handler_t change_handler, change_handler_t read_handler);
|
||||
|
||||
bool CONFIG_HEX(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
unsigned int *target,
|
||||
const char *name, const char *SHORT,
|
||||
unsigned int default_value,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group,
|
||||
change_handler_t change_handler, change_handler_t read_handler);
|
||||
|
||||
/* Please strdup() NAME and SHORT */
|
||||
bool CONFIG_BIND(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
struct retro_keybind *target,
|
||||
uint32_t player, uint32_t player_offset,
|
||||
const char *name, const char *SHORT,
|
||||
const struct retro_keybind *default_value,
|
||||
rarch_setting_group_info_t *group_info,
|
||||
rarch_setting_group_info_t *subgroup_info,
|
||||
const char *parent_group);
|
||||
|
||||
/**
|
||||
* setting_set_with_string_representation:
|
||||
* @setting : pointer to setting
|
||||
* @value : value for the setting (string)
|
||||
*
|
||||
* Set a settings' value with a string. It is assumed
|
||||
* that the string has been properly formatted.
|
||||
**/
|
||||
int setting_set_with_string_representation(
|
||||
rarch_setting_t* setting, const char *value);
|
||||
|
||||
unsigned setting_get_index_offset(rarch_setting_t *setting);
|
||||
|
||||
uint32_t setting_get_index(rarch_setting_t *setting);
|
||||
|
||||
uint64_t setting_get_flags(rarch_setting_t *setting);
|
||||
|
||||
double setting_get_min(rarch_setting_t *setting);
|
||||
|
||||
double setting_get_max(rarch_setting_t *setting);
|
||||
|
||||
unsigned setting_get_bind_type(rarch_setting_t *setting);
|
||||
|
||||
enum setting_type setting_get_type(rarch_setting_t *setting);
|
||||
|
||||
int setting_string_action_start_generic(void *data);
|
||||
|
||||
int setting_generic_action_ok_default(void *data, bool wraparound);
|
||||
|
||||
int setting_generic_action_start_default(void *data);
|
||||
|
||||
rarch_setting_t setting_terminator_setting(void);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user