From 1521532bf483dc882a0fad0dc1fd1c16c837cb90 Mon Sep 17 00:00:00 2001 From: morkt Date: Fri, 27 Oct 2023 04:17:21 +0400 Subject: [PATCH] (Pias): use decimal number for entry names. --- Legacy/Pias/ArcDAT.cs | 9 +++++++-- Legacy/Pias/EncryptedGraphDat.cs | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Legacy/Pias/ArcDAT.cs b/Legacy/Pias/ArcDAT.cs index 231e58a9..34c999fe 100644 --- a/Legacy/Pias/ArcDAT.cs +++ b/Legacy/Pias/ArcDAT.cs @@ -45,7 +45,7 @@ namespace GameRes.Formats.Pias internal class IndexReader { - internal const bool NamesAsHexOffset = true; + internal const bool UseOffsetAsName = true; protected ArcView m_arc; protected ResourceType m_res; @@ -118,7 +118,7 @@ namespace GameRes.Formats.Pias if (!known_offsets.Contains (offset)) { var entry = new Entry { - Name = NamesAsHexOffset ? offset.ToString ("X8") : m_dir.Count.ToString("D4"), + Name = GetName (offset, m_dir.Count), Type = entry_type, Offset = offset, Size = entry_size, @@ -132,6 +132,11 @@ namespace GameRes.Formats.Pias } return true; } + + internal string GetName (long offset, int num) + { + return UseOffsetAsName ? offset.ToString ("D8") : num.ToString("D4"); + } } [Export(typeof(ArchiveFormat))] diff --git a/Legacy/Pias/EncryptedGraphDat.cs b/Legacy/Pias/EncryptedGraphDat.cs index 560755a2..b54a6578 100644 --- a/Legacy/Pias/EncryptedGraphDat.cs +++ b/Legacy/Pias/EncryptedGraphDat.cs @@ -96,7 +96,7 @@ namespace GameRes.Formats.Pias key.Seed (seed); Decrypt (buffer, 0, 4, key); entry.Size = (buffer.ToUInt32 (0) & 0xFFFFFu) + 8u; - entry.Name = NamesAsHexOffset ? entry.Offset.ToString ("X8") : i.ToString("D4"); + entry.Name = GetName (entry.Offset, i); entry.Type = "image"; } var known_offsets = new HashSet (m_dir.Select (e => e.Offset)); @@ -111,7 +111,7 @@ namespace GameRes.Formats.Pias if (!known_offsets.Contains (offset)) { var entry = new Entry { - Name = (NamesAsHexOffset ? offset.ToString ("X8") : m_dir.Count.ToString("D4")) + "_", + Name = GetName (offset, m_dir.Count) + "_", Type = "image", Offset = offset, Size = entry_size,