mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
(Config file) Don't save 'nul' entries in config file anymore -
config file size goes from 100KB to 20KB
This commit is contained in:
parent
debbd9f15b
commit
4c6d46137c
@ -3725,7 +3725,7 @@ bool config_save_autoconf_profile(const char *path, unsigned user)
|
||||
if (bind->valid)
|
||||
input_config_save_keybind(
|
||||
conf, "input", input_config_bind_map_get_base(i),
|
||||
bind, false);
|
||||
bind);
|
||||
}
|
||||
|
||||
ret = config_file_write(conf, autoconf_file, false);
|
||||
|
@ -53,6 +53,10 @@
|
||||
var = newvar; \
|
||||
}
|
||||
|
||||
#ifndef EXPLICIT_NULL
|
||||
#define EXPLICIT_NULL "nul"
|
||||
#endif
|
||||
|
||||
enum crt_switch_type
|
||||
{
|
||||
CRT_SWITCH_NONE = 0,
|
||||
|
@ -453,7 +453,7 @@ void fill_short_pathname_representation_wrapper(char* out_rep,
|
||||
|
||||
last_slash = find_last_slash(path_short);
|
||||
|
||||
if (last_slash != NULL)
|
||||
if (last_slash)
|
||||
{
|
||||
/* We handle paths like:
|
||||
* /path/to/file.7z#mygame.img
|
||||
|
@ -545,8 +545,7 @@ uint16_t input_config_get_vid(unsigned port);
|
||||
void input_config_save_keybinds_user(void *data, unsigned user);
|
||||
|
||||
void input_config_save_keybind(void *data, const char *prefix,
|
||||
const char *base, const struct retro_keybind *bind,
|
||||
bool save_empty);
|
||||
const char *base, const struct retro_keybind *bind);
|
||||
|
||||
void input_config_reset(void);
|
||||
|
||||
|
42
retroarch.c
42
retroarch.c
@ -17731,9 +17731,12 @@ void input_config_save_keybinds_user(void *data, unsigned user)
|
||||
fill_pathname_join_delim(key, prefix, base, '_', sizeof(key));
|
||||
|
||||
input_keymaps_translate_rk_to_str(bind->key, btn, sizeof(btn));
|
||||
config_set_string(conf, key, btn);
|
||||
|
||||
input_config_save_keybind(conf, prefix, base, bind, true);
|
||||
if (!string_is_equal(btn, EXPLICIT_NULL))
|
||||
{
|
||||
config_set_string(conf, key, btn);
|
||||
input_config_save_keybind(conf, prefix, base, bind);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -17775,7 +17778,7 @@ static void save_keybind_hat(config_file_t *conf, const char *key,
|
||||
static void save_keybind_joykey(config_file_t *conf,
|
||||
const char *prefix,
|
||||
const char *base,
|
||||
const struct retro_keybind *bind, bool save_empty)
|
||||
const struct retro_keybind *bind)
|
||||
{
|
||||
char key[64];
|
||||
|
||||
@ -17784,12 +17787,7 @@ static void save_keybind_joykey(config_file_t *conf,
|
||||
fill_pathname_join_delim_concat(key, prefix,
|
||||
base, '_', "_btn", sizeof(key));
|
||||
|
||||
if (bind->joykey == NO_BTN)
|
||||
{
|
||||
if (save_empty)
|
||||
config_set_string(conf, key, "nul");
|
||||
}
|
||||
else if (GET_HAT_DIR(bind->joykey))
|
||||
if (GET_HAT_DIR(bind->joykey))
|
||||
save_keybind_hat(conf, key, bind);
|
||||
else
|
||||
config_set_uint64(conf, key, bind->joykey);
|
||||
@ -17798,7 +17796,7 @@ static void save_keybind_joykey(config_file_t *conf,
|
||||
static void save_keybind_axis(config_file_t *conf,
|
||||
const char *prefix,
|
||||
const char *base,
|
||||
const struct retro_keybind *bind, bool save_empty)
|
||||
const struct retro_keybind *bind)
|
||||
{
|
||||
char key[64];
|
||||
unsigned axis = 0;
|
||||
@ -17811,12 +17809,7 @@ static void save_keybind_axis(config_file_t *conf,
|
||||
"_axis",
|
||||
sizeof(key));
|
||||
|
||||
if (bind->joyaxis == AXIS_NONE)
|
||||
{
|
||||
if (save_empty)
|
||||
config_set_string(conf, key, "nul");
|
||||
}
|
||||
else if (AXIS_NEG_GET(bind->joyaxis) != AXIS_DIR_NONE)
|
||||
if (AXIS_NEG_GET(bind->joyaxis) != AXIS_DIR_NONE)
|
||||
{
|
||||
dir = '-';
|
||||
axis = AXIS_NEG_GET(bind->joyaxis);
|
||||
@ -17841,7 +17834,7 @@ static void save_keybind_axis(config_file_t *conf,
|
||||
static void save_keybind_mbutton(config_file_t *conf,
|
||||
const char *prefix,
|
||||
const char *base,
|
||||
const struct retro_keybind *bind, bool save_empty)
|
||||
const struct retro_keybind *bind)
|
||||
{
|
||||
char key[64];
|
||||
|
||||
@ -17880,8 +17873,6 @@ static void save_keybind_mbutton(config_file_t *conf,
|
||||
config_set_string(conf, key, "whd");
|
||||
break;
|
||||
default:
|
||||
if (save_empty)
|
||||
config_set_string(conf, key, "nul");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -17897,14 +17888,17 @@ static void save_keybind_mbutton(config_file_t *conf,
|
||||
* Save a key binding to the config file.
|
||||
*/
|
||||
void input_config_save_keybind(void *data, const char *prefix,
|
||||
const char *base, const struct retro_keybind *bind,
|
||||
bool save_empty)
|
||||
const char *base, const struct retro_keybind *bind)
|
||||
{
|
||||
config_file_t *conf = (config_file_t*)data;
|
||||
|
||||
save_keybind_joykey (conf, prefix, base, bind, save_empty);
|
||||
save_keybind_axis (conf, prefix, base, bind, save_empty);
|
||||
save_keybind_mbutton(conf, prefix, base, bind, save_empty);
|
||||
|
||||
if (bind->joykey != NO_BTN)
|
||||
save_keybind_joykey(conf, prefix, base, bind);
|
||||
if (bind->joyaxis != AXIS_NONE)
|
||||
save_keybind_axis(conf, prefix, base, bind);
|
||||
if (bind->mbutton != NO_BTN)
|
||||
save_keybind_mbutton(conf, prefix, base, bind);
|
||||
}
|
||||
|
||||
/* MIDI */
|
||||
|
Loading…
x
Reference in New Issue
Block a user