Skip to content

Commit

Permalink
Fixed Dark Souls Remastered file decompression
Browse files Browse the repository at this point in the history
  • Loading branch information
Atvaark committed Jun 15, 2020
1 parent f248279 commit 84bdc67
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 22 deletions.
10 changes: 6 additions & 4 deletions BinderTool.Core/BinderTool.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@
<Reference Include="BouncyCastle.Crypto, Version=1.8.4.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
<HintPath>..\packages\BouncyCastle.1.8.4\lib\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=0.85.4.369, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\ICSharpCode.SharpZipLib.dll.0.85.4.369\lib\net20\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
Expand All @@ -72,6 +69,9 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Zlib.Portable, Version=1.11.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Zlib.Portable.1.11.0\lib\portable-net4+sl5+wp8+win8+wpa81+MonoTouch+MonoAndroid\Zlib.Portable.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Bdf4\Bdf4FileStream.cs" />
Expand Down Expand Up @@ -119,7 +119,9 @@
<Compile Include="Tpf\TpfFileEntry.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BinderTool.Core.Kraken\BinderTool.Core.Kraken.csproj">
Expand Down
14 changes: 6 additions & 8 deletions BinderTool.Core/Dcx/DeflateCompression.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.IO;
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
using Ionic.Zlib;

namespace BinderTool.Core.Dcx
{
Expand All @@ -11,20 +11,18 @@ public class DeflateCompression : DcxCompression
//public override MemoryStream CompressData(byte[] uncompressedData)
//{
// MemoryStream compressedBufferStream = new MemoryStream();
// using (DeflaterOutputStream deflaterStream = new DeflaterOutputStream(compressedBufferStream))
// using (var zlibStream = new ZlibStream(compressedBufferStream, CompressionMode.Compress, (CompressionLevel)Level))
// {
// deflaterStream.Write(uncompressedData, 0, uncompressedData.Length);
// zlibStream.Write(uncompressedData, 0, uncompressedData.Length);
// }

// return compressedBufferStream;
//}

public override MemoryStream DecompressData(byte[] compressedData, int uncompressedSize)
{
InflaterInputStream inflaterStream = new InflaterInputStream(new MemoryStream(compressedData));
MemoryStream outputStream = new MemoryStream();
inflaterStream.CopyTo(outputStream);
outputStream.Position = 0;
return outputStream;
var decompressedData = ZlibStream.UncompressBuffer(compressedData);
return new MemoryStream(decompressedData);
}

public static DeflateCompression Read(BinaryReader reader)
Expand Down
9 changes: 3 additions & 6 deletions BinderTool.Core/Enfl/EntryFileListFile.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.IO;
using System.Text;
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
using Ionic.Zlib;

namespace BinderTool.Core.Enfl
{
Expand Down Expand Up @@ -88,11 +88,8 @@ private MemoryStream Decompress(Stream inputStream)
int uncompressedSize = reader.ReadInt32();

byte[] data = reader.ReadBytes(compressedSize);
InflaterInputStream inflaterStream = new InflaterInputStream(new MemoryStream(data));
MemoryStream decompressedStream = new MemoryStream();
inflaterStream.CopyTo(decompressedStream);
decompressedStream.Position = 0;
return decompressedStream;
byte[] uncompressData = ZlibStream.UncompressBuffer(data);
return new MemoryStream(uncompressData);
}
}
}
2 changes: 1 addition & 1 deletion BinderTool.Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BinderTool.Core")]
[assembly: AssemblyCopyright("Copyright © 2019 Atvaark")]
[assembly: AssemblyCopyright("Copyright © 2020 Atvaark")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
Expand Down
2 changes: 1 addition & 1 deletion BinderTool.Core/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BouncyCastle" version="1.8.4" targetFramework="net462" />
<package id="ICSharpCode.SharpZipLib.dll" version="0.85.4.369" targetFramework="net462" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net462" />
<package id="Zlib.Portable" version="1.11.0" targetFramework="net462" />
</packages>
2 changes: 1 addition & 1 deletion BinderTool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private static void ShowUsageInfo()
{
Console.WriteLine(
"BinderTool by Atvaark\n" +
" A tool for unpacking Dark Souls II/III/Bloodborne/Sekiro Bdt, Bhd, Dcx, Sl2, Tpf, Param and Fmg files\n" +
" A tool for unpacking Dark Souls I/II/III/Bloodborne/Sekiro Bdt, Bhd, Dcx, Sl2, Tpf, Param and Fmg files\n" +
"Usage:\n" +
" BinderTool file_path [output_path]\n" +
"Examples:\n" +
Expand Down
2 changes: 1 addition & 1 deletion BinderTool/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BinderTool")]
[assembly: AssemblyCopyright("Copyright © 2019 Atvaark")]
[assembly: AssemblyCopyright("Copyright © 2020 Atvaark")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
Expand Down

0 comments on commit 84bdc67

Please sign in to comment.