[Disk] Make sure to avoid Saving RAM file if there's no RAM Area available + fix D64 Save Area

This commit is contained in:
LuigiBlood 2019-08-12 23:50:02 +02:00
parent 04c0ff270f
commit 63d0410d79
1 changed files with 8 additions and 2 deletions

View File

@ -147,6 +147,12 @@ bool CN64Disk::SaveDiskImage()
}
else
{
if (m_DiskFileSize <= m_DiskRamAddress || m_DiskRamAddress == 0)
{
m_DiskFile.Close();
return true;
}
stdstr ShadowFile = m_FileName;
ShadowFile[ShadowFile.length() - 1] = 'm';
ShadowFile[ShadowFile.length() - 2] = 'a';
@ -431,7 +437,7 @@ bool CN64Disk::AllocateAndLoadDiskImage(const char * FileLoc)
bool CN64Disk::LoadDiskRAMImage()
{
if (m_DiskFormat == DiskFormatMAME || m_isShadowDisk)
if (m_DiskFormat == DiskFormatMAME || m_isShadowDisk || m_DiskFileSize <= m_DiskRamAddress || m_DiskRamAddress == 0)
return true;
CFile ramfile;
@ -791,7 +797,7 @@ void CN64Disk::DetectRamAddress()
}
else //if (m_DiskFormat == DiskFormatD64)
{
m_DiskRamAddress = m_DiskRomAddress + LBAToByte(SYSTEM_LBAS, *(uint16_t*)(&GetDiskAddressSys()[0xE2]));
m_DiskRamAddress = m_DiskRomAddress + LBAToByte(SYSTEM_LBAS, *(uint16_t*)(&GetDiskAddressSys()[0xE2]) + 1);
}
}