2013-07-11 22:59:17 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2014-01-01 00:50:59 +00:00
|
|
|
* Copyright (C) 2013-2014 - Jason Fetters
|
2013-07-11 22:59:17 +00:00
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2014-05-03 16:38:29 +00:00
|
|
|
#ifndef __RARCH_SETTINGS_DATA_H__
|
|
|
|
#define __RARCH_SETTINGS_DATA_H__
|
2013-07-11 22:59:17 +00:00
|
|
|
|
2014-08-08 05:58:07 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
#include "conf/config_file.h"
|
2013-07-11 22:59:17 +00:00
|
|
|
|
2014-08-17 18:42:35 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2014-08-26 23:30:18 +00:00
|
|
|
typedef void (*change_handler_t)(const void *data);
|
2014-07-08 16:56:12 +00:00
|
|
|
|
2014-08-26 23:30:18 +00:00
|
|
|
#define BINDFOR(s) (*(&(s))->value.keybind)
|
2014-07-08 16:56:12 +00:00
|
|
|
|
2014-04-26 01:14:53 +00:00
|
|
|
enum setting_type
|
|
|
|
{
|
|
|
|
ST_NONE = 0,
|
|
|
|
ST_BOOL,
|
|
|
|
ST_INT,
|
|
|
|
ST_UINT,
|
|
|
|
ST_FLOAT,
|
|
|
|
ST_PATH,
|
2014-08-09 02:27:05 +00:00
|
|
|
ST_DIR,
|
2014-04-26 01:14:53 +00:00
|
|
|
ST_STRING,
|
|
|
|
ST_HEX,
|
|
|
|
ST_BIND,
|
|
|
|
ST_GROUP,
|
|
|
|
ST_SUB_GROUP,
|
|
|
|
ST_END_GROUP,
|
|
|
|
ST_END_SUB_GROUP
|
|
|
|
};
|
2013-12-01 17:42:21 +00:00
|
|
|
|
|
|
|
enum setting_flags
|
|
|
|
{
|
2014-05-03 16:38:29 +00:00
|
|
|
SD_FLAG_PATH_DIR = 1,
|
|
|
|
SD_FLAG_PATH_FILE = 2,
|
2013-12-01 17:42:21 +00:00
|
|
|
SD_FLAG_ALLOW_EMPTY = 4,
|
2014-05-03 16:38:29 +00:00
|
|
|
SD_FLAG_VALUE_DESC = 8,
|
|
|
|
SD_FLAG_HAS_RANGE = 16
|
2013-12-01 17:42:21 +00:00
|
|
|
};
|
2013-07-11 22:59:17 +00:00
|
|
|
|
2014-01-06 01:12:04 +00:00
|
|
|
typedef struct rarch_setting_t
|
2013-07-11 22:59:17 +00:00
|
|
|
{
|
|
|
|
enum setting_type type;
|
|
|
|
|
|
|
|
const char* name;
|
2013-08-25 23:28:57 +00:00
|
|
|
uint32_t size;
|
2013-07-11 22:59:17 +00:00
|
|
|
|
|
|
|
const char* short_description;
|
2014-07-08 19:33:34 +00:00
|
|
|
const char* group;
|
|
|
|
const char* subgroup;
|
2013-07-11 22:59:17 +00:00
|
|
|
|
2013-11-22 14:30:02 +00:00
|
|
|
uint32_t index;
|
2013-08-27 03:56:26 +00:00
|
|
|
|
2013-07-11 22:59:17 +00:00
|
|
|
double min;
|
|
|
|
double max;
|
2013-12-01 17:42:21 +00:00
|
|
|
|
2013-12-03 00:55:58 +00:00
|
|
|
const char* values;
|
2013-12-01 17:42:21 +00:00
|
|
|
uint64_t flags;
|
2013-11-22 14:30:02 +00:00
|
|
|
|
2014-07-12 16:35:35 +00:00
|
|
|
change_handler_t change_handler;
|
2014-07-25 23:50:47 +00:00
|
|
|
change_handler_t read_handler;
|
2014-01-06 01:12:04 +00:00
|
|
|
|
2013-11-22 14:30:02 +00:00
|
|
|
union
|
|
|
|
{
|
|
|
|
bool boolean;
|
|
|
|
int integer;
|
|
|
|
unsigned int unsigned_integer;
|
|
|
|
float fraction;
|
|
|
|
const char* string;
|
|
|
|
const struct retro_keybind* keybind;
|
|
|
|
} default_value;
|
|
|
|
|
|
|
|
union
|
|
|
|
{
|
|
|
|
bool* boolean;
|
|
|
|
int* integer;
|
|
|
|
unsigned int* unsigned_integer;
|
|
|
|
float* fraction;
|
|
|
|
char* string;
|
|
|
|
struct retro_keybind* keybind;
|
|
|
|
} value;
|
2014-08-09 02:54:40 +00:00
|
|
|
|
2014-08-27 15:36:45 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
const char *empty_path;
|
|
|
|
} dir;
|
|
|
|
|
2014-08-09 02:54:40 +00:00
|
|
|
float step;
|
2014-08-24 17:45:34 +00:00
|
|
|
const char *rounding_fraction;
|
2014-08-09 03:18:54 +00:00
|
|
|
bool enforce_minrange;
|
|
|
|
bool enforce_maxrange;
|
2013-07-11 22:59:17 +00:00
|
|
|
} rarch_setting_t;
|
|
|
|
|
2013-12-26 21:17:37 +00:00
|
|
|
void setting_data_reset_setting(const rarch_setting_t* setting);
|
2013-11-22 14:30:02 +00:00
|
|
|
void setting_data_reset(const rarch_setting_t* settings);
|
2013-07-11 22:59:17 +00:00
|
|
|
|
2013-11-22 14:30:02 +00:00
|
|
|
bool setting_data_load_config_path(const rarch_setting_t* settings, const char* path);
|
2014-07-26 01:28:16 +00:00
|
|
|
bool setting_data_save_config(const rarch_setting_t* settings, config_file_t* config);
|
2013-07-11 22:59:17 +00:00
|
|
|
|
2014-07-16 19:29:50 +00:00
|
|
|
rarch_setting_t* setting_data_find_setting(rarch_setting_t* settings, const char* name);
|
2013-07-11 22:59:17 +00:00
|
|
|
|
2013-11-22 14:30:02 +00:00
|
|
|
void setting_data_set_with_string_representation(const rarch_setting_t* setting, const char* value);
|
2014-08-17 14:20:37 +00:00
|
|
|
void setting_data_get_string_representation(const rarch_setting_t* setting, char* buf, size_t sizeof_buf);
|
2013-07-11 22:59:17 +00:00
|
|
|
|
2014-07-25 23:57:50 +00:00
|
|
|
// List building helper functions
|
|
|
|
rarch_setting_t setting_data_group_setting(enum setting_type type, const char* name);
|
|
|
|
rarch_setting_t setting_data_bool_setting(const char* name, const char* description, bool* target, bool default_value, const char * group, const char *subgroup, change_handler_t change_handler, change_handler_t read_handler);
|
|
|
|
rarch_setting_t setting_data_int_setting(const char* name, const char* description, int* target, int default_value, const char *group, const char *subgroup, change_handler_t change_handler, change_handler_t read_handler);
|
|
|
|
rarch_setting_t setting_data_uint_setting(const char* name, const char* description, unsigned int* target, unsigned int default_value, const char *group, const char *subgroup, change_handler_t change_handler, change_handler_t read_handler);
|
2014-08-24 17:37:57 +00:00
|
|
|
rarch_setting_t setting_data_float_setting(const char* name, const char* description, float* target, float default_value, const char *rounding, const char *group, const char *subgroup, change_handler_t change_handler, change_handler_t read_handler);
|
2014-08-24 18:19:59 +00:00
|
|
|
rarch_setting_t setting_data_string_setting(enum setting_type type, const char* name, const char* description, char* target, unsigned size, const char* default_value, const char *empty, const char *group, const char *subgroup, change_handler_t change_handler, change_handler_t read_handler);
|
2014-07-25 23:57:50 +00:00
|
|
|
rarch_setting_t setting_data_bind_setting(const char* name, const char* description, struct retro_keybind* target, uint32_t index,
|
|
|
|
const struct retro_keybind* default_value, const char *group, const char *subgroup);
|
|
|
|
|
2014-07-27 02:30:06 +00:00
|
|
|
void setting_data_get_description(const void *data, char *msg, size_t msg_sizeof);
|
|
|
|
|
2013-11-22 14:30:02 +00:00
|
|
|
// These functions operate only on RetroArch's main settings list
|
2014-07-16 19:29:50 +00:00
|
|
|
rarch_setting_t* setting_data_get_list(void);
|
2013-08-27 02:12:22 +00:00
|
|
|
|
2014-08-17 18:42:35 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-11-22 14:30:02 +00:00
|
|
|
#endif
|