mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
make it possible to sort savestates/savefiles without overrides too
This commit is contained in:
parent
f057b7f8df
commit
8c09578f51
@ -669,6 +669,9 @@ static bool event_init_core(void)
|
|||||||
if(settings->auto_remaps_enable)
|
if(settings->auto_remaps_enable)
|
||||||
config_load_remap();
|
config_load_remap();
|
||||||
|
|
||||||
|
if(settings->sort_savestates_enable || settings->sort_savefiles_enable)
|
||||||
|
set_paths_redirect(global->basename);
|
||||||
|
|
||||||
rarch_verify_api_version();
|
rarch_verify_api_version();
|
||||||
pretro_init();
|
pretro_init();
|
||||||
|
|
||||||
|
@ -494,6 +494,9 @@ static bool default_core_specific_config = false;
|
|||||||
static bool default_auto_overrides_enable = false;
|
static bool default_auto_overrides_enable = false;
|
||||||
static bool default_auto_remaps_enable = false;
|
static bool default_auto_remaps_enable = false;
|
||||||
|
|
||||||
|
static bool default_sort_savefiles_enable = false;
|
||||||
|
static bool default_sort_savestates_enable = false;
|
||||||
|
|
||||||
static unsigned default_menu_btn_ok = RETRO_DEVICE_ID_JOYPAD_A;
|
static unsigned default_menu_btn_ok = RETRO_DEVICE_ID_JOYPAD_A;
|
||||||
static unsigned default_menu_btn_cancel = RETRO_DEVICE_ID_JOYPAD_B;
|
static unsigned default_menu_btn_cancel = RETRO_DEVICE_ID_JOYPAD_B;
|
||||||
static unsigned default_menu_btn_search = RETRO_DEVICE_ID_JOYPAD_X;
|
static unsigned default_menu_btn_search = RETRO_DEVICE_ID_JOYPAD_X;
|
||||||
|
@ -689,6 +689,9 @@ static void config_set_defaults(void)
|
|||||||
settings->auto_overrides_enable = default_auto_overrides_enable;
|
settings->auto_overrides_enable = default_auto_overrides_enable;
|
||||||
settings->auto_remaps_enable = default_auto_remaps_enable;
|
settings->auto_remaps_enable = default_auto_remaps_enable;
|
||||||
|
|
||||||
|
settings->sort_savefiles_enable = default_sort_savefiles_enable;
|
||||||
|
settings->sort_savestates_enable = default_sort_savestates_enable;
|
||||||
|
|
||||||
settings->menu_ok_btn = default_menu_btn_ok;
|
settings->menu_ok_btn = default_menu_btn_ok;
|
||||||
settings->menu_cancel_btn = default_menu_btn_cancel;
|
settings->menu_cancel_btn = default_menu_btn_cancel;
|
||||||
settings->menu_search_btn = default_menu_btn_search;
|
settings->menu_search_btn = default_menu_btn_search;
|
||||||
@ -1620,6 +1623,9 @@ static bool config_load_file(const char *path, bool set_defaults)
|
|||||||
CONFIG_GET_BOOL_BASE(conf, settings, auto_overrides_enable, "auto_overrides_enable");
|
CONFIG_GET_BOOL_BASE(conf, settings, auto_overrides_enable, "auto_overrides_enable");
|
||||||
CONFIG_GET_BOOL_BASE(conf, settings, auto_remaps_enable, "auto_remaps_enable");
|
CONFIG_GET_BOOL_BASE(conf, settings, auto_remaps_enable, "auto_remaps_enable");
|
||||||
|
|
||||||
|
CONFIG_GET_BOOL_BASE(conf, settings, sort_savefiles_enable, "sort_savefiles_enable");
|
||||||
|
CONFIG_GET_BOOL_BASE(conf, settings, sort_savestates_enable, "sort_savestates_enable");
|
||||||
|
|
||||||
CONFIG_GET_INT_BASE(conf, settings, menu_ok_btn, "menu_ok_btn");
|
CONFIG_GET_INT_BASE(conf, settings, menu_ok_btn, "menu_ok_btn");
|
||||||
CONFIG_GET_INT_BASE(conf, settings, menu_cancel_btn, "menu_cancel_btn");
|
CONFIG_GET_INT_BASE(conf, settings, menu_cancel_btn, "menu_cancel_btn");
|
||||||
CONFIG_GET_INT_BASE(conf, settings, menu_search_btn, "menu_search_btn");
|
CONFIG_GET_INT_BASE(conf, settings, menu_search_btn, "menu_search_btn");
|
||||||
@ -2535,6 +2541,10 @@ bool config_save_file(const char *path)
|
|||||||
settings->auto_overrides_enable);
|
settings->auto_overrides_enable);
|
||||||
config_set_bool(conf, "auto_remaps_enable",
|
config_set_bool(conf, "auto_remaps_enable",
|
||||||
settings->auto_remaps_enable);
|
settings->auto_remaps_enable);
|
||||||
|
config_set_bool(conf, "sort_savefiles_enable",
|
||||||
|
settings->sort_savefiles_enable);
|
||||||
|
config_set_bool(conf, "sort_savestates_enable",
|
||||||
|
settings->sort_savestates_enable);
|
||||||
config_set_int(conf, "libretro_log_level", settings->libretro_log_level);
|
config_set_int(conf, "libretro_log_level", settings->libretro_log_level);
|
||||||
config_set_bool(conf, "log_verbosity", global->verbosity);
|
config_set_bool(conf, "log_verbosity", global->verbosity);
|
||||||
config_set_bool(conf, "perfcnt_enable", global->perfcnt_enable);
|
config_set_bool(conf, "perfcnt_enable", global->perfcnt_enable);
|
||||||
|
@ -323,6 +323,9 @@ typedef struct settings
|
|||||||
bool auto_overrides_enable;
|
bool auto_overrides_enable;
|
||||||
bool auto_remaps_enable;
|
bool auto_remaps_enable;
|
||||||
|
|
||||||
|
bool sort_savefiles_enable;
|
||||||
|
bool sort_savestates_enable;
|
||||||
|
|
||||||
unsigned menu_ok_btn;
|
unsigned menu_ok_btn;
|
||||||
unsigned menu_cancel_btn;
|
unsigned menu_cancel_btn;
|
||||||
unsigned menu_search_btn;
|
unsigned menu_search_btn;
|
||||||
|
27
retroarch.c
27
retroarch.c
@ -326,9 +326,25 @@ static void set_special_paths(char **argv, unsigned num_content)
|
|||||||
sizeof(settings->system_directory));
|
sizeof(settings->system_directory));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_paths_redirect(const char *path)
|
void set_paths_redirect(const char *path)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
|
char orig_savestate_dir[PATH_MAX_LENGTH] = "";
|
||||||
|
char orig_savefile_dir[PATH_MAX_LENGTH] = "";
|
||||||
|
|
||||||
|
if (global->system.info.library_name && strcmp(global->system.info.library_name,"No Core") && settings->sort_savefiles_enable)
|
||||||
|
{
|
||||||
|
strlcpy(orig_savefile_dir,global->savefile_dir,sizeof(global->savefile_dir));
|
||||||
|
fill_pathname_dir(global->savefile_dir,global->savefile_dir,global->system.info.library_name,sizeof(global->savefile_dir));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (global->system.info.library_name && strcmp(global->system.info.library_name,"No Core") && settings->sort_savestates_enable)
|
||||||
|
{
|
||||||
|
strlcpy(orig_savestate_dir,global->savestate_dir,sizeof(global->savestate_dir));
|
||||||
|
fill_pathname_dir(global->savestate_dir,global->savestate_dir,global->system.info.library_name,sizeof(global->savestate_dir));
|
||||||
|
}
|
||||||
|
|
||||||
if(path_is_directory(global->savefile_dir))
|
if(path_is_directory(global->savefile_dir))
|
||||||
strlcpy(global->savefile_name,global->savefile_dir,sizeof(global->savefile_dir));
|
strlcpy(global->savefile_name,global->savefile_dir,sizeof(global->savefile_dir));
|
||||||
@ -340,7 +356,7 @@ static void set_paths_redirect(const char *path)
|
|||||||
{
|
{
|
||||||
fill_pathname_dir(global->savefile_name, global->basename,
|
fill_pathname_dir(global->savefile_name, global->basename,
|
||||||
".srm", sizeof(global->savefile_name));
|
".srm", sizeof(global->savefile_name));
|
||||||
RARCH_LOG("Redirecting save file to \"%s\".\n", global->savefile_name);
|
RARCH_LOG("%s \nRedirecting save file to \"%s\".\n", orig_savefile_dir,global->savefile_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path_is_directory(global->savestate_name))
|
if (path_is_directory(global->savestate_name))
|
||||||
@ -356,6 +372,13 @@ static void set_paths_redirect(const char *path)
|
|||||||
".state", sizeof(global->cheatfile_name));
|
".state", sizeof(global->cheatfile_name));
|
||||||
RARCH_LOG("Redirecting cheat file to \"%s\".\n", global->cheatfile_name);
|
RARCH_LOG("Redirecting cheat file to \"%s\".\n", global->cheatfile_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(global->system.info.library_name && strcmp(global->system.info.library_name,"No Core") && settings->sort_savefiles_enable)
|
||||||
|
strlcpy(global->savefile_dir,orig_savefile_dir,sizeof(global->savefile_dir));
|
||||||
|
|
||||||
|
if(global->system.info.library_name && strcmp(global->system.info.library_name,"No Core") && settings->sort_savestates_enable)
|
||||||
|
strlcpy(global->savestate_dir,orig_savestate_dir,sizeof(global->savestate_dir));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void rarch_set_paths(const char *path)
|
void rarch_set_paths(const char *path)
|
||||||
|
@ -167,6 +167,8 @@ void rarch_init_system_av_info(void);
|
|||||||
|
|
||||||
void rarch_set_paths(const char *path);
|
void rarch_set_paths(const char *path);
|
||||||
|
|
||||||
|
void set_paths_redirect(const char *path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rarch_print_compiler:
|
* rarch_print_compiler:
|
||||||
*
|
*
|
||||||
|
24
settings.c
24
settings.c
@ -3682,6 +3682,30 @@ static bool setting_append_list_general_options(
|
|||||||
general_write_handler,
|
general_write_handler,
|
||||||
general_read_handler);
|
general_read_handler);
|
||||||
|
|
||||||
|
CONFIG_BOOL(
|
||||||
|
settings->sort_savefiles_enable,
|
||||||
|
"sort_savefiles_enable",
|
||||||
|
"Sort Saves In Folders",
|
||||||
|
default_sort_savefiles_enable,
|
||||||
|
"OFF",
|
||||||
|
"ON",
|
||||||
|
group_info.name,
|
||||||
|
subgroup_info.name,
|
||||||
|
general_write_handler,
|
||||||
|
general_read_handler);
|
||||||
|
|
||||||
|
CONFIG_BOOL(
|
||||||
|
settings->sort_savestates_enable,
|
||||||
|
"sort_savestates_enable",
|
||||||
|
"Sort Saves States In Folders",
|
||||||
|
default_sort_savestates_enable,
|
||||||
|
"OFF",
|
||||||
|
"ON",
|
||||||
|
group_info.name,
|
||||||
|
subgroup_info.name,
|
||||||
|
general_write_handler,
|
||||||
|
general_read_handler);
|
||||||
|
|
||||||
END_SUB_GROUP(list, list_info);
|
END_SUB_GROUP(list, list_info);
|
||||||
|
|
||||||
START_SUB_GROUP(list, list_info, "Logging", group_info.name, subgroup_info);
|
START_SUB_GROUP(list, list_info, "Logging", group_info.name, subgroup_info);
|
||||||
|
Loading…
Reference in New Issue
Block a user