Load history.

This commit is contained in:
Themaister 2013-04-28 00:35:20 +02:00
parent 30ac2ebfcf
commit 901516d283
3 changed files with 22 additions and 3 deletions

View File

@ -34,6 +34,8 @@ extern "C" {
#include "../../gfx/shader_parse.h"
#endif
#include "history.h"
#define RGUI_MAX_SHADERS 8
#if defined(HAVE_RMENU) || defined(HAVE_RMENU_XUI)
@ -118,6 +120,7 @@ typedef enum
// settings options are done here too
RGUI_SETTINGS_OPEN_FILEBROWSER,
RGUI_SETTINGS_OPEN_HISTORY,
RGUI_SETTINGS_CORE,
RGUI_SETTINGS_CORE_OPTIONS,
RGUI_SETTINGS_REWIND_ENABLE,
@ -227,6 +230,8 @@ typedef struct
#ifdef HAVE_SHADER_MANAGER
struct gfx_shader shader;
#endif
rom_history_t *history;
} rgui_handle_t;
extern rgui_handle_t *rgui;

View File

@ -225,18 +225,24 @@ rgui_handle_t *rgui_init(void)
(float)custom->width / custom->height;
}
char history_path[PATH_MAX];
fill_pathname_resolve_relative(history_path, g_extern.config_path,
".retroarch-history.txt", sizeof(history_path));
rgui->history = rom_history_init(history_path, 20);
return rgui;
}
void rgui_free(rgui_handle_t *rgui)
{
if (rgui->alloc_font)
free((uint8_t *) rgui->font);
free((uint8_t*)rgui->font);
#ifdef HAVE_DYNAMIC
libretro_free_system_info(&rgui->info);
#endif
rom_history_free(rgui->history);
rgui_list_free(rgui->menu_stack);
rgui_list_free(rgui->selection_buf);
}

View File

@ -309,7 +309,8 @@ static config_file_t *open_default_config_file(void)
#if defined(_WIN32) && !defined(_XBOX)
// Just do something for now.
char conf_path[PATH_MAX];
conf = config_file_new("retroarch.cfg");
strlcpy(conf_path, "retroarch.cfg", sizeof(conf_path));
conf = config_file_new(conf_path);
if (!conf)
{
const char *appdata = getenv("APPDATA");
@ -347,11 +348,18 @@ static config_file_t *open_default_config_file(void)
// Try this as a last chance ...
if (!conf)
{
conf = config_file_new("/etc/retroarch.cfg");
strlcpy(conf_path, "/etc/retroarch.cfg", sizeof(conf_path));
conf = config_file_new(conf_path);
RARCH_LOG("Looking for config in: \"/etc/retroarch.cfg\".\n");
}
#endif
if (conf)
{
strlcpy(g_extern.config_path, conf_path,
sizeof(g_extern.config_path));
}
return conf;
}