mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
* Cut down on strlcat calls when possible and replace them with clever
usage of strlcpy (when position/offset of previous strlcpy/snprintf call is known. strlcat implementation in libretro-common makes implicit strlen call, using strlcpy avoids this * Reduce a bunch of local char variables by use of said clever usage, should save up on local stack size usage
This commit is contained in:
parent
dbc1a41cf6
commit
631301b3f7
@ -193,37 +193,34 @@ bool cheat_manager_save(
|
||||
|
||||
for (i = 0; i < cheat_st->size; i++)
|
||||
{
|
||||
size_t _len;
|
||||
unsigned j;
|
||||
char endian_key[100];
|
||||
char key[256];
|
||||
char desc_key[128];
|
||||
char code_key[128];
|
||||
char enable_key[128];
|
||||
char formatted_number[12];
|
||||
char var_key[128];
|
||||
char key[256];
|
||||
|
||||
formatted_number[0] = '\0';
|
||||
snprintf(formatted_number, sizeof(formatted_number), "cheat%u_", i);
|
||||
|
||||
strlcpy(endian_key, formatted_number, sizeof(endian_key));
|
||||
strlcat(endian_key, "big_endian", sizeof(endian_key));
|
||||
strlcpy(desc_key, formatted_number, sizeof(desc_key));
|
||||
strlcat(desc_key, "desc", sizeof(desc_key));
|
||||
strlcpy(code_key, formatted_number, sizeof(code_key));
|
||||
strlcat(code_key, "code", sizeof(code_key));
|
||||
strlcpy(enable_key, formatted_number, sizeof(enable_key));
|
||||
strlcat(enable_key, "enable", sizeof(enable_key));
|
||||
_len = strlcpy(var_key, formatted_number, sizeof(var_key));
|
||||
|
||||
strlcpy(var_key + _len, "desc", sizeof(var_key) - _len);
|
||||
if (!string_is_empty(cheat_st->cheats[i].desc))
|
||||
config_set_string(conf, desc_key, cheat_st->cheats[i].desc);
|
||||
config_set_string(conf, var_key, cheat_st->cheats[i].desc);
|
||||
else
|
||||
config_set_string(conf, desc_key, cheat_st->cheats[i].code);
|
||||
config_set_string(conf, var_key, cheat_st->cheats[i].code);
|
||||
|
||||
config_set_string(conf, code_key, cheat_st->cheats[i].code);
|
||||
config_set_string(conf, enable_key,
|
||||
strlcpy(var_key + _len, "code", sizeof(var_key) - _len);
|
||||
config_set_string(conf, var_key, cheat_st->cheats[i].code);
|
||||
|
||||
strlcpy(var_key + _len, "enable", sizeof(var_key) - _len);
|
||||
config_set_string(conf, var_key,
|
||||
cheat_st->cheats[i].state
|
||||
? "true"
|
||||
: "false");
|
||||
config_set_string(conf, endian_key,
|
||||
|
||||
strlcpy(var_key + _len, "big_endian", sizeof(var_key) - _len);
|
||||
config_set_string(conf, var_key,
|
||||
cheat_st->cheats[i].big_endian
|
||||
? "true"
|
||||
: "false"
|
||||
|
14
command.c
14
command.c
@ -1257,6 +1257,7 @@ bool command_event_save_auto_state(
|
||||
bool savestate_auto_save,
|
||||
const enum rarch_core_type current_core_type)
|
||||
{
|
||||
size_t _len;
|
||||
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
||||
char savestate_name_auto[PATH_MAX_LENGTH];
|
||||
|
||||
@ -1271,12 +1272,12 @@ bool command_event_save_auto_state(
|
||||
if (string_is_empty(path_basename(path_get(RARCH_PATH_BASENAME))))
|
||||
return false;
|
||||
|
||||
strlcpy(savestate_name_auto,
|
||||
_len = strlcpy(savestate_name_auto,
|
||||
runloop_st->name.savestate,
|
||||
sizeof(savestate_name_auto));
|
||||
strlcat(savestate_name_auto,
|
||||
strlcpy(savestate_name_auto + _len,
|
||||
".auto",
|
||||
sizeof(savestate_name_auto));
|
||||
sizeof(savestate_name_auto) - _len);
|
||||
|
||||
if (content_save_state((const char*)savestate_name_auto, true, true))
|
||||
RARCH_LOG("%s \"%s\" %s.\n",
|
||||
@ -1367,6 +1368,7 @@ bool command_event_load_entry_state(settings_t *settings)
|
||||
|
||||
void command_event_load_auto_state(void)
|
||||
{
|
||||
size_t _len;
|
||||
char savestate_name_auto[PATH_MAX_LENGTH];
|
||||
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
||||
|
||||
@ -1382,12 +1384,12 @@ void command_event_load_auto_state(void)
|
||||
return;
|
||||
#endif
|
||||
|
||||
strlcpy(savestate_name_auto,
|
||||
_len = strlcpy(savestate_name_auto,
|
||||
runloop_st->name.savestate,
|
||||
sizeof(savestate_name_auto));
|
||||
strlcat(savestate_name_auto,
|
||||
strlcpy(savestate_name_auto + _len,
|
||||
".auto",
|
||||
sizeof(savestate_name_auto));
|
||||
sizeof(savestate_name_auto) - _len);
|
||||
|
||||
if (!path_is_valid(savestate_name_auto))
|
||||
return;
|
||||
|
@ -3648,21 +3648,20 @@ static bool config_load_file(global_t *global,
|
||||
size_t _len = strlcpy(prefix, "input_player", sizeof(prefix));
|
||||
for (i = 0; i < MAX_USERS; i++)
|
||||
{
|
||||
size_t _len2;
|
||||
char buf[64];
|
||||
buf[0] = '\0';
|
||||
snprintf(prefix + _len, sizeof(prefix) - _len, "%u", i + 1);
|
||||
|
||||
strlcpy(buf, prefix, sizeof(buf));
|
||||
strlcat(buf, "_analog_dpad_mode", sizeof(buf));
|
||||
CONFIG_GET_INT_BASE(conf, settings, uints.input_analog_dpad_mode[i], buf);
|
||||
_len2 = strlcpy(buf, prefix, sizeof(buf));
|
||||
|
||||
strlcpy(buf, prefix, sizeof(buf));
|
||||
strlcat(buf, "_joypad_index", sizeof(buf));
|
||||
strlcpy(buf + _len2, "_mouse_index", sizeof(buf) - _len2);
|
||||
CONFIG_GET_INT_BASE(conf, settings, uints.input_mouse_index[i], buf);
|
||||
|
||||
strlcpy(buf + _len2, "_joypad_index", sizeof(buf) - _len2);
|
||||
CONFIG_GET_INT_BASE(conf, settings, uints.input_joypad_index[i], buf);
|
||||
|
||||
strlcpy(buf, prefix, sizeof(buf));
|
||||
strlcat(buf, "_mouse_index", sizeof(buf));
|
||||
CONFIG_GET_INT_BASE(conf, settings, uints.input_mouse_index[i], buf);
|
||||
strlcpy(buf + _len2, "_analog_dpad_mode", sizeof(buf) - _len2);
|
||||
CONFIG_GET_INT_BASE(conf, settings, uints.input_analog_dpad_mode[i], buf);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4559,30 +4558,31 @@ static void video_driver_save_settings(global_t *global, config_file_t *conf)
|
||||
static void save_keybind_hat(config_file_t *conf, const char *key,
|
||||
const struct retro_keybind *bind)
|
||||
{
|
||||
size_t _len;
|
||||
char config[16];
|
||||
unsigned hat = (unsigned)GET_HAT(bind->joykey);
|
||||
|
||||
config[0] = 'h';
|
||||
config[1] = '\0';
|
||||
|
||||
snprintf(config + 1, sizeof(config) - 1, "%u", hat);
|
||||
_len = snprintf(config + 1, sizeof(config) - 1, "%u", hat);
|
||||
|
||||
switch (GET_HAT_DIR(bind->joykey))
|
||||
{
|
||||
case HAT_UP_MASK:
|
||||
strlcat(config, "up", sizeof(config));
|
||||
strlcpy(config + _len, "up", sizeof(config) - _len);
|
||||
break;
|
||||
|
||||
case HAT_DOWN_MASK:
|
||||
strlcat(config, "down", sizeof(config));
|
||||
strlcpy(config + _len, "down", sizeof(config) - _len);
|
||||
break;
|
||||
|
||||
case HAT_LEFT_MASK:
|
||||
strlcat(config, "left", sizeof(config));
|
||||
strlcpy(config, "left", sizeof(config) - _len);
|
||||
break;
|
||||
|
||||
case HAT_RIGHT_MASK:
|
||||
strlcat(config, "right", sizeof(config));
|
||||
strlcpy(config, "right", sizeof(config) - _len);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -5430,8 +5430,8 @@ int8_t config_save_overrides(enum override_type type, void *data, bool remove)
|
||||
if (settings->uints.input_device[i]
|
||||
!= overrides->uints.input_device[i])
|
||||
{
|
||||
strlcpy(cfg, "input_device_p", sizeof(cfg));
|
||||
strlcat(cfg, formatted_number, sizeof(cfg));
|
||||
size_t _len = strlcpy(cfg, "input_device_p", sizeof(cfg));
|
||||
strlcpy(cfg + _len, formatted_number, sizeof(cfg) - _len);
|
||||
config_set_int(conf, cfg, overrides->uints.input_device[i]);
|
||||
RARCH_DBG("[Overrides]: %s = \"%u\"\n", cfg, overrides->uints.input_device[i]);
|
||||
}
|
||||
@ -5652,8 +5652,8 @@ bool input_remapping_load_file(void *data, const char *path)
|
||||
char formatted_number[4];
|
||||
formatted_number[0] = '\0';
|
||||
snprintf(formatted_number, sizeof(formatted_number), "%u", i + 1);
|
||||
strlcpy(prefix, "input_player", sizeof(prefix));
|
||||
strlcat(prefix, formatted_number, sizeof(prefix));
|
||||
_len = strlcpy(prefix, "input_player", sizeof(prefix));
|
||||
strlcpy(prefix + _len, formatted_number, sizeof(prefix) - _len);
|
||||
_len = strlcpy(s1, prefix, sizeof(s1));
|
||||
s1[_len ] = '_';
|
||||
s1[_len+1] = 'b';
|
||||
@ -5734,16 +5734,16 @@ bool input_remapping_load_file(void *data, const char *path)
|
||||
}
|
||||
}
|
||||
|
||||
strlcpy(s1, prefix, sizeof(s1));
|
||||
strlcat(s1, "_analog_dpad_mode", sizeof(s1));
|
||||
_len = strlcpy(s1, prefix, sizeof(s1));
|
||||
strlcpy(s1 + _len, "_analog_dpad_mode", sizeof(s1) - _len);
|
||||
CONFIG_GET_INT_BASE(conf, settings, uints.input_analog_dpad_mode[i], s1);
|
||||
|
||||
strlcpy(s1, "input_libretro_device_p", sizeof(s1));
|
||||
strlcat(s1, formatted_number, sizeof(s1));
|
||||
_len = strlcpy(s1, "input_libretro_device_p", sizeof(s1));
|
||||
strlcpy(s1 + _len, formatted_number, sizeof(s1) - _len);
|
||||
CONFIG_GET_INT_BASE(conf, settings, uints.input_libretro_device[i], s1);
|
||||
|
||||
strlcpy(s1, "input_remap_port_p", sizeof(s1));
|
||||
strlcat(s1, formatted_number, sizeof(s1));
|
||||
_len = strlcpy(s1, "input_remap_port_p", sizeof(s1));
|
||||
strlcpy(s1 + _len, formatted_number, sizeof(s1) - _len);
|
||||
CONFIG_GET_INT_BASE(conf, settings, uints.input_remap_ports[i], s1);
|
||||
}
|
||||
|
||||
@ -5830,8 +5830,8 @@ bool input_remapping_save_file(const char *path)
|
||||
continue;
|
||||
|
||||
snprintf(formatted_number, sizeof(formatted_number), "%u", i + 1);
|
||||
strlcpy(prefix, "input_player", sizeof(prefix));
|
||||
strlcat(prefix, formatted_number, sizeof(prefix));
|
||||
_len = strlcpy(prefix, "input_player", sizeof(prefix));
|
||||
strlcpy(prefix + _len, formatted_number, sizeof(prefix) - _len);
|
||||
_len = strlcpy(s1, prefix, sizeof(s1));
|
||||
s1[_len ] = '_';
|
||||
s1[_len+1] = 'b';
|
||||
@ -5917,16 +5917,16 @@ bool input_remapping_save_file(const char *path)
|
||||
settings->uints.input_keymapper_ids[i][j]);
|
||||
}
|
||||
|
||||
strlcpy(s1, "input_libretro_device_p", sizeof(s1));
|
||||
strlcat(s1, formatted_number, sizeof(s1));
|
||||
_len = strlcpy(s1, "input_libretro_device_p", sizeof(s1));
|
||||
strlcpy(s1 + _len, formatted_number, sizeof(s1) - _len);
|
||||
config_set_int(conf, s1, input_config_get_device(i));
|
||||
|
||||
strlcpy(s1, prefix, sizeof(s1));
|
||||
strlcat(s1, "_analog_dpad_mode", sizeof(s1));
|
||||
_len = strlcpy(s1, prefix, sizeof(s1));
|
||||
strlcpy(s1 + _len, "_analog_dpad_mode", sizeof(s1) - _len);
|
||||
config_set_int(conf, s1, settings->uints.input_analog_dpad_mode[i]);
|
||||
|
||||
strlcpy(s1, "input_remap_port_p", sizeof(s1));
|
||||
strlcat(s1, formatted_number, sizeof(s1));
|
||||
_len = strlcpy(s1, "input_remap_port_p", sizeof(s1));
|
||||
strlcpy(s1 + _len, formatted_number, sizeof(s1) - _len);
|
||||
config_set_int(conf, s1, settings->uints.input_remap_ports[i]);
|
||||
}
|
||||
|
||||
|
36
core_info.c
36
core_info.c
@ -1340,7 +1340,7 @@ static void core_info_path_list_free(core_path_list_t *path_list)
|
||||
static core_path_list_t *core_info_path_list_new(const char *core_dir,
|
||||
const char *core_exts, bool show_hidden_files)
|
||||
{
|
||||
size_t i;
|
||||
size_t i, _len;
|
||||
char exts[32];
|
||||
core_path_list_t *path_list = NULL;
|
||||
struct string_list *core_ext_list = NULL;
|
||||
@ -1375,11 +1375,12 @@ static core_path_list_t *core_info_path_list_new(const char *core_dir,
|
||||
|
||||
/* Get list of file extensions to include
|
||||
* > core + lock */
|
||||
strlcpy(exts, core_exts, sizeof(exts));
|
||||
strlcat(exts, "|lck", sizeof(exts));
|
||||
_len = strlcpy(exts, core_exts, sizeof(exts));
|
||||
#if defined(HAVE_DYNAMIC)
|
||||
/* > 'standalone exempt' */
|
||||
strlcat(exts, "|lsae", sizeof(exts));
|
||||
strlcpy(exts + _len, "|lck|lsae", sizeof(exts) - _len);
|
||||
#else
|
||||
strlcpy(exts + _len, "|lck", sizeof(exts) - _len);
|
||||
#endif
|
||||
|
||||
/* Fetch core directory listing */
|
||||
@ -1617,21 +1618,21 @@ static void core_info_resolve_firmware(
|
||||
|
||||
for (i = 0; i < firmware_count; i++)
|
||||
{
|
||||
char path_key[64];
|
||||
char desc_key[64];
|
||||
char opt_key[64];
|
||||
size_t _len2;
|
||||
char key[64];
|
||||
struct config_entry_list *entry = NULL;
|
||||
bool tmp_bool = false;
|
||||
|
||||
snprintf(prefix + _len, sizeof(prefix) - _len, "%u_", i);
|
||||
strlcpy(path_key, prefix, sizeof(path_key));
|
||||
strlcat(path_key, "path", sizeof(path_key));
|
||||
strlcpy(desc_key, prefix, sizeof(desc_key));
|
||||
strlcat(desc_key, "desc", sizeof(desc_key));
|
||||
strlcpy(opt_key, prefix, sizeof(opt_key));
|
||||
strlcat(opt_key, "opt", sizeof(opt_key));
|
||||
_len2 = strlcpy(key, prefix, sizeof(key));
|
||||
strlcpy(key + _len2, "opt", sizeof(key) - _len2);
|
||||
|
||||
entry = config_get_entry(conf, path_key);
|
||||
if (config_get_bool(conf, key, &tmp_bool))
|
||||
firmware[i].optional = tmp_bool;
|
||||
|
||||
strlcpy(key + _len2, "path", sizeof(key) - _len2);
|
||||
|
||||
entry = config_get_entry(conf, key);
|
||||
|
||||
if (entry && !string_is_empty(entry->value))
|
||||
{
|
||||
@ -1639,16 +1640,15 @@ static void core_info_resolve_firmware(
|
||||
entry->value = NULL;
|
||||
}
|
||||
|
||||
entry = config_get_entry(conf, desc_key);
|
||||
strlcpy(key + _len2, "desc", sizeof(key) - _len2);
|
||||
|
||||
entry = config_get_entry(conf, key);
|
||||
|
||||
if (entry && !string_is_empty(entry->value))
|
||||
{
|
||||
firmware[i].desc = entry->value;
|
||||
entry->value = NULL;
|
||||
}
|
||||
|
||||
if (config_get_bool(conf, opt_key , &tmp_bool))
|
||||
firmware[i].optional = tmp_bool;
|
||||
}
|
||||
|
||||
info->firmware_count = firmware_count;
|
||||
|
@ -366,9 +366,9 @@ static void frontend_win32_get_os(char *s, size_t len, int *major, int *minor)
|
||||
case 2:
|
||||
if (server)
|
||||
{
|
||||
strlcpy(s, "Windows Server 2003", len);
|
||||
size_t _len = strlcpy(s, "Windows Server 2003", len);
|
||||
if (GetSystemMetrics(SM_SERVERR2))
|
||||
strlcat(s, " R2", len);
|
||||
strlcpy(s + _len, " R2", len - _len);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1351,24 +1351,22 @@ static bool d3d10_gfx_set_shader(void* data,
|
||||
{ "TEXCOORD", 1, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d10_vertex_t, texcoord),
|
||||
D3D10_INPUT_PER_VERTEX_DATA, 0 },
|
||||
};
|
||||
char vs_path[PATH_MAX_LENGTH];
|
||||
char ps_path[PATH_MAX_LENGTH];
|
||||
char _path[PATH_MAX_LENGTH];
|
||||
const char *slang_path = d3d10->shader_preset->pass[i].source.path;
|
||||
const char *vs_src = d3d10->shader_preset->pass[i].source.string.vertex;
|
||||
const char *ps_src = d3d10->shader_preset->pass[i].source.string.fragment;
|
||||
|
||||
strlcpy(vs_path, slang_path, sizeof(vs_path));
|
||||
strlcpy(ps_path, slang_path, sizeof(ps_path));
|
||||
strlcat(vs_path, ".vs.hlsl", sizeof(vs_path));
|
||||
strlcat(ps_path, ".ps.hlsl", sizeof(ps_path));
|
||||
size_t _len = strlcpy(_path, slang_path, sizeof(_path));
|
||||
strlcpy(_path + _len, ".vs.hlsl", sizeof(_path) - _len);
|
||||
|
||||
if (!d3d10_init_shader(
|
||||
d3d10->device, vs_src, 0, vs_path, "main",
|
||||
d3d10->device, vs_src, 0, _path, "main",
|
||||
NULL, NULL, desc, countof(desc),
|
||||
&d3d10->pass[i].shader)) { }
|
||||
|
||||
strlcpy(_path + _len, ".ps.hlsl", sizeof(_path) - _len);
|
||||
|
||||
if (!d3d10_init_shader(
|
||||
d3d10->device, ps_src, 0, ps_path, NULL, "main",
|
||||
d3d10->device, ps_src, 0, _path, NULL, "main",
|
||||
NULL, NULL, 0,
|
||||
&d3d10->pass[i].shader)) { }
|
||||
|
||||
|
@ -1550,25 +1550,23 @@ static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const
|
||||
{ "TEXCOORD", 1, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d11_vertex_t, texcoord),
|
||||
D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
};
|
||||
char vs_path[PATH_MAX_LENGTH];
|
||||
char ps_path[PATH_MAX_LENGTH];
|
||||
char _path[PATH_MAX_LENGTH];
|
||||
const char *slang_path = d3d11->shader_preset->pass[i].source.path;
|
||||
const char *vs_src = d3d11->shader_preset->pass[i].source.string.vertex;
|
||||
const char *ps_src = d3d11->shader_preset->pass[i].source.string.fragment;
|
||||
|
||||
strlcpy(vs_path, slang_path, sizeof(vs_path));
|
||||
strlcpy(ps_path, slang_path, sizeof(ps_path));
|
||||
strlcat(vs_path, ".vs.hlsl", sizeof(vs_path));
|
||||
strlcat(ps_path, ".ps.hlsl", sizeof(ps_path));
|
||||
size_t _len = strlcpy(_path, slang_path, sizeof(_path));
|
||||
strlcpy(_path + _len, ".vs.hlsl", sizeof(_path) - _len);
|
||||
|
||||
if (!d3d11_init_shader(
|
||||
d3d11->device, vs_src, 0, vs_path, "main", NULL, NULL, desc, countof(desc),
|
||||
d3d11->device, vs_src, 0, _path, "main", NULL, NULL, desc, countof(desc),
|
||||
&d3d11->pass[i].shader,
|
||||
feat_level_hint
|
||||
)) { }
|
||||
|
||||
strlcpy(_path + _len, ".ps.hlsl", sizeof(_path) - _len);
|
||||
|
||||
if (!d3d11_init_shader(
|
||||
d3d11->device, ps_src, 0, ps_path, NULL, "main", NULL, NULL, 0,
|
||||
d3d11->device, ps_src, 0, _path, NULL, "main", NULL, NULL, 0,
|
||||
&d3d11->pass[i].shader,
|
||||
feat_level_hint
|
||||
)) { }
|
||||
|
@ -1714,18 +1714,16 @@ static bool d3d12_gfx_set_shader(void* data, enum rarch_shader_type type, const
|
||||
{ "TEXCOORD", 1, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d12_vertex_t, texcoord),
|
||||
D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
|
||||
};
|
||||
char vs_path[PATH_MAX_LENGTH];
|
||||
char ps_path[PATH_MAX_LENGTH];
|
||||
char _path[PATH_MAX_LENGTH];
|
||||
const char *slang_path = d3d12->shader_preset->pass[i].source.path;
|
||||
const char *vs_src = d3d12->shader_preset->pass[i].source.string.vertex;
|
||||
const char *ps_src = d3d12->shader_preset->pass[i].source.string.fragment;
|
||||
strlcpy(vs_path, slang_path, sizeof(vs_path));
|
||||
strlcpy(ps_path, slang_path, sizeof(ps_path));
|
||||
strlcat(vs_path, ".vs.hlsl", sizeof(vs_path));
|
||||
strlcat(ps_path, ".ps.hlsl", sizeof(ps_path));
|
||||
size_t _len = strlcpy(_path, slang_path, sizeof(_path));
|
||||
strlcpy(_path + _len, ".vs.hlsl", sizeof(_path) - _len);
|
||||
if (!d3d_compile(vs_src, 0, _path, "main", "vs_5_0", &vs_code)){ }
|
||||
|
||||
if (!d3d_compile(vs_src, 0, vs_path, "main", "vs_5_0", &vs_code)){ }
|
||||
if (!d3d_compile(ps_src, 0, ps_path, "main", "ps_5_0", &ps_code)){ }
|
||||
strlcpy(_path + _len, ".ps.hlsl", sizeof(_path) - _len);
|
||||
if (!d3d_compile(ps_src, 0, _path, "main", "ps_5_0", &ps_code)){ }
|
||||
|
||||
desc.BlendState.RenderTarget[0].RenderTargetWriteMask = D3D12_COLOR_WRITE_ENABLE_ALL;
|
||||
if (i == d3d12->shader_preset->passes - 1)
|
||||
|
@ -373,15 +373,15 @@ bool slang_reflect(
|
||||
|
||||
/* Validate use of unexpected types. */
|
||||
if (
|
||||
!vertex.sampled_images.empty() ||
|
||||
!vertex.storage_buffers.empty() ||
|
||||
!vertex.subpass_inputs.empty() ||
|
||||
!vertex.storage_images.empty() ||
|
||||
!vertex.atomic_counters.empty() ||
|
||||
!fragment.storage_buffers.empty() ||
|
||||
!fragment.subpass_inputs.empty() ||
|
||||
!fragment.storage_images.empty() ||
|
||||
!fragment.atomic_counters.empty())
|
||||
!vertex.sampled_images.empty()
|
||||
|| !vertex.storage_buffers.empty()
|
||||
|| !vertex.subpass_inputs.empty()
|
||||
|| !vertex.storage_images.empty()
|
||||
|| !vertex.atomic_counters.empty()
|
||||
|| !fragment.storage_buffers.empty()
|
||||
|| !fragment.subpass_inputs.empty()
|
||||
|| !fragment.storage_images.empty()
|
||||
|| !fragment.atomic_counters.empty())
|
||||
{
|
||||
RARCH_ERR("[slang]: Invalid resource type detected.\n");
|
||||
return false;
|
||||
@ -687,8 +687,8 @@ bool slang_reflect(
|
||||
|
||||
{
|
||||
char buf[64];
|
||||
strlcpy(buf, "[slang]:\n", sizeof(buf));
|
||||
strlcat(buf, FILE_PATH_LOG_INFO, sizeof(buf));
|
||||
size_t _len = strlcpy(buf, "[slang]:\n", sizeof(buf));
|
||||
strlcpy(buf + _len, FILE_PATH_LOG_INFO, sizeof(buf) - _len);
|
||||
strlcat(buf, " [slang]: Parameters:\n", sizeof(buf));
|
||||
RARCH_LOG(buf);
|
||||
}
|
||||
|
@ -3427,25 +3427,27 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
|
||||
if ((video_st->frame_count % fps_update_interval) == 0)
|
||||
{
|
||||
size_t new_len;
|
||||
last_fps = TIME_TO_FPS(curr_time, new_time,
|
||||
fps_update_interval);
|
||||
|
||||
video_st->window_title_len = strlcpy(video_st->window_title,
|
||||
video_st->title_buf, sizeof(video_st->window_title));
|
||||
new_len = strlcpy(video_st->window_title, video_st->title_buf,
|
||||
sizeof(video_st->window_title));
|
||||
|
||||
if (!string_is_empty(status_text))
|
||||
{
|
||||
video_st->window_title[video_st->window_title_len ] = ' ';
|
||||
video_st->window_title[video_st->window_title_len+1] = '|';
|
||||
video_st->window_title[video_st->window_title_len+2] = '|';
|
||||
video_st->window_title[video_st->window_title_len+3] = ' ';
|
||||
video_st->window_title[video_st->window_title_len+4] = '\0';
|
||||
video_st->window_title_len = strlcat(video_st->window_title,
|
||||
video_st->window_title[new_len ] = ' ';
|
||||
video_st->window_title[new_len + 1] = '|';
|
||||
video_st->window_title[new_len + 2] = '|';
|
||||
video_st->window_title[new_len + 3] = ' ';
|
||||
video_st->window_title[new_len + 4] = '\0';
|
||||
new_len = strlcat(video_st->window_title,
|
||||
status_text, sizeof(video_st->window_title));
|
||||
}
|
||||
|
||||
curr_time = new_time;
|
||||
video_st->flags |= VIDEO_FLAG_WINDOW_TITLE_UPDATE;
|
||||
curr_time = new_time;
|
||||
video_st->window_title_len = new_len;
|
||||
video_st->flags |= VIDEO_FLAG_WINDOW_TITLE_UPDATE;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -3495,12 +3497,12 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
* message at the end */
|
||||
if (!string_is_empty(status_text))
|
||||
{
|
||||
status_text[buf_pos ] = ' ';
|
||||
status_text[buf_pos+1] = '|';
|
||||
status_text[buf_pos+2] = '|';
|
||||
status_text[buf_pos+3] = ' ';
|
||||
status_text[buf_pos+4] = '\0';
|
||||
buf_pos = strlcat(status_text,
|
||||
status_text[buf_pos ] = ' ';
|
||||
status_text[buf_pos + 1] = '|';
|
||||
status_text[buf_pos + 2] = '|';
|
||||
status_text[buf_pos + 3] = ' ';
|
||||
status_text[buf_pos + 4] = '\0';
|
||||
buf_pos = strlcat(status_text,
|
||||
runloop_st->core_status_msg.str,
|
||||
sizeof(status_text));
|
||||
}
|
||||
@ -3699,8 +3701,8 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
if (len)
|
||||
{
|
||||
/* TODO/FIXME - localize */
|
||||
strlcpy(latency_stats, "LATENCY\n", sizeof(latency_stats));
|
||||
strlcat(latency_stats, tmp, sizeof(latency_stats));
|
||||
size_t _len = strlcpy(latency_stats, "LATENCY\n", sizeof(latency_stats));
|
||||
strlcpy(latency_stats + _len, tmp, sizeof(latency_stats) - _len);
|
||||
}
|
||||
|
||||
/* TODO/FIXME - localize */
|
||||
|
@ -514,40 +514,29 @@ static enum gfx_wrap_type video_shader_wrap_str_to_mode(const char *wrap_mode)
|
||||
static bool video_shader_parse_pass(config_file_t *conf,
|
||||
struct video_shader_pass *pass, unsigned i)
|
||||
{
|
||||
char shader_name[64];
|
||||
char filter_name_buf[64];
|
||||
char wrap_name_buf[64];
|
||||
char frame_count_mod_buf[64];
|
||||
char srgb_output_buf[64];
|
||||
char fp_fbo_buf[64];
|
||||
char mipmap_buf[64];
|
||||
char alias_buf[64];
|
||||
char scale_name_buf[64];
|
||||
char attr_name_buf[64];
|
||||
size_t _len;
|
||||
char shader_var[64];
|
||||
char scale_type[64];
|
||||
char scale_type_x[64];
|
||||
char scale_type_y[64];
|
||||
char formatted_num[12];
|
||||
char tmp_path[PATH_MAX_LENGTH];
|
||||
struct gfx_fbo_scale *scale = NULL;
|
||||
bool tmp_bool = false;
|
||||
struct config_entry_list *entry = NULL;
|
||||
struct gfx_fbo_scale *scale = NULL;
|
||||
bool tmp_bool = false;
|
||||
struct config_entry_list *entry = NULL;
|
||||
|
||||
fp_fbo_buf[0] = mipmap_buf[0] = alias_buf[0] =
|
||||
scale_name_buf[0] = attr_name_buf[0] = scale_type[0] =
|
||||
scale_type_x[0] = scale_type_y[0] =
|
||||
shader_name[0] = filter_name_buf[0] = wrap_name_buf[0] =
|
||||
frame_count_mod_buf[0] = srgb_output_buf[0] = '\0';
|
||||
formatted_num[0] = '\0';
|
||||
scale_type[0] = scale_type_x[0] =
|
||||
scale_type_y[0] = '\0';
|
||||
formatted_num[0] = shader_var[0] = '\0';
|
||||
|
||||
snprintf(formatted_num, sizeof(formatted_num), "%u", i);
|
||||
|
||||
/* Source */
|
||||
strlcpy(shader_name, "shader", sizeof(shader_name));
|
||||
strlcat(shader_name, formatted_num, sizeof(shader_name));
|
||||
if (!config_get_path(conf, shader_name, tmp_path, sizeof(tmp_path)))
|
||||
_len = strlcpy(shader_var, "shader", sizeof(shader_var));
|
||||
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
|
||||
if (!config_get_path(conf, shader_var, tmp_path, sizeof(tmp_path)))
|
||||
{
|
||||
RARCH_ERR("[Shaders]: Couldn't parse shader source \"%s\".\n", shader_name);
|
||||
RARCH_ERR("[Shaders]: Couldn't parse shader source \"%s\".\n", shader_var);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -556,10 +545,10 @@ static bool video_shader_parse_pass(config_file_t *conf,
|
||||
video_shader_replace_wildcards(pass->source.path, PATH_MAX_LENGTH, conf->path);
|
||||
|
||||
/* Smooth */
|
||||
strlcpy(filter_name_buf, "filter_linear", sizeof(filter_name_buf));
|
||||
strlcat(filter_name_buf, formatted_num, sizeof(filter_name_buf));
|
||||
_len = strlcpy(shader_var, "filter_linear", sizeof(shader_var));
|
||||
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
|
||||
|
||||
if (config_get_bool(conf, filter_name_buf, &tmp_bool))
|
||||
if (config_get_bool(conf, shader_var, &tmp_bool))
|
||||
{
|
||||
bool smooth = tmp_bool;
|
||||
pass->filter = smooth ? RARCH_FILTER_LINEAR : RARCH_FILTER_NEAREST;
|
||||
@ -568,25 +557,25 @@ static bool video_shader_parse_pass(config_file_t *conf,
|
||||
pass->filter = RARCH_FILTER_UNSPEC;
|
||||
|
||||
/* Wrapping mode */
|
||||
strlcpy(wrap_name_buf, "wrap_mode", sizeof(wrap_name_buf));
|
||||
strlcat(wrap_name_buf, formatted_num, sizeof(wrap_name_buf));
|
||||
if ((entry = config_get_entry(conf, wrap_name_buf))
|
||||
_len = strlcpy(shader_var, "wrap_mode", sizeof(shader_var));
|
||||
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
|
||||
if ((entry = config_get_entry(conf, shader_var))
|
||||
&& !string_is_empty(entry->value))
|
||||
pass->wrap = video_shader_wrap_str_to_mode(entry->value);
|
||||
entry = NULL;
|
||||
|
||||
/* Frame count mod */
|
||||
strlcpy(frame_count_mod_buf, "frame_count_mod", sizeof(frame_count_mod_buf));
|
||||
strlcat(frame_count_mod_buf, formatted_num, sizeof(frame_count_mod_buf));
|
||||
if ((entry = config_get_entry(conf, frame_count_mod_buf))
|
||||
_len = strlcpy(shader_var, "frame_count_mod", sizeof(shader_var));
|
||||
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
|
||||
if ((entry = config_get_entry(conf, shader_var))
|
||||
&& !string_is_empty(entry->value))
|
||||
pass->frame_count_mod = (unsigned)strtoul(entry->value, NULL, 0);
|
||||
entry = NULL;
|
||||
|
||||
/* FBO types and mipmapping */
|
||||
strlcpy(srgb_output_buf, "srgb_framebuffer", sizeof(srgb_output_buf));
|
||||
strlcat(srgb_output_buf, formatted_num, sizeof(srgb_output_buf));
|
||||
if (config_get_bool(conf, srgb_output_buf, &tmp_bool))
|
||||
_len = strlcpy(shader_var, "srgb_framebuffer", sizeof(shader_var));
|
||||
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
|
||||
if (config_get_bool(conf, shader_var, &tmp_bool))
|
||||
{
|
||||
if (tmp_bool)
|
||||
pass->fbo.flags |= FBO_SCALE_FLAG_SRGB_FBO;
|
||||
@ -594,9 +583,9 @@ static bool video_shader_parse_pass(config_file_t *conf,
|
||||
pass->fbo.flags &= ~FBO_SCALE_FLAG_SRGB_FBO;
|
||||
}
|
||||
|
||||
strlcpy(fp_fbo_buf, "float_framebuffer", sizeof(fp_fbo_buf));
|
||||
strlcat(fp_fbo_buf, formatted_num, sizeof(fp_fbo_buf));
|
||||
if (config_get_bool(conf, fp_fbo_buf, &tmp_bool))
|
||||
_len = strlcpy(shader_var, "float_framebuffer", sizeof(shader_var));
|
||||
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
|
||||
if (config_get_bool(conf, shader_var, &tmp_bool))
|
||||
{
|
||||
if (tmp_bool)
|
||||
pass->fbo.flags |= FBO_SCALE_FLAG_FP_FBO;
|
||||
@ -604,29 +593,29 @@ static bool video_shader_parse_pass(config_file_t *conf,
|
||||
pass->fbo.flags &= ~FBO_SCALE_FLAG_FP_FBO;
|
||||
}
|
||||
|
||||
strlcpy(mipmap_buf, "mipmap_input", sizeof(mipmap_buf));
|
||||
strlcat(mipmap_buf, formatted_num, sizeof(mipmap_buf));
|
||||
if (config_get_bool(conf, mipmap_buf, &tmp_bool))
|
||||
_len = strlcpy(shader_var, "mipmap_input", sizeof(shader_var));
|
||||
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
|
||||
if (config_get_bool(conf, shader_var, &tmp_bool))
|
||||
pass->mipmap = tmp_bool;
|
||||
|
||||
strlcpy(alias_buf, "alias", sizeof(alias_buf));
|
||||
strlcat(alias_buf, formatted_num, sizeof(alias_buf));
|
||||
if (!config_get_array(conf, alias_buf, pass->alias, sizeof(pass->alias)))
|
||||
_len = strlcpy(shader_var, "alias", sizeof(shader_var));
|
||||
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
|
||||
if (!config_get_array(conf, shader_var, pass->alias, sizeof(pass->alias)))
|
||||
*pass->alias = '\0';
|
||||
|
||||
/* Scale */
|
||||
scale = &pass->fbo;
|
||||
strlcpy(scale_name_buf, "scale_type", sizeof(scale_name_buf));
|
||||
strlcat(scale_name_buf, formatted_num, sizeof(scale_name_buf));
|
||||
config_get_array(conf, scale_name_buf, scale_type, sizeof(scale_type));
|
||||
_len = strlcpy(shader_var, "scale_type", sizeof(shader_var));
|
||||
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
|
||||
config_get_array(conf, shader_var, scale_type, sizeof(scale_type));
|
||||
|
||||
strlcpy(scale_name_buf, "scale_type_x", sizeof(scale_name_buf));
|
||||
strlcat(scale_name_buf, formatted_num, sizeof(scale_name_buf));
|
||||
config_get_array(conf, scale_name_buf, scale_type_x, sizeof(scale_type_x));
|
||||
_len = strlcpy(shader_var, "scale_type_x", sizeof(shader_var));
|
||||
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
|
||||
config_get_array(conf, shader_var, scale_type_x, sizeof(scale_type_x));
|
||||
|
||||
strlcpy(scale_name_buf, "scale_type_y", sizeof(scale_name_buf));
|
||||
strlcat(scale_name_buf, formatted_num, sizeof(scale_name_buf));
|
||||
config_get_array(conf, scale_name_buf, scale_type_y, sizeof(scale_type_y));
|
||||
_len = strlcpy(shader_var, "scale_type_y", sizeof(shader_var));
|
||||
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
|
||||
config_get_array(conf, shader_var, scale_type_y, sizeof(scale_type_y));
|
||||
|
||||
if (*scale_type)
|
||||
{
|
||||
@ -672,62 +661,62 @@ static bool video_shader_parse_pass(config_file_t *conf,
|
||||
}
|
||||
}
|
||||
|
||||
strlcpy(attr_name_buf, "scale", sizeof(attr_name_buf));
|
||||
strlcat(attr_name_buf, formatted_num, sizeof(attr_name_buf));
|
||||
_len = strlcpy(shader_var, "scale", sizeof(shader_var));
|
||||
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
|
||||
|
||||
if (scale->type_x == RARCH_SCALE_ABSOLUTE)
|
||||
{
|
||||
int iattr = 0;
|
||||
if (config_get_int(conf, attr_name_buf, &iattr))
|
||||
if (config_get_int(conf, shader_var, &iattr))
|
||||
scale->abs_x = iattr;
|
||||
else
|
||||
{
|
||||
strlcpy(attr_name_buf, "scale_x", sizeof(attr_name_buf));
|
||||
strlcat(attr_name_buf, formatted_num, sizeof(attr_name_buf));
|
||||
if (config_get_int(conf, attr_name_buf, &iattr))
|
||||
_len = strlcpy(shader_var, "scale_x", sizeof(shader_var));
|
||||
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
|
||||
if (config_get_int(conf, shader_var, &iattr))
|
||||
scale->abs_x = iattr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float fattr = 0.0f;
|
||||
if (config_get_float(conf, attr_name_buf, &fattr))
|
||||
if (config_get_float(conf, shader_var, &fattr))
|
||||
scale->scale_x = fattr;
|
||||
else
|
||||
{
|
||||
strlcpy(attr_name_buf, "scale_x", sizeof(attr_name_buf));
|
||||
strlcat(attr_name_buf, formatted_num, sizeof(attr_name_buf));
|
||||
if (config_get_float(conf, attr_name_buf, &fattr))
|
||||
_len = strlcpy(shader_var, "scale_x", sizeof(shader_var));
|
||||
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
|
||||
if (config_get_float(conf, shader_var, &fattr))
|
||||
scale->scale_x = fattr;
|
||||
}
|
||||
}
|
||||
|
||||
strlcpy(attr_name_buf, "scale", sizeof(attr_name_buf));
|
||||
strlcat(attr_name_buf, formatted_num, sizeof(attr_name_buf));
|
||||
_len = strlcpy(shader_var, "scale", sizeof(shader_var));
|
||||
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
|
||||
|
||||
if (scale->type_y == RARCH_SCALE_ABSOLUTE)
|
||||
{
|
||||
int iattr = 0;
|
||||
if (config_get_int(conf, attr_name_buf, &iattr))
|
||||
if (config_get_int(conf, shader_var, &iattr))
|
||||
scale->abs_y = iattr;
|
||||
else
|
||||
{
|
||||
strlcpy(attr_name_buf, "scale_y", sizeof(attr_name_buf));
|
||||
strlcat(attr_name_buf, formatted_num, sizeof(attr_name_buf));
|
||||
if (config_get_int(conf, attr_name_buf, &iattr))
|
||||
_len = strlcpy(shader_var, "scale_y", sizeof(shader_var));
|
||||
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
|
||||
if (config_get_int(conf, shader_var, &iattr))
|
||||
scale->abs_y = iattr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float fattr = 0.0f;
|
||||
if (config_get_float(conf, attr_name_buf, &fattr))
|
||||
if (config_get_float(conf, shader_var, &fattr))
|
||||
scale->scale_y = fattr;
|
||||
else
|
||||
{
|
||||
strlcpy(attr_name_buf, "scale_y", sizeof(attr_name_buf));
|
||||
strlcat(attr_name_buf, formatted_num, sizeof(attr_name_buf));
|
||||
if (config_get_float(conf, attr_name_buf, &fattr))
|
||||
_len = strlcpy(shader_var, "scale_y", sizeof(shader_var));
|
||||
strlcpy(shader_var, formatted_num, sizeof(shader_var) - _len);
|
||||
if (config_get_float(conf, shader_var, &fattr))
|
||||
scale->scale_y = fattr;
|
||||
}
|
||||
}
|
||||
@ -771,18 +760,16 @@ static bool video_shader_parse_textures(config_file_t *conf,
|
||||
id && shader->luts < GFX_MAX_TEXTURES;
|
||||
shader->luts++, id = strtok_r(NULL, ";", &save))
|
||||
{
|
||||
char id_filter[64];
|
||||
char id_wrap[64];
|
||||
char id_mipmap[64];
|
||||
bool mipmap = false;
|
||||
bool smooth = false;
|
||||
struct config_entry_list
|
||||
*entry = NULL;
|
||||
size_t _len;
|
||||
char idx[64];
|
||||
bool mipmap = false;
|
||||
bool smooth = false;
|
||||
struct config_entry_list *entry = NULL;
|
||||
|
||||
id_filter[0] = id_wrap[0] = id_mipmap[0] = '\0';
|
||||
idx[0] = '\0';
|
||||
|
||||
if (!(entry = config_get_entry(conf, id)) ||
|
||||
string_is_empty(entry->value))
|
||||
if (!(entry = config_get_entry(conf, id))
|
||||
|| string_is_empty(entry->value))
|
||||
{
|
||||
RARCH_ERR("[Shaders]: Cannot find path to texture \"%s\"..\n",
|
||||
id);
|
||||
@ -796,33 +783,32 @@ static bool video_shader_parse_textures(config_file_t *conf,
|
||||
fill_pathname_expanded_and_absolute(shader->lut[shader->luts].path, conf->path, texture_path);
|
||||
video_shader_replace_wildcards(shader->lut[shader->luts].path, PATH_MAX_LENGTH, conf->path);
|
||||
|
||||
entry = NULL;
|
||||
|
||||
strlcpy(shader->lut[shader->luts].id, id,
|
||||
sizeof(shader->lut[shader->luts].id));
|
||||
|
||||
strlcpy(id_filter, id, sizeof(id_filter));
|
||||
strlcat(id_filter, "_linear", sizeof(id_filter));
|
||||
if (config_get_bool(conf, id_filter, &smooth))
|
||||
_len = strlcpy(idx, id, sizeof(idx));
|
||||
|
||||
strlcpy(idx + _len, "_linear", sizeof(idx) - _len);
|
||||
if (config_get_bool(conf, idx, &smooth))
|
||||
shader->lut[shader->luts].filter = smooth
|
||||
? RARCH_FILTER_LINEAR
|
||||
: RARCH_FILTER_NEAREST;
|
||||
else
|
||||
shader->lut[shader->luts].filter = RARCH_FILTER_UNSPEC;
|
||||
|
||||
strlcpy(id_wrap, id, sizeof(id_wrap));
|
||||
strlcat(id_wrap, "_wrap_mode", sizeof(id_wrap));
|
||||
if ((entry = config_get_entry(conf, id_wrap))
|
||||
strlcpy(idx + _len, "_mipmap", sizeof(idx) - _len);
|
||||
if (config_get_bool(conf, idx, &mipmap))
|
||||
shader->lut[shader->luts].mipmap = mipmap;
|
||||
else
|
||||
shader->lut[shader->luts].mipmap = false;
|
||||
|
||||
strlcpy(idx + _len, "_wrap_mode", sizeof(idx) - _len);
|
||||
entry = NULL;
|
||||
if ((entry = config_get_entry(conf, idx))
|
||||
&& !string_is_empty(entry->value))
|
||||
shader->lut[shader->luts].wrap = video_shader_wrap_str_to_mode(entry->value);
|
||||
entry = NULL;
|
||||
|
||||
strlcpy(id_mipmap, id, sizeof(id_mipmap));
|
||||
strlcat(id_mipmap, "_mipmap", sizeof(id_mipmap));
|
||||
if (config_get_bool(conf, id_mipmap, &mipmap))
|
||||
shader->lut[shader->luts].mipmap = mipmap;
|
||||
else
|
||||
shader->lut[shader->luts].mipmap = false;
|
||||
}
|
||||
|
||||
free(textures);
|
||||
@ -1045,15 +1031,15 @@ static void video_shader_write_scale_dim(config_file_t *conf,
|
||||
{
|
||||
char key[64];
|
||||
char dim_str[64];
|
||||
strlcpy(dim_str, dim, sizeof(dim_str));
|
||||
strlcat(dim_str, formatted_num, sizeof(dim_str));
|
||||
size_t _len = strlcpy(dim_str, dim, sizeof(dim_str));
|
||||
strlcpy(dim_str + _len, formatted_num, sizeof(dim_str) - _len);
|
||||
|
||||
strlcpy(key, "scale_type_", sizeof(key));
|
||||
strlcat(key, dim_str, sizeof(key));
|
||||
_len = strlcpy(key, "scale_type_", sizeof(key));
|
||||
strlcpy(key + _len, dim_str, sizeof(key) - _len);
|
||||
config_set_string(conf, key, video_shader_scale_type_to_str(type));
|
||||
|
||||
strlcpy(key, "scale_", sizeof(key));
|
||||
strlcat(key, dim_str, sizeof(key));
|
||||
_len = strlcpy(key, "scale_", sizeof(key));
|
||||
strlcpy(key + _len, dim_str, sizeof(key) - _len);
|
||||
if (type == RARCH_SCALE_ABSOLUTE)
|
||||
config_set_int(conf, key, absolute);
|
||||
else
|
||||
@ -1065,18 +1051,18 @@ static void video_shader_write_fbo(config_file_t *conf,
|
||||
const struct gfx_fbo_scale *fbo)
|
||||
{
|
||||
char key[64];
|
||||
strlcpy(key, "float_framebuffer", sizeof(key));
|
||||
strlcat(key, formatted_num, sizeof(key));
|
||||
size_t _len = strlcpy(key, "float_framebuffer", sizeof(key));
|
||||
strlcpy(key + _len, formatted_num, sizeof(key) - _len);
|
||||
config_set_string(conf, key, (fbo->flags & FBO_SCALE_FLAG_FP_FBO) ? "true" : "false");
|
||||
strlcpy(key, "srgb_framebuffer", sizeof(key));
|
||||
strlcat(key, formatted_num, sizeof(key));
|
||||
_len = strlcpy(key, "srgb_framebuffer", sizeof(key));
|
||||
strlcpy(key + _len, formatted_num, sizeof(key) - _len);
|
||||
config_set_string(conf, key, (fbo->flags & FBO_SCALE_FLAG_SRGB_FBO) ? "true" : "false");
|
||||
|
||||
if (!(fbo->flags & FBO_SCALE_FLAG_VALID))
|
||||
return;
|
||||
|
||||
video_shader_write_scale_dim(conf, "x", formatted_num, fbo->type_x, fbo->scale_x, fbo->abs_x);
|
||||
video_shader_write_scale_dim(conf, "y", formatted_num, fbo->type_y, fbo->scale_y, fbo->abs_y);
|
||||
if (fbo->flags & FBO_SCALE_FLAG_VALID)
|
||||
{
|
||||
video_shader_write_scale_dim(conf, "x", formatted_num, fbo->type_x, fbo->scale_x, fbo->abs_x);
|
||||
video_shader_write_scale_dim(conf, "y", formatted_num, fbo->type_y, fbo->scale_y, fbo->abs_y);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1123,6 +1109,7 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
|
||||
|
||||
for (i = 0; i < shader->passes; i++)
|
||||
{
|
||||
size_t _len;
|
||||
char formatted_num[8];
|
||||
const struct video_shader_pass *pass = &shader->pass[i];
|
||||
|
||||
@ -1130,8 +1117,8 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
|
||||
|
||||
snprintf(formatted_num, sizeof(formatted_num), "%u", (int)i);
|
||||
|
||||
strlcpy(key, "shader", sizeof(key));
|
||||
strlcat(key, formatted_num, sizeof(key));
|
||||
_len = strlcpy(key, "shader", sizeof(key));
|
||||
strlcpy(key + _len, formatted_num, sizeof(key) - _len);
|
||||
|
||||
strlcpy(tmp, pass->source.path, PATH_MAX_LENGTH);
|
||||
path_relative_to(tmp_rel, tmp, tmp_base, PATH_MAX_LENGTH);
|
||||
@ -1142,31 +1129,31 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
|
||||
|
||||
if (pass->filter != RARCH_FILTER_UNSPEC)
|
||||
{
|
||||
strlcpy(key, "filter_linear", sizeof(key));
|
||||
strlcat(key, formatted_num, sizeof(key));
|
||||
_len = strlcpy(key, "filter_linear", sizeof(key));
|
||||
strlcpy(key, formatted_num, sizeof(key) - _len);
|
||||
config_set_string(conf, key,
|
||||
(pass->filter == RARCH_FILTER_LINEAR)
|
||||
? "true"
|
||||
: "false");
|
||||
}
|
||||
|
||||
strlcpy(key, "wrap_mode", sizeof(key));
|
||||
strlcat(key, formatted_num, sizeof(key));
|
||||
_len = strlcpy(key, "wrap_mode", sizeof(key));
|
||||
strlcpy(key + _len, formatted_num, sizeof(key) - _len);
|
||||
config_set_string(conf, key, video_shader_wrap_mode_to_str(pass->wrap));
|
||||
|
||||
if (pass->frame_count_mod)
|
||||
{
|
||||
strlcpy(key, "frame_count_mod", sizeof(key));
|
||||
strlcat(key, formatted_num, sizeof(key));
|
||||
_len = strlcpy(key, "frame_count_mod", sizeof(key));
|
||||
strlcpy(key + _len, formatted_num, sizeof(key) - _len);
|
||||
config_set_int(conf, key, pass->frame_count_mod);
|
||||
}
|
||||
|
||||
strlcpy(key, "mipmap_input", sizeof(key));
|
||||
strlcat(key, formatted_num, sizeof(key));
|
||||
_len = strlcpy(key, "mipmap_input", sizeof(key));
|
||||
strlcpy(key + _len, formatted_num, sizeof(key) - _len);
|
||||
config_set_string(conf, key, pass->mipmap ? "true" : "false");
|
||||
|
||||
strlcpy(key, "alias", sizeof(key));
|
||||
strlcat(key, formatted_num, sizeof(key));
|
||||
_len = strlcpy(key, "alias", sizeof(key));
|
||||
strlcpy(key + _len, formatted_num, sizeof(key) - _len);
|
||||
config_set_string(conf, key, pass->alias);
|
||||
|
||||
video_shader_write_fbo(conf, formatted_num, &pass->fbo);
|
||||
@ -1208,8 +1195,8 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
|
||||
if (shader->lut[i].filter != RARCH_FILTER_UNSPEC)
|
||||
{
|
||||
char k[128];
|
||||
strlcpy(k, shader->lut[i].id, sizeof(k));
|
||||
strlcat(k, "_linear", sizeof(k));
|
||||
size_t _len = strlcpy(k, shader->lut[i].id, sizeof(k));
|
||||
strlcpy(k + _len, "_linear", sizeof(k) - _len);
|
||||
config_set_string(conf, k,
|
||||
(shader->lut[i].filter == RARCH_FILTER_LINEAR)
|
||||
? "true"
|
||||
@ -1219,8 +1206,8 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
|
||||
/* Wrap Mode */
|
||||
{
|
||||
char k[128];
|
||||
strlcpy(k, shader->lut[i].id, sizeof(k));
|
||||
strlcat(k, "_wrap_mode", sizeof(k));
|
||||
size_t _len = strlcpy(k, shader->lut[i].id, sizeof(k));
|
||||
strlcpy(k + _len, "_wrap_mode", sizeof(k) - _len);
|
||||
config_set_string(conf, k,
|
||||
video_shader_wrap_mode_to_str(shader->lut[i].wrap));
|
||||
}
|
||||
@ -1228,8 +1215,8 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
|
||||
/* Mipmap On or Off */
|
||||
{
|
||||
char k[128];
|
||||
strlcpy(k, shader->lut[i].id, sizeof(k));
|
||||
strlcat(k, "_mipmap", sizeof(k));
|
||||
size_t _len = strlcpy(k, shader->lut[i].id, sizeof(k));
|
||||
strlcpy(k + _len, "_mipmap", sizeof(k) - _len);
|
||||
config_set_string(conf, k, shader->lut[i].mipmap
|
||||
? "true"
|
||||
: "false");
|
||||
@ -2929,9 +2916,8 @@ bool video_shader_combine_preset_and_apply(
|
||||
const char *preset_ext = video_shader_get_preset_extension(type);
|
||||
struct video_shader *shader_to_append = (struct video_shader*) calloc(1, sizeof(*shader_to_append));
|
||||
struct video_shader *combined_shader = (struct video_shader*) calloc(1, sizeof(*combined_shader));
|
||||
|
||||
strlcpy(combined_preset_name, "retroarch", sizeof(combined_preset_name));
|
||||
strlcat(combined_preset_name, preset_ext, sizeof(combined_preset_name));
|
||||
size_t _len = strlcpy(combined_preset_name, "retroarch", sizeof(combined_preset_name));
|
||||
strlcpy(combined_preset_name + _len, preset_ext, sizeof(combined_preset_name) - _len);
|
||||
fill_pathname_join(combined_preset_path, temp_dir, combined_preset_name, sizeof(combined_preset_path));
|
||||
|
||||
video_shader_load_preset_into_shader(preset_path, shader_to_append);
|
||||
|
@ -328,14 +328,16 @@ bool path_is_compressed_file(const char* path)
|
||||
size_t fill_pathname(char *out_path, const char *in_path,
|
||||
const char *replace, size_t size)
|
||||
{
|
||||
size_t _len, _len2;
|
||||
char tmp_path[PATH_MAX_LENGTH];
|
||||
char *tok = NULL;
|
||||
strlcpy(tmp_path, in_path, sizeof(tmp_path));
|
||||
if ((tok = (char*)strrchr(path_basename(tmp_path), '.')))
|
||||
*tok = '\0';
|
||||
|
||||
strlcpy(out_path, tmp_path, size);
|
||||
return strlcat(out_path, replace, size);
|
||||
_len = strlcpy(out_path, tmp_path, size);
|
||||
_len2 = strlcpy(out_path + _len, replace, size - _len);
|
||||
return _len + _len2;
|
||||
}
|
||||
|
||||
|
||||
|
@ -476,17 +476,18 @@ int string_list_find_elem(const struct string_list *list, const char *elem)
|
||||
bool string_list_find_elem_prefix(const struct string_list *list,
|
||||
const char *prefix, const char *elem)
|
||||
{
|
||||
size_t i;
|
||||
char prefixed[255];
|
||||
if (!list)
|
||||
return false;
|
||||
strlcpy(prefixed, prefix, sizeof(prefixed));
|
||||
strlcat(prefixed, elem, sizeof(prefixed));
|
||||
for (i = 0; i < list->size; i++)
|
||||
if (list)
|
||||
{
|
||||
if ( string_is_equal_noncase(list->elems[i].data, elem)
|
||||
|| string_is_equal_noncase(list->elems[i].data, prefixed))
|
||||
return true;
|
||||
size_t i;
|
||||
char prefixed[255];
|
||||
size_t _len = strlcpy(prefixed, prefix, sizeof(prefixed));
|
||||
strlcpy(prefixed + _len, elem, sizeof(prefixed) - _len);
|
||||
for (i = 0; i < list->size; i++)
|
||||
{
|
||||
if ( string_is_equal_noncase(list->elems[i].data, elem)
|
||||
|| string_is_equal_noncase(list->elems[i].data, prefixed))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -494,21 +495,19 @@ bool string_list_find_elem_prefix(const struct string_list *list,
|
||||
struct string_list *string_list_clone(const struct string_list *src)
|
||||
{
|
||||
size_t i;
|
||||
struct string_list_elem
|
||||
*elems = NULL;
|
||||
struct string_list
|
||||
*dest = (struct string_list*)
|
||||
struct string_list_elem *elems = NULL;
|
||||
struct string_list *dest = (struct string_list*)
|
||||
malloc(sizeof(struct string_list));
|
||||
|
||||
if (!dest)
|
||||
return NULL;
|
||||
|
||||
dest->elems = NULL;
|
||||
dest->size = src->size;
|
||||
dest->elems = NULL;
|
||||
dest->size = src->size;
|
||||
if (src->cap < dest->size)
|
||||
dest->cap = dest->size;
|
||||
dest->cap = dest->size;
|
||||
else
|
||||
dest->cap = src->cap;
|
||||
dest->cap = src->cap;
|
||||
|
||||
if (!(elems = (struct string_list_elem*)
|
||||
calloc(dest->cap, sizeof(struct string_list_elem))))
|
||||
@ -517,7 +516,7 @@ struct string_list *string_list_clone(const struct string_list *src)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dest->elems = elems;
|
||||
dest->elems = elems;
|
||||
|
||||
for (i = 0; i < src->size; i++)
|
||||
{
|
||||
|
@ -97,6 +97,7 @@ static void menu_action_setting_audio_mixer_stream_volume(
|
||||
const char *path,
|
||||
char *s2, size_t len2)
|
||||
{
|
||||
size_t _len;
|
||||
unsigned offset = (type - MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_VOLUME_BEGIN);
|
||||
*w = 19;
|
||||
strlcpy(s2, path, len2);
|
||||
@ -104,8 +105,8 @@ static void menu_action_setting_audio_mixer_stream_volume(
|
||||
if (offset >= AUDIO_MIXER_MAX_SYSTEM_STREAMS)
|
||||
return;
|
||||
|
||||
snprintf(s, len, "%.2f", audio_driver_mixer_get_stream_volume(offset));
|
||||
strlcat(s, " dB", len);
|
||||
_len = snprintf(s, len, "%.2f", audio_driver_mixer_get_stream_volume(offset));
|
||||
strlcpy(s + _len, " dB", len - _len);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -908,8 +909,8 @@ static void menu_action_setting_disp_set_label_input_desc_kbd(
|
||||
if (key_descriptors[key_id].key != RETROK_FIRST)
|
||||
{
|
||||
/* TODO/FIXME - Localize */
|
||||
strlcpy(s, "Keyboard ", len);
|
||||
strlcat(s, key_descriptors[key_id].desc, len);
|
||||
size_t _len = strlcpy(s, "Keyboard ", len);
|
||||
strlcpy(s + _len, key_descriptors[key_id].desc, len - _len);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1163,8 +1163,8 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs,
|
||||
size_t _len = strlcpy(lbl_setting, "input_player", sizeof(lbl_setting));
|
||||
for (i = 0; i < MAX_USERS; i++)
|
||||
{
|
||||
snprintf(lbl_setting + _len, sizeof(lbl_setting) - _len, "%d", i + 1);
|
||||
strlcat(lbl_setting, "_joypad_index", sizeof(lbl_setting));
|
||||
_len += snprintf(lbl_setting + _len, sizeof(lbl_setting) - _len, "%d", i + 1);
|
||||
strlcpy(lbl_setting + _len, "_joypad_index", sizeof(lbl_setting) - _len);
|
||||
|
||||
if (!string_is_equal(label, lbl_setting))
|
||||
continue;
|
||||
|
@ -5578,8 +5578,8 @@ static int menu_displaylist_parse_input_description_kbd_list(
|
||||
else
|
||||
{
|
||||
/* TODO/FIXME: Localize 'Keyboard' */
|
||||
strlcpy(input_description, "Keyboard ", sizeof(input_description));
|
||||
strlcat(input_description, key_label, sizeof(input_description));
|
||||
size_t _len = strlcpy(input_description, "Keyboard ", sizeof(input_description));
|
||||
strlcpy(input_description + _len, key_label, sizeof(input_description) - _len);
|
||||
}
|
||||
|
||||
/* Add menu entry */
|
||||
@ -6366,7 +6366,7 @@ static unsigned menu_displaylist_netplay_refresh_rooms(file_list_t *list)
|
||||
strlcpy(country, " (", sizeof(country));
|
||||
strlcat(country, room->country, sizeof(country));
|
||||
strlcat(country, ")", sizeof(country));
|
||||
strlcat(buf, country, sizeof(buf));
|
||||
strlcat(buf, country, sizeof(buf));
|
||||
}
|
||||
else
|
||||
*country = '\0';
|
||||
@ -11579,9 +11579,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
{
|
||||
if (!string_is_empty(cd_info.title))
|
||||
{
|
||||
/* TODO/FIXME - localize */
|
||||
char title[sizeof("Title: ") + sizeof(cd_info.title)]; /* TODO/FIXME - C89 compliance */
|
||||
strlcpy(title, "Title: ", sizeof(title));
|
||||
strlcat(title, cd_info.title, sizeof(title));
|
||||
size_t _len = strlcpy(title, "Title: ", sizeof(title));
|
||||
strlcpy(title + _len, cd_info.title, sizeof(title) - _len);
|
||||
|
||||
if (menu_entries_append(info->list,
|
||||
title,
|
||||
@ -11595,8 +11596,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
{
|
||||
char system[256];
|
||||
/* TODO/FIXME - Localize */
|
||||
strlcpy(system, "System: ", sizeof(system));
|
||||
strlcat(system, cd_info.system, sizeof(system));
|
||||
size_t _len = strlcpy(system, "System: ", sizeof(system));
|
||||
strlcpy(system + _len, cd_info.system, sizeof(system) - _len);
|
||||
|
||||
if (menu_entries_append(info->list,
|
||||
system,
|
||||
@ -11627,8 +11628,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
{
|
||||
char version[256];
|
||||
/* TODO/FIXME - localize */
|
||||
strlcpy(version, "Version: ", sizeof(version));
|
||||
strlcat(version, cd_info.version, sizeof(version));
|
||||
size_t _len = strlcpy(version, "Version: ", sizeof(version));
|
||||
strlcpy(version + _len, cd_info.version, sizeof(version) - _len);
|
||||
|
||||
if (menu_entries_append(info->list,
|
||||
version,
|
||||
@ -11642,10 +11643,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
{
|
||||
char release_date[256];
|
||||
/* TODO/FIXME - Localize */
|
||||
strlcpy(release_date, "Release Date: ",
|
||||
sizeof(release_date));
|
||||
strlcat(release_date, cd_info.release_date,
|
||||
size_t _len = strlcpy(release_date, "Release Date: ",
|
||||
sizeof(release_date));
|
||||
strlcpy(release_date + _len, cd_info.release_date,
|
||||
sizeof(release_date) - _len);
|
||||
|
||||
if (menu_entries_append(info->list,
|
||||
release_date,
|
||||
@ -12087,71 +12088,61 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
{
|
||||
char lbl_play[128];
|
||||
char lbl_play_looped[128];
|
||||
char lbl_play_sequential[128];
|
||||
char lbl_remove[128];
|
||||
char lbl_stop[128];
|
||||
char lbl_volume[128];
|
||||
char lbl[128];
|
||||
char mixer_stream_str[128];
|
||||
unsigned id = info->type - MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_BEGIN;
|
||||
size_t _len = strlcpy(mixer_stream_str, "mixer_stream_", sizeof(mixer_stream_str));
|
||||
|
||||
lbl_remove[0] = lbl_stop[0] = lbl_play[0] = lbl_play_looped[0] = '\0';
|
||||
lbl_volume[0] = lbl_play_sequential[0] = '\0';
|
||||
|
||||
lbl[0] = '\0';
|
||||
|
||||
snprintf(mixer_stream_str + _len, sizeof(mixer_stream_str) - _len, "%d", id);
|
||||
strlcpy(lbl_volume, mixer_stream_str, sizeof(lbl_volume));
|
||||
strlcpy(lbl_stop, mixer_stream_str, sizeof(lbl_stop));
|
||||
strlcpy(lbl_remove, mixer_stream_str, sizeof(lbl_remove));
|
||||
strlcpy(lbl_play, mixer_stream_str, sizeof(lbl_play));
|
||||
strlcpy(lbl_play_looped, mixer_stream_str, sizeof(lbl_play_looped));
|
||||
strlcpy(lbl_play_sequential, mixer_stream_str, sizeof(lbl_play_sequential));
|
||||
strlcat(lbl_volume, "_action_volume", sizeof(lbl_volume));
|
||||
strlcat(lbl_stop, "_action_stop", sizeof(lbl_stop));
|
||||
strlcat(lbl_remove, "_action_remove", sizeof(lbl_remove));
|
||||
strlcat(lbl_play, "_action_play", sizeof(lbl_play));
|
||||
strlcat(lbl_play_looped, "_action_play_looped", sizeof(lbl_play_looped));
|
||||
strlcat(lbl_play_sequential, "_action_play_sequential",sizeof(lbl_play_sequential));
|
||||
|
||||
_len = strlcpy(lbl, mixer_stream_str, sizeof(lbl));
|
||||
|
||||
strlcpy(lbl + _len, "_action_play", sizeof(lbl) - _len);
|
||||
if (menu_entries_append(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY),
|
||||
lbl_play,
|
||||
lbl,
|
||||
MSG_UNKNOWN,
|
||||
(MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_PLAY_BEGIN + id),
|
||||
0, 0, NULL))
|
||||
count++;
|
||||
strlcpy(lbl + _len, "_action_play_looped", sizeof(lbl) - _len);
|
||||
if (menu_entries_append(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_LOOPED),
|
||||
lbl_play_looped,
|
||||
lbl,
|
||||
MSG_UNKNOWN,
|
||||
(MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_PLAY_LOOPED_BEGIN + id),
|
||||
0, 0, NULL))
|
||||
count++;
|
||||
strlcpy(lbl + _len, "_action_play_sequential",sizeof(lbl) - _len);
|
||||
if (menu_entries_append(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_SEQUENTIAL),
|
||||
lbl_play_sequential,
|
||||
lbl,
|
||||
MSG_UNKNOWN,
|
||||
(MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_PLAY_SEQUENTIAL_BEGIN + id),
|
||||
0, 0, NULL))
|
||||
count++;
|
||||
strlcpy(lbl + _len, "_action_stop", sizeof(lbl) - _len);
|
||||
if (menu_entries_append(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_STOP),
|
||||
lbl_stop,
|
||||
lbl,
|
||||
MSG_UNKNOWN,
|
||||
(MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_STOP_BEGIN + id),
|
||||
0, 0, NULL))
|
||||
count++;
|
||||
strlcpy(lbl + _len, "_action_remove", sizeof(lbl) - _len);
|
||||
if (menu_entries_append(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_REMOVE),
|
||||
lbl_remove,
|
||||
lbl,
|
||||
MSG_UNKNOWN,
|
||||
(MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_REMOVE_BEGIN + id),
|
||||
0, 0, NULL))
|
||||
count++;
|
||||
strlcpy(lbl + _len, "_action_volume", sizeof(lbl) - _len);
|
||||
if (menu_entries_append(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_VOLUME),
|
||||
lbl_volume,
|
||||
lbl,
|
||||
MSG_UNKNOWN,
|
||||
(MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_VOLUME_BEGIN + id),
|
||||
0, 0, NULL))
|
||||
|
@ -6552,8 +6552,8 @@ static void setting_get_string_representation_uint_autosave_interval(
|
||||
|
||||
if (*setting->value.target.unsigned_integer)
|
||||
{
|
||||
snprintf(s, len, "%u ", *setting->value.target.unsigned_integer);
|
||||
strlcat(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SECONDS), len);
|
||||
size_t _len = snprintf(s, len, "%u ", *setting->value.target.unsigned_integer);
|
||||
strlcpy(s + _len, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SECONDS), len - _len);
|
||||
}
|
||||
else
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF), len);
|
||||
@ -6570,8 +6570,8 @@ static void setting_get_string_representation_uint_replay_checkpoint_interval(
|
||||
|
||||
if (*setting->value.target.unsigned_integer)
|
||||
{
|
||||
snprintf(s, len, "%u ", *setting->value.target.unsigned_integer);
|
||||
strlcat(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SECONDS), len);
|
||||
size_t _len = snprintf(s, len, "%u ", *setting->value.target.unsigned_integer);
|
||||
strlcpy(s + _len, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SECONDS), len - _len);
|
||||
}
|
||||
else
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF), len);
|
||||
|
@ -6364,6 +6364,7 @@ bool retroarch_main_init(int argc, char *argv[])
|
||||
if (!string_is_empty(cpu_model))
|
||||
{
|
||||
size_t _len;
|
||||
/* TODO/FIXME - localize */
|
||||
strlcat(str_output, FILE_PATH_LOG_INFO " CPU Model Name: ",
|
||||
sizeof(str_output));
|
||||
_len = strlcat(str_output, cpu_model, sizeof(str_output));
|
||||
|
@ -318,8 +318,8 @@ runtime_log_t *runtime_log_init(
|
||||
* the name of the core itself */
|
||||
if (supports_no_game)
|
||||
{
|
||||
strlcpy(content_name, core_name, sizeof(content_name));
|
||||
strlcat(content_name, ".lrtl", sizeof(content_name));
|
||||
size_t _len = strlcpy(content_name, core_name, sizeof(content_name));
|
||||
strlcpy(content_name + _len, ".lrtl", sizeof(content_name) - _len);
|
||||
}
|
||||
}
|
||||
/* NOTE: TyrQuake requires a specific hack, since all
|
||||
@ -332,17 +332,19 @@ runtime_log_t *runtime_log_init(
|
||||
size_t path_length = last_slash + 1 - content_path;
|
||||
if (path_length < PATH_MAX_LENGTH)
|
||||
{
|
||||
size_t _len;
|
||||
memset(tmp_buf, 0, sizeof(tmp_buf));
|
||||
strlcpy(tmp_buf,
|
||||
content_path, path_length * sizeof(char));
|
||||
strlcpy(content_name,
|
||||
_len = strlcpy(content_name,
|
||||
path_basename(tmp_buf), sizeof(content_name));
|
||||
strlcat(content_name, ".lrtl", sizeof(content_name));
|
||||
strlcpy(content_name + _len, ".lrtl", sizeof(content_name) - _len);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t _len;
|
||||
/* path_remove_extension() requires a char * (not const)
|
||||
* so have to use a temporary buffer... */
|
||||
char *tmp_buf_no_ext = NULL;
|
||||
@ -353,8 +355,8 @@ runtime_log_t *runtime_log_init(
|
||||
if (string_is_empty(tmp_buf_no_ext))
|
||||
return NULL;
|
||||
|
||||
strlcpy(content_name, tmp_buf_no_ext, sizeof(content_name));
|
||||
strlcat(content_name, ".lrtl", sizeof(content_name));
|
||||
_len = strlcpy(content_name, tmp_buf_no_ext, sizeof(content_name));
|
||||
strlcpy(content_name + _len, ".lrtl", sizeof(content_name) - _len);
|
||||
}
|
||||
|
||||
if (string_is_empty(content_name))
|
||||
@ -510,12 +512,13 @@ void runtime_log_get_runtime_str(runtime_log_t *runtime_log,
|
||||
s[_len+1] = '\0';
|
||||
if (runtime_log)
|
||||
{
|
||||
size_t _len2;
|
||||
char t[64];
|
||||
t[0] = '\0';
|
||||
snprintf(t, sizeof(t), "%02u:%02u:%02u",
|
||||
t[0] = '\0';
|
||||
_len2 = snprintf(t, sizeof(t), "%02u:%02u:%02u",
|
||||
runtime_log->runtime.hours, runtime_log->runtime.minutes,
|
||||
runtime_log->runtime.seconds);
|
||||
strlcat(s, t, len);
|
||||
strlcpy(s + _len2, t, len - _len2);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -569,6 +572,7 @@ static void runtime_log_get_last_played_time(runtime_log_t *runtime_log,
|
||||
static bool runtime_last_played_human(runtime_log_t *runtime_log,
|
||||
char *str, size_t len)
|
||||
{
|
||||
size_t _len;
|
||||
struct tm time_info;
|
||||
time_t last_played;
|
||||
time_t current;
|
||||
@ -607,13 +611,14 @@ static bool runtime_last_played_human(runtime_log_t *runtime_log,
|
||||
delta /= periods[i];
|
||||
|
||||
/* Generate string */
|
||||
snprintf(tmp, sizeof(tmp), "%u ", (int)delta);
|
||||
_len = snprintf(tmp, sizeof(tmp), "%u ", (int)delta);
|
||||
if (delta == 1)
|
||||
strlcat(tmp, msg_hash_to_str((enum msg_hash_enums)units[i][0]),
|
||||
sizeof(tmp));
|
||||
strlcpy(tmp + _len, msg_hash_to_str((enum msg_hash_enums)units[i][0]),
|
||||
sizeof(tmp) - _len);
|
||||
else
|
||||
strlcat(tmp, msg_hash_to_str((enum msg_hash_enums)units[i][1]),
|
||||
sizeof(tmp));
|
||||
strlcpy(tmp + _len, msg_hash_to_str((enum msg_hash_enums)units[i][1]),
|
||||
sizeof(tmp) - _len);
|
||||
|
||||
strlcat(str, tmp, len);
|
||||
strlcat(str, " ", len);
|
||||
strlcat(str, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_TIME_UNIT_AGO), len);
|
||||
|
@ -1046,16 +1046,19 @@ static bool content_file_load(
|
||||
else
|
||||
new_basedir[0] = '\0';
|
||||
|
||||
if (string_is_empty(new_basedir) ||
|
||||
!path_is_directory(new_basedir) ||
|
||||
!is_path_accessible_using_standard_io(new_basedir))
|
||||
if ( string_is_empty (new_basedir)
|
||||
|| !path_is_directory(new_basedir)
|
||||
|| !is_path_accessible_using_standard_io(new_basedir))
|
||||
{
|
||||
size_t _len;
|
||||
DWORD basedir_attribs;
|
||||
RARCH_WARN("[Content]: Tried copying to cache directory, "
|
||||
"but cache directory was not set or found. "
|
||||
"Setting cache directory to root of writable app directory...\n");
|
||||
strlcpy(new_basedir, uwp_dir_data, sizeof(new_basedir));
|
||||
strlcat(new_basedir, "VFSCACHE\\", sizeof(new_basedir));
|
||||
_len = strlcpy(new_basedir, uwp_dir_data, sizeof(new_basedir));
|
||||
strlcpy(new_basedir + _len,
|
||||
"VFSCACHE\\",
|
||||
sizeof(new_basedir) - _len);
|
||||
basedir_attribs = GetFileAttributes(new_basedir);
|
||||
if ( (basedir_attribs == INVALID_FILE_ATTRIBUTES)
|
||||
|| (!(basedir_attribs & FILE_ATTRIBUTE_DIRECTORY)))
|
||||
|
@ -545,9 +545,9 @@ static enum msg_file_type extension_to_file_type(const char *ext)
|
||||
string_to_lower(ext_lower);
|
||||
|
||||
if (
|
||||
string_is_equal(ext_lower, "7z") ||
|
||||
string_is_equal(ext_lower, "zip") ||
|
||||
string_is_equal(ext_lower, "apk")
|
||||
string_is_equal(ext_lower, "7z")
|
||||
|| string_is_equal(ext_lower, "zip")
|
||||
|| string_is_equal(ext_lower, "apk")
|
||||
)
|
||||
return FILE_TYPE_COMPRESSED;
|
||||
if (
|
||||
|
@ -383,9 +383,9 @@ void* task_push_http_transfer_file(const char* url, bool mute,
|
||||
|
||||
if (string_ends_with_size(s, ".index",
|
||||
strlen(s), STRLEN_CONST(".index")))
|
||||
strlcat(tmp, msg_hash_to_str(MSG_INDEX_FILE), sizeof(tmp));
|
||||
else
|
||||
strlcat(tmp, s, sizeof(tmp));
|
||||
s = msg_hash_to_str(MSG_INDEX_FILE);
|
||||
|
||||
strlcat(tmp, s, sizeof(tmp));
|
||||
|
||||
t->title = strdup(tmp);
|
||||
return t;
|
||||
|
@ -5090,6 +5090,7 @@ void LoadCoreWindow::onCoreEnterPressed()
|
||||
|
||||
void LoadCoreWindow::onLoadCustomCoreClicked()
|
||||
{
|
||||
size_t _len;
|
||||
QString path;
|
||||
QByteArray pathArray;
|
||||
char core_ext[255] = {0};
|
||||
@ -5100,8 +5101,8 @@ void LoadCoreWindow::onLoadCustomCoreClicked()
|
||||
|
||||
frontend_driver_get_core_extension(core_ext, sizeof(core_ext));
|
||||
|
||||
strlcpy(filters, "Cores (*.", sizeof(filters));
|
||||
strlcat(filters, core_ext, sizeof(filters));
|
||||
_len = strlcpy(filters, "Cores (*.", sizeof(filters));
|
||||
strlcpy(filters + _len, core_ext, sizeof(filters) - _len);
|
||||
strlcat(filters, ");;All Files (*.*)", sizeof(filters));
|
||||
|
||||
path = QFileDialog::getOpenFileName(
|
||||
|
Loading…
x
Reference in New Issue
Block a user