summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
diff options
context:
space:
mode:
author Nathan Woods <npwoods@mess.org>2017-03-18 11:11:35 -0400
committer Vas Crabb <cuavas@users.noreply.github.com>2017-03-20 23:17:15 +1100
commitbcd35f9fd7cf8ab81dce386f906b68536bce0372 (patch)
treefff63b30cb0f466a85e200ec8792049cfab24f87 /src/emu
parentb4d333f1625debf6ecc586cff6f15b02a89f2818 (diff)
Fixed regression when loading multipart softlists
Pernod found a regression introduced in the 0.183 softlist refactoring whereby multi-part softlist items would not distribute to multiple slots. The problem was that the old code was relying on the image slots being loaded into the core. This is not the way the new system works, so I've added a hook into software_list_device::find_mountable_image() that allows the new approach to work.
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/diimage.h2
-rw-r--r--src/emu/softlist_dev.cpp31
-rw-r--r--src/emu/softlist_dev.h3
3 files changed, 28 insertions, 8 deletions
diff --git a/src/emu/diimage.h b/src/emu/diimage.h
index 49a9ff692ea..68fac1f8b9e 100644
--- a/src/emu/diimage.h
+++ b/src/emu/diimage.h
@@ -173,7 +173,7 @@ public:
void seterror(image_error_t err, const char *message);
void message(const char *format, ...) ATTR_PRINTF(2,3);
- bool exists() { return !m_image_name.empty(); }
+ bool exists() const { return !m_image_name.empty(); }
const char *filename() const { if (m_image_name.empty()) return nullptr; else return m_image_name.c_str(); }
const char *basename() const { if (m_basename.empty()) return nullptr; else return m_basename.c_str(); }
const char *basename_noext() const { if (m_basename_noext.empty()) return nullptr; else return m_basename_noext.c_str(); }
diff --git a/src/emu/softlist_dev.cpp b/src/emu/softlist_dev.cpp
index 7a80dc57569..01b4d6c1076 100644
--- a/src/emu/softlist_dev.cpp
+++ b/src/emu/softlist_dev.cpp
@@ -365,7 +365,7 @@ software_compatibility software_list_device::is_compatible(const software_part &
// that can automatically mount this software part
//-------------------------------------------------
-device_image_interface *software_list_device::find_mountable_image(const machine_config &mconfig, const software_part &part)
+device_image_interface *software_list_device::find_mountable_image(const machine_config &mconfig, const software_part &part, std::function<bool(const device_image_interface &)> filter)
{
// if automount="no", don't bother
const char *mount = part.feature("automount");
@@ -375,17 +375,36 @@ device_image_interface *software_list_device::find_mountable_image(const machine
for (device_image_interface &image : image_interface_iterator(mconfig.root_device()))
{
const char *interface = image.image_interface();
- if (interface != nullptr && part.matches_interface(interface))
- {
- if (!image.filename())
- return &image;
- }
+ if (interface != nullptr && part.matches_interface(interface) && filter(image))
+ return &image;
}
return nullptr;
}
//-------------------------------------------------
+// find_mountable_image - find an image interface
+// that can automatically mount this software part
+//-------------------------------------------------
+
+device_image_interface *software_list_device::find_mountable_image(const machine_config &mconfig, const software_part &part)
+{
+ // Multi-part softlists will distribute individual images serially (e.g. - first floppy to flop1, next one to flop2
+ // etc). Pre MAME 0.183 relied on the core doing this distribution between calls to find_mountable_image() so it
+ // could check to see if the slot was empty.
+ //
+ // When softlists were refactored in MAME 0.183, this was changed to build a "plan" for what needs to be loaded, so
+ // it was incorrect to check the image slot. This is why an overload for find_mountable_image() was created that
+ // takes an std::function. This overload is being preserved for compatibility with existing code, but I regard the
+ // continued existance of this overload is a red flag.
+ return find_mountable_image(
+ mconfig,
+ part,
+ [](const device_image_interface &image) { return !image.exists(); });
+}
+
+
+//-------------------------------------------------
// device_validity_check - validate the device
// configuration
//-------------------------------------------------
diff --git a/src/emu/softlist_dev.h b/src/emu/softlist_dev.h
index 2f526230705..461ec0f306c 100644
--- a/src/emu/softlist_dev.h
+++ b/src/emu/softlist_dev.h
@@ -159,7 +159,8 @@ public:
// static helpers
static software_list_device *find_by_name(const machine_config &mconfig, const std::string &name);
static void display_matches(const machine_config &config, const char *interface, const std::string &name);
- static device_image_interface *find_mountable_image(const machine_config &mconfig, const software_part &part);
+ static device_image_interface *find_mountable_image(const machine_config &mconfig, const software_part &part, std::function<bool (const device_image_interface &)> filter);
+ static device_image_interface *find_mountable_image(const machine_config &mconfig, const software_part &part);
protected:
// device-level overrides