summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/imagedev/floppy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/imagedev/floppy.cpp')
-rw-r--r--src/devices/imagedev/floppy.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp
index 15637c033e5..53304a357da 100644
--- a/src/devices/imagedev/floppy.cpp
+++ b/src/devices/imagedev/floppy.cpp
@@ -656,9 +656,9 @@ std::pair<std::error_condition, std::string> floppy_image_device::call_load()
const floppy_image_format_t *best_format = nullptr;
for (const floppy_image_format_t *format : m_fif_list) {
int score = format->identify(*io, m_form_factor, m_variants);
- if(score && format->extension_matches(filename()))
+ if (score && format->extension_matches(filename()))
score |= floppy_image_format_t::FIFID_EXT;
- if(score > best) {
+ if (score > best) {
best = score;
best_format = format;
}
@@ -672,6 +672,11 @@ std::pair<std::error_condition, std::string> floppy_image_device::call_load()
m_image.reset();
return std::make_pair(image_error::INVALIDIMAGE, "Incompatible image file format or corrupted data");
}
+
+ char const *const wp = get_feature("write_protected");
+ if (wp && !std::strcmp(wp, "true"))
+ make_readonly();
+
m_output_format = is_readonly() ? nullptr : best_format;
m_image_dirty = false;