diff --git a/ArcFormats/CatSystem/ArcHG2.cs b/ArcFormats/CatSystem/ArcHG2.cs index f62142cc2..48b70b7ce 100644 --- a/ArcFormats/CatSystem/ArcHG2.cs +++ b/ArcFormats/CatSystem/ArcHG2.cs @@ -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(); @@ -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, }; @@ -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), diff --git a/ArcFormats/CatSystem/ArcHG3.cs b/ArcFormats/CatSystem/ArcHG3.cs index afd4ae02b..e2644423a 100644 --- a/ArcFormats/CatSystem/ArcHG3.cs +++ b/ArcFormats/CatSystem/ArcHG3.cs @@ -48,6 +48,7 @@ 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); @@ -55,7 +56,7 @@ public override ArcFile TryOpen (ArcView file) { 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,