diff nuklear_ui/blastem_nuklear.c @ 1483:001120e91fed nuklear_ui

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
author Michael Pavone <pavone@retrodev.com>
date Sat, 25 Nov 2017 20:43:20 -0800
parents 2d203bf73dbd
children d82af64c94d2
line wrap: on
line diff
--- a/nuklear_ui/blastem_nuklear.c	Sat Nov 25 14:42:38 2017 -0800
+++ b/nuklear_ui/blastem_nuklear.c	Sat Nov 25 20:43:20 2017 -0800
@@ -62,8 +62,13 @@
 				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 @@
 	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());