Fix problems with manual meta edits not masking correctly. Add warning when not entering model Id.

This commit is contained in:
Ottermandias 2022-10-09 22:56:09 +02:00
parent e226b20953
commit 707f308fac
9 changed files with 169 additions and 117 deletions

View file

@ -97,7 +97,7 @@ public partial class MetaManager
}
var def = ImcFile.GetDefault( path, m.EquipSlot, m.Variant, out _ );
var manip = m with { Entry = def };
var manip = m.Copy( def );
if( !manip.Apply( file ) )
{
return false;

View file

@ -12,28 +12,32 @@ namespace Penumbra.Meta.Manipulations;
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
public readonly struct EqdpManipulation : IMetaManipulation< EqdpManipulation >
{
public EqdpEntry Entry { get; init; }
public EqdpEntry Entry { get; private init; }
[JsonConverter( typeof( StringEnumConverter ) )]
public Gender Gender { get; init; }
public Gender Gender { get; private init; }
[JsonConverter( typeof( StringEnumConverter ) )]
public ModelRace Race { get; init; }
public ModelRace Race { get; private init; }
public ushort SetId { get; init; }
public ushort SetId { get; private init; }
[JsonConverter( typeof( StringEnumConverter ) )]
public EquipSlot Slot { get; init; }
public EquipSlot Slot { get; private init; }
[JsonConstructor]
public EqdpManipulation( EqdpEntry entry, EquipSlot slot, Gender gender, ModelRace race, ushort setId )
{
Entry = Eqdp.Mask( slot ) & entry;
Gender = gender;
Race = race;
SetId = setId;
Slot = slot;
Entry = Eqdp.Mask( Slot ) & entry;
}
public EqdpManipulation Copy( EqdpEntry entry )
=> new(entry, Slot, Gender, Race, SetId);
public override string ToString()
=> $"Eqdp - {SetId} - {Slot} - {Race.ToName()} - {Gender.ToName()}";

View file

@ -7,6 +7,7 @@ using Penumbra.GameData.Structs;
using Penumbra.Interop.Structs;
using Penumbra.Meta.Files;
using Penumbra.Util;
using SharpCompress.Common;
namespace Penumbra.Meta.Manipulations;
@ -14,13 +15,14 @@ namespace Penumbra.Meta.Manipulations;
public readonly struct EqpManipulation : IMetaManipulation< EqpManipulation >
{
[JsonConverter( typeof( ForceNumericFlagEnumConverter ) )]
public EqpEntry Entry { get; init; }
public EqpEntry Entry { get; private init; }
public ushort SetId { get; init; }
public ushort SetId { get; private init; }
[JsonConverter( typeof( StringEnumConverter ) )]
public EquipSlot Slot { get; init; }
public EquipSlot Slot { get; private init; }
[JsonConstructor]
public EqpManipulation( EqpEntry entry, EquipSlot slot, ushort setId )
{
Slot = slot;
@ -28,6 +30,9 @@ public readonly struct EqpManipulation : IMetaManipulation< EqpManipulation >
Entry = Eqp.Mask( slot ) & entry;
}
public EqpManipulation Copy( EqpEntry entry )
=> new(entry, Slot, SetId);
public override string ToString()
=> $"Eqp - {SetId} - {Slot}";

View file

@ -19,18 +19,18 @@ public readonly struct EstManipulation : IMetaManipulation< EstManipulation >
Head = CharacterUtility.Index.HeadEst,
}
public ushort Entry { get; init; } // SkeletonIdx.
public ushort Entry { get; private init; } // SkeletonIdx.
[JsonConverter( typeof( StringEnumConverter ) )]
public Gender Gender { get; init; }
public Gender Gender { get; private init; }
[JsonConverter( typeof( StringEnumConverter ) )]
public ModelRace Race { get; init; }
public ModelRace Race { get; private init; }
public ushort SetId { get; init; }
public ushort SetId { get; private init; }
[JsonConverter( typeof( StringEnumConverter ) )]
public EstType Slot { get; init; }
public EstType Slot { get; private init; }
[JsonConstructor]
public EstManipulation( Gender gender, ModelRace race, EstType slot, ushort setId, ushort entry )
@ -42,6 +42,9 @@ public readonly struct EstManipulation : IMetaManipulation< EstManipulation >
Slot = slot;
}
public EstManipulation Copy( ushort entry )
=> new(Gender, Race, Slot, SetId, entry);
public override string ToString()
=> $"Est - {SetId} - {Slot} - {Race.ToName()} {Gender.ToName()}";

View file

@ -1,4 +1,5 @@
using System.Runtime.InteropServices;
using Newtonsoft.Json;
using Penumbra.GameData.Structs;
using Penumbra.Interop.Structs;
using Penumbra.Meta.Files;
@ -8,15 +9,19 @@ namespace Penumbra.Meta.Manipulations;
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
public readonly struct GmpManipulation : IMetaManipulation< GmpManipulation >
{
public GmpEntry Entry { get; init; }
public ushort SetId { get; init; }
public GmpEntry Entry { get; private init; }
public ushort SetId { get; private init; }
[JsonConstructor]
public GmpManipulation( GmpEntry entry, ushort setId )
{
Entry = entry;
SetId = setId;
}
public GmpManipulation Copy( GmpEntry entry )
=> new(entry, SetId);
public override string ToString()
=> $"Gmp - {SetId}";

View file

@ -12,19 +12,19 @@ namespace Penumbra.Meta.Manipulations;
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
public readonly struct ImcManipulation : IMetaManipulation< ImcManipulation >
{
public ImcEntry Entry { get; init; }
public ushort PrimaryId { get; init; }
public ushort Variant { get; init; }
public ushort SecondaryId { get; init; }
public ImcEntry Entry { get; private init; }
public ushort PrimaryId { get; private init; }
public ushort Variant { get; private init; }
public ushort SecondaryId { get; private init; }
[JsonConverter( typeof( StringEnumConverter ) )]
public ObjectType ObjectType { get; init; }
public ObjectType ObjectType { get; private init; }
[JsonConverter( typeof( StringEnumConverter ) )]
public EquipSlot EquipSlot { get; init; }
public EquipSlot EquipSlot { get; private init; }
[JsonConverter( typeof( StringEnumConverter ) )]
public BodySlot BodySlot { get; init; }
public BodySlot BodySlot { get; private init; }
public ImcManipulation( EquipSlot equipSlot, ushort variant, ushort primaryId, ImcEntry entry )
{
@ -71,6 +71,9 @@ public readonly struct ImcManipulation : IMetaManipulation< ImcManipulation >
}
}
public ImcManipulation Copy( ImcEntry entry )
=> new(ObjectType, BodySlot, PrimaryId, SecondaryId, Variant, EquipSlot, entry);
public override string ToString()
=> ObjectType is ObjectType.Equipment or ObjectType.Accessory
? $"Imc - {PrimaryId} - {EquipSlot} - {Variant}"

View file

@ -11,14 +11,15 @@ namespace Penumbra.Meta.Manipulations;
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
public readonly struct RspManipulation : IMetaManipulation< RspManipulation >
{
public float Entry { get; init; }
public float Entry { get; private init; }
[JsonConverter( typeof( StringEnumConverter ) )]
public SubRace SubRace { get; init; }
public SubRace SubRace { get; private init; }
[JsonConverter( typeof( StringEnumConverter ) )]
public RspAttribute Attribute { get; init; }
public RspAttribute Attribute { get; private init; }
[JsonConstructor]
public RspManipulation( SubRace subRace, RspAttribute attribute, float entry )
{
Entry = entry;
@ -26,6 +27,9 @@ public readonly struct RspManipulation : IMetaManipulation< RspManipulation >
Attribute = attribute;
}
public RspManipulation Copy( float entry )
=> new(SubRace, Attribute, entry);
public override string ToString()
=> $"Rsp - {SubRace.ToName()} - {Attribute.ToFullString()}";