fix a bug where the same file can be included in an RCO twice
This commit is contained in:
parent
16ec2b4f59
commit
6771abd6a1
|
@ -222,14 +222,14 @@ namespace CXMLDecompiler
|
|||
|
||||
return ent.offset;
|
||||
}
|
||||
public int AddGetFileTable(byte[] value, string filename)
|
||||
public int AddGetFileTable(byte[] value, string hash)
|
||||
{
|
||||
foreach (StringTableEntry entry in FileTableEntries)
|
||||
if (entry.name == filename)
|
||||
if (entry.name == hash)
|
||||
return entry.offset;
|
||||
|
||||
StringTableEntry ent = new StringTableEntry();
|
||||
ent.name = filename;
|
||||
ent.name = Tools.GenerateHash(value);
|
||||
ent.offset = Convert.ToInt32(FileTable.Position);
|
||||
FileTableEntries.Add(ent);
|
||||
|
||||
|
@ -413,7 +413,7 @@ namespace CXMLDecompiler
|
|||
case AttributeType.TYPE_FILE:
|
||||
string fPath = Path.Combine(MainDir, attribute.Value);
|
||||
byte[] data = File.ReadAllBytes(fPath);
|
||||
int FilePtr = AddGetFileTable(data, Path.Combine(Environment.CurrentDirectory, fPath));
|
||||
int FilePtr = AddGetFileTable(data, Tools.GenerateHash(data));
|
||||
int FileSz = data.Length;
|
||||
tools.WriteInt32(WorkRam, FilePtr);
|
||||
tools.WriteInt32(WorkRam, FileSz);
|
||||
|
|
Loading…
Reference in New Issue