Fixed occasional flicker when changing video mode with F9. (Fixes #611)

This commit is contained in:
tomcw 2019-03-16 14:27:40 +00:00
parent b87ebb7514
commit 8c7d45bd8e
5 changed files with 9 additions and 7 deletions

View File

@ -1295,7 +1295,8 @@ LRESULT CALLBACK FrameWndProc (
// TODO: Clean up code:FrameRefreshStatus(DRAW_TITLE) DrawStatusArea((HDC)0,DRAW_TITLE)
DrawStatusArea( (HDC)0, DRAW_TITLE );
VideoReinitialize();
VideoReinitialize(false);
if (g_nAppMode != MODE_LOGO)
{
if (g_nAppMode == MODE_DEBUG)

View File

@ -2120,14 +2120,15 @@ void NTSC_VideoInit( uint8_t* pFramebuffer ) // wsVideoInit
}
//===========================================================================
void NTSC_VideoReinitialize( DWORD cyclesThisFrame )
void NTSC_VideoReinitialize( DWORD cyclesThisFrame, bool bInitVideoScannerAddress )
{
_ASSERT(cyclesThisFrame < VIDEO_SCANNER_6502_CYCLES);
if (cyclesThisFrame >= VIDEO_SCANNER_6502_CYCLES) cyclesThisFrame = 0; // error
g_nVideoClockVert = (uint16_t) (cyclesThisFrame / VIDEO_SCANNER_MAX_HORZ);
g_nVideoClockHorz = cyclesThisFrame % VIDEO_SCANNER_MAX_HORZ;
updateVideoScannerAddress(); // Pre-condition: g_nVideoClockVert
if (bInitVideoScannerAddress) // GH#611
updateVideoScannerAddress(); // Pre-condition: g_nVideoClockVert
}
//===========================================================================

View File

@ -11,7 +11,7 @@
extern void NTSC_VideoClockResync( const DWORD dwCyclesThisFrame );
extern uint16_t NTSC_VideoGetScannerAddress( const ULONG uExecutedCycles );
extern void NTSC_VideoInit( uint8_t *pFramebuffer );
extern void NTSC_VideoReinitialize( DWORD cyclesThisFrame );
extern void NTSC_VideoReinitialize( DWORD cyclesThisFrame, bool bInitVideoScannerAddress );
extern void NTSC_VideoInitAppleType();
extern void NTSC_VideoInitChroma();
extern void NTSC_VideoUpdateCycles( long cycles6502 );

View File

@ -625,9 +625,9 @@ void VideoRefreshScreen ( uint32_t uRedrawWholeScreenVideoMode /* =0*/, bool bRe
}
//===========================================================================
void VideoReinitialize ()
void VideoReinitialize (bool bInitVideoScannerAddress /*= true*/)
{
NTSC_VideoReinitialize( g_dwCyclesThisFrame );
NTSC_VideoReinitialize( g_dwCyclesThisFrame, bInitVideoScannerAddress );
NTSC_VideoInitAppleType();
NTSC_SetVideoStyle();
NTSC_SetVideoTextMode( g_uVideoMode & VF_80COL ? 80 : 40 );

View File

@ -177,7 +177,7 @@ void VideoRedrawScreenDuringFullSpeed(DWORD dwCyclesThisFrame, bool bInit = f
void VideoRedrawScreenAfterFullSpeed(DWORD dwCyclesThisFrame);
void VideoRedrawScreen (void);
void VideoRefreshScreen (uint32_t uRedrawWholeScreenVideoMode = 0, bool bRedrawWholeScreen = false);
void VideoReinitialize ();
void VideoReinitialize (bool bInitVideoScannerAddress = true);
void VideoResetState ();
enum VideoScanner_e {VS_FullAddr, VS_PartialAddrV, VS_PartialAddrH};
WORD VideoGetScannerAddress(DWORD nCycles, VideoScanner_e videoScannerAddr = VS_FullAddr);