Add ability to override built-in GPU.

This commit is contained in:
joevt 2023-11-25 04:04:25 -08:00 committed by dingusdev
parent 077e6ebae5
commit d0a5a1e7be
3 changed files with 12 additions and 5 deletions

View File

@ -60,7 +60,7 @@ int MPC106::device_postinit()
std::string pci_dev_name;
static const std::map<std::string, int> pci_slots = {
{"pci_PERCH", DEV_FUN(0xC,0)}, {"pci_A1", DEV_FUN(0xD,0)}, {"pci_B1", DEV_FUN(0xE,0)}, {"pci_C1", DEV_FUN(0xF,0)}
{"pci_PERCH", DEV_FUN(0xC,0)}, {"pci_A1", DEV_FUN(0xD,0)}, {"pci_B1", DEV_FUN(0xE,0)}, {"pci_C1", DEV_FUN(0xF,0)}, {"pci_GPU", DEV_FUN(0x12,0)}
};
for (auto& slot : pci_slots) {
@ -351,6 +351,8 @@ static const PropMap Grackle_Properties = {
new StrProperty("")},
{"pci_C1",
new StrProperty("")},
{"pci_GPU",
new StrProperty("")},
};
static const DeviceDescription Grackle_Descriptor = {

View File

@ -123,8 +123,10 @@ int initialize_gossamer(std::string& id)
// add pci devices
grackle_obj->pci_register_device(
DEV_FUN(0x10,0), dynamic_cast<PCIDevice*>(gMachineObj->get_comp_by_name("Heathrow")));
grackle_obj->pci_register_device(
DEV_FUN(0x12,0), dynamic_cast<PCIDevice*>(gMachineObj->get_comp_by_name(id == "pmg3twr" ? "AtiRagePro" : "AtiRageGT")));
std::string gpu = GET_STR_PROP("pci_GPU");
if (gpu.empty())
SET_STR_PROP("pci_GPU", id == "pmg3twr" ? "AtiRagePro" : "AtiRageGT");
// add Athens clock generator device and register it with the I2C host
gMachineObj->add_device("Athens", std::unique_ptr<AthensClocks>(new AthensClocks(0x28)));
@ -168,11 +170,11 @@ static const PropMap gossamer_settings = {
};
static vector<string> pmg3_devices = {
"Grackle", "ScreamerSnd", "Heathrow", "AtiRageGT", "AtaHardDisk", "AtapiCdrom"
"Grackle", "ScreamerSnd", "Heathrow", "AtaHardDisk", "AtapiCdrom"
};
static vector<string> pmg3twr_devices = {
"Grackle", "ScreamerSnd", "Heathrow", "AtiRagePro", "AtaHardDisk", "AtapiCdrom"
"Grackle", "ScreamerSnd", "Heathrow", "AtaHardDisk", "AtapiCdrom"
};
static const MachineDescription pmg3dt_descriptor = {

View File

@ -196,6 +196,9 @@ typedef map<string, BasicProperty*> PropMap;
extern map<string, unique_ptr<BasicProperty>> gMachineSettings;
/** Conveniency macros to hide complex casts. */
#define SET_STR_PROP(name, value) \
dynamic_cast<StrProperty*>(gMachineSettings.at(name).get())->set_string(value)
#define GET_STR_PROP(name) \
dynamic_cast<StrProperty*>(gMachineSettings.at(name).get())->get_string()