static void menu_init_history(void *data) { rgui_handle_t *rgui = (rgui_handle_t*)data; if (rgui && rgui->history) { rom_history_free(rgui->history); rgui->history = NULL; } 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("[RGUI]: Opening history: %s.\n", history_path); rgui->history = rom_history_init(history_path, g_settings.game_history_size); } }
void menu_free(void) { rgui_free(rgui); #ifdef HAVE_FILEBROWSER filebrowser_free(rgui->browser); #endif rom_history_free(rgui->history); free(rgui); }
rom_history_t *rom_history_init(const char *path, size_t size) { rom_history_t *hist = (rom_history_t*)calloc(1, sizeof(*hist)); if (!hist) return NULL; hist->entries = (struct rom_history_entry*)calloc(size, sizeof(*hist->entries)); if (!hist->entries) goto error; hist->cap = size; if (!rom_history_read_file(hist, path)) goto error; hist->conf_path = strdup(path); return hist; error: rom_history_free(hist); return NULL; }
void menu_free(void *data) { rgui_handle_t *rgui = (rgui_handle_t*)data; if (!rgui) return; if (driver.menu_ctx && driver.menu_ctx->free) driver.menu_ctx->free(rgui); #ifdef HAVE_DYNAMIC libretro_free_system_info(&rgui->info); #endif file_list_free(rgui->menu_stack); file_list_free(rgui->selection_buf); rom_history_free(rgui->history); core_info_list_free(rgui->core_info); free(rgui); }