Relaunch boot rom if launcher is not found

This commit is contained in:
neauoire 2022-11-11 21:12:30 -08:00
parent 3a834fdfc1
commit c8fc397054
1 changed files with 5 additions and 1 deletions

View File

@ -53,6 +53,8 @@ static Uint8 zoom = 1;
static Uint32 stdin_event, audio0_event; static Uint32 stdin_event, audio0_event;
static Uint64 exec_deadline, deadline_interval, ms_interval; static Uint64 exec_deadline, deadline_interval, ms_interval;
char *rom_path;
static int static int
error(char *msg, const char *err) error(char *msg, const char *err)
{ {
@ -306,7 +308,8 @@ static void
restart(Uxn *u) restart(Uxn *u)
{ {
screen_resize(&uxn_screen, WIDTH, HEIGHT); screen_resize(&uxn_screen, WIDTH, HEIGHT);
start(u, "launcher.rom"); if(!start(u, "launcher.rom"))
start(u, rom_path);
} }
static Uint8 static Uint8
@ -497,6 +500,7 @@ main(int argc, char **argv)
} else if(!loaded++) { } else if(!loaded++) {
if(!start(&u, argv[i])) if(!start(&u, argv[i]))
return error("Boot", "Failed to boot."); return error("Boot", "Failed to boot.");
rom_path = argv[i];
} else { } else {
char *p = argv[i]; char *p = argv[i];
while(*p) console_input(&u, *p++); while(*p) console_input(&u, *p++);