uxn

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

commit 1bf0ffc5e54f98520de14db54dc6a1236c3739f7
parent 453f49191817294989d7bbd7a02a4b8c47bfdae0
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Mon, 17 Apr 2023 10:29:39 -0700

(uxnemu) Display usage when no roms and no params

Diffstat:
Msrc/uxncli.c | 2++
Msrc/uxnemu.c | 6++++--
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/uxncli.c b/src/uxncli.c @@ -59,6 +59,8 @@ main(int argc, char **argv) return emu_error("Boot", "Failed"); if(!system_load(&u, argv[i++])) return emu_error("Load", "Failed"); + if(i == argc) + u.dev[0x17] = CONSOLE_END; if(!uxn_eval(&u, PAGE_PROGRAM)) return u.dev[0x0f] & 0x7f; for(; i < argc; i++) { diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -496,13 +496,15 @@ main(int argc, char **argv) /* default resolution */ screen_resize(&uxn_screen, WIDTH, HEIGHT); /* default zoom */ - if(strcmp(argv[i], "-1x") == 0 || strcmp(argv[i], "-2x") == 0 || strcmp(argv[i], "-3x") == 0) + if(argc > 1 && (strcmp(argv[i], "-1x") == 0 || strcmp(argv[i], "-2x") == 0 || strcmp(argv[i], "-3x") == 0)) set_zoom(argv[i++][1] - '0'); else if(SDL_GetCurrentDisplayMode(0, &DM) == 0) set_zoom(DM.w / 1280); + if(i == argc) + return error("usage", "uxnemu [-2x][-3x] file.rom"); /* load rom */ if(!start(&u, argv[i])) - return error("usage", "uxnemu [-2x][-3x] file.rom"); + return error("Start", "Failed"); rom_path = argv[i++]; /* read arguments */ for(; i < argc; i++) {