mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-19 16:59:50 +00:00
save only modified values when saving remaps
This commit is contained in:
parent
82991afb36
commit
80845f1cd6
@ -161,7 +161,22 @@ bool input_remapping_save_file(const char *path)
|
||||
{
|
||||
fill_pathname_join_delim(key_ident[j], buf,
|
||||
key_strings[j], '_', sizeof(key_ident[j]));
|
||||
config_set_int(conf, key_ident[j], settings->input.remap_ids[i][j]);
|
||||
|
||||
/* only save values that have been modified */
|
||||
if(j < RARCH_FIRST_CUSTOM_BIND)
|
||||
{
|
||||
if(settings->input.remap_ids[i][j] != j)
|
||||
config_set_int(conf, key_ident[j], settings->input.remap_ids[i][j]);
|
||||
else
|
||||
config_unset(conf,key_ident[j]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(settings->input.remap_ids[i][j] != j - RARCH_FIRST_CUSTOM_BIND)
|
||||
config_set_int(conf, key_ident[j], settings->input.remap_ids[i][j]);
|
||||
else
|
||||
config_unset(conf,key_ident[j]);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_USERS; i++)
|
||||
|
@ -773,6 +773,20 @@ void config_set_string(config_file_t *conf, const char *key, const char *val)
|
||||
conf->entries = entry;
|
||||
}
|
||||
|
||||
void config_unset(config_file_t *conf, const char *key)
|
||||
{
|
||||
struct config_entry_list *last = conf->entries;
|
||||
struct config_entry_list *entry = config_get_entry(conf, key, &last);
|
||||
|
||||
if (!entry)
|
||||
return;
|
||||
|
||||
entry->key = NULL;
|
||||
entry->value = NULL;
|
||||
free(entry->key);
|
||||
free(entry->value);
|
||||
}
|
||||
|
||||
void config_set_path(config_file_t *conf, const char *entry, const char *val)
|
||||
{
|
||||
#if defined(RARCH_CONSOLE)
|
||||
@ -873,7 +887,7 @@ void config_file_dump(config_file_t *conf, FILE *file)
|
||||
list = (struct config_entry_list*)conf->entries;
|
||||
while (list)
|
||||
{
|
||||
if (!list->readonly)
|
||||
if (!list->readonly && list->key)
|
||||
fprintf(file, "%s = \"%s\"\n", list->key, list->value);
|
||||
list = list->next;
|
||||
}
|
||||
|
@ -147,6 +147,7 @@ void config_set_hex(config_file_t *conf, const char *entry, unsigned val);
|
||||
void config_set_uint64(config_file_t *conf, const char *entry, uint64_t val);
|
||||
void config_set_char(config_file_t *conf, const char *entry, char val);
|
||||
void config_set_string(config_file_t *conf, const char *entry, const char *val);
|
||||
void config_unset(config_file_t *conf, const char *key);
|
||||
void config_set_path(config_file_t *conf, const char *entry, const char *val);
|
||||
void config_set_bool(config_file_t *conf, const char *entry, bool val);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user