mirror of
https://github.com/libretro/RetroArch
synced 2025-02-22 21:40:40 +00:00
Reduce some local char variables which were unnecessarily big,
and reduce some temp char variables
This commit is contained in:
parent
631301b3f7
commit
2ab38eaf98
@ -262,7 +262,7 @@ static void video_shader_replace_wildcards(char *inout_absolute_path,
|
|||||||
break;
|
break;
|
||||||
case RARCH_WILDCARD_CORE_REQUESTED_ROTATION:
|
case RARCH_WILDCARD_CORE_REQUESTED_ROTATION:
|
||||||
{
|
{
|
||||||
char rotation_replace_strings[4][PATH_MAX_LENGTH] = {
|
char rotation_replace_strings[4][64] = {
|
||||||
"CORE-REQ-ROT-0",
|
"CORE-REQ-ROT-0",
|
||||||
"CORE-REQ-ROT-90",
|
"CORE-REQ-ROT-90",
|
||||||
"CORE-REQ-ROT-180",
|
"CORE-REQ-ROT-180",
|
||||||
@ -279,7 +279,7 @@ static void video_shader_replace_wildcards(char *inout_absolute_path,
|
|||||||
break;
|
break;
|
||||||
case RARCH_WILDCARD_VIDEO_USER_ROTATION:
|
case RARCH_WILDCARD_VIDEO_USER_ROTATION:
|
||||||
{
|
{
|
||||||
char rotation_replace_strings[4][PATH_MAX_LENGTH] = {
|
char rotation_replace_strings[4][64] = {
|
||||||
"VID-USER-ROT-0",
|
"VID-USER-ROT-0",
|
||||||
"VID-USER-ROT-90",
|
"VID-USER-ROT-90",
|
||||||
"VID-USER-ROT-180",
|
"VID-USER-ROT-180",
|
||||||
@ -293,7 +293,7 @@ static void video_shader_replace_wildcards(char *inout_absolute_path,
|
|||||||
break;
|
break;
|
||||||
case RARCH_WILDCARD_VIDEO_FINAL_ROTATION:
|
case RARCH_WILDCARD_VIDEO_FINAL_ROTATION:
|
||||||
{
|
{
|
||||||
char rotation_replace_strings[4][PATH_MAX_LENGTH] = {
|
char rotation_replace_strings[4][64] = {
|
||||||
"VID-FINAL-ROT-0",
|
"VID-FINAL-ROT-0",
|
||||||
"VID-FINAL-ROT-90",
|
"VID-FINAL-ROT-90",
|
||||||
"VID-FINAL-ROT-180",
|
"VID-FINAL-ROT-180",
|
||||||
@ -304,7 +304,7 @@ static void video_shader_replace_wildcards(char *inout_absolute_path,
|
|||||||
break;
|
break;
|
||||||
case RARCH_WILDCARD_SCREEN_ORIENTATION:
|
case RARCH_WILDCARD_SCREEN_ORIENTATION:
|
||||||
{
|
{
|
||||||
char rotation_replace_strings[4][PATH_MAX_LENGTH] = {
|
char rotation_replace_strings[4][64] = {
|
||||||
"SCREEN-ORIENT-0",
|
"SCREEN-ORIENT-0",
|
||||||
"SCREEN-ORIENT-90",
|
"SCREEN-ORIENT-90",
|
||||||
"SCREEN-ORIENT-180",
|
"SCREEN-ORIENT-180",
|
||||||
@ -2031,7 +2031,7 @@ static bool video_shader_override_values(config_file_t *override_conf,
|
|||||||
/* If the texture is defined in the reference config */
|
/* If the texture is defined in the reference config */
|
||||||
if (config_get_entry(override_conf, shader->lut[i].id))
|
if (config_get_entry(override_conf, shader->lut[i].id))
|
||||||
{
|
{
|
||||||
char *tex_path = (char*)malloc(PATH_MAX_LENGTH);
|
char *tex_path = (char*)malloc(PATH_MAX_LENGTH);
|
||||||
|
|
||||||
/* Texture path from the config */
|
/* Texture path from the config */
|
||||||
config_get_path(override_conf, shader->lut[i].id, tex_path, PATH_MAX_LENGTH);
|
config_get_path(override_conf, shader->lut[i].id, tex_path, PATH_MAX_LENGTH);
|
||||||
|
37
runloop.c
37
runloop.c
@ -669,7 +669,7 @@ void runloop_runtime_log_deinit(
|
|||||||
{
|
{
|
||||||
if (verbosity_is_enabled())
|
if (verbosity_is_enabled())
|
||||||
{
|
{
|
||||||
char log[PATH_MAX_LENGTH] = {0};
|
char log[256] = {0};
|
||||||
unsigned hours = 0;
|
unsigned hours = 0;
|
||||||
unsigned minutes = 0;
|
unsigned minutes = 0;
|
||||||
unsigned seconds = 0;
|
unsigned seconds = 0;
|
||||||
@ -1136,8 +1136,8 @@ static bool validate_game_specific_options(char **output)
|
|||||||
if (!validate_game_options(
|
if (!validate_game_options(
|
||||||
runloop_st->system.info.library_name,
|
runloop_st->system.info.library_name,
|
||||||
game_options_path,
|
game_options_path,
|
||||||
sizeof(game_options_path), false) ||
|
sizeof(game_options_path), false)
|
||||||
!path_is_valid(game_options_path))
|
|| !path_is_valid(game_options_path))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
RARCH_LOG("[Core]: %s \"%s\".\n",
|
RARCH_LOG("[Core]: %s \"%s\".\n",
|
||||||
@ -1182,8 +1182,8 @@ static bool validate_folder_specific_options(
|
|||||||
|
|
||||||
if (!validate_folder_options(
|
if (!validate_folder_options(
|
||||||
folder_options_path,
|
folder_options_path,
|
||||||
sizeof(folder_options_path), false) ||
|
sizeof(folder_options_path), false)
|
||||||
!path_is_valid(folder_options_path))
|
|| !path_is_valid(folder_options_path))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
RARCH_LOG("[Core]: %s \"%s\".\n",
|
RARCH_LOG("[Core]: %s \"%s\".\n",
|
||||||
@ -1365,15 +1365,15 @@ static void runloop_core_msg_queue_push(
|
|||||||
switch (msg->level)
|
switch (msg->level)
|
||||||
{
|
{
|
||||||
case RETRO_LOG_WARN:
|
case RETRO_LOG_WARN:
|
||||||
category = MESSAGE_QUEUE_CATEGORY_WARNING;
|
category = MESSAGE_QUEUE_CATEGORY_WARNING;
|
||||||
break;
|
break;
|
||||||
case RETRO_LOG_ERROR:
|
case RETRO_LOG_ERROR:
|
||||||
category = MESSAGE_QUEUE_CATEGORY_ERROR;
|
category = MESSAGE_QUEUE_CATEGORY_ERROR;
|
||||||
break;
|
break;
|
||||||
case RETRO_LOG_INFO:
|
case RETRO_LOG_INFO:
|
||||||
case RETRO_LOG_DEBUG:
|
case RETRO_LOG_DEBUG:
|
||||||
default:
|
default:
|
||||||
category = MESSAGE_QUEUE_CATEGORY_INFO;
|
category = MESSAGE_QUEUE_CATEGORY_INFO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2921,9 +2921,9 @@ bool runloop_environment_cb(unsigned cmd, void *data)
|
|||||||
|
|
||||||
/* Can potentially be called every frame,
|
/* Can potentially be called every frame,
|
||||||
* don't do anything unless required. */
|
* don't do anything unless required. */
|
||||||
if ( (geom->base_width != in_geom->base_width) ||
|
if ( (geom->base_width != in_geom->base_width)
|
||||||
(geom->base_height != in_geom->base_height) ||
|
|| (geom->base_height != in_geom->base_height)
|
||||||
(geom->aspect_ratio != in_geom->aspect_ratio))
|
|| (geom->aspect_ratio != in_geom->aspect_ratio))
|
||||||
{
|
{
|
||||||
geom->base_width = in_geom->base_width;
|
geom->base_width = in_geom->base_width;
|
||||||
geom->base_height = in_geom->base_height;
|
geom->base_height = in_geom->base_height;
|
||||||
@ -4901,8 +4901,8 @@ bool core_options_remove_override(bool game_specific)
|
|||||||
|
|
||||||
/* Sanity check 1 - if there are no core options
|
/* Sanity check 1 - if there are no core options
|
||||||
* or no overrides are active, there is nothing to do */
|
* or no overrides are active, there is nothing to do */
|
||||||
if ( !coreopts ||
|
if ( !coreopts
|
||||||
( (!(runloop_st->flags & RUNLOOP_FLAG_GAME_OPTIONS_ACTIVE))
|
|| ( (!(runloop_st->flags & RUNLOOP_FLAG_GAME_OPTIONS_ACTIVE))
|
||||||
&& (!(runloop_st->flags & RUNLOOP_FLAG_FOLDER_OPTIONS_ACTIVE))
|
&& (!(runloop_st->flags & RUNLOOP_FLAG_FOLDER_OPTIONS_ACTIVE))
|
||||||
))
|
))
|
||||||
return true;
|
return true;
|
||||||
@ -7902,9 +7902,9 @@ void runloop_path_set_redirect(settings_t *settings,
|
|||||||
|
|
||||||
/* Get content directory name, if per-content-directory
|
/* Get content directory name, if per-content-directory
|
||||||
* saves/states are enabled */
|
* saves/states are enabled */
|
||||||
if ((sort_savefiles_by_content_enable ||
|
if ( (sort_savefiles_by_content_enable
|
||||||
sort_savestates_by_content_enable) &&
|
|| sort_savestates_by_content_enable)
|
||||||
!string_is_empty(runloop_st->runtime_content_path_basename))
|
&& !string_is_empty(runloop_st->runtime_content_path_basename))
|
||||||
fill_pathname_parent_dir_name(content_dir_name,
|
fill_pathname_parent_dir_name(content_dir_name,
|
||||||
runloop_st->runtime_content_path_basename,
|
runloop_st->runtime_content_path_basename,
|
||||||
sizeof(content_dir_name));
|
sizeof(content_dir_name));
|
||||||
@ -7917,8 +7917,9 @@ void runloop_path_set_redirect(settings_t *settings,
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* Per-core and/or per-content-directory saves */
|
/* Per-core and/or per-content-directory saves */
|
||||||
if ((sort_savefiles_enable || sort_savefiles_by_content_enable)
|
if (( sort_savefiles_enable
|
||||||
&& !string_is_empty(old_savefile_dir))
|
|| sort_savefiles_by_content_enable)
|
||||||
|
&& !string_is_empty(old_savefile_dir))
|
||||||
{
|
{
|
||||||
/* Append content directory name to save location */
|
/* Append content directory name to save location */
|
||||||
if (sort_savefiles_by_content_enable)
|
if (sort_savefiles_by_content_enable)
|
||||||
|
@ -1939,47 +1939,46 @@ bool content_load_ram_file(unsigned slot)
|
|||||||
static bool dump_to_file_desperate(const void *data,
|
static bool dump_to_file_desperate(const void *data,
|
||||||
size_t size, unsigned type)
|
size_t size, unsigned type)
|
||||||
{
|
{
|
||||||
time_t time_;
|
|
||||||
struct tm tm_;
|
|
||||||
char timebuf[256];
|
|
||||||
char path[PATH_MAX_LENGTH + 256 + 32];
|
char path[PATH_MAX_LENGTH + 256 + 32];
|
||||||
char application_data[PATH_MAX_LENGTH];
|
|
||||||
|
|
||||||
application_data[0] = '\0';
|
|
||||||
path [0] = '\0';
|
path [0] = '\0';
|
||||||
timebuf [0] = '\0';
|
|
||||||
|
|
||||||
if (!fill_pathname_application_data(application_data,
|
if (fill_pathname_application_data(path,
|
||||||
sizeof(application_data)))
|
sizeof(path)))
|
||||||
return false;
|
{
|
||||||
|
size_t _len;
|
||||||
|
time_t time_;
|
||||||
|
struct tm tm_;
|
||||||
|
char timebuf[256];
|
||||||
|
timebuf [0] = '\0';
|
||||||
|
time(&time_);
|
||||||
|
|
||||||
time(&time_);
|
rtime_localtime(&time_, &tm_);
|
||||||
|
|
||||||
rtime_localtime(&time_, &tm_);
|
strftime(timebuf, 256 * sizeof(char),
|
||||||
|
"%Y-%m-%d-%H-%M-%S", &tm_);
|
||||||
|
|
||||||
strftime(timebuf,
|
_len = strlcat(path, "/RetroArch-recovery-", sizeof(path));
|
||||||
256 * sizeof(char),
|
|
||||||
"%Y-%m-%d-%H-%M-%S", &tm_);
|
|
||||||
|
|
||||||
snprintf(path, sizeof(path),
|
snprintf(path + _len, sizeof(path) - _len,
|
||||||
"%s/RetroArch-recovery-%u%s",
|
"%u%s", type, timebuf);
|
||||||
application_data, type,
|
|
||||||
timebuf);
|
|
||||||
|
|
||||||
/* Fallback (emergency) saves are always
|
/* Fallback (emergency) saves are always
|
||||||
* uncompressed
|
* uncompressed
|
||||||
* > If a regular save fails, then the host
|
* > If a regular save fails, then the host
|
||||||
* system is experiencing serious technical
|
* system is experiencing serious technical
|
||||||
* difficulties (most likely some kind of
|
* difficulties (most likely some kind of
|
||||||
* hardware failure)
|
* hardware failure)
|
||||||
* > In this case, we don't want to further
|
* > In this case, we don't want to further
|
||||||
* complicate matters by introducing zlib
|
* complicate matters by introducing zlib
|
||||||
* compression overheads */
|
* compression overheads */
|
||||||
if (!filestream_write_file(path, data, size))
|
if (filestream_write_file(path, data, size))
|
||||||
return false;
|
{
|
||||||
|
RARCH_WARN("[SRAM]: Succeeded in saving RAM data to \"%s\".\n", path);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RARCH_WARN("[SRAM]: Succeeded in saving RAM data to \"%s\".\n", path);
|
return false;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user