mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 22:13:51 +00:00
Rename ROM history to Content history
This commit is contained in:
parent
d9846f2a37
commit
87a21b2e13
@ -112,13 +112,13 @@
|
||||
@property (nonatomic) NSString* core;
|
||||
@end
|
||||
|
||||
/*********************************************/
|
||||
/* RAHistoryMenu */
|
||||
/* Menu object that displays and allows */
|
||||
/* launching a file from the ROM history. */
|
||||
/*********************************************/
|
||||
/*************************************************/
|
||||
/* RAHistoryMenu */
|
||||
/* Menu object that displays and allows */
|
||||
/* launching a file from the content history. */
|
||||
/*************************************************/
|
||||
@interface RAHistoryMenu : RAMenuBase
|
||||
@property (nonatomic) rom_history_t* history;
|
||||
@property (nonatomic) content_history_t* history;
|
||||
- (id)initWithHistoryPath:(const char*)historyPath;
|
||||
@end
|
||||
|
||||
|
@ -635,24 +635,24 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
|
||||
@end
|
||||
|
||||
/*********************************************/
|
||||
/* RAHistoryMenu */
|
||||
/* Menu object that displays and allows */
|
||||
/* launching a file from the ROM history. */
|
||||
/*********************************************/
|
||||
/*************************************************/
|
||||
/* RAHistoryMenu */
|
||||
/* Menu object that displays and allows */
|
||||
/* launching a file from the content history. */
|
||||
/*************************************************/
|
||||
@implementation RAHistoryMenu
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
if (_history)
|
||||
rom_history_free(_history);
|
||||
content_history_free(_history);
|
||||
}
|
||||
|
||||
- (id)initWithHistoryPath:(const char*)historyPath
|
||||
{
|
||||
if ((self = [super initWithStyle:UITableViewStylePlain]))
|
||||
{
|
||||
_history = rom_history_init(historyPath, 100);
|
||||
_history = content_history_init(historyPath, 100);
|
||||
[self reloadData];
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:BOXSTRING("Clear History")
|
||||
style:UIBarButtonItemStyleBordered target:self action:@selector(clearHistory)];
|
||||
@ -664,7 +664,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
- (void)clearHistory
|
||||
{
|
||||
if (_history)
|
||||
rom_history_clear(_history);
|
||||
content_history_clear(_history);
|
||||
[self reloadData];
|
||||
}
|
||||
|
||||
@ -674,12 +674,12 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
RAHistoryMenu* __weak weakSelf = self;
|
||||
NSMutableArray *section = [NSMutableArray arrayWithObject:BOXSTRING("")];
|
||||
|
||||
for (i = 0; _history && i < rom_history_size(_history); i ++)
|
||||
for (i = 0; _history && i < content_history_size(_history); i ++)
|
||||
{
|
||||
RAMenuItemBasic* item = [RAMenuItemBasic itemWithDescription:BOXSTRING(path_basename(rom_history_get_path(weakSelf.history, i)))
|
||||
action:^{ apple_run_core(BOXSTRING(rom_history_get_core_path(weakSelf.history, i)),
|
||||
rom_history_get_path(weakSelf.history, i)); }
|
||||
detail:^{ return BOXSTRING(rom_history_get_core_name(weakSelf.history, i)); }];
|
||||
RAMenuItemBasic* item = [RAMenuItemBasic itemWithDescription:BOXSTRING(path_basename(content_history_get_path(weakSelf.history, i)))
|
||||
action:^{ apple_run_core(BOXSTRING(content_history_get_core_path(weakSelf.history, i)),
|
||||
content_history_get_path(weakSelf.history, i)); }
|
||||
detail:^{ return BOXSTRING(content_history_get_core_name(weakSelf.history, i)); }];
|
||||
[section addObject:item];
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ typedef struct
|
||||
struct gfx_shader *parameter_shader; // Points to either shader or graphics driver current shader.
|
||||
unsigned current_pad;
|
||||
|
||||
rom_history_t *history;
|
||||
content_history_t *history;
|
||||
retro_time_t last_time; // Used to throttle menu in case VSync is broken.
|
||||
|
||||
struct menu_bind_state binds;
|
||||
|
@ -251,7 +251,7 @@ static void load_symbols(bool is_dummy)
|
||||
else
|
||||
{
|
||||
#ifdef HAVE_DYNAMIC
|
||||
// Need to use absolute path for this setting. It can be saved to ROM history,
|
||||
// Need to use absolute path for this setting. It can be saved to content history,
|
||||
// and a relative path would break in that scenario.
|
||||
path_resolve_realpath(g_settings.libretro, sizeof(g_settings.libretro));
|
||||
|
||||
|
@ -367,10 +367,10 @@ returntype main_entry(signature())
|
||||
if (!ret)
|
||||
#endif
|
||||
{
|
||||
// If we started a ROM directly from command line,
|
||||
// push it to ROM history.
|
||||
// If we started content directly from command line,
|
||||
// push it to content history.
|
||||
if (!g_extern.libretro_dummy)
|
||||
menu_rom_history_push_current();
|
||||
menu_content_history_push_current();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2138,7 +2138,7 @@ static void menu_parse_and_resolve(unsigned menu_type)
|
||||
{
|
||||
case MENU_SETTINGS_OPEN_HISTORY:
|
||||
/* History parse */
|
||||
list_size = rom_history_size(driver.menu->history);
|
||||
list_size = content_history_size(driver.menu->history);
|
||||
|
||||
for (i = 0; i < list_size; i++)
|
||||
{
|
||||
@ -2149,7 +2149,7 @@ static void menu_parse_and_resolve(unsigned menu_type)
|
||||
core_path = NULL;
|
||||
core_name = NULL;
|
||||
|
||||
rom_history_get_index(driver.menu->history, i,
|
||||
content_history_get_index(driver.menu->history, i,
|
||||
&path, &core_path, &core_name);
|
||||
|
||||
if (path)
|
||||
|
@ -26,23 +26,23 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
struct rom_history_entry
|
||||
struct content_history_entry
|
||||
{
|
||||
char *path;
|
||||
char *core_path;
|
||||
char *core_name;
|
||||
};
|
||||
|
||||
struct rom_history
|
||||
struct content_history
|
||||
{
|
||||
struct rom_history_entry *entries;
|
||||
struct content_history_entry *entries;
|
||||
size_t size;
|
||||
size_t cap;
|
||||
|
||||
char *conf_path;
|
||||
};
|
||||
|
||||
void rom_history_get_index(rom_history_t *hist,
|
||||
void content_history_get_index(content_history_t *hist,
|
||||
size_t index,
|
||||
const char **path, const char **core_path,
|
||||
const char **core_name)
|
||||
@ -55,7 +55,7 @@ void rom_history_get_index(rom_history_t *hist,
|
||||
*core_name = hist->entries[index].core_name;
|
||||
}
|
||||
|
||||
static void rom_history_free_entry(struct rom_history_entry *entry)
|
||||
static void content_history_free_entry(struct content_history_entry *entry)
|
||||
{
|
||||
free(entry->path);
|
||||
free(entry->core_path);
|
||||
@ -63,7 +63,7 @@ static void rom_history_free_entry(struct rom_history_entry *entry)
|
||||
memset(entry, 0, sizeof(*entry));
|
||||
}
|
||||
|
||||
void rom_history_push(rom_history_t *hist,
|
||||
void content_history_push(content_history_t *hist,
|
||||
const char *path, const char *core_path,
|
||||
const char *core_name)
|
||||
{
|
||||
@ -85,9 +85,9 @@ void rom_history_push(rom_history_t *hist,
|
||||
return;
|
||||
|
||||
// Seen it before, bump to top.
|
||||
struct rom_history_entry tmp = hist->entries[i];
|
||||
struct content_history_entry tmp = hist->entries[i];
|
||||
memmove(hist->entries + 1, hist->entries,
|
||||
i * sizeof(struct rom_history_entry));
|
||||
i * sizeof(struct content_history_entry));
|
||||
hist->entries[0] = tmp;
|
||||
return;
|
||||
}
|
||||
@ -95,12 +95,12 @@ void rom_history_push(rom_history_t *hist,
|
||||
|
||||
if (hist->size == hist->cap)
|
||||
{
|
||||
rom_history_free_entry(&hist->entries[hist->cap - 1]);
|
||||
content_history_free_entry(&hist->entries[hist->cap - 1]);
|
||||
hist->size--;
|
||||
}
|
||||
|
||||
memmove(hist->entries + 1, hist->entries,
|
||||
(hist->cap - 1) * sizeof(struct rom_history_entry));
|
||||
(hist->cap - 1) * sizeof(struct content_history_entry));
|
||||
|
||||
hist->entries[0].path = path ? strdup(path) : NULL;
|
||||
hist->entries[0].core_path = strdup(core_path);
|
||||
@ -108,7 +108,7 @@ void rom_history_push(rom_history_t *hist,
|
||||
hist->size++;
|
||||
}
|
||||
|
||||
static void rom_history_write_file(rom_history_t *hist)
|
||||
static void content_history_write_file(content_history_t *hist)
|
||||
{
|
||||
size_t i;
|
||||
FILE *file = NULL;
|
||||
@ -135,42 +135,42 @@ static void rom_history_write_file(rom_history_t *hist)
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
void rom_history_free(rom_history_t *hist)
|
||||
void content_history_free(content_history_t *hist)
|
||||
{
|
||||
size_t i;
|
||||
if (!hist)
|
||||
return;
|
||||
|
||||
if (hist->conf_path)
|
||||
rom_history_write_file(hist);
|
||||
content_history_write_file(hist);
|
||||
free(hist->conf_path);
|
||||
|
||||
for (i = 0; i < hist->cap; i++)
|
||||
rom_history_free_entry(&hist->entries[i]);
|
||||
content_history_free_entry(&hist->entries[i]);
|
||||
free(hist->entries);
|
||||
|
||||
free(hist);
|
||||
}
|
||||
|
||||
void rom_history_clear(rom_history_t *hist)
|
||||
void content_history_clear(content_history_t *hist)
|
||||
{
|
||||
size_t i;
|
||||
if (!hist)
|
||||
return;
|
||||
|
||||
for (i = 0; i < hist->cap; i++)
|
||||
rom_history_free_entry(&hist->entries[i]);
|
||||
content_history_free_entry(&hist->entries[i]);
|
||||
hist->size = 0;
|
||||
}
|
||||
|
||||
size_t rom_history_size(rom_history_t *hist)
|
||||
size_t content_history_size(content_history_t *hist)
|
||||
{
|
||||
if (hist)
|
||||
return hist->size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool rom_history_read_file(rom_history_t *hist, const char *path)
|
||||
static bool content_history_read_file(content_history_t *hist, const char *path)
|
||||
{
|
||||
FILE *file = fopen(path, "r");
|
||||
if (!file || !hist)
|
||||
@ -180,7 +180,7 @@ static bool rom_history_read_file(rom_history_t *hist, const char *path)
|
||||
}
|
||||
|
||||
char buf[3][PATH_MAX];
|
||||
struct rom_history_entry *entry = NULL;
|
||||
struct content_history_entry *entry = NULL;
|
||||
char *last = NULL;
|
||||
unsigned i;
|
||||
|
||||
@ -214,33 +214,33 @@ end:
|
||||
return true;
|
||||
}
|
||||
|
||||
rom_history_t *rom_history_init(const char *path, size_t size)
|
||||
content_history_t *content_history_init(const char *path, size_t size)
|
||||
{
|
||||
rom_history_t *hist = (rom_history_t*)calloc(1, sizeof(*hist));
|
||||
content_history_t *hist = (content_history_t*)calloc(1, sizeof(*hist));
|
||||
if (!hist)
|
||||
{
|
||||
RARCH_ERR("Cannot initialize content history.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hist->entries = (struct rom_history_entry*)calloc(size, sizeof(*hist->entries));
|
||||
hist->entries = (struct content_history_entry*)calloc(size, sizeof(*hist->entries));
|
||||
if (!hist->entries)
|
||||
goto error;
|
||||
|
||||
hist->cap = size;
|
||||
|
||||
if (!rom_history_read_file(hist, path))
|
||||
if (!content_history_read_file(hist, path))
|
||||
goto error;
|
||||
|
||||
hist->conf_path = strdup(path);
|
||||
return hist;
|
||||
|
||||
error:
|
||||
rom_history_free(hist);
|
||||
content_history_free(hist);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* rom_history_get_path(rom_history_t *hist, unsigned index)
|
||||
const char* content_history_get_path(content_history_t *hist, unsigned index)
|
||||
{
|
||||
const char *path, *core_path, *core_name;
|
||||
if (!hist)
|
||||
@ -250,14 +250,14 @@ const char* rom_history_get_path(rom_history_t *hist, unsigned index)
|
||||
core_path = NULL;
|
||||
core_name = NULL;
|
||||
|
||||
rom_history_get_index(hist, index, &path, &core_path, &core_name);
|
||||
content_history_get_index(hist, index, &path, &core_path, &core_name);
|
||||
|
||||
if (path)
|
||||
return path;
|
||||
return "";
|
||||
}
|
||||
|
||||
const char *rom_history_get_core_path(rom_history_t *hist, unsigned index)
|
||||
const char *content_history_get_core_path(content_history_t *hist, unsigned index)
|
||||
{
|
||||
const char *path, *core_path, *core_name;
|
||||
if (!hist)
|
||||
@ -267,14 +267,14 @@ const char *rom_history_get_core_path(rom_history_t *hist, unsigned index)
|
||||
core_path = NULL;
|
||||
core_name = NULL;
|
||||
|
||||
rom_history_get_index(hist, index, &path, &core_path, &core_name);
|
||||
content_history_get_index(hist, index, &path, &core_path, &core_name);
|
||||
|
||||
if (core_path)
|
||||
return core_path;
|
||||
return "";
|
||||
}
|
||||
|
||||
const char *rom_history_get_core_name(rom_history_t *hist, unsigned index)
|
||||
const char *content_history_get_core_name(content_history_t *hist, unsigned index)
|
||||
{
|
||||
const char *path, *core_path, *core_name;
|
||||
|
||||
@ -285,7 +285,7 @@ const char *rom_history_get_core_name(rom_history_t *hist, unsigned index)
|
||||
core_path = NULL;
|
||||
core_name = NULL;
|
||||
|
||||
rom_history_get_index(hist, index, &path, &core_path, &core_name);
|
||||
content_history_get_index(hist, index, &path, &core_path, &core_name);
|
||||
|
||||
if (core_name)
|
||||
return core_name;
|
||||
|
@ -22,29 +22,29 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct rom_history rom_history_t;
|
||||
typedef struct content_history content_history_t;
|
||||
|
||||
rom_history_t *rom_history_init(const char *path, size_t size);
|
||||
void rom_history_free(rom_history_t *hist);
|
||||
content_history_t *content_history_init(const char *path, size_t size);
|
||||
void content_history_free(content_history_t *hist);
|
||||
|
||||
void rom_history_clear(rom_history_t *hist);
|
||||
void content_history_clear(content_history_t *hist);
|
||||
|
||||
size_t rom_history_size(rom_history_t *hist);
|
||||
size_t content_history_size(content_history_t *hist);
|
||||
|
||||
void rom_history_get_index(rom_history_t *hist,
|
||||
void content_history_get_index(content_history_t *hist,
|
||||
size_t index,
|
||||
const char **path, const char **core_path,
|
||||
const char **core_name);
|
||||
|
||||
void rom_history_push(rom_history_t *hist,
|
||||
void content_history_push(content_history_t *hist,
|
||||
const char *path, const char *core_path,
|
||||
const char *core_name);
|
||||
|
||||
const char* rom_history_get_path(rom_history_t *hist,
|
||||
const char* content_history_get_path(content_history_t *hist,
|
||||
unsigned index);
|
||||
const char* rom_history_get_core_path(rom_history_t *hist,
|
||||
const char* content_history_get_core_path(content_history_t *hist,
|
||||
unsigned index);
|
||||
const char* rom_history_get_core_name(rom_history_t *hist,
|
||||
const char* content_history_get_core_name(content_history_t *hist,
|
||||
unsigned index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -80,7 +80,7 @@ int menu_defer_core(void *info_, const char *dir, const char *path, char *deferr
|
||||
return 0;
|
||||
}
|
||||
|
||||
void menu_rom_history_push_current(void)
|
||||
void menu_content_history_push_current(void)
|
||||
{
|
||||
// g_extern.fullpath can be relative here.
|
||||
// Ensure we're pushing absolute path.
|
||||
@ -93,7 +93,7 @@ void menu_rom_history_push_current(void)
|
||||
|
||||
if (g_extern.system.no_game || *tmp)
|
||||
if (driver.menu && driver.menu->history)
|
||||
rom_history_push(driver.menu->history,
|
||||
content_history_push(driver.menu->history,
|
||||
*tmp ? tmp : NULL,
|
||||
g_settings.libretro,
|
||||
g_extern.system.info.library_name);
|
||||
@ -120,7 +120,7 @@ void load_menu_game_prepare(void)
|
||||
if (g_extern.system.no_game || *g_extern.fullpath)
|
||||
#endif
|
||||
if (driver.menu && driver.menu->history)
|
||||
rom_history_push(driver.menu->history,
|
||||
content_history_push(driver.menu->history,
|
||||
*g_extern.fullpath ? g_extern.fullpath : NULL,
|
||||
g_settings.libretro,
|
||||
driver.menu->info.library_name ? driver.menu->info.library_name : "");
|
||||
@ -155,7 +155,7 @@ void load_menu_game_history(unsigned game_index)
|
||||
if (!driver.menu)
|
||||
return;
|
||||
|
||||
rom_history_get_index(driver.menu->history,
|
||||
content_history_get_index(driver.menu->history,
|
||||
game_index, &path, &core_path, &core_name);
|
||||
|
||||
strlcpy(g_settings.libretro, core_path, sizeof(g_settings.libretro));
|
||||
@ -173,7 +173,7 @@ static void menu_init_history(menu_handle_t *menu)
|
||||
{
|
||||
if (menu->history)
|
||||
{
|
||||
rom_history_free(menu->history);
|
||||
content_history_free(menu->history);
|
||||
menu->history = NULL;
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ static void menu_init_history(menu_handle_t *menu)
|
||||
}
|
||||
|
||||
RARCH_LOG("[Menu]: Opening history: %s.\n", history_path);
|
||||
menu->history = rom_history_init(history_path, g_settings.game_history_size);
|
||||
menu->history = content_history_init(history_path, g_settings.game_history_size);
|
||||
}
|
||||
}
|
||||
|
||||
@ -349,7 +349,7 @@ void menu_free(void *data)
|
||||
file_list_free(menu->menu_stack);
|
||||
file_list_free(menu->selection_buf);
|
||||
|
||||
rom_history_free(menu->history);
|
||||
content_history_free(menu->history);
|
||||
core_info_list_free(menu->core_info);
|
||||
|
||||
if (menu->core_info_current)
|
||||
|
@ -107,7 +107,7 @@ void load_menu_game_prepare(void);
|
||||
void load_menu_game_prepare_dummy(void);
|
||||
bool load_menu_game(void);
|
||||
void load_menu_game_history(unsigned game_index);
|
||||
void menu_rom_history_push_current(void);
|
||||
void menu_content_history_push_current(void);
|
||||
|
||||
bool menu_replace_config(const char *path);
|
||||
|
||||
|
@ -47,10 +47,10 @@ int main(int argc, char *argv[])
|
||||
#ifdef HAVE_MENU
|
||||
g_extern.lifecycle_state |= 1ULL << MODE_GAME;
|
||||
|
||||
// If we started a ROM directly from command line,
|
||||
// push it to ROM history.
|
||||
// If we started content directly from command line,
|
||||
// push it to content history.
|
||||
if (!g_extern.libretro_dummy)
|
||||
menu_rom_history_push_current();
|
||||
menu_content_history_push_current();
|
||||
#endif
|
||||
|
||||
emscripten_set_main_loop(emscripten_mainloop, g_settings.video.vsync ? 0 : INT_MAX, 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user