Fix interpretation of BPB value used by Atari ST in FAT16 partitions of type BIG GEMDOS.

This commit is contained in:
2021-06-02 20:21:56 +01:00
parent f2b5a4b64c
commit 2d72ec3574

View File

@@ -250,6 +250,16 @@ namespace Aaru.Filesystems
if(sum == 0x1234)
XmlFsType.Bootable = true;
// BGM changes the bytes per sector instead of changing the sectors per cluster. Why?! WHY!?
uint ratio = fakeBpb.bps / imagePlugin.Info.SectorSize;
fakeBpb.bps = (ushort)imagePlugin.Info.SectorSize;
fakeBpb.spc = (byte)(fakeBpb.spc * ratio);
fakeBpb.rsectors = (ushort)(fakeBpb.rsectors * ratio);
fakeBpb.big_sectors = fakeBpb.sectors * ratio;
fakeBpb.sectors = 0;
fakeBpb.spfat = (ushort)(fakeBpb.spfat * ratio);
fakeBpb.sptrk = (ushort)(fakeBpb.sptrk * ratio);
break;
}