From 2d72ec3574db0067698a874b3492049c34cea442 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 2 Jun 2021 20:21:56 +0100 Subject: [PATCH] Fix interpretation of BPB value used by Atari ST in FAT16 partitions of type BIG GEMDOS. --- Aaru.Filesystems/FAT/Super.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Aaru.Filesystems/FAT/Super.cs b/Aaru.Filesystems/FAT/Super.cs index 133135259..63f422c90 100644 --- a/Aaru.Filesystems/FAT/Super.cs +++ b/Aaru.Filesystems/FAT/Super.cs @@ -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; }