Skip to content

Commit

Permalink
Fix right rings and set status not being correctly checked by actorwa…
Browse files Browse the repository at this point in the history
…tcher.
  • Loading branch information
Ottermandias committed Jul 10, 2021
1 parent b05ff66 commit 25f901b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Penumbra/Game/CharEquipment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public override string ToString()
private const int EquipmentSlots = 10;
private const int WeaponSlots = 2;

private readonly ushort IsSet; // Also fills struct size to 56, a multiple of 8.
internal readonly Weapon Mainhand;
internal readonly Weapon Offhand;
internal readonly Equip Head;
Expand All @@ -51,6 +50,7 @@ public override string ToString()
internal readonly Equip Wrist;
internal readonly Equip LFinger;
internal readonly Equip RFinger;
internal readonly ushort IsSet; // Also fills struct size to 56, a multiple of 8.

public CharEquipment()
=> Clear();
Expand Down Expand Up @@ -97,7 +97,7 @@ public unsafe void Clear()
{
fixed( Weapon* main = &Mainhand )
{
var structSizeEights = ( EquipmentSlots * sizeof( Equip ) + WeaponSlots * sizeof( Weapon ) ) / 8;
var structSizeEights = ( 2 + EquipmentSlots * sizeof( Equip ) + WeaponSlots * sizeof( Weapon ) ) / 8;
for( ulong* ptr = ( ulong* )main, end = ptr + structSizeEights; ptr != end; ++ptr )
{
*ptr = 0;
Expand All @@ -107,13 +107,13 @@ public unsafe void Clear()

private unsafe bool CompareAndOverwrite( CharEquipment rhs )
{
var structSizeHalf = ( EquipmentSlots * sizeof( Equip ) + WeaponSlots * sizeof( Weapon ) ) / 8;
var ret = true;
var structSizeEights = ( 2 + EquipmentSlots * sizeof( Equip ) + WeaponSlots * sizeof( Weapon ) ) / 8;
var ret = true;
fixed( Weapon* data1 = &Mainhand, data2 = &rhs.Mainhand )
{
var ptr1 = ( ulong* )data1;
var ptr2 = ( ulong* )data2;
for( var end = ptr1 + structSizeHalf; ptr1 != end; ++ptr1, ++ptr2 )
for( var end = ptr1 + structSizeEights; ptr1 != end; ++ptr1, ++ptr2 )
{
if( *ptr1 != *ptr2 )
{
Expand All @@ -128,12 +128,12 @@ private unsafe bool CompareAndOverwrite( CharEquipment rhs )

private unsafe bool CompareData( CharEquipment rhs )
{
var structSizeHalf = ( EquipmentSlots * sizeof( Equip ) + WeaponSlots * sizeof( Weapon ) ) / 8;
var structSizeEights = ( 2 + EquipmentSlots * sizeof( Equip ) + WeaponSlots * sizeof( Weapon ) ) / 8;
fixed( Weapon* data1 = &Mainhand, data2 = &rhs.Mainhand )
{
var ptr1 = ( ulong* )data1;
var ptr2 = ( ulong* )data2;
for( var end = ptr1 + structSizeHalf; ptr1 != end; ++ptr1, ++ptr2 )
for( var end = ptr1 + structSizeEights; ptr1 != end; ++ptr1, ++ptr2 )
{
if( *ptr1 != *ptr2 )
{
Expand Down
4 changes: 4 additions & 0 deletions Penumbra/UI/MenuTabs/TabDebug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ private void DrawDebugTabActors()

ImGui.TableNextRow();
ImGui.TableNextColumn();
if (actor.Value.IsSet == 0)
{
ImGui.Text( "(not set)" );
}
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( actor.Value.Mainhand._1, actor.Value.Mainhand._2, actor.Value.Mainhand._3, EquipSlot.MainHand )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
Expand Down

0 comments on commit 25f901b

Please sign in to comment.