mirror of
https://github.com/libretro/RetroArch
synced 2025-02-13 12:40:47 +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);
|
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;
|
int i = find_menu_driver_index(g_settings.menu.driver);
|
||||||
|
if (i >= 0)
|
||||||
if (!menu_ctx_drivers[0])
|
driver.menu_ctx = menu_ctx_drivers[i];
|
||||||
return false;
|
else
|
||||||
|
|
||||||
for (i = 0; menu_ctx_drivers[i]; i++)
|
|
||||||
{
|
{
|
||||||
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 = menu_ctx_drivers[0];
|
||||||
{
|
|
||||||
*driver = menu_ctx_drivers[i];
|
if (!driver.menu_ctx)
|
||||||
*data = h;
|
rarch_fail(1, "find_menu_driver()");
|
||||||
strlcpy(g_settings.menu.driver, menu_ctx_drivers[i]->ident, sizeof(g_settings.menu.driver));
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
1
driver.c
1
driver.c
@ -362,6 +362,7 @@ void init_drivers_pre(void)
|
|||||||
#ifdef HAVE_OSK
|
#ifdef HAVE_OSK
|
||||||
find_osk_driver();
|
find_osk_driver();
|
||||||
#endif
|
#endif
|
||||||
|
find_menu_driver();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void adjust_system_rates(void)
|
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
|
#ifdef HAVE_MENU
|
||||||
const void *menu_ctx_find_driver(const char *ident); // Finds driver with ident. Does not initialize.
|
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_prev_menu_driver(void);
|
||||||
void find_next_menu_driver(void);
|
void find_next_menu_driver(void);
|
||||||
#endif
|
#endif
|
||||||
|
@ -314,17 +314,21 @@ bool load_menu_game(void *data)
|
|||||||
|
|
||||||
void *menu_init(void)
|
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;
|
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_ERR("Could not initialize menu.\n");
|
||||||
rarch_fail(1, "menu_init()");
|
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->menu_stack = (file_list_t*)calloc(1, sizeof(file_list_t));
|
||||||
rgui->selection_buf = (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);
|
file_list_push(rgui->menu_stack, "", RGUI_SETTINGS, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user