diff options
author | 2017-01-08 01:59:46 -0800 | |
---|---|---|
committer | 2017-01-08 01:59:46 -0800 | |
commit | 57ac19beee18a22ded082bd110fa4253540467ff (patch) | |
tree | 17cecf107e624aac1f8c9f9349fc42799b78abb9 | |
parent | 7a8d5118b5a5f4b233241b4046f45f3529419b63 (diff) |
pc_dsk: Handle 1.44MB images with 1,024-byte footer, which have turned up in a couple places (nw)
-rw-r--r-- | src/lib/formats/pc_dsk.cpp | 5 | ||||
-rw-r--r-- | src/lib/formats/upd765_dsk.cpp | 4 | ||||
-rw-r--r-- | src/lib/formats/upd765_dsk.h | 1 |
3 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/formats/pc_dsk.cpp b/src/lib/formats/pc_dsk.cpp index e7daeb1d829..cb54d5d9ce8 100644 --- a/src/lib/formats/pc_dsk.cpp +++ b/src/lib/formats/pc_dsk.cpp @@ -168,6 +168,11 @@ int pc_format::identify(io_generic *io, uint32_t form_factor) file_header_skip_bytes = 0x200; } + /* some 1.44MB images have a 1024-byte footer */ + if (size == 1474560 + 0x400) { + file_footer_skip_bytes = 0x400; + } + return upd765_format::identify(io, form_factor); } diff --git a/src/lib/formats/upd765_dsk.cpp b/src/lib/formats/upd765_dsk.cpp index 72e11257b89..67c7ce8b653 100644 --- a/src/lib/formats/upd765_dsk.cpp +++ b/src/lib/formats/upd765_dsk.cpp @@ -11,7 +11,7 @@ #include "emu.h" // emu_fatalerror #include "formats/upd765_dsk.h" -upd765_format::upd765_format(const format *_formats) : file_header_skip_bytes(0) +upd765_format::upd765_format(const format *_formats) : file_header_skip_bytes(0), file_footer_skip_bytes(0) { formats = _formats; } @@ -24,7 +24,7 @@ int upd765_format::find_size(io_generic *io, uint32_t form_factor) const if(form_factor != floppy_image::FF_UNKNOWN && form_factor != f.form_factor) continue; - if(size == file_header_skip_bytes + (uint64_t) compute_track_size(f) * f.track_count * f.head_count) + if(size == file_header_skip_bytes + (uint64_t) compute_track_size(f) * f.track_count * f.head_count + file_footer_skip_bytes) return i; } return -1; diff --git a/src/lib/formats/upd765_dsk.h b/src/lib/formats/upd765_dsk.h index 980d21a396e..716a7bebb97 100644 --- a/src/lib/formats/upd765_dsk.h +++ b/src/lib/formats/upd765_dsk.h @@ -45,6 +45,7 @@ public: protected: uint64_t file_header_skip_bytes; + uint64_t file_footer_skip_bytes; floppy_image_format_t::desc_e* get_desc_fm(const format &f, int ¤t_size, int &end_gap_index); floppy_image_format_t::desc_e* get_desc_mfm(const format &f, int ¤t_size, int &end_gap_index); |