diff options
author | Michael Pavone <pavone@retrodev.com> | 2017-11-25 20:43:20 -0800 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2017-11-25 20:43:20 -0800 |
commit | f4767bb05392fa4a04d72969fa35aa91b688c8cb (patch) | |
tree | 431e023a080a27d2c5602238cdc032bfab974f58 /nuklear_ui/blastem_nuklear.c | |
parent | c6edea8bbaceda316375019344f4e7ffbf6da57e (diff) |
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
Diffstat (limited to 'nuklear_ui/blastem_nuklear.c')
-rw-r--r-- | nuklear_ui/blastem_nuklear.c | 22 |
1 files changed, 20 insertions, 2 deletions
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()); |