Changed how devices are created in the FileStore factories.

This commit is contained in:
a2geek committed 2026-11-01 18:36:58 -06:00
1 parent b040f883af
commit d9eaaab3c3
2 files changed
+12 -7

No files matched your search

@@ -96,12 +96,12 @@ public interface FileStoreFactory {
private BlockDeviceBuilder(Context ctx) {
this.ctx = ctx;
}
public BlockDeviceBuilder check16Sector(Consumer<BlockDevice> check) {
public BlockDeviceBuilder check16Sector(SectorOrder sectorOrder, Consumer<BlockDevice> check) {
if (ctx.nibbleTrackReaderWriter != null) {
Optional<TrackSectorDevice> nibble = TrackSectorNibbleDevice.identify(ctx.nibbleTrackReaderWriter);
nibble.ifPresent(trackSectorDevice -> {
if (trackSectorDevice.getGeometry().sectorsPerTrack() == 16) {
BlockDevice device = new TrackSectorToBlockAdapter(trackSectorDevice.request(SectorOrder.PRODOS),
BlockDevice device = new TrackSectorToBlockAdapter(trackSectorDevice.request(sectorOrder),
TrackSectorToBlockAdapter.BlockStyle.PRODOS);
check.accept(device);
}
@@ -110,18 +110,22 @@ public interface FileStoreFactory {
else if (ctx.source.isApproxBetween(DiskConstants.APPLE_140KB_DISK, DiskConstants.APPLE_160KB_DISK)) {
if (ctx.source.is(Hint.DOS_SECTOR_ORDER) || ctx.source.extensionLike("do")) {
TrackSectorDevice trackSectorDevice = new OrderedTrackSectorDevice(ctx.source, SectorOrder.DOS);
BlockDevice device = new TrackSectorToBlockAdapter(trackSectorDevice.request(SectorOrder.PRODOS),
BlockDevice device = new TrackSectorToBlockAdapter(trackSectorDevice.request(sectorOrder),
TrackSectorToBlockAdapter.BlockStyle.PRODOS);
check.accept(device);
} else if (ctx.source.is(Hint.PRODOS_BLOCK_ORDER) || ctx.source.extensionLike("po")) {
BlockDevice device = new ProdosOrderedBlockDevice(ctx.source, BlockDevice.STANDARD_BLOCK_SIZE);
TrackSectorDevice trackSectorDevice = new OrderedTrackSectorDevice(ctx.source, SectorOrder.PRODOS);
BlockDevice device = new TrackSectorToBlockAdapter(trackSectorDevice.request(sectorOrder),
TrackSectorToBlockAdapter.BlockStyle.PRODOS);
check.accept(device);
} else {
TrackSectorDevice trackSectorDevice = new OrderedTrackSectorDevice(ctx.source, SectorOrder.DOS);
BlockDevice doDevice = new TrackSectorToBlockAdapter(trackSectorDevice.request(SectorOrder.PRODOS),
BlockDevice doDevice = new TrackSectorToBlockAdapter(trackSectorDevice.request(sectorOrder),
TrackSectorToBlockAdapter.BlockStyle.PRODOS);
check.accept(doDevice);
BlockDevice poDevice = new ProdosOrderedBlockDevice(ctx.source, BlockDevice.STANDARD_BLOCK_SIZE);
trackSectorDevice = new OrderedTrackSectorDevice(ctx.source, SectorOrder.PRODOS);
BlockDevice poDevice = new TrackSectorToBlockAdapter(trackSectorDevice.request(sectorOrder),
TrackSectorToBlockAdapter.BlockStyle.PRODOS);
check.accept(poDevice);
}
}
@@ -21,6 +21,7 @@ package org.applecommander.os.pascal;
import com.webcodepro.applecommander.storage.DiskConstants;
import org.applecommander.device.BlockDevice;
import org.applecommander.device.SectorOrder;
import org.applecommander.filestore.FileStoreFactory;
import org.applecommander.filestore.FileStoreOrganization;
import org.applecommander.util.DataBuffer;
@@ -48,7 +49,7 @@ public class PascalFileStoreFactory implements FileStoreFactory, PascalConstants
@Override
public void inspect(Context ctx) {
ctx.blockDevice()
.check16Sector(device -> {
.check16Sector(SectorOrder.PRODOS, device -> {
if (check(device)) {
ctx.fileStores.add(new PascalFileStore(device));
}