mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 03:44:13 +08:00
(malie): LIBP alignment handling.
This commit is contained in:
parent
360664343f
commit
8a74eb1c77
@ -208,14 +208,14 @@ namespace GameRes.Formats.Malie
|
|||||||
{
|
{
|
||||||
byte[] m_index;
|
byte[] m_index;
|
||||||
long m_base_offset;
|
long m_base_offset;
|
||||||
long m_data_align;
|
|
||||||
uint[] m_offset_table;
|
uint[] m_offset_table;
|
||||||
|
LibScheme m_scheme;
|
||||||
|
|
||||||
public LibPReader (ArcView file, IMalieDecryptor decryptor, byte[] header, LibScheme scheme)
|
public LibPReader (ArcView file, IMalieDecryptor decryptor, byte[] header, LibScheme scheme)
|
||||||
: base (file, decryptor, header)
|
: base (file, decryptor, header)
|
||||||
{
|
{
|
||||||
m_base_offset = 0;
|
m_base_offset = 0;
|
||||||
m_data_align = scheme.DataAlign - 1;
|
m_scheme = scheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool ReadIndex ()
|
public override bool ReadIndex ()
|
||||||
@ -238,7 +238,7 @@ namespace GameRes.Formats.Malie
|
|||||||
Buffer.BlockCopy (offsets, 0, m_offset_table, 0, offsets.Length);
|
Buffer.BlockCopy (offsets, 0, m_offset_table, 0, offsets.Length);
|
||||||
|
|
||||||
m_base_offset += 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;
|
m_dir.Capacity = offset_count;
|
||||||
ReadDir ("", 0, 1);
|
ReadDir ("", 0, 1);
|
||||||
|
@ -32,7 +32,7 @@ namespace GameRes.Formats.Malie
|
|||||||
[Serializable]
|
[Serializable]
|
||||||
public abstract class LibScheme
|
public abstract class LibScheme
|
||||||
{
|
{
|
||||||
public uint DataAlign;
|
uint DataAlign;
|
||||||
|
|
||||||
public LibScheme (uint align)
|
public LibScheme (uint align)
|
||||||
{
|
{
|
||||||
@ -40,6 +40,12 @@ namespace GameRes.Formats.Malie
|
|||||||
}
|
}
|
||||||
|
|
||||||
public abstract IMalieDecryptor CreateDecryptor ();
|
public abstract IMalieDecryptor CreateDecryptor ();
|
||||||
|
|
||||||
|
public virtual long GetAlignedOffset (long offset)
|
||||||
|
{
|
||||||
|
long align = DataAlign - 1;
|
||||||
|
return (offset + align) & ~align;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user