Keep rom path in memory
This commit is contained in:
parent
95a28d6b4d
commit
245ad452a2
11
src/uxn11.c
11
src/uxn11.c
|
@ -31,6 +31,8 @@ static Display *display;
|
||||||
static Visual *visual;
|
static Visual *visual;
|
||||||
static Window window;
|
static Window window;
|
||||||
|
|
||||||
|
char *rom_path;
|
||||||
|
|
||||||
#define WIDTH (64 * 8)
|
#define WIDTH (64 * 8)
|
||||||
#define HEIGHT (40 * 8)
|
#define HEIGHT (40 * 8)
|
||||||
|
|
||||||
|
@ -106,7 +108,6 @@ emu_start(Uxn *u, char *rom)
|
||||||
return emu_error("Boot", "Failed");
|
return emu_error("Boot", "Failed");
|
||||||
if(!load_rom(u, rom))
|
if(!load_rom(u, rom))
|
||||||
return emu_error("Load", "Failed");
|
return emu_error("Load", "Failed");
|
||||||
fprintf(stderr, "Loaded %s\n", rom);
|
|
||||||
u->dei = emu_dei;
|
u->dei = emu_dei;
|
||||||
u->deo = emu_deo;
|
u->deo = emu_deo;
|
||||||
screen_resize(&uxn_screen, WIDTH, HEIGHT);
|
screen_resize(&uxn_screen, WIDTH, HEIGHT);
|
||||||
|
@ -168,7 +169,8 @@ emu_event(Uxn *u)
|
||||||
if(sym == XK_F2)
|
if(sym == XK_F2)
|
||||||
system_inspect(u);
|
system_inspect(u);
|
||||||
if(sym == XK_F4)
|
if(sym == XK_F4)
|
||||||
emu_start(u, "boot.rom");
|
if(!emu_start(u, "boot.rom"))
|
||||||
|
emu_start(u, rom_path);
|
||||||
controller_down(u, &u->dev[0x80], get_button(sym));
|
controller_down(u, &u->dev[0x80], get_button(sym));
|
||||||
controller_key(u, &u->dev[0x80], sym < 0x80 ? sym : (Uint8)buf[0]);
|
controller_key(u, &u->dev[0x80], sym < 0x80 ? sym : (Uint8)buf[0]);
|
||||||
} break;
|
} break;
|
||||||
|
@ -227,11 +229,12 @@ main(int argc, char **argv)
|
||||||
static const struct itimerspec screen_tspec = {{0, 16666666}, {0, 16666666}};
|
static const struct itimerspec screen_tspec = {{0, 16666666}, {0, 16666666}};
|
||||||
if(argc < 2)
|
if(argc < 2)
|
||||||
return emu_error("Usage", "uxn11 game.rom args");
|
return emu_error("Usage", "uxn11 game.rom args");
|
||||||
|
rom_path = argv[1];
|
||||||
/* start sequence */
|
/* start sequence */
|
||||||
u.ram = NULL;
|
u.ram = NULL;
|
||||||
if(!emu_start(&u, argv[1]))
|
if(!emu_start(&u, rom_path))
|
||||||
return emu_error("Start", "Failed");
|
return emu_error("Start", "Failed");
|
||||||
if(!init(argv[1]))
|
if(!init(rom_path))
|
||||||
return emu_error("Init", "Failed");
|
return emu_error("Init", "Failed");
|
||||||
/* console vector */
|
/* console vector */
|
||||||
for(i = 2; i < argc; i++) {
|
for(i = 2; i < argc; i++) {
|
||||||
|
|
Loading…
Reference in New Issue