Skip to content

Commit 8c7d45b

Browse files
committed
Fixed occasional flicker when changing video mode with F9. (Fixes AppleWin#611)
1 parent b87ebb7 commit 8c7d45b

5 files changed

Lines changed: 9 additions & 7 deletions

File tree

source/Frame.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1295,7 +1295,8 @@ LRESULT CALLBACK FrameWndProc (
12951295
// TODO: Clean up code:FrameRefreshStatus(DRAW_TITLE) DrawStatusArea((HDC)0,DRAW_TITLE)
12961296
DrawStatusArea( (HDC)0, DRAW_TITLE );
12971297

1298-
VideoReinitialize();
1298+
VideoReinitialize(false);
1299+
12991300
if (g_nAppMode != MODE_LOGO)
13001301
{
13011302
if (g_nAppMode == MODE_DEBUG)

source/NTSC.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2120,14 +2120,15 @@ void NTSC_VideoInit( uint8_t* pFramebuffer ) // wsVideoInit
21202120
}
21212121

21222122
//===========================================================================
2123-
void NTSC_VideoReinitialize( DWORD cyclesThisFrame )
2123+
void NTSC_VideoReinitialize( DWORD cyclesThisFrame, bool bInitVideoScannerAddress )
21242124
{
21252125
_ASSERT(cyclesThisFrame < VIDEO_SCANNER_6502_CYCLES);
21262126
if (cyclesThisFrame >= VIDEO_SCANNER_6502_CYCLES) cyclesThisFrame = 0; // error
21272127
g_nVideoClockVert = (uint16_t) (cyclesThisFrame / VIDEO_SCANNER_MAX_HORZ);
21282128
g_nVideoClockHorz = cyclesThisFrame % VIDEO_SCANNER_MAX_HORZ;
21292129

2130-
updateVideoScannerAddress(); // Pre-condition: g_nVideoClockVert
2130+
if (bInitVideoScannerAddress) // GH#611
2131+
updateVideoScannerAddress(); // Pre-condition: g_nVideoClockVert
21312132
}
21322133

21332134
//===========================================================================

source/NTSC.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
extern void NTSC_VideoClockResync( const DWORD dwCyclesThisFrame );
1212
extern uint16_t NTSC_VideoGetScannerAddress( const ULONG uExecutedCycles );
1313
extern void NTSC_VideoInit( uint8_t *pFramebuffer );
14-
extern void NTSC_VideoReinitialize( DWORD cyclesThisFrame );
14+
extern void NTSC_VideoReinitialize( DWORD cyclesThisFrame, bool bInitVideoScannerAddress );
1515
extern void NTSC_VideoInitAppleType();
1616
extern void NTSC_VideoInitChroma();
1717
extern void NTSC_VideoUpdateCycles( long cycles6502 );

source/Video.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,9 +625,9 @@ void VideoRefreshScreen ( uint32_t uRedrawWholeScreenVideoMode /* =0*/, bool bRe
625625
}
626626

627627
//===========================================================================
628-
void VideoReinitialize ()
628+
void VideoReinitialize (bool bInitVideoScannerAddress /*= true*/)
629629
{
630-
NTSC_VideoReinitialize( g_dwCyclesThisFrame );
630+
NTSC_VideoReinitialize( g_dwCyclesThisFrame, bInitVideoScannerAddress );
631631
NTSC_VideoInitAppleType();
632632
NTSC_SetVideoStyle();
633633
NTSC_SetVideoTextMode( g_uVideoMode & VF_80COL ? 80 : 40 );

source/Video.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ void VideoRedrawScreenDuringFullSpeed(DWORD dwCyclesThisFrame, bool bInit = f
177177
void VideoRedrawScreenAfterFullSpeed(DWORD dwCyclesThisFrame);
178178
void VideoRedrawScreen (void);
179179
void VideoRefreshScreen (uint32_t uRedrawWholeScreenVideoMode = 0, bool bRedrawWholeScreen = false);
180-
void VideoReinitialize ();
180+
void VideoReinitialize (bool bInitVideoScannerAddress = true);
181181
void VideoResetState ();
182182
enum VideoScanner_e {VS_FullAddr, VS_PartialAddrV, VS_PartialAddrH};
183183
WORD VideoGetScannerAddress(DWORD nCycles, VideoScanner_e videoScannerAddr = VS_FullAddr);

0 commit comments

Comments
 (0)