diff --git a/AssetStudio/ResourceIndex.cs b/AssetStudio/ResourceIndex.cs index f37ac5e..4135237 100644 --- a/AssetStudio/ResourceIndex.cs +++ b/AssetStudio/ResourceIndex.cs @@ -82,10 +82,8 @@ namespace AssetStudio foreach (var subAsset in asset.Value) { var bundleInfo = new BundleInfo() { Bundle = asset.Key, Path = subAsset.Name }; - var blockInfo = assetIndex.Assets[asset.Key]; - ulong key = (((ulong)blockInfo.Id) << 32) | subAsset.PathHashLast; AssetLocationMap[subAsset.PathHashPre].Add(subAsset.PathHashLast, bundleInfo); - AssetMap[key] = ((ulong)subAsset.PathHashLast) << 8 | subAsset.PathHashPre; + AssetMap[subAsset.PathHashLast] = ((ulong)subAsset.PathHashLast) << 8 | subAsset.PathHashPre; } } foreach (var asset in assetIndex.Assets) @@ -150,13 +148,10 @@ namespace AssetStudio var asset = new Asset() { Hash = hash }; return AssetLocationMap.ElementAtOrDefault(asset.Pre).ContainsKey(asset.Last); } - public static string GetContainerFromBinName(string fileName, string binName) + public static string GetContainerFromBinName(string binName) { - var blkName = Path.GetFileNameWithoutExtension(fileName); - var blk = Convert.ToUInt64(blkName); var lastHex = Convert.ToUInt32(binName, 16); - var blkHash = (blk << 32) | lastHex; - var index = GetAssetIndex(blkHash); + var index = GetAssetIndex(lastHex); var bundleInfo = GetBundleInfo(index); return bundleInfo != null ? bundleInfo.Path : ""; } diff --git a/AssetStudioCLI/Studio.cs b/AssetStudioCLI/Studio.cs index a3b9f7a..2e5624c 100644 --- a/AssetStudioCLI/Studio.cs +++ b/AssetStudioCLI/Studio.cs @@ -237,7 +237,7 @@ namespace AssetStudioCLI case ClassIDType.MiHoYoBinData: if (indexObject.Names.TryGetValue(objectReader.m_PathID, out var binName)) { - var path = ResourceIndex.GetContainerFromBinName(file, binName); + var path = ResourceIndex.GetContainerFromBinName(binName); asset.Container = path; asset.Name = !string.IsNullOrEmpty(path) ? Path.GetFileName(path) : binName; } diff --git a/AssetStudioGUI/Studio.cs b/AssetStudioGUI/Studio.cs index 4a8d43b..45232b6 100644 --- a/AssetStudioGUI/Studio.cs +++ b/AssetStudioGUI/Studio.cs @@ -250,7 +250,7 @@ namespace AssetStudioGUI case ClassIDType.MiHoYoBinData: if (indexObject.Names.TryGetValue(objectReader.m_PathID, out var binName)) { - var path = ResourceIndex.GetContainerFromBinName(file, binName); + var path = ResourceIndex.GetContainerFromBinName(binName); asset.Container = path; asset.Name = !string.IsNullOrEmpty(path) ? Path.GetFileName(path) : binName; } @@ -430,7 +430,7 @@ namespace AssetStudioGUI var game = GameManager.GetGame("GI"); if (Path.GetExtension(assetsFile.originalPath) == game.Extension) { - path = ResourceIndex.GetContainerFromBinName(assetsFile.originalPath, binName); + path = ResourceIndex.GetContainerFromBinName(binName); } else {