Resize emulator on start

This commit is contained in:
Devine Lu Linvega 2023-07-25 14:46:37 -07:00
parent 4286e0ba53
commit db2117ee0a
1 changed files with 4 additions and 5 deletions

View File

@ -246,6 +246,7 @@ emu_start(Uxn *u, char *rom, int queue)
return system_error("Boot", "Failed to load rom."); return system_error("Boot", "Failed to load rom.");
u->dev[0x17] = queue; u->dev[0x17] = queue;
exec_deadline = SDL_GetPerformanceCounter() + deadline_interval; exec_deadline = SDL_GetPerformanceCounter() + deadline_interval;
screen_resize(WIDTH, HEIGHT);
if(!uxn_eval(u, PAGE_PROGRAM)) if(!uxn_eval(u, PAGE_PROGRAM))
return system_error("Boot", "Failed to eval rom."); return system_error("Boot", "Failed to eval rom.");
SDL_SetWindowTitle(emu_window, rom); SDL_SetWindowTitle(emu_window, rom);
@ -495,14 +496,12 @@ main(int argc, char **argv)
int i = 1; int i = 1;
if(!emu_init()) if(!emu_init())
return system_error("Init", "Failed to initialize emulator."); return system_error("Init", "Failed to initialize emulator.");
/* default resolution */
screen_resize(WIDTH, HEIGHT);
/* default zoom */ /* default zoom */
if(argc > 1 && (strcmp(argv[i], "-1x") == 0 || strcmp(argv[i], "-2x") == 0 || strcmp(argv[i], "-3x") == 0)) if(argc < 2)
return system_error("usage", "uxnemu [-2x][-3x] file.rom [args...]");
if(strcmp(argv[i], "-2x") == 0 || strcmp(argv[i], "-3x") == 0)
set_zoom(argv[i++][1] - '0', 0); set_zoom(argv[i++][1] - '0', 0);
/* load rom */ /* load rom */
if(i == argc)
return system_error("usage", "uxnemu [-2x][-3x] file.rom [args...]");
rom_path = argv[i++]; rom_path = argv[i++];
if(!emu_start(&u, rom_path, argc - i)) if(!emu_start(&u, rom_path, argc - i))
return system_error("Start", "Failed"); return system_error("Start", "Failed");