diff options
-rw-r--r-- | src/devices/imagedev/cassette.h | 1 | ||||
-rw-r--r-- | src/devices/imagedev/magtape.h | 1 | ||||
-rw-r--r-- | src/devices/imagedev/memcard.h | 1 | ||||
-rw-r--r-- | src/devices/imagedev/printer.h | 1 | ||||
-rw-r--r-- | src/emu/diimage.cpp | 23 |
5 files changed, 18 insertions, 9 deletions
diff --git a/src/devices/imagedev/cassette.h b/src/devices/imagedev/cassette.h index ad71e062e70..6d05b5e94a5 100644 --- a/src/devices/imagedev/cassette.h +++ b/src/devices/imagedev/cassette.h @@ -67,6 +67,7 @@ public: virtual bool is_writeable() const noexcept override { return true; } virtual bool is_creatable() const noexcept override { return true; } virtual bool is_reset_on_load() const noexcept override { return false; } + virtual bool support_command_line_image_creation() const noexcept override { return true; } virtual const char *image_interface() const noexcept override { return m_interface; } virtual const char *file_extensions() const noexcept override { return m_extension_list; } virtual const char *image_type_name() const noexcept override { return "cassette"; } diff --git a/src/devices/imagedev/magtape.h b/src/devices/imagedev/magtape.h index 5834573240c..8d302a93a58 100644 --- a/src/devices/imagedev/magtape.h +++ b/src/devices/imagedev/magtape.h @@ -28,6 +28,7 @@ public: virtual bool is_writeable() const noexcept override { return true; } virtual bool is_creatable() const noexcept override { return true; } virtual bool is_reset_on_load() const noexcept override { return false; } + virtual bool support_command_line_image_creation() const noexcept override { return true; } virtual const char *image_type_name() const noexcept override { return "magtape"; } virtual const char *image_brief_type_name() const noexcept override { return "mtap"; } diff --git a/src/devices/imagedev/memcard.h b/src/devices/imagedev/memcard.h index 33ff6a4a62d..afac414a39a 100644 --- a/src/devices/imagedev/memcard.h +++ b/src/devices/imagedev/memcard.h @@ -27,6 +27,7 @@ public: virtual bool is_readable() const noexcept override { return true; } virtual bool is_writeable() const noexcept override { return true; } virtual bool is_creatable() const noexcept override { return true; } + virtual bool support_command_line_image_creation() const noexcept override { return true; } virtual const char *image_type_name() const noexcept override { return "memcard"; } virtual const char *image_brief_type_name() const noexcept override { return "memc"; } diff --git a/src/devices/imagedev/printer.h b/src/devices/imagedev/printer.h index 509ecc43ef2..f509527a014 100644 --- a/src/devices/imagedev/printer.h +++ b/src/devices/imagedev/printer.h @@ -39,6 +39,7 @@ public: virtual bool is_writeable() const noexcept override { return true; } virtual bool is_creatable() const noexcept override { return true; } virtual bool is_reset_on_load() const noexcept override { return false; } + virtual bool support_command_line_image_creation() const noexcept override { return true; } virtual const char *file_extensions() const noexcept override { return "prn"; } virtual const char *image_type_name() const noexcept override { return "printout"; } virtual const char *image_brief_type_name() const noexcept override { return "prin"; } diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp index c741cab8b40..3073d8f2495 100644 --- a/src/emu/diimage.cpp +++ b/src/emu/diimage.cpp @@ -562,15 +562,20 @@ std::vector<u32> device_image_interface::determine_open_plan(bool is_create) { std::vector<u32> open_plan; - // emit flags into a vector - if (!is_create && is_readable() && is_writeable()) - open_plan.push_back(OPEN_FLAG_READ | OPEN_FLAG_WRITE); - if (!is_create && !is_readable() && is_writeable()) - open_plan.push_back(OPEN_FLAG_WRITE); - if (!is_create && is_readable()) - open_plan.push_back(OPEN_FLAG_READ); - if (is_create && is_writeable() && is_creatable()) - open_plan.push_back(OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE); + if (!is_create) + { + if (is_writeable()) + open_plan.push_back(is_readable() ? (OPEN_FLAG_READ | OPEN_FLAG_WRITE) : OPEN_FLAG_WRITE); + else if (is_readable()) + open_plan.push_back(OPEN_FLAG_READ); + } + else if (is_writeable() && is_creatable()) + { + if (is_readable()) + open_plan.push_back(OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE); + else + open_plan.push_back(OPEN_FLAG_WRITE | OPEN_FLAG_CREATE); + } return open_plan; } |