mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-12-25 03:29:38 +00:00
machinepdm: properly insert SCSI hard disk image.
Skip SCSI hard disk registration if no disk image was given.
This commit is contained in:
parent
6ffe28a8a4
commit
8abefb8f8d
@ -41,8 +41,7 @@ ScsiHardDisk::ScsiHardDisk(int my_id) : ScsiDevice(my_id) {
|
|||||||
supports_types(HWCompType::SCSI_DEV);
|
supports_types(HWCompType::SCSI_DEV);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScsiHardDisk::insert_image(std::string filename) {
|
void ScsiHardDisk::insert_image(std::string filename) {
|
||||||
|
|
||||||
//We don't want to store everything in memory, but
|
//We don't want to store everything in memory, but
|
||||||
//we want to keep the hard disk available.
|
//we want to keep the hard disk available.
|
||||||
this->hdd_img.open(filename, ios::out | ios::in | ios::binary);
|
this->hdd_img.open(filename, ios::out | ios::in | ios::binary);
|
||||||
@ -250,4 +249,4 @@ static const PropMap SCSI_HD_Properties = {
|
|||||||
static const DeviceDescription SCSI_HD_Descriptor =
|
static const DeviceDescription SCSI_HD_Descriptor =
|
||||||
{ScsiHardDisk::create, {}, SCSI_HD_Properties};
|
{ScsiHardDisk::create, {}, SCSI_HD_Properties};
|
||||||
|
|
||||||
REGISTER_DEVICE(ScsiDevice, SCSI_HD_Descriptor);
|
REGISTER_DEVICE(ScsiHD, SCSI_HD_Descriptor);
|
||||||
|
@ -83,9 +83,15 @@ int initialize_pdm(std::string& id)
|
|||||||
gMachineObj->add_device("SCSI0", std::unique_ptr<ScsiBus>(new ScsiBus()));
|
gMachineObj->add_device("SCSI0", std::unique_ptr<ScsiBus>(new ScsiBus()));
|
||||||
auto scsi_bus = dynamic_cast<ScsiBus*>(gMachineObj->get_comp_by_name("SCSI0"));
|
auto scsi_bus = dynamic_cast<ScsiBus*>(gMachineObj->get_comp_by_name("SCSI0"));
|
||||||
|
|
||||||
|
std::string hd_image_path = GET_STR_PROP("hdd_img");
|
||||||
|
if (!hd_image_path.empty()) {
|
||||||
// attach SCSI HD to the main bus, ID #0
|
// attach SCSI HD to the main bus, ID #0
|
||||||
gMachineObj->add_device("SCSI_HD", std::unique_ptr<ScsiHardDisk>(new ScsiHardDisk(0)));
|
gMachineObj->add_device("SCSI_HD", std::unique_ptr<ScsiHardDisk>(new ScsiHardDisk(0)));
|
||||||
scsi_bus->register_device(0, dynamic_cast<ScsiDevice*>(gMachineObj->get_comp_by_name("SCSI_HD")));
|
scsi_bus->register_device(0, dynamic_cast<ScsiDevice*>(gMachineObj->get_comp_by_name("SCSI_HD")));
|
||||||
|
// insert specified disk image
|
||||||
|
auto my_hd = dynamic_cast<ScsiHardDisk*>(gMachineObj->get_comp_by_name("SCSI_HD"));
|
||||||
|
my_hd->insert_image(hd_image_path);
|
||||||
|
}
|
||||||
|
|
||||||
// Init virtual CPU and request MPC601
|
// Init virtual CPU and request MPC601
|
||||||
ppc_cpu_init(hmc_obj, PPC_VER::MPC601, 7812500ULL);
|
ppc_cpu_init(hmc_obj, PPC_VER::MPC601, 7812500ULL);
|
||||||
@ -113,7 +119,7 @@ static const PropMap pm6100_settings = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static vector<string> pm6100_devices = {
|
static vector<string> pm6100_devices = {
|
||||||
"HMC", "Amic"
|
"HMC", "Amic", "ScsiHD"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const MachineDescription pm6100_descriptor = {
|
static const MachineDescription pm6100_descriptor = {
|
||||||
|
Loading…
Reference in New Issue
Block a user