Keep boot rom path in system
This commit is contained in:
parent
ddd3a46156
commit
bd8b2026b8
|
@ -15,6 +15,8 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
WITH REGARD TO THIS SOFTWARE.
|
WITH REGARD TO THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
char *boot_rom;
|
||||||
|
|
||||||
static const char *errors[] = {
|
static const char *errors[] = {
|
||||||
"underflow",
|
"underflow",
|
||||||
"overflow",
|
"overflow",
|
||||||
|
@ -100,6 +102,7 @@ system_init(Uxn *u, Uint8 *ram, char *rom)
|
||||||
u->ram = ram;
|
u->ram = ram;
|
||||||
if(!system_load(u, rom))
|
if(!system_load(u, rom))
|
||||||
return system_error("Init", "Failed to load rom.");
|
return system_error("Init", "Failed to load rom.");
|
||||||
|
boot_rom = rom;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@ WITH REGARD TO THIS SOFTWARE.
|
||||||
|
|
||||||
#define RAM_PAGES 0x10
|
#define RAM_PAGES 0x10
|
||||||
|
|
||||||
|
extern char *boot_rom;
|
||||||
|
|
||||||
void system_connect(Uint8 device, Uint8 ver, Uint16 dei, Uint16 deo);
|
void system_connect(Uint8 device, Uint8 ver, Uint16 dei, Uint16 deo);
|
||||||
int system_version(char *emulator, char *date);
|
int system_version(char *emulator, char *date);
|
||||||
int system_load(Uxn *u, char *filename);
|
int system_load(Uxn *u, char *filename);
|
||||||
|
|
|
@ -73,7 +73,7 @@ main(int argc, char **argv)
|
||||||
system_connect(0xc, DATETIME_VERSION, DATETIME_DEIMASK, DATETIME_DEOMASK);
|
system_connect(0xc, DATETIME_VERSION, DATETIME_DEIMASK, DATETIME_DEOMASK);
|
||||||
/* Read flags */
|
/* Read flags */
|
||||||
if(argv[i][0] == '-' && argv[i][1] == 'v')
|
if(argv[i][0] == '-' && argv[i][1] == 'v')
|
||||||
return system_version("Uxncli - Console Varvara Emulator", "9 Aug 2023");
|
return system_version("Uxncli - Console Varvara Emulator", "15 Aug 2023");
|
||||||
if(!system_init(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++]))
|
if(!system_init(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++]))
|
||||||
return system_error("Init", "Failed to initialize uxn.");
|
return system_error("Init", "Failed to initialize uxn.");
|
||||||
/* Game Loop */
|
/* Game Loop */
|
||||||
|
|
14
src/uxnemu.c
14
src/uxnemu.c
|
@ -58,7 +58,6 @@ static SDL_Thread *stdin_thread;
|
||||||
static int window_created = 0;
|
static int window_created = 0;
|
||||||
static Uint32 stdin_event, audio0_event, zoom = 1;
|
static Uint32 stdin_event, audio0_event, zoom = 1;
|
||||||
static Uint64 exec_deadline, deadline_interval, ms_interval;
|
static Uint64 exec_deadline, deadline_interval, ms_interval;
|
||||||
static char *rom_path;
|
|
||||||
|
|
||||||
Uint16 dev_vers[0x10], dei_mask[0x10], deo_mask[0x10];
|
Uint16 dev_vers[0x10], dei_mask[0x10], deo_mask[0x10];
|
||||||
|
|
||||||
|
@ -271,9 +270,9 @@ static void
|
||||||
emu_restart(Uxn *u)
|
emu_restart(Uxn *u)
|
||||||
{
|
{
|
||||||
screen_resize(WIDTH, HEIGHT);
|
screen_resize(WIDTH, HEIGHT);
|
||||||
SDL_SetWindowTitle(emu_window, rom_path);
|
SDL_SetWindowTitle(emu_window, boot_rom);
|
||||||
if(!emu_start(u, "launcher.rom"))
|
if(!emu_start(u, "launcher.rom"))
|
||||||
emu_start(u, rom_path);
|
emu_start(u, boot_rom);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -288,7 +287,7 @@ emu_restart_soft(Uxn *u)
|
||||||
u->rst.ptr = 0;
|
u->rst.ptr = 0;
|
||||||
screen_fill(uxn_screen.bg, 0, 0, uxn_screen.width, uxn_screen.height, 0);
|
screen_fill(uxn_screen.bg, 0, 0, uxn_screen.width, uxn_screen.height, 0);
|
||||||
screen_fill(uxn_screen.fg, 0, 0, uxn_screen.width, uxn_screen.height, 0);
|
screen_fill(uxn_screen.fg, 0, 0, uxn_screen.width, uxn_screen.height, 0);
|
||||||
if(!system_load(u, rom_path))
|
if(!system_load(u, boot_rom))
|
||||||
return system_error("Boot", "Failed to load rom.");
|
return system_error("Boot", "Failed to load rom.");
|
||||||
if(!uxn_eval(u, PAGE_PROGRAM))
|
if(!uxn_eval(u, PAGE_PROGRAM))
|
||||||
return system_error("Boot", "Failed to eval rom.");
|
return system_error("Boot", "Failed to eval rom.");
|
||||||
|
@ -552,19 +551,18 @@ main(int argc, char **argv)
|
||||||
system_connect(0xc, DATETIME_VERSION, DATETIME_DEIMASK, DATETIME_DEOMASK);
|
system_connect(0xc, DATETIME_VERSION, DATETIME_DEIMASK, DATETIME_DEOMASK);
|
||||||
/* Read flags */
|
/* Read flags */
|
||||||
if(argv[i][0] == '-' && argv[i][1] == 'v')
|
if(argv[i][0] == '-' && argv[i][1] == 'v')
|
||||||
return system_version("Uxnemu - Graphical Varvara Emulator", "10 Aug 2023");
|
return system_version("Uxnemu - Graphical Varvara Emulator", "15 Aug 2023");
|
||||||
if(strcmp(argv[i], "-2x") == 0 || strcmp(argv[i], "-3x") == 0)
|
if(strcmp(argv[i], "-2x") == 0 || strcmp(argv[i], "-3x") == 0)
|
||||||
set_zoom(argv[i++][1] - '0', 0);
|
set_zoom(argv[i++][1] - '0', 0);
|
||||||
rom_path = argv[i++];
|
|
||||||
if(!emu_init())
|
if(!emu_init())
|
||||||
return system_error("Init", "Failed to initialize varvara.");
|
return system_error("Init", "Failed to initialize varvara.");
|
||||||
if(!system_init(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), rom_path))
|
if(!system_init(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++]))
|
||||||
return system_error("Init", "Failed to initialize uxn.");
|
return system_error("Init", "Failed to initialize uxn.");
|
||||||
/* Game Loop */
|
/* Game Loop */
|
||||||
u.dev[0x17] = argc - i;
|
u.dev[0x17] = argc - i;
|
||||||
if(uxn_eval(&u, PAGE_PROGRAM)) {
|
if(uxn_eval(&u, PAGE_PROGRAM)) {
|
||||||
console_listen(&u, i, argc, argv);
|
console_listen(&u, i, argc, argv);
|
||||||
emu_run(&u, rom_path);
|
emu_run(&u, boot_rom);
|
||||||
}
|
}
|
||||||
return emu_end(&u);
|
return emu_end(&u);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue