From c6d9dd1bcd0a5d057aa3ddbd62e64d49fcf1f755 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 19 Apr 2026 22:18:48 +0100 Subject: [PATCH] [NDIF] Implement LZH support. --- Aaru.Images/NDIF/Read.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Aaru.Images/NDIF/Read.cs b/Aaru.Images/NDIF/Read.cs index e605bbc56..04a57a52b 100644 --- a/Aaru.Images/NDIF/Read.cs +++ b/Aaru.Images/NDIF/Read.cs @@ -143,10 +143,6 @@ public sealed partial class Ndif case CHUNK_TYPE_KENCODE: AaruLogging.Error(Localization.Chunks_compressed_with_KenCode_are_not_yet_supported); - return ErrorNumber.NotImplemented; - case CHUNK_TYPE_LZH: - AaruLogging.Error(Localization.Chunks_compressed_with_LZH_are_not_yet_supported); - return ErrorNumber.NotImplemented; case CHUNK_TYPE_STUFFIT: AaruLogging.Error(Localization.Chunks_compressed_with_StuffIt_are_not_yet_supported); @@ -357,6 +353,16 @@ public sealed partial class Ndif break; } + case CHUNK_TYPE_LZH: + { + var tmpBuffer = new byte[_bufferSize]; + realSize = AppleLzh.DecodeBuffer(cmpBuffer, tmpBuffer); + data = new byte[realSize]; + Array.Copy(tmpBuffer, 0, data, 0, realSize); + + break; + } + default: return ErrorNumber.NotSupported; }