Device factory sets device features

This commit is contained in:
Uwe Seimet 2021-08-25 00:18:21 +02:00
parent ac9f9bb335
commit 2d364f16d8
8 changed files with 40 additions and 35 deletions

View File

@ -44,33 +44,64 @@ Device *DeviceFactory::CreateDevice(PbDeviceType& type, const string& filename,
}
}
Device *device = NULL;
switch (type) {
case SAHD:
return new SASIHD();
device = new SASIHD();
break;
case SCHD:
if (ext == "hdn" || ext == "hdi" || ext == "nhd") {
return new SCSIHD_NEC();
device = new SCSIHD_NEC();
((Disk *)device)->SetVendor("NEC");
} else {
return new SCSIHD();
device = new SCSIHD();
device->SetProtectable(true);
((Disk *)device)->SetSectorSizeConfigurable(true);
}
break;
case SCRM:
return new SCSIHD(true);
device = new SCSIHD(true);
device->SetProtectable(true);
device->SetLockable(true);
((Disk *)device)->SetSectorSizeConfigurable(true);
break;
case SCMO:
return new SCSIMO();
device = new SCSIMO();
device->SetProtectable(true);
device->SetRemovable(true);
device->SetLockable(true);
device->SetProduct("SCSI MO");
break;
case SCCD:
return new SCSICD();
device = new SCSICD();
device->SetReadOnly(true);
device->SetRemovable(true);
device->SetLockable(true);
device->SetProduct("SCSI CD-ROM");
break;
case SCBR:
return new SCSIBR();
device = new SCSIBR();
device->SetProduct("BRIDGE");
break;
case SCDP:
return new SCSIDaynaPort();
device = new SCSIDaynaPort();
device->SetVendor("Dayna");
device->SetProduct("SCSI/Link");
device->SetRevision("1.4a");
break;
default:
return NULL;
assert(false);
break;
}
return device;
}

View File

@ -31,7 +31,6 @@
//---------------------------------------------------------------------------
SASIHD::SASIHD() : Disk("SAHD")
{
SetProtectable(true);
}
//---------------------------------------------------------------------------

View File

@ -45,12 +45,6 @@ const BYTE SCSIDaynaPort::m_apple_talk_addr[6] = { 0x09, 0x00, 0x07, 0xff, 0xff,
//---------------------------------------------------------------------------
SCSIDaynaPort::SCSIDaynaPort() : Disk("SCDP")
{
SetRemovable(false);
SetVendor("Dayna");
SetProduct("SCSI/Link");
SetRevision("1.4a");
AddCommand(SCSIDEV::eCmdTestUnitReady, "TestUnitReady", &SCSIDaynaPort::TestUnitReady);
AddCommand(SCSIDEV::eCmdRead6, "Read6", &SCSIDaynaPort::Read6);
AddCommand(SCSIDEV::eCmdWrite6, "Write6", &SCSIDaynaPort::Write6);

View File

@ -36,10 +36,6 @@ using namespace std;
//---------------------------------------------------------------------------
SCSIBR::SCSIBR() : Disk("SCBR")
{
SetRemovable(false);
SetProduct("BRIDGE");
fsoptlen = 0;
fsoutlen = 0;
fsresult = 0;

View File

@ -226,11 +226,6 @@ bool CDTrack::IsAudio() const
//---------------------------------------------------------------------------
SCSICD::SCSICD() : Disk("SCCD"), MmcDevice(), FileSupport()
{
SetRemovable(true);
SetReadOnly(true);
SetProduct("SCSI CD-ROM");
// NOT in raw format
rawfile = false;

View File

@ -33,8 +33,6 @@
SCSIHD::SCSIHD(bool removable) : Disk(removable ? "SCRM" : "SCHD")
{
SetRemovable(removable);
SetProtectable(true);
SetSectorSizeConfigurable(true);
}
//---------------------------------------------------------------------------

View File

@ -31,10 +31,6 @@
//---------------------------------------------------------------------------
SCSIHD_NEC::SCSIHD_NEC() : SCSIHD()
{
SetSectorSizeConfigurable(false);
SetVendor("NEC");
// Work initialization
cylinders = 0;
heads = 0;

View File

@ -32,10 +32,6 @@
//---------------------------------------------------------------------------
SCSIMO::SCSIMO() : Disk("SCMO")
{
SetRemovable(true);
SetProtectable(true);
SetProduct("SCSI MO");
}
//---------------------------------------------------------------------------