From 0b17f16f31ca893946b84ded007af185acd8b96d Mon Sep 17 00:00:00 2001 From: Rebecca Wallander Date: Sun, 12 Apr 2026 20:42:07 +0200 Subject: [PATCH] [ISO9660] Handle BD long sectors --- Aaru.Decoders/Bluray/Sector.cs | 10 ++++++++++ Aaru.Filesystems/ISO9660/Mode2.cs | 11 ++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Aaru.Decoders/Bluray/Sector.cs b/Aaru.Decoders/Bluray/Sector.cs index a518e7c9a..21d59c93a 100644 --- a/Aaru.Decoders/Bluray/Sector.cs +++ b/Aaru.Decoders/Bluray/Sector.cs @@ -77,4 +77,14 @@ public sealed class Sector } return true; } + + public static byte[] GetUserData(byte[] data) + { + if(data.Length != 2052) return data; + + byte[] sector = new byte[2048]; + Array.Copy(data, 0, sector, 0, 2048); + + return sector; + } } \ No newline at end of file diff --git a/Aaru.Filesystems/ISO9660/Mode2.cs b/Aaru.Filesystems/ISO9660/Mode2.cs index d33325ce1..e39c6e82c 100644 --- a/Aaru.Filesystems/ISO9660/Mode2.cs +++ b/Aaru.Filesystems/ISO9660/Mode2.cs @@ -234,9 +234,14 @@ public sealed partial class ISO9660 } } - byte[] sectorData = data.Length == 2064 - ? Decoders.DVD.Sector.GetUserData(data) - : Sector.GetUserData(data, interleaved, fileNumber); + byte[] sectorData; + + if(data.Length == 2064) // DVD sector + sectorData = Decoders.DVD.Sector.GetUserData(data); + else if(data.Length == 2052) // Blu-ray sector + sectorData = Decoders.Bluray.Sector.GetUserData(data); + else // CD sector + sectorData = Sector.GetUserData(data, interleaved, fileNumber); ms.Write(sectorData, 0, sectorData.Length); }