2015-01-12 19:00:43 +00:00
|
|
|
/* 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 <string.h>
|
2015-06-05 16:22:15 +00:00
|
|
|
|
2015-12-06 16:55:27 +00:00
|
|
|
#include <file/file_path.h>
|
|
|
|
|
|
|
|
#include "menu_driver.h"
|
|
|
|
#include "menu_cbs.h"
|
2015-10-18 05:15:54 +00:00
|
|
|
#include "menu_display.h"
|
2015-12-09 08:53:43 +00:00
|
|
|
#include "menu_navigation.h"
|
2015-12-06 16:55:27 +00:00
|
|
|
#include "menu_hash.h"
|
|
|
|
#include "menu_shader.h"
|
|
|
|
|
2015-12-06 18:31:47 +00:00
|
|
|
#include "../system.h"
|
2015-12-09 08:53:43 +00:00
|
|
|
#include "../defaults.h"
|
2015-12-06 16:55:27 +00:00
|
|
|
#include "../frontend/frontend.h"
|
2015-10-26 07:39:35 +00:00
|
|
|
#include "../string_list_special.h"
|
2015-12-06 16:55:27 +00:00
|
|
|
#include "../tasks/tasks.h"
|
2015-01-12 19:00:43 +00:00
|
|
|
|
|
|
|
static const menu_ctx_driver_t *menu_ctx_drivers[] = {
|
|
|
|
#if defined(HAVE_RMENU)
|
|
|
|
&menu_ctx_rmenu,
|
|
|
|
#endif
|
|
|
|
#if defined(HAVE_RMENU_XUI)
|
|
|
|
&menu_ctx_rmenu_xui,
|
|
|
|
#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
|
|
|
|
#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
|
|
|
|
};
|
|
|
|
|
2015-12-05 12:13:49 +00:00
|
|
|
static menu_handle_t *menu_driver_data;
|
|
|
|
static const menu_ctx_driver_t *menu_driver_ctx;
|
2015-12-10 19:12:08 +00:00
|
|
|
static struct video_shader *menu_driver_shader;
|
2015-12-11 14:14:39 +00:00
|
|
|
static void *menu_userdata;
|
2015-12-05 12:13:49 +00:00
|
|
|
|
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
|
|
|
*
|
|
|
|
* Returns: Human-readable identifier of menu driver at index. Can be NULL
|
|
|
|
* if nothing found.
|
|
|
|
**/
|
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
|
|
|
}
|
|
|
|
|
|
|
|
void find_menu_driver(void)
|
|
|
|
{
|
2015-03-20 19:43:22 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
2015-03-18 18:40:00 +00:00
|
|
|
|
2015-08-17 03:13:45 +00:00
|
|
|
int i = find_driver_index("menu_driver", settings->menu.driver);
|
2015-01-12 19:00:43 +00:00
|
|
|
if (i >= 0)
|
2015-12-05 12:13:49 +00:00
|
|
|
menu_driver_ctx = (const menu_ctx_driver_t*)menu_driver_find_handle(i);
|
2015-01-12 19:00:43 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
unsigned d;
|
|
|
|
RARCH_WARN("Couldn't find any menu driver named \"%s\"\n",
|
2015-03-20 19:43:22 +00:00
|
|
|
settings->menu.driver);
|
2015-01-12 19:00:43 +00:00
|
|
|
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");
|
|
|
|
|
2015-12-05 12:13:49 +00:00
|
|
|
menu_driver_ctx = (const menu_ctx_driver_t*)menu_driver_find_handle(0);
|
2015-01-12 19:00:43 +00:00
|
|
|
|
2015-12-05 12:13:49 +00:00
|
|
|
if (!menu_driver_ctx)
|
2015-10-26 02:18:13 +00:00
|
|
|
retro_fail(1, "find_menu_driver()");
|
2015-01-12 19:00:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-03 01:15:47 +00:00
|
|
|
menu_handle_t *menu_driver_get_ptr(void)
|
|
|
|
{
|
2015-12-05 12:13:49 +00:00
|
|
|
if (!menu_driver_data)
|
2015-10-03 01:15:47 +00:00
|
|
|
return NULL;
|
2015-12-05 12:13:49 +00:00
|
|
|
return menu_driver_data;
|
2015-10-03 01:15:47 +00:00
|
|
|
}
|
|
|
|
|
2015-01-12 19:00:43 +00:00
|
|
|
void init_menu(void)
|
|
|
|
{
|
2015-12-05 12:13:49 +00:00
|
|
|
if (menu_driver_data)
|
2015-01-12 19:00:43 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
find_menu_driver();
|
2015-07-04 20:59:40 +00:00
|
|
|
|
2015-12-05 12:13:49 +00:00
|
|
|
if (!(menu_driver_data = (menu_handle_t*)menu_init(menu_driver_ctx)))
|
2015-10-26 02:18:13 +00:00
|
|
|
retro_fail(1, "init_menu()");
|
2015-01-12 19:00:43 +00:00
|
|
|
|
2015-12-05 12:13:49 +00:00
|
|
|
if (menu_driver_ctx->lists_init)
|
|
|
|
if (!menu_driver_ctx->lists_init(menu_driver_data))
|
2015-10-26 02:18:13 +00:00
|
|
|
retro_fail(1, "init_menu()");
|
2015-02-13 18:00:34 +00:00
|
|
|
}
|
2015-03-22 04:21:14 +00:00
|
|
|
|
2015-12-10 18:08:28 +00:00
|
|
|
void menu_driver_list_insert(file_list_t *list, const char *path,
|
|
|
|
const char *label, size_t idx)
|
|
|
|
{
|
2015-12-11 14:28:16 +00:00
|
|
|
const menu_ctx_driver_t *driver = menu_driver_ctx;
|
2015-12-10 18:08:28 +00:00
|
|
|
|
|
|
|
if (driver->list_insert)
|
2015-12-11 14:14:39 +00:00
|
|
|
driver->list_insert(menu_userdata ? menu_userdata : NULL, list, path, label, idx);
|
2015-12-10 18:08:28 +00:00
|
|
|
}
|
2015-03-22 04:21:14 +00:00
|
|
|
|
2015-06-12 12:15:48 +00:00
|
|
|
void menu_driver_list_free(file_list_t *list, size_t idx, size_t list_size)
|
2015-05-19 21:28:32 +00:00
|
|
|
{
|
2015-12-11 14:28:16 +00:00
|
|
|
const menu_ctx_driver_t *driver = menu_driver_ctx;
|
2015-06-02 10:31:49 +00:00
|
|
|
|
2015-06-12 12:15:48 +00:00
|
|
|
if (driver->list_free)
|
|
|
|
driver->list_free(list, idx, list_size);
|
2015-05-19 21:28:32 +00:00
|
|
|
|
2015-06-12 12:17:27 +00:00
|
|
|
file_list_free_userdata (list, idx);
|
2015-06-12 02:09:35 +00:00
|
|
|
file_list_free_actiondata(list, idx);
|
2015-05-19 21:28:32 +00:00
|
|
|
}
|
|
|
|
|
2015-04-11 03:28:40 +00:00
|
|
|
void menu_driver_context_destroy(void)
|
|
|
|
{
|
2015-12-11 14:28:16 +00:00
|
|
|
const menu_ctx_driver_t *driver = menu_driver_ctx;
|
2015-04-11 03:28:40 +00:00
|
|
|
|
2015-07-25 13:48:22 +00:00
|
|
|
if (driver && driver->context_destroy)
|
2015-12-11 14:14:39 +00:00
|
|
|
driver->context_destroy(menu_userdata ? menu_userdata : NULL);
|
2015-04-11 03:28:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void menu_driver_list_set_selection(file_list_t *list)
|
|
|
|
{
|
2015-12-11 14:28:16 +00:00
|
|
|
const menu_ctx_driver_t *driver = menu_driver_ctx;
|
2015-04-11 03:28:40 +00:00
|
|
|
|
2015-07-25 13:48:22 +00:00
|
|
|
if (driver && driver->list_set_selection)
|
2015-12-11 14:14:39 +00:00
|
|
|
driver->list_set_selection(menu_userdata ? menu_userdata : NULL, list);
|
2015-04-11 03:28:40 +00:00
|
|
|
}
|
|
|
|
|
2015-06-15 17:00:52 +00:00
|
|
|
size_t menu_driver_list_get_selection(void)
|
|
|
|
{
|
2015-12-11 14:28:16 +00:00
|
|
|
const menu_ctx_driver_t *driver = menu_driver_ctx;
|
2015-06-15 17:00:52 +00:00
|
|
|
|
2015-07-25 13:48:22 +00:00
|
|
|
if (driver && driver->list_get_selection)
|
2015-12-11 14:14:39 +00:00
|
|
|
return driver->list_get_selection(menu_userdata ? menu_userdata : NULL);
|
2015-06-15 17:00:52 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-10-22 02:12:32 +00:00
|
|
|
bool menu_driver_list_push(menu_displaylist_info_t *info, unsigned type)
|
|
|
|
{
|
2015-12-11 14:28:16 +00:00
|
|
|
const menu_ctx_driver_t *driver = menu_driver_ctx;
|
2015-10-22 02:12:32 +00:00
|
|
|
|
|
|
|
if (driver->list_push)
|
2015-12-11 14:14:39 +00:00
|
|
|
if (driver->list_push(menu_driver_data, menu_userdata ? menu_userdata : NULL,
|
2015-12-10 18:02:01 +00:00
|
|
|
info, type) == 0)
|
2015-10-22 02:12:32 +00:00
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-06-07 09:20:36 +00:00
|
|
|
void menu_driver_list_cache(menu_list_type_t type, unsigned action)
|
2015-04-11 03:28:40 +00:00
|
|
|
{
|
2015-12-11 14:28:16 +00:00
|
|
|
const menu_ctx_driver_t *driver = menu_driver_ctx;
|
2015-04-11 03:28:40 +00:00
|
|
|
|
|
|
|
if (driver->list_cache)
|
2015-12-11 14:14:39 +00:00
|
|
|
driver->list_cache(menu_userdata ? menu_userdata : NULL, type, action);
|
2015-04-11 03:28:40 +00:00
|
|
|
}
|
|
|
|
|
2015-06-07 13:43:03 +00:00
|
|
|
size_t menu_driver_list_get_size(menu_list_type_t type)
|
|
|
|
{
|
2015-12-11 14:28:16 +00:00
|
|
|
const menu_ctx_driver_t *driver = menu_driver_ctx;
|
2015-06-07 13:43:03 +00:00
|
|
|
|
2015-06-07 13:49:58 +00:00
|
|
|
if (driver && driver->list_get_size)
|
2015-12-11 14:14:39 +00:00
|
|
|
return driver->list_get_size(menu_userdata ? menu_userdata : NULL, type);
|
2015-06-07 13:43:03 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-06-08 15:02:14 +00:00
|
|
|
void *menu_driver_list_get_entry(menu_list_type_t type, unsigned i)
|
|
|
|
{
|
2015-12-11 14:28:16 +00:00
|
|
|
const menu_ctx_driver_t *driver = menu_driver_ctx;
|
2015-06-08 15:02:14 +00:00
|
|
|
|
|
|
|
if (driver && driver->list_get_entry)
|
2015-12-11 14:14:39 +00:00
|
|
|
return driver->list_get_entry(menu_userdata ? menu_userdata : NULL, type, i);
|
2015-06-08 15:02:14 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2015-03-22 04:21:14 +00:00
|
|
|
void menu_driver_context_reset(void)
|
|
|
|
{
|
2015-12-11 14:28:16 +00:00
|
|
|
const menu_ctx_driver_t *driver = menu_driver_ctx;
|
2015-03-22 04:21:14 +00:00
|
|
|
|
2015-04-11 03:15:38 +00:00
|
|
|
if (driver->context_reset)
|
2015-12-11 14:14:39 +00:00
|
|
|
driver->context_reset(menu_userdata ? menu_userdata : NULL);
|
2015-03-22 04:21:14 +00:00
|
|
|
}
|
2015-03-22 04:27:19 +00:00
|
|
|
|
2015-03-22 04:32:43 +00:00
|
|
|
|
2015-06-08 14:06:51 +00:00
|
|
|
int menu_driver_bind_init(menu_file_list_cbs_t *cbs,
|
|
|
|
const char *path, const char *label, unsigned type, size_t idx,
|
|
|
|
const char *elem0, const char *elem1,
|
|
|
|
uint32_t label_hash, uint32_t menu_label_hash)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
2015-12-11 14:28:16 +00:00
|
|
|
const menu_ctx_driver_t *driver = menu_driver_ctx;
|
2015-06-08 14:06:51 +00:00
|
|
|
|
|
|
|
if (driver && driver->bind_init)
|
|
|
|
ret = driver->bind_init(cbs, path, label, type, idx, elem0, elem1,
|
|
|
|
label_hash, menu_label_hash);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-03-22 04:32:43 +00:00
|
|
|
void menu_driver_free(menu_handle_t *menu)
|
|
|
|
{
|
2015-12-11 14:28:16 +00:00
|
|
|
const menu_ctx_driver_t *driver = menu_driver_ctx;
|
2015-03-22 04:32:43 +00:00
|
|
|
|
2015-04-11 03:15:38 +00:00
|
|
|
if (driver->free)
|
2015-12-11 14:40:13 +00:00
|
|
|
driver->free(menu_userdata);
|
2015-12-11 13:38:57 +00:00
|
|
|
|
|
|
|
if (!menu_driver_data)
|
|
|
|
return;
|
|
|
|
|
2015-12-11 14:14:39 +00:00
|
|
|
if (menu_userdata)
|
|
|
|
free(menu_userdata);
|
|
|
|
menu_userdata = NULL;
|
2015-03-22 04:32:43 +00:00
|
|
|
}
|
2015-03-22 04:35:46 +00:00
|
|
|
|
2015-10-11 10:58:21 +00:00
|
|
|
int menu_driver_iterate(enum menu_action action)
|
2015-10-03 03:08:29 +00:00
|
|
|
{
|
2015-12-11 14:28:16 +00:00
|
|
|
const menu_ctx_driver_t *driver = menu_driver_ctx;
|
2015-10-03 03:08:29 +00:00
|
|
|
|
|
|
|
if (driver->iterate)
|
2015-12-11 14:14:39 +00:00
|
|
|
return driver->iterate(menu_driver_data,
|
|
|
|
menu_userdata ? menu_userdata : NULL, action);
|
2015-10-03 03:08:29 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2015-12-06 16:41:00 +00:00
|
|
|
static void menu_driver_toggle(bool latch)
|
2015-03-22 05:02:02 +00:00
|
|
|
{
|
2015-09-26 23:43:13 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
global_t *global = global_get_ptr();
|
2015-12-10 21:30:25 +00:00
|
|
|
rarch_system_info_t *system = NULL;
|
|
|
|
|
|
|
|
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
2015-12-11 14:39:19 +00:00
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_TOGGLE, &latch);
|
2015-03-22 05:02:02 +00:00
|
|
|
|
2015-12-05 12:49:22 +00:00
|
|
|
if (latch)
|
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_SET_ALIVE, NULL);
|
|
|
|
else
|
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_UNSET_ALIVE, NULL);
|
2015-09-26 23:38:21 +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-10-22 01:54:34 +00:00
|
|
|
menu_entries_set_refresh(false);
|
2015-09-26 23:43:13 +00:00
|
|
|
|
|
|
|
/* Menu should always run with vsync on. */
|
|
|
|
event_command(EVENT_CMD_VIDEO_SET_BLOCKING_STATE);
|
|
|
|
/* Stop all rumbling before entering the menu. */
|
|
|
|
event_command(EVENT_CMD_RUMBLE_STOP);
|
|
|
|
|
|
|
|
if (settings->menu.pause_libretro)
|
|
|
|
event_command(EVENT_CMD_AUDIO_STOP);
|
|
|
|
|
|
|
|
/* Override keyboard callback to redirect to menu instead.
|
|
|
|
* We'll use this later for something ...
|
|
|
|
* FIXME: This should probably be moved to menu_common somehow. */
|
|
|
|
if (global)
|
|
|
|
{
|
|
|
|
global->frontend_key_event = system->key_event;
|
|
|
|
system->key_event = menu_input_key_event;
|
2015-12-04 11:26:39 +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)
|
|
|
|
event_command(EVENT_CMD_AUDIO_START);
|
|
|
|
|
|
|
|
/* Prevent stray input from going to libretro core */
|
2015-11-29 16:23:30 +00:00
|
|
|
input_driver_ctl(RARCH_INPUT_CTL_SET_FLUSHING_INPUT, NULL);
|
2015-09-26 23:43:13 +00:00
|
|
|
|
|
|
|
/* Restore libretro keyboard callback. */
|
|
|
|
if (global)
|
|
|
|
system->key_event = global->frontend_key_event;
|
|
|
|
}
|
2015-03-22 05:02:02 +00:00
|
|
|
}
|
2015-03-22 05:43:35 +00:00
|
|
|
|
2015-06-04 08:39:48 +00:00
|
|
|
bool menu_driver_load_image(void *data, menu_image_type_t type)
|
2015-03-22 05:48:03 +00:00
|
|
|
{
|
2015-12-11 14:28:16 +00:00
|
|
|
const menu_ctx_driver_t *driver = menu_driver_ctx;
|
2015-03-22 05:48:03 +00:00
|
|
|
|
2015-06-04 08:39:48 +00:00
|
|
|
if (driver->load_image)
|
2015-12-11 14:14:39 +00:00
|
|
|
return driver->load_image(menu_userdata ? menu_userdata : NULL, data, type);
|
2015-03-22 05:48:03 +00:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2015-03-22 06:07:07 +00:00
|
|
|
|
2015-07-07 23:01:41 +00:00
|
|
|
bool menu_environment_cb(menu_environ_cb_t type, void *data)
|
|
|
|
{
|
2015-12-11 14:28:16 +00:00
|
|
|
const menu_ctx_driver_t *driver = menu_driver_ctx;
|
2015-07-07 23:01:41 +00:00
|
|
|
|
|
|
|
if (driver->environ_cb)
|
|
|
|
{
|
2015-12-11 14:14:39 +00:00
|
|
|
int ret = driver->environ_cb(type, data, menu_userdata ? menu_userdata : NULL);
|
2015-07-07 23:01:41 +00:00
|
|
|
if (ret == 0)
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2015-11-01 18:17:06 +00:00
|
|
|
|
2015-11-01 19:44:04 +00:00
|
|
|
int menu_driver_pointer_tap(unsigned x, unsigned y, unsigned ptr,
|
|
|
|
menu_file_list_cbs_t *cbs,
|
2015-11-01 19:35:43 +00:00
|
|
|
menu_entry_t *entry, unsigned action)
|
2015-11-01 18:17:06 +00:00
|
|
|
{
|
|
|
|
int ret = 0;
|
2015-12-11 14:28:16 +00:00
|
|
|
const menu_ctx_driver_t *driver = menu_driver_ctx;
|
2015-11-01 18:17:06 +00:00
|
|
|
|
|
|
|
if (driver->pointer_tap)
|
2015-12-11 14:14:39 +00:00
|
|
|
ret = driver->pointer_tap(menu_userdata ? menu_userdata : NULL, x, y, ptr, cbs, entry, action);
|
2015-11-01 18:17:06 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2015-12-05 12:00:45 +00:00
|
|
|
|
2015-12-10 16:24:56 +00:00
|
|
|
void menu_driver_navigation_clear(bool pending_push)
|
|
|
|
{
|
2015-12-11 14:28:16 +00:00
|
|
|
const menu_ctx_driver_t *driver = menu_driver_ctx;
|
2015-12-10 16:24:56 +00:00
|
|
|
|
|
|
|
if (driver->navigation_clear)
|
2015-12-11 14:14:39 +00:00
|
|
|
driver->navigation_clear(menu_userdata ? menu_userdata : NULL, pending_push);
|
2015-12-10 16:24:56 +00:00
|
|
|
}
|
|
|
|
|
2015-12-06 16:55:27 +00:00
|
|
|
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;
|
2015-12-07 15:11:53 +00:00
|
|
|
char *fullpath = NULL;
|
2015-12-06 16:55:27 +00:00
|
|
|
global_t *global = global_get_ptr();
|
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
|
|
|
|
if (!wrap_args)
|
|
|
|
return;
|
|
|
|
|
|
|
|
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
|
|
|
|
|
2015-12-07 15:11:53 +00:00
|
|
|
wrap_args->no_content = menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL);
|
2015-12-06 16:55:27 +00:00
|
|
|
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)
|
|
|
|
{
|
2015-12-10 22:08:34 +00:00
|
|
|
struct retro_system_info *system = NULL;
|
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
char *fullpath = NULL;
|
2015-12-06 16:55:27 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2015-12-10 22:08:34 +00:00
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET,
|
|
|
|
&system);
|
|
|
|
|
2015-12-06 16:55:27 +00:00
|
|
|
content_playlist_push(g_defaults.history,
|
|
|
|
fullpath,
|
|
|
|
NULL,
|
|
|
|
settings->libretro,
|
2015-12-10 22:08:34 +00:00
|
|
|
system->library_name,
|
2015-12-06 16:55:27 +00:00
|
|
|
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;
|
|
|
|
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);
|
2015-12-10 18:43:25 +00:00
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_RENDER, NULL);
|
2015-12-06 16:55:27 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2015-12-10 16:08:17 +00:00
|
|
|
menu_shader_manager_init(menu_driver_data);
|
2015-12-06 16:55:27 +00:00
|
|
|
|
|
|
|
event_command(EVENT_CMD_HISTORY_INIT);
|
|
|
|
|
2015-12-07 15:11:53 +00:00
|
|
|
if (*fullpath || menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL))
|
2015-12-06 16:55:27 +00:00
|
|
|
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)
|
|
|
|
{
|
|
|
|
if (!menu)
|
|
|
|
return;
|
|
|
|
|
2015-12-11 12:01:39 +00:00
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_FREE, NULL);
|
2015-12-06 16:55:27 +00:00
|
|
|
menu_shader_free(menu);
|
2015-12-11 10:56:31 +00:00
|
|
|
menu_input_ctl(MENU_INPUT_CTL_DEINIT, NULL);
|
2015-12-11 10:57:43 +00:00
|
|
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_DEINIT, NULL);
|
2015-12-06 16:55:27 +00:00
|
|
|
menu_driver_free(menu);
|
2015-12-10 22:08:34 +00:00
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_DEINIT, NULL);
|
2015-12-06 16:55:27 +00:00
|
|
|
menu_display_free();
|
|
|
|
menu_entries_free();
|
|
|
|
|
|
|
|
event_command(EVENT_CMD_HISTORY_DEINIT);
|
|
|
|
|
2015-12-11 12:51:17 +00:00
|
|
|
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_FREE, NULL);
|
2015-12-11 12:24:14 +00:00
|
|
|
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_FREE, NULL);
|
2015-12-06 16:55:27 +00:00
|
|
|
|
|
|
|
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;
|
2015-12-11 18:13:40 +00:00
|
|
|
settings->bundle_finished = true;
|
2015-12-06 16:55:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
|
|
|
|
if (!menu_ctx)
|
|
|
|
return NULL;
|
|
|
|
|
2015-12-11 14:14:39 +00:00
|
|
|
if (!(menu = (menu_handle_t*)menu_ctx->init(&menu_userdata)))
|
2015-12-06 16:55:27 +00:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
strlcpy(settings->menu.driver, menu_ctx->ident,
|
|
|
|
sizeof(settings->menu.driver));
|
|
|
|
|
2015-12-11 17:56:00 +00:00
|
|
|
if (!menu_entries_init())
|
2015-12-06 16:55:27 +00:00
|
|
|
goto error;
|
|
|
|
|
2015-12-11 12:24:14 +00:00
|
|
|
if (!runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_INIT, NULL))
|
2015-12-06 16:55:27 +00:00
|
|
|
goto error;
|
|
|
|
|
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
2015-12-10 19:12:08 +00:00
|
|
|
menu_driver_shader = (struct video_shader*)calloc(1, sizeof(struct video_shader));
|
|
|
|
if (!menu_driver_shader)
|
2015-12-06 16:55:27 +00:00
|
|
|
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
|
|
|
|
)
|
|
|
|
{
|
2015-12-11 18:13:40 +00:00
|
|
|
menu->help_screen_type = MENU_HELP_EXTRACT;
|
|
|
|
menu->push_help_screen = true;
|
2015-12-06 16:55:27 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2015-12-05 12:00:45 +00:00
|
|
|
bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
|
|
|
{
|
2015-12-10 22:08:34 +00:00
|
|
|
static struct retro_system_info menu_driver_system;
|
2015-12-11 12:08:30 +00:00
|
|
|
static content_playlist_t *menu_driver_playlist = NULL;
|
|
|
|
static bool menu_driver_prevent_populate = false;
|
|
|
|
static bool menu_driver_load_no_content = false;
|
|
|
|
static bool menu_driver_alive = false;
|
|
|
|
static bool menu_driver_data_own = false;
|
2015-12-11 14:28:16 +00:00
|
|
|
const menu_ctx_driver_t *driver = menu_driver_ctx;
|
2015-12-05 12:00:45 +00:00
|
|
|
|
|
|
|
switch (state)
|
|
|
|
{
|
2015-12-06 17:23:46 +00:00
|
|
|
case RARCH_MENU_CTL_DESTROY:
|
2015-12-07 15:55:13 +00:00
|
|
|
menu_driver_prevent_populate = false;
|
|
|
|
menu_driver_load_no_content = false;
|
|
|
|
menu_driver_alive = false;
|
|
|
|
menu_driver_data_own = false;
|
|
|
|
menu_driver_ctx = 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)
|
|
|
|
content_playlist_free(menu_driver_playlist);
|
|
|
|
menu_driver_playlist = NULL;
|
2015-12-11 12:01:39 +00:00
|
|
|
break;
|
2015-12-11 12:06:24 +00:00
|
|
|
case RARCH_MENU_CTL_PLAYLIST_INIT:
|
|
|
|
{
|
|
|
|
const char *path = (const char*)data;
|
2015-12-11 12:08:30 +00:00
|
|
|
if (!path || path[0] == '\0')
|
2015-12-11 12:06:24 +00:00
|
|
|
return false;
|
2015-12-11 12:08:30 +00:00
|
|
|
menu_driver_playlist = content_playlist_init(path,
|
2015-12-11 12:06:24 +00:00
|
|
|
COLLECTION_SIZE);
|
|
|
|
}
|
|
|
|
return true;
|
2015-12-11 11:40:59 +00:00
|
|
|
case RARCH_MENU_CTL_PLAYLIST_GET:
|
|
|
|
{
|
|
|
|
content_playlist_t **playlist = (content_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
|
|
|
}
|
|
|
|
return true;
|
2015-12-10 22:08:34 +00:00
|
|
|
case RARCH_MENU_CTL_SYSTEM_INFO_GET:
|
|
|
|
{
|
|
|
|
struct retro_system_info **system = (struct retro_system_info**)data;
|
|
|
|
if (!system)
|
|
|
|
return false;
|
|
|
|
*system = &menu_driver_system;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
case RARCH_MENU_CTL_SYSTEM_INFO_DEINIT:
|
|
|
|
#ifdef HAVE_DYNAMIC
|
|
|
|
libretro_free_system_info(&menu_driver_system);
|
|
|
|
#endif
|
2015-12-10 22:10:17 +00:00
|
|
|
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:
|
|
|
|
if (driver->render_messagebox)
|
|
|
|
driver->render_messagebox(menu_userdata, menu_driver_data->menu_state.msg);
|
|
|
|
break;
|
|
|
|
case RARCH_MENU_CTL_BLIT_RENDER:
|
|
|
|
if (driver->render)
|
|
|
|
driver->render(menu_userdata);
|
|
|
|
break;
|
2015-12-10 18:43:25 +00:00
|
|
|
case RARCH_MENU_CTL_RENDER:
|
2015-12-11 14:14:39 +00:00
|
|
|
menu_iterate_render(menu_driver_data, menu_userdata);
|
2015-12-10 18:43:25 +00:00
|
|
|
break;
|
2015-12-10 19:09:15 +00:00
|
|
|
case RARCH_MENU_CTL_SHADER_DEINIT:
|
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
2015-12-10 19:12:08 +00:00
|
|
|
if (menu_driver_shader)
|
|
|
|
free(menu_driver_shader);
|
|
|
|
menu_driver_shader = NULL;
|
2015-12-10 19:09:15 +00:00
|
|
|
#endif
|
|
|
|
return true;
|
2015-12-10 18:56:08 +00:00
|
|
|
case RARCH_MENU_CTL_SHADER_GET:
|
|
|
|
{
|
|
|
|
struct video_shader **shader = (struct video_shader**)data;
|
|
|
|
if (!shader)
|
|
|
|
return false;
|
2015-12-10 19:12:08 +00:00
|
|
|
*shader = menu_driver_shader;
|
2015-12-10 18:56:08 +00:00
|
|
|
}
|
|
|
|
return true;
|
2015-12-06 17:28:37 +00:00
|
|
|
case RARCH_MENU_CTL_FRAME:
|
|
|
|
if (!menu_driver_alive)
|
|
|
|
return false;
|
|
|
|
if (driver->frame)
|
2015-12-11 14:14:39 +00:00
|
|
|
driver->frame(menu_userdata);
|
2015-12-06 17:28:37 +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;
|
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_SET_ALIVE:
|
|
|
|
menu_driver_alive = true;
|
|
|
|
break;
|
|
|
|
case RARCH_MENU_CTL_UNSET_ALIVE:
|
|
|
|
menu_driver_alive = false;
|
|
|
|
break;
|
|
|
|
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:
|
|
|
|
if (driver->set_texture)
|
|
|
|
driver->set_texture();
|
|
|
|
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:
|
2015-12-05 12:13:49 +00:00
|
|
|
menu_free(menu_driver_data);
|
|
|
|
menu_driver_data = NULL;
|
2015-12-05 12:04:21 +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;
|
|
|
|
}
|
2015-12-08 18:54:36 +00:00
|
|
|
return true;
|
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:
|
|
|
|
if (driver->navigation_increment)
|
2015-12-11 14:14:39 +00:00
|
|
|
driver->navigation_increment(menu_userdata);
|
2015-12-11 13:26:51 +00:00
|
|
|
break;
|
|
|
|
case RARCH_MENU_CTL_NAVIGATION_DECREMENT:
|
|
|
|
if (driver->navigation_decrement)
|
2015-12-11 14:14:39 +00:00
|
|
|
driver->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;
|
|
|
|
if (driver->navigation_set)
|
2015-12-11 14:14:39 +00:00
|
|
|
driver->navigation_set(menu_userdata, *scroll);
|
2015-12-11 13:26:51 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
case RARCH_MENU_CTL_NAVIGATION_SET_LAST:
|
|
|
|
if (driver->navigation_set_last)
|
2015-12-11 14:14:39 +00:00
|
|
|
driver->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;
|
|
|
|
|
|
|
|
if (driver->navigation_ascend_alphabet)
|
2015-12-11 14:14:39 +00:00
|
|
|
driver->navigation_ascend_alphabet(menu_userdata, ptr_out);
|
2015-12-11 13:26:51 +00:00
|
|
|
}
|
|
|
|
case RARCH_MENU_CTL_NAVIGATION_DESCEND_ALPHABET:
|
|
|
|
{
|
|
|
|
size_t *ptr_out = (size_t*)data;
|
|
|
|
|
|
|
|
if (!ptr_out)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (driver->navigation_descend_alphabet)
|
2015-12-11 14:14:39 +00:00
|
|
|
driver->navigation_descend_alphabet(menu_userdata, ptr_out);
|
2015-12-11 13:26:51 +00:00
|
|
|
}
|
|
|
|
break;
|
2015-12-11 13:34:47 +00:00
|
|
|
case RARCH_MENU_CTL_POPULATE_ENTRIES:
|
|
|
|
{
|
|
|
|
menu_displaylist_info_t *info = (menu_displaylist_info_t*)data;
|
|
|
|
|
|
|
|
if (!info)
|
|
|
|
return false;
|
|
|
|
if (driver->populate_entries)
|
|
|
|
driver->populate_entries(
|
2015-12-11 14:14:39 +00:00
|
|
|
menu_userdata, info->path, info->label, info->type);
|
2015-12-11 13:34:47 +00:00
|
|
|
}
|
|
|
|
return true;
|
2015-12-11 14:28:16 +00:00
|
|
|
case RARCH_MENU_CTL_LIST_CLEAR:
|
|
|
|
{
|
|
|
|
file_list_t *list = (file_list_t*)data;
|
|
|
|
if (!list)
|
|
|
|
return false;
|
|
|
|
if (driver->list_clear)
|
|
|
|
driver->list_clear(list);
|
|
|
|
}
|
|
|
|
return true;
|
2015-12-11 14:39:19 +00:00
|
|
|
case RARCH_MENU_CTL_TOGGLE:
|
|
|
|
{
|
|
|
|
bool *latch = (bool*)data;
|
|
|
|
if (!latch)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (driver->toggle)
|
|
|
|
driver->toggle(menu_userdata, *latch);
|
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|