(uxnemu) Only set zoom scale once on boot
This commit is contained in:
parent
6021b2b63d
commit
d1dc143912
10
README.md
10
README.md
|
@ -86,18 +86,20 @@ You can send events from Uxn to another application, or another instance of uxn,
|
||||||
uxnemu orca.rom | shim
|
uxnemu orca.rom | shim
|
||||||
```
|
```
|
||||||
|
|
||||||
## Emulator Options
|
## GUI Emulator Options
|
||||||
|
|
||||||
- `-s 1`, `-s 2` or `-s 3` set zoom (default 1)
|
- `-1x` Force small scale
|
||||||
|
- `-2x` Force medium scale
|
||||||
|
- `-3x` Force large scale
|
||||||
|
|
||||||
## Emulator Controls
|
## GUI Emulator Controls
|
||||||
|
|
||||||
- `F1` toggle zoom
|
- `F1` toggle zoom
|
||||||
- `F2` toggle debug
|
- `F2` toggle debug
|
||||||
- `F3` capture screen
|
- `F3` capture screen
|
||||||
- `F4` load launcher.rom
|
- `F4` load launcher.rom
|
||||||
|
|
||||||
### Buttons
|
### GUI Buttons
|
||||||
|
|
||||||
- `LCTRL` A
|
- `LCTRL` A
|
||||||
- `LALT` B
|
- `LALT` B
|
||||||
|
|
2
build.sh
2
build.sh
|
@ -117,6 +117,6 @@ echo "Assembling(piano).."
|
||||||
./bin/uxnasm projects/software/piano.tal bin/piano.rom
|
./bin/uxnasm projects/software/piano.tal bin/piano.rom
|
||||||
|
|
||||||
echo "Running.."
|
echo "Running.."
|
||||||
./bin/uxnemu bin/piano.rom
|
./bin/uxnemu -2x bin/piano.rom
|
||||||
|
|
||||||
echo "Done."
|
echo "Done."
|
||||||
|
|
|
@ -64,7 +64,7 @@ main(int argc, char **argv)
|
||||||
for(i = 2; i < argc; i++) {
|
for(i = 2; i < argc; i++) {
|
||||||
char *p = argv[i];
|
char *p = argv[i];
|
||||||
while(*p) console_input(&u, *p++, CONSOLE_ARG);
|
while(*p) console_input(&u, *p++, CONSOLE_ARG);
|
||||||
console_input(&u, '\n', i == argc-1 ? CONSOLE_END : CONSOLE_EOA);
|
console_input(&u, '\n', i == argc - 1 ? CONSOLE_END : CONSOLE_EOA);
|
||||||
}
|
}
|
||||||
while(!u.dev[0x0f]) {
|
while(!u.dev[0x0f]) {
|
||||||
int c = fgetc(stdin);
|
int c = fgetc(stdin);
|
||||||
|
|
24
src/uxnemu.c
24
src/uxnemu.c
|
@ -267,9 +267,9 @@ start(Uxn *u, char *rom)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_zoom(Uint8 scale)
|
set_zoom(Uint8 z)
|
||||||
{
|
{
|
||||||
zoom = zoom > 2 ? 1 : zoom + 1;
|
zoom = z;
|
||||||
set_window_size(gWindow, (uxn_screen.width + PAD * 2) * zoom, (uxn_screen.height + PAD * 2) * zoom);
|
set_window_size(gWindow, (uxn_screen.width + PAD * 2) * zoom, (uxn_screen.height + PAD * 2) * zoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ static void
|
||||||
do_shortcut(Uxn *u, SDL_Event *event)
|
do_shortcut(Uxn *u, SDL_Event *event)
|
||||||
{
|
{
|
||||||
if(event->key.keysym.sym == SDLK_F1)
|
if(event->key.keysym.sym == SDLK_F1)
|
||||||
set_zoom(zoom);
|
set_zoom(zoom == 3 ? 1 : zoom + 1);
|
||||||
else if(event->key.keysym.sym == SDLK_F2)
|
else if(event->key.keysym.sym == SDLK_F2)
|
||||||
system_inspect(u);
|
system_inspect(u);
|
||||||
else if(event->key.keysym.sym == SDLK_F3)
|
else if(event->key.keysym.sym == SDLK_F3)
|
||||||
|
@ -490,28 +490,24 @@ main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
SDL_DisplayMode DM;
|
SDL_DisplayMode DM;
|
||||||
Uxn u = {0};
|
Uxn u = {0};
|
||||||
int i, loaded = 0;
|
int i = 1, loaded = 0;
|
||||||
if(!init())
|
if(!init())
|
||||||
return error("Init", "Failed to initialize emulator.");
|
return error("Init", "Failed to initialize emulator.");
|
||||||
screen_resize(&uxn_screen, WIDTH, HEIGHT);
|
screen_resize(&uxn_screen, WIDTH, HEIGHT);
|
||||||
/* set default zoom */
|
/* set default zoom */
|
||||||
if(SDL_GetCurrentDisplayMode(0, &DM) == 0)
|
if(strcmp(argv[i], "-1x") == 0 || strcmp(argv[i], "-2x") == 0 || strcmp(argv[i], "-3x") == 0)
|
||||||
|
set_zoom(argv[i++][1] - '0');
|
||||||
|
else if(SDL_GetCurrentDisplayMode(0, &DM) == 0)
|
||||||
set_zoom(DM.w / 1280);
|
set_zoom(DM.w / 1280);
|
||||||
for(i = 1; i < argc; i++) {
|
for(; i < argc; i++) {
|
||||||
/* get default zoom from flags */
|
if(!loaded++) {
|
||||||
if(strcmp(argv[i], "-s") == 0) {
|
|
||||||
if(i < argc - 1)
|
|
||||||
set_zoom(atoi(argv[++i]));
|
|
||||||
else
|
|
||||||
return error("Opt", "-s No scale provided.");
|
|
||||||
} else if(!loaded++) {
|
|
||||||
if(!start(&u, argv[i]))
|
if(!start(&u, argv[i]))
|
||||||
return error("Boot", "Failed to boot.");
|
return error("Boot", "Failed to boot.");
|
||||||
rom_path = argv[i];
|
rom_path = argv[i];
|
||||||
} else {
|
} else {
|
||||||
char *p = argv[i];
|
char *p = argv[i];
|
||||||
while(*p) console_input(&u, *p++, CONSOLE_ARG);
|
while(*p) console_input(&u, *p++, CONSOLE_ARG);
|
||||||
console_input(&u, '\n', i == argc ? CONSOLE_END : CONSOLE_EOA);
|
console_input(&u, '\n', i == argc - 1 ? CONSOLE_END : CONSOLE_EOA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!loaded && !start(&u, "launcher.rom"))
|
if(!loaded && !start(&u, "launcher.rom"))
|
||||||
|
|
Loading…
Reference in New Issue