Fix .ydd export/import with unsolved hashes

When a drawable hash was unknown, it kept the "filename.#dd" name so
exporting to XML lost the hash and importing it back created a broken
file.

Now if the hash is unknown, the name is set to `hash_1234ABCD`, and XML
import checks for `hash_`.
This commit is contained in:
alexguirre 2024-07-06 23:28:23 +02:00
parent f9a3559263
commit d136c55be8
2 changed files with 2 additions and 8 deletions

View File

@ -76,13 +76,7 @@ namespace CodeWalker.GameFiles
var hash = hashes[i]; var hash = hashes[i];
if ((drawable.Name == null) || (drawable.Name.EndsWith("#dd"))) if ((drawable.Name == null) || (drawable.Name.EndsWith("#dd")))
{ {
string hstr = JenkIndex.TryGetString(hash); drawable.Name = YddXml.HashString((MetaHash)hash);
if (!string.IsNullOrEmpty(hstr))
{
drawable.Name = hstr;
}
else
{ }
} }
} }

View File

@ -5847,7 +5847,7 @@ namespace CodeWalker.GameFiles
var d = new Drawable(); var d = new Drawable();
d.ReadXml(inode, ddsfolder); d.ReadXml(inode, ddsfolder);
drawables.Add(d); drawables.Add(d);
drawablehashes.Add(JenkHash.GenHash(d.Name));//TODO: check this! drawablehashes.Add(XmlMeta.GetHash(d.Name));
} }
} }