Handle hard disks and disk eject.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
2258d91208
commit
8b458e61fb
2 changed files with 37 additions and 5 deletions
|
@ -37,6 +37,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
LPCTSTR HD_GetFullPathName(const int iDrive);
|
||||
void HD_Load_Rom(const LPBYTE pCxRomPeripheral, const UINT uSlot);
|
||||
bool HD_Select(const int iDrive);
|
||||
BOOL HD_Insert(const int iDrive, LPCTSTR pszImageFilename);
|
||||
void HD_Unplug(const int iDrive);
|
||||
bool HD_IsDriveUnplugged(const int iDrive);
|
||||
void HD_LoadLastDiskImage(const int iDrive);
|
||||
|
|
|
@ -72,12 +72,35 @@ namespace
|
|||
|
||||
void insertDisk(const QString & filename, const int disk)
|
||||
{
|
||||
const bool createMissingDisk = true;
|
||||
const ImageError_e result = DiskInsert(disk, filename.toStdString().c_str(), IMAGE_USE_FILES_WRITE_PROTECT_STATUS, createMissingDisk);
|
||||
if (result != eIMAGE_ERROR_NONE)
|
||||
if (filename.isEmpty())
|
||||
{
|
||||
const QString message = QString("Error [%1] inserting '%2'").arg(QString::number(result), filename);
|
||||
QMessageBox::warning(NULL, "Disk error", message);
|
||||
DiskEject(disk);
|
||||
}
|
||||
else
|
||||
{
|
||||
const bool createMissingDisk = true;
|
||||
const ImageError_e result = DiskInsert(disk, filename.toStdString().c_str(), IMAGE_USE_FILES_WRITE_PROTECT_STATUS, createMissingDisk);
|
||||
if (result != eIMAGE_ERROR_NONE)
|
||||
{
|
||||
const QString message = QString("Error [%1] inserting '%2'").arg(QString::number(result), filename);
|
||||
QMessageBox::warning(NULL, "Disk error", message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void insertHD(const QString & filename, const int disk)
|
||||
{
|
||||
if (filename.isEmpty())
|
||||
{
|
||||
HD_Unplug(disk);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!HD_Insert(disk, filename.toStdString().c_str()))
|
||||
{
|
||||
const QString message = QString("Error inserting '%1'").arg(filename);
|
||||
QMessageBox::warning(NULL, "Hard Disk error", message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,6 +290,14 @@ void QApple::on_actionOptions_triggered()
|
|||
insertDisk(newOptions.disks[i], diskIDs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < hdIDs.size(); ++i)
|
||||
{
|
||||
if (currentOptions.hds[i] != newOptions.hds[i])
|
||||
{
|
||||
insertHD(newOptions.hds[i], hdIDs[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue