From 0514442753c5163ae1b2f907e05f17b430eb9968 Mon Sep 17 00:00:00 2001 From: Nathan Woods Date: Sat, 29 Apr 2017 19:43:05 -0400 Subject: [PATCH] Fixed an issue that could cause problems when loading reset_on_load devices (like cartridges) from softlists at runtime This was not guaranteed to cause a problem; the specific issue here was reported by mr_gw in the context of the CoCo, and the proximate issue (hanging) was in CoCo-specific code. That said, this could cause problems elsewhere. --- src/emu/diimage.cpp | 14 +++++++------- src/emu/diimage.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp index f55d4bf074b..1c256684821 100644 --- a/src/emu/diimage.cpp +++ b/src/emu/diimage.cpp @@ -1082,6 +1082,13 @@ image_init_result device_image_interface::load(const std::string &path) image_init_result device_image_interface::load_software(const std::string &software_identifier) { + // Is this a software part that forces a reset and we're at runtime? If so, get this loaded through reset_and_load + if (is_reset_on_load() && !init_phase()) + { + reset_and_load(software_identifier); + return image_init_result::PASS; + } + // Prepare to load unload(); clear_error(); @@ -1410,13 +1417,6 @@ bool device_image_interface::load_software_part(const std::string &identifier) return false; } - // Is this a software part that forces a reset and we're at runtime? If so, get this loaded through reset_and_load - if (is_reset_on_load() && !init_phase()) - { - reset_and_load(identifier); - return true; - } - // Load the software part const char *swname = m_software_part_ptr->info().shortname().c_str(); const rom_entry *start_entry = m_software_part_ptr->romdata().data(); diff --git a/src/emu/diimage.h b/src/emu/diimage.h index 7d05f870ec5..bf656b6a040 100644 --- a/src/emu/diimage.h +++ b/src/emu/diimage.h @@ -278,7 +278,6 @@ protected: void image_checkhash(); const software_part *find_software_item(const std::string &identifier, bool restrict_to_interface, software_list_device **device = nullptr) const; - bool load_software_part(const std::string &identifier); std::string software_get_default_slot(const char *default_card_slot) const; void add_format(std::unique_ptr &&format); @@ -311,6 +310,7 @@ private: static image_error_t image_error_from_file_error(osd_file::error filerr); std::vector determine_open_plan(bool is_create); void update_names(); + bool load_software_part(const std::string &identifier); bool init_phase() const; static void run_hash(util::core_file &file, void(*partialhash)(util::hash_collection &, const unsigned char *, unsigned long, const char *), util::hash_collection &hashes, const char *types);