mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-12-27 15:29:39 +00:00
atahd: don't register device for empty images.
Workaround for the case when no hard disk image was specified. The device instance is still there but it won't be visible by the guest OS.
This commit is contained in:
parent
d9b02ecd8d
commit
eaddcab0ba
@ -44,6 +44,10 @@ int AtaHardDisk::device_postinit() {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string hdd_image_path = GET_STR_PROP("hdd_img");
|
||||||
|
if (hdd_image_path.empty())
|
||||||
|
return 0;
|
||||||
|
|
||||||
std::string bus_id;
|
std::string bus_id;
|
||||||
uint32_t dev_num;
|
uint32_t dev_num;
|
||||||
|
|
||||||
@ -52,10 +56,7 @@ int AtaHardDisk::device_postinit() {
|
|||||||
auto bus_obj = dynamic_cast<IdeChannel*>(gMachineObj->get_comp_by_name(bus_id));
|
auto bus_obj = dynamic_cast<IdeChannel*>(gMachineObj->get_comp_by_name(bus_id));
|
||||||
bus_obj->register_device(dev_num, this);
|
bus_obj->register_device(dev_num, this);
|
||||||
|
|
||||||
std::string hdd_image_path = GET_STR_PROP("hdd_img");
|
this->insert_image(hdd_image_path);
|
||||||
if (!hdd_image_path.empty()) {
|
|
||||||
this->insert_image(hdd_image_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user