mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Compare cutscene actors by customization.
This commit is contained in:
parent
28e0affbb4
commit
f808c8a471
4 changed files with 164 additions and 151 deletions
55
Penumbra.GameData/Structs/CustomizeData.cs
Normal file
55
Penumbra.GameData/Structs/CustomizeData.cs
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
using Penumbra.GameData.Util;
|
||||
|
||||
namespace Penumbra.GameData.Structs;
|
||||
|
||||
public unsafe struct CustomizeData : IEquatable< CustomizeData >
|
||||
{
|
||||
public const int Size = 26;
|
||||
|
||||
public fixed byte Data[Size];
|
||||
|
||||
public void Read( void* source )
|
||||
{
|
||||
fixed( byte* ptr = Data )
|
||||
{
|
||||
Functions.MemCpyUnchecked( ptr, source, Size );
|
||||
}
|
||||
}
|
||||
|
||||
public void Write( void* target )
|
||||
{
|
||||
fixed( byte* ptr = Data )
|
||||
{
|
||||
Functions.MemCpyUnchecked( target, ptr, Size );
|
||||
}
|
||||
}
|
||||
|
||||
public CustomizeData Clone()
|
||||
{
|
||||
var ret = new CustomizeData();
|
||||
Write( ret.Data );
|
||||
return ret;
|
||||
}
|
||||
|
||||
public bool Equals( CustomizeData other )
|
||||
{
|
||||
fixed( byte* ptr = Data )
|
||||
{
|
||||
return Functions.MemCmpUnchecked( ptr, other.Data, Size ) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Equals( object? obj )
|
||||
=> obj is CustomizeData other && Equals( other );
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
fixed( byte* ptr = Data )
|
||||
{
|
||||
var p = ( int* )ptr;
|
||||
var u = *( ushort* )( p + 6 );
|
||||
return HashCode.Combine( *p, p[ 1 ], p[ 2 ], p[ 3 ], p[ 4 ], p[ 5 ], u );
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue