merge menu.c and menu_driver.c

This commit is contained in:
twinaphex 2015-12-06 17:55:27 +01:00
parent 8e8f69bb69
commit 1cfb39a9d1
43 changed files with 503 additions and 545 deletions

View File

@ -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 \

View File

@ -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)
{

View File

@ -20,7 +20,10 @@
#include <stdlib.h>
#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);

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -14,7 +14,8 @@
*/
#include <file/file_path.h>
#include "../menu.h"
#include "../menu_driver.h"
#include "../menu_cbs.h"
static int action_cancel_pop_default(const char *path,

View File

@ -13,7 +13,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "../menu.h"
#include "../menu_driver.h"
#include "../menu_cbs.h"
#ifndef BIND_ACTION_CONTENT_LIST_SWITCH

View File

@ -15,7 +15,7 @@
#include <file/file_path.h>
#include "../menu.h"
#include "../menu_driver.h"
#include "../menu_cbs.h"
#include "../../msg_hash.h"

View File

@ -13,7 +13,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "../menu.h"
#include "../menu_driver.h"
#include "../menu_navigation.h"
#include "../menu_cbs.h"

View File

@ -15,7 +15,7 @@
#include <file/file_path.h>
#include "../menu.h"
#include "../menu_driver.h"
#include "../menu_animation.h"
#include "../menu_cbs.h"
#include "../menu_shader.h"

View File

@ -15,7 +15,7 @@
#include <compat/strl.h>
#include "../menu.h"
#include "../menu_driver.h"
#include "../menu_cbs.h"
#include "../menu_hash.h"

View File

@ -15,7 +15,7 @@
#include <file/file_path.h>
#include "../menu.h"
#include "../menu_driver.h"
#include "../menu_cbs.h"
#include "../menu_hash.h"
#include "../menu_input.h"

View File

@ -16,7 +16,7 @@
#include <file/file_path.h>
#include <retro_stat.h>
#include "../menu.h"
#include "../menu_driver.h"
#include "../menu_cbs.h"
#include "../menu_display.h"
#include "../menu_setting.h"

View File

@ -13,7 +13,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "../menu.h"
#include "../menu_driver.h"
#include "../menu_cbs.h"
#include "../menu_hash.h"

View File

@ -15,7 +15,7 @@
#include <file/file_path.h>
#include "../menu.h"
#include "../menu_driver.h"
#include "../menu_cbs.h"
#include "../menu_hash.h"
#include "../menu_input.h"

View File

@ -16,7 +16,7 @@
#include <file/file_path.h>
#include <compat/strl.h>
#include "../menu.h"
#include "../menu_driver.h"
#include "../menu_cbs.h"
#include "../menu_entry.h"
#include "../menu_setting.h"

View File

@ -13,7 +13,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "../menu.h"
#include "../menu_driver.h"
#include "../menu_entry.h"
#include "../menu_cbs.h"
#include "../menu_setting.h"

View File

@ -15,7 +15,7 @@
#include <file/file_path.h>
#include "../menu.h"
#include "../menu_driver.h"
#include "../menu_cbs.h"
#include "../menu_input.h"
#include "../menu_display.h"

View File

@ -19,7 +19,7 @@
#include <compat/strl.h>
#include "../menu.h"
#include "../menu_driver.h"
#include "../menu_cbs.h"
#include "../menu_hash.h"

View File

@ -13,7 +13,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "../menu.h"
#include "../menu_driver.h"
#include "../menu_cbs.h"
#include "../menu_navigation.h"

View File

@ -30,7 +30,6 @@
#include "menu_generic.h"
#include "../menu.h"
#include "../menu_driver.h"
#include "../menu_animation.h"
#include "../menu_hash.h"

View File

@ -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"

View File

@ -19,9 +19,10 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "../menu_driver.h"
#include "../menu_display.h"
#include "../menu.h"
#include "../../general.h"
menu_ctx_driver_t menu_ctx_null = {

View File

@ -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"

View File

@ -26,7 +26,6 @@
#include "menu_generic.h"
#include "../menu.h"
#include "../menu_driver.h"
#include "../menu_entry.h"
#include "../menu_input.h"

View File

@ -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"

View File

@ -30,7 +30,6 @@
#include "menu_generic.h"
#include "../menu.h"
#include "../menu_driver.h"
#include "../menu_entry.h"
#include "../menu_animation.h"

View File

@ -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"

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#include <file/file_path.h>
#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;
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef __RETROARCH_MENU_H__
#define __RETROARCH_MENU_H__
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <boolean.h>
#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

View File

@ -17,8 +17,10 @@
#define MENU_CBS_H__
#include <stdlib.h>
#include <boolean.h>
#include "menu_entries.h"
#include "menu_hash.h"
enum

View File

@ -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"

View File

@ -21,7 +21,7 @@
#include <file/dir_list.h>
#include <retro_stat.h>
#include "menu.h"
#include "menu_driver.h"
#include "menu_hash.h"
#ifdef HAVE_LIBRETRODB

View File

@ -16,10 +16,18 @@
#include <string.h>
#include "menu.h"
#include <file/file_path.h>
#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;

View File

@ -17,22 +17,51 @@
#ifndef __MENU_DRIVER_H__
#define __MENU_DRIVER_H__
#include <stddef.h>
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <boolean.h>
#include <retro_miscellaneous.h>
#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

View File

@ -16,7 +16,8 @@
#include <string.h>
#include <retro_inline.h>
#include "menu.h"
#include "menu_driver.h"
#include "menu_cbs.h"
#include "menu_hash.h"

View File

@ -16,7 +16,7 @@
#include <compat/strl.h>
#include <string/string_list.h>
#include "menu.h"
#include "menu_driver.h"
#include "menu_display.h"
/* This file provides an abstraction of the currently displayed

View File

@ -23,8 +23,8 @@
#include <stdlib.h>
#include <string.h>
#include "menu_driver.h"
#include "menu_input.h"
#include "menu.h"
#include "menu_animation.h"
#include "menu_display.h"
#include "menu_entry.h"

View File

@ -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"

View File

@ -20,7 +20,7 @@
#include <retro_assert.h>
#include <file/file_path.h>
#include "menu.h"
#include "menu_driver.h"
#include "menu_hash.h"
#include "menu_shader.h"
#include "../configuration.h"

View File

@ -67,7 +67,7 @@
#endif
#ifdef HAVE_MENU
#include "menu/menu.h"
#include "menu/menu_driver.h"
#include "menu/menu_hash.h"
#endif

View File

@ -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