mirror of
https://github.com/AppleWin/AppleWin.git
synced 2026-04-20 00:17:16 +00:00
Added libyaml 0.1.5
Added yaml save-state support for: . Main AppleII unit . Aux memory & RawWorksIII . Printer . SSC . Z80 . Mouse . Mockingboard . Phasor . Disk][ . HDD
This commit is contained in:
@@ -186,7 +186,7 @@ void CPropertySheetHelper::GetDiskBaseNameWithAWS(TCHAR* pszFilename)
|
||||
if (pDiskName && pDiskName[0])
|
||||
{
|
||||
strcpy(pszFilename, pDiskName);
|
||||
strcpy(&pszFilename[strlen(pDiskName)], ".aws");
|
||||
strcpy(&pszFilename[strlen(pDiskName)], ".aws.yaml");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,9 +230,17 @@ int CPropertySheetHelper::SaveStateSelectImage(HWND hWindow, TCHAR* pszTitle, bo
|
||||
ofn.lStructSize = sizeof(OPENFILENAME);
|
||||
ofn.hwndOwner = hWindow;
|
||||
ofn.hInstance = g_hInstance;
|
||||
ofn.lpstrFilter = TEXT("Save State files (*.aws)\0*.aws\0")
|
||||
TEXT("All Files\0*.*\0");
|
||||
ofn.lpstrFile = szFilename;
|
||||
if (bSave)
|
||||
{
|
||||
ofn.lpstrFilter = TEXT("Save State files (*.aws.yaml)\0*.aws.yaml\0");
|
||||
TEXT("All Files\0*.*\0");
|
||||
}
|
||||
else
|
||||
{
|
||||
ofn.lpstrFilter = TEXT("Save State files (*.aws,*.aws.yaml)\0*.aws;*.aws.yaml\0");
|
||||
TEXT("All Files\0*.*\0");
|
||||
}
|
||||
ofn.lpstrFile = szFilename; // Dialog strips the last .EXT from this string (eg. file.aws.yaml is displayed as: file.aws
|
||||
ofn.nMaxFile = MAX_PATH;
|
||||
ofn.lpstrInitialDir = szDirectory;
|
||||
ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;
|
||||
@@ -245,11 +253,16 @@ int CPropertySheetHelper::SaveStateSelectImage(HWND hWindow, TCHAR* pszTitle, bo
|
||||
if (bSave) // Only for saving (allow loading of any file for backwards compatibility)
|
||||
{
|
||||
// Append .aws if it's not there
|
||||
const char szAWS_EXT[] = ".aws";
|
||||
const char szAWS_EXT1[] = ".aws";
|
||||
const char szAWS_EXT2[] = ".aws.yaml";
|
||||
const char szAWS_EXT3[] = ".yaml";
|
||||
const UINT uStrLenFile = strlen(&szFilename[ofn.nFileOffset]);
|
||||
const UINT uStrLenExt = strlen(szAWS_EXT);
|
||||
if ((uStrLenFile <= uStrLenExt) || (strcmp(&szFilename[ofn.nFileOffset+uStrLenFile-uStrLenExt], szAWS_EXT) != 0))
|
||||
strcpy(&szFilename[ofn.nFileOffset+uStrLenFile], szAWS_EXT);
|
||||
const UINT uStrLenExt1 = strlen(szAWS_EXT1);
|
||||
const UINT uStrLenExt2 = strlen(szAWS_EXT2);
|
||||
if ((uStrLenFile <= uStrLenExt1) || (strcmp(&szFilename[ofn.nFileOffset+uStrLenFile-uStrLenExt1], szAWS_EXT1) == 0))
|
||||
strcpy(&szFilename[ofn.nFileOffset+uStrLenFile], szAWS_EXT3); // "file.aws" += ".yaml"
|
||||
else if ((uStrLenFile <= uStrLenExt2) || (strcmp(&szFilename[ofn.nFileOffset+uStrLenFile-uStrLenExt2], szAWS_EXT2) != 0))
|
||||
strcpy(&szFilename[ofn.nFileOffset+uStrLenFile], szAWS_EXT2); // "file" += "aws.yaml"
|
||||
}
|
||||
|
||||
strcpy(m_szSSNewFilename, &szFilename[ofn.nFileOffset]);
|
||||
|
||||
Reference in New Issue
Block a user