(Menu) Add Content History Path

This commit is contained in:
twinaphex 2014-07-24 21:29:53 +02:00
parent dbe3da76f6
commit 631a1fc8bf
5 changed files with 31 additions and 15 deletions

View File

@ -530,6 +530,7 @@ static void menu_common_entries_init(void *data, unsigned menu_type)
#endif
file_list_push(menu->selection_buf, "Core Directory", MENU_LIBRETRO_DIR_PATH, 0);
file_list_push(menu->selection_buf, "Core Info Directory", MENU_LIBRETRO_INFO_DIR_PATH, 0);
file_list_push(menu->selection_buf, "Content History Path", MENU_SETTINGS_CONTENT_HISTORY_PATH, 0);
#ifdef HAVE_DYLIB
file_list_push(menu->selection_buf, "Software Filter Directory", MENU_FILTER_DIR_PATH, 0);
#endif
@ -2563,6 +2564,7 @@ static int menu_common_iterate(unsigned action)
type == MENU_SETTINGS_OVERLAY_PRESET ||
type == MENU_SETTINGS_VIDEO_SOFTFILTER ||
type == MENU_SETTINGS_AUDIO_DSP_FILTER ||
type == MENU_SETTINGS_CONTENT_HISTORY_PATH ||
type == MENU_SETTINGS_CORE ||
type == MENU_SETTINGS_CONFIG ||
type == MENU_SETTINGS_DISK_APPEND ||
@ -2690,6 +2692,11 @@ static int menu_common_iterate(unsigned action)
menu_flush_stack_type(MENU_SETTINGS);
ret = -1;
}
else if (menu_type == MENU_SETTINGS_CONTENT_HISTORY_PATH)
{
fill_pathname_join(g_settings.game_history_path, dir, path, sizeof(g_settings.input.overlay));
menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS);
}
else if (menu_type == MENU_BROWSER_DIR_PATH)
{
strlcpy(g_settings.menu_content_directory, dir, sizeof(g_settings.menu_content_directory));
@ -2847,6 +2854,7 @@ static int menu_common_iterate(unsigned action)
menu_common_type_is(menu_type) == MENU_SETTINGS_SHADER_OPTIONS ||
menu_common_type_is(menu_type) == MENU_FILE_DIRECTORY ||
menu_type == MENU_SETTINGS_OVERLAY_PRESET ||
menu_type == MENU_SETTINGS_CONTENT_HISTORY_PATH ||
menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER ||
menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER ||
menu_type == MENU_SETTINGS_DEFERRED_CORE ||
@ -3965,6 +3973,21 @@ static int menu_common_setting_set(unsigned setting, unsigned action)
}
break;
#endif
case MENU_SETTINGS_CONTENT_HISTORY_PATH:
switch (action)
{
case MENU_ACTION_OK:
file_list_push(driver.menu->menu_stack, g_settings.game_history_path, setting, driver.menu->selection_ptr);
menu_clear_navigation(driver.menu);
driver.menu->need_refresh = true;
break;
case MENU_ACTION_START:
*g_settings.game_history_path = '\0';
break;
default:
break;
}
break;
case MENU_SETTINGS_VIDEO_SOFTFILTER:
switch (action)
{
@ -5191,6 +5214,9 @@ static void menu_common_setting_set_label(char *type_str, size_t type_str_size,
snprintf(type_str, type_str_size, "%.2f", g_settings.input.overlay_scale);
break;
#endif
case MENU_SETTINGS_CONTENT_HISTORY_PATH:
strlcpy(type_str, g_settings.game_history_path ? g_settings.game_history_path : "<None>", type_str_size);
break;
case MENU_SETTINGS_BIND_PLAYER:
snprintf(type_str, type_str_size, "#%d", driver.menu->current_pad + 1);
break;

View File

@ -131,6 +131,7 @@ typedef enum
MENU_SETTINGS_WINDOW_COMPOSITING_ENABLE,
MENU_SETTINGS_PAUSE_IF_WINDOW_FOCUS_LOST,
MENU_CONTENT_HISTORY_SIZE,
MENU_SETTINGS_CONTENT_HISTORY_PATH,
MENU_SCREENSHOT_DIR_PATH,
MENU_BROWSER_DIR_PATH,
MENU_CONTENT_DIR_PATH,

View File

@ -176,20 +176,8 @@ static void menu_init_history(menu_handle_t *menu)
{
menu_free_history(menu);
if (*g_extern.config_path)
{
char history_path[PATH_MAX];
if (*g_settings.game_history_path)
strlcpy(history_path, g_settings.game_history_path, sizeof(history_path));
else
{
fill_pathname_resolve_relative(history_path, g_extern.config_path,
".retroarch-game-history.txt", sizeof(history_path));
}
RARCH_LOG("[Menu]: Opening history: %s.\n", history_path);
menu->history = content_history_init(history_path, g_settings.game_history_size);
}
RARCH_LOG("[Menu]: Opening history: %s.\n", g_settings.game_history_path);
menu->history = content_history_init(g_settings.game_history_path, g_settings.game_history_size);
}
static void menu_update_libretro_info(menu_handle_t *menu)

View File

@ -1090,6 +1090,7 @@ 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");
fill_pathname_resolve_relative(g_settings.game_history_path, g_extern.config_path, ".retroarch-game-history.txt", sizeof(g_settings.game_history_path));
CONFIG_GET_PATH(game_history_path, "game_history_path");
CONFIG_GET_INT(game_history_size, "game_history_size");

View File

@ -670,7 +670,7 @@ static void general_change_handler(const void *data)
else if (!strcmp(setting->name, "cheat_settings_path"))
strlcpy(g_settings.cheat_settings_path, setting->value.string, sizeof(g_settings.cheat_settings_path));
else if (!strcmp(setting->name, "game_history_path"))
strlcpy(g_settings.cheat_settings_path, setting->value.string, sizeof(g_settings.cheat_settings_path));
strlcpy(g_settings.game_history_path, setting->value.string, sizeof(g_settings.game_history_path));
else if (!strcmp(setting->name, "video_shader_dir"))
strlcpy(g_settings.video.filter_dir, setting->value.string, sizeof(g_settings.video.filter_dir));
else if (!strcmp(setting->name, "video_aspect_ratio_auto"))