* Add TODO/FIXME localize notes

* More snprintf optimizations
This commit is contained in:
libretroadmin 2023-04-30 19:30:07 +02:00
parent 907efccb05
commit c087b044c2
6 changed files with 122 additions and 165 deletions

View File

@ -16,6 +16,7 @@
#include <stdlib.h>
#include <compat/strl.h>
#include <file/file_path.h>
#include <file/config_file_userdata.h>
#include <lists/dir_list.h>
@ -138,12 +139,8 @@ static bool create_softfilter_graph(rarch_softfilter_t *filt,
unsigned input_fmts, input_fmt, output_fmts, i = 0;
struct config_file_userdata userdata;
char key[64], name[64];
(void)i;
key[0] = name[0] = '\0';
snprintf(key, sizeof(key), "filter");
name[0] = '\0';
strlcpy(key, "filter", sizeof(key));
if (!config_get_array(filt->conf, key, name, sizeof(name)))
{
@ -157,21 +154,20 @@ static bool create_softfilter_graph(rarch_softfilter_t *filt,
return false;
}
filt->impl = softfilter_find_implementation(filt, name);
if (!filt->impl)
if (!(filt->impl = softfilter_find_implementation(filt, name)))
{
RARCH_ERR("Could not find implementation.\n");
return false;
}
userdata.conf = filt->conf;
userdata.conf = filt->conf;
/* Index-specific configs take priority over ident-specific. */
userdata.prefix[0] = key;
userdata.prefix[1] = filt->impl->short_ident;
/* Simple assumptions. */
filt->pix_fmt = in_pixel_format;
input_fmts = filt->impl->query_input_formats();
filt->pix_fmt = in_pixel_format;
input_fmts = filt->impl->query_input_formats();
switch (in_pixel_format)
{
@ -331,12 +327,8 @@ static bool append_softfilter_plugs(rarch_softfilter_t *filt,
unsigned i;
softfilter_simd_mask_t mask = (softfilter_simd_mask_t)cpu_features_get();
(void)list;
filt->plugs = (struct rarch_soft_plug*)
calloc(ARRAY_SIZE(soft_plugs_builtin), sizeof(*filt->plugs));
if (!filt->plugs)
if (!(filt->plugs = (struct rarch_soft_plug*)
calloc(ARRAY_SIZE(soft_plugs_builtin), sizeof(*filt->plugs))))
return false;
filt->num_plugs = ARRAY_SIZE(soft_plugs_builtin);

View File

@ -2522,19 +2522,19 @@ void input_config_get_bind_string_joykey(
switch (GET_HAT_DIR(bind->joykey))
{
case HAT_UP_MASK:
snprintf(buf + len, size - len, "up (%s)", na_str);
snprintf(buf + len, size - len, "up (%s)", na_str);
break;
case HAT_DOWN_MASK:
snprintf(buf + len, size - len, "down (%s)", na_str);
snprintf(buf + len, size - len, "down (%s)", na_str);
break;
case HAT_LEFT_MASK:
snprintf(buf + len, size - len, "left (%s)", na_str);
snprintf(buf + len, size - len, "left (%s)", na_str);
break;
case HAT_RIGHT_MASK:
snprintf(buf + len, size - len, "right (%s)",na_str);
snprintf(buf + len, size - len, "right (%s)", na_str);
break;
default:
snprintf(buf + len, size - len, "? (%s)", na_str);
snprintf(buf + len, size - len, "? (%s)", na_str);
break;
}
}
@ -2583,17 +2583,17 @@ void input_config_get_bind_string_joyaxis(
}
else
{
const char *na_str =
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE);
if (AXIS_NEG_GET(bind->joyaxis) != AXIS_DIR_NONE)
{
unsigned axis = AXIS_NEG_GET(bind->joyaxis);
snprintf(buf, size, "%s-%u (%s)", prefix, axis, na_str);
snprintf(buf, size, "%s-%u (%s)", prefix, axis,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE));
}
else if (AXIS_POS_GET(bind->joyaxis) != AXIS_DIR_NONE)
{
unsigned axis = AXIS_POS_GET(bind->joyaxis);
snprintf(buf, size, "%s+%u (%s)", prefix, axis, na_str);
snprintf(buf, size, "%s+%u (%s)", prefix, axis,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE));
}
}
}

View File

@ -5401,6 +5401,7 @@ bool menu_input_key_bind_iterate(
uint64_t input_bind_hold_us = settings->uints.input_bind_hold * 1000000;
uint64_t input_bind_timeout_us = settings->uints.input_bind_timeout * 1000000;
/* TODO/FIXME - localize */
snprintf(bind->s, bind->len,
"[%s]\nPress keyboard, mouse or joypad\n(Timeout %d %s)",
input_config_bind_map_get_desc(
@ -5490,6 +5491,7 @@ bool menu_input_key_bind_iterate(
new_binds.timer_hold.timeout_us =
new_binds.timer_hold.timeout_end - current_time;
/* TODO/FIXME - localize */
snprintf(bind->s, bind->len,
"[%s]\nPress keyboard, mouse or joypad\nand hold ...",
input_config_bind_map_get_desc(

View File

@ -674,6 +674,7 @@ void runloop_runtime_log_deinit(
runloop_st->core_runtime_usec,
&hours, &minutes, &seconds);
/* TODO/FIXME - localize */
snprintf(log, sizeof(log),
"[Core]: Content ran for a total of:"
" %02u hours, %02u minutes, %02u seconds.",
@ -4976,6 +4977,7 @@ void core_options_reset(void)
void core_options_flush(void)
{
size_t _len;
runloop_state_t *runloop_st = &runloop_state;
core_option_manager_t *coreopts = runloop_st->core_options;
const char *path_core_options = path_get(RARCH_PATH_CORE_OPTIONS);
@ -5048,26 +5050,25 @@ void core_options_flush(void)
if (success)
{
/* Log result */
_len = strlcpy(msg, msg_hash_to_str(MSG_CORE_OPTIONS_FLUSHED),
sizeof(msg));
RARCH_LOG(
"[Core]: Saved core options to \"%s\".\n",
path_core_options ? path_core_options : "UNKNOWN");
snprintf(msg, sizeof(msg), "%s \"%s\"",
msg_hash_to_str(MSG_CORE_OPTIONS_FLUSHED),
core_options_file);
}
else
{
/* Log result */
_len = strlcpy(msg, msg_hash_to_str(MSG_CORE_OPTIONS_FLUSH_FAILED),
sizeof(msg));
RARCH_LOG(
"[Core]: Failed to save core options to \"%s\".\n",
path_core_options ? path_core_options : "UNKNOWN");
snprintf(msg, sizeof(msg), "%s \"%s\"",
msg_hash_to_str(MSG_CORE_OPTIONS_FLUSH_FAILED),
core_options_file);
}
snprintf(msg + _len, sizeof(msg) - _len, " \"%s\"",
core_options_file);
runloop_msg_queue_push(
msg, 1, 100, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
@ -6403,11 +6404,8 @@ static enum runloop_state_enum runloop_check_state(
cur_state_slot);
_len = strlcpy(msg, msg_hash_to_str(MSG_STATE_SLOT), sizeof(msg));
snprintf(msg + _len,
sizeof(msg) - _len,
": %d",
settings->ints.state_slot);
snprintf(msg + _len, sizeof(msg) - _len,
": %d", settings->ints.state_slot);
if (cur_state_slot < 0)
strlcat(msg, " (Auto)", sizeof(msg));
@ -6466,11 +6464,8 @@ static enum runloop_state_enum runloop_check_state(
cur_replay_slot);
_len = strlcpy(msg, msg_hash_to_str(MSG_REPLAY_SLOT), sizeof(msg));
snprintf(msg + _len,
sizeof(msg) - _len,
": %d",
settings->ints.replay_slot);
snprintf(msg + _len, sizeof(msg) - _len,
": %d", settings->ints.replay_slot);
if (cur_replay_slot < 0)
strlcat(msg, " (Auto)", sizeof(msg));
@ -7228,12 +7223,14 @@ bool runloop_get_savestate_path(char *path, size_t len, int state_slot)
if (string_is_empty(name_savestate))
return false;
if (state_slot > 0)
snprintf(path, len, "%s%d", name_savestate, state_slot);
else if (state_slot < 0)
if (state_slot < 0)
fill_pathname_join_delim(path, name_savestate, "auto", '.', len);
else
strlcpy(path, name_savestate, len);
{
size_t _len = strlcpy(path, name_savestate, len);
if (state_slot > 0)
snprintf(path + _len, len - _len, "%d", state_slot);
}
return true;
}
@ -7248,6 +7245,7 @@ bool runloop_get_current_replay_path(char *path, size_t len)
bool runloop_get_replay_path(char *path, size_t len, unsigned slot)
{
size_t _len;
runloop_state_t *runloop_st = &runloop_state;
const char *name_replay = NULL;
@ -7258,10 +7256,9 @@ bool runloop_get_replay_path(char *path, size_t len, unsigned slot)
if (string_is_empty(name_replay))
return false;
_len = strlcpy(path, name_replay, len);
if (slot >= 0)
snprintf(path, len, "%s%d", name_replay, slot);
else
strlcpy(path, name_replay, len);
snprintf(path + _len, len - _len, "%d", slot);
return true;
}

View File

@ -731,12 +731,13 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
enum playlist_sublabel_last_played_style_type timedate_style,
enum playlist_sublabel_last_played_date_separator_type date_separator)
{
size_t _len;
char tmp[64];
bool has_am_pm = false;
const char *format_str = "";
size_t _len = strlcpy(str, msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED), len);
tmp[0] = '\0';
tmp[0] = '\0';
if (runtime_log)
{
@ -869,21 +870,15 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
}
break;
default:
has_am_pm = false;
break;
}
if (has_am_pm)
{
if (runtime_log)
{
/* Get time */
struct tm time_info;
runtime_log_get_last_played_time(runtime_log, &time_info);
runtime_last_played_strftime(tmp, sizeof(tmp), format_str, &time_info);
}
_len = strlcpy(str, msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED), len);
/* Get time */
struct tm time_info;
runtime_log_get_last_played_time(runtime_log, &time_info);
runtime_last_played_strftime(tmp, sizeof(tmp), format_str, &time_info);
str[_len ] = ' ';
str[_len+1] = '\0';
strlcat(str, tmp, len);
@ -897,18 +892,16 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
switch (date_separator)
{
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_SLASH:
format_str = "%s %04u/%02u/%02u %02u:%02u";
format_str = " %04u/%02u/%02u %02u:%02u";
break;
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_PERIOD:
format_str = "%s %04u.%02u.%02u %02u:%02u";
format_str = " %04u.%02u.%02u %02u:%02u";
break;
default:
format_str = "%s %04u-%02u-%02u %02u:%02u";
format_str = " %04u-%02u-%02u %02u:%02u";
break;
}
snprintf(str, len, format_str,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
snprintf(str + _len, len - _len, format_str,
runtime_log->last_played.year,
runtime_log->last_played.month,
runtime_log->last_played.day,
@ -919,18 +912,16 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
switch (date_separator)
{
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_SLASH:
format_str = "%s %04u/%02u/%02u";
format_str = " %04u/%02u/%02u";
break;
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_PERIOD:
format_str = "%s %04u.%02u.%02u";
format_str = " %04u.%02u.%02u";
break;
default:
format_str = "%s %04u-%02u-%02u";
format_str = " %04u-%02u-%02u";
break;
}
snprintf(str, len, format_str,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
snprintf(str + _len, len - _len, format_str,
runtime_log->last_played.year,
runtime_log->last_played.month,
runtime_log->last_played.day);
@ -939,18 +930,16 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
switch (date_separator)
{
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_SLASH:
format_str = "%s %04u/%02u";
format_str = " %04u/%02u";
break;
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_PERIOD:
format_str = "%s %04u.%02u";
format_str = " %04u.%02u";
break;
default:
format_str = "%s %04u-%02u";
format_str = " %04u-%02u";
break;
}
snprintf(str, len, format_str,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
snprintf(str + _len, len - _len, format_str,
runtime_log->last_played.year,
runtime_log->last_played.month);
return;
@ -958,18 +947,16 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
switch (date_separator)
{
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_SLASH:
format_str = "%s %02u/%02u/%04u %02u:%02u:%02u";
format_str = " %02u/%02u/%04u %02u:%02u:%02u";
break;
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_PERIOD:
format_str = "%s %02u.%02u.%04u %02u:%02u:%02u";
format_str = " %02u.%02u.%04u %02u:%02u:%02u";
break;
default:
format_str = "%s %02u-%02u-%04u %02u:%02u:%02u";
format_str = " %02u-%02u-%04u %02u:%02u:%02u";
break;
}
snprintf(str, len, format_str,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
snprintf(str + _len, len - _len, format_str,
runtime_log->last_played.month,
runtime_log->last_played.day,
runtime_log->last_played.year,
@ -981,18 +968,16 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
switch (date_separator)
{
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_SLASH:
format_str = "%s %02u/%02u/%04u %02u:%02u";
format_str = " %02u/%02u/%04u %02u:%02u";
break;
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_PERIOD:
format_str = "%s %02u.%02u.%04u %02u:%02u";
format_str = " %02u.%02u.%04u %02u:%02u";
break;
default:
format_str = "%s %02u-%02u-%04u %02u:%02u";
format_str = " %02u-%02u-%04u %02u:%02u";
break;
}
snprintf(str, len, format_str,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
snprintf(str + _len, len - _len, format_str,
runtime_log->last_played.month,
runtime_log->last_played.day,
runtime_log->last_played.year,
@ -1003,18 +988,16 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
switch (date_separator)
{
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_SLASH:
format_str = "%s %02u/%02u %02u:%02u";
format_str = " %02u/%02u %02u:%02u";
break;
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_PERIOD:
format_str = "%s %02u.%02u %02u:%02u";
format_str = " %02u.%02u %02u:%02u";
break;
default:
format_str = "%s %02u-%02u %02u:%02u";
format_str = " %02u-%02u %02u:%02u";
break;
}
snprintf(str, len, format_str,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
snprintf(str + _len, len - _len, format_str,
runtime_log->last_played.month,
runtime_log->last_played.day,
runtime_log->last_played.hour,
@ -1024,18 +1007,16 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
switch (date_separator)
{
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_SLASH:
format_str = "%s %02u/%02u/%04u";
format_str = " %02u/%02u/%04u";
break;
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_PERIOD:
format_str = "%s %02u.%02u.%04u";
format_str = " %02u.%02u.%04u";
break;
default:
format_str = "%s %02u-%02u-%04u";
format_str = " %02u-%02u-%04u";
break;
}
snprintf(str, len, format_str,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
snprintf(str + _len, len - _len, format_str,
runtime_log->last_played.month,
runtime_log->last_played.day,
runtime_log->last_played.year);
@ -1044,18 +1025,16 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
switch (date_separator)
{
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_SLASH:
format_str = "%s %02u/%02u";
format_str = " %02u/%02u";
break;
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_PERIOD:
format_str = "%s %02u.%02u";
format_str = " %02u.%02u";
break;
default:
format_str = "%s %02u-%02u";
format_str = " %02u-%02u";
break;
}
snprintf(str, len, format_str,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
snprintf(str + _len, len - _len, format_str,
runtime_log->last_played.month,
runtime_log->last_played.day);
return;
@ -1063,18 +1042,16 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
switch (date_separator)
{
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_SLASH:
format_str = "%s %02u/%02u/%04u %02u:%02u:%02u";
format_str = " %02u/%02u/%04u %02u:%02u:%02u";
break;
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_PERIOD:
format_str = "%s %02u.%02u.%04u %02u:%02u:%02u";
format_str = " %02u.%02u.%04u %02u:%02u:%02u";
break;
default:
format_str = "%s %02u-%02u-%04u %02u:%02u:%02u";
format_str = " %02u-%02u-%04u %02u:%02u:%02u";
break;
}
snprintf(str, len, format_str,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
snprintf(str + _len, len - _len, format_str,
runtime_log->last_played.day,
runtime_log->last_played.month,
runtime_log->last_played.year,
@ -1086,18 +1063,16 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
switch (date_separator)
{
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_SLASH:
format_str = "%s %02u/%02u/%04u %02u:%02u";
format_str = " %02u/%02u/%04u %02u:%02u";
break;
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_PERIOD:
format_str = "%s %02u.%02u.%04u %02u:%02u";
format_str = " %02u.%02u.%04u %02u:%02u";
break;
default:
format_str = "%s %02u-%02u-%04u %02u:%02u";
format_str = " %02u-%02u-%04u %02u:%02u";
break;
}
snprintf(str, len, format_str,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
snprintf(str + _len, len - _len, format_str,
runtime_log->last_played.day,
runtime_log->last_played.month,
runtime_log->last_played.year,
@ -1108,18 +1083,16 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
switch (date_separator)
{
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_SLASH:
format_str = "%s %02u/%02u %02u:%02u";
format_str = " %02u/%02u %02u:%02u";
break;
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_PERIOD:
format_str = "%s %02u.%02u %02u:%02u";
format_str = " %02u.%02u %02u:%02u";
break;
default:
format_str = "%s %02u-%02u %02u:%02u";
format_str = " %02u-%02u %02u:%02u";
break;
}
snprintf(str, len, format_str,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
snprintf(str + _len, len - _len, format_str,
runtime_log->last_played.day,
runtime_log->last_played.month,
runtime_log->last_played.hour,
@ -1129,18 +1102,16 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
switch (date_separator)
{
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_SLASH:
format_str = "%s %02u/%02u/%04u";
format_str = " %02u/%02u/%04u";
break;
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_PERIOD:
format_str = "%s %02u.%02u.%04u";
format_str = " %02u.%02u.%04u";
break;
default:
format_str = "%s %02u-%02u-%04u";
format_str = " %02u-%02u-%04u";
break;
}
snprintf(str, len, format_str,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
snprintf(str + _len, len - _len, format_str,
runtime_log->last_played.day,
runtime_log->last_played.month,
runtime_log->last_played.year);
@ -1149,18 +1120,16 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
switch (date_separator)
{
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_SLASH:
format_str = "%s %02u/%02u";
format_str = " %02u/%02u";
break;
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_PERIOD:
format_str = "%s %02u.%02u";
format_str = " %02u.%02u";
break;
default:
format_str = "%s %02u-%02u";
format_str = " %02u-%02u";
break;
}
snprintf(str, len, format_str,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
snprintf(str + _len, len - _len, format_str,
runtime_log->last_played.day, runtime_log->last_played.month);
return;
case PLAYLIST_LAST_PLAYED_STYLE_AGO:
@ -1169,8 +1138,6 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_INLINE_CORE_DISPLAY_NEVER),
sizeof(tmp));
_len = strlcpy(str, msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED), len);
str[_len ] = ' ';
str[_len+1] = '\0';
strlcat(str, tmp, len);
@ -1180,18 +1147,16 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
switch (date_separator)
{
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_SLASH:
format_str = "%s %04u/%02u/%02u %02u:%02u:%02u";
format_str = " %04u/%02u/%02u %02u:%02u:%02u";
break;
case PLAYLIST_LAST_PLAYED_DATE_SEPARATOR_PERIOD:
format_str = "%s %04u.%02u.%02u %02u:%02u:%02u";
format_str = " %04u.%02u.%02u %02u:%02u:%02u";
break;
default:
format_str = "%s %04u-%02u-%02u %02u:%02u:%02u";
format_str = " %04u-%02u-%02u %02u:%02u:%02u";
break;
}
snprintf(str, len, format_str,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
snprintf(str + _len, len - _len, format_str,
runtime_log->last_played.year,
runtime_log->last_played.month,
runtime_log->last_played.day,
@ -1202,11 +1167,8 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
}
}
else
snprintf(str, len,
"%s %s",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_INLINE_CORE_DISPLAY_NEVER)
);
snprintf(str + _len, len - _len,
" %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_INLINE_CORE_DISPLAY_NEVER));
}
/* Status */

View File

@ -247,9 +247,10 @@ error:
static bool bsv_movie_start_record(input_driver_state_t * input_st, char *path)
{
size_t _len;
char msg[8192];
bsv_movie_t *state = NULL;
const char *movie_rec_str = msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO);
const char *movie_rec_str = NULL;
/* this should trigger a start recording task which on failure or
success prints a message and on success sets the
@ -267,10 +268,9 @@ static bool bsv_movie_start_record(input_driver_state_t * input_st, char *path)
input_st->bsv_movie_state_handle = state;
input_st->bsv_movie_state.flags |= BSV_FLAG_MOVIE_RECORDING;
snprintf(msg, sizeof(msg),
"%s \"%s\".", movie_rec_str,
path);
movie_rec_str = msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO);
_len = strlcpy(msg, movie_rec_str, sizeof(msg));
snprintf(msg + _len, sizeof(msg) - _len, " \"%s\".", path);
runloop_msg_queue_push(msg, 2, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_LOG("%s \"%s\".\n", movie_rec_str, path);
@ -418,10 +418,12 @@ bool movie_stop(input_driver_state_t *input_st)
bool movie_start_playback(input_driver_state_t *input_st, char *path)
{
retro_task_t *task = task_init();
moviectl_task_state_t *state = (moviectl_task_state_t *) calloc(1, sizeof(*state));
bool file_exists = filestream_exists(path);
moviectl_task_state_t *state = (moviectl_task_state_t *)calloc(1, sizeof(*state));
bool file_exists = filestream_exists(path);
if (!task || !state || !file_exists)
goto error;
*state = input_st->bsv_movie_state;
strlcpy(state->movie_start_path, path, sizeof(state->movie_start_path));
task->type = TASK_TYPE_NONE;
@ -441,20 +443,23 @@ error:
return false;
}
bool movie_start_record(input_driver_state_t *input_st, char*path)
{
size_t _len;
char msg[8192];
const char *movie_rec_str = msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO);
retro_task_t *task = task_init();
moviectl_task_state_t *state = (moviectl_task_state_t *) calloc(1, sizeof(*state));
moviectl_task_state_t *state = (moviectl_task_state_t *)calloc(1, sizeof(*state));
if (!task || !state)
goto error;
*state = input_st->bsv_movie_state;
strlcpy(state->movie_start_path, path, sizeof(state->movie_start_path));
msg[0] = '\0';
snprintf(msg, sizeof(msg), "%s \"%s\".", movie_rec_str, path);
_len = strlcpy(msg, movie_rec_str, sizeof(msg));
snprintf(msg + _len, sizeof(msg) - _len, " \"%s\".", path);
task->type = TASK_TYPE_NONE;
task->state = state;
@ -476,5 +481,4 @@ error:
return false;
}
#endif