mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
No longer use fill_pathname_noext - just basic strlcpy/strlcat string
concatenation
This commit is contained in:
parent
7b83636b64
commit
e91cf0e40d
47
command.c
47
command.c
@ -1084,7 +1084,6 @@ bool command_event_save_auto_state(
|
||||
const enum rarch_core_type current_core_type)
|
||||
{
|
||||
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
||||
bool ret = false;
|
||||
char savestate_name_auto[PATH_MAX_LENGTH];
|
||||
|
||||
if (runloop_st->entry_state_slot)
|
||||
@ -1095,10 +1094,8 @@ bool command_event_save_auto_state(
|
||||
return false;
|
||||
if (!core_info_current_supports_savestate())
|
||||
return false;
|
||||
|
||||
if (string_is_empty(path_basename(path_get(RARCH_PATH_BASENAME))))
|
||||
return false;
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
if (rcheevos_hardcore_active())
|
||||
return false;
|
||||
@ -1106,15 +1103,21 @@ bool command_event_save_auto_state(
|
||||
|
||||
savestate_name_auto[0] = '\0';
|
||||
|
||||
fill_pathname_noext(savestate_name_auto,
|
||||
strlcpy(savestate_name_auto,
|
||||
runloop_st->name.savestate,
|
||||
".auto", sizeof(savestate_name_auto));
|
||||
sizeof(savestate_name_auto));
|
||||
strlcat(savestate_name_auto,
|
||||
".auto",
|
||||
sizeof(savestate_name_auto));
|
||||
|
||||
ret = content_save_state((const char*)savestate_name_auto, true, true);
|
||||
RARCH_LOG("%s \"%s\" %s.\n",
|
||||
msg_hash_to_str(MSG_AUTO_SAVE_STATE_TO),
|
||||
savestate_name_auto, ret ?
|
||||
"succeeded" : "failed");
|
||||
if (content_save_state((const char*)savestate_name_auto, true, true))
|
||||
RARCH_LOG("%s \"%s\" %s.\n",
|
||||
msg_hash_to_str(MSG_AUTO_SAVE_STATE_TO),
|
||||
savestate_name_auto, "succeeded");
|
||||
else
|
||||
RARCH_LOG("%s \"%s\" %s.\n",
|
||||
msg_hash_to_str(MSG_AUTO_SAVE_STATE_TO),
|
||||
savestate_name_auto, "failed");
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1212,21 +1215,29 @@ void command_event_load_auto_state(void)
|
||||
|
||||
savestate_name_auto[0] = '\0';
|
||||
|
||||
fill_pathname_noext(savestate_name_auto, runloop_st->name.savestate,
|
||||
".auto", sizeof(savestate_name_auto));
|
||||
strlcpy(savestate_name_auto,
|
||||
runloop_st->name.savestate,
|
||||
sizeof(savestate_name_auto));
|
||||
strlcat(savestate_name_auto,
|
||||
".auto",
|
||||
sizeof(savestate_name_auto));
|
||||
|
||||
if (!path_is_valid(savestate_name_auto))
|
||||
return;
|
||||
|
||||
ret = content_load_state(savestate_name_auto, false, true);
|
||||
|
||||
RARCH_LOG("[State]: %s \"%s\".\n",
|
||||
msg_hash_to_str(MSG_FOUND_AUTO_SAVESTATE_IN),
|
||||
savestate_name_auto);
|
||||
RARCH_LOG("[State]: %s \"%s\" %s.\n",
|
||||
msg_hash_to_str(MSG_AUTOLOADING_SAVESTATE_FROM),
|
||||
savestate_name_auto, ret ? "succeeded" : "failed"
|
||||
);
|
||||
|
||||
if ((content_load_state(savestate_name_auto, false, true)))
|
||||
RARCH_LOG("[State]: %s \"%s\" %s.\n",
|
||||
msg_hash_to_str(MSG_AUTOLOADING_SAVESTATE_FROM),
|
||||
savestate_name_auto, "succeeded");
|
||||
else
|
||||
RARCH_LOG("[State]: %s \"%s\" %s.\n",
|
||||
msg_hash_to_str(MSG_AUTOLOADING_SAVESTATE_FROM),
|
||||
savestate_name_auto, "failed");
|
||||
|
||||
}
|
||||
|
||||
void command_event_set_savestate_auto_index(settings_t *settings)
|
||||
|
@ -555,10 +555,10 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info,
|
||||
|
||||
if (core_info->categories_list)
|
||||
{
|
||||
fill_pathname_noext(tmp,
|
||||
strlcpy(tmp,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_CATEGORIES),
|
||||
": ",
|
||||
sizeof(tmp));
|
||||
strlcat(tmp, ": ", sizeof(tmp));
|
||||
string_list_join_concat(tmp, sizeof(tmp),
|
||||
core_info->categories_list, ", ");
|
||||
if (menu_entries_append_enum(info->list, tmp, "",
|
||||
@ -568,10 +568,10 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info,
|
||||
|
||||
if (core_info->authors_list)
|
||||
{
|
||||
fill_pathname_noext(tmp,
|
||||
strlcpy(tmp,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_AUTHORS),
|
||||
": ",
|
||||
sizeof(tmp));
|
||||
strlcat(tmp, ": ", sizeof(tmp));
|
||||
string_list_join_concat(tmp, sizeof(tmp),
|
||||
core_info->authors_list, ", ");
|
||||
if (menu_entries_append_enum(info->list, tmp, "",
|
||||
@ -581,10 +581,10 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info,
|
||||
|
||||
if (core_info->permissions_list)
|
||||
{
|
||||
fill_pathname_noext(tmp,
|
||||
strlcpy(tmp,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_PERMISSIONS),
|
||||
": ",
|
||||
sizeof(tmp));
|
||||
strlcat(tmp, ": ", sizeof(tmp));
|
||||
string_list_join_concat(tmp, sizeof(tmp),
|
||||
core_info->permissions_list, ", ");
|
||||
if (menu_entries_append_enum(info->list, tmp, "",
|
||||
@ -594,10 +594,10 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info,
|
||||
|
||||
if (core_info->licenses_list)
|
||||
{
|
||||
fill_pathname_noext(tmp,
|
||||
strlcpy(tmp,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES),
|
||||
": ",
|
||||
sizeof(tmp));
|
||||
strlcat(tmp, ": ", sizeof(tmp));
|
||||
string_list_join_concat(tmp, sizeof(tmp),
|
||||
core_info->licenses_list, ", ");
|
||||
if (menu_entries_append_enum(info->list, tmp, "",
|
||||
@ -607,10 +607,11 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info,
|
||||
|
||||
if (core_info->supported_extensions_list)
|
||||
{
|
||||
fill_pathname_noext(tmp,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_SUPPORTED_EXTENSIONS),
|
||||
": ",
|
||||
strlcpy(tmp,
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_CORE_INFO_SUPPORTED_EXTENSIONS),
|
||||
sizeof(tmp));
|
||||
strlcat(tmp, ": ", sizeof(tmp));
|
||||
string_list_join_concat(tmp, sizeof(tmp),
|
||||
core_info->supported_extensions_list, ", ");
|
||||
if (menu_entries_append_enum(info->list, tmp, "",
|
||||
@ -620,10 +621,10 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info,
|
||||
|
||||
if (core_info->required_hw_api)
|
||||
{
|
||||
fill_pathname_noext(tmp,
|
||||
strlcpy(tmp,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_REQUIRED_HW_API),
|
||||
": ",
|
||||
sizeof(tmp));
|
||||
strlcat(tmp, ": ", sizeof(tmp));
|
||||
string_list_join_concat(tmp, sizeof(tmp),
|
||||
core_info->required_hw_api_list, ", ");
|
||||
if (menu_entries_append_enum(info->list, tmp, "",
|
||||
@ -682,11 +683,10 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info,
|
||||
|
||||
if (update_missing_firmware)
|
||||
{
|
||||
fill_pathname_noext(tmp,
|
||||
strlcpy(tmp,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_FIRMWARE),
|
||||
": ",
|
||||
sizeof(tmp));
|
||||
|
||||
strlcat(tmp, ": ", sizeof(tmp));
|
||||
if (menu_entries_append_enum(info->list, tmp, "",
|
||||
MENU_ENUM_LABEL_CORE_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0))
|
||||
count++;
|
||||
@ -1655,15 +1655,15 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
|
||||
|
||||
#endif
|
||||
{
|
||||
char cpu_str[255];
|
||||
char cpu_str[NAME_MAX_LENGTH];
|
||||
const char *model = frontend_driver_get_cpu_model_name();
|
||||
|
||||
cpu_str[0] = '\0';
|
||||
|
||||
fill_pathname_noext(cpu_str,
|
||||
strlcpy(cpu_str,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CPU_MODEL),
|
||||
": ",
|
||||
sizeof(cpu_str));
|
||||
strlcat(cpu_str, ": ", sizeof(cpu_str));
|
||||
|
||||
if (string_is_empty(model))
|
||||
strlcat(cpu_str, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), sizeof(cpu_str));
|
||||
@ -1676,14 +1676,15 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
|
||||
}
|
||||
|
||||
{
|
||||
char cpu_str[255];
|
||||
char cpu_str[NAME_MAX_LENGTH];
|
||||
|
||||
cpu_str[0] = '\0';
|
||||
|
||||
fill_pathname_noext(cpu_str,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CPU_FEATURES),
|
||||
": ",
|
||||
strlcpy(cpu_str,
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CPU_FEATURES),
|
||||
sizeof(cpu_str));
|
||||
strlcat(cpu_str, ": ", sizeof(cpu_str));
|
||||
|
||||
retroarch_get_capabilities(RARCH_CAPABILITIES_CPU,
|
||||
cpu_str, sizeof(cpu_str));
|
||||
@ -2005,7 +2006,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
|
||||
|
||||
{
|
||||
unsigned i;
|
||||
char feat_str[255];
|
||||
char feat_str[NAME_MAX_LENGTH];
|
||||
typedef struct menu_features_info
|
||||
{
|
||||
bool enabled;
|
||||
@ -8078,7 +8079,8 @@ unsigned menu_displaylist_build_list(
|
||||
|
||||
setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_ADDRESS_BIT_POSITION);
|
||||
if (setting )
|
||||
setting->max = cheat_manager_state.working_cheat.memory_search_size<3 ? 255 : 0 ;
|
||||
setting->max =
|
||||
(cheat_manager_state.working_cheat.memory_search_size < 3) ? 255 : 0 ;
|
||||
|
||||
setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_BROWSE_MEMORY);
|
||||
if (setting )
|
||||
@ -13888,7 +13890,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
break;
|
||||
case DISPLAYLIST_FILE_BROWSER_SELECT_SIDELOAD_CORE:
|
||||
{
|
||||
char ext_names[255];
|
||||
char ext_names[NAME_MAX_LENGTH];
|
||||
ext_names[0] = '\0';
|
||||
|
||||
info->type_default = FILE_TYPE_SIDELOAD_CORE;
|
||||
|
@ -8971,10 +8971,12 @@ static bool setting_append_list_input_player_options(
|
||||
|
||||
for (j = 0; j < RARCH_BIND_LIST_END; j++)
|
||||
{
|
||||
char label[255];
|
||||
char name[255];
|
||||
char label[NAME_MAX_LENGTH];
|
||||
char name[NAME_MAX_LENGTH];
|
||||
|
||||
i = (j < RARCH_ANALOG_BIND_LIST_END) ? input_config_bind_order[j] : j;
|
||||
i = (j < RARCH_ANALOG_BIND_LIST_END)
|
||||
? input_config_bind_order[j]
|
||||
: j;
|
||||
|
||||
if (input_config_bind_map_get_meta(i))
|
||||
continue;
|
||||
@ -8982,9 +8984,10 @@ static bool setting_append_list_input_player_options(
|
||||
label[0] = name[0] = '\0';
|
||||
|
||||
if (!string_is_empty(buffer[user]))
|
||||
fill_pathname_noext(label, buffer[user],
|
||||
" ",
|
||||
sizeof(label));
|
||||
{
|
||||
strlcpy(label, buffer[user], sizeof(label));
|
||||
strlcat(label, " ", sizeof(label));
|
||||
}
|
||||
|
||||
if (
|
||||
settings->bools.input_descriptor_label_show
|
||||
|
51
runloop.c
51
runloop.c
@ -5795,10 +5795,14 @@ bool runloop_path_init_subsystem(void)
|
||||
from the main SRAM location. */
|
||||
if (!retroarch_override_setting_is_set(
|
||||
RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL))
|
||||
fill_pathname_noext(runloop_st->name.savefile,
|
||||
{
|
||||
strlcpy(runloop_st->name.savefile,
|
||||
runloop_st->runtime_content_path_basename,
|
||||
sizeof(runloop_st->name.savefile));
|
||||
strlcat(runloop_st->name.savefile,
|
||||
".srm",
|
||||
sizeof(runloop_st->name.savefile));
|
||||
}
|
||||
|
||||
if (path_is_directory(runloop_st->name.savefile))
|
||||
{
|
||||
@ -5833,22 +5837,34 @@ void runloop_path_fill_names(void)
|
||||
return;
|
||||
|
||||
if (string_is_empty(runloop_st->name.ups))
|
||||
fill_pathname_noext(runloop_st->name.ups,
|
||||
{
|
||||
strlcpy(runloop_st->name.ups,
|
||||
runloop_st->runtime_content_path_basename,
|
||||
sizeof(runloop_st->name.ups));
|
||||
strlcat(runloop_st->name.ups,
|
||||
".ups",
|
||||
sizeof(runloop_st->name.ups));
|
||||
}
|
||||
|
||||
if (string_is_empty(runloop_st->name.bps))
|
||||
fill_pathname_noext(runloop_st->name.bps,
|
||||
{
|
||||
strlcpy(runloop_st->name.bps,
|
||||
runloop_st->runtime_content_path_basename,
|
||||
sizeof(runloop_st->name.bps));
|
||||
strlcat(runloop_st->name.bps,
|
||||
".bps",
|
||||
sizeof(runloop_st->name.bps));
|
||||
}
|
||||
|
||||
if (string_is_empty(runloop_st->name.ips))
|
||||
fill_pathname_noext(runloop_st->name.ips,
|
||||
{
|
||||
strlcpy(runloop_st->name.ips,
|
||||
runloop_st->runtime_content_path_basename,
|
||||
sizeof(runloop_st->name.ips));
|
||||
strlcat(runloop_st->name.ips,
|
||||
".ips",
|
||||
sizeof(runloop_st->name.ips));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8494,20 +8510,35 @@ void runloop_path_set_names(void)
|
||||
runloop_state_t *runloop_st = &runloop_state;
|
||||
if (!retroarch_override_setting_is_set(
|
||||
RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL))
|
||||
fill_pathname_noext(runloop_st->name.savefile,
|
||||
{
|
||||
strlcpy(runloop_st->name.savefile,
|
||||
runloop_st->runtime_content_path_basename,
|
||||
".srm", sizeof(runloop_st->name.savefile));
|
||||
sizeof(runloop_st->name.savefile));
|
||||
strlcat(runloop_st->name.savefile,
|
||||
".srm",
|
||||
sizeof(runloop_st->name.savefile));
|
||||
}
|
||||
|
||||
if (!retroarch_override_setting_is_set(
|
||||
RARCH_OVERRIDE_SETTING_STATE_PATH, NULL))
|
||||
fill_pathname_noext(runloop_st->name.savestate,
|
||||
{
|
||||
strlcpy(runloop_st->name.savestate,
|
||||
runloop_st->runtime_content_path_basename,
|
||||
".state", sizeof(runloop_st->name.savestate));
|
||||
sizeof(runloop_st->name.savestate));
|
||||
strlcat(runloop_st->name.savestate,
|
||||
".state",
|
||||
sizeof(runloop_st->name.savestate));
|
||||
}
|
||||
|
||||
#ifdef HAVE_CHEATS
|
||||
if (!string_is_empty(runloop_st->runtime_content_path_basename))
|
||||
fill_pathname_noext(runloop_st->name.cheatfile,
|
||||
{
|
||||
strlcpy(runloop_st->name.cheatfile,
|
||||
runloop_st->runtime_content_path_basename,
|
||||
".cht", sizeof(runloop_st->name.cheatfile));
|
||||
sizeof(runloop_st->name.cheatfile));
|
||||
strlcat(runloop_st->name.cheatfile,
|
||||
".cht",
|
||||
sizeof(runloop_st->name.cheatfile));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -446,16 +446,12 @@ void rarch_log_file_init(
|
||||
* log files, since user may decide to switch at any moment...) */
|
||||
if (string_is_empty(timestamped_log_file_name))
|
||||
{
|
||||
char format[256];
|
||||
struct tm tm_;
|
||||
time_t cur_time = time(NULL);
|
||||
|
||||
rtime_localtime(&cur_time, &tm_);
|
||||
|
||||
format[0] = '\0';
|
||||
strftime(format, sizeof(format), "retroarch__%Y_%m_%d__%H_%M_%S", &tm_);
|
||||
fill_pathname_noext(timestamped_log_file_name, format,
|
||||
".log",
|
||||
strftime(timestamped_log_file_name, sizeof(timestamped_log_file_name), "retroarch__%Y_%m_%d__%H_%M_%S", &tm_);
|
||||
strlcat(timestamped_log_file_name, ".log",
|
||||
sizeof(timestamped_log_file_name));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user