Add basic version of item swap, seemingly working for hair, tail and ears.

This commit is contained in:
Ottermandias 2022-12-12 23:14:50 +01:00
parent e534ce37d5
commit 5b3d5d1e67
22 changed files with 1730 additions and 120 deletions

View file

@ -1,6 +1,7 @@
namespace Penumbra.GameData.Files;
public interface IWritable
{
{
public bool Valid { get; }
public byte[] Write();
}

View file

@ -83,7 +83,9 @@ public partial class MdlFile : IWritable
public Shape[] Shapes;
// Raw, unparsed data.
public byte[] RemainingData;
public byte[] RemainingData;
public bool Valid { get; }
public MdlFile(byte[] data)
{
@ -180,6 +182,7 @@ public partial class MdlFile : IWritable
BoneBoundingBoxes[i] = MdlStructs.BoundingBoxStruct.Read(r);
RemainingData = r.ReadBytes((int)(r.BaseStream.Length - r.BaseStream.Position));
Valid = true;
}
private MdlStructs.ModelFileHeader LoadModelFileHeader(LuminaBinaryReader r)

View file

@ -231,6 +231,9 @@ public partial class MtrlFile : IWritable
{
public string Path;
public ushort Flags;
public bool DX11
=> (Flags & 0x8000) != 0;
}
public struct Constant
@ -251,6 +254,7 @@ public partial class MtrlFile : IWritable
public readonly uint Version;
public bool Valid { get; }
public Texture[] Textures;
public UvSet[] UvSets;
@ -368,6 +372,7 @@ public partial class MtrlFile : IWritable
ShaderPackage.Constants = r.ReadStructuresAsArray<Constant>(constantCount);
ShaderPackage.Samplers = r.ReadStructuresAsArray<Sampler>(samplerCount);
ShaderPackage.ShaderValues = r.ReadStructuresAsArray<float>(shaderValueListSize / 4);
Valid = true;
}
private static Texture[] ReadTextureOffsets(BinaryReader r, int count, out ushort[] offsets)