More compression fixes
This commit is contained in:
parent
c6c0019efc
commit
4133289486
@ -108,9 +108,7 @@ namespace FirstPlugin
|
|||||||
reader.Seek(4, System.IO.SeekOrigin.Begin);
|
reader.Seek(4, System.IO.SeekOrigin.Begin);
|
||||||
uint decompSize = reader.ReadUInt32();
|
uint decompSize = reader.ReadUInt32();
|
||||||
uint compSize = (uint)reader.BaseStream.Length - 8;
|
uint compSize = (uint)reader.BaseStream.Length - 8;
|
||||||
|
return STLibraryCompression.MTA_CUSTOM.Decompress(data, decompSize);
|
||||||
var comp = new STLibraryCompression.MTA_CUSTOM();
|
|
||||||
return comp.Decompress(data, decompSize);
|
|
||||||
}
|
}
|
||||||
else if (compType == 0x30 || compType == 0x20)
|
else if (compType == 0x30 || compType == 0x20)
|
||||||
{
|
{
|
||||||
|
42
Switch_Toolbox_Library/Compression/Formats/MtaCustomCmp.cs
Normal file
42
Switch_Toolbox_Library/Compression/Formats/MtaCustomCmp.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.IO;
|
||||||
|
using System.IO.Compression;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Toolbox.Library.IO;
|
||||||
|
|
||||||
|
namespace Toolbox.Library
|
||||||
|
{
|
||||||
|
public class MtaCustomCmp : ICompressionFormat
|
||||||
|
{
|
||||||
|
public int Alignment = 0;
|
||||||
|
|
||||||
|
public string[] Description { get; set; } = new string[] { "Mario Tennis Custom" };
|
||||||
|
public string[] Extension { get; set; } = new string[] { "*.cbtx", };
|
||||||
|
|
||||||
|
public override string ToString() { return "Mario Tennis Custom"; }
|
||||||
|
|
||||||
|
public bool Identify(Stream stream, string fileName)
|
||||||
|
{
|
||||||
|
return Utils.GetExtension(fileName) == ".cbtx";
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanCompress { get; } = false;
|
||||||
|
|
||||||
|
public Stream Decompress(Stream stream)
|
||||||
|
{
|
||||||
|
using (var reader = new FileReader(stream, true))
|
||||||
|
{
|
||||||
|
reader.SeekBegin(4);
|
||||||
|
uint decompSize = reader.ReadUInt32();
|
||||||
|
return new MemoryStream(STLibraryCompression.MTA_CUSTOM.Decompress(stream.ToArray(), decompSize));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Stream Compress(Stream stream)
|
||||||
|
{
|
||||||
|
return new MemoryStream();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Switch_Toolbox_Library/Compression/MarioTennisCmp32.cs
Normal file
11
Switch_Toolbox_Library/Compression/MarioTennisCmp32.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Toolbox.Library.IO
|
||||||
|
{
|
||||||
|
public class MarioTennisCmp32
|
||||||
|
{
|
||||||
|
[DllImport("Lib/LibTennis32.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void DecompressBuffer(IntPtr output, IntPtr input, uint len);
|
||||||
|
}
|
||||||
|
}
|
@ -222,6 +222,7 @@
|
|||||||
<Compile Include="Compression\Formats\lz4.cs" />
|
<Compile Include="Compression\Formats\lz4.cs" />
|
||||||
<Compile Include="Compression\Formats\LZ4F.cs" />
|
<Compile Include="Compression\Formats\LZ4F.cs" />
|
||||||
<Compile Include="Compression\Formats\LZMA.cs" />
|
<Compile Include="Compression\Formats\LZMA.cs" />
|
||||||
|
<Compile Include="Compression\Formats\MtaCustomCmp.cs" />
|
||||||
<Compile Include="Compression\Formats\ZlibGZ.cs" />
|
<Compile Include="Compression\Formats\ZlibGZ.cs" />
|
||||||
<Compile Include="Compression\Formats\Zstb.cs" />
|
<Compile Include="Compression\Formats\Zstb.cs" />
|
||||||
<Compile Include="Compression\LZ77_WII.cs" />
|
<Compile Include="Compression\LZ77_WII.cs" />
|
||||||
@ -233,6 +234,7 @@
|
|||||||
<Compile Include="Compression\7ZIP\RangeCoder\RangeCoder.cs" />
|
<Compile Include="Compression\7ZIP\RangeCoder\RangeCoder.cs" />
|
||||||
<Compile Include="Compression\7ZIP\RangeCoder\RangeCoderBit.cs" />
|
<Compile Include="Compression\7ZIP\RangeCoder\RangeCoderBit.cs" />
|
||||||
<Compile Include="Compression\7ZIP\RangeCoder\RangeCoderBitTree.cs" />
|
<Compile Include="Compression\7ZIP\RangeCoder\RangeCoderBitTree.cs" />
|
||||||
|
<Compile Include="Compression\MarioTennisCmp32.cs" />
|
||||||
<Compile Include="Compression\STLibraryCompression.cs" />
|
<Compile Include="Compression\STLibraryCompression.cs" />
|
||||||
<Compile Include="Compression\Formats\Yay0.cs" />
|
<Compile Include="Compression\Formats\Yay0.cs" />
|
||||||
<Compile Include="Compression\Formats\Yaz0.cs" />
|
<Compile Include="Compression\Formats\Yaz0.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user