uxn

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

commit 8b83ae7e38bb36ccb6fa28f8b3a0b99e283ae293
parent 753c5836e6604d31dbe5bec295cd4cef51d2fce8
Author: Hannah Crawford <hannah@embyr.sh>
Date:   Tue, 21 Sep 2021 21:22:58 +0100

Added scale (-s) flag

Diffstat:
MREADME.md | 4++++
Msrc/uxnemu.c | 23++++++++++++++++++-----
2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md @@ -78,6 +78,10 @@ You can send events from Uxn to another application, or another instance of uxn, uxnemu orca.rom | shim ``` +## Emulator Options + +- `-s 1`, `-s 2` or `-s 3` set zoom (default 1) + ## Emulator Controls - `F1` toggle zoom diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -577,16 +577,29 @@ int main(int argc, char **argv) { Uxn u; - - stdin_event = SDL_RegisterEvents(1); - audio0_event = SDL_RegisterEvents(POLYPHONY); - SDL_CreateThread(stdin_handler, "stdin", NULL); + int i; if(argc < 2) return error("usage", "uxnemu file.rom"); if(!uxn_boot(&u)) return error("Boot", "Failed to start uxn."); - if(!load(&u, argv[1])) return error("Load", "Failed to open rom."); + + for(i = 1; i < argc - 1; i++) { + if(strcmp(argv[i], "-s") == 0) { + if((i + 1) < argc - 1) { + zoom = atoi(argv[++i]); + if(zoom < 1 || zoom > 3) return error("Opt", "-s Scale must be between 1 and 3."); + } else { + return error("Opt", "-s No scale provided."); + } + } + } + + if(!load(&u, argv[argc - 1])) return error("Load", "Failed to open rom."); if(!init()) return error("Init", "Failed to initialize emulator."); + stdin_event = SDL_RegisterEvents(1); + audio0_event = SDL_RegisterEvents(POLYPHONY); + SDL_CreateThread(stdin_handler, "stdin", NULL); + /* system */ devsystem = uxn_port(&u, 0x0, system_talk); /* console */ devconsole = uxn_port(&u, 0x1, console_talk); /* screen */ devscreen = uxn_port(&u, 0x2, screen_talk);