mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
Silence unused variable warnings
This commit is contained in:
parent
dd489312ea
commit
23bd9686e5
@ -2321,13 +2321,12 @@ static void rc_hash_reset_cdreader_hooks(void)
|
||||
|
||||
static void rcheevos_show_game_placard(void)
|
||||
{
|
||||
size_t len;
|
||||
char msg[256];
|
||||
int len;
|
||||
const settings_t* settings = config_get_ptr();
|
||||
rc_client_user_game_summary_t summary;
|
||||
|
||||
const settings_t* settings = config_get_ptr();
|
||||
const rc_client_game_t* game = rc_client_get_game_info(rcheevos_locals.client);
|
||||
if (!game) /* make sure there's actually a game loaded */
|
||||
if (!game) /* Make sure there's actually a game loaded */
|
||||
return;
|
||||
|
||||
rc_client_get_user_game_summary(rcheevos_locals.client, &summary);
|
||||
@ -2342,18 +2341,14 @@ static void rcheevos_show_game_placard(void)
|
||||
(int)summary.num_unofficial_achievements);
|
||||
}
|
||||
else if (rc_client_get_encore_mode_enabled(rcheevos_locals.client))
|
||||
{
|
||||
len = snprintf(msg, sizeof(msg),
|
||||
msg_hash_to_str(MSG_CHEEVOS_ALL_ACHIEVEMENTS_ACTIVATED),
|
||||
(int)summary.num_core_achievements);
|
||||
}
|
||||
else
|
||||
{
|
||||
len = snprintf(msg, sizeof(msg),
|
||||
msg_hash_to_str(MSG_CHEEVOS_NUMBER_ACHIEVEMENTS_UNLOCKED),
|
||||
(int)summary.num_unlocked_achievements,
|
||||
(int)summary.num_core_achievements);
|
||||
}
|
||||
|
||||
if (summary.num_unsupported_achievements)
|
||||
{
|
||||
@ -2362,14 +2357,14 @@ static void rcheevos_show_game_placard(void)
|
||||
msg[len++] = ' ';
|
||||
msg[len++] = '(';
|
||||
|
||||
len += snprintf(&msg[len], sizeof(msg) - len,
|
||||
msg_hash_to_str(MSG_CHEEVOS_UNSUPPORTED_COUNT),
|
||||
(int)summary.num_unsupported_achievements);
|
||||
len += snprintf(&msg[len], sizeof(msg) - len,
|
||||
msg_hash_to_str(MSG_CHEEVOS_UNSUPPORTED_COUNT),
|
||||
(int)summary.num_unsupported_achievements);
|
||||
|
||||
if (len < sizeof(msg) - 1)
|
||||
{
|
||||
msg[len++] = ')';
|
||||
msg[len] = '\0';
|
||||
msg[len] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2377,21 +2372,23 @@ static void rcheevos_show_game_placard(void)
|
||||
msg[sizeof(msg) - 1] = 0;
|
||||
CHEEVOS_LOG(RCHEEVOS_TAG "%s\n", msg);
|
||||
|
||||
if (settings->uints.cheevos_visibility_summary == RCHEEVOS_SUMMARY_ALLGAMES ||
|
||||
(settings->uints.cheevos_visibility_summary == RCHEEVOS_SUMMARY_HASCHEEVOS &&
|
||||
(summary.num_core_achievements || summary.num_unofficial_achievements)))
|
||||
if ( settings->uints.cheevos_visibility_summary == RCHEEVOS_SUMMARY_ALLGAMES
|
||||
|| (settings->uints.cheevos_visibility_summary == RCHEEVOS_SUMMARY_HASCHEEVOS
|
||||
&& (summary.num_core_achievements || summary.num_unofficial_achievements)))
|
||||
{
|
||||
#if defined (HAVE_GFX_WIDGETS)
|
||||
if (gfx_widgets_ready())
|
||||
{
|
||||
char badge_name[32];
|
||||
size_t _len = strlcpy(badge_name, "i", sizeof(badge_name));
|
||||
_len += strlcpy(badge_name + _len, game->badge_name, sizeof(badge_name) - _len);
|
||||
_len += strlcpy(badge_name + _len, game->badge_name,
|
||||
sizeof(badge_name) - _len);
|
||||
gfx_widgets_push_achievement(game->title, msg, badge_name);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
runloop_msg_queue_push(msg, 0, 3 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
runloop_msg_queue_push(msg, 0, 3 * 60, false, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -910,7 +910,6 @@ static struct video_shader_parameter *video_shader_parse_find_parameter(
|
||||
void video_shader_resolve_parameters(struct video_shader *shader)
|
||||
{
|
||||
size_t i;
|
||||
struct video_shader_parameter *param = &shader->parameters[0];
|
||||
|
||||
shader->num_parameters = 0;
|
||||
|
||||
@ -919,87 +918,96 @@ void video_shader_resolve_parameters(struct video_shader *shader)
|
||||
RARCH_DBG("[Shaders]: Finding parameters in shader passes (#pragma parameter)..\n");
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS)
|
||||
for (i = 0; i < shader->passes; i++)
|
||||
{
|
||||
const char *path = shader->pass[i].source.path;
|
||||
uint8_t *buf = NULL;
|
||||
int64_t buf_len = 0;
|
||||
|
||||
if (string_is_empty(path) || !path_is_valid(path))
|
||||
continue;
|
||||
|
||||
#if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS)
|
||||
/* Now uses the same slang parsing for parameters since
|
||||
* it should be the same implementation, but supporting
|
||||
* #include directives */
|
||||
slang_preprocess_parse_parameters(path, shader);
|
||||
}
|
||||
#else
|
||||
/* Read file contents */
|
||||
if (filestream_read_file(path, (void**)&buf, &buf_len))
|
||||
{
|
||||
struct video_shader_parameter *param = &shader->parameters[0];
|
||||
for (i = 0; i < shader->passes; i++)
|
||||
{
|
||||
size_t line_index = 0;
|
||||
struct string_list lines = {0};
|
||||
bool lines_inited = false;
|
||||
const char *path = shader->pass[i].source.path;
|
||||
uint8_t *buf = NULL;
|
||||
int64_t buf_len = 0;
|
||||
|
||||
/* Split into lines */
|
||||
if (buf_len > 0)
|
||||
{
|
||||
string_list_initialize(&lines);
|
||||
lines_inited = string_split_noalloc(&lines, (const char*)buf, "\n");
|
||||
}
|
||||
|
||||
/* Buffer is no longer required - clean up */
|
||||
if ((void*)buf)
|
||||
free((void*)buf);
|
||||
|
||||
if (!lines_inited)
|
||||
if (string_is_empty(path) || !path_is_valid(path))
|
||||
continue;
|
||||
|
||||
/* Even though the pass is set in the loop too,
|
||||
* not all passes have parameters */
|
||||
param->pass = (int)i;
|
||||
|
||||
while ((shader->num_parameters < ARRAY_SIZE(shader->parameters))
|
||||
&& (line_index < lines.size))
|
||||
/* Read file contents */
|
||||
if (filestream_read_file(path, (void**)&buf, &buf_len))
|
||||
{
|
||||
int ret;
|
||||
const char *line = lines.elems[line_index].data;
|
||||
line_index++;
|
||||
size_t line_index = 0;
|
||||
struct string_list lines = {0};
|
||||
bool lines_inited = false;
|
||||
|
||||
/* Check if this is a '#pragma parameter' line */
|
||||
if (strncmp("#pragma parameter", line,
|
||||
STRLEN_CONST("#pragma parameter")))
|
||||
/* Split into lines */
|
||||
if (buf_len > 0)
|
||||
{
|
||||
string_list_initialize(&lines);
|
||||
lines_inited = string_split_noalloc(&lines, (const char*)buf, "\n");
|
||||
}
|
||||
|
||||
/* Buffer is no longer required - clean up */
|
||||
if ((void*)buf)
|
||||
free((void*)buf);
|
||||
|
||||
if (!lines_inited)
|
||||
continue;
|
||||
|
||||
/* Parse line */
|
||||
if ((ret = sscanf(line, "#pragma parameter %63s \"%63[^\"]\" %f %f %f %f",
|
||||
param->id, param->desc, ¶m->initial,
|
||||
¶m->minimum, ¶m->maximum, ¶m->step)) < 5)
|
||||
continue;
|
||||
/* Even though the pass is set in the loop too,
|
||||
* not all passes have parameters */
|
||||
param->pass = (int)i;
|
||||
|
||||
param->id[63] = '\0';
|
||||
param->desc[63] = '\0';
|
||||
while ((shader->num_parameters < ARRAY_SIZE(shader->parameters))
|
||||
&& (line_index < lines.size))
|
||||
{
|
||||
int ret;
|
||||
const char *line = lines.elems[line_index].data;
|
||||
line_index++;
|
||||
|
||||
if (ret == 5)
|
||||
param->step = 0.1f * (param->maximum - param->minimum);
|
||||
/* Check if this is a '#pragma parameter' line */
|
||||
if (strncmp("#pragma parameter", line,
|
||||
STRLEN_CONST("#pragma parameter")))
|
||||
continue;
|
||||
|
||||
param->pass = (int)i;
|
||||
/* Parse line */
|
||||
if ((ret = sscanf(line, "#pragma parameter %63s \"%63[^\"]\" %f %f %f %f",
|
||||
param->id, param->desc, ¶m->initial,
|
||||
¶m->minimum, ¶m->maximum, ¶m->step)) < 5)
|
||||
continue;
|
||||
|
||||
param->id[63] = '\0';
|
||||
param->desc[63] = '\0';
|
||||
|
||||
if (ret == 5)
|
||||
param->step = 0.1f * (param->maximum - param->minimum);
|
||||
|
||||
param->pass = (int)i;
|
||||
|
||||
#ifdef DEBUG
|
||||
RARCH_DBG("[Shaders]: Found #pragma parameter %s (%s) %f %f %f %f in pass %d.\n",
|
||||
param->desc, param->id, param->initial,
|
||||
param->minimum, param->maximum, param->step, param->pass);
|
||||
RARCH_DBG("[Shaders]: Found #pragma parameter %s (%s) %f %f %f %f in pass %d.\n",
|
||||
param->desc, param->id, param->initial,
|
||||
param->minimum, param->maximum, param->step, param->pass);
|
||||
#endif
|
||||
param->current = param->initial;
|
||||
param->current = param->initial;
|
||||
|
||||
shader->num_parameters++;
|
||||
param++;
|
||||
shader->num_parameters++;
|
||||
param++;
|
||||
}
|
||||
|
||||
string_list_deinitialize(&lines);
|
||||
}
|
||||
|
||||
string_list_deinitialize(&lines);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -1127,9 +1135,9 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
|
||||
char *tmp = (char*)malloc(3 * PATH_MAX_LENGTH);
|
||||
char *tmp_rel = tmp + PATH_MAX_LENGTH;
|
||||
char *tmp_base = tmp + 2 * PATH_MAX_LENGTH;
|
||||
config_file_t *conf = NULL;
|
||||
config_file_t *conf = config_file_new_alloc();
|
||||
|
||||
if (!(conf = config_file_new_alloc()))
|
||||
if (!conf)
|
||||
return false;
|
||||
|
||||
if (!tmp)
|
||||
@ -1454,12 +1462,12 @@ static bool video_shader_write_referenced_preset(
|
||||
const char *path_to_save)
|
||||
{
|
||||
size_t i;
|
||||
char config_dir[DIR_MAX_LENGTH];
|
||||
config_file_t *conf = NULL;
|
||||
config_file_t *ref_conf = NULL;
|
||||
struct video_shader *ref_shader = (struct video_shader*)
|
||||
calloc(1, sizeof(*ref_shader));
|
||||
bool ret = false;
|
||||
char *config_dir = (char*)malloc(DIR_MAX_LENGTH);
|
||||
char *path_to_ref = (char*)malloc(PATH_MAX_LENGTH);
|
||||
char* path_to_save_conformed = (char*)malloc(PATH_MAX_LENGTH);
|
||||
|
||||
@ -1880,7 +1888,6 @@ end:
|
||||
config_file_free(conf);
|
||||
config_file_free(ref_conf);
|
||||
free(ref_shader);
|
||||
free(config_dir);
|
||||
free(path_to_ref);
|
||||
free(path_to_save_conformed);
|
||||
|
||||
@ -1929,8 +1936,7 @@ static bool video_shader_load_root_config_into_shader(
|
||||
* the root preset and it is the path to the
|
||||
* simple preset originally loaded, but that is set inside
|
||||
* video_shader_load_preset_into_shader*/
|
||||
strlcpy(shader->loaded_preset_path,
|
||||
conf->path,
|
||||
strlcpy(shader->loaded_preset_path, conf->path,
|
||||
sizeof(shader->loaded_preset_path));
|
||||
|
||||
if (settings->bools.video_shader_watch_files)
|
||||
|
@ -1177,35 +1177,38 @@ size_t fill_pathname_abbreviate_special(char *out_path,
|
||||
*
|
||||
* @path_part : directory or filename
|
||||
*
|
||||
* Takes single part of a path eg. single filename
|
||||
* Takes single part of a path eg. single filename
|
||||
* or directory, and removes any special chars that are
|
||||
* unavailable.
|
||||
*
|
||||
*
|
||||
* @returns new string that has been sanitized
|
||||
**/
|
||||
const char *sanitize_path_part(const char *path_part, size_t size)
|
||||
{
|
||||
int i;
|
||||
int j = 0;
|
||||
int len = 0;
|
||||
char *temp = NULL;
|
||||
char *tmp = NULL;
|
||||
const char *special_chars = "<>:\"/\\|?*";
|
||||
|
||||
if (string_is_empty(path_part))
|
||||
return NULL;
|
||||
|
||||
temp = (char *)malloc((size + 1) * sizeof(char));
|
||||
tmp = (char *)malloc((size + 1) * sizeof(char));
|
||||
|
||||
for (i = 0; path_part[i] != '\0'; i++)
|
||||
/* Check if the current character is one of the special characters */
|
||||
if (strchr(special_chars, path_part[i]) == NULL)
|
||||
/* If not, copy it to the temporary array */
|
||||
temp[j++] = path_part[i];
|
||||
{
|
||||
/* Check if the current character is
|
||||
* one of the special characters */
|
||||
|
||||
temp[j] = '\0';
|
||||
/* If not, copy it to the temporary array */
|
||||
if (!strchr(special_chars, path_part[i]))
|
||||
tmp[j++] = path_part[i];
|
||||
}
|
||||
|
||||
tmp[j] = '\0';
|
||||
|
||||
/* Return the new string */
|
||||
return temp;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -945,13 +945,12 @@ static int action_get_title_group_settings(const char *path, const char *label,
|
||||
}
|
||||
|
||||
{
|
||||
size_t _len;
|
||||
char *tok, *save;
|
||||
char *label_cpy = strdup(label);
|
||||
|
||||
if ((tok = strtok_r(label_cpy, "|", &save)))
|
||||
{
|
||||
_len = strlcpy(s, tok, len);
|
||||
size_t _len = strlcpy(s, tok, len);
|
||||
if ((tok = strtok_r(NULL, "|", &save)))
|
||||
{
|
||||
s[ _len] = ' ';
|
||||
|
Loading…
x
Reference in New Issue
Block a user