diff options
author | 2022-03-10 02:55:40 +1100 | |
---|---|---|
committer | 2022-03-10 02:55:40 +1100 | |
commit | 422185fe558463a119cfdee25e2d4b6e5d71dc97 (patch) | |
tree | 10a01acb7c99b76a0cc575dabd4ce76ec9e3249f /src | |
parent | bbb9ec846a44598159258d36f21bae42437ee290 (diff) |
docs: Added page describing how MAME searches for media.
Also made error messages for missing CHDs and missing files for software
parts using the image file loader show search paths, and changed the
(poorly named) bitbanger device to use the image file loader rather than
the ROM loader for software items.
Diffstat (limited to 'src')
-rw-r--r-- | src/devices/imagedev/bitbngr.cpp | 30 | ||||
-rw-r--r-- | src/devices/imagedev/bitbngr.h | 2 | ||||
-rw-r--r-- | src/emu/debug/debugcmd.cpp | 10 | ||||
-rw-r--r-- | src/emu/diimage.cpp | 18 | ||||
-rw-r--r-- | src/emu/romload.cpp | 10 |
5 files changed, 35 insertions, 35 deletions
diff --git a/src/devices/imagedev/bitbngr.cpp b/src/devices/imagedev/bitbngr.cpp index 86c92c88ceb..dc31c4ccb83 100644 --- a/src/devices/imagedev/bitbngr.cpp +++ b/src/devices/imagedev/bitbngr.cpp @@ -28,8 +28,6 @@ DEFINE_DEVICE_TYPE(BITBANGER, bitbanger_device, "bitbanger", "Bitbanger") bitbanger_device::bitbanger_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, BITBANGER, tag, owner, clock), device_image_interface(mconfig, *this), - m_next(nullptr), - m_end(nullptr), m_interface(nullptr), m_is_readonly(false) { @@ -54,21 +52,10 @@ void bitbanger_device::output(uint8_t data) uint32_t bitbanger_device::input(void *buffer, uint32_t length) { - if (loaded_through_softlist()) - { - size_t const result = std::min<size_t>(length, m_end - m_next); - memcpy(buffer, m_next, result); - m_next += result; - return uint32_t(result); - } - else if (exists()) - { + if (exists()) return fread(buffer, length); - } else - { return 0; - } } @@ -89,7 +76,7 @@ void bitbanger_device::device_start() const software_list_loader &bitbanger_device::get_software_list_loader() const { - return rom_software_list_loader::instance(); + return image_software_list_loader::instance(); } @@ -100,16 +87,7 @@ const software_list_loader &bitbanger_device::get_software_list_loader() const image_init_result bitbanger_device::call_load() { - if (loaded_through_softlist()) - { - auto const length = get_software_region_length("input"); - m_next = get_software_region("input"); - m_end = m_next + length; - } - else - { - m_next = m_end = nullptr; - } + // we don't need to do anything special return image_init_result::PASS; } @@ -125,5 +103,5 @@ image_init_result bitbanger_device::call_create(int format_type, util::option_re void bitbanger_device::call_unload() { - m_next = m_end = nullptr; + // we don't need to do anything special } diff --git a/src/devices/imagedev/bitbngr.h b/src/devices/imagedev/bitbngr.h index 7ffcfd45a2b..5b02417cfc3 100644 --- a/src/devices/imagedev/bitbngr.h +++ b/src/devices/imagedev/bitbngr.h @@ -46,8 +46,6 @@ protected: virtual software_list_loader const &get_software_list_loader() const override; private: - uint8_t const *m_next; - uint8_t const *m_end; char const *m_interface; bool m_is_readonly; }; diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index 2915ef342db..bb93f050c95 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -1052,7 +1052,7 @@ bool debugger_commands::mini_printf(std::ostream &stream, std::string_view forma m_console.printf("Not enough parameters for format!\n"); return false; } - util::stream_format(stream, "%c", char(*param)); + stream << char(*param); param++; params--; break; @@ -1115,7 +1115,7 @@ void debugger_commands::execute_printf(const std::vector<std::string> ¶ms) /* then do a printf */ std::ostringstream buffer; if (mini_printf(buffer, params[0], params.size() - 1, &values[1])) - m_console.printf("%s\n", buffer.str()); + m_console.printf("%s\n", std::move(buffer).str()); } @@ -1134,7 +1134,7 @@ void debugger_commands::execute_logerror(const std::vector<std::string> ¶ms) /* then do a printf */ std::ostringstream buffer; if (mini_printf(buffer, params[0], params.size() - 1, &values[1])) - m_machine.logerror("%s", buffer.str()); + m_machine.logerror("%s", std::move(buffer).str()); } @@ -1153,7 +1153,7 @@ void debugger_commands::execute_tracelog(const std::vector<std::string> ¶ms) /* then do a printf */ std::ostringstream buffer; if (mini_printf(buffer, params[0], params.size() - 1, &values[1])) - m_console.get_visible_cpu()->debug()->trace_printf("%s", buffer.str().c_str()); + m_console.get_visible_cpu()->debug()->trace_printf("%s", std::move(buffer).str().c_str()); } @@ -1189,7 +1189,7 @@ void debugger_commands::execute_tracesym(const std::vector<std::string> ¶ms) // then do a printf std::ostringstream buffer; if (mini_printf(buffer, format.str(), params.size(), values)) - m_console.get_visible_cpu()->debug()->trace_printf("%s", buffer.str().c_str()); + m_console.get_visible_cpu()->debug()->trace_printf("%s", std::move(buffer).str().c_str()); } diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp index 6f01f8f26b5..2d192836ddd 100644 --- a/src/emu/diimage.cpp +++ b/src/emu/diimage.cpp @@ -26,6 +26,7 @@ #include <cctype> #include <cstring> #include <regex> +#include <sstream> //************************************************************************** @@ -683,7 +684,24 @@ bool device_image_interface::load_software(software_list_device &swlist, std::st else filerr = m_mame_file->open(romp->name()); if (filerr) + { m_mame_file.reset(); + std::ostringstream msg; + util::stream_format(msg, + "%s: error opening image file %s: %s (%s:%d)", + device().tag(), romp->name(), + filerr.message(), + filerr.category().name(), + filerr.value()); + if (!searchpath.empty()) + { + msg << " (tried in"; + for (auto const &path : searchpath) + msg << ' ' << path; + msg << ')'; + } + osd_printf_error("%s\n", std::move(msg).str()); + } warningcount += verify_length_and_hash(m_mame_file.get(), romp->name(), romp->get_length(), util::hash_collection(romp->hashdata())); diff --git a/src/emu/romload.cpp b/src/emu/romload.cpp index f408f865004..4ce34832c78 100644 --- a/src/emu/romload.cpp +++ b/src/emu/romload.cpp @@ -1072,7 +1072,13 @@ void rom_load_manager::process_disk_entries(std::initializer_list<std::reference err = do_open_disk(machine().options(), searchpath, romp, chd->orig_chd(), next_parent); if (err) { - handle_missing_file(romp, std::vector<std::string>(), err); + std::vector<std::string> tried; + for (auto const &paths : searchpath) + { + for (std::string const &path : paths.get()) + tried.emplace_back(path); + } + handle_missing_file(romp, tried, err); chd = nullptr; continue; } @@ -1222,7 +1228,7 @@ void rom_load_manager::load_software_part_region(device_t &device, software_list const software_info *const swinfo = swlist.find(std::string(swname)); if (swinfo) { - // dispay a warning for unsupported software + // display a warning for unsupported software // TODO: list supported clones like we do for machines? if (swinfo->supported() == software_support::PARTIALLY_SUPPORTED) { |