mirror of
https://github.com/libretro/RetroArch
synced 2025-02-21 09:39:56 +00:00
(General) Cleanup
This commit is contained in:
parent
e514c30d0f
commit
c36e21ed13
113
configuration.c
113
configuration.c
@ -835,10 +835,11 @@ static void config_set_defaults(void)
|
|||||||
**/
|
**/
|
||||||
static config_file_t *open_default_config_file(void)
|
static config_file_t *open_default_config_file(void)
|
||||||
{
|
{
|
||||||
char conf_path[PATH_MAX_LENGTH], app_path[PATH_MAX_LENGTH];
|
char conf_path[PATH_MAX_LENGTH] = {0};
|
||||||
config_file_t *conf = NULL;
|
char app_path[PATH_MAX_LENGTH] = {0};
|
||||||
bool saved = false;
|
config_file_t *conf = NULL;
|
||||||
global_t *global = global_get_ptr();
|
bool saved = false;
|
||||||
|
global_t *global = global_get_ptr();
|
||||||
|
|
||||||
(void)conf_path;
|
(void)conf_path;
|
||||||
(void)app_path;
|
(void)app_path;
|
||||||
@ -961,9 +962,9 @@ static config_file_t *open_default_config_file(void)
|
|||||||
{
|
{
|
||||||
if (home || xdg)
|
if (home || xdg)
|
||||||
{
|
{
|
||||||
/* Try to create a new config file. */
|
char basedir[PATH_MAX_LENGTH] = {0};
|
||||||
|
|
||||||
char basedir[PATH_MAX_LENGTH];
|
/* Try to create a new config file. */
|
||||||
|
|
||||||
/* XDG_CONFIG_HOME falls back to $HOME/.config. */
|
/* XDG_CONFIG_HOME falls back to $HOME/.config. */
|
||||||
if (xdg)
|
if (xdg)
|
||||||
@ -982,7 +983,8 @@ static config_file_t *open_default_config_file(void)
|
|||||||
|
|
||||||
if (path_mkdir(basedir))
|
if (path_mkdir(basedir))
|
||||||
{
|
{
|
||||||
char skeleton_conf[PATH_MAX_LENGTH];
|
char skeleton_conf[PATH_MAX_LENGTH] = {0};
|
||||||
|
|
||||||
fill_pathname_join(skeleton_conf, GLOBAL_CONFIG_DIR,
|
fill_pathname_join(skeleton_conf, GLOBAL_CONFIG_DIR,
|
||||||
"retroarch.cfg", sizeof(skeleton_conf));
|
"retroarch.cfg", sizeof(skeleton_conf));
|
||||||
conf = config_file_new(skeleton_conf);
|
conf = config_file_new(skeleton_conf);
|
||||||
@ -1138,15 +1140,17 @@ static void config_file_dump_all(config_file_t *conf)
|
|||||||
static bool config_load_file(const char *path, bool set_defaults)
|
static bool config_load_file(const char *path, bool set_defaults)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
char *save, tmp_str[PATH_MAX_LENGTH];
|
char *save = NULL;
|
||||||
char tmp_append_path[PATH_MAX_LENGTH]; /* Don't destroy append_config_path. */
|
const char *extra_path = NULL;
|
||||||
const char *extra_path;
|
char tmp_str[PATH_MAX_LENGTH] = {0};
|
||||||
|
char tmp_append_path[PATH_MAX_LENGTH] = {0}; /* Don't destroy append_config_path. */
|
||||||
int vp_width = 0, vp_height = 0, vp_x = 0, vp_y = 0;
|
int vp_width = 0, vp_height = 0, vp_x = 0, vp_y = 0;
|
||||||
unsigned msg_color = 0;
|
unsigned msg_color = 0;
|
||||||
config_file_t *conf = NULL;
|
config_file_t *conf = NULL;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
video_viewport_t *custom_vp = (video_viewport_t*)video_viewport_get_custom();
|
video_viewport_t *custom_vp = (video_viewport_t*)
|
||||||
|
video_viewport_get_custom();
|
||||||
|
|
||||||
if (path)
|
if (path)
|
||||||
{
|
{
|
||||||
@ -1346,7 +1350,7 @@ static bool config_load_file(const char *path, bool set_defaults)
|
|||||||
|
|
||||||
for (i = 0; i < MAX_USERS; i++)
|
for (i = 0; i < MAX_USERS; i++)
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64] = {0};
|
||||||
snprintf(buf, sizeof(buf), "input_player%u_joypad_index", i + 1);
|
snprintf(buf, sizeof(buf), "input_player%u_joypad_index", i + 1);
|
||||||
CONFIG_GET_INT_BASE(conf, settings, input.joypad_map[i], buf);
|
CONFIG_GET_INT_BASE(conf, settings, input.joypad_map[i], buf);
|
||||||
|
|
||||||
@ -1686,12 +1690,12 @@ static void config_load_core_specific(void)
|
|||||||
|
|
||||||
if (settings->core_specific_config)
|
if (settings->core_specific_config)
|
||||||
{
|
{
|
||||||
|
char tmp[PATH_MAX_LENGTH] = {0};
|
||||||
|
|
||||||
/* Toggle has_save_path to false so it resets */
|
/* Toggle has_save_path to false so it resets */
|
||||||
global->has_set_save_path = false;
|
global->has_set_save_path = false;
|
||||||
global->has_set_state_path = false;
|
global->has_set_state_path = false;
|
||||||
|
|
||||||
char tmp[PATH_MAX_LENGTH];
|
|
||||||
strlcpy(tmp, settings->libretro, sizeof(tmp));
|
strlcpy(tmp, settings->libretro, sizeof(tmp));
|
||||||
RARCH_LOG("Loading core-specific config from: %s.\n",
|
RARCH_LOG("Loading core-specific config from: %s.\n",
|
||||||
global->core_specific_config_path);
|
global->core_specific_config_path);
|
||||||
@ -1706,9 +1710,9 @@ static void config_load_core_specific(void)
|
|||||||
/* This must be true for core specific configs. */
|
/* This must be true for core specific configs. */
|
||||||
settings->core_specific_config = true;
|
settings->core_specific_config = true;
|
||||||
|
|
||||||
/* Reset save paths */
|
/* Reset save paths */
|
||||||
global->has_set_save_path = true;
|
global->has_set_save_path = true;
|
||||||
global->has_set_state_path = true;
|
global->has_set_state_path = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1730,14 +1734,15 @@ static void config_load_core_specific(void)
|
|||||||
*/
|
*/
|
||||||
bool config_load_override(void)
|
bool config_load_override(void)
|
||||||
{
|
{
|
||||||
char config_directory[PATH_MAX_LENGTH], /* path to the directory containing retroarch.cfg (prefix) */
|
char config_directory[PATH_MAX_LENGTH] = {0}; /* path to the directory containing retroarch.cfg (prefix) */
|
||||||
core_path[PATH_MAX_LENGTH], /* final path for core-specific configuration (prefix+suffix) */
|
char core_path[PATH_MAX_LENGTH] = {0}; /* final path for core-specific configuration (prefix+suffix) */
|
||||||
game_path[PATH_MAX_LENGTH]; /* final path for game-specific configuration (prefix+suffix) */
|
char game_path[PATH_MAX_LENGTH] = {0}; /* final path for game-specific configuration (prefix+suffix) */
|
||||||
config_file_t *new_conf;
|
config_file_t *new_conf = NULL;
|
||||||
const char *core_name, *game_name; /* suffix */
|
const char *core_name = NULL;
|
||||||
bool should_append = false;
|
const char *game_name = NULL;
|
||||||
global_t *global = global_get_ptr();
|
bool should_append = false;
|
||||||
settings_t *settings = config_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
/* Early return in case a library isn't loaded */
|
/* Early return in case a library isn't loaded */
|
||||||
if (!global->system.info.library_name || !strcmp(global->system.info.library_name,"No Core"))
|
if (!global->system.info.library_name || !strcmp(global->system.info.library_name,"No Core"))
|
||||||
@ -1822,7 +1827,7 @@ bool config_load_override(void)
|
|||||||
/* Re-load the configuration with any overrides that might have been found */
|
/* Re-load the configuration with any overrides that might have been found */
|
||||||
if (should_append)
|
if (should_append)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX_LENGTH];
|
char buf[PATH_MAX_LENGTH] = {0};
|
||||||
|
|
||||||
if (settings->core_specific_config)
|
if (settings->core_specific_config)
|
||||||
{
|
{
|
||||||
@ -1912,13 +1917,14 @@ bool config_load_override(void)
|
|||||||
*/
|
*/
|
||||||
bool config_load_remap(void)
|
bool config_load_remap(void)
|
||||||
{
|
{
|
||||||
config_file_t *new_conf;
|
config_file_t *new_conf = NULL;
|
||||||
char remap_directory[PATH_MAX_LENGTH], /* path to the directory containing retroarch.cfg (prefix) */
|
const char *core_name = NULL;
|
||||||
core_path[PATH_MAX_LENGTH], /* final path for core-specific configuration (prefix+suffix) */
|
const char *game_name = NULL;
|
||||||
game_path[PATH_MAX_LENGTH]; /* final path for game-specific configuration (prefix+suffix) */
|
char remap_directory[PATH_MAX_LENGTH] = {0}; /* path to the directory containing retroarch.cfg (prefix) */
|
||||||
const char *core_name, *game_name; /* suffix */
|
char core_path[PATH_MAX_LENGTH] = {0}; /* final path for core-specific configuration (prefix+suffix) */
|
||||||
global_t *global = global_get_ptr(); /* global pointer */
|
char game_path[PATH_MAX_LENGTH] = {0}; /* final path for game-specific configuration (prefix+suffix) */
|
||||||
settings_t *settings = config_get_ptr(); /* config pointer */
|
global_t *global = global_get_ptr();
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
/* Early return in case a library isn't loaded or remapping is disabled */
|
/* Early return in case a library isn't loaded or remapping is disabled */
|
||||||
if (!global->system.info.library_name || !strcmp(global->system.info.library_name,"No Core"))
|
if (!global->system.info.library_name || !strcmp(global->system.info.library_name,"No Core"))
|
||||||
@ -2040,7 +2046,8 @@ static bool config_read_keybinds(const char *path)
|
|||||||
static void save_keybind_key(config_file_t *conf, const char *prefix,
|
static void save_keybind_key(config_file_t *conf, const char *prefix,
|
||||||
const char *base, const struct retro_keybind *bind)
|
const char *base, const struct retro_keybind *bind)
|
||||||
{
|
{
|
||||||
char key[64], btn[64];
|
char key[64] = {0};
|
||||||
|
char btn[64] = {0};
|
||||||
|
|
||||||
snprintf(key, sizeof(key), "%s_%s", prefix, base);
|
snprintf(key, sizeof(key), "%s_%s", prefix, base);
|
||||||
input_keymaps_translate_rk_to_str(bind->key, btn, sizeof(btn));
|
input_keymaps_translate_rk_to_str(bind->key, btn, sizeof(btn));
|
||||||
@ -2050,9 +2057,9 @@ static void save_keybind_key(config_file_t *conf, const char *prefix,
|
|||||||
static void save_keybind_hat(config_file_t *conf, const char *key,
|
static void save_keybind_hat(config_file_t *conf, const char *key,
|
||||||
const struct retro_keybind *bind)
|
const struct retro_keybind *bind)
|
||||||
{
|
{
|
||||||
char config[16];
|
char config[16] = {0};
|
||||||
unsigned hat = GET_HAT(bind->joykey);
|
unsigned hat = GET_HAT(bind->joykey);
|
||||||
const char *dir = NULL;
|
const char *dir = NULL;
|
||||||
|
|
||||||
switch (GET_HAT_DIR(bind->joykey))
|
switch (GET_HAT_DIR(bind->joykey))
|
||||||
{
|
{
|
||||||
@ -2083,7 +2090,8 @@ static void save_keybind_hat(config_file_t *conf, const char *key,
|
|||||||
static void save_keybind_joykey(config_file_t *conf, const char *prefix,
|
static void save_keybind_joykey(config_file_t *conf, const char *prefix,
|
||||||
const char *base, const struct retro_keybind *bind)
|
const char *base, const struct retro_keybind *bind)
|
||||||
{
|
{
|
||||||
char key[64];
|
char key[64] = {0};
|
||||||
|
|
||||||
snprintf(key, sizeof(key), "%s_%s_btn", prefix, base);
|
snprintf(key, sizeof(key), "%s_%s_btn", prefix, base);
|
||||||
|
|
||||||
if (bind->joykey == NO_BTN)
|
if (bind->joykey == NO_BTN)
|
||||||
@ -2097,9 +2105,10 @@ static void save_keybind_joykey(config_file_t *conf, const char *prefix,
|
|||||||
static void save_keybind_axis(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)
|
const char *base, const struct retro_keybind *bind)
|
||||||
{
|
{
|
||||||
char key[64], config[16];
|
char key[64] = {0};
|
||||||
unsigned axis = 0;
|
char config[16] = {0};
|
||||||
char dir = '\0';
|
unsigned axis = 0;
|
||||||
|
char dir = '\0';
|
||||||
|
|
||||||
snprintf(key, sizeof(key), "%s_%s_axis", prefix, base);
|
snprintf(key, sizeof(key), "%s_%s_axis", prefix, base);
|
||||||
|
|
||||||
@ -2207,8 +2216,8 @@ void config_load(void)
|
|||||||
**/
|
**/
|
||||||
bool config_save_keybinds_file(const char *path)
|
bool config_save_keybinds_file(const char *path)
|
||||||
{
|
{
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
config_file_t *conf = config_file_new(path);
|
config_file_t *conf = config_file_new(path);
|
||||||
|
|
||||||
if (!conf)
|
if (!conf)
|
||||||
@ -2237,8 +2246,8 @@ bool config_save_keybinds_file(const char *path)
|
|||||||
**/
|
**/
|
||||||
bool config_save_file(const char *path)
|
bool config_save_file(const char *path)
|
||||||
{
|
{
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
config_file_t *conf = config_file_new(path);
|
config_file_t *conf = config_file_new(path);
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
@ -2544,7 +2553,7 @@ bool config_save_file(const char *path)
|
|||||||
settings->input.keyboard_layout);
|
settings->input.keyboard_layout);
|
||||||
for (i = 0; i < MAX_USERS; i++)
|
for (i = 0; i < MAX_USERS; i++)
|
||||||
{
|
{
|
||||||
char cfg[64];
|
char cfg[64] = {0};
|
||||||
|
|
||||||
snprintf(cfg, sizeof(cfg), "input_device_p%u", i + 1);
|
snprintf(cfg, sizeof(cfg), "input_device_p%u", i + 1);
|
||||||
config_set_int(conf, cfg, settings->input.device[i]);
|
config_set_int(conf, cfg, settings->input.device[i]);
|
||||||
|
18
content.c
18
content.c
@ -94,8 +94,9 @@ static bool read_content_file(unsigned i, const char *path, void **buf,
|
|||||||
static void dump_to_file_desperate(const void *data,
|
static void dump_to_file_desperate(const void *data,
|
||||||
size_t size, unsigned type)
|
size_t size, unsigned type)
|
||||||
{
|
{
|
||||||
char path[PATH_MAX_LENGTH], timebuf[PATH_MAX_LENGTH];
|
|
||||||
time_t time_;
|
time_t time_;
|
||||||
|
char path[PATH_MAX_LENGTH] = {0};
|
||||||
|
char timebuf[PATH_MAX_LENGTH] = {0};
|
||||||
#if defined(_WIN32) && !defined(_XBOX)
|
#if defined(_WIN32) && !defined(_XBOX)
|
||||||
const char *base = getenv("APPDATA");
|
const char *base = getenv("APPDATA");
|
||||||
#elif defined(__CELLOS_LV2__) || defined(_XBOX)
|
#elif defined(__CELLOS_LV2__) || defined(_XBOX)
|
||||||
@ -142,8 +143,8 @@ struct sram_block
|
|||||||
**/
|
**/
|
||||||
bool save_state(const char *path)
|
bool save_state(const char *path)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
void *data = NULL;
|
void *data = NULL;
|
||||||
size_t size = pretro_serialize_size();
|
size_t size = pretro_serialize_size();
|
||||||
|
|
||||||
RARCH_LOG("Saving state: \"%s\".\n", path);
|
RARCH_LOG("Saving state: \"%s\".\n", path);
|
||||||
@ -356,12 +357,13 @@ static bool load_content_need_fullpath(
|
|||||||
bool need_fullpath, const char *path)
|
bool need_fullpath, const char *path)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_COMPRESSION
|
#ifdef HAVE_COMPRESSION
|
||||||
char new_path[PATH_MAX_LENGTH], new_basedir[PATH_MAX_LENGTH];
|
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
union string_list_elem_attr attributes;
|
union string_list_elem_attr attributes;
|
||||||
bool ret = false;
|
char new_path[PATH_MAX_LENGTH] = {0};
|
||||||
settings_t *settings = config_get_ptr();
|
char new_basedir[PATH_MAX_LENGTH] = {0};
|
||||||
global_t *global = global_get_ptr();
|
bool ret = false;
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
global_t *global = global_get_ptr();
|
||||||
|
|
||||||
if (global->system.info.block_extract)
|
if (global->system.info.block_extract)
|
||||||
return true;
|
return true;
|
||||||
@ -601,7 +603,7 @@ bool init_content_file(void)
|
|||||||
|
|
||||||
if (ext && !strcasecmp(ext, "zip"))
|
if (ext && !strcasecmp(ext, "zip"))
|
||||||
{
|
{
|
||||||
char temporary_content[PATH_MAX_LENGTH];
|
char temporary_content[PATH_MAX_LENGTH] = {0};
|
||||||
|
|
||||||
strlcpy(temporary_content, content->elems[i].data,
|
strlcpy(temporary_content, content->elems[i].data,
|
||||||
sizeof(temporary_content));
|
sizeof(temporary_content));
|
||||||
|
23
dynamic.c
23
dynamic.c
@ -390,7 +390,7 @@ static void load_symbols(bool is_dummy)
|
|||||||
void libretro_get_current_core_pathname(char *name, size_t size)
|
void libretro_get_current_core_pathname(char *name, size_t size)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
const char *id = NULL;
|
const char *id = NULL;
|
||||||
struct retro_system_info info = {0};
|
struct retro_system_info info = {0};
|
||||||
|
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
@ -596,18 +596,19 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||||||
core_option_free(global->system.core_options);
|
core_option_free(global->system.core_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct retro_variable *vars =
|
|
||||||
(const struct retro_variable*)data;
|
|
||||||
|
|
||||||
const char *options_path = settings->core_options_path;
|
|
||||||
char buf[PATH_MAX_LENGTH];
|
|
||||||
if (!*options_path && *global->config_path)
|
|
||||||
{
|
{
|
||||||
fill_pathname_resolve_relative(buf, global->config_path,
|
const struct retro_variable *vars = (const struct retro_variable*)data;
|
||||||
"retroarch-core-options.cfg", sizeof(buf));
|
char buf[PATH_MAX_LENGTH] = {0};
|
||||||
options_path = buf;
|
const char *options_path = settings->core_options_path;
|
||||||
|
|
||||||
|
if (!*options_path && *global->config_path)
|
||||||
|
{
|
||||||
|
fill_pathname_resolve_relative(buf, global->config_path,
|
||||||
|
"retroarch-core-options.cfg", sizeof(buf));
|
||||||
|
options_path = buf;
|
||||||
|
}
|
||||||
|
global->system.core_options = core_option_new(options_path, vars);
|
||||||
}
|
}
|
||||||
global->system.core_options = core_option_new(options_path, vars);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -153,13 +153,13 @@ error:
|
|||||||
int read_compressed_file(const char * path, void **buf,
|
int read_compressed_file(const char * path, void **buf,
|
||||||
const char* optional_filename, ssize_t *length)
|
const char* optional_filename, ssize_t *length)
|
||||||
{
|
{
|
||||||
const char* file_ext;
|
const char* file_ext = NULL;
|
||||||
char archive_path[PATH_MAX_LENGTH], *archive_found = NULL;
|
char *archive_found = NULL;
|
||||||
|
char archive_path[PATH_MAX_LENGTH] = {0};
|
||||||
|
|
||||||
if (optional_filename)
|
if (optional_filename)
|
||||||
{
|
{
|
||||||
/* Safety check.
|
/* Safety check. * If optional_filename and optional_filename
|
||||||
* If optional_filename and optional_filename
|
|
||||||
* exists, we simply return 0,
|
* exists, we simply return 0,
|
||||||
* hoping that optional_filename is the
|
* hoping that optional_filename is the
|
||||||
* same as requested.
|
* same as requested.
|
||||||
|
@ -96,7 +96,7 @@ void fill_pathname_expand_special(char *out_path,
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
size_t src_size;
|
size_t src_size;
|
||||||
char application_dir[PATH_MAX_LENGTH];
|
char application_dir[PATH_MAX_LENGTH] = {0};
|
||||||
|
|
||||||
fill_pathname_application_path(application_dir, sizeof(application_dir));
|
fill_pathname_application_path(application_dir, sizeof(application_dir));
|
||||||
path_basedir(application_dir);
|
path_basedir(application_dir);
|
||||||
@ -119,8 +119,8 @@ void fill_pathname_abbreviate_special(char *out_path,
|
|||||||
{
|
{
|
||||||
#if !defined(RARCH_CONSOLE)
|
#if !defined(RARCH_CONSOLE)
|
||||||
unsigned i;
|
unsigned i;
|
||||||
char application_dir[PATH_MAX_LENGTH];
|
char application_dir[PATH_MAX_LENGTH] = {0};
|
||||||
const char *home = getenv("HOME");
|
const char *home = getenv("HOME");
|
||||||
|
|
||||||
fill_pathname_application_path(application_dir, sizeof(application_dir));
|
fill_pathname_application_path(application_dir, sizeof(application_dir));
|
||||||
path_basedir(application_dir);
|
path_basedir(application_dir);
|
||||||
@ -199,7 +199,7 @@ void fill_pathname_application_path(char *buf, size_t size)
|
|||||||
#else
|
#else
|
||||||
*buf = '\0';
|
*buf = '\0';
|
||||||
pid_t pid = getpid();
|
pid_t pid = getpid();
|
||||||
char link_path[PATH_MAX_LENGTH];
|
char link_path[PATH_MAX_LENGTH] = {0};
|
||||||
/* Linux, BSD and Solaris paths. Not standardized. */
|
/* Linux, BSD and Solaris paths. Not standardized. */
|
||||||
static const char *exts[] = { "exe", "file", "path/a.out" };
|
static const char *exts[] = { "exe", "file", "path/a.out" };
|
||||||
for (i = 0; i < ARRAY_SIZE(exts); i++)
|
for (i = 0; i < ARRAY_SIZE(exts); i++)
|
||||||
|
16
netplay.c
16
netplay.c
@ -575,8 +575,8 @@ static void log_connection(const struct sockaddr_storage *their_addr,
|
|||||||
const struct sockaddr_in *v4;
|
const struct sockaddr_in *v4;
|
||||||
const struct sockaddr_in6 *v6;
|
const struct sockaddr_in6 *v6;
|
||||||
} u;
|
} u;
|
||||||
const char *str = NULL;
|
const char *str = NULL;
|
||||||
char buf_v4[INET_ADDRSTRLEN] = {0};
|
char buf_v4[INET_ADDRSTRLEN] = {0};
|
||||||
char buf_v6[INET6_ADDRSTRLEN] = {0};
|
char buf_v6[INET6_ADDRSTRLEN] = {0};
|
||||||
|
|
||||||
u.storage = their_addr;
|
u.storage = their_addr;
|
||||||
@ -610,7 +610,7 @@ static void log_connection(const struct sockaddr_storage *their_addr,
|
|||||||
|
|
||||||
if (str)
|
if (str)
|
||||||
{
|
{
|
||||||
char msg[512];
|
char msg[512] = {0};
|
||||||
snprintf(msg, sizeof(msg), "Got connection from: \"%s (%s)\" (#%u)",
|
snprintf(msg, sizeof(msg), "Got connection from: \"%s (%s)\" (#%u)",
|
||||||
nick, str, slot);
|
nick, str, slot);
|
||||||
rarch_main_msg_queue_push(msg, 1, 180, false);
|
rarch_main_msg_queue_push(msg, 1, 180, false);
|
||||||
@ -679,10 +679,10 @@ end:
|
|||||||
static bool init_tcp_socket(netplay_t *netplay, const char *server,
|
static bool init_tcp_socket(netplay_t *netplay, const char *server,
|
||||||
uint16_t port, bool spectate)
|
uint16_t port, bool spectate)
|
||||||
{
|
{
|
||||||
char port_buf[16];
|
char port_buf[16] = {0};
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
const struct addrinfo *tmp_info = NULL;
|
const struct addrinfo *tmp_info = NULL;
|
||||||
struct addrinfo hints, *res = NULL;
|
struct addrinfo hints, *res = NULL;
|
||||||
|
|
||||||
memset(&hints, 0, sizeof(hints));
|
memset(&hints, 0, sizeof(hints));
|
||||||
|
|
||||||
@ -734,8 +734,8 @@ static bool init_tcp_socket(netplay_t *netplay, const char *server,
|
|||||||
static bool init_udp_socket(netplay_t *netplay, const char *server,
|
static bool init_udp_socket(netplay_t *netplay, const char *server,
|
||||||
uint16_t port)
|
uint16_t port)
|
||||||
{
|
{
|
||||||
char port_buf[16];
|
char port_buf[16] = {0};
|
||||||
struct addrinfo hints;
|
struct addrinfo hints = {0};
|
||||||
|
|
||||||
memset(&hints, 0, sizeof(hints));
|
memset(&hints, 0, sizeof(hints));
|
||||||
#if defined(_WIN32) || defined(HAVE_SOCKET_LEGACY)
|
#if defined(_WIN32) || defined(HAVE_SOCKET_LEGACY)
|
||||||
|
@ -410,8 +410,9 @@ uint64_t rarch_get_cpu_features(void)
|
|||||||
const unsigned MAX_FEATURES = \
|
const unsigned MAX_FEATURES = \
|
||||||
sizeof(" MMX MMXEXT SSE SSE2 SSE3 SSSE3 SS4 SSE4.2 AES AVX AVX2 NEON VMX VMX128 VFPU PS");
|
sizeof(" MMX MMXEXT SSE SSE2 SSE3 SSSE3 SS4 SSE4.2 AES AVX AVX2 NEON VMX VMX128 VFPU PS");
|
||||||
char buf[MAX_FEATURES];
|
char buf[MAX_FEATURES];
|
||||||
memset(buf, 0, MAX_FEATURES);
|
|
||||||
|
|
||||||
|
memset(buf, 0, MAX_FEATURES);
|
||||||
|
|
||||||
(void)flags;
|
(void)flags;
|
||||||
|
|
||||||
#if defined(CPU_X86)
|
#if defined(CPU_X86)
|
||||||
|
@ -321,11 +321,11 @@ size_t content_playlist_size(content_playlist_t *playlist)
|
|||||||
static bool content_playlist_read_file(
|
static bool content_playlist_read_file(
|
||||||
content_playlist_t *playlist, const char *path)
|
content_playlist_t *playlist, const char *path)
|
||||||
{
|
{
|
||||||
char buf[PLAYLIST_ENTRIES][1024];
|
|
||||||
unsigned i;
|
unsigned i;
|
||||||
content_playlist_entry_t *entry = NULL;
|
char buf[PLAYLIST_ENTRIES][1024] = {0};
|
||||||
char *last = NULL;
|
content_playlist_entry_t *entry = NULL;
|
||||||
FILE *file = fopen(path, "r");
|
char *last = NULL;
|
||||||
|
FILE *file = fopen(path, "r");
|
||||||
|
|
||||||
/* If playlist file does not exist,
|
/* If playlist file does not exist,
|
||||||
* create an empty playlist instead.
|
* create an empty playlist instead.
|
||||||
|
22
retroarch.c
22
retroarch.c
@ -117,7 +117,7 @@ static void print_features(void)
|
|||||||
**/
|
**/
|
||||||
static void print_help(void)
|
static void print_help(void)
|
||||||
{
|
{
|
||||||
char str[PATH_MAX_LENGTH];
|
char str[PATH_MAX_LENGTH] = {0};
|
||||||
|
|
||||||
puts("===================================================================");
|
puts("===================================================================");
|
||||||
#ifdef HAVE_GIT_VERSION
|
#ifdef HAVE_GIT_VERSION
|
||||||
@ -840,8 +840,8 @@ static void rarch_init_savefile_paths(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char savefile_name_rtc[PATH_MAX_LENGTH];
|
|
||||||
union string_list_elem_attr attr;
|
union string_list_elem_attr attr;
|
||||||
|
char savefile_name_rtc[PATH_MAX_LENGTH] = {0};
|
||||||
|
|
||||||
attr.i = RETRO_MEMORY_SAVE_RAM;
|
attr.i = RETRO_MEMORY_SAVE_RAM;
|
||||||
string_list_append(global->savefiles, global->savefile_name, attr);
|
string_list_append(global->savefiles, global->savefile_name, attr);
|
||||||
@ -1333,11 +1333,11 @@ void rarch_main_deinit(void)
|
|||||||
**/
|
**/
|
||||||
void rarch_playlist_load_content(void *data, unsigned idx)
|
void rarch_playlist_load_content(void *data, unsigned idx)
|
||||||
{
|
{
|
||||||
const char *path = NULL;
|
const char *path = NULL;
|
||||||
const char *core_path = NULL;
|
const char *core_path = NULL;
|
||||||
content_playlist_t *playlist = (content_playlist_t*)data;
|
content_playlist_t *playlist = (content_playlist_t*)data;
|
||||||
menu_handle_t *menu = menu_driver_get_ptr();
|
menu_handle_t *menu = menu_driver_get_ptr();
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
if (!playlist)
|
if (!playlist)
|
||||||
return;
|
return;
|
||||||
@ -1375,11 +1375,11 @@ int rarch_defer_core(core_info_list_t *core_info, const char *dir,
|
|||||||
const char *path, const char *menu_label,
|
const char *path, const char *menu_label,
|
||||||
char *s, size_t len)
|
char *s, size_t len)
|
||||||
{
|
{
|
||||||
char new_core_path[PATH_MAX_LENGTH];
|
char new_core_path[PATH_MAX_LENGTH] = {0};
|
||||||
const core_info_t *info = NULL;
|
const core_info_t *info = NULL;
|
||||||
size_t supported = 0;
|
size_t supported = 0;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
|
|
||||||
fill_pathname_join(s, dir, path, len);
|
fill_pathname_join(s, dir, path, len);
|
||||||
|
|
||||||
|
12
runloop.c
12
runloop.c
@ -123,8 +123,8 @@ static void check_fast_forward_button(bool fastforward_pressed,
|
|||||||
**/
|
**/
|
||||||
static void check_stateslots(bool pressed_increase, bool pressed_decrease)
|
static void check_stateslots(bool pressed_increase, bool pressed_decrease)
|
||||||
{
|
{
|
||||||
char msg[PATH_MAX_LENGTH];
|
char msg[PATH_MAX_LENGTH] = {0};
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
/* Save state slots */
|
/* Save state slots */
|
||||||
if (pressed_increase)
|
if (pressed_increase)
|
||||||
@ -243,7 +243,8 @@ static void check_slowmotion(bool slowmotion_pressed)
|
|||||||
|
|
||||||
static bool check_movie_init(void)
|
static bool check_movie_init(void)
|
||||||
{
|
{
|
||||||
char path[PATH_MAX_LENGTH], msg[PATH_MAX_LENGTH];
|
char path[PATH_MAX_LENGTH] = {0};
|
||||||
|
char msg[PATH_MAX_LENGTH] = {0};
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
@ -353,8 +354,9 @@ static bool check_movie(void)
|
|||||||
**/
|
**/
|
||||||
static void check_shader_dir(bool pressed_next, bool pressed_prev)
|
static void check_shader_dir(bool pressed_next, bool pressed_prev)
|
||||||
{
|
{
|
||||||
char msg[PATH_MAX_LENGTH];
|
char msg[PATH_MAX_LENGTH] = {0};
|
||||||
const char *shader = NULL, *ext = NULL;
|
const char *shader = NULL;
|
||||||
|
const char *ext = NULL;
|
||||||
enum rarch_shader_type type = RARCH_SHADER_NONE;
|
enum rarch_shader_type type = RARCH_SHADER_NONE;
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
|
|
||||||
|
@ -326,9 +326,9 @@ void rarch_main_data_msg_queue_push(unsigned type,
|
|||||||
const char *msg, const char *msg2,
|
const char *msg, const char *msg2,
|
||||||
unsigned prio, unsigned duration, bool flush)
|
unsigned prio, unsigned duration, bool flush)
|
||||||
{
|
{
|
||||||
char new_msg[PATH_MAX_LENGTH];
|
char new_msg[PATH_MAX_LENGTH] = {0};
|
||||||
msg_queue_t *queue = NULL;
|
msg_queue_t *queue = NULL;
|
||||||
data_runloop_t *runloop = rarch_main_data_get_ptr();
|
data_runloop_t *runloop = rarch_main_data_get_ptr();
|
||||||
|
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
|
44
screenshot.c
44
screenshot.c
@ -177,13 +177,13 @@ end:
|
|||||||
|
|
||||||
static bool take_screenshot_viewport(void)
|
static bool take_screenshot_viewport(void)
|
||||||
{
|
{
|
||||||
char screenshot_path[PATH_MAX_LENGTH];
|
char screenshot_path[PATH_MAX_LENGTH] = {0};
|
||||||
const char *screenshot_dir = NULL;
|
const char *screenshot_dir = NULL;
|
||||||
uint8_t *buffer = NULL;
|
uint8_t *buffer = NULL;
|
||||||
bool retval = false;
|
bool retval = false;
|
||||||
struct video_viewport vp = {0};
|
struct video_viewport vp = {0};
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
|
|
||||||
video_driver_viewport_info(&vp);
|
video_driver_viewport_info(&vp);
|
||||||
|
|
||||||
@ -222,11 +222,11 @@ static bool take_screenshot_raw(void)
|
|||||||
{
|
{
|
||||||
unsigned width, height;
|
unsigned width, height;
|
||||||
size_t pitch;
|
size_t pitch;
|
||||||
char screenshot_path[PATH_MAX_LENGTH];
|
char screenshot_path[PATH_MAX_LENGTH] = {0};
|
||||||
global_t *global = global_get_ptr();
|
const void *data = NULL;
|
||||||
const void *data = NULL;
|
const char *screenshot_dir = NULL;
|
||||||
settings_t *settings = config_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
const char *screenshot_dir = NULL;
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
video_driver_cached_frame_get(data, &width, &height, &pitch);
|
video_driver_cached_frame_get(data, &width, &height, &pitch);
|
||||||
|
|
||||||
@ -254,9 +254,9 @@ static bool take_screenshot_raw(void)
|
|||||||
**/
|
**/
|
||||||
bool take_screenshot(void)
|
bool take_screenshot(void)
|
||||||
{
|
{
|
||||||
bool viewport_read = false;
|
bool viewport_read = false;
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
const char *msg = NULL;
|
const char *msg = NULL;
|
||||||
runloop_t *runloop = rarch_main_get_ptr();
|
runloop_t *runloop = rarch_main_get_ptr();
|
||||||
driver_t *driver = driver_get_ptr();
|
driver_t *driver = driver_get_ptr();
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
@ -343,13 +343,13 @@ bool take_screenshot(void)
|
|||||||
bool screenshot_dump(const char *folder, const void *frame,
|
bool screenshot_dump(const char *folder, const void *frame,
|
||||||
unsigned width, unsigned height, int pitch, bool bgr24)
|
unsigned width, unsigned height, int pitch, bool bgr24)
|
||||||
{
|
{
|
||||||
char filename[PATH_MAX_LENGTH];
|
char filename[PATH_MAX_LENGTH] = {0};
|
||||||
char shotname[PATH_MAX_LENGTH];
|
char shotname[PATH_MAX_LENGTH] = {0};
|
||||||
struct scaler_ctx scaler = {0};
|
struct scaler_ctx scaler = {0};
|
||||||
FILE *file = NULL;
|
FILE *file = NULL;
|
||||||
uint8_t *out_buffer = NULL;
|
uint8_t *out_buffer = NULL;
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
driver_t *driver = driver_get_ptr();
|
driver_t *driver = driver_get_ptr();
|
||||||
|
|
||||||
(void)file;
|
(void)file;
|
||||||
(void)out_buffer;
|
(void)out_buffer;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user