From 480291dfb70568aaca8237055ec09f17a861c4e8 Mon Sep 17 00:00:00 2001 From: lastbattle <4586194+lastbattle@users.noreply.github.com> Date: Wed, 26 Jun 2024 11:50:16 +0800 Subject: [PATCH] [HaCreator] fix another map file parsing issue with 64-bit wz --- HaCreator/GUI/Initialization.cs | 4 +++- HaSharedLibrary/Wz/WzInfoTools.cs | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/HaCreator/GUI/Initialization.cs b/HaCreator/GUI/Initialization.cs index 1c9a1bb8..a83e068d 100644 --- a/HaCreator/GUI/Initialization.cs +++ b/HaCreator/GUI/Initialization.cs @@ -732,7 +732,8 @@ public void ExtractStringWzMaps() public void ExtractMaps() { UpdateUI_CurrentLoadingWzFile(string.Format("{0} map data", Program.InfoManager.MapsNameCache.Count), false); - Parallel.ForEach(Program.InfoManager.MapsNameCache, val => { + //foreach (KeyValuePair> val in Program.InfoManager.MapsNameCache) { + Parallel.ForEach(Program.InfoManager.MapsNameCache, val => { int mapid = 0; int.TryParse(val.Key, out mapid); @@ -751,6 +752,7 @@ public void ExtractMaps() { ); } } + //} }); } diff --git a/HaSharedLibrary/Wz/WzInfoTools.cs b/HaSharedLibrary/Wz/WzInfoTools.cs index ea6eb14f..acfdaefc 100644 --- a/HaSharedLibrary/Wz/WzInfoTools.cs +++ b/HaSharedLibrary/Wz/WzInfoTools.cs @@ -255,11 +255,12 @@ public static WzImage FindMapImage(string mapid, WzFileManager fileManager) if (mapParent == null) return null; + string mapIdNamePadded = AddLeadingZeros(mapid, 9) + ".img"; + if (fileManager.Is64Bit) { // is WzFile - return (WzImage)mapParent; + return (WzImage)mapParent?[mapIdNamePadded]; } // is WzDirectory - string mapIdNamePadded = AddLeadingZeros(mapid, 9) + ".img"; return (WzImage)mapParent?[mapIdNamePadded]; } @@ -284,8 +285,8 @@ public static WzDirectory FindMapDirectoryParent(string mapid, WzFileManager fil WzObject mapObjectWzDir = fileManager.FindWzImageByName(baseDir, fileManager.Is64Bit ? string.Empty : "Map"); if (fileManager.Is64Bit) { - Debug.WriteLine("Init map: {0}\\{1}", baseDir, mapIdNamePadded); - return (WzDirectory)mapObjectWzDir?[mapcat]; + //Debug.WriteLine("Init map: {0}\\{1}", baseDir, mapIdNamePadded); + return (WzDirectory)mapObjectWzDir; } else { WzDirectory mapImage = (WzDirectory)mapObjectWzDir?[mapcat];