mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
(PAC): archive index variation.
This commit is contained in:
@@ -130,11 +130,8 @@ namespace GameRes.Formats.NeXAS
|
|||||||
index_packed[i] = (byte)~index_packed[i];
|
index_packed[i] = (byte)~index_packed[i];
|
||||||
|
|
||||||
var index = HuffmanDecode (index_packed, unpacked_size);
|
var index = HuffmanDecode (index_packed, unpacked_size);
|
||||||
using (var input = new MemoryStream (index))
|
using (var input = new BinMemoryStream (index))
|
||||||
if (!ReadFromStream (input, 0x40))
|
return ReadFromStream (input, 0x40);
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReadOld ()
|
bool ReadOld ()
|
||||||
@@ -142,37 +139,31 @@ namespace GameRes.Formats.NeXAS
|
|||||||
using (var input = m_file.CreateStream())
|
using (var input = m_file.CreateStream())
|
||||||
{
|
{
|
||||||
input.Position = 0xC;
|
input.Position = 0xC;
|
||||||
if (!ReadFromStream (input, 0x20))
|
if (ReadFromStream (input, 0x20))
|
||||||
return false;
|
return true;
|
||||||
|
input.Position = 0xC;
|
||||||
|
return ReadFromStream (input, 0x40);
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] m_name_buffer = new byte[MaxNameLength];
|
bool ReadFromStream (IBinaryStream index, int name_length)
|
||||||
|
|
||||||
bool ReadFromStream (Stream input, int name_length)
|
|
||||||
{
|
{
|
||||||
m_dir.Clear();
|
m_dir.Clear();
|
||||||
using (var index = new ArcView.Reader (input))
|
for (int i = 0; i < m_count; ++i)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_count; ++i)
|
var name = index.ReadCString (name_length);
|
||||||
{
|
if (string.IsNullOrWhiteSpace (name))
|
||||||
if (name_length != index.Read (m_name_buffer, 0, name_length))
|
return false;
|
||||||
return false;
|
var entry = FormatCatalog.Instance.Create<PackedEntry> (name);
|
||||||
var name = Binary.GetCString (m_name_buffer, 0, name_length);
|
entry.Offset = index.ReadUInt32();
|
||||||
if (string.IsNullOrWhiteSpace (name))
|
entry.UnpackedSize = index.ReadUInt32();
|
||||||
return false;
|
entry.Size = index.ReadUInt32();
|
||||||
var entry = FormatCatalog.Instance.Create<PackedEntry> (name);
|
if (!entry.CheckPlacement (m_file.MaxOffset))
|
||||||
entry.Offset = index.ReadUInt32();
|
return false;
|
||||||
entry.UnpackedSize = index.ReadUInt32();
|
entry.IsPacked = m_pack_type != 0 && (m_pack_type != 4 || entry.Size != entry.UnpackedSize);
|
||||||
entry.Size = index.ReadUInt32();
|
m_dir.Add (entry);
|
||||||
if (!entry.CheckPlacement (m_file.MaxOffset))
|
|
||||||
return false;
|
|
||||||
entry.IsPacked = m_pack_type != 0 && (m_pack_type != 4 || entry.Size != entry.UnpackedSize);
|
|
||||||
m_dir.Add (entry);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user