void mainloop(const bool &Exit) { unsigned char skipped = 0; for (;!Exit;) { if (skipped < temp.frameskip) { skipped++; temp.vidblock = 1; } else skipped = temp.vidblock = 0; if (!temp.vidblock) flip(); for (unsigned f = rsm.needframes[rsm.frame]; f; f--) { temp.sndblock = !conf.sound.enabled; temp.inputblock = temp.vidblock && conf.sound.enabled; spectrum_frame(); VideoSaver(); // message handling before flip (they paint to rbuf) if (!temp.inputblock) { dispatch(conf.atm.xt_kbd ? ac_main_xt : ac_main); } if (!temp.sndblock) { do_sound(); Vs1001.Play(); } if (rsm.mix_frames > 1) { memcpy(rbuf_s + rsm.rbuf_dst * rb2_offs, rbuf, temp.scx * temp.scy / 4); if (++rsm.rbuf_dst == rsm.mix_frames) rsm.rbuf_dst = 0; } if (!temp.sndblock) { /* if(conf.sound.do_sound == do_sound_none) do_idle(); */ } } if (++rsm.frame == rsm.period) rsm.frame = 0; } correct_exit(); }
static void spectrum_frame_event_fn( libspectrum_dword last_tstates, int type, void *user_data ) { if( rzx_playback ) event_force_events(); rzx_frame(); psg_frame(); spectrum_frame(); z80_interrupt(); ui_joystick_poll(); timer_estimate_speed(); debugger_add_time_events(); ui_event(); ui_error_frame(); }