diff options
author | 2022-09-19 02:33:50 -0400 | |
---|---|---|
committer | 2022-09-19 08:33:50 +0200 | |
commit | 5499683a239d9328a7c54b08135f31e7903ec772 (patch) | |
tree | e439ca5174cec47008c571f9c2636a5d4da68d81 /src/lib/formats/fs_coco_os9.cpp | |
parent | e1e30896f5cc3fd736564a9dea25d255241f6777 (diff) |
Changed fs::manager_t::enumerate_f() to simplify logic within file system drivers (#10106)
* Changed fs::manager_t::enumerate_f() to simplify logic within file system drivers
enumerate_f() used to contain quite a bit of boilerplate logic to determine whether a particular floppy type should be added. This change attempts to move this logic outside the file system drivers to simplify the drivers.
The riskiest part of this change is unformatted_image::enumerate_f(). I attempted to replicate the logic that was previously determining with unformatted image types to use, but the logic is tricky and it isn't clear to me that replicating the logic is the correct action - I may be cargo culting.
* Fix to floppy_image_device::fs_enum::add_raw()
* Updating FS_FAT to reflect this PR
* On the advise of Sarayan, I moved the filtering to the fs::manager_t::fs_enum base class. This is actually a less intrusive change than what I originally had because it keeps the unformatted raw image handling closer to what we had previously.
Some misgivings about these changes:
1. We now have fs::manager_t::fs_enum::add() being a thin call that invokes a protected method called fs::manager_t::fs_enum::add_format(). Better ideas for names are welcome.
2. It feels odd that we've removed the need to do filtering from the various FS modules, but the unformatted module has to ask the fs_enum() for its internal variables for filtering to perform the same logic. This seems to be the least worst option
Feedback is welcome
Diffstat (limited to 'src/lib/formats/fs_coco_os9.cpp')
-rw-r--r-- | src/lib/formats/fs_coco_os9.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/lib/formats/fs_coco_os9.cpp b/src/lib/formats/fs_coco_os9.cpp index dd3f0f48f8d..f72ae772f8f 100644 --- a/src/lib/formats/fs_coco_os9.cpp +++ b/src/lib/formats/fs_coco_os9.cpp @@ -155,13 +155,10 @@ const char *coco_os9_image::description() const // enumerate_f //------------------------------------------------- -void coco_os9_image::enumerate_f(floppy_enumerator &fe, u32 form_factor, const std::vector<u32> &variants) const +void coco_os9_image::enumerate_f(floppy_enumerator &fe) const { - if (has(form_factor, variants, floppy_image::FF_525, floppy_image::SSDD)) - { - fe.add(FLOPPY_COCO_RAWDSK_FORMAT, 161280, "coco_rawdsk_os9_35", "CoCo Raw Disk OS-9 single-sided 35 tracks"); - fe.add(FLOPPY_COCO_RAWDSK_FORMAT, 184320, "coco_rawdsk_os9_40", "CoCo Raw Disk OS-9 single-sided 40 tracks"); - } + fe.add(FLOPPY_COCO_RAWDSK_FORMAT, floppy_image::FF_525, floppy_image::SSSD, 161280, "coco_rawdsk_os9_35", "CoCo Raw Disk OS-9 single-sided 35 tracks"); + fe.add(FLOPPY_COCO_RAWDSK_FORMAT, floppy_image::FF_525, floppy_image::SSSD, 184320, "coco_rawdsk_os9_40", "CoCo Raw Disk OS-9 single-sided 40 tracks"); } |