diff --git a/targets/mega65/configdb.c b/targets/mega65/configdb.c index 763779dd..e3efd338 100644 --- a/targets/mega65/configdb.c +++ b/targets/mega65/configdb.c @@ -111,6 +111,7 @@ static const struct xemutools_configdef_switch_st switch_options[] = { { "curskeyjoy", "Cursor keys as joystick [makes your emulator unsable to move cursor in BASIC/etc!]", &hid_joy_on_cursor_keys }, { "showscanlines", "Show scanlines in V200 modes", &configdb.show_scanlines }, { "allowscanlines", "Allow user programs to control scanline visibility", &configdb.allow_scanlines }, + { "fastboot", "Try to use sleepless emulation mode during booting", &configdb.fastboot }, { NULL } }; diff --git a/targets/mega65/configdb.h b/targets/mega65/configdb.h index ed0d58f1..415d8f4b 100644 --- a/targets/mega65/configdb.h +++ b/targets/mega65/configdb.h @@ -108,6 +108,7 @@ struct configdb_st { int noopl3; int sidmask; int audiobuffersize; + int fastboot; }; extern struct configdb_st configdb; diff --git a/targets/mega65/hypervisor.c b/targets/mega65/hypervisor.c index bde1d4a1..aa2a96e6 100644 --- a/targets/mega65/hypervisor.c +++ b/targets/mega65/hypervisor.c @@ -288,6 +288,7 @@ static inline void first_leave ( void ) vic4_set_videostd(configdb.videostd, "in hypervisor.c, requested as boot/reset default"); // OK, that's enough hdos_notify_system_start_end(); + xemu_sleepless_temporary_mode(0); // turn off temporary sleepless mode which may have been enabled before DEBUGPRINT("HYPERVISOR: first return after RESET, end of processing workarounds." NL); } diff --git a/targets/mega65/mega65.c b/targets/mega65/mega65.c index 5556535d..b56a8ece 100644 --- a/targets/mega65/mega65.c +++ b/targets/mega65/mega65.c @@ -830,6 +830,7 @@ int main ( int argc, char **argv ) configdb.umon = XUMON_DEFAULT_PORT; xumon_init(configdb.umon); #endif + xemu_sleepless_temporary_mode(configdb.fastboot); if (configdb.prg) { inject_register_prg(configdb.prg, configdb.prgmode); } else { diff --git a/xemu/emutools.c b/xemu/emutools.c index 425e512f..3378935b 100644 --- a/xemu/emutools.c +++ b/xemu/emutools.c @@ -1236,6 +1236,26 @@ void xemu_timekeeping_start ( void ) } +void xemu_sleepless_temporary_mode ( const int enable ) +{ + static int enabled = 0; + if ((enable && enabled) || (!enable && !enabled)) + return; + enabled = enable; + static int sleepless_old = 0; + if (enable) { + DEBUGPRINT("TIMING: enabling temporary sleepless mode: %s" NL, emu_is_sleepless ? "already sleepless" : "OK"); + sleepless_old = emu_is_sleepless; + emu_is_sleepless = 1; + } else { + DEBUGPRINT("TIMING: disabling temporary sleepless mode: %s" NL, sleepless_old ? "constant sleepless" : "OK"); + emu_is_sleepless = sleepless_old; + if (!emu_is_sleepless) + xemu_timekeeping_start(); + } +} + + void xemu_render_dummy_frame ( Uint32 colour, int texture_x_size, int texture_y_size ) { int tail; diff --git a/xemu/emutools.h b/xemu/emutools.h index 15f534ac..845e7211 100644 --- a/xemu/emutools.h +++ b/xemu/emutools.h @@ -209,6 +209,7 @@ extern int xemu_post_init ( ); extern int xemu_set_icon_from_xpm ( char *xpm[] ); extern void xemu_timekeeping_start ( void ); +extern void xemu_sleepless_temporary_mode ( const int enable ); extern void xemu_render_dummy_frame ( Uint32 colour, int texture_x_size, int texture_y_size ); extern Uint32 *xemu_start_pixel_buffer_access ( int *texture_tail ); extern void xemu_update_screen ( void );