Create file_path_str FILE_PATH_NUL

This commit is contained in:
twinaphex 2016-06-28 11:10:30 +02:00
parent 5ba74302b2
commit fa7eb9d8c8
5 changed files with 12 additions and 8 deletions

View File

@ -2368,7 +2368,7 @@ static void save_keybind_joykey(config_file_t *conf, const char *prefix,
if (bind->joykey == NO_BTN) if (bind->joykey == NO_BTN)
{ {
if (save_empty) if (save_empty)
config_set_string(conf, key, "nul"); config_set_string(conf, key, file_path_str(FILE_PATH_NUL));
} }
else if (GET_HAT_DIR(bind->joykey)) else if (GET_HAT_DIR(bind->joykey))
save_keybind_hat(conf, key, bind); save_keybind_hat(conf, key, bind);
@ -2389,7 +2389,7 @@ static void save_keybind_axis(config_file_t *conf, const char *prefix,
if (bind->joyaxis == AXIS_NONE) if (bind->joyaxis == AXIS_NONE)
{ {
if (save_empty) if (save_empty)
config_set_string(conf, key, "nul"); config_set_string(conf, key, file_path_str(FILE_PATH_NUL));
} }
else if (AXIS_NEG_GET(bind->joyaxis) != AXIS_DIR_NONE) else if (AXIS_NEG_GET(bind->joyaxis) != AXIS_DIR_NONE)
{ {

View File

@ -26,6 +26,7 @@ enum file_path_enum
{ {
FILE_PATH_UNKNOWN = 0, FILE_PATH_UNKNOWN = 0,
FILE_PATH_PROGRAM_NAME, FILE_PATH_PROGRAM_NAME,
FILE_PATH_NUL,
FILE_PATH_LOG_WARN, FILE_PATH_LOG_WARN,
FILE_PATH_LOG_ERROR, FILE_PATH_LOG_ERROR,
FILE_PATH_LOG_INFO, FILE_PATH_LOG_INFO,

View File

@ -25,6 +25,8 @@ const char *file_path_str(enum file_path_enum enum_idx)
#else #else
return "RetroArch"; return "RetroArch";
#endif #endif
case FILE_PATH_NUL:
return "nul";
case FILE_PATH_LOG_WARN: case FILE_PATH_LOG_WARN:
return "[WARN]"; return "[WARN]";
case FILE_PATH_LOG_ERROR: case FILE_PATH_LOG_ERROR:

View File

@ -25,6 +25,7 @@
#include "input_keymaps.h" #include "input_keymaps.h"
#include "input_remapping.h" #include "input_remapping.h"
#include "../file_path_special.h"
#include "../general.h" #include "../general.h"
#include "../verbosity.h" #include "../verbosity.h"
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -300,7 +301,7 @@ void input_config_parse_joy_button(config_file_t *conf, const char *prefix,
if (config_get_array(conf, key, tmp, sizeof(tmp))) if (config_get_array(conf, key, tmp, sizeof(tmp)))
{ {
btn = tmp; btn = tmp;
if (string_is_equal(btn, "nul")) if (string_is_equal(btn, file_path_str(FILE_PATH_NUL)))
bind->joykey = NO_BTN; bind->joykey = NO_BTN;
else else
{ {
@ -336,7 +337,7 @@ void input_config_parse_joy_axis(config_file_t *conf, const char *prefix,
if (config_get_array(conf, key, tmp, sizeof(tmp))) if (config_get_array(conf, key, tmp, sizeof(tmp)))
{ {
if (string_is_equal(tmp, "nul")) if (string_is_equal(tmp, file_path_str(FILE_PATH_NUL)))
bind->joyaxis = AXIS_NONE; bind->joyaxis = AXIS_NONE;
else if (strlen(tmp) >= 2 && (*tmp == '+' || *tmp == '-')) else if (strlen(tmp) >= 2 && (*tmp == '+' || *tmp == '-'))
{ {
@ -365,7 +366,7 @@ static void input_config_get_bind_string_joykey(char *buf, const char *prefix,
if (GET_HAT_DIR(bind->joykey)) if (GET_HAT_DIR(bind->joykey))
{ {
const char *dir = NULL; const char *dir = "?";
switch (GET_HAT_DIR(bind->joykey)) switch (GET_HAT_DIR(bind->joykey))
{ {
@ -382,7 +383,6 @@ static void input_config_get_bind_string_joykey(char *buf, const char *prefix,
dir = "right"; dir = "right";
break; break;
default: default:
dir = "?";
break; break;
} }
@ -447,7 +447,7 @@ void input_config_get_bind_string(char *buf, const struct retro_keybind *bind,
#ifndef RARCH_CONSOLE #ifndef RARCH_CONSOLE
input_keymaps_translate_rk_to_str(bind->key, key, sizeof(key)); input_keymaps_translate_rk_to_str(bind->key, key, sizeof(key));
if (string_is_equal(key, "nul")) if (string_is_equal(key, file_path_str(FILE_PATH_NUL)))
*key = '\0'; *key = '\0';
snprintf(keybuf, sizeof(keybuf), "(Key: %s)", key); snprintf(keybuf, sizeof(keybuf), "(Key: %s)", key);

View File

@ -24,6 +24,7 @@
#include "tasks_internal.h" #include "tasks_internal.h"
#include "../file_path_special.h"
#include "../input/input_config.h" #include "../input/input_config.h"
#include "../input/input_overlay.h" #include "../input/input_overlay.h"
#include "../configuration.h" #include "../configuration.h"
@ -181,7 +182,7 @@ static bool task_overlay_load_desc(
for (; tmp; tmp = strtok_r(NULL, "|", &save)) for (; tmp; tmp = strtok_r(NULL, "|", &save))
{ {
if (!string_is_equal(tmp, "nul")) if (!string_is_equal(tmp, file_path_str(FILE_PATH_NUL)))
desc->key_mask |= UINT64_C(1) desc->key_mask |= UINT64_C(1)
<< input_config_translate_str_to_bind_id(tmp); << input_config_translate_str_to_bind_id(tmp);
} }