mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-02-09 14:30:56 +00:00
Bug fix: Loading save-state file (.aws) wasn't Win32-closing .dsk images in drives. Problem if Drive1 contained eg. Skyfox.dsk and you attempt to load a .aws with the same Skyfox.dsk.
Also change F11/F12 behaviour, now: - Load save-state tries to load Prop Sheet's .aws filename first - Save save-state tries to save as <Drive1-Filename>.aws first
This commit is contained in:
parent
7048bcf8c2
commit
1490e77037
@ -1020,6 +1020,8 @@ DWORD DiskSetSnapshot(SS_CARD_DISK2* pSS, DWORD /*dwSlot*/)
|
|||||||
{
|
{
|
||||||
bool bImageError = false;
|
bool bImageError = false;
|
||||||
|
|
||||||
|
DiskEject(i); // Remove any disk & update Registry to reflect empty drive
|
||||||
|
|
||||||
ZeroMemory(&g_aFloppyDisk[i], sizeof(Disk_t ));
|
ZeroMemory(&g_aFloppyDisk[i], sizeof(Disk_t ));
|
||||||
if(pSS->Unit[i].szFileName[0] == 0x00)
|
if(pSS->Unit[i].szFileName[0] == 0x00)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1162,27 +1162,45 @@ static void SaveStateUpdate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void GetDiskBaseNameWithAWS(TCHAR* pszFilename)
|
||||||
|
{
|
||||||
|
LPCTSTR pDiskName = DiskGetBaseName(DRIVE_1);
|
||||||
|
if (pDiskName && pDiskName[0])
|
||||||
|
{
|
||||||
|
strcpy(pszFilename, pDiskName);
|
||||||
|
strcpy(&pszFilename[strlen(pDiskName)], ".aws");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NB. OK'ing this property sheet will call Snapshot_SetFilename() with this new filename
|
||||||
static int SaveStateSelectImage(HWND hWindow, TCHAR* pszTitle, bool bSave)
|
static int SaveStateSelectImage(HWND hWindow, TCHAR* pszTitle, bool bSave)
|
||||||
{
|
{
|
||||||
TCHAR szDirectory[MAX_PATH] = TEXT("");
|
TCHAR szDirectory[MAX_PATH] = TEXT("");
|
||||||
TCHAR szFilename[MAX_PATH];
|
TCHAR szFilename[MAX_PATH] = {0};
|
||||||
|
|
||||||
// Attempt to use drive1's image name as the name for the .aws file
|
if (bSave)
|
||||||
LPCTSTR pDiskName0 = DiskGetBaseName(DRIVE_1);
|
|
||||||
if (pDiskName0 && pDiskName0[0])
|
|
||||||
{
|
{
|
||||||
strcpy(szFilename, pDiskName0);
|
// Attempt to use drive1's image name as the name for the .aws file
|
||||||
strcpy(&szFilename[strlen(pDiskName0)], ".aws");
|
// Else Attempt to use the Prop Sheet's filename
|
||||||
// NB. OK'ing this property sheet will call Snapshot_SetFilename() with this new filename
|
GetDiskBaseNameWithAWS(szFilename);
|
||||||
|
if (szFilename[0] == 0)
|
||||||
|
{
|
||||||
|
strcpy(szFilename, Snapshot_GetFilename());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else // Load
|
||||||
{
|
{
|
||||||
|
// Attempt to use the Prop Sheet's filename first
|
||||||
|
// Else attempt to use drive1's image name as the name for the .aws file
|
||||||
strcpy(szFilename, Snapshot_GetFilename());
|
strcpy(szFilename, Snapshot_GetFilename());
|
||||||
|
if (szFilename[0] == 0)
|
||||||
|
{
|
||||||
|
GetDiskBaseNameWithAWS(szFilename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RegLoadString(TEXT("Preferences"),REGVALUE_PREF_START_DIR,1,szDirectory,MAX_PATH);
|
RegLoadString(TEXT("Preferences"),REGVALUE_PREF_START_DIR,1,szDirectory,MAX_PATH);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
OPENFILENAME ofn;
|
OPENFILENAME ofn;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user