public void Read(AssetsFileReader reader) { bufferedPath = reader.ReadNullTerminated(); guid = new GUID128(); guid.Read(reader); type = reader.ReadInt32(); assetPath = reader.ReadNullTerminated(); originalAssetPath = assetPath; //because lowercase "resources" is read by unity fine on linux, it either uses //hardcoded replaces like below or it has case insensitive pathing somehow //this isn't consistent with the original assetstools but it only supported //windows anyway, so this will only create issues if more than these three //pop up in the future. also, the reason I don't just replace all "library" //with "Resources" is so that when saving, I can change it back to the original //(like how unity_builtin_extra goes back to "resources", not "library") if (assetPath == "resources/unity_builtin_extra") { assetPath = "Resources/unity_builtin_extra"; } else if (assetPath == "library/unity default resources" || assetPath == "Library/unity default resources") { assetPath = "Resources/unity default resources"; } else if (assetPath == "library/unity editor resources" || assetPath == "Library/unity editor resources") { assetPath = "Resources/unity editor resources"; } }
public string assetPath; //path to the .assets file public void Read(AssetsFileReader reader) { bufferedPath = reader.ReadNullTerminated(); guid = new GUID128(); guid.Read(reader); type = reader.ReadInt32(); assetPath = reader.ReadNullTerminated(); //todo: the switchero was here for testing purposes, should be handled by application for full control if (assetPath.StartsWith("library/")) { assetPath = "Resources/" + assetPath.Substring(8); } }
public string assetPath; //path to the .assets file public ulong Read(ulong absFilePos, AssetsFileReader reader, bool bigEndian) { bufferedPath = reader.ReadNullTerminated(); guid = new GUID128(); guid.Read(reader.Position, reader); type = reader.ReadInt32(); assetPath = reader.ReadNullTerminated(); //todo: the switchero was here for testing purposes, should be handled by application for full control if (assetPath.StartsWith("library/")) { assetPath = "Resources/" + assetPath.Substring(8); } return(reader.Position); }
///public bool Pack(AssetsFileReader reader, LPARAM lPar, AssetsFileWriter writer, LPARAM writerPar); public bool IsAssetsFile(AssetsFileReader reader, AssetBundleDirectoryInfo06 entry) { //todo - not fully implemented long offset = bundleHeader6.GetFileDataOffset() + entry.offset; if (entry.decompressedSize < 0x20) { return(false); } reader.Position = offset; string possibleBundleHeader = reader.ReadStringLength(7); if (possibleBundleHeader == "UnityFS") { return(false); } reader.Position = offset + 0x08; int possibleFormat = reader.ReadInt32(); if (possibleFormat > 99) { return(false); } reader.Position = offset + 0x14; string possibleVersion = reader.ReadNullTerminated(); string emptyVersion = Regex.Replace(possibleVersion, "[a-zA-Z0-9\\.]", ""); string fullVersion = Regex.Replace(possibleVersion, "[^a-zA-Z0-9\\.]", ""); return(emptyVersion == "" && fullVersion.Length > 0); }
public bool Read(AssetsFileReader reader, bool allowCompressed = false) { this.reader = reader; reader.ReadNullTerminated(); uint version = reader.ReadUInt32(); if (version == 6 || version == 7) { reader.Position = 0; bundleHeader6 = new AssetBundleHeader06(); bundleHeader6.Read(reader); if (bundleHeader6.fileVersion >= 7) { reader.Align16(); } if (bundleHeader6.signature == "UnityFS") { bundleInf6 = new AssetBundleBlockAndDirectoryList06(); if ((bundleHeader6.flags & 0x3F) != 0) { if (allowCompressed) { return(true); } else { Close(); return(false); } } else { bundleInf6.Read(bundleHeader6.GetBundleInfoOffset(), reader); return(true); } } else { new NotImplementedException("Non UnityFS bundles are not supported yet."); } } else if (version == 3) { new NotImplementedException("Version 3 bundles are not supported yet."); } else { new Exception("AssetsBundleFile.Read : Unknown file version!"); } return(false); }
public uint dwUnknown; //actually belongs to the asset list; stored for .assets format < 14 public void Read(AssetsFileReader reader, uint version) { unityVersion = reader.ReadNullTerminated(); this.version = reader.ReadUInt32(); hasTypeTree = reader.ReadBoolean(); fieldCount = reader.ReadInt32(); unity5Types = new List <Type_0D>(); for (int i = 0; i < fieldCount; i++) { Type_0D type0d = new Type_0D(); type0d.Read(hasTypeTree, reader, version); unity5Types.Add(type0d); } if (version < 0x0E) { dwUnknown = reader.ReadUInt24(); } }//Minimum AssetsFile format : 6