mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 03:44:13 +08:00
(WcgFormat.Reader): cosmetic changes.
This commit is contained in:
parent
eefa7d2fc2
commit
32b320d550
@ -112,7 +112,6 @@ namespace GameRes.Formats
|
|||||||
private uint m_src;
|
private uint m_src;
|
||||||
private uint m_src_size;
|
private uint m_src_size;
|
||||||
private uint m_dst_size;
|
private uint m_dst_size;
|
||||||
private uint esi;
|
|
||||||
private uint edi;
|
private uint edi;
|
||||||
|
|
||||||
private uint m_index_length_limit;
|
private uint m_index_length_limit;
|
||||||
@ -160,12 +159,12 @@ namespace GameRes.Formats
|
|||||||
if (data_size > m_src_size)
|
if (data_size > m_src_size)
|
||||||
throw new InvalidFormatException ("Invalid compressed data size");
|
throw new InvalidFormatException ("Invalid compressed data size");
|
||||||
|
|
||||||
esi = m_src + index_size*2 + 12;
|
uint data_pos = m_src + index_size*2 + 12;
|
||||||
edi = offset;
|
edi = offset;
|
||||||
m_next_size = m_src_size - data_size;
|
m_next_size = m_src_size - data_size;
|
||||||
m_next_ptr = esi + data_size;
|
m_next_ptr = data_pos + data_size;
|
||||||
m_src_size = data_size;
|
m_src_size = data_size;
|
||||||
return DecodeStream (index_size);
|
return DecodeStream (data_pos, index_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReadIndex (uint index_size)
|
void ReadIndex (uint index_size)
|
||||||
@ -176,10 +175,10 @@ namespace GameRes.Formats
|
|||||||
m_index[i] = m_input.ReadUInt16();
|
m_index[i] = m_input.ReadUInt16();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DecodeStream (uint index_size)
|
bool DecodeStream (uint data_pos, uint index_size)
|
||||||
{
|
{
|
||||||
ReadIndex (index_size);
|
ReadIndex (index_size);
|
||||||
m_input.BaseStream.Position = esi;
|
m_input.BaseStream.Position = data_pos;
|
||||||
|
|
||||||
bool small_index = index_size < 0x1002;
|
bool small_index = index_size < 0x1002;
|
||||||
m_index_length_limit = small_index ? 0x06u : 0x0eu;
|
m_index_length_limit = small_index ? 0x06u : 0x0eu;
|
||||||
@ -228,7 +227,6 @@ namespace GameRes.Formats
|
|||||||
if (0 == m_src_size--)
|
if (0 == m_src_size--)
|
||||||
throw new InvalidFormatException ("Unexpected end of file");
|
throw new InvalidFormatException ("Unexpected end of file");
|
||||||
m_bits = (int)m_input.ReadByte();
|
m_bits = (int)m_input.ReadByte();
|
||||||
esi++;
|
|
||||||
m_bits = (m_bits << 1) + 1;
|
m_bits = (m_bits << 1) + 1;
|
||||||
carry = 0 != (m_bits & 0x100);
|
carry = 0 != (m_bits & 0x100);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user