2015-01-12 19:00:43 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
2016-01-10 03:06:50 +00:00
|
|
|
* Copyright (C) 2011-2016 - Daniel De Matteis
|
2016-10-27 15:47:10 +00:00
|
|
|
* Copyright (C) 2016 - Brad Parker
|
2016-09-05 15:35:27 +00:00
|
|
|
*
|
2015-01-12 19:00:43 +00:00
|
|
|
* 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 <string.h>
|
2015-06-05 16:22:15 +00:00
|
|
|
|
2016-09-05 22:56:00 +00:00
|
|
|
#include <compat/strl.h>
|
2015-12-06 16:55:27 +00:00
|
|
|
#include <file/file_path.h>
|
2015-12-26 06:37:44 +00:00
|
|
|
#include <string/stdstring.h>
|
2015-12-06 16:55:27 +00:00
|
|
|
|
2016-09-06 22:01:49 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "../config.h"
|
|
|
|
#endif
|
|
|
|
|
2016-02-10 19:29:17 +00:00
|
|
|
#include "menu_animation.h"
|
2015-12-06 16:55:27 +00:00
|
|
|
#include "menu_driver.h"
|
|
|
|
#include "menu_cbs.h"
|
2015-10-18 05:15:54 +00:00
|
|
|
#include "menu_display.h"
|
2016-10-26 22:14:01 +00:00
|
|
|
#include "menu_event.h"
|
2015-12-09 08:53:43 +00:00
|
|
|
#include "menu_navigation.h"
|
2016-09-15 13:57:25 +00:00
|
|
|
#include "widgets/menu_dialog.h"
|
2016-09-14 22:10:37 +00:00
|
|
|
#include "widgets/menu_list.h"
|
2015-12-06 16:55:27 +00:00
|
|
|
#include "menu_shader.h"
|
|
|
|
|
2016-02-05 13:00:27 +00:00
|
|
|
#include "../content.h"
|
2016-06-20 04:34:30 +00:00
|
|
|
#include "../configuration.h"
|
2016-09-11 16:49:38 +00:00
|
|
|
#include "../dynamic.h"
|
|
|
|
#include "../driver.h"
|
2016-03-22 01:45:25 +00:00
|
|
|
#include "../retroarch.h"
|
2015-12-09 08:53:43 +00:00
|
|
|
#include "../defaults.h"
|
2015-12-06 16:55:27 +00:00
|
|
|
#include "../frontend/frontend.h"
|
2016-03-20 16:28:24 +00:00
|
|
|
#include "../list_special.h"
|
2016-02-09 16:12:39 +00:00
|
|
|
#include "../tasks/tasks_internal.h"
|
2016-02-10 19:29:17 +00:00
|
|
|
#include "../ui/ui_companion_driver.h"
|
2016-06-20 04:34:30 +00:00
|
|
|
#include "../runloop.h"
|
2015-12-20 19:52:23 +00:00
|
|
|
#include "../verbosity.h"
|
2015-01-12 19:00:43 +00:00
|
|
|
|
|
|
|
static const menu_ctx_driver_t *menu_ctx_drivers[] = {
|
2016-01-12 08:23:17 +00:00
|
|
|
#if defined(HAVE_XUI)
|
|
|
|
&menu_ctx_xui,
|
2015-01-12 19:00:43 +00:00
|
|
|
#endif
|
2015-11-02 22:23:54 +00:00
|
|
|
#if defined(HAVE_MATERIALUI)
|
2015-11-05 09:55:32 +00:00
|
|
|
&menu_ctx_mui,
|
2015-01-12 19:00:43 +00:00
|
|
|
#endif
|
2016-04-25 12:58:47 +00:00
|
|
|
#if defined(HAVE_NUKLEAR)
|
|
|
|
&menu_ctx_nuklear,
|
2016-02-14 19:10:06 +00:00
|
|
|
#endif
|
2015-01-12 19:00:43 +00:00
|
|
|
#if defined(HAVE_XMB)
|
|
|
|
&menu_ctx_xmb,
|
|
|
|
#endif
|
|
|
|
#if defined(HAVE_RGUI)
|
|
|
|
&menu_ctx_rgui,
|
2015-10-02 00:15:23 +00:00
|
|
|
#endif
|
|
|
|
#if defined(HAVE_ZARCH)
|
|
|
|
&menu_ctx_zarch,
|
2015-01-12 19:00:43 +00:00
|
|
|
#endif
|
2015-03-09 13:39:39 +00:00
|
|
|
&menu_ctx_null,
|
2015-01-12 19:00:43 +00:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2016-07-09 14:42:31 +00:00
|
|
|
static struct retro_system_info menu_driver_system;
|
|
|
|
static bool menu_driver_pending_quick_menu = false;
|
|
|
|
static bool menu_driver_prevent_populate = false;
|
|
|
|
static bool menu_driver_load_no_content = false;
|
|
|
|
static bool menu_driver_alive = false;
|
2016-09-05 15:35:27 +00:00
|
|
|
static bool menu_driver_toggled = false;
|
2016-07-09 14:42:31 +00:00
|
|
|
static bool menu_driver_data_own = false;
|
2016-09-02 01:47:25 +00:00
|
|
|
static bool menu_driver_pending_quit = false;
|
2016-09-04 19:31:50 +00:00
|
|
|
static bool menu_driver_pending_shutdown = false;
|
2016-10-30 01:58:22 +00:00
|
|
|
static bool menu_driver_is_binding = false;
|
2016-07-09 14:42:31 +00:00
|
|
|
static playlist_t *menu_driver_playlist = NULL;
|
|
|
|
static menu_handle_t *menu_driver_data = NULL;
|
|
|
|
static const menu_ctx_driver_t *menu_driver_ctx = NULL;
|
|
|
|
static void *menu_userdata = NULL;
|
2015-12-05 12:13:49 +00:00
|
|
|
|
2016-11-20 13:42:20 +00:00
|
|
|
bool menu_driver_is_binding_state(void)
|
2016-10-30 01:58:22 +00:00
|
|
|
{
|
|
|
|
return menu_driver_is_binding;
|
|
|
|
}
|
|
|
|
|
|
|
|
void menu_driver_set_binding_state(bool on)
|
|
|
|
{
|
|
|
|
menu_driver_is_binding = on;
|
|
|
|
}
|
|
|
|
|
2015-01-12 19:00:43 +00:00
|
|
|
/**
|
|
|
|
* menu_driver_find_handle:
|
2015-01-15 20:10:36 +00:00
|
|
|
* @idx : index of driver to get handle to.
|
2015-01-12 19:00:43 +00:00
|
|
|
*
|
|
|
|
* Returns: handle to menu driver at index. Can be NULL
|
|
|
|
* if nothing found.
|
|
|
|
**/
|
2015-01-15 20:10:36 +00:00
|
|
|
const void *menu_driver_find_handle(int idx)
|
2015-01-12 19:00:43 +00:00
|
|
|
{
|
2015-01-15 20:10:36 +00:00
|
|
|
const void *drv = menu_ctx_drivers[idx];
|
2015-01-12 19:00:43 +00:00
|
|
|
if (!drv)
|
|
|
|
return NULL;
|
|
|
|
return drv;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* menu_driver_find_ident:
|
2015-01-15 20:10:36 +00:00
|
|
|
* @idx : index of driver to get handle to.
|
2015-01-12 19:00:43 +00:00
|
|
|
*
|
2016-09-05 15:35:27 +00:00
|
|
|
* Returns: Human-readable identifier of menu driver at index.
|
2016-02-04 19:23:52 +00:00
|
|
|
* Can be NULL if nothing found.
|
2015-01-12 19:00:43 +00:00
|
|
|
**/
|
2015-01-15 20:10:36 +00:00
|
|
|
const char *menu_driver_find_ident(int idx)
|
2015-01-12 19:00:43 +00:00
|
|
|
{
|
2015-01-15 20:10:36 +00:00
|
|
|
const menu_ctx_driver_t *drv = menu_ctx_drivers[idx];
|
2015-01-12 19:00:43 +00:00
|
|
|
if (!drv)
|
|
|
|
return NULL;
|
|
|
|
return drv->ident;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* config_get_menu_driver_options:
|
|
|
|
*
|
|
|
|
* Get an enumerated list of all menu driver names,
|
|
|
|
* separated by '|'.
|
|
|
|
*
|
|
|
|
* Returns: string listing of all menu driver names,
|
|
|
|
* separated by '|'.
|
|
|
|
**/
|
2015-10-26 07:39:35 +00:00
|
|
|
const char *config_get_menu_driver_options(void)
|
2015-01-12 19:00:43 +00:00
|
|
|
{
|
2015-10-26 18:41:20 +00:00
|
|
|
return char_list_new_special(STRING_LIST_MENU_DRIVERS, NULL);
|
2015-01-12 19:00:43 +00:00
|
|
|
}
|
|
|
|
|
2016-09-18 23:56:26 +00:00
|
|
|
#ifdef HAVE_COMPRESSION
|
2016-02-04 19:23:52 +00:00
|
|
|
static void bundle_decompressed(void *task_data,
|
|
|
|
void *user_data, const char *err)
|
2016-01-26 20:04:05 +00:00
|
|
|
{
|
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
decompress_task_data_t *dec = (decompress_task_data_t*)task_data;
|
|
|
|
|
|
|
|
if (dec && !err)
|
2016-05-09 18:51:53 +00:00
|
|
|
command_event(CMD_EVENT_REINIT, NULL);
|
2016-01-26 20:04:05 +00:00
|
|
|
|
|
|
|
if (err)
|
|
|
|
RARCH_ERR("%s", err);
|
|
|
|
|
|
|
|
if (dec)
|
|
|
|
{
|
|
|
|
/* delete bundle? */
|
|
|
|
free(dec->source_file);
|
|
|
|
free(dec);
|
|
|
|
}
|
|
|
|
|
2016-09-05 15:35:27 +00:00
|
|
|
settings->bundle_assets_extract_last_version =
|
2016-02-04 19:23:52 +00:00
|
|
|
settings->bundle_assets_extract_version_current;
|
2016-01-26 20:04:05 +00:00
|
|
|
settings->bundle_finished = true;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* menu_init:
|
|
|
|
* @data : Menu context handle.
|
|
|
|
*
|
|
|
|
* Create and initialize menu handle.
|
|
|
|
*
|
|
|
|
* Returns: menu handle on success, otherwise NULL.
|
|
|
|
**/
|
2016-02-10 20:01:55 +00:00
|
|
|
static bool menu_init(menu_handle_t *menu_data)
|
2016-01-26 20:04:05 +00:00
|
|
|
{
|
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
|
|
|
|
if (!menu_entries_ctl(MENU_ENTRIES_CTL_INIT, NULL))
|
2016-02-10 02:49:47 +00:00
|
|
|
return false;
|
2016-01-26 20:04:05 +00:00
|
|
|
|
|
|
|
if (settings->menu_show_start_screen)
|
|
|
|
{
|
2016-09-15 14:07:20 +00:00
|
|
|
menu_dialog_push_pending(true, MENU_DIALOG_WELCOME);
|
2016-02-10 02:52:02 +00:00
|
|
|
settings->menu_show_start_screen = false;
|
2016-10-13 12:54:18 +00:00
|
|
|
if (settings->config_save_on_exit)
|
|
|
|
command_event(CMD_EVENT_MENU_SAVE_CURRENT_CONFIG, NULL);
|
2016-01-26 20:04:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( settings->bundle_assets_extract_enable
|
2016-09-05 15:35:27 +00:00
|
|
|
&& !string_is_empty(settings->path.bundle_assets_src)
|
2016-04-28 17:52:25 +00:00
|
|
|
&& !string_is_empty(settings->path.bundle_assets_dst)
|
2016-01-26 20:04:05 +00:00
|
|
|
#ifdef IOS
|
2016-09-15 14:07:20 +00:00
|
|
|
&& menu_dialog_is_push_pending()
|
2016-01-26 20:04:05 +00:00
|
|
|
#else
|
2016-09-05 15:35:27 +00:00
|
|
|
&& (settings->bundle_assets_extract_version_current
|
2016-02-04 19:23:52 +00:00
|
|
|
!= settings->bundle_assets_extract_last_version)
|
2016-01-26 20:04:05 +00:00
|
|
|
#endif
|
|
|
|
)
|
|
|
|
{
|
2016-09-15 14:07:20 +00:00
|
|
|
menu_dialog_push_pending(true, MENU_DIALOG_HELP_EXTRACT);
|
2016-09-18 23:56:26 +00:00
|
|
|
#ifdef HAVE_COMPRESSION
|
2016-09-05 15:35:27 +00:00
|
|
|
task_push_decompress(settings->path.bundle_assets_src,
|
2016-04-28 17:52:25 +00:00
|
|
|
settings->path.bundle_assets_dst,
|
|
|
|
NULL, settings->path.bundle_assets_dst_subdir,
|
2016-02-04 19:23:52 +00:00
|
|
|
NULL, bundle_decompressed, NULL);
|
2016-01-26 20:04:05 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2017-01-11 02:36:35 +00:00
|
|
|
menu_shader_manager_init();
|
2016-01-26 20:04:05 +00:00
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
if (!menu_display_init())
|
2016-02-10 02:49:47 +00:00
|
|
|
return false;
|
2016-01-26 20:04:05 +00:00
|
|
|
|
2016-02-10 02:29:31 +00:00
|
|
|
return true;
|
2016-01-26 20:04:05 +00:00
|
|
|
}
|
|
|
|
|
2016-01-21 18:19:14 +00:00
|
|
|
static void menu_input_key_event(bool down, unsigned keycode,
|
|
|
|
uint32_t character, uint16_t mod)
|
|
|
|
{
|
|
|
|
(void)down;
|
|
|
|
(void)keycode;
|
|
|
|
(void)mod;
|
|
|
|
|
2016-10-28 04:59:18 +00:00
|
|
|
#if 0
|
2016-10-26 22:14:01 +00:00
|
|
|
RARCH_LOG("down: %d, keycode: %d, mod: %d, character: %d\n", down, keycode, mod, character);
|
2016-10-26 22:13:29 +00:00
|
|
|
#endif
|
|
|
|
|
2017-01-12 10:31:24 +00:00
|
|
|
menu_event_kb_set(down, (enum retro_key)keycode);
|
2016-01-21 18:19:14 +00:00
|
|
|
}
|
|
|
|
|
2016-10-28 03:43:07 +00:00
|
|
|
static void menu_driver_toggle(bool on)
|
2015-03-22 05:02:02 +00:00
|
|
|
{
|
2016-01-21 18:21:09 +00:00
|
|
|
retro_keyboard_event_t *key_event = NULL;
|
|
|
|
retro_keyboard_event_t *frontend_key_event = NULL;
|
2016-02-04 19:23:52 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
2016-09-05 15:35:27 +00:00
|
|
|
|
2016-10-28 03:43:07 +00:00
|
|
|
menu_driver_toggled = on;
|
2016-09-05 15:35:27 +00:00
|
|
|
|
2016-10-28 03:43:07 +00:00
|
|
|
if (!on)
|
2016-09-05 15:35:27 +00:00
|
|
|
menu_display_toggle_set_reason(MENU_TOGGLE_REASON_NONE);
|
|
|
|
|
2016-10-28 03:43:07 +00:00
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_TOGGLE, &on);
|
2015-03-22 05:02:02 +00:00
|
|
|
|
2016-10-28 03:43:07 +00:00
|
|
|
if (on)
|
2016-10-26 06:43:59 +00:00
|
|
|
menu_driver_alive = true;
|
2015-12-05 12:49:22 +00:00
|
|
|
else
|
2016-10-26 06:43:59 +00:00
|
|
|
menu_driver_alive = false;
|
2015-09-26 23:38:21 +00:00
|
|
|
|
2016-01-21 18:27:48 +00:00
|
|
|
runloop_ctl(RUNLOOP_CTL_FRONTEND_KEY_EVENT_GET, &frontend_key_event);
|
2016-02-10 19:58:45 +00:00
|
|
|
runloop_ctl(RUNLOOP_CTL_KEY_EVENT_GET, &key_event);
|
2016-01-21 18:27:48 +00:00
|
|
|
|
2015-12-05 12:49:22 +00:00
|
|
|
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
|
2015-09-26 23:43:13 +00:00
|
|
|
{
|
2015-12-12 01:14:50 +00:00
|
|
|
bool refresh = false;
|
|
|
|
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
2015-09-26 23:43:13 +00:00
|
|
|
|
|
|
|
/* Menu should always run with vsync on. */
|
2016-05-09 18:51:53 +00:00
|
|
|
command_event(CMD_EVENT_VIDEO_SET_BLOCKING_STATE, NULL);
|
2015-09-26 23:43:13 +00:00
|
|
|
/* Stop all rumbling before entering the menu. */
|
2016-05-09 18:51:53 +00:00
|
|
|
command_event(CMD_EVENT_RUMBLE_STOP, NULL);
|
2015-09-26 23:43:13 +00:00
|
|
|
|
|
|
|
if (settings->menu.pause_libretro)
|
2016-05-09 18:51:53 +00:00
|
|
|
command_event(CMD_EVENT_AUDIO_STOP, NULL);
|
2015-09-26 23:43:13 +00:00
|
|
|
|
|
|
|
/* Override keyboard callback to redirect to menu instead.
|
2016-01-21 00:52:02 +00:00
|
|
|
* We'll use this later for something ... */
|
2015-12-04 11:26:39 +00:00
|
|
|
|
2016-01-21 00:52:02 +00:00
|
|
|
if (key_event && frontend_key_event)
|
|
|
|
{
|
|
|
|
*frontend_key_event = *key_event;
|
|
|
|
*key_event = menu_input_key_event;
|
2015-12-13 13:31:06 +00:00
|
|
|
|
2016-01-21 00:52:02 +00:00
|
|
|
runloop_ctl(RUNLOOP_CTL_SET_FRAME_TIME_LAST, NULL);
|
2015-09-26 23:43:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-12-04 11:44:12 +00:00
|
|
|
if (!runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL))
|
2015-12-11 10:04:16 +00:00
|
|
|
driver_ctl(RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, NULL);
|
2015-09-26 23:43:13 +00:00
|
|
|
|
|
|
|
if (settings && settings->menu.pause_libretro)
|
2016-05-09 18:51:53 +00:00
|
|
|
command_event(CMD_EVENT_AUDIO_START, NULL);
|
2015-09-26 23:43:13 +00:00
|
|
|
|
|
|
|
/* Restore libretro keyboard callback. */
|
2016-01-21 00:52:02 +00:00
|
|
|
if (key_event && frontend_key_event)
|
|
|
|
*key_event = *frontend_key_event;
|
2015-09-26 23:43:13 +00:00
|
|
|
}
|
2016-06-27 23:02:04 +00:00
|
|
|
|
2016-06-27 23:02:27 +00:00
|
|
|
/* Prevent stray input */
|
2016-06-27 23:02:04 +00:00
|
|
|
input_driver_set_flushing_input();
|
2015-03-22 05:02:02 +00:00
|
|
|
}
|
2015-03-22 05:43:35 +00:00
|
|
|
|
2016-07-09 14:45:36 +00:00
|
|
|
const char *menu_driver_ident(void)
|
|
|
|
{
|
|
|
|
if (!menu_driver_alive)
|
|
|
|
return NULL;
|
|
|
|
if (!menu_driver_ctx || !menu_driver_ctx->ident)
|
|
|
|
return NULL;
|
|
|
|
return menu_driver_ctx->ident;
|
|
|
|
}
|
|
|
|
|
2017-01-18 20:23:18 +00:00
|
|
|
void menu_driver_frame(video_frame_info_t *video_info)
|
|
|
|
{
|
|
|
|
if (!menu_driver_alive)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (menu_driver_ctx->frame)
|
|
|
|
menu_driver_ctx->frame(menu_userdata, video_info);
|
|
|
|
}
|
|
|
|
|
2016-08-17 10:51:26 +00:00
|
|
|
/**
|
|
|
|
* menu_update_libretro_info:
|
|
|
|
*
|
|
|
|
* Update menu state which depends on config.
|
|
|
|
**/
|
|
|
|
static void menu_update_libretro_info(void)
|
|
|
|
{
|
|
|
|
struct retro_system_info *info = NULL;
|
2016-09-05 15:35:27 +00:00
|
|
|
|
2016-08-17 10:51:26 +00:00
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET,
|
|
|
|
&info);
|
2016-09-05 15:35:27 +00:00
|
|
|
|
2016-08-17 10:51:26 +00:00
|
|
|
if (!info)
|
|
|
|
return;
|
|
|
|
|
|
|
|
command_event(CMD_EVENT_CORE_INFO_INIT, NULL);
|
|
|
|
command_event(CMD_EVENT_LOAD_CORE_PERSIST, NULL);
|
|
|
|
}
|
|
|
|
|
2015-12-05 12:00:45 +00:00
|
|
|
bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
|
|
|
{
|
|
|
|
switch (state)
|
|
|
|
{
|
2016-02-10 20:15:23 +00:00
|
|
|
case RARCH_MENU_CTL_DRIVER_DATA_GET:
|
|
|
|
{
|
|
|
|
menu_handle_t **driver_data = (menu_handle_t**)data;
|
|
|
|
if (!driver_data)
|
|
|
|
return false;
|
|
|
|
*driver_data = menu_driver_data;
|
|
|
|
}
|
|
|
|
break;
|
2016-02-12 03:28:09 +00:00
|
|
|
case RARCH_MENU_CTL_IS_PENDING_QUICK_MENU:
|
|
|
|
return menu_driver_pending_quick_menu;
|
|
|
|
case RARCH_MENU_CTL_SET_PENDING_QUICK_MENU:
|
|
|
|
menu_driver_pending_quick_menu = true;
|
|
|
|
break;
|
2016-02-10 18:19:30 +00:00
|
|
|
case RARCH_MENU_CTL_IS_PENDING_QUIT:
|
|
|
|
return menu_driver_pending_quit;
|
|
|
|
case RARCH_MENU_CTL_SET_PENDING_QUIT:
|
|
|
|
menu_driver_pending_quit = true;
|
|
|
|
break;
|
2016-02-10 18:56:35 +00:00
|
|
|
case RARCH_MENU_CTL_IS_PENDING_SHUTDOWN:
|
|
|
|
return menu_driver_pending_shutdown;
|
|
|
|
case RARCH_MENU_CTL_SET_PENDING_SHUTDOWN:
|
|
|
|
menu_driver_pending_shutdown = true;
|
|
|
|
break;
|
2015-12-06 17:23:46 +00:00
|
|
|
case RARCH_MENU_CTL_DESTROY:
|
2016-02-12 03:28:09 +00:00
|
|
|
menu_driver_pending_quick_menu = false;
|
|
|
|
menu_driver_pending_quit = false;
|
|
|
|
menu_driver_pending_shutdown = false;
|
|
|
|
menu_driver_prevent_populate = false;
|
|
|
|
menu_driver_load_no_content = false;
|
|
|
|
menu_driver_alive = false;
|
|
|
|
menu_driver_data_own = false;
|
|
|
|
menu_driver_ctx = NULL;
|
|
|
|
menu_userdata = NULL;
|
2015-12-06 17:23:46 +00:00
|
|
|
break;
|
2015-12-11 12:01:39 +00:00
|
|
|
case RARCH_MENU_CTL_PLAYLIST_FREE:
|
2015-12-11 12:08:30 +00:00
|
|
|
if (menu_driver_playlist)
|
2016-05-16 07:07:44 +00:00
|
|
|
playlist_free(menu_driver_playlist);
|
2015-12-11 12:08:30 +00:00
|
|
|
menu_driver_playlist = NULL;
|
2015-12-11 12:01:39 +00:00
|
|
|
break;
|
2016-02-09 15:49:23 +00:00
|
|
|
case RARCH_MENU_CTL_FIND_DRIVER:
|
2016-02-10 19:58:45 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
driver_ctx_info_t drv;
|
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
|
|
|
|
drv.label = "menu_driver";
|
|
|
|
drv.s = settings->menu.driver;
|
|
|
|
|
|
|
|
driver_ctl(RARCH_DRIVER_CTL_FIND_INDEX, &drv);
|
|
|
|
|
|
|
|
i = drv.len;
|
|
|
|
|
|
|
|
if (i >= 0)
|
|
|
|
menu_driver_ctx = (const menu_ctx_driver_t*)
|
|
|
|
menu_driver_find_handle(i);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
unsigned d;
|
|
|
|
RARCH_WARN("Couldn't find any menu driver named \"%s\"\n",
|
|
|
|
settings->menu.driver);
|
|
|
|
RARCH_LOG_OUTPUT("Available menu drivers are:\n");
|
|
|
|
for (d = 0; menu_driver_find_handle(d); d++)
|
|
|
|
RARCH_LOG_OUTPUT("\t%s\n", menu_driver_find_ident(d));
|
|
|
|
RARCH_WARN("Going to default to first menu driver...\n");
|
|
|
|
|
|
|
|
menu_driver_ctx = (const menu_ctx_driver_t*)
|
|
|
|
menu_driver_find_handle(0);
|
|
|
|
|
|
|
|
if (!menu_driver_ctx)
|
|
|
|
{
|
2016-05-09 05:09:26 +00:00
|
|
|
retroarch_fail(1, "find_menu_driver()");
|
2016-02-10 19:58:45 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2015-12-11 12:06:24 +00:00
|
|
|
case RARCH_MENU_CTL_PLAYLIST_INIT:
|
|
|
|
{
|
|
|
|
const char *path = (const char*)data;
|
2015-12-26 08:14:13 +00:00
|
|
|
if (string_is_empty(path))
|
2015-12-11 12:06:24 +00:00
|
|
|
return false;
|
2016-05-16 07:07:44 +00:00
|
|
|
menu_driver_playlist = playlist_init(path,
|
2015-12-11 12:06:24 +00:00
|
|
|
COLLECTION_SIZE);
|
|
|
|
}
|
2016-02-10 02:49:47 +00:00
|
|
|
break;
|
2015-12-11 11:40:59 +00:00
|
|
|
case RARCH_MENU_CTL_PLAYLIST_GET:
|
|
|
|
{
|
2016-05-16 07:07:44 +00:00
|
|
|
playlist_t **playlist = (playlist_t**)data;
|
2015-12-11 12:08:30 +00:00
|
|
|
if (!playlist)
|
2015-12-11 11:40:59 +00:00
|
|
|
return false;
|
2015-12-11 12:08:30 +00:00
|
|
|
*playlist = menu_driver_playlist;
|
2015-12-11 11:40:59 +00:00
|
|
|
}
|
2016-02-10 02:49:47 +00:00
|
|
|
break;
|
2015-12-10 22:08:34 +00:00
|
|
|
case RARCH_MENU_CTL_SYSTEM_INFO_GET:
|
|
|
|
{
|
2016-09-05 15:35:27 +00:00
|
|
|
struct retro_system_info **system =
|
2016-02-04 19:23:52 +00:00
|
|
|
(struct retro_system_info**)data;
|
2015-12-10 22:08:34 +00:00
|
|
|
if (!system)
|
|
|
|
return false;
|
|
|
|
*system = &menu_driver_system;
|
|
|
|
}
|
2016-02-10 02:49:47 +00:00
|
|
|
break;
|
2015-12-10 22:08:34 +00:00
|
|
|
case RARCH_MENU_CTL_SYSTEM_INFO_DEINIT:
|
2016-06-24 18:10:11 +00:00
|
|
|
#ifndef HAVE_DYNAMIC
|
|
|
|
if (frontend_driver_has_fork())
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
libretro_free_system_info(&menu_driver_system);
|
|
|
|
memset(&menu_driver_system, 0, sizeof(struct retro_system_info));
|
|
|
|
}
|
2015-12-10 22:08:34 +00:00
|
|
|
break;
|
2015-12-11 14:28:16 +00:00
|
|
|
case RARCH_MENU_CTL_RENDER_MESSAGEBOX:
|
2016-02-10 02:49:47 +00:00
|
|
|
if (menu_driver_ctx->render_messagebox)
|
|
|
|
menu_driver_ctx->render_messagebox(menu_userdata,
|
2016-02-04 19:23:52 +00:00
|
|
|
menu_driver_data->menu_state.msg);
|
2015-12-11 14:28:16 +00:00
|
|
|
break;
|
|
|
|
case RARCH_MENU_CTL_BLIT_RENDER:
|
2016-02-10 02:49:47 +00:00
|
|
|
if (menu_driver_ctx->render)
|
|
|
|
menu_driver_ctx->render(menu_userdata);
|
2015-12-11 14:28:16 +00:00
|
|
|
break;
|
2015-12-10 18:43:25 +00:00
|
|
|
case RARCH_MENU_CTL_RENDER:
|
2016-02-10 19:29:17 +00:00
|
|
|
if (!menu_driver_data)
|
|
|
|
return false;
|
|
|
|
|
2016-09-05 15:35:27 +00:00
|
|
|
if (BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_FRAMEBUFFER)
|
2016-02-10 19:29:17 +00:00
|
|
|
!= BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_MESSAGEBOX))
|
|
|
|
BIT64_SET(menu_driver_data->state, MENU_STATE_RENDER_FRAMEBUFFER);
|
|
|
|
|
|
|
|
if (BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_FRAMEBUFFER))
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_set_framebuffer_dirty_flag();
|
2016-02-10 19:29:17 +00:00
|
|
|
|
2016-09-05 15:35:27 +00:00
|
|
|
if (BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_MESSAGEBOX)
|
2016-02-10 19:29:17 +00:00
|
|
|
&& !string_is_empty(menu_driver_data->menu_state.msg))
|
|
|
|
{
|
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_RENDER_MESSAGEBOX, NULL);
|
|
|
|
|
|
|
|
if (ui_companion_is_on_foreground())
|
|
|
|
{
|
|
|
|
const ui_companion_driver_t *ui = ui_companion_get_ptr();
|
|
|
|
if (ui->render_messagebox)
|
|
|
|
ui->render_messagebox(menu_driver_data->menu_state.msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (BIT64_GET(menu_driver_data->state, MENU_STATE_BLIT))
|
|
|
|
{
|
2017-01-17 15:55:34 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
menu_animation_update_time(settings->menu.timedate_enable);
|
2016-02-10 19:29:17 +00:00
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_BLIT_RENDER, NULL);
|
|
|
|
}
|
|
|
|
|
2016-09-05 15:35:27 +00:00
|
|
|
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)
|
2016-02-10 19:29:17 +00:00
|
|
|
&& !runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL))
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_libretro();
|
2016-02-10 19:29:17 +00:00
|
|
|
|
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_SET_TEXTURE, NULL);
|
|
|
|
|
|
|
|
menu_driver_data->state = 0;
|
2015-12-10 18:43:25 +00:00
|
|
|
break;
|
2015-12-07 15:55:13 +00:00
|
|
|
case RARCH_MENU_CTL_SET_PREVENT_POPULATE:
|
|
|
|
menu_driver_prevent_populate = true;
|
|
|
|
break;
|
|
|
|
case RARCH_MENU_CTL_UNSET_PREVENT_POPULATE:
|
|
|
|
menu_driver_prevent_populate = false;
|
|
|
|
break;
|
|
|
|
case RARCH_MENU_CTL_IS_PREVENT_POPULATE:
|
|
|
|
return menu_driver_prevent_populate;
|
2016-09-05 15:35:27 +00:00
|
|
|
case RARCH_MENU_CTL_IS_TOGGLE:
|
|
|
|
return menu_driver_toggled;
|
2015-12-06 16:41:00 +00:00
|
|
|
case RARCH_MENU_CTL_SET_TOGGLE:
|
|
|
|
menu_driver_toggle(true);
|
|
|
|
break;
|
|
|
|
case RARCH_MENU_CTL_UNSET_TOGGLE:
|
|
|
|
menu_driver_toggle(false);
|
|
|
|
break;
|
2015-12-05 12:49:22 +00:00
|
|
|
case RARCH_MENU_CTL_IS_ALIVE:
|
|
|
|
return menu_driver_alive;
|
2015-12-05 12:00:45 +00:00
|
|
|
case RARCH_MENU_CTL_SET_OWN_DRIVER:
|
|
|
|
menu_driver_data_own = true;
|
|
|
|
break;
|
|
|
|
case RARCH_MENU_CTL_UNSET_OWN_DRIVER:
|
|
|
|
menu_driver_data_own = false;
|
|
|
|
break;
|
2015-12-06 17:30:45 +00:00
|
|
|
case RARCH_MENU_CTL_SET_TEXTURE:
|
2016-02-10 02:49:47 +00:00
|
|
|
if (menu_driver_ctx->set_texture)
|
|
|
|
menu_driver_ctx->set_texture();
|
2015-12-06 17:30:45 +00:00
|
|
|
break;
|
2015-12-05 12:06:22 +00:00
|
|
|
case RARCH_MENU_CTL_IS_SET_TEXTURE:
|
2015-12-05 12:13:49 +00:00
|
|
|
if (!menu_driver_ctx)
|
2015-12-05 12:06:22 +00:00
|
|
|
return false;
|
2015-12-05 12:13:49 +00:00
|
|
|
return menu_driver_ctx->set_texture;
|
2015-12-05 12:00:45 +00:00
|
|
|
case RARCH_MENU_CTL_OWNS_DRIVER:
|
|
|
|
return menu_driver_data_own;
|
2015-12-05 12:04:21 +00:00
|
|
|
case RARCH_MENU_CTL_DEINIT:
|
2016-02-10 06:17:26 +00:00
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_CONTEXT_DESTROY, NULL);
|
|
|
|
if (menu_driver_ctl(RARCH_MENU_CTL_OWNS_DRIVER, NULL))
|
|
|
|
return true;
|
2016-05-23 15:49:22 +00:00
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_FREE, NULL);
|
2017-01-09 02:53:55 +00:00
|
|
|
menu_shader_manager_free();
|
|
|
|
|
2016-02-10 02:49:47 +00:00
|
|
|
if (menu_driver_data)
|
|
|
|
{
|
|
|
|
menu_input_ctl(MENU_INPUT_CTL_DEINIT, NULL);
|
|
|
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_DEINIT, NULL);
|
|
|
|
|
|
|
|
if (menu_driver_ctx && menu_driver_ctx->free)
|
|
|
|
menu_driver_ctx->free(menu_userdata);
|
|
|
|
|
|
|
|
if (menu_userdata)
|
|
|
|
free(menu_userdata);
|
|
|
|
menu_userdata = NULL;
|
|
|
|
|
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_DEINIT, NULL);
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_deinit();
|
2016-02-10 02:49:47 +00:00
|
|
|
menu_entries_ctl(MENU_ENTRIES_CTL_DEINIT, NULL);
|
|
|
|
|
2016-05-09 18:51:53 +00:00
|
|
|
command_event(CMD_EVENT_HISTORY_DEINIT, NULL);
|
2016-02-10 02:49:47 +00:00
|
|
|
|
2016-09-15 14:07:20 +00:00
|
|
|
menu_dialog_reset();
|
2016-02-10 02:49:47 +00:00
|
|
|
|
|
|
|
free(menu_driver_data);
|
|
|
|
}
|
2015-12-05 12:13:49 +00:00
|
|
|
menu_driver_data = NULL;
|
2015-12-05 12:04:21 +00:00
|
|
|
break;
|
2016-02-09 15:45:28 +00:00
|
|
|
case RARCH_MENU_CTL_INIT:
|
|
|
|
{
|
2016-07-09 14:42:31 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
2016-08-17 10:51:26 +00:00
|
|
|
menu_update_libretro_info();
|
2016-07-09 14:42:31 +00:00
|
|
|
if (menu_driver_data)
|
|
|
|
return true;
|
2016-02-09 15:45:28 +00:00
|
|
|
|
2016-07-09 14:42:31 +00:00
|
|
|
menu_driver_data = (menu_handle_t*)
|
|
|
|
menu_driver_ctx->init(&menu_userdata);
|
2016-02-10 02:59:17 +00:00
|
|
|
|
2016-07-09 14:42:31 +00:00
|
|
|
if (!menu_driver_data || !menu_init(menu_driver_data))
|
2016-02-09 15:45:28 +00:00
|
|
|
{
|
2016-05-09 05:09:26 +00:00
|
|
|
retroarch_fail(1, "init_menu()");
|
2016-02-09 15:45:28 +00:00
|
|
|
return false;
|
|
|
|
}
|
2016-07-09 14:42:31 +00:00
|
|
|
|
|
|
|
strlcpy(settings->menu.driver, menu_driver_ctx->ident,
|
|
|
|
sizeof(settings->menu.driver));
|
|
|
|
|
|
|
|
if (menu_driver_ctx->lists_init)
|
|
|
|
{
|
|
|
|
if (!menu_driver_ctx->lists_init(menu_driver_data))
|
|
|
|
{
|
|
|
|
retroarch_fail(1, "init_menu()");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2016-02-09 15:45:28 +00:00
|
|
|
}
|
2016-02-10 02:49:47 +00:00
|
|
|
break;
|
2015-12-07 15:11:53 +00:00
|
|
|
case RARCH_MENU_CTL_LOAD_NO_CONTENT_GET:
|
|
|
|
{
|
|
|
|
bool **ptr = (bool**)data;
|
|
|
|
if (!ptr)
|
|
|
|
return false;
|
|
|
|
*ptr = (bool*)&menu_driver_load_no_content;
|
|
|
|
}
|
2016-02-10 02:49:47 +00:00
|
|
|
break;
|
2015-12-07 15:00:48 +00:00
|
|
|
case RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT:
|
2015-12-07 15:11:53 +00:00
|
|
|
return menu_driver_load_no_content;
|
2015-12-07 14:54:06 +00:00
|
|
|
case RARCH_MENU_CTL_SET_LOAD_NO_CONTENT:
|
2015-12-07 15:11:53 +00:00
|
|
|
menu_driver_load_no_content = true;
|
2015-12-07 14:54:06 +00:00
|
|
|
break;
|
|
|
|
case RARCH_MENU_CTL_UNSET_LOAD_NO_CONTENT:
|
2015-12-07 15:11:53 +00:00
|
|
|
menu_driver_load_no_content = false;
|
2015-12-07 14:54:06 +00:00
|
|
|
break;
|
2015-12-11 13:26:51 +00:00
|
|
|
case RARCH_MENU_CTL_NAVIGATION_INCREMENT:
|
2016-02-10 02:49:47 +00:00
|
|
|
if (menu_driver_ctx->navigation_increment)
|
|
|
|
menu_driver_ctx->navigation_increment(menu_userdata);
|
2015-12-11 13:26:51 +00:00
|
|
|
break;
|
|
|
|
case RARCH_MENU_CTL_NAVIGATION_DECREMENT:
|
2016-02-10 02:49:47 +00:00
|
|
|
if (menu_driver_ctx->navigation_decrement)
|
|
|
|
menu_driver_ctx->navigation_decrement(menu_userdata);
|
2015-12-11 13:26:51 +00:00
|
|
|
break;
|
|
|
|
case RARCH_MENU_CTL_NAVIGATION_SET:
|
|
|
|
{
|
|
|
|
bool *scroll = (bool*)data;
|
|
|
|
|
|
|
|
if (!scroll)
|
|
|
|
return false;
|
2016-02-10 02:49:47 +00:00
|
|
|
if (menu_driver_ctx->navigation_set)
|
|
|
|
menu_driver_ctx->navigation_set(menu_userdata, *scroll);
|
2015-12-11 13:26:51 +00:00
|
|
|
}
|
2016-02-10 02:49:47 +00:00
|
|
|
break;
|
2015-12-11 13:26:51 +00:00
|
|
|
case RARCH_MENU_CTL_NAVIGATION_SET_LAST:
|
2016-02-10 02:49:47 +00:00
|
|
|
if (menu_driver_ctx->navigation_set_last)
|
|
|
|
menu_driver_ctx->navigation_set_last(menu_userdata);
|
2015-12-11 13:26:51 +00:00
|
|
|
break;
|
|
|
|
case RARCH_MENU_CTL_NAVIGATION_ASCEND_ALPHABET:
|
|
|
|
{
|
|
|
|
size_t *ptr_out = (size_t*)data;
|
|
|
|
|
|
|
|
if (!ptr_out)
|
|
|
|
return false;
|
|
|
|
|
2016-02-10 02:49:47 +00:00
|
|
|
if (menu_driver_ctx->navigation_ascend_alphabet)
|
2016-02-10 04:25:30 +00:00
|
|
|
menu_driver_ctx->navigation_ascend_alphabet(
|
|
|
|
menu_userdata, ptr_out);
|
2015-12-11 13:26:51 +00:00
|
|
|
}
|
2016-05-23 19:39:17 +00:00
|
|
|
break;
|
2016-02-10 19:29:17 +00:00
|
|
|
case RARCH_MENU_CTL_NAVIGATION_DESCEND_ALPHABET:
|
2015-12-11 13:26:51 +00:00
|
|
|
{
|
|
|
|
size_t *ptr_out = (size_t*)data;
|
|
|
|
|
|
|
|
if (!ptr_out)
|
|
|
|
return false;
|
|
|
|
|
2016-02-10 02:49:47 +00:00
|
|
|
if (menu_driver_ctx->navigation_descend_alphabet)
|
2016-02-10 04:25:30 +00:00
|
|
|
menu_driver_ctx->navigation_descend_alphabet(
|
|
|
|
menu_userdata, ptr_out);
|
2015-12-11 13:26:51 +00:00
|
|
|
}
|
|
|
|
break;
|
2016-02-10 19:29:17 +00:00
|
|
|
case RARCH_MENU_CTL_NAVIGATION_CLEAR:
|
2015-12-12 22:40:25 +00:00
|
|
|
{
|
|
|
|
bool *pending_push = (bool*)data;
|
|
|
|
|
|
|
|
if (!pending_push)
|
|
|
|
return false;
|
2016-02-10 02:49:47 +00:00
|
|
|
if (menu_driver_ctx->navigation_clear)
|
2016-02-10 04:25:30 +00:00
|
|
|
menu_driver_ctx->navigation_clear(
|
|
|
|
menu_userdata, pending_push);
|
2015-12-12 22:40:25 +00:00
|
|
|
}
|
|
|
|
break;
|
2016-02-10 19:29:17 +00:00
|
|
|
case RARCH_MENU_CTL_POPULATE_ENTRIES:
|
2015-12-11 13:34:47 +00:00
|
|
|
{
|
|
|
|
menu_displaylist_info_t *info = (menu_displaylist_info_t*)data;
|
|
|
|
|
|
|
|
if (!info)
|
|
|
|
return false;
|
2016-02-10 02:49:47 +00:00
|
|
|
if (menu_driver_ctx->populate_entries)
|
|
|
|
menu_driver_ctx->populate_entries(
|
2016-02-10 04:25:30 +00:00
|
|
|
menu_userdata, info->path,
|
|
|
|
info->label, info->type);
|
2015-12-11 13:34:47 +00:00
|
|
|
}
|
2016-02-10 02:49:47 +00:00
|
|
|
break;
|
2016-02-11 00:12:19 +00:00
|
|
|
case RARCH_MENU_CTL_LIST_GET_ENTRY:
|
|
|
|
{
|
|
|
|
menu_ctx_list_t *list = (menu_ctx_list_t*)data;
|
|
|
|
|
|
|
|
if (!menu_driver_ctx || !menu_driver_ctx->list_get_entry)
|
|
|
|
{
|
|
|
|
list->entry = NULL;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
list->entry = menu_driver_ctx->list_get_entry(menu_userdata,
|
|
|
|
list->type, list->idx);
|
|
|
|
}
|
|
|
|
break;
|
2016-02-11 00:07:30 +00:00
|
|
|
case RARCH_MENU_CTL_LIST_GET_SIZE:
|
|
|
|
{
|
|
|
|
menu_ctx_list_t *list = (menu_ctx_list_t*)data;
|
|
|
|
if (!menu_driver_ctx || !menu_driver_ctx->list_get_size)
|
|
|
|
{
|
|
|
|
list->size = 0;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
list->size = menu_driver_ctx->list_get_size(menu_userdata, list->type);
|
|
|
|
}
|
|
|
|
break;
|
2016-02-10 23:59:55 +00:00
|
|
|
case RARCH_MENU_CTL_LIST_GET_SELECTION:
|
|
|
|
{
|
|
|
|
menu_ctx_list_t *list = (menu_ctx_list_t*)data;
|
|
|
|
|
|
|
|
if (!menu_driver_ctx || !menu_driver_ctx->list_get_selection)
|
|
|
|
{
|
|
|
|
list->selection = 0;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
list->selection = menu_driver_ctx->list_get_selection(menu_userdata);
|
|
|
|
}
|
|
|
|
break;
|
2016-02-10 20:21:19 +00:00
|
|
|
case RARCH_MENU_CTL_LIST_FREE:
|
|
|
|
{
|
|
|
|
menu_ctx_list_t *list = (menu_ctx_list_t*)data;
|
|
|
|
|
|
|
|
if (menu_driver_ctx)
|
|
|
|
{
|
|
|
|
if (menu_driver_ctx->list_free)
|
|
|
|
menu_driver_ctx->list_free(list->list, list->idx, list->list_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (list->list)
|
|
|
|
{
|
|
|
|
file_list_free_userdata (list->list, list->idx);
|
|
|
|
file_list_free_actiondata(list->list, list->idx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2016-02-10 19:36:13 +00:00
|
|
|
case RARCH_MENU_CTL_LIST_PUSH:
|
|
|
|
{
|
|
|
|
menu_ctx_displaylist_t *disp_list = (menu_ctx_displaylist_t*)data;
|
|
|
|
|
|
|
|
if (menu_driver_ctx->list_push)
|
|
|
|
if (menu_driver_ctx->list_push(menu_driver_data,
|
|
|
|
menu_userdata, disp_list->info, disp_list->type) == 0)
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2016-02-10 19:29:17 +00:00
|
|
|
case RARCH_MENU_CTL_LIST_CLEAR:
|
2015-12-11 14:28:16 +00:00
|
|
|
{
|
|
|
|
file_list_t *list = (file_list_t*)data;
|
|
|
|
if (!list)
|
|
|
|
return false;
|
2016-02-10 02:49:47 +00:00
|
|
|
if (menu_driver_ctx->list_clear)
|
|
|
|
menu_driver_ctx->list_clear(list);
|
2015-12-11 14:28:16 +00:00
|
|
|
}
|
2016-02-10 02:49:47 +00:00
|
|
|
break;
|
2016-02-10 19:29:17 +00:00
|
|
|
case RARCH_MENU_CTL_TOGGLE:
|
2015-12-11 14:39:19 +00:00
|
|
|
{
|
2016-10-28 03:43:07 +00:00
|
|
|
bool *on = (bool*)data;
|
|
|
|
if (!on)
|
2015-12-11 14:39:19 +00:00
|
|
|
return false;
|
|
|
|
|
2016-05-10 21:33:51 +00:00
|
|
|
if (menu_driver_ctx && menu_driver_ctx->toggle)
|
2016-10-28 03:43:07 +00:00
|
|
|
menu_driver_ctx->toggle(menu_userdata, *on);
|
2015-12-11 14:39:19 +00:00
|
|
|
}
|
|
|
|
break;
|
2016-02-10 19:29:17 +00:00
|
|
|
case RARCH_MENU_CTL_REFRESH:
|
2015-12-12 16:25:03 +00:00
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
bool refresh = false;
|
|
|
|
menu_entries_ctl(MENU_ENTRIES_CTL_LIST_DEINIT, NULL);
|
|
|
|
menu_entries_ctl(MENU_ENTRIES_CTL_SETTINGS_DEINIT, NULL);
|
|
|
|
menu_entries_ctl(MENU_ENTRIES_CTL_INIT, NULL);
|
|
|
|
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
break;
|
2016-02-10 19:29:17 +00:00
|
|
|
case RARCH_MENU_CTL_CONTEXT_RESET:
|
2016-02-10 16:41:10 +00:00
|
|
|
if (!menu_driver_ctx || !menu_driver_ctx->context_reset)
|
|
|
|
return false;
|
|
|
|
menu_driver_ctx->context_reset(menu_userdata);
|
2015-12-12 22:34:49 +00:00
|
|
|
break;
|
2016-02-10 19:29:17 +00:00
|
|
|
case RARCH_MENU_CTL_CONTEXT_DESTROY:
|
2016-02-10 16:41:10 +00:00
|
|
|
if (!menu_driver_ctx || !menu_driver_ctx->context_destroy)
|
|
|
|
return false;
|
|
|
|
menu_driver_ctx->context_destroy(menu_userdata);
|
2015-12-12 22:36:43 +00:00
|
|
|
break;
|
2016-02-10 19:29:17 +00:00
|
|
|
case RARCH_MENU_CTL_LIST_SET_SELECTION:
|
2016-02-10 02:53:20 +00:00
|
|
|
{
|
2016-02-10 04:25:30 +00:00
|
|
|
file_list_t *list = (file_list_t*)data;
|
2016-02-10 02:53:20 +00:00
|
|
|
|
|
|
|
if (!list)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (!menu_driver_ctx || !menu_driver_ctx->list_set_selection)
|
|
|
|
return false;
|
|
|
|
|
2016-02-10 04:21:44 +00:00
|
|
|
menu_driver_ctx->list_set_selection(menu_userdata, list);
|
2016-02-10 02:53:20 +00:00
|
|
|
}
|
|
|
|
break;
|
2016-02-10 19:29:17 +00:00
|
|
|
case RARCH_MENU_CTL_LIST_CACHE:
|
2016-02-10 05:43:56 +00:00
|
|
|
{
|
|
|
|
menu_ctx_list_t *list = (menu_ctx_list_t*)data;
|
|
|
|
if (!list || !menu_driver_ctx || !menu_driver_ctx->list_cache)
|
|
|
|
return false;
|
2016-02-10 19:40:39 +00:00
|
|
|
menu_driver_ctx->list_cache(menu_userdata,
|
|
|
|
list->type, list->action);
|
2016-02-10 05:43:56 +00:00
|
|
|
}
|
|
|
|
break;
|
2016-02-10 19:29:17 +00:00
|
|
|
case RARCH_MENU_CTL_LIST_INSERT:
|
2016-02-10 05:38:57 +00:00
|
|
|
{
|
|
|
|
menu_ctx_list_t *list = (menu_ctx_list_t*)data;
|
|
|
|
if (!list || !menu_driver_ctx || !menu_driver_ctx->list_insert)
|
|
|
|
return false;
|
2016-02-10 19:40:39 +00:00
|
|
|
menu_driver_ctx->list_insert(menu_userdata,
|
2017-01-07 17:32:40 +00:00
|
|
|
list->list, list->path, list->fullpath,
|
|
|
|
list->label, list->idx);
|
2016-02-10 05:38:57 +00:00
|
|
|
}
|
|
|
|
break;
|
2016-02-10 19:29:17 +00:00
|
|
|
case RARCH_MENU_CTL_LOAD_IMAGE:
|
2016-02-10 05:01:11 +00:00
|
|
|
{
|
2016-09-05 15:35:27 +00:00
|
|
|
menu_ctx_load_image_t *load_image_info =
|
2016-02-10 19:40:39 +00:00
|
|
|
(menu_ctx_load_image_t*)data;
|
2016-02-10 05:01:11 +00:00
|
|
|
if (!menu_driver_ctx || !menu_driver_ctx->load_image)
|
|
|
|
return false;
|
|
|
|
return menu_driver_ctx->load_image(menu_userdata,
|
|
|
|
load_image_info->data, load_image_info->type);
|
|
|
|
}
|
2016-02-10 19:29:17 +00:00
|
|
|
case RARCH_MENU_CTL_ITERATE:
|
2016-02-10 19:13:12 +00:00
|
|
|
{
|
|
|
|
menu_ctx_iterate_t *iterate = (menu_ctx_iterate_t*)data;
|
|
|
|
|
2016-02-12 03:28:09 +00:00
|
|
|
if (menu_driver_ctl(RARCH_MENU_CTL_IS_PENDING_QUICK_MENU, NULL))
|
|
|
|
{
|
2016-10-26 06:43:59 +00:00
|
|
|
menu_driver_pending_quick_menu = false;
|
2016-02-12 03:28:09 +00:00
|
|
|
menu_entries_flush_stack(NULL, MENU_SETTINGS);
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_set_msg_force(true);
|
2016-02-12 03:28:09 +00:00
|
|
|
|
2016-07-09 16:06:50 +00:00
|
|
|
generic_action_ok_displaylist_push("", NULL,
|
2016-02-12 03:28:09 +00:00
|
|
|
"", 0, 0, 0, ACTION_OK_DL_CONTENT_SETTINGS);
|
2016-02-12 03:55:18 +00:00
|
|
|
|
|
|
|
if (menu_driver_ctl(RARCH_MENU_CTL_IS_PENDING_QUIT, NULL))
|
|
|
|
{
|
2016-10-26 06:43:59 +00:00
|
|
|
menu_driver_pending_quit = false;
|
2016-02-12 03:55:18 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-02-12 03:28:09 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-02-10 19:13:12 +00:00
|
|
|
if (menu_driver_ctl(RARCH_MENU_CTL_IS_PENDING_QUIT, NULL))
|
|
|
|
{
|
2016-10-26 06:43:59 +00:00
|
|
|
menu_driver_pending_quit = false;
|
2016-02-10 19:13:12 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (menu_driver_ctl(RARCH_MENU_CTL_IS_PENDING_SHUTDOWN, NULL))
|
|
|
|
{
|
2016-10-26 06:43:59 +00:00
|
|
|
menu_driver_pending_shutdown = false;
|
2016-05-09 18:51:53 +00:00
|
|
|
if (!command_event(CMD_EVENT_QUIT, NULL))
|
2016-02-10 19:13:12 +00:00
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!menu_driver_ctx || !menu_driver_ctx->iterate)
|
|
|
|
return false;
|
2016-09-05 15:35:27 +00:00
|
|
|
|
2016-02-10 19:40:39 +00:00
|
|
|
if (menu_driver_ctx->iterate(menu_driver_data,
|
|
|
|
menu_userdata, iterate->action) == -1)
|
2016-02-10 19:13:12 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
break;
|
2016-02-10 19:29:17 +00:00
|
|
|
case RARCH_MENU_CTL_ENVIRONMENT:
|
2016-02-10 19:19:21 +00:00
|
|
|
{
|
2016-09-05 15:35:27 +00:00
|
|
|
menu_ctx_environment_t *menu_environ =
|
2016-02-10 19:40:39 +00:00
|
|
|
(menu_ctx_environment_t*)data;
|
|
|
|
|
2016-02-10 19:19:21 +00:00
|
|
|
if (menu_driver_ctx->environ_cb)
|
|
|
|
{
|
2016-02-10 19:40:39 +00:00
|
|
|
if (menu_driver_ctx->environ_cb(menu_environ->type,
|
|
|
|
menu_environ->data, menu_userdata) == 0)
|
2016-02-10 19:19:21 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
2016-02-10 23:47:00 +00:00
|
|
|
case RARCH_MENU_CTL_POINTER_TAP:
|
|
|
|
{
|
|
|
|
menu_ctx_pointer_t *point = (menu_ctx_pointer_t*)data;
|
|
|
|
if (!menu_driver_ctx || !menu_driver_ctx->pointer_tap)
|
|
|
|
{
|
|
|
|
point->retcode = 0;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
point->retcode = menu_driver_ctx->pointer_tap(menu_userdata,
|
|
|
|
point->x, point->y, point->ptr,
|
|
|
|
point->cbs, point->entry, point->action);
|
|
|
|
}
|
|
|
|
break;
|
2016-10-30 10:48:35 +00:00
|
|
|
case RARCH_MENU_CTL_OSK_PTR_AT_POS:
|
|
|
|
{
|
2017-01-19 00:33:47 +00:00
|
|
|
unsigned width = 0;
|
|
|
|
unsigned height = 0;
|
2016-10-30 10:48:35 +00:00
|
|
|
menu_ctx_pointer_t *point = (menu_ctx_pointer_t*)data;
|
2016-10-30 19:41:32 +00:00
|
|
|
if (!menu_driver_ctx || !menu_driver_ctx->osk_ptr_at_pos)
|
2016-10-30 10:48:35 +00:00
|
|
|
{
|
|
|
|
point->retcode = 0;
|
|
|
|
return false;
|
|
|
|
}
|
2017-01-19 00:33:47 +00:00
|
|
|
video_driver_get_size(&width, &height);
|
2016-10-30 10:48:35 +00:00
|
|
|
point->retcode = menu_driver_ctx->osk_ptr_at_pos(menu_userdata,
|
2017-01-19 00:33:47 +00:00
|
|
|
point->x, point->y, width, height);
|
2016-10-30 10:48:35 +00:00
|
|
|
}
|
|
|
|
break;
|
2016-02-10 23:53:49 +00:00
|
|
|
case RARCH_MENU_CTL_BIND_INIT:
|
|
|
|
{
|
|
|
|
menu_ctx_bind_t *bind = (menu_ctx_bind_t*)data;
|
|
|
|
|
|
|
|
if (!menu_driver_ctx || !menu_driver_ctx->bind_init)
|
|
|
|
{
|
|
|
|
bind->retcode = 0;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bind->retcode = menu_driver_ctx->bind_init(
|
|
|
|
bind->cbs,
|
|
|
|
bind->path,
|
|
|
|
bind->label,
|
|
|
|
bind->type,
|
2016-07-01 18:59:51 +00:00
|
|
|
bind->idx);
|
2016-02-10 23:53:49 +00:00
|
|
|
}
|
|
|
|
break;
|
2016-04-27 20:26:09 +00:00
|
|
|
case RARCH_MENU_CTL_UPDATE_THUMBNAIL_PATH:
|
|
|
|
{
|
|
|
|
size_t selection;
|
|
|
|
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (!menu_driver_ctx || !menu_driver_ctx->update_thumbnail_path)
|
|
|
|
return false;
|
|
|
|
menu_driver_ctx->update_thumbnail_path(menu_userdata, selection);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RARCH_MENU_CTL_UPDATE_THUMBNAIL_IMAGE:
|
|
|
|
{
|
|
|
|
if (!menu_driver_ctx || !menu_driver_ctx->update_thumbnail_image)
|
|
|
|
return false;
|
|
|
|
menu_driver_ctx->update_thumbnail_image(menu_userdata);
|
|
|
|
}
|
|
|
|
break;
|
2016-12-01 01:43:53 +00:00
|
|
|
case RARCH_MENU_CTL_UPDATE_SAVESTATE_THUMBNAIL_PATH:
|
|
|
|
{
|
|
|
|
size_t selection;
|
|
|
|
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (!menu_driver_ctx || !menu_driver_ctx->update_savestate_thumbnail_path)
|
|
|
|
return false;
|
|
|
|
menu_driver_ctx->update_savestate_thumbnail_path(menu_userdata, selection);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RARCH_MENU_CTL_UPDATE_SAVESTATE_THUMBNAIL_IMAGE:
|
|
|
|
{
|
|
|
|
if (!menu_driver_ctx || !menu_driver_ctx->update_savestate_thumbnail_image)
|
|
|
|
return false;
|
|
|
|
menu_driver_ctx->update_savestate_thumbnail_image(menu_userdata);
|
|
|
|
}
|
|
|
|
break;
|
2015-12-05 12:00:45 +00:00
|
|
|
default:
|
2015-12-05 12:01:15 +00:00
|
|
|
case RARCH_MENU_CTL_NONE:
|
2015-12-05 12:00:45 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-02-10 02:49:47 +00:00
|
|
|
return true;
|
2015-12-05 12:00:45 +00:00
|
|
|
}
|