summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/diimage.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2022-12-24 02:33:22 +1100
committer Vas Crabb <vas@vastheman.com>2022-12-24 02:33:22 +1100
commit50fa0a6609235cbb6babf3b1a11e274542a1c00c (patch)
tree9a3ebccc0ccda1878ff40fc5d896ca57d8297208 /src/emu/diimage.cpp
parent471438ac10f84c22558ff642ed1c1cac3e3e164e (diff)
imagedev: Allow command-line creation for tapes/memory cards/printouts.
Also made image devices not request read access when creating files for write-only devices.
Diffstat (limited to 'src/emu/diimage.cpp')
-rw-r--r--src/emu/diimage.cpp23
1 files changed, 14 insertions, 9 deletions
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;
}