Browse code

Relaunch boot rom if launcher is not found

neauoire authored on 12/11/2022 05:12:30
Showing 1 changed files
... ...
@@ -53,6 +53,8 @@ static Uint8 zoom = 1;
53 53
 static Uint32 stdin_event, audio0_event;
54 54
 static Uint64 exec_deadline, deadline_interval, ms_interval;
55 55
 
56
+char *rom_path;
57
+
56 58
 static int
57 59
 error(char *msg, const char *err)
58 60
 {
... ...
@@ -306,7 +308,8 @@ static void
306 308
 restart(Uxn *u)
307 309
 {
308 310
 	screen_resize(&uxn_screen, WIDTH, HEIGHT);
309
-	start(u, "launcher.rom");
311
+	if(!start(u, "launcher.rom"))
312
+		start(u, rom_path);
310 313
 }
311 314
 
312 315
 static Uint8
... ...
@@ -497,6 +500,7 @@ main(int argc, char **argv)
497 500
 		} else if(!loaded++) {
498 501
 			if(!start(&u, argv[i]))
499 502
 				return error("Boot", "Failed to boot.");
503
+			rom_path = argv[i];
500 504
 		} else {
501 505
 			char *p = argv[i];
502 506
 			while(*p) console_input(&u, *p++);