diff --git a/ArcFormats/Malie/ArcLIB.cs b/ArcFormats/Malie/ArcLIB.cs index 9de84af3..87450e0b 100644 --- a/ArcFormats/Malie/ArcLIB.cs +++ b/ArcFormats/Malie/ArcLIB.cs @@ -206,16 +206,16 @@ namespace GameRes.Formats.Malie internal class LibPReader : LibIndexReader { - byte[] m_index; - long m_base_offset; - long m_data_align; - uint[] m_offset_table; + byte[] m_index; + long m_base_offset; + uint[] m_offset_table; + LibScheme m_scheme; public LibPReader (ArcView file, IMalieDecryptor decryptor, byte[] header, LibScheme scheme) : base (file, decryptor, header) { m_base_offset = 0; - m_data_align = scheme.DataAlign - 1; + m_scheme = scheme; } public override bool ReadIndex () @@ -238,7 +238,7 @@ namespace GameRes.Formats.Malie Buffer.BlockCopy (offsets, 0, m_offset_table, 0, offsets.Length); m_base_offset += offsets.Length; - m_base_offset = (m_base_offset + m_data_align) & ~m_data_align; + m_base_offset = m_scheme.GetAlignedOffset (m_base_offset); m_dir.Capacity = offset_count; ReadDir ("", 0, 1); diff --git a/ArcFormats/Malie/LibScheme.cs b/ArcFormats/Malie/LibScheme.cs index 692713e8..70fb5769 100644 --- a/ArcFormats/Malie/LibScheme.cs +++ b/ArcFormats/Malie/LibScheme.cs @@ -32,7 +32,7 @@ namespace GameRes.Formats.Malie [Serializable] public abstract class LibScheme { - public uint DataAlign; + uint DataAlign; public LibScheme (uint align) { @@ -40,6 +40,12 @@ namespace GameRes.Formats.Malie } public abstract IMalieDecryptor CreateDecryptor (); + + public virtual long GetAlignedOffset (long offset) + { + long align = DataAlign - 1; + return (offset + align) & ~align; + } } [Serializable] diff --git a/ArcFormats/Resources/Formats.dat b/ArcFormats/Resources/Formats.dat index 2a3ce029..0fd6c734 100644 Binary files a/ArcFormats/Resources/Formats.dat and b/ArcFormats/Resources/Formats.dat differ