mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 03:44:13 +08:00
(PFS): use UTF8 encoding for versions 8+.
This commit is contained in:
parent
d741215219
commit
9ff0da050f
@ -65,14 +65,14 @@ namespace GameRes.Formats.Artemis
|
|||||||
int count = file.View.ReadInt32 (7);
|
int count = file.View.ReadInt32 (7);
|
||||||
if (!IsSaneCount (count) || 7L + index_size > file.MaxOffset)
|
if (!IsSaneCount (count) || 7L + index_size > file.MaxOffset)
|
||||||
return null;
|
return null;
|
||||||
|
var encoding = version >= 8 ? System.Text.Encoding.UTF8 : Encodings.cp932;
|
||||||
var index = file.View.ReadBytes (7, index_size);
|
var index = file.View.ReadBytes (7, index_size);
|
||||||
int index_offset = 4;
|
int index_offset = 4;
|
||||||
var dir = new List<Entry> (count);
|
var dir = new List<Entry> (count);
|
||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
int name_length = index.ToInt32 (index_offset);
|
int name_length = index.ToInt32 (index_offset);
|
||||||
var name = Encodings.cp932.GetString (index, index_offset+4, name_length);
|
var name = encoding.GetString (index, index_offset+4, name_length);
|
||||||
index_offset += name_length + 8;
|
index_offset += name_length + 8;
|
||||||
var entry = FormatCatalog.Instance.Create<Entry> (name);
|
var entry = FormatCatalog.Instance.Create<Entry> (name);
|
||||||
entry.Offset = index.ToUInt32 (index_offset);
|
entry.Offset = index.ToUInt32 (index_offset);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user