From d136c55be82ba8e008e58589cad31c8665e858fd Mon Sep 17 00:00:00 2001 From: alexguirre Date: Sat, 6 Jul 2024 23:28:23 +0200 Subject: [PATCH] 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_`. --- CodeWalker.Core/GameFiles/FileTypes/YddFile.cs | 8 +------- CodeWalker.Core/GameFiles/Resources/Drawable.cs | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/CodeWalker.Core/GameFiles/FileTypes/YddFile.cs b/CodeWalker.Core/GameFiles/FileTypes/YddFile.cs index f9e7e2f..39ba0c5 100644 --- a/CodeWalker.Core/GameFiles/FileTypes/YddFile.cs +++ b/CodeWalker.Core/GameFiles/FileTypes/YddFile.cs @@ -76,13 +76,7 @@ namespace CodeWalker.GameFiles var hash = hashes[i]; if ((drawable.Name == null) || (drawable.Name.EndsWith("#dd"))) { - string hstr = JenkIndex.TryGetString(hash); - if (!string.IsNullOrEmpty(hstr)) - { - drawable.Name = hstr; - } - else - { } + drawable.Name = YddXml.HashString((MetaHash)hash); } } diff --git a/CodeWalker.Core/GameFiles/Resources/Drawable.cs b/CodeWalker.Core/GameFiles/Resources/Drawable.cs index b4768a3..0f6c574 100644 --- a/CodeWalker.Core/GameFiles/Resources/Drawable.cs +++ b/CodeWalker.Core/GameFiles/Resources/Drawable.cs @@ -5847,7 +5847,7 @@ namespace CodeWalker.GameFiles var d = new Drawable(); d.ReadXml(inode, ddsfolder); drawables.Add(d); - drawablehashes.Add(JenkHash.GenHash(d.Name));//TODO: check this! + drawablehashes.Add(XmlMeta.GetHash(d.Name)); } }