Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions ArcFormats/CatSystem/ArcHG2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public class Hg2Opener : ArchiveFormat

public override ArcFile TryOpen (ArcView file)
{
if (0x25 != file.View.ReadInt32 (8))
int version = file.View.ReadInt32 (8);
if (0x20 != version && 0x25 != version)
return null;
var base_name = Path.GetFileNameWithoutExtension (file.Name);
var dir = new List<Entry>();
Expand All @@ -50,9 +51,10 @@ public override ArcFile TryOpen (ArcView file)
while (offset < file.MaxOffset)
{
uint section_size = file.View.ReadUInt32 (offset+0x40);
int image_id = file.View.ReadInt32 (offset+0x28);
var entry = new Entry
{
Name = string.Format ("{0}#{1:D4}", base_name, i),
Name = string.Format ("{0}#{1:D4}", base_name, image_id),
Type = "image",
Offset = offset,
};
Expand All @@ -76,7 +78,8 @@ public override IImageDecoder OpenImage (ArcFile arc, Entry entry)
var offset = entry.Offset;
var info = new Hg2MetaData
{
HeaderSize = 0x4C,
Version = arc.File.View.ReadInt32 (8),
HeaderSize = arc.File.View.ReadUInt32 (offset+0x24) + 0x24,
Width = arc.File.View.ReadUInt32 (offset),
Height = arc.File.View.ReadUInt32 (offset+4),
BPP = arc.File.View.ReadInt32 (offset+8),
Expand Down
3 changes: 2 additions & 1 deletion ArcFormats/CatSystem/ArcHG3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ public override ArcFile TryOpen (ArcView file)
while (offset+0x14 < file.MaxOffset && file.View.AsciiEqual (offset+8, "stdinfo"))
{
uint section_size = file.View.ReadUInt32 (offset);
int image_id = file.View.ReadInt32 (offset+4);
if (0 == section_size)
section_size = (uint)(file.MaxOffset - offset);
uint stdinfo_size = file.View.ReadUInt32 (offset+0x10);
if (file.View.AsciiEqual (offset+8+stdinfo_size, "img"))
{
var entry = new Entry
{
Name = string.Format ("{0}#{1:D4}", base_name, i),
Name = string.Format ("{0}#{1:D4}", base_name, image_id),
Type = "image",
Offset = offset + 8,
Size = section_size - 8,
Expand Down