mirror of
https://github.com/libretro/RetroArch.git
synced 2024-12-03 05:40:56 +00:00
De-opaque history.
This commit is contained in:
parent
cce0ec63a4
commit
e2c1ba096d
@ -18,6 +18,7 @@
|
||||
#define DRIVER_MENU_H__
|
||||
|
||||
#include "frontend/menu/file_list.h"
|
||||
#include "frontend/menu/history.h"
|
||||
|
||||
typedef struct menu_ctx_driver_backend
|
||||
{
|
||||
@ -154,7 +155,7 @@ typedef struct
|
||||
void *parameter_shader; // Points to either shader or graphics driver current shader.
|
||||
unsigned current_pad;
|
||||
|
||||
void *history;
|
||||
rom_history_t *history;
|
||||
retro_time_t last_time; // Used to throttle menu in case VSync is broken.
|
||||
|
||||
struct menu_bind_state binds;
|
||||
|
@ -42,12 +42,11 @@ struct rom_history
|
||||
char *conf_path;
|
||||
};
|
||||
|
||||
void rom_history_get_index(void *data,
|
||||
void rom_history_get_index(rom_history_t *hist,
|
||||
size_t index,
|
||||
const char **path, const char **core_path,
|
||||
const char **core_name)
|
||||
{
|
||||
rom_history_t *hist = (rom_history_t*)data;
|
||||
if (!hist)
|
||||
return;
|
||||
|
||||
@ -64,12 +63,11 @@ static void rom_history_free_entry(struct rom_history_entry *entry)
|
||||
memset(entry, 0, sizeof(*entry));
|
||||
}
|
||||
|
||||
void rom_history_push(void *data,
|
||||
void rom_history_push(rom_history_t *hist,
|
||||
const char *path, const char *core_path,
|
||||
const char *core_name)
|
||||
{
|
||||
size_t i;
|
||||
rom_history_t *hist = (rom_history_t*)data;
|
||||
|
||||
if (!hist)
|
||||
return;
|
||||
@ -110,10 +108,9 @@ void rom_history_push(void *data,
|
||||
hist->size++;
|
||||
}
|
||||
|
||||
static void rom_history_write_file(void *data)
|
||||
static void rom_history_write_file(rom_history_t *hist)
|
||||
{
|
||||
size_t i;
|
||||
rom_history_t *hist = (rom_history_t*)data;
|
||||
FILE *file = fopen(hist->conf_path, "w");
|
||||
if (!file || !hist)
|
||||
return;
|
||||
@ -129,10 +126,9 @@ static void rom_history_write_file(void *data)
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
void rom_history_free(void *data)
|
||||
void rom_history_free(rom_history_t *hist)
|
||||
{
|
||||
size_t i;
|
||||
rom_history_t *hist = (rom_history_t*)data;
|
||||
if (!hist)
|
||||
return;
|
||||
|
||||
@ -147,10 +143,9 @@ void rom_history_free(void *data)
|
||||
free(hist);
|
||||
}
|
||||
|
||||
void rom_history_clear(void *data)
|
||||
void rom_history_clear(rom_history_t *hist)
|
||||
{
|
||||
size_t i;
|
||||
rom_history_t *hist = (rom_history_t*)data;
|
||||
if (!hist)
|
||||
return;
|
||||
|
||||
@ -159,19 +154,17 @@ void rom_history_clear(void *data)
|
||||
hist->size = 0;
|
||||
}
|
||||
|
||||
size_t rom_history_size(void *data)
|
||||
size_t rom_history_size(rom_history_t *hist)
|
||||
{
|
||||
rom_history_t *hist = (rom_history_t*)data;
|
||||
if (hist)
|
||||
return hist->size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool rom_history_read_file(void *data, const char *path)
|
||||
static bool rom_history_read_file(rom_history_t *hist, const char *path)
|
||||
{
|
||||
rom_history_t *hist = (rom_history_t*)data;
|
||||
FILE *file = fopen(path, "r");
|
||||
if (!file || !data)
|
||||
if (!file || !hist)
|
||||
return true;
|
||||
|
||||
char buf[3][PATH_MAX];
|
||||
@ -232,10 +225,9 @@ error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* rom_history_get_path(void *data, unsigned index)
|
||||
const char* rom_history_get_path(rom_history_t *hist, unsigned index)
|
||||
{
|
||||
const char *path, *core_path, *core_name;
|
||||
rom_history_t* hist = (rom_history_t*)data;
|
||||
if (!hist)
|
||||
return "";
|
||||
|
||||
@ -250,10 +242,9 @@ const char* rom_history_get_path(void *data, unsigned index)
|
||||
return "";
|
||||
}
|
||||
|
||||
const char *rom_history_get_core_path(void *data, unsigned index)
|
||||
const char *rom_history_get_core_path(rom_history_t *hist, unsigned index)
|
||||
{
|
||||
const char *path, *core_path, *core_name;
|
||||
rom_history_t* hist = (rom_history_t*)data;
|
||||
if (!hist)
|
||||
return "";
|
||||
|
||||
@ -268,10 +259,9 @@ const char *rom_history_get_core_path(void *data, unsigned index)
|
||||
return "";
|
||||
}
|
||||
|
||||
const char *rom_history_get_core_name(void *data, unsigned index)
|
||||
const char *rom_history_get_core_name(rom_history_t *hist, unsigned index)
|
||||
{
|
||||
const char *path, *core_path, *core_name;
|
||||
rom_history_t* hist = (rom_history_t*)data;
|
||||
|
||||
if (!hist)
|
||||
return "";
|
||||
|
@ -25,26 +25,26 @@ extern "C" {
|
||||
typedef struct rom_history rom_history_t;
|
||||
|
||||
rom_history_t *rom_history_init(const char *path, size_t size);
|
||||
void rom_history_free(void *data);
|
||||
void rom_history_free(rom_history_t *hist);
|
||||
|
||||
void rom_history_clear(void *data);
|
||||
void rom_history_clear(rom_history_t *hist);
|
||||
|
||||
size_t rom_history_size(void *data);
|
||||
size_t rom_history_size(rom_history_t *hist);
|
||||
|
||||
void rom_history_get_index(void *data,
|
||||
void rom_history_get_index(rom_history_t *hist,
|
||||
size_t index,
|
||||
const char **path, const char **core_path,
|
||||
const char **core_name);
|
||||
|
||||
void rom_history_push(void *data,
|
||||
void rom_history_push(rom_history_t *hist,
|
||||
const char *path, const char *core_path,
|
||||
const char *core_name);
|
||||
|
||||
const char* rom_history_get_path(void *data,
|
||||
const char* rom_history_get_path(rom_history_t *hist,
|
||||
unsigned index);
|
||||
const char* rom_history_get_core_path(void *data,
|
||||
const char* rom_history_get_core_path(rom_history_t *hist,
|
||||
unsigned index);
|
||||
const char* rom_history_get_core_name(void *data,
|
||||
const char* rom_history_get_core_name(rom_history_t *hist,
|
||||
unsigned index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Loading…
Reference in New Issue
Block a user