private void LoadGeneric(AssetsFileInstance mainFile, bool isLevel) { List <AssetDetails> assets = new List <AssetDetails>(); foreach (AssetFileInfoEx info in mainFile.table.assetFileInfo) { ClassDatabaseType type = AssetHelper.FindAssetClassByID(helper.classFile, info.curFileType); if (type == null) { continue; } string typeName = type.name.GetString(helper.classFile); if (typeName != "GameObject" && isLevel) { continue; } string name = AssetHelper.GetAssetNameFast(mainFile.file, helper.classFile, info); if (name == "") { name = "[Unnamed]"; } assets.Add(new AssetDetails(new AssetPPtr(0, info.index), GetIconForName(typeName), name, typeName, (int)info.curFileSize)); } rootDir = new FSDirectory(); rootDir.Create(assets); ChangeDirectory(""); }
private void LoadGGM(AssetsFileInstance mainFile) { //swap this with resources so we can actually see ggm assets foreach (AssetFileInfoEx info in mainFile.table.pAssetFileInfo) { ClassDatabaseType type = AssetHelper.FindAssetClassByID(helper.classFile, info.curFileType); if (type.name.GetString(helper.classFile) == "ResourceManager") { AssetTypeInstance inst = helper.GetATI(mainFile.file, info); AssetTypeValueField baseField = inst.GetBaseField(); AssetTypeValueField m_Container = baseField.Get("m_Container").Get("Array"); //Dictionary<string, AssetDetails> paths = new Dictionary<string, AssetDetails>(); List <AssetDetails> assets = new List <AssetDetails>(); for (uint i = 0; i < m_Container.GetValue().AsArray().size; i++) { AssetTypeValueField item = m_Container[i]; string path = item.Get("first").GetValue().AsString(); AssetTypeValueField pointerField = item.Get("second"); uint fileID = (uint)pointerField.Get("m_FileID").GetValue().AsInt(); ulong pathID = (ulong)pointerField.Get("m_PathID").GetValue().AsInt64(); //paths[path] = new AssetDetails(new AssetPPtr(fileID, pathID)); assets.Add(new AssetDetails(new AssetPPtr(fileID, pathID), AssetIcon.Unknown, path)); } rootDir = new FSDirectory(); //rootDir.Create(paths); rootDir.Create(assets); ChangeDirectory(""); helper.UpdateDependencies(); CheckResourcesInfo(); return; } } }
private void LoadResources(AssetsFileInstance ggm) { foreach (AssetFileInfoEx info in ggm.table.assetFileInfo) { ClassDatabaseType type = AssetHelper.FindAssetClassByID(helper.classFile, info.curFileType); if (type.name.GetString(helper.classFile) == "ResourceManager") { AssetTypeInstance inst = helper.GetTypeInstance(ggm.file, info); AssetTypeValueField baseField = inst.GetBaseField(); AssetTypeValueField m_Container = baseField.Get("m_Container").Get("Array"); List <AssetDetails> assets = new List <AssetDetails>(); for (int i = 0; i < m_Container.GetValue().AsArray().size; i++) { AssetTypeValueField item = m_Container[i]; string path = item.Get("first").GetValue().AsString(); AssetTypeValueField pointerField = item.Get("second"); //paths[path] = new AssetDetails(new AssetPPtr(fileID, pathID)); AssetExternal assetExt = helper.GetExtAsset(ggm, pointerField, true); AssetFileInfoEx assetInfo = assetExt.info; if (assetInfo == null) { continue; } ClassDatabaseType assetType = AssetHelper.FindAssetClassByID(helper.classFile, assetInfo.curFileType); if (assetType == null) { continue; } string assetTypeName = assetType.name.GetString(helper.classFile); string assetName = AssetHelper.GetAssetNameFast(assetExt.file.file, helper.classFile, assetInfo); if (path.Contains("/")) { if (path.Substring(path.LastIndexOf('/') + 1) == assetName.ToLower()) { path = path.Substring(0, path.LastIndexOf('/') + 1) + assetName; } } else { if (path == assetName.ToLower()) { path = path.Substring(0, path.LastIndexOf('/') + 1) + assetName; } } assets.Add(new AssetDetails(new AssetPPtr(0, assetInfo.index), GetIconForName(assetTypeName), path, assetTypeName, (int)assetInfo.curFileSize)); } rootDir = new FSDirectory(); //rootDir.Create(paths); rootDir.Create(assets); ChangeDirectory(""); helper.UpdateDependencies(); CheckResourcesInfo(); return; } } }
private void LoadGeneric(AssetsFileInstance mainFile, bool isLevel) { //Dictionary<string, AssetDetails> paths = new Dictionary<string, AssetDetails>(); List <AssetDetails> assets = new List <AssetDetails>(); foreach (AssetFileInfoEx info in mainFile.table.pAssetFileInfo) { ClassDatabaseType type = AssetHelper.FindAssetClassByID(helper.classFile, info.curFileType); if (type == null) { continue; } string typeName = type.name.GetString(helper.classFile); if (typeName != "GameObject" && isLevel) { continue; } string name = AssetInfo.GetAssetNameFast(info, helper.classFile, type, mainFile); if (name == "") { name = "[Unnamed]"; } //int count = 0; //string newName = name; //while (paths.Keys.Contains(newName)/* && count < 20*/) //{ // count++; // newName = $"{name} ({count})"; //} //if (count < 20) //{ //paths[newName] = new AssetDetails(new AssetPPtr(0, info.index), name, typeName, (int)info.curFileSize); assets.Add(new AssetDetails(new AssetPPtr(0, info.index), GetIconForName(typeName), name, typeName, (int)info.curFileSize)); //} } rootDir = new FSDirectory(); //rootDir.Create(paths); rootDir.Create(assets); ChangeDirectory(""); }