mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-14 04:34:19 +01:00
Add some start for Evp Data.
This commit is contained in:
parent
8aec63d0be
commit
2010e02034
4 changed files with 128 additions and 60 deletions
|
|
@ -1,4 +1,3 @@
|
||||||
using System;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@ public enum EqpEntry : ulong
|
||||||
BodyShowNecklace = 0x08_00ul,
|
BodyShowNecklace = 0x08_00ul,
|
||||||
BodyShowBracelet = 0x10_00ul,
|
BodyShowBracelet = 0x10_00ul,
|
||||||
BodyShowTail = 0x20_00ul,
|
BodyShowTail = 0x20_00ul,
|
||||||
DisableBreastPhysics = 0x40_00ul,
|
BodyDisableBreastPhysics = 0x40_00ul,
|
||||||
_15 = 0x80_00ul,
|
BodyHasVfxObject = 0x80_00ul,
|
||||||
BodyMask = 0xFF_FFul,
|
BodyMask = 0xFF_FFul,
|
||||||
|
|
||||||
LegsEnabled = 0x01ul << 16,
|
LegsEnabled = 0x01ul << 16,
|
||||||
|
|
@ -75,7 +75,7 @@ public enum EqpEntry : ulong
|
||||||
_55 = 0x00_80_00ul << 40,
|
_55 = 0x00_80_00ul << 40,
|
||||||
HeadShowHrothgarHat = 0x01_00_00ul << 40,
|
HeadShowHrothgarHat = 0x01_00_00ul << 40,
|
||||||
HeadShowVieraHat = 0x02_00_00ul << 40,
|
HeadShowVieraHat = 0x02_00_00ul << 40,
|
||||||
_58 = 0x04_00_00ul << 40,
|
HeadHasVfxObject = 0x04_00_00ul << 40,
|
||||||
_59 = 0x08_00_00ul << 40,
|
_59 = 0x08_00_00ul << 40,
|
||||||
_60 = 0x10_00_00ul << 40,
|
_60 = 0x10_00_00ul << 40,
|
||||||
_61 = 0x20_00_00ul << 40,
|
_61 = 0x20_00_00ul << 40,
|
||||||
|
|
@ -150,8 +150,8 @@ public static class Eqp
|
||||||
EqpEntry.BodyShowNecklace => EquipSlot.Body,
|
EqpEntry.BodyShowNecklace => EquipSlot.Body,
|
||||||
EqpEntry.BodyShowBracelet => EquipSlot.Body,
|
EqpEntry.BodyShowBracelet => EquipSlot.Body,
|
||||||
EqpEntry.BodyShowTail => EquipSlot.Body,
|
EqpEntry.BodyShowTail => EquipSlot.Body,
|
||||||
EqpEntry.DisableBreastPhysics => EquipSlot.Body,
|
EqpEntry.BodyDisableBreastPhysics => EquipSlot.Body,
|
||||||
EqpEntry._15 => EquipSlot.Body,
|
EqpEntry.BodyHasVfxObject => EquipSlot.Body,
|
||||||
|
|
||||||
EqpEntry.LegsEnabled => EquipSlot.Legs,
|
EqpEntry.LegsEnabled => EquipSlot.Legs,
|
||||||
EqpEntry.LegsHideKneePads => EquipSlot.Legs,
|
EqpEntry.LegsHideKneePads => EquipSlot.Legs,
|
||||||
|
|
@ -198,9 +198,9 @@ public static class Eqp
|
||||||
EqpEntry._55 => EquipSlot.Head,
|
EqpEntry._55 => EquipSlot.Head,
|
||||||
EqpEntry.HeadShowHrothgarHat => EquipSlot.Head,
|
EqpEntry.HeadShowHrothgarHat => EquipSlot.Head,
|
||||||
EqpEntry.HeadShowVieraHat => EquipSlot.Head,
|
EqpEntry.HeadShowVieraHat => EquipSlot.Head,
|
||||||
|
EqpEntry.HeadHasVfxObject => EquipSlot.Head,
|
||||||
|
|
||||||
// Currently unused.
|
// currently unused
|
||||||
EqpEntry._58 => EquipSlot.Unknown,
|
|
||||||
EqpEntry._59 => EquipSlot.Unknown,
|
EqpEntry._59 => EquipSlot.Unknown,
|
||||||
EqpEntry._60 => EquipSlot.Unknown,
|
EqpEntry._60 => EquipSlot.Unknown,
|
||||||
EqpEntry._61 => EquipSlot.Unknown,
|
EqpEntry._61 => EquipSlot.Unknown,
|
||||||
|
|
@ -229,8 +229,8 @@ public static class Eqp
|
||||||
EqpEntry.BodyShowNecklace => "Show Necklace",
|
EqpEntry.BodyShowNecklace => "Show Necklace",
|
||||||
EqpEntry.BodyShowBracelet => "Show Bracelet",
|
EqpEntry.BodyShowBracelet => "Show Bracelet",
|
||||||
EqpEntry.BodyShowTail => "Show Tail",
|
EqpEntry.BodyShowTail => "Show Tail",
|
||||||
EqpEntry.DisableBreastPhysics => "Disable Breast Physics",
|
EqpEntry.BodyDisableBreastPhysics => "Disable Breast Physics",
|
||||||
EqpEntry._15 => "Unknown 15",
|
EqpEntry.BodyHasVfxObject => "Has Special Effects",
|
||||||
|
|
||||||
EqpEntry.LegsEnabled => "Enabled",
|
EqpEntry.LegsEnabled => "Enabled",
|
||||||
EqpEntry.LegsHideKneePads => "Hide Knee Pads",
|
EqpEntry.LegsHideKneePads => "Hide Knee Pads",
|
||||||
|
|
@ -277,7 +277,8 @@ public static class Eqp
|
||||||
EqpEntry._55 => "Unknown 55",
|
EqpEntry._55 => "Unknown 55",
|
||||||
EqpEntry.HeadShowHrothgarHat => "Show on Hrothgar",
|
EqpEntry.HeadShowHrothgarHat => "Show on Hrothgar",
|
||||||
EqpEntry.HeadShowVieraHat => "Show on Viera",
|
EqpEntry.HeadShowVieraHat => "Show on Viera",
|
||||||
EqpEntry._58 => "Unknown 58",
|
EqpEntry.HeadHasVfxObject => "Has Special Effects",
|
||||||
|
|
||||||
EqpEntry._59 => "Unknown 59",
|
EqpEntry._59 => "Unknown 59",
|
||||||
EqpEntry._60 => "Unknown 60",
|
EqpEntry._60 => "Unknown 60",
|
||||||
EqpEntry._61 => "Unknown 61",
|
EqpEntry._61 => "Unknown 61",
|
||||||
|
|
|
||||||
68
Penumbra/Meta/Files/EvpFile.cs
Normal file
68
Penumbra/Meta/Files/EvpFile.cs
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Penumbra.Meta.Files;
|
||||||
|
|
||||||
|
|
||||||
|
// EVP file structure:
|
||||||
|
// [Identifier:3 bytes, EVP]
|
||||||
|
// [NumModels:ushort]
|
||||||
|
// NumModels x [ModelId:ushort]
|
||||||
|
// Containing the relevant model IDs. Seems to be sorted.
|
||||||
|
// NumModels x [DataArray]:512 Byte]
|
||||||
|
// Containing Flags in each byte, 0x01 set for Body, 0x02 set for Helmet. Unsure where the index into this array comes from.
|
||||||
|
public unsafe class EvpFile : MetaBaseFile
|
||||||
|
{
|
||||||
|
public const int FlagArraySize = 512;
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum EvpFlag : byte
|
||||||
|
{
|
||||||
|
None = 0x00,
|
||||||
|
Body = 0x01,
|
||||||
|
Head = 0x02,
|
||||||
|
Both = Body | Head,
|
||||||
|
}
|
||||||
|
|
||||||
|
public int NumModels
|
||||||
|
=> Data[ 3 ];
|
||||||
|
|
||||||
|
public ReadOnlySpan< ushort > ModelSetIds
|
||||||
|
=> new(Data + 4, NumModels);
|
||||||
|
|
||||||
|
public ushort ModelSetId( int idx )
|
||||||
|
=> idx >= 0 && idx < NumModels ? ( ( ushort* )( Data + 4 ) )[ idx ] : ushort.MaxValue;
|
||||||
|
|
||||||
|
public ReadOnlySpan< EvpFlag > Flags( int idx )
|
||||||
|
=> new(Data + 4 + idx * FlagArraySize, FlagArraySize);
|
||||||
|
|
||||||
|
public EvpFlag Flag( ushort modelSet, int arrayIndex )
|
||||||
|
{
|
||||||
|
if( arrayIndex is >= FlagArraySize or < 0 )
|
||||||
|
{
|
||||||
|
return EvpFlag.None;
|
||||||
|
}
|
||||||
|
|
||||||
|
var ids = ModelSetIds;
|
||||||
|
for( var i = 0; i < ids.Length; ++i )
|
||||||
|
{
|
||||||
|
var model = ids[ i ];
|
||||||
|
if( model < modelSet )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( model > modelSet )
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Flags( i )[ arrayIndex ];
|
||||||
|
}
|
||||||
|
|
||||||
|
return EvpFlag.None;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EvpFile()
|
||||||
|
: base( ( Interop.Structs.CharacterUtility.Index )1 ) // TODO: Name
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
|
@ -12,7 +12,7 @@ public unsafe class MetaBaseFile : IDisposable
|
||||||
public CharacterUtility.InternalIndex Index { get; }
|
public CharacterUtility.InternalIndex Index { get; }
|
||||||
|
|
||||||
public MetaBaseFile( Interop.Structs.CharacterUtility.Index idx )
|
public MetaBaseFile( Interop.Structs.CharacterUtility.Index idx )
|
||||||
=> Index = CharacterUtility.ReverseIndices[(int) idx];
|
=> Index = CharacterUtility.ReverseIndices[ ( int )idx ];
|
||||||
|
|
||||||
protected (IntPtr Data, int Length) DefaultData
|
protected (IntPtr Data, int Length) DefaultData
|
||||||
=> Penumbra.CharacterUtility.DefaultResource( Index );
|
=> Penumbra.CharacterUtility.DefaultResource( Index );
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue