Zlib fixes
This commit is contained in:
parent
4b83f9f17c
commit
36a09eafdd
@ -173,11 +173,6 @@ namespace FirstPlugin
|
|||||||
|
|
||||||
public class FileEntry : ArchiveFileInfo
|
public class FileEntry : ArchiveFileInfo
|
||||||
{
|
{
|
||||||
public override bool OpenFileFormatOnLoad
|
|
||||||
{
|
|
||||||
get { return true; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public NodeEntry nodeEntry;
|
public NodeEntry nodeEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@ namespace Toolbox.Library
|
|||||||
|
|
||||||
public bool Identify(Stream stream, string fileName)
|
public bool Identify(Stream stream, string fileName)
|
||||||
{
|
{
|
||||||
|
if (stream.Length < 12) return false;
|
||||||
|
|
||||||
using (var reader = new FileReader(stream, true))
|
using (var reader = new FileReader(stream, true))
|
||||||
{
|
{
|
||||||
uint DecompressedSize = reader.ReadUInt32();
|
uint DecompressedSize = reader.ReadUInt32();
|
||||||
|
@ -173,9 +173,17 @@ namespace Toolbox.Library.IO
|
|||||||
{
|
{
|
||||||
var ms = new System.IO.MemoryStream();
|
var ms = new System.IO.MemoryStream();
|
||||||
if (hasMagic)
|
if (hasMagic)
|
||||||
|
{
|
||||||
br.Position = 2;
|
br.Position = 2;
|
||||||
using (var ds = new DeflateStream(new MemoryStream(br.ReadBytes((int)br.BaseStream.Length - 6)), CompressionMode.Decompress))
|
using (var ds = new DeflateStream(new MemoryStream(br.ReadBytes((int)br.BaseStream.Length - 6)), CompressionMode.Decompress))
|
||||||
ds.CopyTo(ms);
|
ds.CopyTo(ms);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
using (var ds = new DeflateStream(new MemoryStream(b), CompressionMode.Decompress))
|
||||||
|
ds.CopyTo(ms);
|
||||||
|
}
|
||||||
|
|
||||||
return ms.ToArray();
|
return ms.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -248,11 +256,8 @@ namespace Toolbox.Library.IO
|
|||||||
//Mario Tennis Aces Custom compression
|
//Mario Tennis Aces Custom compression
|
||||||
public class MTA_CUSTOM
|
public class MTA_CUSTOM
|
||||||
{
|
{
|
||||||
[DllImport("Lib/LibTennis32.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
static extern void DecompressBuffer32(IntPtr output, IntPtr input, uint len);
|
|
||||||
|
|
||||||
[DllImport("Lib/LibTennis64.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("Lib/LibTennis64.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
static extern void DecompressBuffer64(IntPtr output, IntPtr input, uint len);
|
static extern void DecompressBuffer(IntPtr output, IntPtr input, uint len);
|
||||||
|
|
||||||
public unsafe byte[] Decompress(byte[] input, uint decompressedLength)
|
public unsafe byte[] Decompress(byte[] input, uint decompressedLength)
|
||||||
{
|
{
|
||||||
@ -261,10 +266,9 @@ namespace Toolbox.Library.IO
|
|||||||
fixed (byte* inputPtr = input)
|
fixed (byte* inputPtr = input)
|
||||||
{
|
{
|
||||||
if (Environment.Is64BitProcess)
|
if (Environment.Is64BitProcess)
|
||||||
DecompressBuffer64((IntPtr)outputPtr, (IntPtr)inputPtr, decompressedLength);
|
DecompressBuffer((IntPtr)outputPtr, (IntPtr)inputPtr, decompressedLength);
|
||||||
else
|
else
|
||||||
DecompressBuffer32((IntPtr)outputPtr, (IntPtr)inputPtr, decompressedLength);
|
MarioTennisCmp32.DecompressBuffer((IntPtr)outputPtr, (IntPtr)inputPtr, decompressedLength);
|
||||||
// Decompress(outputPtr, inputPtr, decompressedLength);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] decomp = new byte[decompressedLength];
|
byte[] decomp = new byte[decompressedLength];
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user