mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
(noncolor): filenames encoding handling.
This commit is contained in:
@@ -58,6 +58,7 @@ namespace GameRes.Formats.NonColor
|
|||||||
public string Title;
|
public string Title;
|
||||||
public ulong Hash;
|
public ulong Hash;
|
||||||
public string FileListName;
|
public string FileListName;
|
||||||
|
public bool LowCaseNames;
|
||||||
|
|
||||||
public Scheme(string title)
|
public Scheme(string title)
|
||||||
{
|
{
|
||||||
@@ -70,6 +71,14 @@ namespace GameRes.Formats.NonColor
|
|||||||
{
|
{
|
||||||
return Crc64.Compute (name, 0, name.Length);
|
return Crc64.Compute (name, 0, name.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public byte[] GetBytes (string name)
|
||||||
|
{
|
||||||
|
if (LowCaseNames)
|
||||||
|
return name.ToLowerShiftJis();
|
||||||
|
else
|
||||||
|
return Encodings.cp932.GetBytes (name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
@@ -194,7 +203,7 @@ namespace GameRes.Formats.NonColor
|
|||||||
{
|
{
|
||||||
var dict = new Dictionary<ulong, NameRecord>();
|
var dict = new Dictionary<ulong, NameRecord>();
|
||||||
FormatCatalog.Instance.ReadFileList (scheme.FileListName, line => {
|
FormatCatalog.Instance.ReadFileList (scheme.FileListName, line => {
|
||||||
var bytes = Encodings.cp932.GetBytes (line); // line.ToLowerShiftJis();
|
var bytes = scheme.GetBytes (line);
|
||||||
ulong hash = scheme.ComputeHash (bytes);
|
ulong hash = scheme.ComputeHash (bytes);
|
||||||
dict[hash] = new NameRecord { Name = line, NameBytes = bytes };
|
dict[hash] = new NameRecord { Name = line, NameBytes = bytes };
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -38,7 +38,9 @@ namespace GameRes.Formats.Minato
|
|||||||
|
|
||||||
public override ulong ComputeHash (byte[] name)
|
public override ulong ComputeHash (byte[] name)
|
||||||
{
|
{
|
||||||
return Crc32.Compute (name, 0, name.Length);
|
var bytes = name.Clone() as byte[];
|
||||||
|
bytes.ToLowerShiftJis();
|
||||||
|
return Crc32.Compute (bytes, 0, bytes.Length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user