commit eaaed92

Devine Lu Linvega  ·  2022-06-13 17:43:43 +0000 UTC
parent 245ad45
Reload initial rom when boot.rom is not found
1 files changed,  +6, -6
+6, -6
 1@@ -103,13 +103,8 @@ emu_draw(void)
 2 static int
 3 emu_start(Uxn *u, char *rom)
 4 {
 5-	free(u->ram);
 6-	if(!uxn_boot(u, (Uint8 *)calloc(0x10300, sizeof(Uint8))))
 7-		return emu_error("Boot", "Failed");
 8 	if(!load_rom(u, rom))
 9-		return emu_error("Load", "Failed");
10-	u->dei = emu_dei;
11-	u->deo = emu_deo;
12+		return 0;
13 	screen_resize(&uxn_screen, WIDTH, HEIGHT);
14 	if(!uxn_eval(u, PAGE_PROGRAM))
15 		return emu_error("Boot", "Failed to start rom.");
16@@ -232,6 +227,11 @@ main(int argc, char **argv)
17 	rom_path = argv[1];
18 	/* start sequence */
19 	u.ram = NULL;
20+	/* free(u->ram); */
21+	if(!uxn_boot(&u, (Uint8 *)calloc(0x10300, sizeof(Uint8))))
22+		return emu_error("Boot", "Failed");
23+	u.dei = emu_dei;
24+	u.deo = emu_deo;
25 	if(!emu_start(&u, rom_path))
26 		return emu_error("Start", "Failed");
27 	if(!init(rom_path))