From f4767bb05392fa4a04d72969fa35aa91b688c8cb Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sat, 25 Nov 2017 20:43:20 -0800 Subject: Skip loading menu ROM if Nuklear UI is enabled. Allow disabling Nuklear UI in favor of old menu ROM both at compile time and in config. Fall back to ROM UI if GL is unavailable --HG-- branch : nuklear_ui --- nuklear_ui/blastem_nuklear.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'nuklear_ui/blastem_nuklear.c') diff --git a/nuklear_ui/blastem_nuklear.c b/nuklear_ui/blastem_nuklear.c index 4785de6..96f8a5d 100644 --- a/nuklear_ui/blastem_nuklear.c +++ b/nuklear_ui/blastem_nuklear.c @@ -62,8 +62,13 @@ void view_load(struct nk_context *context) free_dir_list(entries, num_entries); entries = NULL; } else { - current_system->next_rom = full_path; - current_system->request_exit(current_system); + if (current_system) { + current_system->next_rom = full_path; + current_system->request_exit(current_system); + } else { + init_system_with_media(full_path, SYSTEM_UNKNOWN); + free(full_path); + } current_view = view_play; } } @@ -254,6 +259,19 @@ uint8_t is_nuklear_active(void) return active; } +uint8_t is_nuklear_available(void) +{ + if (!render_has_gl()) { + //currently no fallback if GL2 unavailable + return 0; + } + char *style = tern_find_path(config, "ui\0style\0", TVAL_PTR).ptrval; + if (!style) { + return 1; + } + return strcmp(style, "rom") != 0; +} + void blastem_nuklear_init(uint8_t file_loaded) { context = nk_sdl_init(render_get_window()); -- cgit v1.2.3