diff --git a/Makefile.common b/Makefile.common index ab4f514b6d..67f1c532f3 100644 --- a/Makefile.common +++ b/Makefile.common @@ -407,8 +407,7 @@ ifeq ($(HAVE_MENU_COMMON), 1) else PSEUDO_NS := endif - OBJ += menu/menu.o \ - menu/menu_hash.o \ + OBJ += menu/menu_hash.o \ menu/menu_driver.o \ menu/intl/menu_hash_de.o \ menu/intl/menu_hash_es.o \ diff --git a/cheevos.c b/cheevos.c index 8ab78cac76..63c6853224 100644 --- a/cheevos.c +++ b/cheevos.c @@ -27,9 +27,14 @@ #include "configuration.h" #include "performance.h" #include "runloop.h" -#include "menu/menu.h" + +#ifdef HAVE_MENU +#include "menu/menu_driver.h" +#endif + #include "verbosity.h" + enum { CHEEVOS_VAR_SIZE_BIT_0, @@ -1921,6 +1926,7 @@ int cheevos_load(const struct retro_game_info *info) return -1; } +#ifdef HAVE_MENU void cheevos_populate_menu(menu_displaylist_info_t *info) { unsigned i; @@ -1977,6 +1983,7 @@ void cheevos_populate_menu(menu_displaylist_info_t *info) } } } +#endif void cheevos_get_description(unsigned cheevo_ndx, char *str, size_t len) { diff --git a/cheevos.h b/cheevos.h index 0bfe5c47d3..a9ebb4a271 100644 --- a/cheevos.h +++ b/cheevos.h @@ -20,7 +20,10 @@ #include #include "libretro.h" + +#ifdef HAVE_MENU #include "menu/menu_entries.h" +#endif typedef struct { @@ -32,7 +35,9 @@ extern cheevos_globals_t cheevos_globals; int cheevos_load(const struct retro_game_info *info); +#ifdef HAVE_MENU void cheevos_populate_menu(menu_displaylist_info_t *info); +#endif void cheevos_get_description(unsigned cheevo_ndx, char *str, size_t len); diff --git a/command_event.c b/command_event.c index 385cb4dba1..ca7eedb16c 100644 --- a/command_event.c +++ b/command_event.c @@ -45,11 +45,9 @@ #include "input/input_remapping.h" #ifdef HAVE_MENU -#include "menu/menu.h" #include "menu/menu_driver.h" #include "menu/menu_display.h" #include "menu/menu_shader.h" -#include "menu/menu_input.h" #endif #ifdef HAVE_NETPLAY diff --git a/driver.c b/driver.c index bec4141a13..bcb4b5c407 100644 --- a/driver.c +++ b/driver.c @@ -27,7 +27,7 @@ #include "libretro_version_1.h" #ifdef HAVE_MENU -#include "menu/menu.h" +#include "menu/menu_driver.h" #endif #ifdef HAVE_CONFIG_H diff --git a/griffin/griffin.c b/griffin/griffin.c index ade96109d9..c05e1d5b0e 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -547,7 +547,6 @@ DRIVERS #include "../audio/audio_driver.c" #include "../camera/camera_driver.c" #include "../location/location_driver.c" -#include "../menu/menu_driver.c" #include "../driver.c" /*============================================================ @@ -781,7 +780,7 @@ PLAYLISTS MENU ============================================================ */ #ifdef HAVE_MENU -#include "../menu/menu.c" +#include "../menu/menu_driver.c" #include "../menu/menu_hash.c" #include "../menu/menu_input.c" #include "../menu/menu_entry.c" diff --git a/menu/cbs/menu_cbs_cancel.c b/menu/cbs/menu_cbs_cancel.c index d935cc4e65..f85d48fbeb 100644 --- a/menu/cbs/menu_cbs_cancel.c +++ b/menu/cbs/menu_cbs_cancel.c @@ -14,7 +14,8 @@ */ #include -#include "../menu.h" + +#include "../menu_driver.h" #include "../menu_cbs.h" static int action_cancel_pop_default(const char *path, diff --git a/menu/cbs/menu_cbs_contentlist_switch.c b/menu/cbs/menu_cbs_contentlist_switch.c index 9de3b637c7..382ebe78fd 100644 --- a/menu/cbs/menu_cbs_contentlist_switch.c +++ b/menu/cbs/menu_cbs_contentlist_switch.c @@ -13,7 +13,7 @@ * If not, see . */ -#include "../menu.h" +#include "../menu_driver.h" #include "../menu_cbs.h" #ifndef BIND_ACTION_CONTENT_LIST_SWITCH diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index 71ecdf1200..f99b61bc44 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -15,7 +15,7 @@ #include -#include "../menu.h" +#include "../menu_driver.h" #include "../menu_cbs.h" #include "../../msg_hash.h" diff --git a/menu/cbs/menu_cbs_down.c b/menu/cbs/menu_cbs_down.c index 5790f630b1..f9b742d0c0 100644 --- a/menu/cbs/menu_cbs_down.c +++ b/menu/cbs/menu_cbs_down.c @@ -13,7 +13,7 @@ * If not, see . */ -#include "../menu.h" +#include "../menu_driver.h" #include "../menu_navigation.h" #include "../menu_cbs.h" diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index e066d3bb51..727f54fb04 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -15,7 +15,7 @@ #include -#include "../menu.h" +#include "../menu_driver.h" #include "../menu_animation.h" #include "../menu_cbs.h" #include "../menu_shader.h" diff --git a/menu/cbs/menu_cbs_info.c b/menu/cbs/menu_cbs_info.c index 1fcee033a6..8d68a8e133 100644 --- a/menu/cbs/menu_cbs_info.c +++ b/menu/cbs/menu_cbs_info.c @@ -15,7 +15,7 @@ #include -#include "../menu.h" +#include "../menu_driver.h" #include "../menu_cbs.h" #include "../menu_hash.h" diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 3acd7b9cdc..8bcafca0a8 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -15,7 +15,7 @@ #include -#include "../menu.h" +#include "../menu_driver.h" #include "../menu_cbs.h" #include "../menu_hash.h" #include "../menu_input.h" diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index d0c7b4642c..819e036bc2 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -16,7 +16,7 @@ #include #include -#include "../menu.h" +#include "../menu_driver.h" #include "../menu_cbs.h" #include "../menu_display.h" #include "../menu_setting.h" diff --git a/menu/cbs/menu_cbs_refresh.c b/menu/cbs/menu_cbs_refresh.c index 900b6ff682..6c7553d190 100644 --- a/menu/cbs/menu_cbs_refresh.c +++ b/menu/cbs/menu_cbs_refresh.c @@ -13,7 +13,7 @@ * If not, see . */ -#include "../menu.h" +#include "../menu_driver.h" #include "../menu_cbs.h" #include "../menu_hash.h" diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index 4c634425e8..84389aea57 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -15,7 +15,7 @@ #include -#include "../menu.h" +#include "../menu_driver.h" #include "../menu_cbs.h" #include "../menu_hash.h" #include "../menu_input.h" diff --git a/menu/cbs/menu_cbs_scan.c b/menu/cbs/menu_cbs_scan.c index e4586d9712..1e5c92a61d 100644 --- a/menu/cbs/menu_cbs_scan.c +++ b/menu/cbs/menu_cbs_scan.c @@ -16,7 +16,7 @@ #include #include -#include "../menu.h" +#include "../menu_driver.h" #include "../menu_cbs.h" #include "../menu_entry.h" #include "../menu_setting.h" diff --git a/menu/cbs/menu_cbs_select.c b/menu/cbs/menu_cbs_select.c index 972a5dea93..8e41753b12 100644 --- a/menu/cbs/menu_cbs_select.c +++ b/menu/cbs/menu_cbs_select.c @@ -13,7 +13,7 @@ * If not, see . */ -#include "../menu.h" +#include "../menu_driver.h" #include "../menu_entry.h" #include "../menu_cbs.h" #include "../menu_setting.h" diff --git a/menu/cbs/menu_cbs_start.c b/menu/cbs/menu_cbs_start.c index 35c4a97443..8c68f5ac3b 100644 --- a/menu/cbs/menu_cbs_start.c +++ b/menu/cbs/menu_cbs_start.c @@ -15,7 +15,7 @@ #include -#include "../menu.h" +#include "../menu_driver.h" #include "../menu_cbs.h" #include "../menu_input.h" #include "../menu_display.h" diff --git a/menu/cbs/menu_cbs_title.c b/menu/cbs/menu_cbs_title.c index c12d315db5..09fc48e9e7 100644 --- a/menu/cbs/menu_cbs_title.c +++ b/menu/cbs/menu_cbs_title.c @@ -19,7 +19,7 @@ #include -#include "../menu.h" +#include "../menu_driver.h" #include "../menu_cbs.h" #include "../menu_hash.h" diff --git a/menu/cbs/menu_cbs_up.c b/menu/cbs/menu_cbs_up.c index 2a478d5e8e..7c3526a274 100644 --- a/menu/cbs/menu_cbs_up.c +++ b/menu/cbs/menu_cbs_up.c @@ -13,7 +13,7 @@ * If not, see . */ -#include "../menu.h" +#include "../menu_driver.h" #include "../menu_cbs.h" #include "../menu_navigation.h" diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 3a4ef097f4..c4939fb709 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -30,7 +30,6 @@ #include "menu_generic.h" -#include "../menu.h" #include "../menu_driver.h" #include "../menu_animation.h" #include "../menu_hash.h" diff --git a/menu/drivers/menu_generic.c b/menu/drivers/menu_generic.c index 4bd5b7e5d4..8dd07658e9 100644 --- a/menu/drivers/menu_generic.c +++ b/menu/drivers/menu_generic.c @@ -19,7 +19,7 @@ #include "menu_generic.h" -#include "../menu.h" +#include "../menu_driver.h" #include "../menu_animation.h" #include "../menu_display.h" #include "../menu_displaylist.h" diff --git a/menu/drivers/null.c b/menu/drivers/null.c index 8ac7d30847..7aeb80d654 100644 --- a/menu/drivers/null.c +++ b/menu/drivers/null.c @@ -19,9 +19,10 @@ #include #include #include + #include "../menu_driver.h" #include "../menu_display.h" -#include "../menu.h" + #include "../../general.h" menu_ctx_driver_t menu_ctx_null = { diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index f0002b385e..4e5cf77910 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -31,7 +31,7 @@ #include "../../general.h" -#include "../menu.h" +#include "../menu_driver.h" #include "../menu_animation.h" #include "../menu_display.h" #include "../menu_hash.h" diff --git a/menu/drivers/rmenu.c b/menu/drivers/rmenu.c index dbcc54e1dc..33f43733fb 100644 --- a/menu/drivers/rmenu.c +++ b/menu/drivers/rmenu.c @@ -26,7 +26,6 @@ #include "menu_generic.h" -#include "../menu.h" #include "../menu_driver.h" #include "../menu_entry.h" #include "../menu_input.h" diff --git a/menu/drivers/rmenu_xui.cpp b/menu/drivers/rmenu_xui.cpp index c6ebc5449c..0abea74126 100644 --- a/menu/drivers/rmenu_xui.cpp +++ b/menu/drivers/rmenu_xui.cpp @@ -31,7 +31,6 @@ #include "menu_generic.h" #include "../menu_driver.h" -#include "../menu.h" #include "../menu_animation.h" #include "../menu_entry.h" #include "../menu_entries.h" diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 1cd52d0f43..07819491d5 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -30,7 +30,6 @@ #include "menu_generic.h" -#include "../menu.h" #include "../menu_driver.h" #include "../menu_entry.h" #include "../menu_animation.h" diff --git a/menu/drivers/zarch.c b/menu/drivers/zarch.c index 730d15e99a..efd5b14d7b 100644 --- a/menu/drivers/zarch.c +++ b/menu/drivers/zarch.c @@ -35,7 +35,7 @@ #include "../../dir_list_special.h" -#include "../menu.h" +#include "../menu_driver.h" #include "../menu_animation.h" #include "../menu_entry.h" #include "../menu_display.h" diff --git a/menu/menu.c b/menu/menu.c deleted file mode 100644 index 7af6e0f6c8..0000000000 --- a/menu/menu.c +++ /dev/null @@ -1,294 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2015 - Daniel De Matteis - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#include - -#include "menu.h" -#include "menu_cbs.h" -#include "menu_display.h" -#include "menu_hash.h" - -#include "../general.h" -#include "../frontend/frontend.h" - -#include "../tasks/tasks.h" - -static void menu_environment_get(int *argc, char *argv[], - void *args, void *params_data) -{ - struct rarch_main_wrap *wrap_args = (struct rarch_main_wrap*)params_data; - global_t *global = global_get_ptr(); - settings_t *settings = config_get_ptr(); - menu_handle_t *menu = menu_driver_get_ptr(); - char *fullpath = NULL; - - if (!wrap_args) - return; - - runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath); - - wrap_args->no_content = menu->load_no_content; - if (!global->has_set.verbosity) - wrap_args->verbose = *retro_main_verbosity(); - - wrap_args->config_path = *global->path.config ? global->path.config : NULL; - wrap_args->sram_path = *global->dir.savefile ? global->dir.savefile : NULL; - wrap_args->state_path = *global->dir.savestate ? global->dir.savestate : NULL; - wrap_args->content_path = *fullpath ? fullpath : NULL; - - if (!global->has_set.libretro) - wrap_args->libretro_path = *settings->libretro ? settings->libretro : NULL; - wrap_args->touched = true; -} - -static void menu_push_to_history_playlist(void) -{ - settings_t *settings = config_get_ptr(); - global_t *global = global_get_ptr(); - char *fullpath = NULL; - - if (!settings->history_list_enable) - return; - - runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath); - - if (*fullpath) - { - char tmp[PATH_MAX_LENGTH]; - char str[PATH_MAX_LENGTH]; - - fill_pathname_base(tmp, fullpath, sizeof(tmp)); - snprintf(str, sizeof(str), "INFO - Loading %s ...", tmp); - menu_display_msg_queue_push(str, 1, 1, false); - } - - content_playlist_push(g_defaults.history, - fullpath, - NULL, - settings->libretro, - global->menu.info.library_name, - NULL, - NULL); -} - -/** - * menu_load_content: - * - * Loads content into currently selected core. - * Will also optionally push the content entry to the history playlist. - * - * Returns: true (1) if successful, otherwise false (0). - **/ -bool menu_load_content(enum rarch_core_type type) -{ - bool msg_force = true; - menu_handle_t *menu = menu_driver_get_ptr(); - char *fullpath = NULL; - - runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath); - /* redraw menu frame */ - menu_display_ctl(MENU_DISPLAY_CTL_SET_MSG_FORCE, &msg_force); - menu_iterate_render(); - - if (!(main_load_content(0, NULL, NULL, menu_environment_get))) - { - char name[PATH_MAX_LENGTH] = {0}; - char msg[PATH_MAX_LENGTH] = {0}; - - fill_pathname_base(name, fullpath, sizeof(name)); - snprintf(msg, sizeof(msg), "Failed to load %s.\n", name); - menu_display_msg_queue_push(msg, 1, 90, false); - - return false; - } - - menu_shader_manager_init(menu); - - event_command(EVENT_CMD_HISTORY_INIT); - - if (*fullpath || (menu && menu->load_no_content)) - menu_push_to_history_playlist(); - - event_command(EVENT_CMD_VIDEO_SET_ASPECT_RATIO); - event_command(EVENT_CMD_RESUME); - - return true; -} - -int menu_common_load_content( - const char *core_path, const char *fullpath, - bool persist, enum rarch_core_type type) -{ - enum event_command cmd = EVENT_CMD_NONE; - - if (core_path) - { - runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, (void*)core_path); - event_command(EVENT_CMD_LOAD_CORE); - } - - if (fullpath) - runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, (void*)fullpath); - - switch (type) - { - case CORE_TYPE_PLAIN: - case CORE_TYPE_DUMMY: - cmd = persist ? EVENT_CMD_LOAD_CONTENT_PERSIST : EVENT_CMD_LOAD_CONTENT; - break; -#ifdef HAVE_FFMPEG - case CORE_TYPE_FFMPEG: - cmd = EVENT_CMD_LOAD_CONTENT_FFMPEG; - break; -#endif - case CORE_TYPE_IMAGEVIEWER: -#ifdef HAVE_IMAGEVIEWER - cmd = EVENT_CMD_LOAD_CONTENT_IMAGEVIEWER; -#endif - break; - } - - if (cmd != EVENT_CMD_NONE) - event_command(cmd); - - return -1; -} - -/** - * menu_free: - * @menu : Menu handle. - * - * Frees a menu handle - **/ -void menu_free(menu_handle_t *menu) -{ - global_t *global = global_get_ptr(); - if (!menu) - return; - - if (menu->playlist) - content_playlist_free(menu->playlist); - menu->playlist = NULL; - - menu_shader_free(menu); - - menu_input_free(); - menu_navigation_free(); - menu_driver_free(menu); - -#ifdef HAVE_DYNAMIC - libretro_free_system_info(&global->menu.info); -#endif - - menu_display_free(); - menu_entries_free(); - - event_command(EVENT_CMD_HISTORY_DEINIT); - - if (global->core_info.list) - core_info_list_free(global->core_info.list); - - if (global->core_info.current) - free(global->core_info.current); - global->core_info.current = NULL; - - free(menu); -} - -static void bundle_decompressed(void *task_data, void *user_data, const char *err) -{ - settings_t *settings = config_get_ptr(); - decompress_task_data_t *dec = (decompress_task_data_t*)task_data; - - if (dec && !err) - event_command(EVENT_CMD_REINIT); - - if (err) - RARCH_ERR("%s", err); - - if (dec) - { - /* delete bundle? */ - free(dec->source_file); - free(dec); - } - - settings->bundle_assets_extract_last_version = settings->bundle_assets_extract_version_current; -} - -/** - * menu_init: - * @data : Menu context handle. - * - * Create and initialize menu handle. - * - * Returns: menu handle on success, otherwise NULL. - **/ -void *menu_init(const void *data) -{ - menu_handle_t *menu = NULL; - menu_ctx_driver_t *menu_ctx = (menu_ctx_driver_t*)data; - global_t *global = global_get_ptr(); - settings_t *settings = config_get_ptr(); - - if (!menu_ctx) - return NULL; - - if (!(menu = (menu_handle_t*)menu_ctx->init())) - return NULL; - - strlcpy(settings->menu.driver, menu_ctx->ident, - sizeof(settings->menu.driver)); - - if (!menu_entries_init(menu)) - goto error; - - global->core_info.current = (core_info_t*)calloc(1, sizeof(core_info_t)); - if (!global->core_info.current) - goto error; - -#ifdef HAVE_SHADER_MANAGER - menu->shader = (struct video_shader*)calloc(1, sizeof(struct video_shader)); - if (!menu->shader) - goto error; -#endif - - menu->push_help_screen = settings->menu_show_start_screen; - menu->help_screen_type = MENU_HELP_WELCOME; - settings->menu_show_start_screen = false; - - if (settings->bundle_assets_extract_enable && - settings->bundle_assets_src_path[0] != '\0' && settings->bundle_assets_dst_path[0] != '\0' && - settings->bundle_assets_extract_version_current != settings->bundle_assets_extract_last_version - ) - { - rarch_task_push_decompress(settings->bundle_assets_src_path, settings->bundle_assets_dst_path, - settings->bundle_assets_dst_path_subdir, NULL, bundle_decompressed, NULL); - } - - menu_shader_manager_init(menu); - - if (!menu_display_init()) - goto error; - - return menu; - -error: - menu_free(menu); - - return NULL; -} - diff --git a/menu/menu.h b/menu/menu.h deleted file mode 100644 index 3b7461c2ca..0000000000 --- a/menu/menu.h +++ /dev/null @@ -1,209 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2015 - Daniel De Matteis - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#ifndef __RETROARCH_MENU_H__ -#define __RETROARCH_MENU_H__ - -#include -#include -#include -#include -#include -#include - -#include "menu_driver.h" -#include "menu_shader.h" -#include "../driver.h" -#include "../input/input_driver.h" -#include "../dynamic.h" - -#ifndef MAX_COUNTERS -#define MAX_COUNTERS 64 -#endif - -#ifndef MAX_CHEAT_COUNTERS -#define MAX_CHEAT_COUNTERS 100 -#endif - -#define MENU_SETTINGS_CORE_INFO_NONE 0xffff -#define MENU_SETTINGS_CORE_OPTION_NONE 0xffff -#define MENU_SETTINGS_CHEEVOS_NONE 0xffff -#define MENU_SETTINGS_CORE_OPTION_CREATE 0x05000 -#define MENU_SETTINGS_CORE_OPTION_START 0x10000 -#define MENU_SETTINGS_PLAYLIST_ASSOCIATION_START 0x20000 -#define MENU_SETTINGS_CHEEVOS_START 0x40000 - - -#define MENU_KEYBOARD_BIND_TIMEOUT_SECONDS 5 - -#ifdef __cplusplus -extern "C" { -#endif - - -typedef enum -{ - MENU_FILE_NONE = 0, - MENU_FILE_PLAIN, - MENU_FILE_DIRECTORY, - MENU_FILE_PARENT_DIRECTORY, - MENU_FILE_PATH, - MENU_FILE_DEVICE, - MENU_FILE_CORE, - MENU_FILE_PLAYLIST_ENTRY, - MENU_FILE_CONTENTLIST_ENTRY, - MENU_FILE_SHADER_PRESET, - MENU_FILE_SHADER, - MENU_FILE_VIDEOFILTER, - MENU_FILE_AUDIOFILTER, - MENU_FILE_CHEAT, - MENU_FILE_OVERLAY, - MENU_FILE_FONT, - MENU_FILE_CONFIG, - MENU_FILE_USE_DIRECTORY, - MENU_FILE_SCAN_DIRECTORY, - MENU_FILE_CARCHIVE, - MENU_FILE_IN_CARCHIVE, - MENU_FILE_IMAGE, - MENU_FILE_IMAGEVIEWER, - MENU_FILE_REMAP, - MENU_FILE_DOWNLOAD_CORE, - MENU_FILE_DOWNLOAD_CORE_CONTENT, - MENU_FILE_DOWNLOAD_CORE_INFO, - MENU_FILE_RDB, - MENU_FILE_RDB_ENTRY, - MENU_FILE_RPL_ENTRY, - MENU_FILE_CURSOR, - MENU_FILE_RECORD_CONFIG, - MENU_FILE_PLAYLIST_COLLECTION, - MENU_FILE_PLAYLIST_ASSOCIATION, - MENU_FILE_MOVIE, - MENU_FILE_MUSIC, - MENU_SETTINGS, - MENU_SETTINGS_TAB, - MENU_HISTORY_TAB, - MENU_ADD_TAB, - MENU_PLAYLISTS_TAB, - MENU_SETTING_NO_ITEM, - MENU_SETTING_DRIVER, - MENU_SETTING_ACTION, - MENU_SETTING_ACTION_RUN, - MENU_SETTING_ACTION_CLOSE, - MENU_SETTING_ACTION_CORE_OPTIONS, - MENU_SETTING_ACTION_CORE_INPUT_REMAPPING_OPTIONS, - MENU_SETTING_ACTION_CORE_CHEAT_OPTIONS, - MENU_SETTING_ACTION_CORE_INFORMATION, - MENU_SETTING_ACTION_CORE_DISK_OPTIONS, - MENU_SETTING_ACTION_CORE_SHADER_OPTIONS, - MENU_SETTING_ACTION_SAVESTATE, - MENU_SETTING_ACTION_LOADSTATE, - MENU_SETTING_ACTION_SCREENSHOT, - MENU_SETTING_ACTION_RESET, - MENU_SETTING_STRING_OPTIONS, - MENU_SETTING_GROUP, - MENU_SETTING_SUBGROUP, - MENU_SETTING_HORIZONTAL_MENU, - MENU_INFO_MESSAGE, - MENU_FILE_TYPE_T_LAST -} menu_file_type_t; - -typedef enum -{ - MENU_SETTINGS_NONE = MENU_FILE_TYPE_T_LAST + 1, - MENU_SETTINGS_SHADER_PARAMETER_0, - MENU_SETTINGS_SHADER_PARAMETER_LAST = MENU_SETTINGS_SHADER_PARAMETER_0 + (GFX_MAX_PARAMETERS - 1), - MENU_SETTINGS_SHADER_PRESET_PARAMETER_0, - MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST = MENU_SETTINGS_SHADER_PRESET_PARAMETER_0 + (GFX_MAX_PARAMETERS - 1), - MENU_SETTINGS_SHADER_PASS_0, - MENU_SETTINGS_SHADER_PASS_LAST = MENU_SETTINGS_SHADER_PASS_0 + (GFX_MAX_SHADERS - 1), - MENU_SETTINGS_SHADER_PASS_FILTER_0, - MENU_SETTINGS_SHADER_PASS_FILTER_LAST = MENU_SETTINGS_SHADER_PASS_FILTER_0 + (GFX_MAX_SHADERS - 1), - MENU_SETTINGS_SHADER_PASS_SCALE_0, - MENU_SETTINGS_SHADER_PASS_SCALE_LAST = MENU_SETTINGS_SHADER_PASS_SCALE_0 + (GFX_MAX_SHADERS - 1), - - MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_INDEX, - MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_IMAGE_APPEND, - MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_CYCLE_TRAY_STATUS, - - MENU_SETTINGS_BIND_BEGIN, - MENU_SETTINGS_BIND_LAST = MENU_SETTINGS_BIND_BEGIN + RARCH_ANALOG_RIGHT_Y_MINUS, - MENU_SETTINGS_BIND_ALL_LAST = MENU_SETTINGS_BIND_BEGIN + RARCH_MENU_TOGGLE, - - MENU_SETTINGS_CUSTOM_BIND, - MENU_SETTINGS_CUSTOM_BIND_KEYBOARD, - MENU_SETTINGS_CUSTOM_BIND_ALL, - MENU_SETTINGS_CUSTOM_BIND_DEFAULT_ALL, - MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN, - MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_END = MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN + (MAX_COUNTERS - 1), - MENU_SETTINGS_PERF_COUNTERS_BEGIN, - MENU_SETTINGS_PERF_COUNTERS_END = MENU_SETTINGS_PERF_COUNTERS_BEGIN + (MAX_COUNTERS - 1), - MENU_SETTINGS_CHEAT_BEGIN, - MENU_SETTINGS_CHEAT_END = MENU_SETTINGS_CHEAT_BEGIN + (MAX_CHEAT_COUNTERS - 1), - MENU_SETTINGS_INPUT_DESC_BEGIN, - MENU_SETTINGS_INPUT_DESC_END = MENU_SETTINGS_INPUT_DESC_BEGIN + (MAX_USERS * (RARCH_FIRST_CUSTOM_BIND + 4)), - MENU_SETTINGS_LAST -} menu_settings_t; - -/** - * menu_init: - * @data : Menu context handle. - * - * Create and initialize menu handle. - * - * Returns: menu handle on success, otherwise NULL. - **/ -void *menu_init(const void *data); - -/** - * menu_iterate: - * @render_this_frame : Render this frame or not - * @action : Associated action for this frame - * - * Runs RetroArch menu for one frame. - * - * Returns: 0 on success, -1 if we need to quit out of the loop. - **/ -int menu_iterate(bool render_this_frame, enum menu_action action); - -int menu_iterate_render(void); - -/** - * menu_free: - * @menu : Menu handle. - * - * Frees a menu handle - **/ -void menu_free(menu_handle_t *menu); - -/** - * menu_load_content: - * type : Type of content to load. - * - * Loads content into currently selected core. - * Will also optionally push the content entry to the history playlist. - * - * Returns: true (1) if successful, otherwise false (0). - **/ -bool menu_load_content(enum rarch_core_type type); - -int menu_common_load_content(const char *core_path, const char *full_path, - bool persist, enum rarch_core_type type); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/menu/menu_cbs.h b/menu/menu_cbs.h index efc2b0691a..6ec51f761e 100644 --- a/menu/menu_cbs.h +++ b/menu/menu_cbs.h @@ -17,8 +17,10 @@ #define MENU_CBS_H__ #include + #include +#include "menu_entries.h" #include "menu_hash.h" enum diff --git a/menu/menu_display.c b/menu/menu_display.c index 8546ec97db..ff5a96daac 100644 --- a/menu/menu_display.c +++ b/menu/menu_display.c @@ -23,7 +23,7 @@ #include "../config.def.h" #include "../gfx/video_thread_wrapper.h" -#include "menu.h" +#include "menu_driver.h" #include "menu_animation.h" #include "menu_display.h" diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index ba871c1568..3a99920452 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -21,7 +21,7 @@ #include #include -#include "menu.h" +#include "menu_driver.h" #include "menu_hash.h" #ifdef HAVE_LIBRETRODB diff --git a/menu/menu_driver.c b/menu/menu_driver.c index e006f292bd..b8a8491509 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -16,10 +16,18 @@ #include -#include "menu.h" +#include + +#include "menu_driver.h" +#include "menu_cbs.h" #include "menu_display.h" +#include "menu_hash.h" +#include "menu_shader.h" + #include "../general.h" +#include "../frontend/frontend.h" #include "../string_list_special.h" +#include "../tasks/tasks.h" static const menu_ctx_driver_t *menu_ctx_drivers[] = { #if defined(HAVE_RMENU) @@ -368,6 +376,273 @@ int menu_driver_pointer_tap(unsigned x, unsigned y, unsigned ptr, return ret; } +static void menu_environment_get(int *argc, char *argv[], + void *args, void *params_data) +{ + struct rarch_main_wrap *wrap_args = (struct rarch_main_wrap*)params_data; + global_t *global = global_get_ptr(); + settings_t *settings = config_get_ptr(); + menu_handle_t *menu = menu_driver_get_ptr(); + char *fullpath = NULL; + + if (!wrap_args) + return; + + runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath); + + wrap_args->no_content = menu->load_no_content; + if (!global->has_set.verbosity) + wrap_args->verbose = *retro_main_verbosity(); + + wrap_args->config_path = *global->path.config ? global->path.config : NULL; + wrap_args->sram_path = *global->dir.savefile ? global->dir.savefile : NULL; + wrap_args->state_path = *global->dir.savestate ? global->dir.savestate : NULL; + wrap_args->content_path = *fullpath ? fullpath : NULL; + + if (!global->has_set.libretro) + wrap_args->libretro_path = *settings->libretro ? settings->libretro : NULL; + wrap_args->touched = true; +} + +static void menu_push_to_history_playlist(void) +{ + settings_t *settings = config_get_ptr(); + global_t *global = global_get_ptr(); + char *fullpath = NULL; + + if (!settings->history_list_enable) + return; + + runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath); + + if (*fullpath) + { + char tmp[PATH_MAX_LENGTH]; + char str[PATH_MAX_LENGTH]; + + fill_pathname_base(tmp, fullpath, sizeof(tmp)); + snprintf(str, sizeof(str), "INFO - Loading %s ...", tmp); + menu_display_msg_queue_push(str, 1, 1, false); + } + + content_playlist_push(g_defaults.history, + fullpath, + NULL, + settings->libretro, + global->menu.info.library_name, + NULL, + NULL); +} + +/** + * menu_load_content: + * + * Loads content into currently selected core. + * Will also optionally push the content entry to the history playlist. + * + * Returns: true (1) if successful, otherwise false (0). + **/ +bool menu_load_content(enum rarch_core_type type) +{ + bool msg_force = true; + menu_handle_t *menu = menu_driver_get_ptr(); + char *fullpath = NULL; + + runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath); + /* redraw menu frame */ + menu_display_ctl(MENU_DISPLAY_CTL_SET_MSG_FORCE, &msg_force); + menu_iterate_render(); + + if (!(main_load_content(0, NULL, NULL, menu_environment_get))) + { + char name[PATH_MAX_LENGTH] = {0}; + char msg[PATH_MAX_LENGTH] = {0}; + + fill_pathname_base(name, fullpath, sizeof(name)); + snprintf(msg, sizeof(msg), "Failed to load %s.\n", name); + menu_display_msg_queue_push(msg, 1, 90, false); + + return false; + } + + menu_shader_manager_init(menu); + + event_command(EVENT_CMD_HISTORY_INIT); + + if (*fullpath || (menu && menu->load_no_content)) + menu_push_to_history_playlist(); + + event_command(EVENT_CMD_VIDEO_SET_ASPECT_RATIO); + event_command(EVENT_CMD_RESUME); + + return true; +} + +int menu_common_load_content( + const char *core_path, const char *fullpath, + bool persist, enum rarch_core_type type) +{ + enum event_command cmd = EVENT_CMD_NONE; + + if (core_path) + { + runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, (void*)core_path); + event_command(EVENT_CMD_LOAD_CORE); + } + + if (fullpath) + runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, (void*)fullpath); + + switch (type) + { + case CORE_TYPE_PLAIN: + case CORE_TYPE_DUMMY: + cmd = persist ? EVENT_CMD_LOAD_CONTENT_PERSIST : EVENT_CMD_LOAD_CONTENT; + break; +#ifdef HAVE_FFMPEG + case CORE_TYPE_FFMPEG: + cmd = EVENT_CMD_LOAD_CONTENT_FFMPEG; + break; +#endif + case CORE_TYPE_IMAGEVIEWER: +#ifdef HAVE_IMAGEVIEWER + cmd = EVENT_CMD_LOAD_CONTENT_IMAGEVIEWER; +#endif + break; + } + + if (cmd != EVENT_CMD_NONE) + event_command(cmd); + + return -1; +} + +/** + * menu_free: + * @menu : Menu handle. + * + * Frees a menu handle + **/ +void menu_free(menu_handle_t *menu) +{ + global_t *global = global_get_ptr(); + if (!menu) + return; + + if (menu->playlist) + content_playlist_free(menu->playlist); + menu->playlist = NULL; + + menu_shader_free(menu); + + menu_input_free(); + menu_navigation_free(); + menu_driver_free(menu); + +#ifdef HAVE_DYNAMIC + libretro_free_system_info(&global->menu.info); +#endif + + menu_display_free(); + menu_entries_free(); + + event_command(EVENT_CMD_HISTORY_DEINIT); + + if (global->core_info.list) + core_info_list_free(global->core_info.list); + + if (global->core_info.current) + free(global->core_info.current); + global->core_info.current = NULL; + + free(menu); +} + +static void bundle_decompressed(void *task_data, void *user_data, const char *err) +{ + settings_t *settings = config_get_ptr(); + decompress_task_data_t *dec = (decompress_task_data_t*)task_data; + + if (dec && !err) + event_command(EVENT_CMD_REINIT); + + if (err) + RARCH_ERR("%s", err); + + if (dec) + { + /* delete bundle? */ + free(dec->source_file); + free(dec); + } + + settings->bundle_assets_extract_last_version = settings->bundle_assets_extract_version_current; +} + +/** + * menu_init: + * @data : Menu context handle. + * + * Create and initialize menu handle. + * + * Returns: menu handle on success, otherwise NULL. + **/ +void *menu_init(const void *data) +{ + menu_handle_t *menu = NULL; + menu_ctx_driver_t *menu_ctx = (menu_ctx_driver_t*)data; + global_t *global = global_get_ptr(); + settings_t *settings = config_get_ptr(); + + if (!menu_ctx) + return NULL; + + if (!(menu = (menu_handle_t*)menu_ctx->init())) + return NULL; + + strlcpy(settings->menu.driver, menu_ctx->ident, + sizeof(settings->menu.driver)); + + if (!menu_entries_init(menu)) + goto error; + + global->core_info.current = (core_info_t*)calloc(1, sizeof(core_info_t)); + if (!global->core_info.current) + goto error; + +#ifdef HAVE_SHADER_MANAGER + menu->shader = (struct video_shader*)calloc(1, sizeof(struct video_shader)); + if (!menu->shader) + goto error; +#endif + + menu->push_help_screen = settings->menu_show_start_screen; + menu->help_screen_type = MENU_HELP_WELCOME; + settings->menu_show_start_screen = false; + + if (settings->bundle_assets_extract_enable && + settings->bundle_assets_src_path[0] != '\0' && settings->bundle_assets_dst_path[0] != '\0' && + settings->bundle_assets_extract_version_current != settings->bundle_assets_extract_last_version + ) + { + rarch_task_push_decompress(settings->bundle_assets_src_path, settings->bundle_assets_dst_path, + settings->bundle_assets_dst_path_subdir, NULL, bundle_decompressed, NULL); + } + + menu_shader_manager_init(menu); + + if (!menu_display_init()) + goto error; + + return menu; + +error: + menu_free(menu); + + return NULL; +} + + bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) { static bool menu_driver_alive = false; diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 3ca119de6c..5e9a2504cd 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -17,22 +17,51 @@ #ifndef __MENU_DRIVER_H__ #define __MENU_DRIVER_H__ -#include #include +#include +#include +#include +#include + #include #include + #include "menu_displaylist.h" #include "menu_entries.h" #include "menu_input.h" #include "menu_navigation.h" #include "menu_setting.h" + +#include "../driver.h" #include "../libretro.h" #include "../playlist.h" +#include "../input/input_driver.h" +#include "../dynamic.h" +#include "../gfx/video_shader_driver.h" #ifdef __cplusplus extern "C" { #endif +#ifndef MAX_COUNTERS +#define MAX_COUNTERS 64 +#endif + +#ifndef MAX_CHEAT_COUNTERS +#define MAX_CHEAT_COUNTERS 100 +#endif + +#define MENU_SETTINGS_CORE_INFO_NONE 0xffff +#define MENU_SETTINGS_CORE_OPTION_NONE 0xffff +#define MENU_SETTINGS_CHEEVOS_NONE 0xffff +#define MENU_SETTINGS_CORE_OPTION_CREATE 0x05000 +#define MENU_SETTINGS_CORE_OPTION_START 0x10000 +#define MENU_SETTINGS_PLAYLIST_ASSOCIATION_START 0x20000 +#define MENU_SETTINGS_CHEEVOS_START 0x40000 + + +#define MENU_KEYBOARD_BIND_TIMEOUT_SECONDS 5 + typedef enum { MENU_IMAGE_NONE = 0, @@ -78,6 +107,109 @@ enum rarch_menu_ctl_state RARCH_MENU_CTL_OWNS_DRIVER }; +typedef enum +{ + MENU_FILE_NONE = 0, + MENU_FILE_PLAIN, + MENU_FILE_DIRECTORY, + MENU_FILE_PARENT_DIRECTORY, + MENU_FILE_PATH, + MENU_FILE_DEVICE, + MENU_FILE_CORE, + MENU_FILE_PLAYLIST_ENTRY, + MENU_FILE_CONTENTLIST_ENTRY, + MENU_FILE_SHADER_PRESET, + MENU_FILE_SHADER, + MENU_FILE_VIDEOFILTER, + MENU_FILE_AUDIOFILTER, + MENU_FILE_CHEAT, + MENU_FILE_OVERLAY, + MENU_FILE_FONT, + MENU_FILE_CONFIG, + MENU_FILE_USE_DIRECTORY, + MENU_FILE_SCAN_DIRECTORY, + MENU_FILE_CARCHIVE, + MENU_FILE_IN_CARCHIVE, + MENU_FILE_IMAGE, + MENU_FILE_IMAGEVIEWER, + MENU_FILE_REMAP, + MENU_FILE_DOWNLOAD_CORE, + MENU_FILE_DOWNLOAD_CORE_CONTENT, + MENU_FILE_DOWNLOAD_CORE_INFO, + MENU_FILE_RDB, + MENU_FILE_RDB_ENTRY, + MENU_FILE_RPL_ENTRY, + MENU_FILE_CURSOR, + MENU_FILE_RECORD_CONFIG, + MENU_FILE_PLAYLIST_COLLECTION, + MENU_FILE_PLAYLIST_ASSOCIATION, + MENU_FILE_MOVIE, + MENU_FILE_MUSIC, + MENU_SETTINGS, + MENU_SETTINGS_TAB, + MENU_HISTORY_TAB, + MENU_ADD_TAB, + MENU_PLAYLISTS_TAB, + MENU_SETTING_NO_ITEM, + MENU_SETTING_DRIVER, + MENU_SETTING_ACTION, + MENU_SETTING_ACTION_RUN, + MENU_SETTING_ACTION_CLOSE, + MENU_SETTING_ACTION_CORE_OPTIONS, + MENU_SETTING_ACTION_CORE_INPUT_REMAPPING_OPTIONS, + MENU_SETTING_ACTION_CORE_CHEAT_OPTIONS, + MENU_SETTING_ACTION_CORE_INFORMATION, + MENU_SETTING_ACTION_CORE_DISK_OPTIONS, + MENU_SETTING_ACTION_CORE_SHADER_OPTIONS, + MENU_SETTING_ACTION_SAVESTATE, + MENU_SETTING_ACTION_LOADSTATE, + MENU_SETTING_ACTION_SCREENSHOT, + MENU_SETTING_ACTION_RESET, + MENU_SETTING_STRING_OPTIONS, + MENU_SETTING_GROUP, + MENU_SETTING_SUBGROUP, + MENU_SETTING_HORIZONTAL_MENU, + MENU_INFO_MESSAGE, + MENU_FILE_TYPE_T_LAST +} menu_file_type_t; + +typedef enum +{ + MENU_SETTINGS_NONE = MENU_FILE_TYPE_T_LAST + 1, + MENU_SETTINGS_SHADER_PARAMETER_0, + MENU_SETTINGS_SHADER_PARAMETER_LAST = MENU_SETTINGS_SHADER_PARAMETER_0 + (GFX_MAX_PARAMETERS - 1), + MENU_SETTINGS_SHADER_PRESET_PARAMETER_0, + MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST = MENU_SETTINGS_SHADER_PRESET_PARAMETER_0 + (GFX_MAX_PARAMETERS - 1), + MENU_SETTINGS_SHADER_PASS_0, + MENU_SETTINGS_SHADER_PASS_LAST = MENU_SETTINGS_SHADER_PASS_0 + (GFX_MAX_SHADERS - 1), + MENU_SETTINGS_SHADER_PASS_FILTER_0, + MENU_SETTINGS_SHADER_PASS_FILTER_LAST = MENU_SETTINGS_SHADER_PASS_FILTER_0 + (GFX_MAX_SHADERS - 1), + MENU_SETTINGS_SHADER_PASS_SCALE_0, + MENU_SETTINGS_SHADER_PASS_SCALE_LAST = MENU_SETTINGS_SHADER_PASS_SCALE_0 + (GFX_MAX_SHADERS - 1), + + MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_INDEX, + MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_IMAGE_APPEND, + MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_CYCLE_TRAY_STATUS, + + MENU_SETTINGS_BIND_BEGIN, + MENU_SETTINGS_BIND_LAST = MENU_SETTINGS_BIND_BEGIN + RARCH_ANALOG_RIGHT_Y_MINUS, + MENU_SETTINGS_BIND_ALL_LAST = MENU_SETTINGS_BIND_BEGIN + RARCH_MENU_TOGGLE, + + MENU_SETTINGS_CUSTOM_BIND, + MENU_SETTINGS_CUSTOM_BIND_KEYBOARD, + MENU_SETTINGS_CUSTOM_BIND_ALL, + MENU_SETTINGS_CUSTOM_BIND_DEFAULT_ALL, + MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN, + MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_END = MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN + (MAX_COUNTERS - 1), + MENU_SETTINGS_PERF_COUNTERS_BEGIN, + MENU_SETTINGS_PERF_COUNTERS_END = MENU_SETTINGS_PERF_COUNTERS_BEGIN + (MAX_COUNTERS - 1), + MENU_SETTINGS_CHEAT_BEGIN, + MENU_SETTINGS_CHEAT_END = MENU_SETTINGS_CHEAT_BEGIN + (MAX_CHEAT_COUNTERS - 1), + MENU_SETTINGS_INPUT_DESC_BEGIN, + MENU_SETTINGS_INPUT_DESC_END = MENU_SETTINGS_INPUT_DESC_BEGIN + (MAX_USERS * (RARCH_FIRST_CUSTOM_BIND + 4)), + MENU_SETTINGS_LAST +} menu_settings_t; + typedef struct { void *userdata; @@ -248,6 +380,51 @@ extern unsigned int rdb_entry_start_game_selection_ptr; bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data); +/** + * menu_init: + * @data : Menu context handle. + * + * Create and initialize menu handle. + * + * Returns: menu handle on success, otherwise NULL. + **/ +void *menu_init(const void *data); + +/** + * menu_iterate: + * @render_this_frame : Render this frame or not + * @action : Associated action for this frame + * + * Runs RetroArch menu for one frame. + * + * Returns: 0 on success, -1 if we need to quit out of the loop. + **/ +int menu_iterate(bool render_this_frame, enum menu_action action); + +int menu_iterate_render(void); + +/** + * menu_free: + * @menu : Menu handle. + * + * Frees a menu handle + **/ +void menu_free(menu_handle_t *menu); + +/** + * menu_load_content: + * type : Type of content to load. + * + * Loads content into currently selected core. + * Will also optionally push the content entry to the history playlist. + * + * Returns: true (1) if successful, otherwise false (0). + **/ +bool menu_load_content(enum rarch_core_type type); + +int menu_common_load_content(const char *core_path, const char *full_path, + bool persist, enum rarch_core_type type); + #ifdef __cplusplus } #endif diff --git a/menu/menu_entries.c b/menu/menu_entries.c index 95224b5d86..8c2e163d7d 100644 --- a/menu/menu_entries.c +++ b/menu/menu_entries.c @@ -16,7 +16,8 @@ #include #include -#include "menu.h" + +#include "menu_driver.h" #include "menu_cbs.h" #include "menu_hash.h" diff --git a/menu/menu_entry.c b/menu/menu_entry.c index fd0360a18f..344ee110c5 100644 --- a/menu/menu_entry.c +++ b/menu/menu_entry.c @@ -16,7 +16,7 @@ #include #include -#include "menu.h" +#include "menu_driver.h" #include "menu_display.h" /* This file provides an abstraction of the currently displayed diff --git a/menu/menu_input.c b/menu/menu_input.c index 7d01518ff7..15f5d40697 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -23,8 +23,8 @@ #include #include +#include "menu_driver.h" #include "menu_input.h" -#include "menu.h" #include "menu_animation.h" #include "menu_display.h" #include "menu_entry.h" diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 47f90236ff..fbb4d0d490 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -29,7 +29,7 @@ #include "menu_setting.h" -#include "menu.h" +#include "menu_driver.h" #include "menu_animation.h" #include "menu_display.h" #include "menu_input.h" diff --git a/menu/menu_shader.c b/menu/menu_shader.c index 6fd841c4c3..fcd6b583f3 100644 --- a/menu/menu_shader.c +++ b/menu/menu_shader.c @@ -20,7 +20,7 @@ #include #include -#include "menu.h" +#include "menu_driver.h" #include "menu_hash.h" #include "menu_shader.h" #include "../configuration.h" diff --git a/retroarch.c b/retroarch.c index fd471715ea..177bc407ac 100644 --- a/retroarch.c +++ b/retroarch.c @@ -67,7 +67,7 @@ #endif #ifdef HAVE_MENU -#include "menu/menu.h" +#include "menu/menu_driver.h" #include "menu/menu_hash.h" #endif diff --git a/runloop.c b/runloop.c index b4abf8cc93..4c5ba803d3 100644 --- a/runloop.c +++ b/runloop.c @@ -54,7 +54,7 @@ #include "input/input_keyboard.h" #ifdef HAVE_MENU -#include "menu/menu.h" +#include "menu/menu_driver.h" #endif #ifdef HAVE_NETPLAY