uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit bd8b2026b819626fe054f917ffef14c54daa0c82
parent ddd3a46156ebc9fc757d4dbe62871f49760017be
Author: neauoire <aliceffekt@gmail.com>
Date:   Tue, 15 Aug 2023 18:53:51 -0700

Keep boot rom path in system

Diffstat:
Msrc/devices/system.c | 3+++
Msrc/devices/system.h | 2++
Msrc/uxncli.c | 2+-
Msrc/uxnemu.c | 14++++++--------
4 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/devices/system.c b/src/devices/system.c @@ -15,6 +15,8 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. */ +char *boot_rom; + static const char *errors[] = { "underflow", "overflow", @@ -100,6 +102,7 @@ system_init(Uxn *u, Uint8 *ram, char *rom) u->ram = ram; if(!system_load(u, rom)) return system_error("Init", "Failed to load rom."); + boot_rom = rom; return 1; } diff --git a/src/devices/system.h b/src/devices/system.h @@ -15,6 +15,8 @@ WITH REGARD TO THIS SOFTWARE. #define RAM_PAGES 0x10 +extern char *boot_rom; + void system_connect(Uint8 device, Uint8 ver, Uint16 dei, Uint16 deo); int system_version(char *emulator, char *date); int system_load(Uxn *u, char *filename); diff --git a/src/uxncli.c b/src/uxncli.c @@ -73,7 +73,7 @@ main(int argc, char **argv) system_connect(0xc, DATETIME_VERSION, DATETIME_DEIMASK, DATETIME_DEOMASK); /* Read flags */ 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++])) return system_error("Init", "Failed to initialize uxn."); /* Game Loop */ diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -58,7 +58,6 @@ static SDL_Thread *stdin_thread; static int window_created = 0; static Uint32 stdin_event, audio0_event, zoom = 1; static Uint64 exec_deadline, deadline_interval, ms_interval; -static char *rom_path; Uint16 dev_vers[0x10], dei_mask[0x10], deo_mask[0x10]; @@ -271,9 +270,9 @@ static void emu_restart(Uxn *u) { screen_resize(WIDTH, HEIGHT); - SDL_SetWindowTitle(emu_window, rom_path); + SDL_SetWindowTitle(emu_window, boot_rom); if(!emu_start(u, "launcher.rom")) - emu_start(u, rom_path); + emu_start(u, boot_rom); } static int @@ -288,7 +287,7 @@ emu_restart_soft(Uxn *u) u->rst.ptr = 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); - if(!system_load(u, rom_path)) + if(!system_load(u, boot_rom)) return system_error("Boot", "Failed to load rom."); if(!uxn_eval(u, PAGE_PROGRAM)) 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); /* Read flags */ 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) set_zoom(argv[i++][1] - '0', 0); - rom_path = argv[i++]; if(!emu_init()) 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."); /* Game Loop */ u.dev[0x17] = argc - i; if(uxn_eval(&u, PAGE_PROGRAM)) { console_listen(&u, i, argc, argv); - emu_run(&u, rom_path); + emu_run(&u, boot_rom); } return emu_end(&u); }