mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 18:40:49 +00:00
Fixup menu_ctx_init_first.
Use it directly instead of find_driver().
This commit is contained in:
parent
3b70e3be4a
commit
c2e863ac85
@ -33,7 +33,7 @@
|
||||
#include "../../compat/posix_string.h"
|
||||
|
||||
rgui_handle_t *rgui;
|
||||
menu_ctx_driver_t *menu_ctx;
|
||||
const menu_ctx_driver_t *menu_ctx;
|
||||
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
void shader_manager_init(rgui_handle_t *rgui)
|
||||
@ -499,12 +499,7 @@ bool load_menu_game(void)
|
||||
|
||||
void menu_init(void)
|
||||
{
|
||||
menu_ctx = (menu_ctx_driver_t*)menu_ctx_init_first();
|
||||
|
||||
if (menu_ctx && menu_ctx->init)
|
||||
rgui = (rgui_handle_t*)menu_ctx->init();
|
||||
|
||||
if (rgui == NULL || menu_ctx == NULL)
|
||||
if (!menu_ctx_init_first(&menu_ctx, &rgui))
|
||||
{
|
||||
RARCH_ERR("Could not initialize menu.\n");
|
||||
rarch_fail(1, "menu_init()");
|
||||
|
@ -44,10 +44,22 @@ const menu_ctx_driver_t *menu_ctx_find_driver(const char *ident)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const menu_ctx_driver_t *menu_ctx_init_first(void)
|
||||
bool menu_ctx_init_first(const menu_ctx_driver_t **driver, rgui_handle_t **handle)
|
||||
{
|
||||
for (unsigned i = 0; menu_ctx_drivers[i]; i++)
|
||||
return menu_ctx_drivers[i];
|
||||
if (!menu_ctx_drivers[0])
|
||||
return false;
|
||||
|
||||
return NULL;
|
||||
for (unsigned i = 0; menu_ctx_drivers[i]; i++)
|
||||
{
|
||||
void *h = menu_ctx_drivers[i]->init();
|
||||
if (h)
|
||||
{
|
||||
*driver = menu_ctx_drivers[i];
|
||||
*handle = h;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include "../../config.h"
|
||||
#endif
|
||||
|
||||
#include "menu_common.h"
|
||||
|
||||
typedef struct menu_ctx_driver
|
||||
{
|
||||
int (*iterate)(void*);
|
||||
@ -39,6 +41,6 @@ extern const menu_ctx_driver_t menu_ctx_rmenu_xui;
|
||||
extern const menu_ctx_driver_t menu_ctx_rgui;
|
||||
|
||||
const menu_ctx_driver_t *menu_ctx_find_driver(const char *ident); // Finds driver with ident. Does not initialize.
|
||||
const menu_ctx_driver_t *menu_ctx_init_first(void); // Finds first suitable driver and initializes.
|
||||
bool menu_ctx_init_first(const menu_ctx_driver_t **driver, rgui_handle_t **handle); // Finds first suitable driver and initializes.
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user