uxn

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

commit 72e23f0260a838287787b9cd330784fdbbef4769
parent d1dc14391271459e4c11f18115812c3b74569c15
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Mon, 17 Apr 2023 09:48:27 -0700

(uxnemu) Simplified boot sequence

Diffstat:
Msrc/uxnemu.c | 26+++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -490,29 +490,29 @@ main(int argc, char **argv) { SDL_DisplayMode DM; Uxn u = {0}; - int i = 1, loaded = 0; + int i = 1; if(!init()) return error("Init", "Failed to initialize emulator."); + /* default resolution */ screen_resize(&uxn_screen, WIDTH, HEIGHT); - /* set default zoom */ + /* default zoom */ if(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); + /* load rom */ + if(!start(&u, argv[i])) + return error("usage", "uxnemu [-s scale] file.rom"); + rom_path = argv[i++]; + /* read arguments */ for(; i < argc; i++) { - if(!loaded++) { - if(!start(&u, argv[i])) - return error("Boot", "Failed to boot."); - rom_path = argv[i]; - } else { - char *p = argv[i]; - while(*p) console_input(&u, *p++, CONSOLE_ARG); - console_input(&u, '\n', i == argc - 1 ? CONSOLE_END : CONSOLE_EOA); - } + char *p = argv[i]; + while(*p) console_input(&u, *p++, CONSOLE_ARG); + console_input(&u, '\n', i == argc - 1 ? CONSOLE_END : CONSOLE_EOA); } - if(!loaded && !start(&u, "launcher.rom")) - return error("usage", "uxnemu [-s scale] file.rom"); + /* start rom */ run(&u); + /* finished */ #ifdef _WIN32 #pragma GCC diagnostic ignored "-Wint-to-pointer-cast" TerminateThread((HANDLE)SDL_GetThreadID(stdin_thread), 0);