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 camera_active;
|
||||||
bool location_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'
|
/* Set this to true if the platform in question needs to 'own'
|
||||||
* the respective handle and therefore skip regular RetroArch
|
* the respective handle and therefore skip regular RetroArch
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
#include "../general.h"
|
#include "../general.h"
|
||||||
#include "../string_list_special.h"
|
#include "../string_list_special.h"
|
||||||
|
|
||||||
static bool menu_alive = false;
|
|
||||||
|
|
||||||
static const menu_ctx_driver_t *menu_ctx_drivers[] = {
|
static const menu_ctx_driver_t *menu_ctx_drivers[] = {
|
||||||
#if defined(HAVE_RMENU)
|
#if defined(HAVE_RMENU)
|
||||||
&menu_ctx_rmenu,
|
&menu_ctx_rmenu,
|
||||||
|
@ -46,6 +44,10 @@ static const menu_ctx_driver_t *menu_ctx_drivers[] = {
|
||||||
NULL
|
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:
|
* menu_driver_find_handle:
|
||||||
* @idx : index of driver to get handle to.
|
* @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)
|
void find_menu_driver(void)
|
||||||
{
|
{
|
||||||
driver_t *driver = driver_get_ptr();
|
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
int i = find_driver_index("menu_driver", settings->menu.driver);
|
int i = find_driver_index("menu_driver", settings->menu.driver);
|
||||||
if (i >= 0)
|
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
|
else
|
||||||
{
|
{
|
||||||
unsigned d;
|
unsigned d;
|
||||||
|
@ -108,43 +109,39 @@ void find_menu_driver(void)
|
||||||
RARCH_LOG_OUTPUT("\t%s\n", menu_driver_find_ident(d));
|
RARCH_LOG_OUTPUT("\t%s\n", menu_driver_find_ident(d));
|
||||||
RARCH_WARN("Going to default to first menu driver...\n");
|
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()");
|
retro_fail(1, "find_menu_driver()");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_handle_t *menu_driver_get_ptr(void)
|
menu_handle_t *menu_driver_get_ptr(void)
|
||||||
{
|
{
|
||||||
driver_t *driver = driver_get_ptr();
|
if (!menu_driver_data)
|
||||||
if (!driver || !driver->menu_driver_data)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
return driver->menu_driver_data;
|
return menu_driver_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
const menu_ctx_driver_t *menu_ctx_driver_get_ptr(void)
|
const menu_ctx_driver_t *menu_ctx_driver_get_ptr(void)
|
||||||
{
|
{
|
||||||
driver_t *driver = driver_get_ptr();
|
if (!menu_driver_ctx)
|
||||||
if (!driver || !driver->menu_driver_ctx)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
return driver->menu_driver_ctx;
|
return menu_driver_ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_menu(void)
|
void init_menu(void)
|
||||||
{
|
{
|
||||||
driver_t *driver = driver_get_ptr();
|
if (menu_driver_data)
|
||||||
|
|
||||||
if (driver->menu_driver_data)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
find_menu_driver();
|
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()");
|
retro_fail(1, "init_menu()");
|
||||||
|
|
||||||
if (driver->menu_driver_ctx->lists_init)
|
if (menu_driver_ctx->lists_init)
|
||||||
if (!driver->menu_driver_ctx->lists_init(driver->menu_driver_data))
|
if (!menu_driver_ctx->lists_init(menu_driver_data))
|
||||||
retro_fail(1, "init_menu()");
|
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)
|
bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||||
{
|
{
|
||||||
static bool menu_driver_data_own = false;
|
static bool menu_driver_data_own = false;
|
||||||
driver_t *driver = driver_get_ptr();
|
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
|
@ -388,14 +384,15 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||||
menu_driver_data_own = false;
|
menu_driver_data_own = false;
|
||||||
break;
|
break;
|
||||||
case RARCH_MENU_CTL_IS_SET_TEXTURE:
|
case RARCH_MENU_CTL_IS_SET_TEXTURE:
|
||||||
if (!driver || !driver->menu_driver_ctx)
|
if (!menu_driver_ctx)
|
||||||
return false;
|
return false;
|
||||||
return driver->menu_driver_ctx->set_texture;
|
return menu_driver_ctx->set_texture;
|
||||||
case RARCH_MENU_CTL_OWNS_DRIVER:
|
case RARCH_MENU_CTL_OWNS_DRIVER:
|
||||||
return menu_driver_data_own;
|
return menu_driver_data_own;
|
||||||
case RARCH_MENU_CTL_DEINIT:
|
case RARCH_MENU_CTL_DEINIT:
|
||||||
menu_free(driver->menu_driver_data);
|
menu_free(menu_driver_data);
|
||||||
driver->menu_driver_data = NULL;
|
menu_driver_data = NULL;
|
||||||
|
menu_driver_ctx = NULL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case RARCH_MENU_CTL_NONE:
|
case RARCH_MENU_CTL_NONE:
|
||||||
|
|
Loading…
Reference in New Issue