mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-10 07:04:36 +00:00
PACx : fix some freezes loading type 0 files (root single chunks)
This commit is contained in:
parent
cdc0049190
commit
bebba0e432
1 changed files with 14 additions and 2 deletions
|
@ -82,7 +82,20 @@ namespace HedgehogLibrary
|
||||||
if (IsVersion4)
|
if (IsVersion4)
|
||||||
{
|
{
|
||||||
var header = reader.ReadStruct<HeaderV4>();
|
var header = reader.ReadStruct<HeaderV4>();
|
||||||
var chunks = reader.ReadMultipleStructs<Chunk>(header.ChunkCount);
|
|
||||||
|
List<Chunk> chunks = new List<Chunk>();
|
||||||
|
if (header.Type != (PacType)0)
|
||||||
|
{
|
||||||
|
uint chunkCount = reader.ReadUInt32();
|
||||||
|
chunks = reader.ReadMultipleStructs<Chunk>(chunkCount);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
chunks.Add(new Chunk()
|
||||||
|
{
|
||||||
|
CompressedSize = header.RootCompressedSize,
|
||||||
|
UncompressedSize = header.RootUncompressedSize
|
||||||
|
});
|
||||||
|
|
||||||
Checksum = header.PacID;
|
Checksum = header.PacID;
|
||||||
|
|
||||||
//Decompress each chunk now
|
//Decompress each chunk now
|
||||||
|
@ -226,7 +239,6 @@ namespace HedgehogLibrary
|
||||||
public uint RootUncompressedSize;
|
public uint RootUncompressedSize;
|
||||||
public PacType Type = PacType.HasNoSplit;
|
public PacType Type = PacType.HasNoSplit;
|
||||||
public ushort Constant = 0x208;
|
public ushort Constant = 0x208;
|
||||||
public uint ChunkCount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
|
|
Loading…
Reference in a new issue