Skip to content

Commit

Permalink
[HaCreator] fix another map file parsing issue with 64-bit wz
Browse files Browse the repository at this point in the history
  • Loading branch information
lastbattle committed Jun 26, 2024
1 parent c5af956 commit 480291d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion HaCreator/GUI/Initialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, Tuple<string, string>> val in Program.InfoManager.MapsNameCache) {
Parallel.ForEach(Program.InfoManager.MapsNameCache, val => {
int mapid = 0;
int.TryParse(val.Key, out mapid);

Expand All @@ -751,6 +752,7 @@ public void ExtractMaps() {
);
}
}
//}
});
}

Expand Down
9 changes: 5 additions & 4 deletions HaSharedLibrary/Wz/WzInfoTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand All @@ -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];
Expand Down

0 comments on commit 480291d

Please sign in to comment.