Add content history dir and change 'retroarch-history.txt' to 'retroarch-content-history.txt'

This commit is contained in:
twinaphex 2014-11-27 08:46:30 +01:00
parent 5998ca0f5d
commit df8e3dfc55
7 changed files with 30 additions and 13 deletions

View File

@ -78,7 +78,7 @@ public final class HistorySelection extends DialogFragment
adapter = new IconAdapter<HistoryWrapper>(ctx, R.layout.line_list_item);
// Populate the adapter
File history = new File(ctx.getApplicationInfo().dataDir, "retroarch-history.txt");
File history = new File(ctx.getApplicationInfo().dataDir, "retroarch-content-history.txt");
try
{
BufferedReader br = new BufferedReader(new InputStreamReader(

View File

@ -238,7 +238,7 @@ public final class UserPreferences
}
config.setBoolean("video_font_enable", prefs.getBoolean("video_font_enable", true));
config.setString("game_history_path", dataDir + "/retroarch-history.txt");
config.setString("game_history_path", dataDir + "/retroarch-content-history.txt");
// FIXME: This is incomplete. Need analog axes as well.
for (int i = 1; i <= 4; i++)

View File

@ -144,6 +144,8 @@ static void check_defaults_dirs(void)
path_mkdir(g_defaults.resampler_dir);
if (*g_defaults.menu_config_dir)
path_mkdir(g_defaults.menu_config_dir);
if (*g_defaults.content_history_dir)
path_mkdir(g_defaults.content_history_dir);
}
static void history_playlist_push(content_playlist_t *playlist,

View File

@ -623,6 +623,8 @@ static void frontend_android_get_environment_settings(int *argc,
path, "audio_filters", sizeof(g_defaults.audio_filter_dir));
fill_pathname_join(g_defaults.video_filter_dir,
path, "video_filters", sizeof(g_defaults.video_filter_dir));
strlcpy(g_defaults.content_history_dir,
path, sizeof(g_defaults.content_history_dir));
}
}
}

View File

@ -213,6 +213,7 @@ struct defaults
char screenshot_dir[PATH_MAX];
char system_dir[PATH_MAX];
char playlist_dir[PATH_MAX];
char content_history_dir[PATH_MAX];
struct
{
@ -388,6 +389,7 @@ struct settings
char core_options_path[PATH_MAX];
char content_history_path[PATH_MAX];
char content_history_directory[PATH_MAX];
unsigned content_history_size;
char libretro[PATH_MAX];

View File

@ -12,10 +12,13 @@
# will be extracted to this directory.
# extraction_directory =
# If set to a directory, the content history playlist will be saved
# to this directory along with any other playlists.
# Save all playlist files to this directory.
# playlist_directory =
# If set to a directory, the content history playlist will be saved
# to this directory.
# content_history_dir =
# Automatically saves a savestate at the end of RetroArch's lifetime.
# The path is $SRAM_PATH.auto.
# RetroArch will automatically load any savestate with this path on startup if savestate_auto_load is set.

View File

@ -501,6 +501,7 @@ static void config_set_defaults(void)
*g_settings.core_options_path = '\0';
*g_settings.content_history_path = '\0';
*g_settings.content_history_directory = '\0';
*g_settings.cheat_database = '\0';
*g_settings.cheat_settings_path = '\0';
*g_settings.resampler_directory = '\0';
@ -600,6 +601,10 @@ static void config_set_defaults(void)
strlcpy(g_settings.resampler_directory,
g_defaults.resampler_dir,
sizeof(g_settings.resampler_directory));
if (*g_defaults.content_history_dir)
strlcpy(g_settings.content_history_directory,
g_defaults.content_history_dir,
sizeof(g_settings.content_history_directory));
if (*g_defaults.config_path)
fill_pathname_expand_special(g_extern.config_path,
@ -1144,15 +1149,7 @@ static bool config_load_file(const char *path, bool set_defaults)
CONFIG_GET_INT(network_cmd_port, "network_cmd_port");
CONFIG_GET_BOOL(stdin_cmd_enable, "stdin_cmd_enable");
if (g_settings.playlist_directory[0] != '\0')
fill_pathname_join(g_settings.content_history_path,
g_settings.playlist_directory,
"retroarch-content-history.txt",
sizeof(g_settings.content_history_path));
else
fill_pathname_resolve_relative(g_settings.content_history_path,
g_extern.config_path, "retroarch-content-history.txt",
sizeof(g_settings.content_history_path));
CONFIG_GET_PATH(content_history_directory, "content_history_dir");
CONFIG_GET_BOOL(history_list_enable, "history_list_enable");
@ -1222,6 +1219,16 @@ static bool config_load_file(const char *path, bool set_defaults)
RARCH_WARN("savestate_directory is not a directory, ignoring ...\n");
}
if (g_settings.content_history_directory[0] != '\0')
fill_pathname_join(g_settings.content_history_path,
g_settings.content_history_directory,
"retroarch-content-history.txt",
sizeof(g_settings.content_history_path));
else
fill_pathname_resolve_relative(g_settings.content_history_path,
g_extern.config_path, "retroarch-content-history.txt",
sizeof(g_settings.content_history_path));
if (!config_get_path(conf, "system_directory",
g_settings.system_directory, sizeof(g_settings.system_directory)))
{
@ -1546,6 +1553,7 @@ bool config_save_file(const char *path)
config_set_path(conf, "libretro_directory", g_settings.libretro_directory);
config_set_path(conf, "libretro_info_path", g_settings.libretro_info_path);
config_set_path(conf, "cheat_database_path", g_settings.cheat_database);
config_set_path(conf, "content_history_dir", g_settings.content_history_directory);
config_set_bool(conf, "rewind_enable", g_settings.rewind_enable);
config_set_int(conf, "audio_latency", g_settings.audio.latency);
config_set_bool(conf, "audio_sync", g_settings.audio.sync);