Added soft reboot
This commit is contained in:
parent
a394dcb999
commit
de7b24e820
|
@ -88,7 +88,6 @@ uxnemu orca.rom | shim
|
|||
|
||||
## GUI Emulator Options
|
||||
|
||||
- `-1x` Force small scale
|
||||
- `-2x` Force medium scale
|
||||
- `-3x` Force large scale
|
||||
|
||||
|
@ -97,7 +96,8 @@ uxnemu orca.rom | shim
|
|||
- `F1` toggle zoom
|
||||
- `F2` toggle debug
|
||||
- `F3` capture screen
|
||||
- `F4` load launcher.rom
|
||||
- `F4` reboot
|
||||
- `F5` soft reboot
|
||||
|
||||
### GUI Buttons
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ screen_change(Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2)
|
|||
if(y2 > uxn_screen.y2) uxn_screen.y2 = y2;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
screen_fill(Uint8 *layer, int x1, int y1, int x2, int y2, int color)
|
||||
{
|
||||
int x, y, width = uxn_screen.width, height = uxn_screen.height;
|
||||
|
|
|
@ -22,6 +22,7 @@ typedef struct UxnScreen {
|
|||
extern UxnScreen uxn_screen;
|
||||
extern int emu_resize(int width, int height);
|
||||
|
||||
void screen_fill(Uint8 *layer, int x1, int y1, int x2, int y2, int color);
|
||||
void screen_palette(Uint8 *addr);
|
||||
void screen_resize(Uint16 width, Uint16 height);
|
||||
void screen_change(Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2);
|
||||
|
|
17
src/uxnemu.c
17
src/uxnemu.c
|
@ -279,6 +279,21 @@ emu_restart(Uxn *u)
|
|||
emu_start(u, rom_path, 0);
|
||||
}
|
||||
|
||||
static int
|
||||
emu_restart_soft(Uxn *u)
|
||||
{
|
||||
int i;
|
||||
for(i = 0x100; i < 0x10000; i++)
|
||||
u->ram[i] = 0;
|
||||
screen_fill(uxn_screen.bg, 0, 0, uxn_screen.width, uxn_screen.height, 0);
|
||||
screen_fill(uxn_screen.fg, 0, 0, uxn_screen.width, uxn_screen.height, 0);
|
||||
if(!system_load(u, rom_path))
|
||||
return system_error("Boot", "Failed to load rom.");
|
||||
if(!uxn_eval(u, PAGE_PROGRAM))
|
||||
return system_error("Boot", "Failed to eval rom.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
capture_screen(void)
|
||||
{
|
||||
|
@ -402,6 +417,8 @@ handle_events(Uxn *u)
|
|||
capture_screen();
|
||||
else if(event.key.keysym.sym == SDLK_F4)
|
||||
emu_restart(u);
|
||||
else if(event.key.keysym.sym == SDLK_F5)
|
||||
emu_restart_soft(u);
|
||||
ksym = event.key.keysym.sym;
|
||||
if(SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_KEYUP, SDL_KEYUP) == 1 && ksym == event.key.keysym.sym)
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue