From 9a882a64c770930ee6e0a74a366aaab95b753b92 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Mon, 17 Apr 2023 10:41:03 -0700 Subject: [PATCH] (uxnemu) Write arguments end in console device --- src/devices/system.c | 2 ++ src/devices/system.h | 2 +- src/uxncli.c | 2 +- src/uxnemu.c | 4 +++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/devices/system.c b/src/devices/system.c index edb6e5d..d5794d2 100644 --- a/src/devices/system.c +++ b/src/devices/system.c @@ -102,6 +102,8 @@ uxn_halt(Uxn *u, Uint8 instr, Uint8 err, Uint16 addr) return 0; } +/* Console */ + int console_input(Uxn *u, char c, int type) { diff --git a/src/devices/system.h b/src/devices/system.h index 15b36bb..40c67a9 100644 --- a/src/devices/system.h +++ b/src/devices/system.h @@ -20,4 +20,4 @@ int system_load(Uxn *u, char *filename); void system_inspect(Uxn *u); void system_deo(Uxn *u, Uint8 *d, Uint8 port); int console_input(Uxn *u, char c, int type); -void console_deo(Uint8 *d, Uint8 port); \ No newline at end of file +void console_deo(Uint8 *d, Uint8 port); diff --git a/src/uxncli.c b/src/uxncli.c index d014356..6788083 100644 --- a/src/uxncli.c +++ b/src/uxncli.c @@ -53,7 +53,7 @@ main(int argc, char **argv) { Uxn u; int i = 1; - if(argc < 2) + if(i == argc) return emu_error("Usage", "uxncli game.rom args"); if(!uxn_boot(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)))) return emu_error("Boot", "Failed"); diff --git a/src/uxnemu.c b/src/uxnemu.c index 5427dd8..e1a44db 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -500,9 +500,11 @@ main(int argc, char **argv) set_zoom(argv[i++][1] - '0'); else if(SDL_GetCurrentDisplayMode(0, &DM) == 0) set_zoom(DM.w / 1280); + /* load rom */ if(i == argc) return error("usage", "uxnemu [-2x][-3x] file.rom"); - /* load rom */ + if(i == argc - 1) + u.dev[0x17] = CONSOLE_END; if(!start(&u, argv[i])) return error("Start", "Failed"); rom_path = argv[i++];