Added NTSC_Reinitialize() to re-init NTSC state after loading a save-state file

This commit is contained in:
tomcw
2016-04-05 22:17:29 +01:00
parent 7ccf722200
commit 9adbb1e8e6
4 changed files with 20 additions and 18 deletions
+12 -7
View File
@@ -1672,7 +1672,18 @@ void NTSC_VideoInit( uint8_t* pFramebuffer ) // wsVideoInit
}
//===========================================================================
void NTSC_VideoInitAppleType ( DWORD cyclesThisFrame )
void NTSC_VideoReinitialize( DWORD cyclesThisFrame )
{
_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
}
//===========================================================================
void NTSC_VideoInitAppleType ()
{
int model = g_Apple2Type;
@@ -1681,12 +1692,6 @@ void NTSC_VideoInitAppleType ( DWORD cyclesThisFrame )
g_pHorzClockOffset = APPLE_IIE_HORZ_CLOCK_OFFSET;
else
g_pHorzClockOffset = APPLE_IIP_HORZ_CLOCK_OFFSET;
// TC: Move these to a better place (as init'ing these 2 vars is nothing to do with g_Apple2Type)
_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;
}
//===========================================================================
+2 -2
View File
@@ -13,8 +13,8 @@
extern uint32_t*NTSC_VideoGetChromaTable( bool bHueTypeMonochrome, bool bMonitorTypeColorTV );
extern uint16_t NTSC_VideoGetScannerAddress( unsigned long cycles6502 );
extern void NTSC_VideoInit( uint8_t *pFramebuffer );
extern void NTSC_VideoInitAppleType ( DWORD cyclesThisFrame );
extern void NTSC_VideoReinitialize( DWORD cyclesThisFrame );
extern void NTSC_VideoInitAppleType();
extern void NTSC_VideoInitChroma();
extern bool NTSC_VideoIsVbl();
extern void NTSC_VideoUpdateCycles( long cycles6502 );
+2
View File
@@ -208,6 +208,8 @@ static void Snapshot_LoadState_v1() // .aws v1.0.0.1, up to (and including) Appl
SetLoadedSaveStateFlag(true);
MemUpdatePaging(TRUE);
VideoReinitialize(); // g_CharsetType changed
}
catch(std::string szMessage)
{
+4 -9
View File
@@ -1207,8 +1207,10 @@ void VideoRefreshScreen ( int bVideoModeFlags, UINT uDelayRefresh /* =0 */ )
//===========================================================================
void VideoReinitialize ()
{
NTSC_VideoInitAppleType(g_dwCyclesThisFrame);
NTSC_VideoReinitialize( g_dwCyclesThisFrame );
NTSC_VideoInitAppleType();
NTSC_SetVideoStyle();
NTSC_SetVideoMode( g_uVideoMode ); // Pre-condition: g_nVideoClockHorz (derived from g_dwCyclesThisFrame)
}
//===========================================================================
@@ -1338,10 +1340,7 @@ void VideoSetSnapshot_v1(const UINT AltCharSet, const UINT VideoMode)
{
g_nAltCharSetOffset = !AltCharSet ? 0 : 256;
g_uVideoMode = VideoMode;
// NTSC_BEGIN
NTSC_SetVideoMode( g_uVideoMode );
// NTSC_END
g_dwCyclesThisFrame = 0;
}
//
@@ -1373,10 +1372,6 @@ void VideoLoadSnapshot(YamlLoadHelper& yamlLoadHelper)
g_uVideoMode = yamlLoadHelper.LoadUint(SS_YAML_KEY_VIDEOMODE);
g_dwCyclesThisFrame = yamlLoadHelper.LoadUint(SS_YAML_KEY_CYCLESTHISFRAME);
// NTSC_BEGIN
NTSC_SetVideoMode( g_uVideoMode );
// NTSC_END
yamlLoadHelper.PopMap();
}