Added scale (-s) flag

This commit is contained in:
Hannah Crawford 2021-09-21 21:22:58 +01:00 committed by Andrew Alderwick
parent 753c5836e6
commit 8b83ae7e38
2 changed files with 22 additions and 5 deletions

View File

@ -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

View File

@ -577,16 +577,29 @@ int
main(int argc, char **argv)
{
Uxn u;
int i;
if(argc < 2) return error("usage", "uxnemu file.rom");
if(!uxn_boot(&u)) return error("Boot", "Failed to start uxn.");
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);
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.");
if(!init()) return error("Init", "Failed to initialize emulator.");
/* system */ devsystem = uxn_port(&u, 0x0, system_talk);
/* console */ devconsole = uxn_port(&u, 0x1, console_talk);
/* screen */ devscreen = uxn_port(&u, 0x2, screen_talk);