static bool isthreadedvsync (void) { return isvsync_chipset () <= -2 || isvsync_rtg () < 0; }
static bool event_check_vsync(void) { /* Keep only CPU emulation running while waiting for sync point. */ if (is_syncline == -1) { if (!isvsync_chipset()) { events_reset_syncline(); return false; } // wait for vblank audio_finish_pull(); int done = vsync_isdone(NULL); if (done == -2) { // if no vsync thread int vp = target_get_display_scanline(-1); if (vp < is_syncline_end) done = 1; else if (vp > is_syncline_end) is_syncline_end = vp; } if (!done) { #ifdef WITH_PPC if (ppc_state) { uae_ppc_execute_quick(); } #endif if (currprefs.cachesize) pissoff = pissoff_value; else pissoff = pissoff_nojit_value; return true; } vsync_clear(); vsync_event_done(); } else if (is_syncline == -2) { if (!isvsync_chipset()) { events_reset_syncline(); return false; } // wait for vblank or early vblank audio_finish_pull(); int done = vsync_isdone(NULL); if (done == -2) done = 0; int vp = target_get_display_scanline(-1); if (vp < 0 || vp >= is_syncline_end) done = 1; if (!done) { #ifdef WITH_PPC if (ppc_state) { uae_ppc_execute_quick(); } #endif if (currprefs.cachesize) pissoff = pissoff_value; else pissoff = pissoff_nojit_value; return true; } vsync_clear(); vsync_event_done(); } else if (is_syncline == -3) { if (!isvsync_chipset()) { events_reset_syncline(); return false; } // not vblank audio_finish_pull(); int vp = target_get_display_scanline(-1); if (vp <= 0) { #ifdef WITH_PPC if (ppc_state) { uae_ppc_execute_quick(); } #endif if (currprefs.cachesize) pissoff = pissoff_value; else pissoff = pissoff_nojit_value; return true; } vsync_clear(); vsync_event_done(); } else if (is_syncline > 0) { if (!isvsync_chipset()) { events_reset_syncline(); return false; } audio_finish_pull(); // wait for specific scanline int vp = target_get_display_scanline(-1); if (vp < 0 || is_syncline > vp) { #ifdef WITH_PPC if (ppc_state) { uae_ppc_execute_check(); } #endif if (currprefs.cachesize) pissoff = pissoff_value; else pissoff = pissoff_nojit_value; return true; } vsync_event_done(); } else if (is_syncline <= -100) { if (!isvsync_chipset()) { events_reset_syncline(); return false; } audio_finish_pull(); // wait for specific scanline int vp = target_get_display_scanline(-1); if (vp < 0 || vp >= (-(is_syncline + 100))) { #ifdef WITH_PPC if (ppc_state) { uae_ppc_execute_check(); } #endif if (currprefs.cachesize) pissoff = pissoff_value; else pissoff = pissoff_nojit_value; return true; } vsync_event_done(); } else if (is_syncline == -10) { // wait is_syncline_end if (event_wait) { int rpt = read_processor_time(); int v = rpt - is_syncline_end; if (v < 0) { #ifdef WITH_PPC if (ppc_state) { uae_ppc_execute_check(); } #endif if (currprefs.cachesize) pissoff = pissoff_value; else pissoff = pissoff_nojit_value; return true; } } events_reset_syncline(); } else if (is_syncline < -10) { // wait is_syncline_end/vsyncmintime if (event_wait) { int rpt = read_processor_time(); int v = rpt - vsyncmintime; int v2 = rpt - is_syncline_end; if (v > vsynctimebase || v < -vsynctimebase) { v = 0; } if (v < 0 && v2 < 0) { #ifdef WITH_PPC if (ppc_state) { if (is_syncline == -11) { uae_ppc_execute_check(); } else { uae_ppc_execute_quick(); } } #endif if (currprefs.cachesize) pissoff = pissoff_value; else pissoff = pissoff_nojit_value; return true; } } events_reset_syncline(); } return false; }