mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 00:20:01 +00:00
(menu_setting) Refactor this macro mess
This commit is contained in:
parent
892d99b3a6
commit
aa1e8dc543
@ -130,6 +130,12 @@ enum
|
||||
RECORD_NULL
|
||||
};
|
||||
|
||||
#ifdef GEKKO
|
||||
#define MAX_GAMMA_SETTING 2
|
||||
#else
|
||||
#define MAX_GAMMA_SETTING 1
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) || defined(__CELLOS_LV2__)
|
||||
#define VIDEO_DEFAULT_DRIVER VIDEO_GL
|
||||
#elif defined(GEKKO)
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "../string_list_special.h"
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
#include "../menu/menu_hash.h"
|
||||
#include "../menu/menu_setting.h"
|
||||
#endif
|
||||
|
||||
@ -1162,43 +1163,54 @@ static void video_monitor_adjust_system_rates(void)
|
||||
RARCH_LOG("Game FPS > Monitor FPS. Cannot rely on VSync.\n");
|
||||
}
|
||||
|
||||
void video_driver_menu_settings(void *data, void *subgroup_data, const char *parent_group)
|
||||
void video_driver_menu_settings(void **list_data, void *list_info_data,
|
||||
void *group_data, void *subgroup_data, const char *parent_group)
|
||||
{
|
||||
#ifdef HAVE_MENU
|
||||
rarch_setting_group_info_t *group_info = (rarch_setting_group_info_t*)data;
|
||||
rarch_setting_t **list = (rarch_setting_t**)list_data;
|
||||
rarch_setting_info_t *list_info = (rarch_setting_info_t*)list_info_data;
|
||||
rarch_setting_group_info_t *group_info = (rarch_setting_group_info_t*)group_data;
|
||||
rarch_setting_group_info_t *subgroup_info = (rarch_setting_group_info_t*)subgroup_data;
|
||||
global_t *global = global_get_ptr();
|
||||
(void)list;
|
||||
(void)list_info;
|
||||
(void)group_info;
|
||||
(void)subgroup_info;
|
||||
(void)global;
|
||||
|
||||
#if defined(GEKKO) || defined(__CELLOS_LV2__)
|
||||
CONFIG_ACTION(
|
||||
list, list_info,
|
||||
menu_hash_to_str(MENU_LABEL_SCREEN_RESOLUTION),
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_SCREEN_RESOLUTION),
|
||||
group_info->name,
|
||||
subgroup_info->name,
|
||||
group_info,
|
||||
subgroup_info,
|
||||
parent_group);
|
||||
#endif
|
||||
#if defined(__CELLOS_LV2__)
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
&global->console.screen.pal60_enable,
|
||||
menu_hash_to_str(MENU_LABEL_PAL60_ENABLE),
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_PAL60_ENABLE),
|
||||
false,
|
||||
menu_hash_to_str(MENU_VALUE_OFF),
|
||||
menu_hash_to_str(MENU_VALUE_ON),
|
||||
group_info->name,
|
||||
subgroup_info->name,
|
||||
group_info,
|
||||
subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
#endif
|
||||
#if defined(HW_RVL) || defined(_XBOX360)
|
||||
CONFIG_UINT(
|
||||
global->console.screen.gamma_correction,
|
||||
list, list_info,
|
||||
&global->console.screen.gamma_correction,
|
||||
menu_hash_to_str(MENU_LABEL_VIDEO_GAMMA),
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_VIDEO_GAMMA),
|
||||
0,
|
||||
group_info->name,
|
||||
subgroup_info->name,
|
||||
group_info,
|
||||
subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
@ -1218,14 +1230,15 @@ void video_driver_menu_settings(void *data, void *subgroup_data, const char *par
|
||||
#endif
|
||||
#if defined(_XBOX1) || defined(HW_RVL)
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
&global->console.softfilter_enable,
|
||||
menu_hash_to_str(MENU_LABEL_VIDEO_SOFT_FILTER),
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_VIDEO_SOFT_FILTER),
|
||||
false,
|
||||
menu_hash_to_str(MENU_VALUE_OFF),
|
||||
menu_hash_to_str(MENU_VALUE_ON),
|
||||
group_info->name,
|
||||
subgroup_info->name,
|
||||
group_info,
|
||||
subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
@ -1236,12 +1249,13 @@ void video_driver_menu_settings(void *data, void *subgroup_data, const char *par
|
||||
#endif
|
||||
#ifdef _XBOX1
|
||||
CONFIG_UINT(
|
||||
settings->video.swap_interval,
|
||||
list, list_info,
|
||||
&settings->video.swap_interval,
|
||||
menu_hash_to_str(MENU_LABEL_VIDEO_FILTER_FLICKER),
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_VIDEO_FILTER_FLICKER),
|
||||
0,
|
||||
group_info.name,
|
||||
subgroup_info.name,
|
||||
group_info,
|
||||
subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
|
@ -434,7 +434,8 @@ void video_driver_cached_frame_set_ptr(const void *data);
|
||||
void video_driver_cached_frame_get(const void **data, unsigned *width,
|
||||
unsigned *height, size_t *pitch);
|
||||
|
||||
void video_driver_menu_settings(void *data, void *subgroup_data, const char *parent_group);
|
||||
void video_driver_menu_settings(void **list_data, void *list_info_data,
|
||||
void *group_data, void *subgroup_data, const char *parent_group);
|
||||
|
||||
/**
|
||||
* video_viewport_get_scaled_integer:
|
||||
|
3981
menu/menu_setting.c
3981
menu/menu_setting.c
File diff suppressed because it is too large
Load Diff
@ -21,6 +21,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <boolean.h>
|
||||
|
||||
#include "../command_event.h"
|
||||
#include "../libretro.h"
|
||||
#include "../input/input_driver.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -97,86 +101,177 @@ enum setting_list_flags
|
||||
|
||||
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);
|
||||
|
||||
rarch_setting_t setting_group_setting(enum setting_type type, const char* name,
|
||||
const char *parent_group);
|
||||
|
||||
/**
|
||||
* setting_action_setting:
|
||||
* @name : Name of setting.
|
||||
* @short_description : Short description of setting.
|
||||
* @group : Group that the setting belongs to.
|
||||
* @subgroup : Subgroup that the setting belongs to.
|
||||
*
|
||||
* Initializes a setting of type ST_ACTION.
|
||||
*
|
||||
* Returns: setting of type ST_ACTION.
|
||||
**/
|
||||
rarch_setting_t setting_action_setting(const char* name,
|
||||
const char* short_description,
|
||||
const char *group, const char *subgroup,
|
||||
const char *parent_group);
|
||||
|
||||
#define SL_FLAG_SETTINGS_GROUP_ALL (SL_FLAG_SETTINGS_ALL - SL_FLAG_MAIN_MENU)
|
||||
|
||||
#define START_GROUP(group_info, NAME, parent_group) \
|
||||
do{ \
|
||||
group_info.name = NAME; \
|
||||
if (!(menu_settings_list_append(list, list_info, setting_group_setting (ST_GROUP, NAME, parent_group)))) return false; \
|
||||
}while(0)
|
||||
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);
|
||||
|
||||
#define END_GROUP(list, list_info, parent_group) \
|
||||
do{ \
|
||||
if (!(menu_settings_list_append(list, list_info, setting_group_setting (ST_END_GROUP, 0, parent_group)))) return false; \
|
||||
}while(0)
|
||||
bool END_GROUP(rarch_setting_t **list, rarch_setting_info_t *list_info,
|
||||
const char *parent_group);
|
||||
|
||||
#define START_SUB_GROUP(list, list_info, NAME, group_info, subgroup_info, parent_group) \
|
||||
do{ \
|
||||
subgroup_info.name = NAME; \
|
||||
if (!(menu_settings_list_append(list, list_info, setting_subgroup_setting (ST_SUB_GROUP, NAME, group_info, parent_group)))) return false; \
|
||||
}while(0)
|
||||
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);
|
||||
|
||||
#define END_SUB_GROUP(list, list_info, parent_group) \
|
||||
do{ \
|
||||
if (!(menu_settings_list_append(list, list_info, setting_group_setting (ST_END_SUB_GROUP, 0, parent_group)))) return false; \
|
||||
}while(0)
|
||||
bool END_SUB_GROUP(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
const char *parent_group);
|
||||
|
||||
#define CONFIG_ACTION(NAME, SHORT, group_info, subgroup_info, parent_group) \
|
||||
do{ \
|
||||
if (!menu_settings_list_append(list, list_info, setting_action_setting (NAME, SHORT, group_info, subgroup_info, parent_group))) return false; \
|
||||
}while(0)
|
||||
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);
|
||||
|
||||
#define CONFIG_BOOL(TARGET, NAME, SHORT, DEF, OFF, ON, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER) \
|
||||
do{ \
|
||||
if (!menu_settings_list_append(list, list_info, setting_bool_setting (NAME, SHORT, TARGET, DEF, OFF, ON, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER)))return false; \
|
||||
}while(0)
|
||||
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);
|
||||
|
||||
#define CONFIG_INT(TARGET, NAME, SHORT, DEF, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER) \
|
||||
do{ \
|
||||
if (!(menu_settings_list_append(list, list_info, setting_int_setting (NAME, SHORT, &TARGET, DEF, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER)))) return false; \
|
||||
}while(0)
|
||||
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);
|
||||
|
||||
#define CONFIG_UINT(TARGET, NAME, SHORT, DEF, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER) \
|
||||
do{ \
|
||||
if (!(menu_settings_list_append(list, list_info, setting_uint_setting (NAME, SHORT, &TARGET, DEF, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER)))) return false; \
|
||||
}while(0)
|
||||
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);
|
||||
|
||||
#define CONFIG_FLOAT(TARGET, NAME, SHORT, DEF, ROUNDING, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER) \
|
||||
do{ \
|
||||
if (!(menu_settings_list_append(list, list_info, setting_float_setting (NAME, SHORT, &TARGET, DEF, ROUNDING, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER)))) return false; \
|
||||
}while(0)
|
||||
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);
|
||||
|
||||
#define CONFIG_PATH(TARGET, NAME, SHORT, DEF, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER) \
|
||||
do{ \
|
||||
if (!(menu_settings_list_append(list, list_info, setting_string_setting(ST_PATH, NAME, SHORT, TARGET, sizeof(TARGET), DEF, "", group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER)))) return false; \
|
||||
}while(0)
|
||||
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);
|
||||
|
||||
#define CONFIG_DIR(TARGET, NAME, SHORT, DEF, EMPTY, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER) \
|
||||
do{ \
|
||||
if (!(menu_settings_list_append(list, list_info, setting_string_setting(ST_DIR, NAME, SHORT, TARGET, sizeof(TARGET), DEF, EMPTY, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER)))) return false; \
|
||||
}while(0)
|
||||
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);
|
||||
|
||||
#define CONFIG_STRING(TARGET, NAME, SHORT, DEF, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER) \
|
||||
do{ \
|
||||
if (!(menu_settings_list_append(list, list_info, setting_string_setting(ST_STRING, NAME, SHORT, TARGET, sizeof(TARGET), DEF, "", group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER)))) return false; \
|
||||
}while(0)
|
||||
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);
|
||||
|
||||
#define CONFIG_STRING_OPTIONS(TARGET, NAME, SHORT, DEF, OPTS, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER) \
|
||||
do{ \
|
||||
if (!(menu_settings_list_append(list, list_info, setting_string_setting_options(ST_STRING_OPTIONS, NAME, SHORT, TARGET, sizeof(TARGET), DEF, "", OPTS, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER)))) return false; \
|
||||
}while(0)
|
||||
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);
|
||||
|
||||
#define CONFIG_HEX(TARGET, NAME, SHORT, DEF, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER) \
|
||||
do{ \
|
||||
if (!(menu_settings_list_append(list, list_info, setting_hex_setting(NAME, SHORT, &TARGET, DEF, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER)))) return false; \
|
||||
}while(0)
|
||||
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 */
|
||||
#define CONFIG_BIND(TARGET, PLAYER, PLAYER_OFFSET, NAME, SHORT, DEF, group_info, subgroup_info, parent_group) \
|
||||
do{ \
|
||||
if (!(menu_settings_list_append(list, list_info, setting_bind_setting (NAME, SHORT, &TARGET, PLAYER, PLAYER_OFFSET, DEF, group_info, subgroup_info, parent_group)))) return false; \
|
||||
}while(0)
|
||||
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);
|
||||
|
||||
@ -283,6 +378,26 @@ bool menu_setting_action_right(rarch_setting_t *setting, bool wraparound);
|
||||
|
||||
void menu_settings_list_increment(rarch_setting_t **list);
|
||||
|
||||
void general_write_handler(void *data);
|
||||
|
||||
void general_read_handler(void *data);
|
||||
|
||||
void menu_settings_list_current_add_cmd(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
enum event_command values);
|
||||
|
||||
void menu_settings_list_current_add_range(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
float min, float max, float step,
|
||||
bool enforce_minrange_enable, bool enforce_maxrange_enable);
|
||||
|
||||
void settings_data_list_current_add_flags(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
unsigned values);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user