mirror of
https://github.com/libretro/RetroArch
synced 2025-02-22 03:40:43 +00:00
* replace more strlcat calls with strlcpy
* Get rid of unnecessary string copies by clever usage of strlcpy * Get rid of unnecessary temp variables when not needed
This commit is contained in:
parent
61ce614251
commit
0517354181
@ -4199,7 +4199,8 @@ bool config_load_override(void *data)
|
|||||||
sizeof(tmp_path));
|
sizeof(tmp_path));
|
||||||
tmp_path[_len ] = '|';
|
tmp_path[_len ] = '|';
|
||||||
tmp_path[_len+1] = '\0';
|
tmp_path[_len+1] = '\0';
|
||||||
strlcat(tmp_path, core_path, sizeof(tmp_path));
|
_len += 1;
|
||||||
|
strlcpy(tmp_path + _len, core_path, sizeof(tmp_path) - _len);
|
||||||
RARCH_LOG("[Overrides]: Core-specific overrides stacking on top of previous overrides.\n");
|
RARCH_LOG("[Overrides]: Core-specific overrides stacking on top of previous overrides.\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -4229,7 +4230,8 @@ bool config_load_override(void *data)
|
|||||||
sizeof(tmp_path));
|
sizeof(tmp_path));
|
||||||
tmp_path[_len ] = '|';
|
tmp_path[_len ] = '|';
|
||||||
tmp_path[_len+1] = '\0';
|
tmp_path[_len+1] = '\0';
|
||||||
strlcat(tmp_path, content_path, sizeof(tmp_path));
|
_len += 1;
|
||||||
|
strlcpy(tmp_path + _len, content_path, sizeof(tmp_path) - _len);
|
||||||
RARCH_LOG("[Overrides]: Content dir-specific overrides stacking on top of previous overrides.\n");
|
RARCH_LOG("[Overrides]: Content dir-specific overrides stacking on top of previous overrides.\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -4257,7 +4259,8 @@ bool config_load_override(void *data)
|
|||||||
sizeof(tmp_path));
|
sizeof(tmp_path));
|
||||||
tmp_path[_len ] = '|';
|
tmp_path[_len ] = '|';
|
||||||
tmp_path[_len+1] = '\0';
|
tmp_path[_len+1] = '\0';
|
||||||
strlcat(tmp_path, game_path, sizeof(tmp_path));
|
_len += 1;
|
||||||
|
strlcpy(tmp_path + _len, game_path, sizeof(tmp_path) - _len);
|
||||||
RARCH_LOG("[Overrides]: Game-specific overrides stacking on top of previous overrides.\n");
|
RARCH_LOG("[Overrides]: Game-specific overrides stacking on top of previous overrides.\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -4570,19 +4573,19 @@ static void save_keybind_hat(config_file_t *conf, const char *key,
|
|||||||
switch (GET_HAT_DIR(bind->joykey))
|
switch (GET_HAT_DIR(bind->joykey))
|
||||||
{
|
{
|
||||||
case HAT_UP_MASK:
|
case HAT_UP_MASK:
|
||||||
strlcpy(config + _len, "up", sizeof(config) - _len);
|
strlcpy(config + _len, "up", sizeof(config) - _len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HAT_DOWN_MASK:
|
case HAT_DOWN_MASK:
|
||||||
strlcpy(config + _len, "down", sizeof(config) - _len);
|
strlcpy(config + _len, "down", sizeof(config) - _len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HAT_LEFT_MASK:
|
case HAT_LEFT_MASK:
|
||||||
strlcpy(config, "left", sizeof(config) - _len);
|
strlcpy(config + _len, "left", sizeof(config) - _len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HAT_RIGHT_MASK:
|
case HAT_RIGHT_MASK:
|
||||||
strlcpy(config, "right", sizeof(config) - _len);
|
strlcpy(config + _len, "right", sizeof(config) - _len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -5106,6 +5109,7 @@ bool config_save_file(const char *path)
|
|||||||
|
|
||||||
for (i = 0; i < MAX_USERS; i++)
|
for (i = 0; i < MAX_USERS; i++)
|
||||||
{
|
{
|
||||||
|
size_t _len;
|
||||||
char cfg[64];
|
char cfg[64];
|
||||||
char formatted_number[4];
|
char formatted_number[4];
|
||||||
|
|
||||||
@ -5118,19 +5122,16 @@ bool config_save_file(const char *path)
|
|||||||
config_set_int(conf, cfg, settings->uints.input_device[i]);
|
config_set_int(conf, cfg, settings->uints.input_device[i]);
|
||||||
|
|
||||||
strlcpy(cfg, "input_player", sizeof(cfg));
|
strlcpy(cfg, "input_player", sizeof(cfg));
|
||||||
strlcat(cfg, formatted_number, sizeof(cfg));
|
_len = strlcat(cfg, formatted_number, sizeof(cfg));
|
||||||
strlcat(cfg, "_analog_dpad_mode", sizeof(cfg));
|
|
||||||
config_set_int(conf, cfg, settings->uints.input_analog_dpad_mode[i]);
|
|
||||||
|
|
||||||
strlcpy(cfg, "input_player", sizeof(cfg));
|
strlcpy(cfg + _len, "_mouse_index", sizeof(cfg) - _len);
|
||||||
strlcat(cfg, formatted_number, sizeof(cfg));
|
config_set_int(conf, cfg, settings->uints.input_mouse_index[i]);
|
||||||
strlcat(cfg, "_joypad_index", sizeof(cfg));
|
|
||||||
|
strlcpy(cfg + _len, "_joypad_index", sizeof(cfg) - _len);
|
||||||
config_set_int(conf, cfg, settings->uints.input_joypad_index[i]);
|
config_set_int(conf, cfg, settings->uints.input_joypad_index[i]);
|
||||||
|
|
||||||
strlcpy(cfg, "input_player", sizeof(cfg));
|
strlcpy(cfg + _len, "_analog_dpad_mode", sizeof(cfg) - _len);
|
||||||
strlcat(cfg, formatted_number, sizeof(cfg));
|
config_set_int(conf, cfg, settings->uints.input_analog_dpad_mode[i]);
|
||||||
strlcat(cfg, "_mouse_index", sizeof(cfg));
|
|
||||||
config_set_int(conf, cfg, settings->uints.input_mouse_index[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Boolean settings */
|
/* Boolean settings */
|
||||||
@ -5420,6 +5421,7 @@ int8_t config_save_overrides(enum override_type type, void *data, bool remove)
|
|||||||
|
|
||||||
for (i = 0; i < MAX_USERS; i++)
|
for (i = 0; i < MAX_USERS; i++)
|
||||||
{
|
{
|
||||||
|
size_t _len;
|
||||||
uint8_t j;
|
uint8_t j;
|
||||||
char cfg[64];
|
char cfg[64];
|
||||||
char formatted_number[4];
|
char formatted_number[4];
|
||||||
@ -5436,34 +5438,31 @@ int8_t config_save_overrides(enum override_type type, void *data, bool remove)
|
|||||||
RARCH_DBG("[Overrides]: %s = \"%u\"\n", cfg, overrides->uints.input_device[i]);
|
RARCH_DBG("[Overrides]: %s = \"%u\"\n", cfg, overrides->uints.input_device[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings->uints.input_analog_dpad_mode[i]
|
strlcpy(cfg, "input_player", sizeof(cfg));
|
||||||
!= overrides->uints.input_analog_dpad_mode[i])
|
_len = strlcat(cfg, formatted_number, sizeof(cfg));
|
||||||
|
|
||||||
|
if (settings->uints.input_mouse_index[i]
|
||||||
|
!= overrides->uints.input_mouse_index[i])
|
||||||
{
|
{
|
||||||
strlcpy(cfg, "input_player", sizeof(cfg));
|
strlcpy(cfg + _len, "_mouse_index", sizeof(cfg) - _len);
|
||||||
strlcat(cfg, formatted_number, sizeof(cfg));
|
config_set_int(conf, cfg, overrides->uints.input_mouse_index[i]);
|
||||||
strlcat(cfg, "_analog_dpad_mode", sizeof(cfg));
|
RARCH_DBG("[Overrides]: %s = \"%u\"\n", cfg, overrides->uints.input_mouse_index[i]);
|
||||||
config_set_int(conf, cfg, overrides->uints.input_analog_dpad_mode[i]);
|
|
||||||
RARCH_DBG("[Overrides]: %s = \"%u\"\n", cfg, overrides->uints.input_analog_dpad_mode[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings->uints.input_joypad_index[i]
|
if (settings->uints.input_joypad_index[i]
|
||||||
!= overrides->uints.input_joypad_index[i])
|
!= overrides->uints.input_joypad_index[i])
|
||||||
{
|
{
|
||||||
strlcpy(cfg, "input_player", sizeof(cfg));
|
strlcpy(cfg + _len, "_joypad_index", sizeof(cfg) - _len);
|
||||||
strlcat(cfg, formatted_number, sizeof(cfg));
|
|
||||||
strlcat(cfg, "_joypad_index", sizeof(cfg));
|
|
||||||
config_set_int(conf, cfg, overrides->uints.input_joypad_index[i]);
|
config_set_int(conf, cfg, overrides->uints.input_joypad_index[i]);
|
||||||
RARCH_DBG("[Overrides]: %s = \"%u\"\n", cfg, overrides->uints.input_joypad_index[i]);
|
RARCH_DBG("[Overrides]: %s = \"%u\"\n", cfg, overrides->uints.input_joypad_index[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings->uints.input_mouse_index[i]
|
if (settings->uints.input_analog_dpad_mode[i]
|
||||||
!= overrides->uints.input_mouse_index[i])
|
!= overrides->uints.input_analog_dpad_mode[i])
|
||||||
{
|
{
|
||||||
strlcpy(cfg, "input_player", sizeof(cfg));
|
strlcpy(cfg + _len, "_analog_dpad_mode", sizeof(cfg) - _len);
|
||||||
strlcat(cfg, formatted_number, sizeof(cfg));
|
config_set_int(conf, cfg, overrides->uints.input_analog_dpad_mode[i]);
|
||||||
strlcat(cfg, "_mouse_index", sizeof(cfg));
|
RARCH_DBG("[Overrides]: %s = \"%u\"\n", cfg, overrides->uints.input_analog_dpad_mode[i]);
|
||||||
config_set_int(conf, cfg, overrides->uints.input_mouse_index[i]);
|
|
||||||
RARCH_DBG("[Overrides]: %s = \"%u\"\n", cfg, overrides->uints.input_mouse_index[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < RARCH_BIND_LIST_END; j++)
|
for (j = 0; j < RARCH_BIND_LIST_END; j++)
|
||||||
|
@ -802,10 +802,6 @@ static void d3d9_cg_renderchain_bind_prev(d3d9_renderchain_t *chain,
|
|||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
float texture_size[2];
|
float texture_size[2];
|
||||||
char attr_texture[64];
|
|
||||||
char attr_input_size[64];
|
|
||||||
char attr_tex_size[64];
|
|
||||||
char attr_coord[64];
|
|
||||||
static const char *prev_names[] = {
|
static const char *prev_names[] = {
|
||||||
"PREV",
|
"PREV",
|
||||||
"PREV1",
|
"PREV1",
|
||||||
@ -821,44 +817,20 @@ static void d3d9_cg_renderchain_bind_prev(d3d9_renderchain_t *chain,
|
|||||||
|
|
||||||
for (i = 0; i < TEXTURES - 1; i++)
|
for (i = 0; i < TEXTURES - 1; i++)
|
||||||
{
|
{
|
||||||
char prev_name[32];
|
char attr[64];
|
||||||
CGparameter param;
|
CGparameter param;
|
||||||
float video_size[2];
|
float video_size[2];
|
||||||
CGprogram fprg = (CGprogram)pass->fprg;
|
CGprogram fprg = (CGprogram)pass->fprg;
|
||||||
CGprogram vprg = (CGprogram)pass->vprg;
|
CGprogram vprg = (CGprogram)pass->vprg;
|
||||||
|
size_t _len = strlcpy(attr, prev_names[i], sizeof(attr));
|
||||||
strlcpy(prev_name, prev_names[i], sizeof(prev_name));
|
|
||||||
strlcpy(attr_texture, prev_name, sizeof(attr_texture));
|
|
||||||
strlcat(attr_texture, ".texture", sizeof(attr_texture));
|
|
||||||
strlcpy(attr_input_size, prev_name, sizeof(attr_input_size));
|
|
||||||
strlcat(attr_input_size, ".video_size", sizeof(attr_input_size));
|
|
||||||
strlcpy(attr_tex_size, prev_name, sizeof(attr_tex_size));
|
|
||||||
strlcat(attr_tex_size, ".texture_size", sizeof(attr_tex_size));
|
|
||||||
strlcpy(attr_coord, prev_name, sizeof(attr_coord));
|
|
||||||
strlcat(attr_coord, ".tex_coord", sizeof(attr_coord));
|
|
||||||
|
|
||||||
video_size[0] = chain->prev.last_width[
|
video_size[0] = chain->prev.last_width[
|
||||||
(chain->prev.ptr - (i + 1)) & TEXTURESMASK];
|
(chain->prev.ptr - (i + 1)) & TEXTURESMASK];
|
||||||
video_size[1] = chain->prev.last_height[
|
video_size[1] = chain->prev.last_height[
|
||||||
(chain->prev.ptr - (i + 1)) & TEXTURESMASK];
|
(chain->prev.ptr - (i + 1)) & TEXTURESMASK];
|
||||||
|
|
||||||
/* Vertex program */
|
strlcpy(attr + _len, ".texture", sizeof(attr) - _len);
|
||||||
param = cgGetNamedParameter(vprg, attr_input_size);
|
param = cgGetNamedParameter(fprg, attr);
|
||||||
if (param)
|
|
||||||
cgD3D9SetUniform(param, &video_size);
|
|
||||||
param = cgGetNamedParameter(vprg, attr_tex_size);
|
|
||||||
if (param)
|
|
||||||
cgD3D9SetUniform(param, &texture_size);
|
|
||||||
|
|
||||||
/* Fragment program */
|
|
||||||
param = cgGetNamedParameter(fprg, attr_input_size);
|
|
||||||
if (param)
|
|
||||||
cgD3D9SetUniform(param, &video_size);
|
|
||||||
param = cgGetNamedParameter(fprg, attr_tex_size);
|
|
||||||
if (param)
|
|
||||||
cgD3D9SetUniform(param, &texture_size);
|
|
||||||
|
|
||||||
param = cgGetNamedParameter(fprg, attr_texture);
|
|
||||||
if (param)
|
if (param)
|
||||||
{
|
{
|
||||||
unsigned index = cgGetParameterResourceIndex(param);
|
unsigned index = cgGetParameterResourceIndex(param);
|
||||||
@ -877,7 +849,8 @@ static void d3d9_cg_renderchain_bind_prev(d3d9_renderchain_t *chain,
|
|||||||
IDirect3DDevice9_SetSamplerState(chain->dev, index, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
|
IDirect3DDevice9_SetSamplerState(chain->dev, index, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
param = cgGetNamedParameter(vprg, attr_coord);
|
strlcpy(attr + _len, ".tex_coord", sizeof(attr) - _len);
|
||||||
|
param = cgGetNamedParameter(vprg, attr);
|
||||||
if (param)
|
if (param)
|
||||||
{
|
{
|
||||||
LPDIRECT3DVERTEXBUFFER9 vert_buf = (LPDIRECT3DVERTEXBUFFER9)
|
LPDIRECT3DVERTEXBUFFER9 vert_buf = (LPDIRECT3DVERTEXBUFFER9)
|
||||||
@ -890,6 +863,24 @@ static void d3d9_cg_renderchain_bind_prev(d3d9_renderchain_t *chain,
|
|||||||
sizeof(struct D3D9CGVertex));
|
sizeof(struct D3D9CGVertex));
|
||||||
unsigned_vector_list_append(chain->bound_vert, index);
|
unsigned_vector_list_append(chain->bound_vert, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strlcpy(attr + _len, ".video_size", sizeof(attr) - _len);
|
||||||
|
|
||||||
|
param = cgGetNamedParameter(vprg, attr);
|
||||||
|
if (param)
|
||||||
|
cgD3D9SetUniform(param, &video_size);
|
||||||
|
param = cgGetNamedParameter(fprg, attr);
|
||||||
|
if (param)
|
||||||
|
cgD3D9SetUniform(param, &video_size);
|
||||||
|
|
||||||
|
strlcpy(attr + _len, ".texture_size", sizeof(attr) - _len);
|
||||||
|
param = cgGetNamedParameter(vprg, attr);
|
||||||
|
if (param)
|
||||||
|
cgD3D9SetUniform(param, &texture_size);
|
||||||
|
param = cgGetNamedParameter(fprg, attr);
|
||||||
|
if (param)
|
||||||
|
cgD3D9SetUniform(param, &texture_size);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -908,44 +899,16 @@ static void d3d9_cg_renderchain_bind_pass(
|
|||||||
float video_size[2];
|
float video_size[2];
|
||||||
float texture_size[2];
|
float texture_size[2];
|
||||||
char pass_base[64];
|
char pass_base[64];
|
||||||
char attr_texture[64];
|
|
||||||
char attr_input_size[64];
|
|
||||||
char attr_tex_size[64];
|
|
||||||
char attr_coord[64];
|
|
||||||
struct shader_pass *curr_pass = (struct shader_pass*)&chain->passes->data[i];
|
struct shader_pass *curr_pass = (struct shader_pass*)&chain->passes->data[i];
|
||||||
|
size_t _len = snprintf(pass_base, sizeof(pass_base), "PASS%u", i);
|
||||||
snprintf(pass_base, sizeof(pass_base), "PASS%u", i);
|
|
||||||
strlcpy(attr_texture, pass_base, sizeof(attr_texture));
|
|
||||||
strlcat(attr_texture, ".texture", sizeof(attr_texture));
|
|
||||||
strlcpy(attr_input_size, pass_base, sizeof(attr_input_size));
|
|
||||||
strlcat(attr_input_size, ".video_size", sizeof(attr_input_size));
|
|
||||||
strlcpy(attr_tex_size, pass_base, sizeof(attr_tex_size));
|
|
||||||
strlcat(attr_tex_size, ".texture_size", sizeof(attr_tex_size));
|
|
||||||
strlcpy(attr_coord, pass_base, sizeof(attr_coord));
|
|
||||||
strlcat(attr_coord, ".tex_coord", sizeof(attr_coord));
|
|
||||||
|
|
||||||
video_size[0] = curr_pass->last_width;
|
video_size[0] = curr_pass->last_width;
|
||||||
video_size[1] = curr_pass->last_height;
|
video_size[1] = curr_pass->last_height;
|
||||||
texture_size[0] = curr_pass->info.tex_w;
|
texture_size[0] = curr_pass->info.tex_w;
|
||||||
texture_size[1] = curr_pass->info.tex_h;
|
texture_size[1] = curr_pass->info.tex_h;
|
||||||
|
|
||||||
/* Vertex program */
|
strlcpy(pass_base + _len, ".texture", sizeof(pass_base) - _len);
|
||||||
param = cgGetNamedParameter(vprg, attr_input_size);
|
param = cgGetNamedParameter(fprg, pass_base);
|
||||||
if (param)
|
|
||||||
cgD3D9SetUniform(param, &video_size);
|
|
||||||
param = cgGetNamedParameter(vprg, attr_tex_size);
|
|
||||||
if (param)
|
|
||||||
cgD3D9SetUniform(param, &texture_size);
|
|
||||||
|
|
||||||
/* Fragment program */
|
|
||||||
param = cgGetNamedParameter(fprg, attr_input_size);
|
|
||||||
if (param)
|
|
||||||
cgD3D9SetUniform(param, &video_size);
|
|
||||||
param = cgGetNamedParameter(fprg, attr_tex_size);
|
|
||||||
if (param)
|
|
||||||
cgD3D9SetUniform(param, &texture_size);
|
|
||||||
|
|
||||||
param = cgGetNamedParameter(fprg, attr_texture);
|
|
||||||
if (param)
|
if (param)
|
||||||
{
|
{
|
||||||
unsigned index = cgGetParameterResourceIndex(param);
|
unsigned index = cgGetParameterResourceIndex(param);
|
||||||
@ -960,7 +923,8 @@ static void d3d9_cg_renderchain_bind_pass(
|
|||||||
IDirect3DDevice9_SetSamplerState(chain->dev, index, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
|
IDirect3DDevice9_SetSamplerState(chain->dev, index, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
param = cgGetNamedParameter(vprg, attr_coord);
|
strlcpy(pass_base + _len, ".tex_coord", sizeof(pass_base) - _len);
|
||||||
|
param = cgGetNamedParameter(vprg, pass_base);
|
||||||
if (param)
|
if (param)
|
||||||
{
|
{
|
||||||
struct unsigned_vector_list *attrib_map =
|
struct unsigned_vector_list *attrib_map =
|
||||||
@ -972,6 +936,23 @@ static void d3d9_cg_renderchain_bind_pass(
|
|||||||
sizeof(struct D3D9CGVertex));
|
sizeof(struct D3D9CGVertex));
|
||||||
unsigned_vector_list_append(chain->bound_vert, index);
|
unsigned_vector_list_append(chain->bound_vert, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strlcpy(pass_base + _len, ".video_size", sizeof(pass_base) - _len);
|
||||||
|
param = cgGetNamedParameter(vprg, pass_base);
|
||||||
|
if (param)
|
||||||
|
cgD3D9SetUniform(param, &video_size);
|
||||||
|
param = cgGetNamedParameter(fprg, pass_base);
|
||||||
|
if (param)
|
||||||
|
cgD3D9SetUniform(param, &video_size);
|
||||||
|
|
||||||
|
strlcpy(pass_base + _len, ".texture_size", sizeof(pass_base) - _len);
|
||||||
|
param = cgGetNamedParameter(vprg, pass_base);
|
||||||
|
if (param)
|
||||||
|
cgD3D9SetUniform(param, &texture_size);
|
||||||
|
param = cgGetNamedParameter(fprg, pass_base);
|
||||||
|
if (param)
|
||||||
|
cgD3D9SetUniform(param, &texture_size);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,11 +41,7 @@ static std::string build_stage_source(
|
|||||||
size_t i;
|
size_t i;
|
||||||
std::string str;
|
std::string str;
|
||||||
bool active = true;
|
bool active = true;
|
||||||
|
if (!lines || lines->size < 1)
|
||||||
if (!lines)
|
|
||||||
return "";
|
|
||||||
|
|
||||||
if (lines->size < 1)
|
|
||||||
return "";
|
return "";
|
||||||
str.reserve(lines->size);
|
str.reserve(lines->size);
|
||||||
|
|
||||||
@ -65,15 +61,15 @@ static std::string build_stage_source(
|
|||||||
if (!string_is_empty(stage))
|
if (!string_is_empty(stage))
|
||||||
{
|
{
|
||||||
char expected[128];
|
char expected[128];
|
||||||
strlcpy(expected, "#pragma stage ", sizeof(expected));
|
size_t _len = strlcpy(expected, "#pragma stage ", sizeof(expected));
|
||||||
strlcat(expected, stage, sizeof(expected));
|
strlcpy(expected + _len, stage, sizeof(expected) - _len);
|
||||||
active = string_is_equal(expected, line);
|
active = string_is_equal(expected, line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (
|
else if (
|
||||||
!strncmp("#pragma name ", line,
|
!strncmp("#pragma name ", line,
|
||||||
STRLEN_CONST("#pragma name ")) ||
|
STRLEN_CONST("#pragma name "))
|
||||||
!strncmp("#pragma format ", line,
|
|| !strncmp("#pragma format ", line,
|
||||||
STRLEN_CONST("#pragma format ")))
|
STRLEN_CONST("#pragma format ")))
|
||||||
{
|
{
|
||||||
/* Ignore */
|
/* Ignore */
|
||||||
|
@ -188,16 +188,16 @@ static GLint gl_glsl_get_uniform(glsl_shader_data_t *glsl,
|
|||||||
unsigned i;
|
unsigned i;
|
||||||
GLint loc;
|
GLint loc;
|
||||||
char buf[80];
|
char buf[80];
|
||||||
strlcpy(buf, glsl->shader->prefix, sizeof(buf));
|
size_t _len = strlcpy(buf, glsl->shader->prefix, sizeof(buf));
|
||||||
strlcat(buf, base, sizeof(buf));
|
strlcpy(buf + _len, base, sizeof(buf) - _len);
|
||||||
if ((loc = glGetUniformLocation(prog, buf)) >= 0)
|
if ((loc = glGetUniformLocation(prog, buf)) >= 0)
|
||||||
return loc;
|
return loc;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(glsl_prefixes); i++)
|
for (i = 0; i < ARRAY_SIZE(glsl_prefixes); i++)
|
||||||
{
|
{
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
strlcpy(buf, glsl_prefixes[i], sizeof(buf));
|
_len = strlcpy(buf, glsl_prefixes[i], sizeof(buf));
|
||||||
strlcat(buf, base, sizeof(buf));
|
strlcpy(buf + _len, base, sizeof(buf) - _len);
|
||||||
if ((loc = glGetUniformLocation(prog, buf)) >= 0)
|
if ((loc = glGetUniformLocation(prog, buf)) >= 0)
|
||||||
return loc;
|
return loc;
|
||||||
}
|
}
|
||||||
@ -211,15 +211,15 @@ static GLint gl_glsl_get_attrib(glsl_shader_data_t *glsl,
|
|||||||
unsigned i;
|
unsigned i;
|
||||||
GLint loc;
|
GLint loc;
|
||||||
char buf[80];
|
char buf[80];
|
||||||
strlcpy(buf, glsl->shader->prefix, sizeof(buf));
|
size_t _len = strlcpy(buf, glsl->shader->prefix, sizeof(buf));
|
||||||
strlcat(buf, base, sizeof(buf));
|
strlcpy(buf + _len, base, sizeof(buf) - _len);
|
||||||
if ((loc = glGetUniformLocation(prog, buf)) >= 0)
|
if ((loc = glGetUniformLocation(prog, buf)) >= 0)
|
||||||
return loc;
|
return loc;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(glsl_prefixes); i++)
|
for (i = 0; i < ARRAY_SIZE(glsl_prefixes); i++)
|
||||||
{
|
{
|
||||||
strlcpy(buf, glsl_prefixes[i], sizeof(buf));
|
_len = strlcpy(buf, glsl_prefixes[i], sizeof(buf));
|
||||||
strlcat(buf, base, sizeof(buf));
|
strlcpy(buf + _len, base, sizeof(buf) - _len);
|
||||||
if ((loc = glGetAttribLocation(prog, buf)) >= 0)
|
if ((loc = glGetAttribLocation(prog, buf)) >= 0)
|
||||||
return loc;
|
return loc;
|
||||||
}
|
}
|
||||||
@ -682,28 +682,33 @@ static void gl_glsl_find_uniforms_frame(glsl_shader_data_t *glsl,
|
|||||||
GLuint prog,
|
GLuint prog,
|
||||||
struct shader_uniforms_frame *frame, const char *base)
|
struct shader_uniforms_frame *frame, const char *base)
|
||||||
{
|
{
|
||||||
char texture[64];
|
char uni[64];
|
||||||
char texture_size[64];
|
size_t _len = strlcpy(uni, base, sizeof(uni));
|
||||||
char input_size[64];
|
|
||||||
char tex_coord[64];
|
|
||||||
|
|
||||||
strlcpy(texture, base, sizeof(texture));
|
|
||||||
strlcat(texture, "Texture", sizeof(texture));
|
|
||||||
strlcpy(texture_size, base, sizeof(texture_size));
|
|
||||||
strlcat(texture_size, "TextureSize", sizeof(texture_size));
|
|
||||||
strlcpy(input_size, base, sizeof(input_size));
|
|
||||||
strlcat(input_size, "InputSize", sizeof(input_size));
|
|
||||||
strlcpy(tex_coord, base, sizeof(tex_coord));
|
|
||||||
strlcat(tex_coord, "TexCoord", sizeof(tex_coord));
|
|
||||||
|
|
||||||
if (frame->texture < 0)
|
if (frame->texture < 0)
|
||||||
frame->texture = gl_glsl_get_uniform(glsl, prog, texture);
|
{
|
||||||
if (frame->texture_size < 0)
|
strlcpy(uni + _len, "Texture", sizeof(uni) - _len);
|
||||||
frame->texture_size = gl_glsl_get_uniform(glsl, prog, texture_size);
|
frame->texture = gl_glsl_get_uniform(glsl, prog, uni);
|
||||||
if (frame->input_size < 0)
|
}
|
||||||
frame->input_size = gl_glsl_get_uniform(glsl, prog, input_size);
|
|
||||||
if (frame->tex_coord < 0)
|
if (frame->tex_coord < 0)
|
||||||
frame->tex_coord = gl_glsl_get_attrib(glsl, prog, tex_coord);
|
{
|
||||||
|
strlcpy(uni + _len, "TexCoord", sizeof(uni) - _len);
|
||||||
|
frame->tex_coord = gl_glsl_get_attrib(glsl, prog, uni);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (frame->input_size < 0)
|
||||||
|
{
|
||||||
|
strlcpy(uni + _len, "InputSize", sizeof(uni) - _len);
|
||||||
|
frame->input_size = gl_glsl_get_uniform(glsl, prog, uni);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (frame->texture_size < 0)
|
||||||
|
{
|
||||||
|
strlcpy(uni + _len, "TextureSize", sizeof(uni) - _len);
|
||||||
|
frame->texture_size = gl_glsl_get_uniform(glsl, prog, uni);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gl_glsl_find_uniforms(glsl_shader_data_t *glsl,
|
static void gl_glsl_find_uniforms(glsl_shader_data_t *glsl,
|
||||||
|
@ -4919,7 +4919,8 @@ static unsigned menu_displaylist_parse_content_information(
|
|||||||
tmp[_len+1] = ' ';
|
tmp[_len+1] = ' ';
|
||||||
tmp[_len+2] = '\n';
|
tmp[_len+2] = '\n';
|
||||||
tmp[_len+3] = '\0';
|
tmp[_len+3] = '\0';
|
||||||
strlcat(tmp, rcheevos_get_hash(), sizeof(tmp));
|
_len += 3;
|
||||||
|
strlcpy(tmp + _len, rcheevos_get_hash(), sizeof(tmp) - _len);
|
||||||
if (menu_entries_append(info_list, tmp, cheevos_hash_str,
|
if (menu_entries_append(info_list, tmp, cheevos_hash_str,
|
||||||
MENU_ENUM_LABEL_VALUE_CONTENT_INFO_CHEEVOS_HASH,
|
MENU_ENUM_LABEL_VALUE_CONTENT_INFO_CHEEVOS_HASH,
|
||||||
0, 0, 0, NULL))
|
0, 0, 0, NULL))
|
||||||
|
@ -2883,6 +2883,7 @@ static bool menu_shader_manager_save_preset_internal(
|
|||||||
const char **target_dirs,
|
const char **target_dirs,
|
||||||
size_t num_target_dirs)
|
size_t num_target_dirs)
|
||||||
{
|
{
|
||||||
|
size_t _len;
|
||||||
char fullname[PATH_MAX_LENGTH];
|
char fullname[PATH_MAX_LENGTH];
|
||||||
char buffer[PATH_MAX_LENGTH];
|
char buffer[PATH_MAX_LENGTH];
|
||||||
const char *preset_ext = NULL;
|
const char *preset_ext = NULL;
|
||||||
@ -2898,10 +2899,10 @@ static bool menu_shader_manager_save_preset_internal(
|
|||||||
preset_ext = video_shader_get_preset_extension(type);
|
preset_ext = video_shader_get_preset_extension(type);
|
||||||
|
|
||||||
if (!string_is_empty(basename))
|
if (!string_is_empty(basename))
|
||||||
strlcpy(fullname, basename, sizeof(fullname));
|
_len = strlcpy(fullname, basename, sizeof(fullname));
|
||||||
else
|
else
|
||||||
strlcpy(fullname, "retroarch", sizeof(fullname));
|
_len = strlcpy(fullname, "retroarch", sizeof(fullname));
|
||||||
strlcat(fullname, preset_ext, sizeof(fullname));
|
strlcpy(fullname + _len, preset_ext, sizeof(fullname) - _len);
|
||||||
|
|
||||||
if (path_is_absolute(fullname))
|
if (path_is_absolute(fullname))
|
||||||
{
|
{
|
||||||
|
@ -125,6 +125,7 @@ static void task_overlay_desc_populate_eightway_config(
|
|||||||
struct overlay_desc *desc,
|
struct overlay_desc *desc,
|
||||||
unsigned ol_idx, unsigned desc_idx)
|
unsigned ol_idx, unsigned desc_idx)
|
||||||
{
|
{
|
||||||
|
size_t _len;
|
||||||
input_driver_state_t *input_st = input_state_get_ptr();
|
input_driver_state_t *input_st = input_state_get_ptr();
|
||||||
overlay_eightway_config_t *eightway;
|
overlay_eightway_config_t *eightway;
|
||||||
char conf_key_base[20];
|
char conf_key_base[20];
|
||||||
@ -169,38 +170,35 @@ static void task_overlay_desc_populate_eightway_config(
|
|||||||
|
|
||||||
/* Redefine eightway vals if specified in conf
|
/* Redefine eightway vals if specified in conf
|
||||||
*/
|
*/
|
||||||
strlcpy(conf_key, conf_key_base, sizeof(conf_key));
|
_len = strlcpy(conf_key, conf_key_base, sizeof(conf_key));
|
||||||
strlcat(conf_key, "_up", sizeof(conf_key));
|
strlcpy(conf_key + _len, "_up", sizeof(conf_key) - _len);
|
||||||
if (config_get_string(loader->conf, conf_key, &str))
|
if (config_get_string(loader->conf, conf_key, &str))
|
||||||
{
|
{
|
||||||
task_overlay_redefine_eightway_direction(str, &eightway->up);
|
task_overlay_redefine_eightway_direction(str, &eightway->up);
|
||||||
free(str);
|
free(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
strlcpy(conf_key, conf_key_base, sizeof(conf_key));
|
strlcpy(conf_key + _len, "_down", sizeof(conf_key) - _len);
|
||||||
strlcat(conf_key, "_down", sizeof(conf_key));
|
|
||||||
if (config_get_string(loader->conf, conf_key, &str))
|
if (config_get_string(loader->conf, conf_key, &str))
|
||||||
{
|
{
|
||||||
task_overlay_redefine_eightway_direction(str, &eightway->down);
|
task_overlay_redefine_eightway_direction(str, &eightway->down);
|
||||||
free(str);
|
free(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
strlcpy(conf_key, conf_key_base, sizeof(conf_key));
|
strlcpy(conf_key + _len, "_left", sizeof(conf_key) - _len);
|
||||||
strlcat(conf_key, "_right", sizeof(conf_key));
|
|
||||||
if (config_get_string(loader->conf, conf_key, &str))
|
|
||||||
{
|
|
||||||
task_overlay_redefine_eightway_direction(str, &eightway->right);
|
|
||||||
free(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
strlcpy(conf_key, conf_key_base, sizeof(conf_key));
|
|
||||||
strlcat(conf_key, "_left", sizeof(conf_key));
|
|
||||||
if (config_get_string(loader->conf, conf_key, &str))
|
if (config_get_string(loader->conf, conf_key, &str))
|
||||||
{
|
{
|
||||||
task_overlay_redefine_eightway_direction(str, &eightway->left);
|
task_overlay_redefine_eightway_direction(str, &eightway->left);
|
||||||
free(str);
|
free(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strlcpy(conf_key + _len, "_right", sizeof(conf_key) - _len);
|
||||||
|
if (config_get_string(loader->conf, conf_key, &str))
|
||||||
|
{
|
||||||
|
task_overlay_redefine_eightway_direction(str, &eightway->right);
|
||||||
|
free(str);
|
||||||
|
}
|
||||||
|
|
||||||
/* Prepopulate diagonals.
|
/* Prepopulate diagonals.
|
||||||
*/
|
*/
|
||||||
bits_or_bits(eightway->up_right.data, eightway->up.data,
|
bits_or_bits(eightway->up_right.data, eightway->up.data,
|
||||||
@ -232,10 +230,11 @@ static bool task_overlay_load_desc(
|
|||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
bool normalized, float alpha_mod, float range_mod)
|
bool normalized, float alpha_mod, float range_mod)
|
||||||
{
|
{
|
||||||
|
size_t _len;
|
||||||
float width_mod, height_mod;
|
float width_mod, height_mod;
|
||||||
char conf_key[64];
|
char conf_key[64];
|
||||||
char overlay_desc_key[32];
|
char overlay_desc_key[32];
|
||||||
char overlay_desc_normalized_key[32];
|
char overlay_key[64];
|
||||||
char overlay[256];
|
char overlay[256];
|
||||||
float tmp_float = 0.0f;
|
float tmp_float = 0.0f;
|
||||||
bool tmp_bool = false;
|
bool tmp_bool = false;
|
||||||
@ -249,17 +248,16 @@ static bool task_overlay_load_desc(
|
|||||||
config_file_t *conf = loader->conf;
|
config_file_t *conf = loader->conf;
|
||||||
|
|
||||||
overlay_desc_key[0] =
|
overlay_desc_key[0] =
|
||||||
|
overlay_key[0] =
|
||||||
conf_key[0] =
|
conf_key[0] =
|
||||||
overlay[0] = '\0';
|
overlay[0] = '\0';
|
||||||
|
|
||||||
snprintf(overlay_desc_key, sizeof(overlay_desc_key),
|
snprintf(overlay_desc_key, sizeof(overlay_desc_key),
|
||||||
"overlay%u_desc%u", ol_idx, desc_idx);
|
"overlay%u_desc%u", ol_idx, desc_idx);
|
||||||
|
|
||||||
strlcpy(overlay_desc_normalized_key, overlay_desc_key,
|
_len = strlcpy(overlay_key, overlay_desc_key, sizeof(overlay_key));
|
||||||
sizeof(overlay_desc_normalized_key));
|
strlcpy(overlay_key + _len, "_normalized", sizeof(overlay_key) - _len);
|
||||||
strlcat(overlay_desc_normalized_key, "_normalized",
|
if (config_get_bool(conf, overlay_key, &tmp_bool))
|
||||||
sizeof(overlay_desc_normalized_key));
|
|
||||||
if (config_get_bool(conf, overlay_desc_normalized_key, &tmp_bool))
|
|
||||||
normalized = tmp_bool;
|
normalized = tmp_bool;
|
||||||
|
|
||||||
by_pixel = !normalized;
|
by_pixel = !normalized;
|
||||||
@ -329,12 +327,9 @@ static bool task_overlay_load_desc(
|
|||||||
|
|
||||||
if (BIT256_GET(desc->button_mask, RARCH_OVERLAY_NEXT))
|
if (BIT256_GET(desc->button_mask, RARCH_OVERLAY_NEXT))
|
||||||
{
|
{
|
||||||
char overlay_target_key[64];
|
strlcpy(overlay_key + _len, "_next_target",
|
||||||
strlcpy(overlay_target_key, overlay_desc_key,
|
sizeof(overlay_key) - _len);
|
||||||
sizeof(overlay_target_key));
|
config_get_array(conf, overlay_key,
|
||||||
strlcat(overlay_target_key, "_next_target",
|
|
||||||
sizeof(overlay_target_key));
|
|
||||||
config_get_array(conf, overlay_target_key,
|
|
||||||
desc->next_index_name, sizeof(desc->next_index_name));
|
desc->next_index_name, sizeof(desc->next_index_name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -370,28 +365,20 @@ static bool task_overlay_load_desc(
|
|||||||
{
|
{
|
||||||
case OVERLAY_TYPE_ANALOG_LEFT:
|
case OVERLAY_TYPE_ANALOG_LEFT:
|
||||||
case OVERLAY_TYPE_ANALOG_RIGHT:
|
case OVERLAY_TYPE_ANALOG_RIGHT:
|
||||||
|
if (desc->hitbox != OVERLAY_HITBOX_RADIAL)
|
||||||
{
|
{
|
||||||
char overlay_analog_saturate_key[64];
|
RARCH_ERR("[Overlay]: Analog hitbox type must be \"radial\".\n");
|
||||||
|
ret = false;
|
||||||
overlay_analog_saturate_key[0] = '\0';
|
goto end;
|
||||||
|
|
||||||
if (desc->hitbox != OVERLAY_HITBOX_RADIAL)
|
|
||||||
{
|
|
||||||
RARCH_ERR("[Overlay]: Analog hitbox type must be \"radial\".\n");
|
|
||||||
ret = false;
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
strlcpy(overlay_analog_saturate_key, overlay_desc_key,
|
|
||||||
sizeof(overlay_analog_saturate_key));
|
|
||||||
strlcat(overlay_analog_saturate_key, "_saturate_pct",
|
|
||||||
sizeof(overlay_analog_saturate_key));
|
|
||||||
if (config_get_float(conf, overlay_analog_saturate_key,
|
|
||||||
&tmp_float))
|
|
||||||
desc->analog_saturate_pct = tmp_float;
|
|
||||||
else
|
|
||||||
desc->analog_saturate_pct = 1.0f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strlcpy(overlay_key + _len, "_saturate_pct",
|
||||||
|
sizeof(overlay_key) - _len);
|
||||||
|
if (config_get_float(conf, overlay_key,
|
||||||
|
&tmp_float))
|
||||||
|
desc->analog_saturate_pct = tmp_float;
|
||||||
|
else
|
||||||
|
desc->analog_saturate_pct = 1.0f;
|
||||||
break;
|
break;
|
||||||
case OVERLAY_TYPE_DPAD_AREA:
|
case OVERLAY_TYPE_DPAD_AREA:
|
||||||
case OVERLAY_TYPE_ABXY_AREA:
|
case OVERLAY_TYPE_ABXY_AREA:
|
||||||
@ -407,46 +394,72 @@ static bool task_overlay_load_desc(
|
|||||||
desc->range_x = (float)strtod(list.elems[4].data, NULL) * width_mod;
|
desc->range_x = (float)strtod(list.elems[4].data, NULL) * width_mod;
|
||||||
desc->range_y = (float)strtod(list.elems[5].data, NULL) * height_mod;
|
desc->range_y = (float)strtod(list.elems[5].data, NULL) * height_mod;
|
||||||
|
|
||||||
strlcpy(conf_key, overlay_desc_key, sizeof(conf_key));
|
_len = strlcpy(conf_key, overlay_desc_key, sizeof(conf_key));
|
||||||
strlcat(conf_key, "_reach_right", sizeof(conf_key));
|
|
||||||
desc->reach_right = 1.0f;
|
|
||||||
if (config_get_float(conf, conf_key, &tmp_float))
|
|
||||||
desc->reach_right = tmp_float;
|
|
||||||
|
|
||||||
strlcpy(conf_key, overlay_desc_key, sizeof(conf_key));
|
strlcpy(conf_key + _len, "_reach_x", sizeof(conf_key) - _len);
|
||||||
strlcat(conf_key, "_reach_left", sizeof(conf_key));
|
|
||||||
desc->reach_left = 1.0f;
|
|
||||||
if (config_get_float(conf, conf_key, &tmp_float))
|
|
||||||
desc->reach_left = tmp_float;
|
|
||||||
|
|
||||||
strlcpy(conf_key, overlay_desc_key, sizeof(conf_key));
|
|
||||||
strlcat(conf_key, "_reach_up", sizeof(conf_key));
|
|
||||||
desc->reach_up = 1.0f;
|
|
||||||
if (config_get_float(conf, conf_key, &tmp_float))
|
|
||||||
desc->reach_up = tmp_float;
|
|
||||||
|
|
||||||
strlcpy(conf_key, overlay_desc_key, sizeof(conf_key));
|
|
||||||
strlcat(conf_key, "_reach_down", sizeof(conf_key));
|
|
||||||
desc->reach_down = 1.0f;
|
|
||||||
if (config_get_float(conf, conf_key, &tmp_float))
|
|
||||||
desc->reach_down = tmp_float;
|
|
||||||
|
|
||||||
strlcpy(conf_key, overlay_desc_key, sizeof(conf_key));
|
|
||||||
strlcat(conf_key, "_reach_x", sizeof(conf_key));
|
|
||||||
if (config_get_float(conf, conf_key, &tmp_float))
|
if (config_get_float(conf, conf_key, &tmp_float))
|
||||||
{
|
{
|
||||||
desc->reach_right = tmp_float;
|
desc->reach_right = tmp_float;
|
||||||
desc->reach_left = tmp_float;
|
desc->reach_left = tmp_float;
|
||||||
}
|
}
|
||||||
|
|
||||||
strlcpy(conf_key, overlay_desc_key, sizeof(conf_key));
|
strlcpy(conf_key + _len, "_reach_y", sizeof(conf_key) - _len);
|
||||||
strlcat(conf_key, "_reach_y", sizeof(conf_key));
|
|
||||||
if (config_get_float(conf, conf_key, &tmp_float))
|
if (config_get_float(conf, conf_key, &tmp_float))
|
||||||
{
|
{
|
||||||
desc->reach_up = tmp_float;
|
desc->reach_up = tmp_float;
|
||||||
desc->reach_down = tmp_float;
|
desc->reach_down = tmp_float;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strlcpy(conf_key + _len, "_movable", sizeof(conf_key) - _len);
|
||||||
|
desc->flags &= ~OVERLAY_DESC_MOVABLE;
|
||||||
|
desc->delta_x = 0.0f;
|
||||||
|
desc->delta_y = 0.0f;
|
||||||
|
if (config_get_bool(conf, conf_key, &tmp_bool)
|
||||||
|
&& tmp_bool)
|
||||||
|
desc->flags |= OVERLAY_DESC_MOVABLE;
|
||||||
|
|
||||||
|
strlcpy(conf_key + _len, "_reach_up", sizeof(conf_key) - _len);
|
||||||
|
desc->reach_up = 1.0f;
|
||||||
|
if (config_get_float(conf, conf_key, &tmp_float))
|
||||||
|
desc->reach_up = tmp_float;
|
||||||
|
|
||||||
|
strlcpy(conf_key + _len, "_alpha_mod", sizeof(conf_key) - _len);
|
||||||
|
desc->alpha_mod = alpha_mod;
|
||||||
|
if (config_get_float(conf, conf_key, &tmp_float))
|
||||||
|
desc->alpha_mod = tmp_float;
|
||||||
|
|
||||||
|
strlcpy(conf_key + _len, "_range_mod", sizeof(conf_key) - _len);
|
||||||
|
desc->range_mod = range_mod;
|
||||||
|
if (config_get_float(conf, conf_key, &tmp_float))
|
||||||
|
desc->range_mod = tmp_float;
|
||||||
|
|
||||||
|
strlcpy(conf_key + _len, "_exclusive", sizeof(conf_key) - _len);
|
||||||
|
desc->flags &= ~OVERLAY_DESC_EXCLUSIVE;
|
||||||
|
if (config_get_bool(conf, conf_key, &tmp_bool)
|
||||||
|
&& tmp_bool)
|
||||||
|
desc->flags |= OVERLAY_DESC_EXCLUSIVE;
|
||||||
|
|
||||||
|
strlcpy(conf_key + _len, "_reach_down", sizeof(conf_key) - _len);
|
||||||
|
desc->reach_down = 1.0f;
|
||||||
|
if (config_get_float(conf, conf_key, &tmp_float))
|
||||||
|
desc->reach_down = tmp_float;
|
||||||
|
|
||||||
|
strlcpy(conf_key + _len, "_reach_left", sizeof(conf_key) - _len);
|
||||||
|
desc->reach_left = 1.0f;
|
||||||
|
if (config_get_float(conf, conf_key, &tmp_float))
|
||||||
|
desc->reach_left = tmp_float;
|
||||||
|
|
||||||
|
strlcpy(conf_key + _len, "_reach_right", sizeof(conf_key) - _len);
|
||||||
|
desc->reach_right = 1.0f;
|
||||||
|
if (config_get_float(conf, conf_key, &tmp_float))
|
||||||
|
desc->reach_right = tmp_float;
|
||||||
|
|
||||||
|
strlcpy(conf_key + _len, "_range_mod_exclusive", sizeof(conf_key) - _len);
|
||||||
|
desc->flags &= ~OVERLAY_DESC_RANGE_MOD_EXCLUSIVE;
|
||||||
|
if (config_get_bool(conf, conf_key, &tmp_bool)
|
||||||
|
&& tmp_bool)
|
||||||
|
desc->flags |= OVERLAY_DESC_RANGE_MOD_EXCLUSIVE;
|
||||||
|
|
||||||
if ( (desc->reach_left == 0.0f && desc->reach_right == 0.0f)
|
if ( (desc->reach_left == 0.0f && desc->reach_right == 0.0f)
|
||||||
|| (desc->reach_up == 0.0f && desc->reach_down == 0.0f))
|
|| (desc->reach_up == 0.0f && desc->reach_down == 0.0f))
|
||||||
desc->hitbox = OVERLAY_HITBOX_NONE;
|
desc->hitbox = OVERLAY_HITBOX_NONE;
|
||||||
@ -456,42 +469,6 @@ static bool task_overlay_load_desc(
|
|||||||
desc->mod_y = desc->y - desc->range_y;
|
desc->mod_y = desc->y - desc->range_y;
|
||||||
desc->mod_h = 2.0f * desc->range_y;
|
desc->mod_h = 2.0f * desc->range_y;
|
||||||
|
|
||||||
strlcpy(conf_key, overlay_desc_key, sizeof(conf_key));
|
|
||||||
strlcat(conf_key, "_alpha_mod", sizeof(conf_key));
|
|
||||||
desc->alpha_mod = alpha_mod;
|
|
||||||
if (config_get_float(conf, conf_key, &tmp_float))
|
|
||||||
desc->alpha_mod = tmp_float;
|
|
||||||
|
|
||||||
strlcpy(conf_key, overlay_desc_key, sizeof(conf_key));
|
|
||||||
strlcat(conf_key, "_range_mod", sizeof(conf_key));
|
|
||||||
desc->range_mod = range_mod;
|
|
||||||
if (config_get_float(conf, conf_key, &tmp_float))
|
|
||||||
desc->range_mod = tmp_float;
|
|
||||||
|
|
||||||
strlcpy(conf_key, overlay_desc_key, sizeof(conf_key));
|
|
||||||
strlcat(conf_key, "_exclusive", sizeof(conf_key));
|
|
||||||
desc->flags &= ~OVERLAY_DESC_EXCLUSIVE;
|
|
||||||
if (config_get_bool(conf, conf_key, &tmp_bool)
|
|
||||||
&& tmp_bool)
|
|
||||||
desc->flags |= OVERLAY_DESC_EXCLUSIVE;
|
|
||||||
|
|
||||||
strlcpy(conf_key, overlay_desc_key, sizeof(conf_key));
|
|
||||||
strlcat(conf_key, "_range_mod_exclusive", sizeof(conf_key));
|
|
||||||
desc->flags &= ~OVERLAY_DESC_RANGE_MOD_EXCLUSIVE;
|
|
||||||
if (config_get_bool(conf, conf_key, &tmp_bool)
|
|
||||||
&& tmp_bool)
|
|
||||||
desc->flags |= OVERLAY_DESC_RANGE_MOD_EXCLUSIVE;
|
|
||||||
|
|
||||||
strlcpy(conf_key, overlay_desc_key, sizeof(conf_key));
|
|
||||||
strlcat(conf_key, "_movable", sizeof(conf_key));
|
|
||||||
desc->flags &= ~OVERLAY_DESC_MOVABLE;
|
|
||||||
desc->delta_x = 0.0f;
|
|
||||||
desc->delta_y = 0.0f;
|
|
||||||
|
|
||||||
if (config_get_bool(conf, conf_key, &tmp_bool)
|
|
||||||
&& tmp_bool)
|
|
||||||
desc->flags |= OVERLAY_DESC_MOVABLE;
|
|
||||||
|
|
||||||
input_overlay->pos ++;
|
input_overlay->pos ++;
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
@ -192,17 +192,17 @@ static void task_pl_manager_reset_cores_handler(retro_task_t *task)
|
|||||||
|
|
||||||
if (entry)
|
if (entry)
|
||||||
{
|
{
|
||||||
|
size_t _len;
|
||||||
struct playlist_entry update_entry = {0};
|
struct playlist_entry update_entry = {0};
|
||||||
char task_title[PATH_MAX_LENGTH];
|
char task_title[PATH_MAX_LENGTH];
|
||||||
/* Update progress display */
|
/* Update progress display */
|
||||||
task_free_title(task);
|
task_free_title(task);
|
||||||
strlcpy(
|
_len = strlcpy(task_title,
|
||||||
task_title,
|
msg_hash_to_str(MSG_PLAYLIST_MANAGER_RESETTING_CORES),
|
||||||
msg_hash_to_str(MSG_PLAYLIST_MANAGER_RESETTING_CORES),
|
|
||||||
sizeof(task_title));
|
sizeof(task_title));
|
||||||
|
|
||||||
if (!string_is_empty(entry->label))
|
if (!string_is_empty(entry->label))
|
||||||
strlcat(task_title, entry->label, sizeof(task_title));
|
strlcpy(task_title + _len, entry->label, sizeof(task_title) - _len);
|
||||||
else if (!string_is_empty(entry->path))
|
else if (!string_is_empty(entry->path))
|
||||||
{
|
{
|
||||||
char entry_name[PATH_MAX_LENGTH];
|
char entry_name[PATH_MAX_LENGTH];
|
||||||
@ -232,15 +232,16 @@ static void task_pl_manager_reset_cores_handler(retro_task_t *task)
|
|||||||
break;
|
break;
|
||||||
case PL_MANAGER_END:
|
case PL_MANAGER_END:
|
||||||
{
|
{
|
||||||
|
size_t _len;
|
||||||
char task_title[PATH_MAX_LENGTH];
|
char task_title[PATH_MAX_LENGTH];
|
||||||
/* Save playlist changes to disk */
|
/* Save playlist changes to disk */
|
||||||
playlist_write_file(pl_manager->playlist);
|
playlist_write_file(pl_manager->playlist);
|
||||||
/* Update progress display */
|
/* Update progress display */
|
||||||
task_free_title(task);
|
task_free_title(task);
|
||||||
strlcpy(
|
_len = strlcpy(task_title,
|
||||||
task_title, msg_hash_to_str(MSG_PLAYLIST_MANAGER_CORES_RESET),
|
msg_hash_to_str(MSG_PLAYLIST_MANAGER_CORES_RESET),
|
||||||
sizeof(task_title));
|
sizeof(task_title));
|
||||||
strlcat(task_title, pl_manager->playlist_name, sizeof(task_title));
|
strlcpy(task_title + _len, pl_manager->playlist_name, sizeof(task_title) - _len);
|
||||||
|
|
||||||
task_set_title(task, strdup(task_title));
|
task_set_title(task, strdup(task_title));
|
||||||
}
|
}
|
||||||
@ -278,6 +279,7 @@ static bool task_pl_manager_reset_cores_finder(
|
|||||||
|
|
||||||
bool task_push_pl_manager_reset_cores(const playlist_config_t *playlist_config)
|
bool task_push_pl_manager_reset_cores(const playlist_config_t *playlist_config)
|
||||||
{
|
{
|
||||||
|
size_t _len;
|
||||||
task_finder_data_t find_data;
|
task_finder_data_t find_data;
|
||||||
char playlist_name[PATH_MAX_LENGTH];
|
char playlist_name[PATH_MAX_LENGTH];
|
||||||
char task_title[PATH_MAX_LENGTH];
|
char task_title[PATH_MAX_LENGTH];
|
||||||
@ -318,11 +320,10 @@ bool task_push_pl_manager_reset_cores(const playlist_config_t *playlist_config)
|
|||||||
pl_manager->status = PL_MANAGER_BEGIN;
|
pl_manager->status = PL_MANAGER_BEGIN;
|
||||||
|
|
||||||
/* Configure task */
|
/* Configure task */
|
||||||
strlcpy(
|
_len = strlcpy(task_title,
|
||||||
task_title,
|
msg_hash_to_str(MSG_PLAYLIST_MANAGER_RESETTING_CORES),
|
||||||
msg_hash_to_str(MSG_PLAYLIST_MANAGER_RESETTING_CORES),
|
|
||||||
sizeof(task_title));
|
sizeof(task_title));
|
||||||
strlcat(task_title, playlist_name, sizeof(task_title));
|
strlcpy(task_title + _len, playlist_name, sizeof(task_title) - _len);
|
||||||
|
|
||||||
task->handler = task_pl_manager_reset_cores_handler;
|
task->handler = task_pl_manager_reset_cores_handler;
|
||||||
task->state = pl_manager;
|
task->state = pl_manager;
|
||||||
@ -652,15 +653,17 @@ static void task_pl_manager_clean_playlist_handler(retro_task_t *task)
|
|||||||
break;
|
break;
|
||||||
case PL_MANAGER_END:
|
case PL_MANAGER_END:
|
||||||
{
|
{
|
||||||
|
size_t _len;
|
||||||
char task_title[PATH_MAX_LENGTH];
|
char task_title[PATH_MAX_LENGTH];
|
||||||
/* Save playlist changes to disk */
|
/* Save playlist changes to disk */
|
||||||
playlist_write_file(pl_manager->playlist);
|
playlist_write_file(pl_manager->playlist);
|
||||||
/* Update progress display */
|
/* Update progress display */
|
||||||
task_free_title(task);
|
task_free_title(task);
|
||||||
strlcpy(
|
_len = strlcpy(task_title,
|
||||||
task_title, msg_hash_to_str(MSG_PLAYLIST_MANAGER_PLAYLIST_CLEANED),
|
msg_hash_to_str(MSG_PLAYLIST_MANAGER_PLAYLIST_CLEANED),
|
||||||
sizeof(task_title));
|
sizeof(task_title));
|
||||||
strlcat(task_title, pl_manager->playlist_name, sizeof(task_title));
|
strlcpy(task_title + _len, pl_manager->playlist_name,
|
||||||
|
sizeof(task_title) - _len);
|
||||||
|
|
||||||
task_set_title(task, strdup(task_title));
|
task_set_title(task, strdup(task_title));
|
||||||
}
|
}
|
||||||
@ -700,6 +703,7 @@ static bool task_pl_manager_clean_playlist_finder(
|
|||||||
bool task_push_pl_manager_clean_playlist(
|
bool task_push_pl_manager_clean_playlist(
|
||||||
const playlist_config_t *playlist_config)
|
const playlist_config_t *playlist_config)
|
||||||
{
|
{
|
||||||
|
size_t _len;
|
||||||
task_finder_data_t find_data;
|
task_finder_data_t find_data;
|
||||||
char playlist_name[PATH_MAX_LENGTH];
|
char playlist_name[PATH_MAX_LENGTH];
|
||||||
char task_title[PATH_MAX_LENGTH];
|
char task_title[PATH_MAX_LENGTH];
|
||||||
@ -743,11 +747,10 @@ bool task_push_pl_manager_clean_playlist(
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* Configure task */
|
/* Configure task */
|
||||||
strlcpy(
|
_len = strlcpy(task_title,
|
||||||
task_title,
|
msg_hash_to_str(MSG_PLAYLIST_MANAGER_CLEANING_PLAYLIST),
|
||||||
msg_hash_to_str(MSG_PLAYLIST_MANAGER_CLEANING_PLAYLIST),
|
|
||||||
sizeof(task_title));
|
sizeof(task_title));
|
||||||
strlcat(task_title, playlist_name, sizeof(task_title));
|
strlcpy(task_title + _len, playlist_name, sizeof(task_title) - _len);
|
||||||
|
|
||||||
task->handler = task_pl_manager_clean_playlist_handler;
|
task->handler = task_pl_manager_clean_playlist_handler;
|
||||||
task->state = pl_manager;
|
task->state = pl_manager;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user