mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 08:43:10 +00:00
fill_pathname_parent_dir_name - small cleanups
This commit is contained in:
parent
c492e46d96
commit
17fc55c762
@ -4312,7 +4312,6 @@ bool config_load_override(void *data)
|
|||||||
char core_path[PATH_MAX_LENGTH];
|
char core_path[PATH_MAX_LENGTH];
|
||||||
char game_path[PATH_MAX_LENGTH];
|
char game_path[PATH_MAX_LENGTH];
|
||||||
char content_path[PATH_MAX_LENGTH];
|
char content_path[PATH_MAX_LENGTH];
|
||||||
char content_dir_name[DIR_MAX_LENGTH];
|
|
||||||
char config_directory[DIR_MAX_LENGTH];
|
char config_directory[DIR_MAX_LENGTH];
|
||||||
bool should_append = false;
|
bool should_append = false;
|
||||||
bool show_notification = true;
|
bool show_notification = true;
|
||||||
@ -4327,7 +4326,6 @@ bool config_load_override(void *data)
|
|||||||
core_path[0] = '\0';
|
core_path[0] = '\0';
|
||||||
game_path[0] = '\0';
|
game_path[0] = '\0';
|
||||||
content_path[0] = '\0';
|
content_path[0] = '\0';
|
||||||
content_dir_name[0] = '\0';
|
|
||||||
config_directory[0] = '\0';
|
config_directory[0] = '\0';
|
||||||
|
|
||||||
path_clear(RARCH_PATH_CONFIG_OVERRIDE);
|
path_clear(RARCH_PATH_CONFIG_OVERRIDE);
|
||||||
@ -4345,6 +4343,7 @@ bool config_load_override(void *data)
|
|||||||
* game_path, content_path */
|
* game_path, content_path */
|
||||||
if (has_content)
|
if (has_content)
|
||||||
{
|
{
|
||||||
|
char content_dir_name[DIR_MAX_LENGTH];
|
||||||
fill_pathname_parent_dir_name(content_dir_name,
|
fill_pathname_parent_dir_name(content_dir_name,
|
||||||
rarch_path_basename, sizeof(content_dir_name));
|
rarch_path_basename, sizeof(content_dir_name));
|
||||||
game_name = path_basename_nocompression(rarch_path_basename);
|
game_name = path_basename_nocompression(rarch_path_basename);
|
||||||
@ -4612,7 +4611,6 @@ bool config_unload_override(void)
|
|||||||
bool config_load_remap(const char *directory_input_remapping,
|
bool config_load_remap(const char *directory_input_remapping,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
char content_dir_name[DIR_MAX_LENGTH];
|
|
||||||
/* final path for core-specific configuration (prefix+suffix) */
|
/* final path for core-specific configuration (prefix+suffix) */
|
||||||
char core_path[PATH_MAX_LENGTH];
|
char core_path[PATH_MAX_LENGTH];
|
||||||
/* final path for game-specific configuration (prefix+suffix) */
|
/* final path for game-specific configuration (prefix+suffix) */
|
||||||
@ -4637,7 +4635,6 @@ bool config_load_remap(const char *directory_input_remapping,
|
|||||||
size_t remap_path_total_len = 0;
|
size_t remap_path_total_len = 0;
|
||||||
size_t _len = 0;
|
size_t _len = 0;
|
||||||
|
|
||||||
content_dir_name[0] = '\0';
|
|
||||||
core_path[0] = '\0';
|
core_path[0] = '\0';
|
||||||
game_path[0] = '\0';
|
game_path[0] = '\0';
|
||||||
content_path[0] = '\0';
|
content_path[0] = '\0';
|
||||||
@ -4682,6 +4679,7 @@ bool config_load_remap(const char *directory_input_remapping,
|
|||||||
* game_path, content_path */
|
* game_path, content_path */
|
||||||
if (has_content)
|
if (has_content)
|
||||||
{
|
{
|
||||||
|
char content_dir_name[DIR_MAX_LENGTH];
|
||||||
fill_pathname_parent_dir_name(content_dir_name,
|
fill_pathname_parent_dir_name(content_dir_name,
|
||||||
rarch_path_basename, sizeof(content_dir_name));
|
rarch_path_basename, sizeof(content_dir_name));
|
||||||
game_name = path_basename_nocompression(rarch_path_basename);
|
game_name = path_basename_nocompression(rarch_path_basename);
|
||||||
@ -5515,7 +5513,6 @@ int8_t config_save_overrides(enum override_type type,
|
|||||||
struct config_path_setting *path_overrides = NULL;
|
struct config_path_setting *path_overrides = NULL;
|
||||||
char config_directory[DIR_MAX_LENGTH];
|
char config_directory[DIR_MAX_LENGTH];
|
||||||
char override_directory[DIR_MAX_LENGTH];
|
char override_directory[DIR_MAX_LENGTH];
|
||||||
char content_dir_name[DIR_MAX_LENGTH];
|
|
||||||
char override_path[PATH_MAX_LENGTH];
|
char override_path[PATH_MAX_LENGTH];
|
||||||
settings_t *overrides = config_st;
|
settings_t *overrides = config_st;
|
||||||
int bool_settings_size = sizeof(settings->bools) / sizeof(settings->bools.placeholder);
|
int bool_settings_size = sizeof(settings->bools) / sizeof(settings->bools.placeholder);
|
||||||
@ -5531,7 +5528,6 @@ int8_t config_save_overrides(enum override_type type,
|
|||||||
const char *game_name = NULL;
|
const char *game_name = NULL;
|
||||||
bool has_content = !string_is_empty(rarch_path_basename);
|
bool has_content = !string_is_empty(rarch_path_basename);
|
||||||
|
|
||||||
content_dir_name[0] = '\0';
|
|
||||||
override_path[0] = '\0';
|
override_path[0] = '\0';
|
||||||
|
|
||||||
/* > Cannot save an override if we have no core
|
/* > Cannot save an override if we have no core
|
||||||
@ -5790,13 +5786,17 @@ int8_t config_save_overrides(enum override_type type,
|
|||||||
sizeof(override_path));
|
sizeof(override_path));
|
||||||
break;
|
break;
|
||||||
case OVERRIDE_CONTENT_DIR:
|
case OVERRIDE_CONTENT_DIR:
|
||||||
fill_pathname_parent_dir_name(content_dir_name,
|
{
|
||||||
rarch_path_basename, sizeof(content_dir_name));
|
char content_dir_name[DIR_MAX_LENGTH];
|
||||||
fill_pathname_join_special_ext(override_path,
|
content_dir_name[0] = '\0';
|
||||||
config_directory, core_name,
|
fill_pathname_parent_dir_name(content_dir_name,
|
||||||
content_dir_name,
|
rarch_path_basename, sizeof(content_dir_name));
|
||||||
FILE_PATH_CONFIG_EXTENSION,
|
fill_pathname_join_special_ext(override_path,
|
||||||
sizeof(override_path));
|
config_directory, core_name,
|
||||||
|
content_dir_name,
|
||||||
|
FILE_PATH_CONFIG_EXTENSION,
|
||||||
|
sizeof(override_path));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case OVERRIDE_AS:
|
case OVERRIDE_AS:
|
||||||
fill_pathname_join_special_ext(override_path,
|
fill_pathname_join_special_ext(override_path,
|
||||||
|
@ -291,17 +291,17 @@ static void switch_res_crt(
|
|||||||
unsigned crt_mode, unsigned native_width,
|
unsigned crt_mode, unsigned native_width,
|
||||||
int monitor_index, int super_width)
|
int monitor_index, int super_width)
|
||||||
{
|
{
|
||||||
char current_core_name[NAME_MAX_LENGTH];
|
|
||||||
char current_content_dir[DIR_MAX_LENGTH];
|
|
||||||
int flags = 0, ret;
|
|
||||||
const char *err_msg = NULL;
|
|
||||||
int w = native_width;
|
int w = native_width;
|
||||||
int h = height;
|
int h = height;
|
||||||
double rr = p_switch->ra_core_hz;
|
|
||||||
|
|
||||||
/* Check if SR2 is loaded, if not, load it */
|
/* Check if SR2 is loaded, if not, load it */
|
||||||
if (crt_sr2_init(p_switch, monitor_index, crt_mode, super_width))
|
if (crt_sr2_init(p_switch, monitor_index, crt_mode, super_width))
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
|
int flags = 0;
|
||||||
|
char current_core_name[NAME_MAX_LENGTH];
|
||||||
|
char current_content_dir[DIR_MAX_LENGTH];
|
||||||
|
double rr = p_switch->ra_core_hz;
|
||||||
const char *_core_name = (const char*)runloop_state_get_ptr()->system.info.library_name;
|
const char *_core_name = (const char*)runloop_state_get_ptr()->system.info.library_name;
|
||||||
/* Check for core and content changes in case we need
|
/* Check for core and content changes in case we need
|
||||||
to make any adjustments */
|
to make any adjustments */
|
||||||
|
@ -1588,7 +1588,7 @@ static int16_t input_state_device(
|
|||||||
res = (( input_st->turbo_btns.count
|
res = (( input_st->turbo_btns.count
|
||||||
% settings->uints.input_turbo_period)
|
% settings->uints.input_turbo_period)
|
||||||
< settings->uints.input_turbo_duty_cycle);
|
< settings->uints.input_turbo_duty_cycle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5317,7 +5317,7 @@ static const char *input_overlay_path(bool want_osk)
|
|||||||
/* maybe based on the content's directory name */
|
/* maybe based on the content's directory name */
|
||||||
if (!string_is_empty(content_path))
|
if (!string_is_empty(content_path))
|
||||||
{
|
{
|
||||||
char dirname[PATH_MAX_LENGTH];
|
char dirname[DIR_MAX_LENGTH];
|
||||||
fill_pathname_parent_dir_name(dirname, content_path, sizeof(dirname));
|
fill_pathname_parent_dir_name(dirname, content_path, sizeof(dirname));
|
||||||
fill_pathname_join_special_ext(system_overlay_path,
|
fill_pathname_join_special_ext(system_overlay_path,
|
||||||
overlay_directory, SYSTEM_OVERLAY_DIR, dirname, ".cfg",
|
overlay_directory, SYSTEM_OVERLAY_DIR, dirname, ".cfg",
|
||||||
|
@ -3683,7 +3683,6 @@ static int generic_action_ok_remap_file_operation(const char *path,
|
|||||||
unsigned action_type)
|
unsigned action_type)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_CONFIGFILE
|
#ifdef HAVE_CONFIGFILE
|
||||||
char content_dir_name[DIR_MAX_LENGTH];
|
|
||||||
char remap_file_path[PATH_MAX_LENGTH];
|
char remap_file_path[PATH_MAX_LENGTH];
|
||||||
struct menu_state *menu_st = menu_state_get_ptr();
|
struct menu_state *menu_st = menu_state_get_ptr();
|
||||||
rarch_system_info_t *sys_info = &runloop_state_get_ptr()->system;
|
rarch_system_info_t *sys_info = &runloop_state_get_ptr()->system;
|
||||||
@ -3700,7 +3699,6 @@ static int generic_action_ok_remap_file_operation(const char *path,
|
|||||||
size_t remap_path_total_len = 0;
|
size_t remap_path_total_len = 0;
|
||||||
size_t _len = 0;
|
size_t _len = 0;
|
||||||
|
|
||||||
content_dir_name[0] = '\0';
|
|
||||||
remap_file_path[0] = '\0';
|
remap_file_path[0] = '\0';
|
||||||
|
|
||||||
/* Cannot perform remap file operation if we
|
/* Cannot perform remap file operation if we
|
||||||
@ -3768,9 +3766,9 @@ static int generic_action_ok_remap_file_operation(const char *path,
|
|||||||
case ACTION_OK_REMAP_FILE_REMOVE_CONTENT_DIR:
|
case ACTION_OK_REMAP_FILE_REMOVE_CONTENT_DIR:
|
||||||
if (has_content)
|
if (has_content)
|
||||||
{
|
{
|
||||||
|
char content_dir_name[DIR_MAX_LENGTH];
|
||||||
fill_pathname_parent_dir_name(content_dir_name,
|
fill_pathname_parent_dir_name(content_dir_name,
|
||||||
rarch_path_basename, sizeof(content_dir_name));
|
rarch_path_basename, sizeof(content_dir_name));
|
||||||
|
|
||||||
fill_pathname_join_special_ext(remap_file_path,
|
fill_pathname_join_special_ext(remap_file_path,
|
||||||
directory_input_remapping, remap_path,
|
directory_input_remapping, remap_path,
|
||||||
content_dir_name,
|
content_dir_name,
|
||||||
|
@ -6852,7 +6852,6 @@ unsigned menu_displaylist_build_list(
|
|||||||
case DISPLAYLIST_OPTIONS_OVERRIDES:
|
case DISPLAYLIST_OPTIONS_OVERRIDES:
|
||||||
{
|
{
|
||||||
char config_directory[DIR_MAX_LENGTH];
|
char config_directory[DIR_MAX_LENGTH];
|
||||||
char content_dir_name[DIR_MAX_LENGTH];
|
|
||||||
char override_path[PATH_MAX_LENGTH];
|
char override_path[PATH_MAX_LENGTH];
|
||||||
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
||||||
rarch_system_info_t *sys_info = &runloop_st->system;
|
rarch_system_info_t *sys_info = &runloop_st->system;
|
||||||
@ -6865,7 +6864,6 @@ unsigned menu_displaylist_build_list(
|
|||||||
bool game_override_remove = false;
|
bool game_override_remove = false;
|
||||||
|
|
||||||
config_directory[0] = '\0';
|
config_directory[0] = '\0';
|
||||||
content_dir_name[0] = '\0';
|
|
||||||
override_path[0] = '\0';
|
override_path[0] = '\0';
|
||||||
|
|
||||||
fill_pathname_application_special(config_directory,
|
fill_pathname_application_special(config_directory,
|
||||||
@ -6874,6 +6872,8 @@ unsigned menu_displaylist_build_list(
|
|||||||
|
|
||||||
if (has_content)
|
if (has_content)
|
||||||
{
|
{
|
||||||
|
char content_dir_name[DIR_MAX_LENGTH];
|
||||||
|
|
||||||
/* Game-specific path */
|
/* Game-specific path */
|
||||||
fill_pathname_join_special_ext(override_path,
|
fill_pathname_join_special_ext(override_path,
|
||||||
config_directory, core_name,
|
config_directory, core_name,
|
||||||
|
24
runloop.c
24
runloop.c
@ -1150,21 +1150,19 @@ static bool validate_game_specific_options(char **output)
|
|||||||
static bool validate_folder_options(
|
static bool validate_folder_options(
|
||||||
char *s, size_t len, bool mkdir)
|
char *s, size_t len, bool mkdir)
|
||||||
{
|
{
|
||||||
char folder_name[DIR_MAX_LENGTH];
|
|
||||||
runloop_state_t *runloop_st = &runloop_state;
|
|
||||||
const char *core_name = runloop_st->system.info.library_name;
|
|
||||||
const char *game_path = path_get(RARCH_PATH_BASENAME);
|
const char *game_path = path_get(RARCH_PATH_BASENAME);
|
||||||
|
|
||||||
folder_name[0] = '\0';
|
if (!string_is_empty(game_path))
|
||||||
|
{
|
||||||
if (string_is_empty(game_path))
|
char folder_name[DIR_MAX_LENGTH];
|
||||||
return false;
|
runloop_state_t *runloop_st = &runloop_state;
|
||||||
|
const char *core_name = runloop_st->system.info.library_name;
|
||||||
fill_pathname_parent_dir_name(folder_name,
|
fill_pathname_parent_dir_name(folder_name,
|
||||||
game_path, sizeof(folder_name));
|
game_path, sizeof(folder_name));
|
||||||
|
return validate_per_core_options(s, len, mkdir,
|
||||||
return validate_per_core_options(s, len, mkdir,
|
core_name, folder_name);
|
||||||
core_name, folder_name);
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -323,8 +323,8 @@ static bool screenshot_dump(
|
|||||||
|
|
||||||
/* Append content directory name to screenshot
|
/* Append content directory name to screenshot
|
||||||
* path, if required */
|
* path, if required */
|
||||||
if (settings->bools.sort_screenshots_by_content_enable &&
|
if ( settings->bools.sort_screenshots_by_content_enable
|
||||||
!string_is_empty(content_dir))
|
&& !string_is_empty(content_dir))
|
||||||
{
|
{
|
||||||
char content_dir_name[DIR_MAX_LENGTH];
|
char content_dir_name[DIR_MAX_LENGTH];
|
||||||
fill_pathname_parent_dir_name(content_dir_name,
|
fill_pathname_parent_dir_name(content_dir_name,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user