Browse code

Added scale (-s) flag

Hannah Crawford authored on 21/09/2021 20:22:58 • Andrew Alderwick committed on 21/09/2021 20:27:45
Showing 2 changed files
... ...
@@ -78,6 +78,10 @@ You can send events from Uxn to another application, or another instance of uxn,
78 78
 uxnemu orca.rom | shim
79 79
 ```
80 80
 
81
+## Emulator Options
82
+
83
+- `-s 1`, `-s 2` or `-s 3` set zoom (default 1)
84
+
81 85
 ## Emulator Controls
82 86
 
83 87
 - `F1` toggle zoom
... ...
@@ -577,16 +577,29 @@ int
577 577
 main(int argc, char **argv)
578 578
 {
579 579
 	Uxn u;
580
-
581
-	stdin_event = SDL_RegisterEvents(1);
582
-	audio0_event = SDL_RegisterEvents(POLYPHONY);
583
-	SDL_CreateThread(stdin_handler, "stdin", NULL);
580
+	int i;
584 581
 
585 582
 	if(argc < 2) return error("usage", "uxnemu file.rom");
586 583
 	if(!uxn_boot(&u)) return error("Boot", "Failed to start uxn.");
587
-	if(!load(&u, argv[1])) return error("Load", "Failed to open rom.");
584
+
585
+	for(i = 1; i < argc - 1; i++) {
586
+		if(strcmp(argv[i], "-s") == 0) {
587
+			if((i + 1) < argc - 1) {
588
+				zoom = atoi(argv[++i]);
589
+				if(zoom < 1 || zoom > 3) return error("Opt", "-s Scale must be between 1 and 3.");
590
+			} else {
591
+				return error("Opt", "-s No scale provided.");
592
+			}
593
+		}
594
+	}
595
+
596
+	if(!load(&u, argv[argc - 1])) return error("Load", "Failed to open rom.");
588 597
 	if(!init()) return error("Init", "Failed to initialize emulator.");
589 598
 
599
+	stdin_event = SDL_RegisterEvents(1);
600
+	audio0_event = SDL_RegisterEvents(POLYPHONY);
601
+	SDL_CreateThread(stdin_handler, "stdin", NULL);
602
+
590 603
 	/* system   */ devsystem = uxn_port(&u, 0x0, system_talk);
591 604
 	/* console  */ devconsole = uxn_port(&u, 0x1, console_talk);
592 605
 	/* screen   */ devscreen = uxn_port(&u, 0x2, screen_talk);