For full-speed: update every 16ms of real-time (close #351)

This commit is contained in:
tomcw 2016-09-22 22:34:16 +01:00
parent 626965109a
commit 30160583cb
3 changed files with 15 additions and 4 deletions

View File

@ -232,6 +232,9 @@ void ContinueExecution(void)
if (g_bFullSpeed) if (g_bFullSpeed)
{ {
if (!bWasFullSpeed)
VideoRedrawScreenDuringFullSpeed(0, true); // Init for full-speed mode
// Don't call Spkr_Mute() - will get speaker clicks // Don't call Spkr_Mute() - will get speaker clicks
MB_Mute(); MB_Mute();
SysClk_StopTimer(); SysClk_StopTimer();
@ -249,7 +252,6 @@ void ContinueExecution(void)
{ {
if (bWasFullSpeed) if (bWasFullSpeed)
{ {
VideoRedrawScreenDuringFullSpeed(0, true); // Invalidate the copies of video memory
VideoRedrawScreenAfterFullSpeed(g_dwCyclesThisFrame); VideoRedrawScreenAfterFullSpeed(g_dwCyclesThisFrame);
} }

View File

@ -1052,16 +1052,25 @@ void VideoDisplayLogo ()
// . 10s only update if HIRES changes (17s for Debug build) // . 10s only update if HIRES changes (17s for Debug build)
// . ~9s no update during full-speed (but IBIZA.DSK doesn't show anything!) // . ~9s no update during full-speed (but IBIZA.DSK doesn't show anything!)
void VideoRedrawScreenDuringFullSpeed(DWORD dwCyclesThisFrame, bool bInvalidate /*=false*/) void VideoRedrawScreenDuringFullSpeed(DWORD dwCyclesThisFrame, bool bInit /*=false*/)
{ {
static DWORD dwFullSpeedStartTime = 0;
static bool bValid = false; static bool bValid = false;
if (bInvalidate) if (bInit)
{ {
// Just entered full-speed mode
bValid = false; bValid = false;
dwFullSpeedStartTime = GetTickCount();
return; return;
} }
DWORD dwFullSpeedDuration = GetTickCount() - dwFullSpeedStartTime;
if (dwFullSpeedDuration <= 16) // Only update after every realtime ~17ms of *continuous* full-speed
return;
dwFullSpeedStartTime += dwFullSpeedDuration;
// //
static BYTE text_main[1024*2] = {0}; // page1 & 2 static BYTE text_main[1024*2] = {0}; // page1 & 2

View File

@ -169,7 +169,7 @@ void VideoDestroy ();
void VideoDisplayLogo (); void VideoDisplayLogo ();
void VideoInitialize (); void VideoInitialize ();
void VideoRealizePalette (HDC); void VideoRealizePalette (HDC);
void VideoRedrawScreenDuringFullSpeed(DWORD dwCyclesThisFrame, bool bInvalidate = false); void VideoRedrawScreenDuringFullSpeed(DWORD dwCyclesThisFrame, bool bInit = false);
void VideoRedrawScreenAfterFullSpeed(DWORD dwCyclesThisFrame); void VideoRedrawScreenAfterFullSpeed(DWORD dwCyclesThisFrame);
void VideoRedrawScreen (UINT uDelayRefresh = 0); void VideoRedrawScreen (UINT uDelayRefresh = 0);
void VideoRefreshScreen (int bVideoFlags, UINT uDelayRefresh =0 ); void VideoRefreshScreen (int bVideoFlags, UINT uDelayRefresh =0 );