From eaaed92aeba03ec2f8e5141d439e242bd2b39f23 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Mon, 13 Jun 2022 10:43:43 -0700 Subject: [PATCH] Reload initial rom when boot.rom is not found --- src/uxn11.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/uxn11.c b/src/uxn11.c index 29c89c8..0e3204d 100644 --- a/src/uxn11.c +++ b/src/uxn11.c @@ -103,13 +103,8 @@ emu_draw(void) static int emu_start(Uxn *u, char *rom) { - free(u->ram); - if(!uxn_boot(u, (Uint8 *)calloc(0x10300, sizeof(Uint8)))) - return emu_error("Boot", "Failed"); if(!load_rom(u, rom)) - return emu_error("Load", "Failed"); - u->dei = emu_dei; - u->deo = emu_deo; + return 0; screen_resize(&uxn_screen, WIDTH, HEIGHT); if(!uxn_eval(u, PAGE_PROGRAM)) return emu_error("Boot", "Failed to start rom."); @@ -232,6 +227,11 @@ main(int argc, char **argv) rom_path = argv[1]; /* start sequence */ u.ram = NULL; + /* free(u->ram); */ + if(!uxn_boot(&u, (Uint8 *)calloc(0x10300, sizeof(Uint8)))) + return emu_error("Boot", "Failed"); + u.dei = emu_dei; + u.deo = emu_deo; if(!emu_start(&u, rom_path)) return emu_error("Start", "Failed"); if(!init(rom_path))