mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-23 00:07:53 +01:00
Added more detailed information about metadata changes on click on value, as well as option to edit them or add new ones.
This commit is contained in:
parent
068b1e074b
commit
83cad76b62
9 changed files with 950 additions and 166 deletions
|
|
@ -21,13 +21,35 @@ namespace Penumbra.Meta.Files
|
|||
public static ulong ToInteger( this ImcFile.ImageChangeData imc )
|
||||
{
|
||||
ulong ret = imc.MaterialId;
|
||||
ret |= ( ulong )imc.DecalId << 8;
|
||||
ret |= ( ulong )imc.AttributeMask << 16;
|
||||
ret |= ( ulong )imc.SoundId << 16;
|
||||
ret |= ( ulong )imc.VfxId << 32;
|
||||
ret |= ( ulong )imc.DecalId << 8;
|
||||
ret |= ( ulong )imc.AttributeMask << 16;
|
||||
ret |= ( ulong )imc.SoundId << 16;
|
||||
ret |= ( ulong )imc.VfxId << 32;
|
||||
ret |= ( ulong )imc.ActualMaterialAnimationId() << 40;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static byte ActualMaterialAnimationId( this ImcFile.ImageChangeData imc )
|
||||
{
|
||||
var tmp = imc.GetType().GetField( "_MaterialAnimationIdMask",
|
||||
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance );
|
||||
ret |= ( ulong )( byte )tmp!.GetValue( imc ) << 40;
|
||||
return ( byte )( tmp?.GetValue( imc ) ?? 0 );
|
||||
}
|
||||
|
||||
public static ImcFile.ImageChangeData FromValues( byte materialId, byte decalId, ushort attributeMask, byte soundId, byte vfxId,
|
||||
byte materialAnimationId )
|
||||
{
|
||||
var ret = new ImcFile.ImageChangeData()
|
||||
{
|
||||
DecalId = decalId,
|
||||
MaterialId = materialId,
|
||||
VfxId = vfxId,
|
||||
};
|
||||
ret.GetType().GetField( "_AttributeAndSound",
|
||||
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance )!
|
||||
.SetValue( ret, ( ushort )( ( attributeMask & 0x3FF ) | ( soundId << 10 ) ) );
|
||||
ret.GetType().GetField( "_AttributeAndSound",
|
||||
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance )!.SetValue( ret, materialAnimationId );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -45,7 +67,7 @@ namespace Penumbra.Meta.Files
|
|||
bw.Write( variant.DecalId );
|
||||
bw.Write( ( ushort )( variant.AttributeMask | variant.SoundId ) );
|
||||
bw.Write( variant.VfxId );
|
||||
bw.Write( variant.MaterialAnimationId );
|
||||
bw.Write( variant.ActualMaterialAnimationId() );
|
||||
}
|
||||
|
||||
public static byte[] WriteBytes( this ImcFile file )
|
||||
|
|
|
|||
|
|
@ -145,6 +145,24 @@ namespace Penumbra.Meta.Files
|
|||
};
|
||||
}
|
||||
|
||||
public object? GetDefaultValue( MetaManipulation m )
|
||||
{
|
||||
return m.Type switch
|
||||
{
|
||||
MetaType.Imc => GetDefaultImcFile( m.ImcIdentifier.ObjectType, m.ImcIdentifier.PrimaryId, m.ImcIdentifier.SecondaryId )
|
||||
?.GetValue( m ),
|
||||
MetaType.Gmp => GetDefaultGmpFile()?.GetEntry( m.GmpIdentifier.SetId ),
|
||||
MetaType.Eqp => GetDefaultEqpFile()?.GetEntry( m.EqpIdentifier.SetId )
|
||||
.Reduce( m.EqpIdentifier.Slot ),
|
||||
MetaType.Eqdp => GetDefaultEqdpFile( m.EqdpIdentifier.Slot, m.EqdpIdentifier.GenderRace )?.GetEntry( m.EqdpIdentifier.SetId )
|
||||
.Reduce( m.EqdpIdentifier.Slot ),
|
||||
MetaType.Est => GetDefaultEstFile( m.EstIdentifier.ObjectType, m.EstIdentifier.EquipSlot, m.EstIdentifier.BodySlot )
|
||||
?.GetEntry( m.EstIdentifier.GenderRace, m.EstIdentifier.PrimaryId ),
|
||||
MetaType.Rsp => GetDefaultCmpFile()?[ m.RspIdentifier.SubRace ][ m.RspIdentifier.Attribute ],
|
||||
_ => throw new NotImplementedException(),
|
||||
};
|
||||
}
|
||||
|
||||
// Create a deep copy of a default file as a new file.
|
||||
public object? CreateNewFile( MetaManipulation m )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue