d88_dsk.cpp: Be more permissive about allowing double-sided images in single-sided drives

This commit is contained in:
AJR 2024-09-07 22:58:42 -04:00
parent edbfe76b37
commit 425573a0cb

View File

@ -477,6 +477,16 @@ bool d88_format::load(util::random_read &io, uint32_t form_factor, const std::ve
if(!head_count)
return false;
int img_tracks, img_heads;
image.get_maximal_geometry(img_tracks, img_heads);
if (track_count > img_tracks)
{
osd_printf_error("d88: Floppy disk has too many tracks for this drive (floppy tracks=%d, drive tracks=%d).\n", track_count, img_tracks);
return false;
}
if (head_count > img_heads)
osd_printf_warning("d88: Floppy disk has excess of heads for this drive that will be discarded (floppy heads=%d, drive heads=%d).\n", head_count, img_heads);
uint32_t track_pos[164];
std::tie(err, actual) = read_at(io, 32, track_pos, 164*4); // FIXME: check for errors and premature EOF
@ -535,10 +545,12 @@ bool d88_format::load(util::random_read &io, uint32_t form_factor, const std::ve
sects[i].data = nullptr;
}
if(density == 0x40)
build_pc_track_fm(track, head, image, cell_count / 2, sector_count, sects, calc_default_pc_gap3_size(form_factor, sects[0].actual_size));
else
build_pc_track_mfm(track, head, image, cell_count, sector_count, sects, calc_default_pc_gap3_size(form_factor, sects[0].actual_size));
if(head < img_heads) {
if(density == 0x40)
build_pc_track_fm(track, head, image, cell_count / 2, sector_count, sects, calc_default_pc_gap3_size(form_factor, sects[0].actual_size));
else
build_pc_track_mfm(track, head, image, cell_count, sector_count, sects, calc_default_pc_gap3_size(form_factor, sects[0].actual_size));
}
}
return true;