mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-01 09:12:35 +00:00
(Menu) Initialize menu driver during init_drivers_pre
This commit is contained in:
parent
06cc9a5c18
commit
e69b9c4f8a
@ -76,25 +76,23 @@ void find_next_menu_driver(void)
|
||||
RARCH_WARN("Couldn't find any next menu driver (current one: \"%s\").\n", g_settings.menu.driver);
|
||||
}
|
||||
|
||||
bool menu_ctx_init_first(const menu_ctx_driver_t **driver, void **data)
|
||||
static void find_menu_driver(void)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
if (!menu_ctx_drivers[0])
|
||||
return false;
|
||||
|
||||
for (i = 0; menu_ctx_drivers[i]; i++)
|
||||
int i = find_menu_driver_index(g_settings.menu.driver);
|
||||
if (i >= 0)
|
||||
driver.menu_ctx = menu_ctx_drivers[i];
|
||||
else
|
||||
{
|
||||
void *h = menu_ctx_drivers[i]->init();
|
||||
unsigned d;
|
||||
RARCH_WARN("Couldn't find any menu driver named \"%s\"\n", g_settings.menu.driver);
|
||||
RARCH_LOG_OUTPUT("Available menu drivers are:\n");
|
||||
for (d = 0; menu_ctx_drivers[d]; d++)
|
||||
RARCH_LOG_OUTPUT("\t%s\n", menu_ctx_drivers[d]->ident);
|
||||
RARCH_WARN("Going to default to first menu driver...\n");
|
||||
|
||||
if (h)
|
||||
{
|
||||
*driver = menu_ctx_drivers[i];
|
||||
*data = h;
|
||||
strlcpy(g_settings.menu.driver, menu_ctx_drivers[i]->ident, sizeof(g_settings.menu.driver));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
driver.menu_ctx = menu_ctx_drivers[0];
|
||||
|
||||
return false;
|
||||
if (!driver.menu_ctx)
|
||||
rarch_fail(1, "find_menu_driver()");
|
||||
}
|
||||
}
|
||||
|
1
driver.c
1
driver.c
@ -362,6 +362,7 @@ void init_drivers_pre(void)
|
||||
#ifdef HAVE_OSK
|
||||
find_osk_driver();
|
||||
#endif
|
||||
find_menu_driver();
|
||||
}
|
||||
|
||||
static void adjust_system_rates(void)
|
||||
|
1
driver.h
1
driver.h
@ -622,7 +622,6 @@ void driver_location_set_interval(unsigned interval_msecs, unsigned interval_dis
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
const void *menu_ctx_find_driver(const char *ident); // Finds driver with ident. Does not initialize.
|
||||
bool menu_ctx_init_first(const menu_ctx_driver_t **driver, void **handle); // Finds first suitable driver and initializes.
|
||||
void find_prev_menu_driver(void);
|
||||
void find_next_menu_driver(void);
|
||||
#endif
|
||||
|
@ -314,17 +314,21 @@ bool load_menu_game(void *data)
|
||||
|
||||
void *menu_init(void)
|
||||
{
|
||||
rgui_handle_t *rgui = (rgui_handle_t*)calloc(1, sizeof(rgui));
|
||||
rgui_handle_t *rgui;
|
||||
|
||||
if (!rgui)
|
||||
if (!driver.menu_ctx)
|
||||
return NULL;
|
||||
|
||||
if (!menu_ctx_init_first(&driver.menu_ctx, (void**)&rgui))
|
||||
rgui = (rgui_handle_t*)driver.menu_ctx->init();
|
||||
|
||||
if (!rgui)
|
||||
{
|
||||
RARCH_ERR("Could not initialize menu.\n");
|
||||
rarch_fail(1, "menu_init()");
|
||||
}
|
||||
|
||||
strlcpy(g_settings.menu.driver, driver.menu_ctx->ident, sizeof(g_settings.menu.driver));
|
||||
|
||||
rgui->menu_stack = (file_list_t*)calloc(1, sizeof(file_list_t));
|
||||
rgui->selection_buf = (file_list_t*)calloc(1, sizeof(file_list_t));
|
||||
file_list_push(rgui->menu_stack, "", RGUI_SETTINGS, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user