Refactor reading, writing, and yaml export:

* Pull up release and editor methods
* Change universal methods into extensions
* Remove Version, Platform, and Flags from AssetReader and AssetWriter
This commit is contained in:
Jeremy Pritts 2023-03-24 22:11:02 -04:00
parent f8a171aea3
commit 6045b846f2
19 changed files with 150 additions and 147 deletions

View File

@ -1,9 +1,29 @@
using AssetRipper.Yaml;
using AssetRipper.IO.Files.SerializedFiles;
using AssetRipper.Yaml;
namespace AssetRipper.Assets.Export.Yaml
{
public interface IYamlExportable
{
YamlNode ExportYaml(IExportContainer collection);
YamlNode ExportYamlEditor(IExportContainer container);
YamlNode ExportYamlRelease(IExportContainer container);
}
public static class YamlExportableExtensions
{
public static YamlNode ExportYaml(this IYamlExportable @this, IExportContainer container)
{
return @this.ExportYaml(container, container.ExportFlags);
}
public static YamlNode ExportYaml(this IYamlExportable @this, IExportContainer container, TransferInstructionFlags flags)
{
if (flags.IsRelease())
{
return @this.ExportYamlRelease(container);
}
else
{
return @this.ExportYamlEditor(container);
}
}
}
}

View File

@ -1,9 +1,5 @@
using AssetRipper.Assets.Collections;
using AssetRipper.IO.Endian;
using AssetRipper.IO.Files;
using AssetRipper.IO.Files.SerializedFiles;
using AssetRipper.VersionUtilities;
namespace AssetRipper.Assets.IO.Reading
{
@ -30,14 +26,6 @@ namespace AssetRipper.Assets.IO.Reading
return ret;
}
public override string ToString()
{
return $"{nameof(AssetReader)} ({Platform} {Version})";
}
public UnityVersion Version => AssetCollection.Version;
public BuildTarget Platform => AssetCollection.Platform;
public TransferInstructionFlags Flags => AssetCollection.Flags;
public AssetCollection AssetCollection { get; }
}
}

View File

@ -1,7 +1,29 @@
namespace AssetRipper.Assets.IO.Reading
using AssetRipper.IO.Files.SerializedFiles;
namespace AssetRipper.Assets.IO.Reading
{
public interface IAssetReadable
{
void Read(AssetReader reader);
void ReadEditor(AssetReader reader);
void ReadRelease(AssetReader reader);
}
public static class AssetReadableExtensions
{
public static void Read(this IAssetReadable asset, AssetReader reader)
{
asset.Read(reader, reader.AssetCollection.Flags);
}
public static void Read(this IAssetReadable asset, AssetReader reader, TransferInstructionFlags flags)
{
if (flags.IsRelease())
{
asset.ReadRelease(reader);
}
else
{
asset.ReadEditor(reader);
}
}
}
}

View File

@ -1,8 +1,5 @@
using AssetRipper.Assets.Collections;
using AssetRipper.IO.Endian;
using AssetRipper.IO.Files;
using AssetRipper.IO.Files.SerializedFiles;
using AssetRipper.VersionUtilities;
namespace AssetRipper.Assets.IO.Writing
{
@ -18,14 +15,6 @@ namespace AssetRipper.Assets.IO.Writing
throw new NotSupportedException();
}
public void WriteAsset<T>(T value) where T : IAssetWritable
{
value.Write(this);
}
public UnityVersion Version => AssetCollection.Version;
public BuildTarget Platform => AssetCollection.Platform;
public TransferInstructionFlags Flags => AssetCollection.Flags;
public AssetCollection AssetCollection { get; }
}
}

View File

@ -1,7 +1,29 @@
namespace AssetRipper.Assets.IO.Writing
using AssetRipper.IO.Files.SerializedFiles;
namespace AssetRipper.Assets.IO.Writing
{
public interface IAssetWritable
{
void Write(AssetWriter writer);
void WriteEditor(AssetWriter writer);
void WriteRelease(AssetWriter writer);
}
public static class AssetWritableExtensions
{
public static void Write(this IAssetWritable asset, AssetWriter writer)
{
asset.Write(writer, writer.AssetCollection.Flags);
}
public static void Write(this IAssetWritable asset, AssetWriter writer, TransferInstructionFlags flags)
{
if (flags.IsRelease())
{
asset.WriteRelease(writer);
}
else
{
asset.WriteEditor(writer);
}
}
}
}

View File

@ -1,5 +1,6 @@
using AssetRipper.Assets.Collections;
using AssetRipper.Assets.Export;
using AssetRipper.Assets.Export.Yaml;
using AssetRipper.IO.Files;
using AssetRipper.Yaml;

View File

@ -1,4 +1,5 @@
using AssetRipper.Assets.Export;
using AssetRipper.Assets.Export.Yaml;
using AssetRipper.IO.Files;
using AssetRipper.VersionUtilities;
using AssetRipper.Yaml;

View File

@ -11,7 +11,7 @@ namespace AssetRipper.Assets.Metadata
{
}
public YamlNode ExportYaml(IExportContainer container)
public YamlNode ExportYaml()
{
YamlMappingNode node = new();
node.Style = MappingStyle.Flow;
@ -31,6 +31,10 @@ namespace AssetRipper.Assets.Metadata
return new MetaPtr(ExportIdHandler.GetMainExportID((uint)classID), UnityGUID.MissingReference, assetType);
}
YamlNode IYamlExportable.ExportYamlEditor(IExportContainer container) => ExportYaml();
YamlNode IYamlExportable.ExportYamlRelease(IExportContainer container) => ExportYaml();
private const string FileIDName = "fileID";
private const string GuidName = "guid";
private const string TypeName = "type";

View File

@ -5,7 +5,6 @@ using AssetRipper.Assets.Interfaces;
using AssetRipper.Assets.IO.Reading;
using AssetRipper.Assets.IO.Writing;
using AssetRipper.Assets.Metadata;
using AssetRipper.IO.Files.SerializedFiles;
using AssetRipper.Yaml;
using System.Runtime.CompilerServices;
@ -20,50 +19,14 @@ public abstract class UnityAssetBase : IUnityAssetBase
public virtual void ReadRelease(AssetReader reader) => throw MethodNotSupported();
public void Read(AssetReader reader)
{
if (reader.Flags.IsRelease())
{
ReadRelease(reader);
}
else
{
ReadEditor(reader);
}
}
public virtual void WriteEditor(AssetWriter writer) => throw MethodNotSupported();
public virtual void WriteRelease(AssetWriter writer) => throw MethodNotSupported();
public void Write(AssetWriter writer)
{
if (writer.Flags.IsRelease())
{
WriteRelease(writer);
}
else
{
WriteEditor(writer);
}
}
public virtual YamlNode ExportYamlEditor(IExportContainer container) => throw MethodNotSupported();
public virtual YamlNode ExportYamlRelease(IExportContainer container) => throw MethodNotSupported();
public YamlNode ExportYaml(IExportContainer container)
{
if (container.ExportFlags.IsRelease())
{
return ExportYamlRelease(container);
}
else
{
return ExportYamlEditor(container);
}
}
public virtual IEnumerable<PPtr<IUnityObjectBase>> FetchDependencies(DependencyContext context)
{
return Enumerable.Empty<PPtr<IUnityObjectBase>>();

View File

@ -1,6 +1,7 @@
using AssetRipper.Assets.Collections;
using AssetRipper.Assets.Export;
using AssetRipper.Assets.Export.Dependencies;
using AssetRipper.Assets.Export.Yaml;
using AssetRipper.Assets.Metadata;
using AssetRipper.IO.Files;
using AssetRipper.Yaml;
@ -32,7 +33,7 @@ public abstract class UnityObjectBase : UnityAssetBase, IUnityObjectBase
YamlMappingNode root = document.CreateMappingRoot();
root.Tag = ClassID.ToString();
root.Anchor = container.GetExportID(this).ToString();
root.Add(ClassName, ExportYaml(container));
root.Add(ClassName, this.ExportYaml(container));
return document;
}

View File

@ -8,7 +8,7 @@ using AssetRipper.VersionUtilities;
namespace AssetRipper.Export.Modules.Shaders.ShaderBlob
{
public sealed class ShaderSubProgram : IAssetReadable, IAssetWritable
public sealed class ShaderSubProgram
{
/// <summary>
/// 2019.1 and greater
@ -48,44 +48,24 @@ namespace AssetRipper.Export.Modules.Shaders.ShaderBlob
public static bool HasMergedKeywords(UnityVersion version) => version.IsGreaterEqual(2021, 2);
private static int GetExpectedProgramVersion(UnityVersion version)
{
if (version.IsEqual(5, 3))
return version switch
{
return 201509030;
}
else if (version.IsEqual(5, 4))
{
return 201510240;
}
else if (version.IsEqual(5, 5))
{
return 201608170;
}
else if (version.IsLess(2017, 3))
{
return 201609010;
}
else if (version.IsLess(2018, 2))
{
return 201708220;
}
else if (version.IsLess(2019))
{
return 201802150;
}
else if (version.IsLess(2021, 2))
{
return 201806140;
}
else
{
return 202012090;
}
_ when version.IsEqual(5, 3) => 201509030,
_ when version.IsEqual(5, 4) => 201510240,
_ when version.IsEqual(5, 5) => 201608170,
_ when version.IsLess(2017, 3) => 201609010,
_ when version.IsLess(2018, 2) => 201708220,
_ when version.IsLess(2019) => 201802150,
_ when version.IsLess(2021, 2) => 201806140,
_ => 202012090,
};
}
public void Read(AssetReader reader)
{
UnityVersion unityVersion = reader.AssetCollection.Version;
int version = reader.ReadInt32();
if (version != GetExpectedProgramVersion(reader.Version))
if (version != GetExpectedProgramVersion(unityVersion))
{
throw new Exception($"Shader program version {version} doesn't match");
}
@ -94,19 +74,19 @@ namespace AssetRipper.Export.Modules.Shaders.ShaderBlob
StatsALU = reader.ReadInt32();
StatsTEX = reader.ReadInt32();
StatsFlow = reader.ReadInt32();
if (HasStatsTempRegister(reader.Version))
if (HasStatsTempRegister(unityVersion))
{
StatsTempRegister = reader.ReadInt32();
}
if (HasMergedKeywords(reader.Version))
if (HasMergedKeywords(unityVersion))
{
reader.ReadStringArray();
}
else
{
GlobalKeywords = reader.ReadStringArray();
if (HasLocalKeywords(reader.Version))
if (HasLocalKeywords(unityVersion))
{
LocalKeywords = reader.ReadStringArray();
}
@ -134,8 +114,8 @@ namespace AssetRipper.Export.Modules.Shaders.ShaderBlob
List<VectorParameter> structVectors = new List<VectorParameter>();
List<MatrixParameter> structMatrices = new List<MatrixParameter>();
List<BufferBinding> buffers = new List<BufferBinding>();
List<UAVParameter>? uavs = HasUAVParameters(reader.Version) ? new List<UAVParameter>() : null;
List<SamplerParameter>? samplers = HasSamplerParameters(reader.Version) ? new List<SamplerParameter>() : null;
List<UAVParameter>? uavs = HasUAVParameters(unityVersion) ? new List<UAVParameter>() : null;
List<SamplerParameter>? samplers = HasSamplerParameters(unityVersion) ? new List<SamplerParameter>() : null;
List<BufferBinding> constBindings = new List<BufferBinding>();
List<StructParameter> structs = new List<StructParameter>();
@ -162,21 +142,21 @@ namespace AssetRipper.Export.Modules.Shaders.ShaderBlob
if (isMatrix)
{
MatrixParameter matrix = IsAllParamArgs(reader.Version)
MatrixParameter matrix = IsAllParamArgs(unityVersion)
? new MatrixParameter(paramName, paramType, index, arraySize, rows, columns)
: new MatrixParameter(paramName, paramType, index, rows, columns);
matrices.Add(matrix);
}
else
{
VectorParameter vector = IsAllParamArgs(reader.Version)
VectorParameter vector = IsAllParamArgs(unityVersion)
? new VectorParameter(paramName, paramType, index, arraySize, columns)
: new VectorParameter(paramName, paramType, index, columns);
vectors.Add(vector);
}
}
if (HasStructParameters(reader.Version))
if (HasStructParameters(unityVersion))
{
int structCount = reader.ReadInt32();
for (int j = 0; j < structCount; j++)
@ -203,14 +183,14 @@ namespace AssetRipper.Export.Modules.Shaders.ShaderBlob
if (isMatrix)
{
MatrixParameter matrix = IsAllParamArgs(reader.Version)
MatrixParameter matrix = IsAllParamArgs(unityVersion)
? new MatrixParameter(paramName, paramType, paramIndex, vectorArraySize, rows, columns)
: new MatrixParameter(paramName, paramType, paramIndex, rows, columns);
structMatrices.Add(matrix);
}
else
{
VectorParameter vector = IsAllParamArgs(reader.Version)
VectorParameter vector = IsAllParamArgs(unityVersion)
? new VectorParameter(paramName, paramType, paramIndex, vectorArraySize, columns)
: new VectorParameter(paramName, paramType, paramIndex, columns);
structVectors.Add(vector);
@ -245,7 +225,7 @@ namespace AssetRipper.Export.Modules.Shaders.ShaderBlob
if (type == 0)
{
TextureParameter texture;
if (HasNewTextureParams(reader.Version))
if (HasNewTextureParams(unityVersion))
{
uint textureExtraValue = reader.ReadUInt32();
bool isMultiSampled = (textureExtraValue & 1) == 1;
@ -253,7 +233,7 @@ namespace AssetRipper.Export.Modules.Shaders.ShaderBlob
int samplerIndex = extraValue;
texture = new TextureParameter(name, index, dimension, samplerIndex, isMultiSampled);
}
else if (HasMultiSampled(reader.Version))
else if (HasMultiSampled(unityVersion))
{
uint textureExtraValue = reader.ReadUInt32();
bool isMultiSampled = textureExtraValue == 1;
@ -317,17 +297,13 @@ namespace AssetRipper.Export.Modules.Shaders.ShaderBlob
}
ConstantBufferBindings = constBindings.ToArray();
if (HasStructParameters(reader.Version))
if (HasStructParameters(unityVersion))
{
StructParameters = structs.ToArray();
}
}
public void Write(AssetWriter writer)
{
#warning TODO:
throw new NotImplementedException();
}
public void Write(AssetWriter writer) => throw new NotImplementedException();
public ShaderGpuProgramType GetProgramType(UnityVersion version)
{

View File

@ -1,7 +1,6 @@
using AssetRipper.Assets.Collections;
using AssetRipper.Assets.IO.Reading;
using AssetRipper.Assets.IO.Writing;
using AssetRipper.Import.IO.Extensions;
using AssetRipper.Import.Utils;
using K4os.Compression.LZ4;
@ -30,7 +29,7 @@ namespace AssetRipper.Export.Modules.Shaders.ShaderBlob
using AssetReader blobReader = new AssetReader(blobMem, shaderCollection);
if (segment == 0)
{
Entries = ReadAssetArray<ShaderSubProgramEntry>(blobReader);
Entries = ReadAssetArray(blobReader);
SubPrograms = ArrayUtils.CreateAndInitializeArray<ShaderSubProgram>(Entries.Length);
}
ReadSegment(blobReader, segment);
@ -77,7 +76,7 @@ namespace AssetRipper.Export.Modules.Shaders.ShaderBlob
{
if (segment == 0)
{
blobWriter.WriteAssetArray(Entries);
WriteAssetArray(blobWriter, Entries);
}
WriteSegment(blobWriter, segment);
@ -113,7 +112,7 @@ namespace AssetRipper.Export.Modules.Shaders.ShaderBlob
}
}
private static T[] ReadAssetArray<T>(AssetReader reader) where T : IAssetReadable, new()
private static ShaderSubProgramEntry[] ReadAssetArray(AssetReader reader)
{
int count = reader.ReadInt32();
if (count < 0)
@ -121,10 +120,10 @@ namespace AssetRipper.Export.Modules.Shaders.ShaderBlob
throw new ArgumentOutOfRangeException(nameof(count), $"Cannot be negative: {count}");
}
T[] array = count == 0 ? Array.Empty<T>() : new T[count];
ShaderSubProgramEntry[] array = count == 0 ? Array.Empty<ShaderSubProgramEntry>() : new ShaderSubProgramEntry[count];
for (int i = 0; i < count; i++)
{
T instance = new T();
ShaderSubProgramEntry instance = new();
instance.Read(reader);
array[i] = instance;
}
@ -135,6 +134,21 @@ namespace AssetRipper.Export.Modules.Shaders.ShaderBlob
return array;
}
private static void WriteAssetArray(AssetWriter writer, ShaderSubProgramEntry[] buffer)
{
writer.Write(buffer.Length);
for (int i = 0; i < buffer.Length; i++)
{
buffer[i].Write(writer);
}
if (writer.IsAlignArray)
{
writer.AlignStream();
}
}
public ShaderSubProgramEntry[] Entries { get; set; } = Array.Empty<ShaderSubProgramEntry>();
public ShaderSubProgram[] SubPrograms { get; set; } = Array.Empty<ShaderSubProgram>();

View File

@ -4,7 +4,7 @@ using AssetRipper.VersionUtilities;
namespace AssetRipper.Export.Modules.Shaders.ShaderBlob
{
public sealed class ShaderSubProgramEntry : IAssetReadable, IAssetWritable
public sealed class ShaderSubProgramEntry
{
/// <summary>
/// 2019.3 and greater
@ -15,7 +15,7 @@ namespace AssetRipper.Export.Modules.Shaders.ShaderBlob
{
Offset = reader.ReadInt32();
Length = reader.ReadInt32();
if (HasSegment(reader.Version))
if (HasSegment(reader.AssetCollection.Version))
{
Segment = reader.ReadInt32();
}
@ -25,7 +25,7 @@ namespace AssetRipper.Export.Modules.Shaders.ShaderBlob
{
writer.Write(Offset);
writer.Write(Length);
if (HasSegment(writer.Version))
if (HasSegment(writer.AssetCollection.Version))
{
writer.Write(Segment);
}

View File

@ -1,5 +1,6 @@
using AssetRipper.Assets;
using AssetRipper.Assets.Export;
using AssetRipper.Assets.Export.Yaml;
using AssetRipper.Assets.Interfaces;
using AssetRipper.Export.UnityProjects.Audio;
using AssetRipper.Export.UnityProjects.Shaders;

View File

@ -1,6 +1,7 @@
using AssetRipper.Assets;
using AssetRipper.Assets.Export;
using AssetRipper.Assets.Export.Dependencies;
using AssetRipper.Assets.Export.Yaml;
using AssetRipper.Assets.IO;
using AssetRipper.Assets.IO.Reading;
using AssetRipper.Assets.IO.Writing;
@ -180,7 +181,7 @@ namespace AssetRipper.Import.Structure.Assembly.Serializable
IAsset[] structures = new IAsset[count];
for (int i = 0; i < count; i++)
{
IAsset structure = etalon.Type.CreateInstance(depth + 1, reader.Version);
IAsset structure = etalon.Type.CreateInstance(depth + 1, reader.AssetCollection.Version);
structure.Read(reader);
structures[i] = structure;
}
@ -188,7 +189,7 @@ namespace AssetRipper.Import.Structure.Assembly.Serializable
}
else
{
IAsset structure = etalon.Type.CreateInstance(depth + 1, reader.Version);
IAsset structure = etalon.Type.CreateInstance(depth + 1, reader.AssetCollection.Version);
structure.Read(reader);
CValue = structure;
}

View File

@ -48,7 +48,7 @@ namespace AssetRipper.Import.Structure
public override IUnityObjectBase? ReadAsset(AssetInfo assetInfo, AssetReader reader, int size, SerializedType? type)
{
IUnityObjectBase? asset = AssetFactory.CreateAsset(reader.Version, assetInfo);
IUnityObjectBase? asset = AssetFactory.CreateAsset(assetInfo.Collection.Version, assetInfo);
return asset switch
{
@ -146,7 +146,7 @@ namespace AssetRipper.Import.Structure
catch (Exception ex)
{
replaceWithUnreadableObject = false;
LogReadException(asset, reader, ex);
LogReadException(asset, ex);
}
if (replaceWithUnreadableObject)
{
@ -164,7 +164,7 @@ namespace AssetRipper.Import.Structure
private static void LogIncorrectNumberOfBytesRead(IUnityObjectBase asset, AssetReader reader, int size)
{
Logger.Error($"Read {reader.BaseStream.Position} but expected {size} for asset type {(ClassIDType)asset.ClassID}. V: {reader.Version} P: {reader.Platform} N: {reader.AssetCollection.Name} Path: {reader.AssetCollection.FilePath}");
Logger.Error($"Read {reader.BaseStream.Position} but expected {size} for asset type {(ClassIDType)asset.ClassID}. V: {asset.Collection.Version} P: {asset.Collection.Platform} N: {asset.Collection.Name} Path: {asset.Collection.FilePath}");
}
/// <summary>
@ -199,9 +199,9 @@ namespace AssetRipper.Import.Structure
Logger.Error(LogCategory.Import, $"Unable to read {monoBehaviour}, because script {monoBehaviour.Structure} layout mismatched binary content ({ex.GetType().Name}).");
}
private static void LogReadException(IUnityObjectBase asset, AssetReader reader, Exception ex)
private static void LogReadException(IUnityObjectBase asset, Exception ex)
{
Logger.Error($"Error during reading of asset type {(ClassIDType)asset.ClassID}. V: {reader.Version} P: {reader.Platform} N: {reader.AssetCollection.Name} Path: {reader.AssetCollection.FilePath}", ex);
Logger.Error($"Error during reading of asset type {(ClassIDType)asset.ClassID}. V: {asset.Collection.Version} P: {asset.Collection.Platform} N: {asset.Collection.Name} Path: {asset.Collection.FilePath}", ex);
}
public static IAsset CreateEngineAsset(string name, UnityVersion version)

View File

@ -5,7 +5,7 @@ using System.Numerics;
namespace AssetRipper.Processing.AnimationClips.Editor
{
public sealed record class StreamedCurveKey : IAssetReadable
public sealed record class StreamedCurveKey
{
public StreamedCurveKey() { }
public StreamedCurveKey(int index, Vector3 coefficient, float value)

View File

@ -2,18 +2,18 @@ using AssetRipper.Assets.IO.Reading;
namespace AssetRipper.Processing.AnimationClips.Editor
{
public sealed class StreamedFrame : IAssetReadable
public sealed class StreamedFrame
{
public void Read(AssetReader reader)
{
Time = reader.ReadSingle();
Curves = ReadAssetArray<StreamedCurveKey>(reader);
Curves = ReadAssetArray(reader);
}
public float Time { get; set; }
public StreamedCurveKey[] Curves { get; set; } = Array.Empty<StreamedCurveKey>();
private static T[] ReadAssetArray<T>(AssetReader reader) where T : IAssetReadable, new()
private static StreamedCurveKey[] ReadAssetArray(AssetReader reader)
{
int count = reader.ReadInt32();
if (count < 0)
@ -21,10 +21,10 @@ namespace AssetRipper.Processing.AnimationClips.Editor
throw new ArgumentOutOfRangeException(nameof(count), $"Cannot be negative: {count}");
}
T[] array = count == 0 ? Array.Empty<T>() : new T[count];
StreamedCurveKey[] array = count == 0 ? Array.Empty<StreamedCurveKey>() : new StreamedCurveKey[count];
for (int i = 0; i < count; i++)
{
T instance = new T();
StreamedCurveKey instance = new();
instance.Read(reader);
array[i] = instance;
}

View File

@ -157,16 +157,16 @@ namespace AssetRipper.Tools.RawTextureExtractor
{
public override IUnityObjectBase? ReadAsset(AssetInfo assetInfo, AssetReader reader, int size, SerializedType? type)
{
IUnityObjectBase? asset = CreateAsset(assetInfo, reader);
IUnityObjectBase? asset = CreateAsset(assetInfo);
return asset is not null ? TryReadAsset(reader, size, asset) : null;
}
private static IUnityObjectBase? CreateAsset(AssetInfo assetInfo, AssetReader reader)
private static IUnityObjectBase? CreateAsset(AssetInfo assetInfo)
{
return (ClassIDType)assetInfo.ClassID switch
{
ClassIDType.Texture2D => Texture2DFactory.CreateAsset(reader.Version, assetInfo),
ClassIDType.Cubemap => CubemapFactory.CreateAsset(reader.Version, assetInfo),
ClassIDType.Texture2D => Texture2DFactory.CreateAsset(assetInfo.Collection.Version, assetInfo),
ClassIDType.Cubemap => CubemapFactory.CreateAsset(assetInfo.Collection.Version, assetInfo),
_ => null
};
}
@ -178,7 +178,7 @@ namespace AssetRipper.Tools.RawTextureExtractor
asset.Read(reader);
if (reader.BaseStream.Position != size)
{
Console.WriteLine($"Read {reader.BaseStream.Position} but expected {size} for asset type {(ClassIDType)asset.ClassID}. V: {reader.Version} P: {reader.Platform} N: {reader.AssetCollection.Name} Path: {reader.AssetCollection.FilePath}");
Console.WriteLine($"Read {reader.BaseStream.Position} but expected {size} for asset type {(ClassIDType)asset.ClassID}. V: {asset.Collection.Version} P: {asset.Collection.Platform} N: {asset.Collection.Name} Path: {asset.Collection.FilePath}");
return null;
}
else
@ -188,7 +188,7 @@ namespace AssetRipper.Tools.RawTextureExtractor
}
catch (Exception ex)
{
Console.WriteLine($"Error during reading of asset type {(ClassIDType)asset.ClassID}. V: {reader.Version} P: {reader.Platform} N: {reader.AssetCollection.Name} Path: {reader.AssetCollection.FilePath}\n{ex}");
Console.WriteLine($"Error during reading of asset type {(ClassIDType)asset.ClassID}. V: {asset.Collection.Version} P: {asset.Collection.Platform} N: {asset.Collection.Name} Path: {asset.Collection.FilePath}\n{ex}");
return null;
}
}