mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Move variables to menu_driver.c and turn them staticc
This commit is contained in:
parent
688ddcfd9e
commit
66582c3f06
4
driver.h
4
driver.h
@ -200,10 +200,6 @@ typedef struct driver
|
||||
bool camera_active;
|
||||
bool location_active;
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_handle_t *menu_driver_data;
|
||||
const menu_ctx_driver_t *menu_driver_ctx;
|
||||
#endif
|
||||
|
||||
/* Set this to true if the platform in question needs to 'own'
|
||||
* the respective handle and therefore skip regular RetroArch
|
||||
|
@ -21,8 +21,6 @@
|
||||
#include "../general.h"
|
||||
#include "../string_list_special.h"
|
||||
|
||||
static bool menu_alive = false;
|
||||
|
||||
static const menu_ctx_driver_t *menu_ctx_drivers[] = {
|
||||
#if defined(HAVE_RMENU)
|
||||
&menu_ctx_rmenu,
|
||||
@ -46,6 +44,10 @@ static const menu_ctx_driver_t *menu_ctx_drivers[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
static bool menu_alive = false;
|
||||
static menu_handle_t *menu_driver_data;
|
||||
static const menu_ctx_driver_t *menu_driver_ctx;
|
||||
|
||||
/**
|
||||
* menu_driver_find_handle:
|
||||
* @idx : index of driver to get handle to.
|
||||
@ -92,12 +94,11 @@ const char *config_get_menu_driver_options(void)
|
||||
|
||||
void find_menu_driver(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
int i = find_driver_index("menu_driver", settings->menu.driver);
|
||||
if (i >= 0)
|
||||
driver->menu_driver_ctx = (const menu_ctx_driver_t*)menu_driver_find_handle(i);
|
||||
menu_driver_ctx = (const menu_ctx_driver_t*)menu_driver_find_handle(i);
|
||||
else
|
||||
{
|
||||
unsigned d;
|
||||
@ -108,43 +109,39 @@ void find_menu_driver(void)
|
||||
RARCH_LOG_OUTPUT("\t%s\n", menu_driver_find_ident(d));
|
||||
RARCH_WARN("Going to default to first menu driver...\n");
|
||||
|
||||
driver->menu_driver_ctx = (const menu_ctx_driver_t*)menu_driver_find_handle(0);
|
||||
menu_driver_ctx = (const menu_ctx_driver_t*)menu_driver_find_handle(0);
|
||||
|
||||
if (!driver->menu_driver_ctx)
|
||||
if (!menu_driver_ctx)
|
||||
retro_fail(1, "find_menu_driver()");
|
||||
}
|
||||
}
|
||||
|
||||
menu_handle_t *menu_driver_get_ptr(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver || !driver->menu_driver_data)
|
||||
if (!menu_driver_data)
|
||||
return NULL;
|
||||
return driver->menu_driver_data;
|
||||
return menu_driver_data;
|
||||
}
|
||||
|
||||
const menu_ctx_driver_t *menu_ctx_driver_get_ptr(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver || !driver->menu_driver_ctx)
|
||||
if (!menu_driver_ctx)
|
||||
return NULL;
|
||||
return driver->menu_driver_ctx;
|
||||
return menu_driver_ctx;
|
||||
}
|
||||
|
||||
void init_menu(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
if (driver->menu_driver_data)
|
||||
if (menu_driver_data)
|
||||
return;
|
||||
|
||||
find_menu_driver();
|
||||
|
||||
if (!(driver->menu_driver_data = (menu_handle_t*)menu_init(driver->menu_driver_ctx)))
|
||||
if (!(menu_driver_data = (menu_handle_t*)menu_init(menu_driver_ctx)))
|
||||
retro_fail(1, "init_menu()");
|
||||
|
||||
if (driver->menu_driver_ctx->lists_init)
|
||||
if (!driver->menu_driver_ctx->lists_init(driver->menu_driver_data))
|
||||
if (menu_driver_ctx->lists_init)
|
||||
if (!menu_driver_ctx->lists_init(menu_driver_data))
|
||||
retro_fail(1, "init_menu()");
|
||||
}
|
||||
|
||||
@ -377,7 +374,6 @@ int menu_driver_pointer_tap(unsigned x, unsigned y, unsigned ptr,
|
||||
bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||
{
|
||||
static bool menu_driver_data_own = false;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
switch (state)
|
||||
{
|
||||
@ -388,14 +384,15 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||
menu_driver_data_own = false;
|
||||
break;
|
||||
case RARCH_MENU_CTL_IS_SET_TEXTURE:
|
||||
if (!driver || !driver->menu_driver_ctx)
|
||||
if (!menu_driver_ctx)
|
||||
return false;
|
||||
return driver->menu_driver_ctx->set_texture;
|
||||
return menu_driver_ctx->set_texture;
|
||||
case RARCH_MENU_CTL_OWNS_DRIVER:
|
||||
return menu_driver_data_own;
|
||||
case RARCH_MENU_CTL_DEINIT:
|
||||
menu_free(driver->menu_driver_data);
|
||||
driver->menu_driver_data = NULL;
|
||||
menu_free(menu_driver_data);
|
||||
menu_driver_data = NULL;
|
||||
menu_driver_ctx = NULL;
|
||||
break;
|
||||
default:
|
||||
case RARCH_MENU_CTL_NONE:
|
||||
|
Loading…
x
Reference in New Issue
Block a user