mirror of
https://github.com/holub/mame
synced 2025-05-20 20:58:51 +03:00
Fixed reading default card and throw exception now on wrong slot item name (no whatsnew)
This commit is contained in:
parent
35762c3186
commit
1d9a61aa09
@ -30,8 +30,13 @@ void device_slot_interface::static_set_slot_info(device_t &device, const slot_in
|
||||
|
||||
device_t* device_slot_interface::get_card_device()
|
||||
{
|
||||
const char *subtag = device().mconfig().options().value(device().tag());
|
||||
const char *subtag;
|
||||
device_t *dev = NULL;
|
||||
if (!device().mconfig().options().exists(device().tag())) {
|
||||
subtag = m_default_card;
|
||||
} else {
|
||||
subtag = device().mconfig().options().value(device().tag());
|
||||
}
|
||||
if (subtag) {
|
||||
device_slot_card_interface *intf = NULL;
|
||||
dev = device().subdevice(subtag);
|
||||
|
@ -79,13 +79,19 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options)
|
||||
if (!options.exists(owner.tag()))
|
||||
selval = slot->get_default_card(devicelist(), options);
|
||||
|
||||
if (selval != NULL)
|
||||
for (int i = 0; intf[i].name != NULL; i++)
|
||||
if (selval != NULL && strlen(selval)!=0) {
|
||||
bool found = false;
|
||||
for (int i = 0; intf[i].name != NULL; i++) {
|
||||
if (strcmp(selval, intf[i].name) == 0) {
|
||||
device_t *new_dev = device_add(&owner, intf[i].name, intf[i].devtype, 0);
|
||||
found = true;
|
||||
if (!options.exists(owner.tag()))
|
||||
device_t::static_set_input_default(*new_dev, slot->input_ports_defaults());
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
throw emu_fatalerror("Unknown slot option '%s' in slot '%s'", selval, owner.tag());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user