mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-09 05:32:05 +00:00
Deprecated and removed support for v1 save-state. (Fixes #603)
This commit is contained in:
parent
b17f880e6d
commit
eea8cb3cdf
@ -650,22 +650,6 @@ void CpuReset()
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void CpuSetSnapshot_v1(const BYTE A, const BYTE X, const BYTE Y, const BYTE P, const BYTE SP, const USHORT PC, const unsigned __int64 CumulativeCycles)
|
|
||||||
{
|
|
||||||
regs.a = A;
|
|
||||||
regs.x = X;
|
|
||||||
regs.y = Y;
|
|
||||||
regs.ps = P | (AF_RESERVED | AF_BREAK);
|
|
||||||
regs.sp = ((USHORT)SP) | 0x100;
|
|
||||||
regs.pc = PC;
|
|
||||||
|
|
||||||
CpuIrqReset();
|
|
||||||
CpuNmiReset();
|
|
||||||
g_nCumulativeCycles = CumulativeCycles;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
#define SS_YAML_KEY_CPU_TYPE "Type"
|
#define SS_YAML_KEY_CPU_TYPE "Type"
|
||||||
#define SS_YAML_KEY_REGA "A"
|
#define SS_YAML_KEY_REGA "A"
|
||||||
#define SS_YAML_KEY_REGX "X"
|
#define SS_YAML_KEY_REGX "X"
|
||||||
|
@ -27,7 +27,6 @@ void CpuNmiReset();
|
|||||||
void CpuNmiAssert(eIRQSRC Device);
|
void CpuNmiAssert(eIRQSRC Device);
|
||||||
void CpuNmiDeassert(eIRQSRC Device);
|
void CpuNmiDeassert(eIRQSRC Device);
|
||||||
void CpuReset ();
|
void CpuReset ();
|
||||||
void CpuSetSnapshot_v1(const BYTE A, const BYTE X, const BYTE Y, const BYTE P, const BYTE SP, const USHORT PC, const unsigned __int64 CumulativeCycles);
|
|
||||||
void CpuSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
void CpuSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||||
void CpuLoadSnapshot(class YamlLoadHelper& yamlLoadHelper);
|
void CpuLoadSnapshot(class YamlLoadHelper& yamlLoadHelper);
|
||||||
|
|
||||||
|
@ -1301,94 +1301,6 @@ static BYTE __stdcall Disk_IOWrite(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULON
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
int DiskSetSnapshot_v1(const SS_CARD_DISK2* const pSS)
|
|
||||||
{
|
|
||||||
if(pSS->Hdr.UnitHdr.hdr.v1.dwVersion > MAKE_VERSION(1,0,0,2))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
phases = pSS->phases;
|
|
||||||
currdrive = pSS->currdrive;
|
|
||||||
//diskaccessed = pSS->diskaccessed; // deprecated
|
|
||||||
enhancedisk = pSS->enhancedisk ? true : false;
|
|
||||||
floppylatch = pSS->floppylatch;
|
|
||||||
floppymotoron = pSS->floppymotoron;
|
|
||||||
floppywritemode = pSS->floppywritemode;
|
|
||||||
|
|
||||||
// Eject all disks first in case Drive-2 contains disk to be inserted into Drive-1
|
|
||||||
for(UINT i=0; i<NUM_DRIVES; i++)
|
|
||||||
{
|
|
||||||
DiskEject(i); // Remove any disk & update Registry to reflect empty drive
|
|
||||||
g_aFloppyDrive[i].clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
for(UINT i=0; i<NUM_DRIVES; i++)
|
|
||||||
{
|
|
||||||
if(pSS->Unit[i].szFileName[0] == 0x00)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
DWORD dwAttributes = GetFileAttributes(pSS->Unit[i].szFileName);
|
|
||||||
if(dwAttributes == INVALID_FILE_ATTRIBUTES)
|
|
||||||
{
|
|
||||||
// Get user to browse for file
|
|
||||||
DiskSelectImage(i, pSS->Unit[i].szFileName);
|
|
||||||
|
|
||||||
dwAttributes = GetFileAttributes(pSS->Unit[i].szFileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool bImageError = false;
|
|
||||||
if(dwAttributes != INVALID_FILE_ATTRIBUTES)
|
|
||||||
{
|
|
||||||
if(DiskInsert(i, pSS->Unit[i].szFileName, dwAttributes & FILE_ATTRIBUTE_READONLY, IMAGE_DONT_CREATE) != eIMAGE_ERROR_NONE)
|
|
||||||
bImageError = true;
|
|
||||||
|
|
||||||
// DiskInsert() sets up:
|
|
||||||
// . imagename
|
|
||||||
// . fullname
|
|
||||||
// . writeprotected
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
// strcpy(g_aFloppyDrive[i].fullname, pSS->Unit[i].szFileName);
|
|
||||||
g_aFloppyDrive[i].track = pSS->Unit[i].track;
|
|
||||||
g_aFloppyDrive[i].phase = pSS->Unit[i].phase;
|
|
||||||
g_aFloppyDrive[i].spinning = pSS->Unit[i].spinning;
|
|
||||||
g_aFloppyDrive[i].writelight = pSS->Unit[i].writelight;
|
|
||||||
|
|
||||||
g_aFloppyDrive[i].disk.byte = pSS->Unit[i].byte;
|
|
||||||
// g_aFloppyDrive[i].disk.writeprotected = pSS->Unit[i].writeprotected;
|
|
||||||
g_aFloppyDrive[i].disk.trackimagedata = pSS->Unit[i].trackimagedata ? true : false;
|
|
||||||
g_aFloppyDrive[i].disk.trackimagedirty = pSS->Unit[i].trackimagedirty ? true : false;
|
|
||||||
g_aFloppyDrive[i].disk.nibbles = pSS->Unit[i].nibbles;
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
if(!bImageError)
|
|
||||||
{
|
|
||||||
if((g_aFloppyDrive[i].disk.trackimage == NULL) && g_aFloppyDrive[i].disk.nibbles)
|
|
||||||
AllocTrack(i);
|
|
||||||
|
|
||||||
if(g_aFloppyDrive[i].disk.trackimage == NULL)
|
|
||||||
bImageError = true;
|
|
||||||
else
|
|
||||||
memcpy(g_aFloppyDrive[i].disk.trackimage, pSS->Unit[i].nTrack, NIBBLES_PER_TRACK);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(bImageError)
|
|
||||||
{
|
|
||||||
g_aFloppyDrive[i].disk.trackimagedata = false;
|
|
||||||
g_aFloppyDrive[i].disk.trackimagedirty = false;
|
|
||||||
g_aFloppyDrive[i].disk.nibbles = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
// Unit version history:
|
// Unit version history:
|
||||||
// 2: Added: Format Track state & DiskLastCycle
|
// 2: Added: Format Track state & DiskLastCycle
|
||||||
// 3: Added: DiskLastReadLatchCycle
|
// 3: Added: DiskLastReadLatchCycle
|
||||||
|
@ -72,7 +72,6 @@ void DiskUpdateDriveState(DWORD);
|
|||||||
bool DiskDriveSwap(void);
|
bool DiskDriveSwap(void);
|
||||||
void DiskLoadRom(LPBYTE pCxRomPeripheral, UINT uSlot);
|
void DiskLoadRom(LPBYTE pCxRomPeripheral, UINT uSlot);
|
||||||
|
|
||||||
int DiskSetSnapshot_v1(const struct SS_CARD_DISK2* const pSS);
|
|
||||||
std::string DiskGetSnapshotCardName(void);
|
std::string DiskGetSnapshotCardName(void);
|
||||||
void DiskSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
void DiskSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||||
bool DiskLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
|
bool DiskLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
|
||||||
|
@ -931,13 +931,6 @@ void JoyportControl(const UINT uControl)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void JoySetSnapshot_v1(const unsigned __int64 JoyCntrResetCycle)
|
|
||||||
{
|
|
||||||
g_nJoyCntrResetCycle = JoyCntrResetCycle;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
#define SS_YAML_KEY_COUNTERRESETCYCLE "Counter Reset Cycle"
|
#define SS_YAML_KEY_COUNTERRESETCYCLE "Counter Reset Cycle"
|
||||||
#define SS_YAML_KEY_JOY0TRIMX "Joystick0 TrimX"
|
#define SS_YAML_KEY_JOY0TRIMX "Joystick0 TrimX"
|
||||||
#define SS_YAML_KEY_JOY0TRIMY "Joystick0 TrimY"
|
#define SS_YAML_KEY_JOY0TRIMY "Joystick0 TrimY"
|
||||||
|
@ -25,7 +25,6 @@ void JoySetTrim(short nValue, bool bAxisX);
|
|||||||
short JoyGetTrim(bool bAxisX);
|
short JoyGetTrim(bool bAxisX);
|
||||||
void JoyportControl(const UINT uControl);
|
void JoyportControl(const UINT uControl);
|
||||||
void JoySetHookAltKeys(bool hook);
|
void JoySetHookAltKeys(bool hook);
|
||||||
void JoySetSnapshot_v1(const unsigned __int64 JoyCntrResetCycle);
|
|
||||||
void JoySaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
void JoySaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||||
void JoyLoadSnapshot(class YamlLoadHelper& yamlLoadHelper);
|
void JoyLoadSnapshot(class YamlLoadHelper& yamlLoadHelper);
|
||||||
|
|
||||||
|
@ -544,13 +544,6 @@ void KeybToggleP8ACapsLock ()
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void KeybSetSnapshot_v1(const BYTE LastKey)
|
|
||||||
{
|
|
||||||
keycode = LastKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
#define SS_YAML_KEY_LASTKEY "Last Key"
|
#define SS_YAML_KEY_LASTKEY "Last Key"
|
||||||
#define SS_YAML_KEY_KEYWAITING "Key Waiting"
|
#define SS_YAML_KEY_KEYWAITING "Key Waiting"
|
||||||
|
|
||||||
|
@ -18,6 +18,5 @@ void KeybToggleP8ACapsLock ();
|
|||||||
void KeybAnyKeyDown(UINT message, WPARAM wparam, bool bIsExtended);
|
void KeybAnyKeyDown(UINT message, WPARAM wparam, bool bIsExtended);
|
||||||
BYTE KeybReadData (void);
|
BYTE KeybReadData (void);
|
||||||
BYTE KeybReadFlag (void);
|
BYTE KeybReadFlag (void);
|
||||||
void KeybSetSnapshot_v1(const BYTE LastKey);
|
|
||||||
void KeybSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
void KeybSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||||
void KeybLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT version);
|
void KeybLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT version);
|
||||||
|
@ -229,7 +229,7 @@ static void ResetDefaultMachineMemTypes(void)
|
|||||||
g_MemTypeAppleIIe = CT_Extended80Col;
|
g_MemTypeAppleIIe = CT_Extended80Col;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called from MemInitialize(), MemLoadSnapshot(), MemSetSnapshot_v1()
|
// Called from MemInitialize(), MemLoadSnapshot()
|
||||||
static void SetExpansionMemTypeDefault(void)
|
static void SetExpansionMemTypeDefault(void)
|
||||||
{
|
{
|
||||||
SS_CARDTYPE defaultType = IsApple2Original(GetApple2Type()) ? g_MemTypeAppleII
|
SS_CARDTYPE defaultType = IsApple2Original(GetApple2Type()) ? g_MemTypeAppleII
|
||||||
@ -1702,7 +1702,6 @@ inline DWORD getRandomTime()
|
|||||||
// Called by:
|
// Called by:
|
||||||
// . MemInitialize()
|
// . MemInitialize()
|
||||||
// . ResetMachineState() eg. Power-cycle ('Apple-Go' button)
|
// . ResetMachineState() eg. Power-cycle ('Apple-Go' button)
|
||||||
// . Snapshot_LoadState_v1()
|
|
||||||
// . Snapshot_LoadState_v2()
|
// . Snapshot_LoadState_v2()
|
||||||
void MemReset()
|
void MemReset()
|
||||||
{
|
{
|
||||||
@ -2037,29 +2036,6 @@ LPVOID MemGetSlotParameters(UINT uSlot)
|
|||||||
// . If we were to save the state when 'modechanging' is set, then on restoring the state, the 6502 code will immediately update the read memory mode.
|
// . If we were to save the state when 'modechanging' is set, then on restoring the state, the 6502 code will immediately update the read memory mode.
|
||||||
// . This will work correctly.
|
// . This will work correctly.
|
||||||
|
|
||||||
void MemSetSnapshot_v1(const DWORD MemMode, const BOOL LastWriteRam, const BYTE* const pMemMain, const BYTE* const pMemAux)
|
|
||||||
{
|
|
||||||
// Create default LC type for AppleII machine (do prior to loading saved LC state)
|
|
||||||
ResetDefaultMachineMemTypes();
|
|
||||||
g_MemTypeAppleII = CT_LanguageCard; // SSv1 doesn't save machine type - so if current machine is Apple II then give it 64K + LC
|
|
||||||
SetExpansionMemTypeDefault();
|
|
||||||
CreateLanguageCard(); // Create LC here, as for SSv1 there is no slot-0 state
|
|
||||||
|
|
||||||
SetMemMode(MemMode ^ MF_INTCXROM); // Convert from SLOTCXROM to INTCXROM
|
|
||||||
SetLastRamWrite(LastWriteRam);
|
|
||||||
|
|
||||||
memcpy(memmain, pMemMain, nMemMainSize);
|
|
||||||
memcpy(memaux, pMemAux, nMemAuxSize);
|
|
||||||
memset(memdirty, 0, 0x100);
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
// NB. MemUpdatePaging(TRUE) called at end of Snapshot_LoadState_v1()
|
|
||||||
UpdatePaging(1); // Initialize=1
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
#define SS_YAML_KEY_MEMORYMODE "Memory Mode"
|
#define SS_YAML_KEY_MEMORYMODE "Memory Mode"
|
||||||
#define SS_YAML_KEY_LASTRAMWRITE "Last RAM Write"
|
#define SS_YAML_KEY_LASTRAMWRITE "Last RAM Write"
|
||||||
#define SS_YAML_KEY_IOSELECT "IO_SELECT"
|
#define SS_YAML_KEY_IOSELECT "IO_SELECT"
|
||||||
|
@ -79,7 +79,6 @@ void MemReset ();
|
|||||||
void MemResetPaging ();
|
void MemResetPaging ();
|
||||||
void MemUpdatePaging(BOOL initialize);
|
void MemUpdatePaging(BOOL initialize);
|
||||||
LPVOID MemGetSlotParameters (UINT uSlot);
|
LPVOID MemGetSlotParameters (UINT uSlot);
|
||||||
void MemSetSnapshot_v1(const DWORD MemMode, const BOOL LastWriteRam, const BYTE* const pMemMain, const BYTE* const pMemAux);
|
|
||||||
std::string MemGetSnapshotUnitAuxSlotName(void);
|
std::string MemGetSnapshotUnitAuxSlotName(void);
|
||||||
void MemSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
void MemSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||||
bool MemLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT version);
|
bool MemLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT version);
|
||||||
|
@ -1871,52 +1871,6 @@ void MB_GetSnapshot_v1(SS_CARD_MOCKINGBOARD_v1* const pSS, const DWORD dwSlot)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int MB_SetSnapshot_v1(const SS_CARD_MOCKINGBOARD_v1* const pSS, const DWORD /*dwSlot*/)
|
|
||||||
{
|
|
||||||
if(pSS->Hdr.UnitHdr.hdr.v1.dwVersion != MAKE_VERSION(1,0,0,0))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
UINT nMbCardNum = pSS->Hdr.Slot - SLOT4;
|
|
||||||
UINT nDeviceNum = nMbCardNum*2;
|
|
||||||
SY6522_AY8910* pMB = &g_MB[nDeviceNum];
|
|
||||||
|
|
||||||
g_nSSI263Device = 0;
|
|
||||||
g_nCurrentActivePhoneme = -1;
|
|
||||||
|
|
||||||
for(UINT i=0; i<MB_UNITS_PER_CARD_v1; i++)
|
|
||||||
{
|
|
||||||
memcpy(&pMB->sy6522, &pSS->Unit[i].RegsSY6522, sizeof(SY6522));
|
|
||||||
memcpy(AY8910_GetRegsPtr(nDeviceNum), &pSS->Unit[i].RegsAY8910, 16);
|
|
||||||
memcpy(&pMB->SpeechChip, &pSS->Unit[i].RegsSSI263, sizeof(SSI263A));
|
|
||||||
pMB->nAYCurrentRegister = pSS->Unit[i].nAYCurrentRegister;
|
|
||||||
pMB->state = AY_INACTIVE;
|
|
||||||
|
|
||||||
StartTimer1_LoadStateV1(pMB); // Attempt to start timer
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
// Crude - currently only support a single speech chip
|
|
||||||
// FIX THIS:
|
|
||||||
// . Speech chip could be Votrax instead
|
|
||||||
// . Is this IRQ compatible with Phasor?
|
|
||||||
if(pMB->SpeechChip.DurationPhoneme)
|
|
||||||
{
|
|
||||||
g_nSSI263Device = nDeviceNum;
|
|
||||||
|
|
||||||
if((pMB->SpeechChip.CurrentMode != MODE_IRQ_DISABLED) && (pMB->sy6522.PCR == 0x0C) && (pMB->sy6522.IER & IxR_PERIPHERAL))
|
|
||||||
{
|
|
||||||
UpdateIFR(pMB, 0, IxR_PERIPHERAL);
|
|
||||||
pMB->SpeechChip.CurrentMode |= 1; // Set SSI263's D7 pin
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nDeviceNum++;
|
|
||||||
pMB++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
// Unit version history:
|
// Unit version history:
|
||||||
|
@ -18,7 +18,6 @@ DWORD MB_GetVolume();
|
|||||||
void MB_SetVolume(DWORD dwVolume, DWORD dwVolumeMax);
|
void MB_SetVolume(DWORD dwVolume, DWORD dwVolumeMax);
|
||||||
|
|
||||||
void MB_GetSnapshot_v1(struct SS_CARD_MOCKINGBOARD_v1* const pSS, const DWORD dwSlot); // For debugger
|
void MB_GetSnapshot_v1(struct SS_CARD_MOCKINGBOARD_v1* const pSS, const DWORD dwSlot); // For debugger
|
||||||
int MB_SetSnapshot_v1(const struct SS_CARD_MOCKINGBOARD_v1* const pSS, const DWORD dwSlot);
|
|
||||||
std::string MB_GetSnapshotCardName(void);
|
std::string MB_GetSnapshotCardName(void);
|
||||||
void MB_SaveSnapshot(class YamlSaveHelper& yamlSaveHelper, const UINT uSlot);
|
void MB_SaveSnapshot(class YamlSaveHelper& yamlSaveHelper, const UINT uSlot);
|
||||||
bool MB_LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
|
bool MB_LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
|
||||||
|
@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
|
|
||||||
#include "StdAfx.h"
|
#include "StdAfx.h"
|
||||||
|
|
||||||
#include "SaveState_Structs_v1.h"
|
|
||||||
#include "YamlHelper.h"
|
#include "YamlHelper.h"
|
||||||
|
|
||||||
#include "Applewin.h"
|
#include "Applewin.h"
|
||||||
@ -112,127 +111,6 @@ const char* Snapshot_GetPath()
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void Snapshot_LoadState_v1() // .aws v1.0.0.1, up to (and including) AppleWin v1.25.0
|
|
||||||
{
|
|
||||||
std::string strOldImageDir(g_sCurrentDir);
|
|
||||||
|
|
||||||
APPLEWIN_SNAPSHOT_v1* pSS = (APPLEWIN_SNAPSHOT_v1*) new char[sizeof(APPLEWIN_SNAPSHOT_v1)]; // throw's bad_alloc
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
#if _MSC_VER >= 1600 // static_assert supported from VS2010 (cl.exe v16.00)
|
|
||||||
static_assert(kSnapshotSize_v1 == sizeof(APPLEWIN_SNAPSHOT_v1), "Save-state v1 struct size mismatch");
|
|
||||||
#else
|
|
||||||
// A compile error here means sizeof(APPLEWIN_SNAPSHOT_v1) is wrong, eg. one of the constituent structs has been modified
|
|
||||||
typedef char VerifySizesAreEqual[kSnapshotSize_v1 == sizeof(APPLEWIN_SNAPSHOT_v1) ? 1 : -1];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (kSnapshotSize_v1 != sizeof(APPLEWIN_SNAPSHOT_v1))
|
|
||||||
throw std::string("Save-state v1 struct size mismatch");
|
|
||||||
|
|
||||||
SetCurrentImageDir(g_strSaveStatePath.c_str()); // Allow .dsk's load without prompting
|
|
||||||
|
|
||||||
memset(pSS, 0, sizeof(APPLEWIN_SNAPSHOT_v1));
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
HANDLE hFile = CreateFile( g_strSaveStatePathname.c_str(),
|
|
||||||
GENERIC_READ,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
OPEN_EXISTING,
|
|
||||||
FILE_ATTRIBUTE_NORMAL,
|
|
||||||
0);
|
|
||||||
|
|
||||||
if(hFile == INVALID_HANDLE_VALUE)
|
|
||||||
throw std::string("File not found: ") + g_strSaveStatePathname;
|
|
||||||
|
|
||||||
DWORD dwBytesRead;
|
|
||||||
BOOL bRes = ReadFile( hFile,
|
|
||||||
pSS,
|
|
||||||
sizeof(APPLEWIN_SNAPSHOT_v1),
|
|
||||||
&dwBytesRead,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
CloseHandle(hFile);
|
|
||||||
|
|
||||||
if(!bRes || (dwBytesRead != sizeof(APPLEWIN_SNAPSHOT_v1)))
|
|
||||||
// File size wrong: probably because of version mismatch or corrupt file
|
|
||||||
throw std::string("File size mismatch");
|
|
||||||
|
|
||||||
if(pSS->Hdr.dwTag != AW_SS_TAG)
|
|
||||||
throw std::string("File corrupt");
|
|
||||||
|
|
||||||
if(pSS->Hdr.dwVersion != MAKE_VERSION(1,0,0,1))
|
|
||||||
throw std::string("Version mismatch");
|
|
||||||
|
|
||||||
// TO DO: Verify checksum
|
|
||||||
|
|
||||||
//
|
|
||||||
// Reset all sub-systems
|
|
||||||
MemReset();
|
|
||||||
DiskReset();
|
|
||||||
HD_Reset();
|
|
||||||
KeybReset();
|
|
||||||
VideoResetState();
|
|
||||||
MB_Reset();
|
|
||||||
sg_SSC.CommReset();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Apple2 unit
|
|
||||||
//
|
|
||||||
|
|
||||||
SS_CPU6502& CPU = pSS->Apple2Unit.CPU6502;
|
|
||||||
CpuSetSnapshot_v1(CPU.A, CPU.X, CPU.Y, CPU.P, CPU.S, CPU.PC, CPU.nCumulativeCycles);
|
|
||||||
|
|
||||||
SS_IO_Comms& SSC = pSS->Apple2Unit.Comms;
|
|
||||||
sg_SSC.SetSnapshot_v1(SSC.baudrate, SSC.bytesize, SSC.commandbyte, SSC.comminactivity, SSC.controlbyte, SSC.parity, SSC.stopbits);
|
|
||||||
|
|
||||||
JoySetSnapshot_v1(pSS->Apple2Unit.Joystick.nJoyCntrResetCycle);
|
|
||||||
KeybSetSnapshot_v1(pSS->Apple2Unit.Keyboard.nLastKey);
|
|
||||||
SpkrSetSnapshot_v1(pSS->Apple2Unit.Speaker.nSpkrLastCycle);
|
|
||||||
VideoSetSnapshot_v1(pSS->Apple2Unit.Video.bAltCharSet, pSS->Apple2Unit.Video.dwVidMode);
|
|
||||||
MemSetSnapshot_v1(pSS->Apple2Unit.Memory.dwMemMode, pSS->Apple2Unit.Memory.bLastWriteRam, pSS->Apple2Unit.Memory.nMemMain, pSS->Apple2Unit.Memory.nMemAux);
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
|
||||||
// Slot4: Mockingboard
|
|
||||||
MB_SetSnapshot_v1(&pSS->Mockingboard1, 4);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Slot5: Mockingboard
|
|
||||||
MB_SetSnapshot_v1(&pSS->Mockingboard2, 5);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Slot6: Disk][
|
|
||||||
DiskSetSnapshot_v1(&pSS->Disk2);
|
|
||||||
|
|
||||||
SetLoadedSaveStateFlag(true);
|
|
||||||
|
|
||||||
MemUpdatePaging(TRUE);
|
|
||||||
|
|
||||||
// NB. g_Apple2Type doesn't change for v1, but replicate this (like v2)
|
|
||||||
VideoReinitialize(); // g_CharsetType changed
|
|
||||||
FrameUpdateApple2Type();
|
|
||||||
}
|
|
||||||
catch(std::string szMessage)
|
|
||||||
{
|
|
||||||
MessageBox( g_hFrameWindow,
|
|
||||||
szMessage.c_str(),
|
|
||||||
TEXT("Load State"),
|
|
||||||
MB_ICONEXCLAMATION | MB_SETFOREGROUND);
|
|
||||||
|
|
||||||
SetCurrentImageDir(strOldImageDir.c_str());
|
|
||||||
|
|
||||||
PostMessage(g_hFrameWindow, WM_USER_RESTART, 0, 0); // Power-cycle VM (undoing all the new state just loaded)
|
|
||||||
}
|
|
||||||
|
|
||||||
delete [] pSS;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
static HANDLE m_hFile = INVALID_HANDLE_VALUE;
|
static HANDLE m_hFile = INVALID_HANDLE_VALUE;
|
||||||
static CConfigNeedingRestart m_ConfigNew;
|
static CConfigNeedingRestart m_ConfigNew;
|
||||||
|
|
||||||
@ -564,7 +442,12 @@ void Snapshot_LoadState()
|
|||||||
const size_t pos = g_strSaveStatePathname.size() - ext_aws.size();
|
const size_t pos = g_strSaveStatePathname.size() - ext_aws.size();
|
||||||
if (g_strSaveStatePathname.find(ext_aws, pos) != std::string::npos) // find ".aws" at end of pathname
|
if (g_strSaveStatePathname.find(ext_aws, pos) != std::string::npos) // find ".aws" at end of pathname
|
||||||
{
|
{
|
||||||
Snapshot_LoadState_v1();
|
MessageBox( g_hFrameWindow,
|
||||||
|
"Save-state v1 no longer supported.\n"
|
||||||
|
"Please load using AppleWin 1.27, and re-save as a v2 state file.",
|
||||||
|
TEXT("Load State"),
|
||||||
|
MB_ICONEXCLAMATION | MB_SETFOREGROUND);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1355,25 +1355,6 @@ void CSuperSerialCard::SetSerialPortName(const char* pSerialPortName)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void CSuperSerialCard::SetSnapshot_v1( const DWORD baudrate,
|
|
||||||
const BYTE bytesize,
|
|
||||||
const BYTE commandbyte,
|
|
||||||
const DWORD comminactivity,
|
|
||||||
const BYTE controlbyte,
|
|
||||||
const BYTE parity,
|
|
||||||
const BYTE stopbits)
|
|
||||||
{
|
|
||||||
// Redundant:
|
|
||||||
// . baudrate, stopbits, bytesize (encapsulated in controlbyte)
|
|
||||||
// . parity (encapsulated in commandbyte)
|
|
||||||
// Obsolete:
|
|
||||||
// . comminactivity
|
|
||||||
|
|
||||||
UpdateCommandAndControlRegs(commandbyte, controlbyte);
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
// Unit version history:
|
// Unit version history:
|
||||||
// 2: Added: Support DCD flag
|
// 2: Added: Support DCD flag
|
||||||
// Removed: redundant data (encapsulated in Command & Control bytes)
|
// Removed: redundant data (encapsulated in Command & Control bytes)
|
||||||
|
@ -32,7 +32,6 @@ public:
|
|||||||
void CommReset();
|
void CommReset();
|
||||||
void CommDestroy();
|
void CommDestroy();
|
||||||
void CommSetSerialPort(HWND hWindow, DWORD dwNewSerialPortItem);
|
void CommSetSerialPort(HWND hWindow, DWORD dwNewSerialPortItem);
|
||||||
void SetSnapshot_v1(const DWORD baudrate, const BYTE bytesize, const BYTE commandbyte, const DWORD comminactivity, const BYTE controlbyte, const BYTE parity, const BYTE stopbits);
|
|
||||||
std::string GetSnapshotCardName(void);
|
std::string GetSnapshotCardName(void);
|
||||||
void SaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
void SaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||||
bool LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
|
bool LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
|
||||||
|
@ -931,13 +931,6 @@ void Spkr_DSUninit()
|
|||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
void SpkrSetSnapshot_v1(const unsigned __int64 SpkrLastCycle)
|
|
||||||
{
|
|
||||||
g_nSpkrLastCycle = SpkrLastCycle;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
#define SS_YAML_KEY_LASTCYCLE "Last Cycle"
|
#define SS_YAML_KEY_LASTCYCLE "Last Cycle"
|
||||||
|
|
||||||
static std::string SpkrGetSnapshotStructName(void)
|
static std::string SpkrGetSnapshotStructName(void)
|
||||||
|
@ -33,7 +33,6 @@ void Spkr_Demute();
|
|||||||
bool Spkr_IsActive();
|
bool Spkr_IsActive();
|
||||||
bool Spkr_DSInit();
|
bool Spkr_DSInit();
|
||||||
void Spkr_DSUninit();
|
void Spkr_DSUninit();
|
||||||
void SpkrSetSnapshot_v1(const unsigned __int64 SpkrLastCycle);
|
|
||||||
void SpkrSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
void SpkrSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||||
void SpkrLoadSnapshot(class YamlLoadHelper& yamlLoadHelper);
|
void SpkrLoadSnapshot(class YamlLoadHelper& yamlLoadHelper);
|
||||||
|
|
||||||
|
@ -720,15 +720,6 @@ bool VideoGetSWAltCharSet(void)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void VideoSetSnapshot_v1(const UINT AltCharSet, const UINT VideoMode)
|
|
||||||
{
|
|
||||||
g_nAltCharSetOffset = !AltCharSet ? 0 : 256;
|
|
||||||
g_uVideoMode = VideoMode;
|
|
||||||
g_dwCyclesThisFrame = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
#define SS_YAML_KEY_ALTCHARSET "Alt Char Set"
|
#define SS_YAML_KEY_ALTCHARSET "Alt Char Set"
|
||||||
#define SS_YAML_KEY_VIDEOMODE "Video Mode"
|
#define SS_YAML_KEY_VIDEOMODE "Video Mode"
|
||||||
#define SS_YAML_KEY_CYCLESTHISFRAME "Cycles This Frame"
|
#define SS_YAML_KEY_CYCLESTHISFRAME "Cycles This Frame"
|
||||||
|
@ -182,7 +182,6 @@ bool VideoGetSWPAGE2(void);
|
|||||||
bool VideoGetSWTEXT(void);
|
bool VideoGetSWTEXT(void);
|
||||||
bool VideoGetSWAltCharSet(void);
|
bool VideoGetSWAltCharSet(void);
|
||||||
|
|
||||||
void VideoSetSnapshot_v1(const UINT AltCharSet, const UINT VideoMode);
|
|
||||||
void VideoSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
void VideoSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||||
void VideoLoadSnapshot(class YamlLoadHelper& yamlLoadHelper);
|
void VideoLoadSnapshot(class YamlLoadHelper& yamlLoadHelper);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user