From f36c813ca57571cab8f5357ce4d96123f6301b81 Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 25 Jul 2024 00:46:33 +0200 Subject: [PATCH] HxC MFM format: Add heuristic to default to a sane RPM when the RPM in the image is set to 0, fixes #4357. --- src/floppy/fdd_mfm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/floppy/fdd_mfm.c b/src/floppy/fdd_mfm.c index b4c859d5d..f998a6201 100644 --- a/src/floppy/fdd_mfm.c +++ b/src/floppy/fdd_mfm.c @@ -450,13 +450,20 @@ mfm_load(int drive, char *fn) } if (!(dev->hdr.if_type & 0x80)) { + pclog("Bit rate = %i\n", dev->hdr.bit_rate); dbr = round(((double) dev->hdr.bit_rate) / 50.0) * 50.0; dev->br_rounded = (int) dbr; mfm_log("Rounded bit rate: %i kbps\n", dev->br_rounded); + pclog("Rounded bit rate: %i kbps\n", dev->br_rounded); - dbr = round(((double) dev->hdr.rpm) / 60.0) * 60.0; + pclog("RPM = %i\n", dev->hdr.rpm); + if (dev->hdr.rpm != 0) + dbr = round(((double) dev->hdr.rpm) / 60.0) * 60.0; + else + dbr = (dev->br_rounded == 300) ? 360 : 300; dev->rpm_rounded = (int) dbr; mfm_log("Rounded RPM: %i kbps\n", dev->rpm_rounded); + pclog("Rounded RPM: %i kbps\n", dev->rpm_rounded); } /* Set up the drive unit. */