From 8a5583c308bf4e3192b217fc2c33d27957224c8b Mon Sep 17 00:00:00 2001 From: barubary Date: Wed, 6 Apr 2011 16:42:27 +0000 Subject: [PATCH] C#: fixed The new LZ-0x10 and LZ-0x11 decompressors. Only LZ-0x10 hasn't been tested yet. --- CSharp/DSDecmp/Formats/Nitro/LZ10.cs | 4 ++-- CSharp/DSDecmp/Formats/Nitro/LZ11.cs | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CSharp/DSDecmp/Formats/Nitro/LZ10.cs b/CSharp/DSDecmp/Formats/Nitro/LZ10.cs index f306692..4989365 100644 --- a/CSharp/DSDecmp/Formats/Nitro/LZ10.cs +++ b/CSharp/DSDecmp/Formats/Nitro/LZ10.cs @@ -58,7 +58,7 @@ namespace DSDecmp.Formats.Nitro int currentOutSize = 0; - int flags = 0, mask = 0; + int flags = 0, mask = 1; while (currentOutSize < decompressedSize) { // (throws when requested new flags byte is not available) @@ -123,7 +123,7 @@ namespace DSDecmp.Formats.Nitro buffer[bufferOffset] = next; bufferOffset = (bufferOffset + 1) % bufferLength; } - + currentOutSize += length; } else { diff --git a/CSharp/DSDecmp/Formats/Nitro/LZ11.cs b/CSharp/DSDecmp/Formats/Nitro/LZ11.cs index 9250b8d..e3fb99b 100644 --- a/CSharp/DSDecmp/Formats/Nitro/LZ11.cs +++ b/CSharp/DSDecmp/Formats/Nitro/LZ11.cs @@ -76,7 +76,7 @@ namespace DSDecmp.Formats.Nitro int bufferOffset = 0; int currentOutSize = 0; - int flags = 0, mask = 0; + int flags = 0, mask = 1; while (currentOutSize < decompressedSize) { // (throws when requested new flags byte is not available) @@ -196,7 +196,7 @@ namespace DSDecmp.Formats.Nitro buffer[bufferOffset] = next; bufferOffset = (bufferOffset + 1) % bufferLength; } - + currentOutSize += length; } else { @@ -206,8 +206,7 @@ namespace DSDecmp.Formats.Nitro if (next < 0) throw new StreamTooShortException(); - currentOutSize++; - outstream.WriteByte((byte)next); + outstream.WriteByte((byte)next); currentOutSize++; buffer[bufferOffset] = (byte)next; bufferOffset = (bufferOffset + 1) % bufferLength; }