pc_dsk: Handle 1.44MB images with 1,024-byte footer, which have turned up in a couple places (nw)

This commit is contained in:
Justin Kerk 2017-01-08 01:59:46 -08:00
parent 7a8d5118b5
commit 57ac19beee
3 changed files with 8 additions and 2 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -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 &current_size, int &end_gap_index);
floppy_image_format_t::desc_e* get_desc_mfm(const format &f, int &current_size, int &end_gap_index);