settings.c - cleanups

This commit is contained in:
twinaphex 2015-01-14 00:35:27 +01:00
parent 6374422d1f
commit 92a18a4109
3 changed files with 81 additions and 26 deletions

View File

@ -927,45 +927,61 @@ exit:
static void read_keybinds_keyboard(config_file_t *conf, unsigned user,
unsigned idx, struct retro_keybind *bind)
{
if (input_config_bind_map[idx].valid && input_config_bind_map[idx].base)
{
const char *prefix = input_config_get_prefix(user,
input_config_bind_map[idx].meta);
if (prefix)
input_config_parse_key(conf, prefix,
input_config_bind_map[idx].base, bind);
}
const char *prefix = NULL;
if (!input_config_bind_map[idx].valid)
return;
if (!input_config_bind_map[idx].base)
return;
prefix = input_config_get_prefix(user, input_config_bind_map[idx].meta);
if (prefix)
input_config_parse_key(conf, prefix,
input_config_bind_map[idx].base, bind);
}
static void read_keybinds_button(config_file_t *conf, unsigned user,
unsigned idx, struct retro_keybind *bind)
{
if (input_config_bind_map[idx].valid && input_config_bind_map[idx].base)
{
const char *prefix = input_config_get_prefix(user,
input_config_bind_map[idx].meta);
if (prefix)
input_config_parse_joy_button(conf, prefix,
input_config_bind_map[idx].base, bind);
}
const char *prefix = NULL;
if (!input_config_bind_map[idx].valid)
return;
if (!input_config_bind_map[idx].base)
return;
prefix = input_config_get_prefix(user,
input_config_bind_map[idx].meta);
if (prefix)
input_config_parse_joy_button(conf, prefix,
input_config_bind_map[idx].base, bind);
}
static void read_keybinds_axis(config_file_t *conf, unsigned user,
unsigned idx, struct retro_keybind *bind)
{
if (input_config_bind_map[idx].valid && input_config_bind_map[idx].base)
{
const char *prefix = input_config_get_prefix(user,
input_config_bind_map[idx].meta);
if (prefix)
input_config_parse_joy_axis(conf, prefix,
input_config_bind_map[idx].base, bind);
}
const char *prefix = NULL;
if (!input_config_bind_map[idx].valid)
return;
if (!input_config_bind_map[idx].base)
return;
prefix = input_config_get_prefix(user,
input_config_bind_map[idx].meta);
if (prefix)
input_config_parse_joy_axis(conf, prefix,
input_config_bind_map[idx].base, bind);
}
static void read_keybinds_user(config_file_t *conf, unsigned user)
{
unsigned i;
for (i = 0; input_config_bind_map[i].valid; i++)
{
struct retro_keybind *bind = (struct retro_keybind*)
@ -983,6 +999,7 @@ static void read_keybinds_user(config_file_t *conf, unsigned user)
static void config_read_keybinds_conf(config_file_t *conf)
{
unsigned i;
for (i = 0; i < MAX_USERS; i++)
read_keybinds_user(conf, i);
}
@ -1001,6 +1018,7 @@ static void config_file_dump_all(config_file_t *conf)
}
list = conf->entries;
while (list)
{
RARCH_LOG("%s = \"%s\" %s\n", list->key,
@ -1617,7 +1635,7 @@ static void save_keybind_joykey(config_file_t *conf, const char *prefix,
static void save_keybind_axis(config_file_t *conf, const char *prefix,
const char *base, const struct retro_keybind *bind)
{
char key[64];
char key[64], config[16];
unsigned axis = 0;
char dir = '\0';
@ -1638,7 +1656,6 @@ static void save_keybind_axis(config_file_t *conf, const char *prefix,
if (dir)
{
char config[16];
snprintf(config, sizeof(config), "%c%u", dir, axis);
config_set_string(conf, key, config);
}

View File

@ -1724,6 +1724,25 @@ rarch_setting_t setting_data_string_setting(enum setting_type type,
return result;
}
/**
* setting_data_string_setting_options:
* @type : type of settting.
* @name : name of setting.
* @short_description : Short description of setting.
* @target : Target of bind setting.
* @size : Size of string setting.
* @default_value : Default value.
* @empty : N/A.
* @values : Values, separated by a delimiter.
* @group : Group that the setting belongs to.
* @subgroup : Subgroup that the setting belongs to.
* @change_handler : Function callback for change handler function pointer.
* @read_handler : Function callback for read handler function pointer.
*
* Initializes a string options list setting.
*
* Returns: string option list setting.
**/
rarch_setting_t setting_data_string_setting_options(enum setting_type type,
const char* name, const char* short_description, char* target,
unsigned size, const char* default_value,

View File

@ -249,6 +249,25 @@ rarch_setting_t setting_data_bind_setting(const char* name,
const struct retro_keybind* default_value, const char *group,
const char *subgroup);
/**
* setting_data_string_setting_options:
* @type : type of settting.
* @name : name of setting.
* @short_description : Short description of setting.
* @target : Target of bind setting.
* @size : Size of string setting.
* @default_value : Default value.
* @empty : N/A.
* @values : Values, separated by a delimiter.
* @group : Group that the setting belongs to.
* @subgroup : Subgroup that the setting belongs to.
* @change_handler : Function callback for change handler function pointer.
* @read_handler : Function callback for read handler function pointer.
*
* Initializes a string options list setting.
*
* Returns: string option list setting.
**/
rarch_setting_t setting_data_string_setting_options(enum setting_type type,
const char* name, const char* short_description, char* target,
unsigned size, const char* default_value, const char *empty, const char *values,