mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-02-23 05:29:26 +00:00
Initial support for device path properties.
This commit is contained in:
parent
d113c4cf7a
commit
3a7e3c1986
@ -81,6 +81,7 @@ static const map<string, string> PropHelp = {
|
||||
{"fdd_wr_prot", "toggles floppy disk's write protection"},
|
||||
{"hdd_img", "specifies path to hard disk image"},
|
||||
{"hdd_wr_prot", "toggles hard disk's write protection"},
|
||||
{"cdr_config", "CD-ROM device path in [bus]:[device#] format"},
|
||||
{"cdr_img", "specifies path to CD-ROM image"},
|
||||
{"mon_id", "specifies which monitor to emulate"},
|
||||
{"pci_A1", "insert a PCI device into A1 slot"},
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-22 divingkatae and maximum
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
@ -144,3 +144,21 @@ void BinProperty::set_string(string val)
|
||||
LOG_F(ERROR, "Invalid BinProperty value %s!", val.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void parse_device_path(string dev_path, string& bus_id, uint32_t& dev_num) {
|
||||
bus_id = "";
|
||||
dev_num = -1;
|
||||
|
||||
size_t delimiter_pos = dev_path.find(":");
|
||||
if (delimiter_pos == string::npos)
|
||||
ABORT_F("Invalid device path %s", dev_path.c_str());
|
||||
|
||||
bus_id = dev_path.substr(0, delimiter_pos);
|
||||
|
||||
try {
|
||||
dev_num = (uint32_t)strtoul(dev_path.substr(delimiter_pos+1).c_str(), 0, 0);
|
||||
} catch (string bad_string) {
|
||||
ABORT_F("Invalid device number %s in device path %s", bad_string.c_str(),
|
||||
dev_path.c_str());
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-22 divingkatae and maximum
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
@ -189,6 +189,8 @@ private:
|
||||
int bin_val;
|
||||
};
|
||||
|
||||
void parse_device_path(string dev_path, string& bus_id, uint32_t& dev_num);
|
||||
|
||||
/** Special map type for specifying machine presets. */
|
||||
typedef map<string, BasicProperty*> PropMap;
|
||||
|
||||
@ -205,4 +207,4 @@ extern map<string, unique_ptr<BasicProperty>> gMachineSettings;
|
||||
#define GET_BIN_PROP(name) \
|
||||
dynamic_cast<BinProperty*>(gMachineSettings.at(name).get())->get_val()
|
||||
|
||||
#endif /* MACHINE_PROPERTIES_H */
|
||||
#endif // MACHINE_PROPERTIES_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user