From 1d9a61aa0933137b59f254309a965172e252ff6c Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 13 Nov 2011 15:28:56 +0000 Subject: [PATCH] Fixed reading default card and throw exception now on wrong slot item name (no whatsnew) --- src/emu/dislot.c | 7 ++++++- src/emu/mconfig.c | 10 ++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/emu/dislot.c b/src/emu/dislot.c index 5295b260cb9..a794589aa13 100644 --- a/src/emu/dislot.c +++ b/src/emu/dislot.c @@ -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); diff --git a/src/emu/mconfig.c b/src/emu/mconfig.c index 70df85c5436..1916a2a0fbe 100644 --- a/src/emu/mconfig.c +++ b/src/emu/mconfig.c @@ -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()); + } } }