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
@ -665,10 +665,13 @@ static bool event_init_core(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pretro_set_environment(rarch_environment_cb);
|
pretro_set_environment(rarch_environment_cb);
|
||||||
|
|
||||||
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");
|
||||||
@ -1817,7 +1823,7 @@ bool config_load_override(void)
|
|||||||
{
|
{
|
||||||
RARCH_WARN("Can't use overrides in conjunction with netplay, disabling overrides\n");
|
RARCH_WARN("Can't use overrides in conjunction with netplay, disabling overrides\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char buf[PATH_MAX_LENGTH];
|
char buf[PATH_MAX_LENGTH];
|
||||||
@ -1829,7 +1835,7 @@ bool config_load_override(void)
|
|||||||
global->has_set_state_path = false;
|
global->has_set_state_path = false;
|
||||||
|
|
||||||
if (config_load_file(global->config_path, false))
|
if (config_load_file(global->config_path, false))
|
||||||
{
|
{
|
||||||
// Restore the libretro_path we're using since it will be overwritten by the override when reloading
|
// Restore the libretro_path we're using since it will be overwritten by the override when reloading
|
||||||
strlcpy(settings->libretro,buf,sizeof(settings->libretro));
|
strlcpy(settings->libretro,buf,sizeof(settings->libretro));
|
||||||
rarch_main_msg_queue_push("Configuration override loaded", 1, 100, true);
|
rarch_main_msg_queue_push("Configuration override loaded", 1, 100, true);
|
||||||
@ -1860,16 +1866,16 @@ bool config_load_override(void)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
*global->append_config_path = '\0';
|
*global->append_config_path = '\0';
|
||||||
|
|
||||||
// Toggle has_save_path to false so it resets
|
// Toggle has_save_path to false so it resets
|
||||||
global->has_set_save_path = false;
|
global->has_set_save_path = false;
|
||||||
global->has_set_state_path = false;
|
global->has_set_state_path = false;
|
||||||
|
|
||||||
if (config_load_file(global->config_path, false))
|
if (config_load_file(global->config_path, false))
|
||||||
{
|
{
|
||||||
RARCH_LOG("Configuration overrides unloaded, original configuration reset\n");
|
RARCH_LOG("Configuration overrides unloaded, original configuration reset\n");
|
||||||
|
|
||||||
// Reset save paths
|
// Reset save paths
|
||||||
global->has_set_save_path = true;
|
global->has_set_save_path = true;
|
||||||
global->has_set_state_path = true;
|
global->has_set_state_path = true;
|
||||||
|
|
||||||
@ -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);
|
||||||
|
@ -33,7 +33,7 @@ extern "C" {
|
|||||||
|
|
||||||
typedef struct settings
|
typedef struct settings
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
char driver[32];
|
char driver[32];
|
||||||
char context_driver[32];
|
char context_driver[32];
|
||||||
@ -105,7 +105,7 @@ typedef struct settings
|
|||||||
} ui;
|
} ui;
|
||||||
|
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
char driver[32];
|
char driver[32];
|
||||||
bool pause_libretro;
|
bool pause_libretro;
|
||||||
@ -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;
|
||||||
|
43
retroarch.c
43
retroarch.c
@ -273,7 +273,7 @@ static void set_basename(const char *path)
|
|||||||
* /file/to/path/comp.7z#folder/game.extension
|
* /file/to/path/comp.7z#folder/game.extension
|
||||||
*
|
*
|
||||||
* The choice I take here is:
|
* The choice I take here is:
|
||||||
* /file/to/path/game as basename. We might end up in a writable
|
* /file/to/path/game as basename. We might end up in a writable
|
||||||
* directory then and the name of srm and states are meaningful.
|
* directory then and the name of srm and states are meaningful.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -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,9 +356,9 @@ 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))
|
||||||
{
|
{
|
||||||
fill_pathname_dir(global->savestate_name, global->basename,
|
fill_pathname_dir(global->savestate_name, global->basename,
|
||||||
@ -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)
|
||||||
@ -388,7 +411,7 @@ void rarch_set_paths(const char *path)
|
|||||||
/**
|
/**
|
||||||
* parse_input:
|
* parse_input:
|
||||||
* @argc : Count of (commandline) arguments.
|
* @argc : Count of (commandline) arguments.
|
||||||
* @argv : (Commandline) arguments.
|
* @argv : (Commandline) arguments.
|
||||||
*
|
*
|
||||||
* Parses (commandline) arguments passed to RetroArch.
|
* Parses (commandline) arguments passed to RetroArch.
|
||||||
*
|
*
|
||||||
@ -423,8 +446,8 @@ static void parse_input(int argc, char *argv[])
|
|||||||
*global->bps_name = '\0';
|
*global->bps_name = '\0';
|
||||||
*global->ips_name = '\0';
|
*global->ips_name = '\0';
|
||||||
*global->subsystem = '\0';
|
*global->subsystem = '\0';
|
||||||
|
|
||||||
global->overrides_active = false;
|
global->overrides_active = false;
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
@ -820,7 +843,7 @@ static void rarch_init_savefile_paths(void)
|
|||||||
/* For subsystems, we know exactly which RAM types are supported. */
|
/* For subsystems, we know exactly which RAM types are supported. */
|
||||||
|
|
||||||
unsigned i, j;
|
unsigned i, j;
|
||||||
const struct retro_subsystem_info *info =
|
const struct retro_subsystem_info *info =
|
||||||
libretro_find_subsystem_info(
|
libretro_find_subsystem_info(
|
||||||
global->system.special, global->system.num_special,
|
global->system.special, global->system.num_special,
|
||||||
global->subsystem);
|
global->subsystem);
|
||||||
@ -1445,7 +1468,7 @@ int rarch_defer_core(core_info_list_t *core_info, const char *dir,
|
|||||||
else
|
else
|
||||||
strlcpy(new_core_path, info->path, sizeof(new_core_path));
|
strlcpy(new_core_path, info->path, sizeof(new_core_path));
|
||||||
|
|
||||||
/* There are multiple deferred cores and a
|
/* There are multiple deferred cores and a
|
||||||
* selection needs to be made from a list, return 0. */
|
* selection needs to be made from a list, return 0. */
|
||||||
if (supported != 1)
|
if (supported != 1)
|
||||||
return 0;
|
return 0;
|
||||||
@ -1483,7 +1506,7 @@ bool rarch_replace_config(const char *path)
|
|||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
|
|
||||||
/* If config file to be replaced is the same as the
|
/* If config file to be replaced is the same as the
|
||||||
* current config file, exit. */
|
* current config file, exit. */
|
||||||
if (!strcmp(path, global->config_path))
|
if (!strcmp(path, global->config_path))
|
||||||
return false;
|
return false;
|
||||||
|
@ -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