From 24ecdbe75b8180180b61b71ce5b274c834b40f81 Mon Sep 17 00:00:00 2001 From: joevt Date: Fri, 2 Sep 2022 00:24:03 -0700 Subject: [PATCH] Allow non-HFS/MFS raw floppies Such as FAT formatted floppies which should be readable in Open Firmware (when floppy support is updated to work in Open Firmware). --- devices/floppy/floppyimg.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/devices/floppy/floppyimg.cpp b/devices/floppy/floppyimg.cpp index 47e1db3..7298cad 100644 --- a/devices/floppy/floppyimg.cpp +++ b/devices/floppy/floppyimg.cpp @@ -64,7 +64,7 @@ static FlopImgType identify_image(std::ifstream& img_file) } } - return FlopImgType::UNKNOWN; + return FlopImgType::RAW; } static int64_t get_hfs_vol_size(const uint8_t *mdb_data) @@ -133,17 +133,16 @@ int RawFloppyImg::calc_phys_params() } else if (buf[0] == 0xD2 && buf[1] == 0xD7) { // check MFS volume size } else { - LOG_F(ERROR, "RawFloppyImg: unknown volume type!"); - return -1; + LOG_F(WARNING, "RawFloppyImg: unknown volume type!"); } - if (vol_size > this->img_size) { + if (vol_size && (vol_size > this->img_size)) { LOG_F(INFO, "RawFloppyImg: volume size > image size!"); LOG_F(INFO, "Volume size: %llu, Image size: %d", vol_size, this->img_size); return -1; } - // raw images don't include anything than raw disk data + // raw images don't include anything other than raw disk data this->data_size = this->img_size; // guess disk format from image file size