mirror of
https://github.com/libretro/RetroArch
synced 2025-02-21 18:40:09 +00:00
Revert "(Config file) Don't save 'nul' entries in config file anymore -"
This reverts commit 4c6d46137c05e583de5d8978e95991f36344d86b.
This commit is contained in:
parent
4c6d46137c
commit
51bc64559b
@ -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);
|
||||
bind, false);
|
||||
}
|
||||
|
||||
ret = config_file_write(conf, autoconf_file, false);
|
||||
|
@ -53,10 +53,6 @@
|
||||
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)
|
||||
if (last_slash != NULL)
|
||||
{
|
||||
/* We handle paths like:
|
||||
* /path/to/file.7z#mygame.img
|
||||
|
@ -545,7 +545,8 @@ 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);
|
||||
const char *base, const struct retro_keybind *bind,
|
||||
bool save_empty);
|
||||
|
||||
void input_config_reset(void);
|
||||
|
||||
|
42
retroarch.c
42
retroarch.c
@ -17731,12 +17731,9 @@ 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);
|
||||
|
||||
if (!string_is_equal(btn, EXPLICIT_NULL))
|
||||
{
|
||||
config_set_string(conf, key, btn);
|
||||
input_config_save_keybind(conf, prefix, base, bind);
|
||||
}
|
||||
input_config_save_keybind(conf, prefix, base, bind, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -17778,7 +17775,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)
|
||||
const struct retro_keybind *bind, bool save_empty)
|
||||
{
|
||||
char key[64];
|
||||
|
||||
@ -17787,7 +17784,12 @@ static void save_keybind_joykey(config_file_t *conf,
|
||||
fill_pathname_join_delim_concat(key, prefix,
|
||||
base, '_', "_btn", sizeof(key));
|
||||
|
||||
if (GET_HAT_DIR(bind->joykey))
|
||||
if (bind->joykey == NO_BTN)
|
||||
{
|
||||
if (save_empty)
|
||||
config_set_string(conf, key, "nul");
|
||||
}
|
||||
else if (GET_HAT_DIR(bind->joykey))
|
||||
save_keybind_hat(conf, key, bind);
|
||||
else
|
||||
config_set_uint64(conf, key, bind->joykey);
|
||||
@ -17796,7 +17798,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)
|
||||
const struct retro_keybind *bind, bool save_empty)
|
||||
{
|
||||
char key[64];
|
||||
unsigned axis = 0;
|
||||
@ -17809,7 +17811,12 @@ static void save_keybind_axis(config_file_t *conf,
|
||||
"_axis",
|
||||
sizeof(key));
|
||||
|
||||
if (AXIS_NEG_GET(bind->joyaxis) != AXIS_DIR_NONE)
|
||||
if (bind->joyaxis == AXIS_NONE)
|
||||
{
|
||||
if (save_empty)
|
||||
config_set_string(conf, key, "nul");
|
||||
}
|
||||
else if (AXIS_NEG_GET(bind->joyaxis) != AXIS_DIR_NONE)
|
||||
{
|
||||
dir = '-';
|
||||
axis = AXIS_NEG_GET(bind->joyaxis);
|
||||
@ -17834,7 +17841,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)
|
||||
const struct retro_keybind *bind, bool save_empty)
|
||||
{
|
||||
char key[64];
|
||||
|
||||
@ -17873,6 +17880,8 @@ 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;
|
||||
}
|
||||
}
|
||||
@ -17888,17 +17897,14 @@ 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)
|
||||
const char *base, const struct retro_keybind *bind,
|
||||
bool save_empty)
|
||||
{
|
||||
config_file_t *conf = (config_file_t*)data;
|
||||
|
||||
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
/* MIDI */
|
||||
|
Loading…
x
Reference in New Issue
Block a user