| ... | ... |
@@ -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); |