merge from main

This commit is contained in:
Stanley Dimant
2022-09-03 15:06:01 +02:00
11 changed files with 183 additions and 130 deletions

View File

@@ -47,7 +47,7 @@ namespace MareSynchronos.Models
var chara = (Character*)curPtr;
bool addr = Address == IntPtr.Zero || Address != curPtr;
bool equip = CompareAndUpdateByteData(chara->EquipSlotData, chara->CustomizeData);
bool drawObj = (chara->GameObject.DrawObject != null && (IntPtr)chara->GameObject.DrawObject != DrawObjectAddress);
bool drawObj = (IntPtr)chara->GameObject.DrawObject != DrawObjectAddress;
var name = new Utf8String(chara->GameObject.Name).ToString();
bool nameChange = (name != _name);
if (addr || equip || drawObj || nameChange)
@@ -60,17 +60,11 @@ namespace MareSynchronos.Models
HasUnprocessedUpdate = true;
}
}
else
else if (Address != IntPtr.Zero || DrawObjectAddress != IntPtr.Zero)
{
if (Address != IntPtr.Zero || DrawObjectAddress != IntPtr.Zero)
{
Address = IntPtr.Zero;
DrawObjectAddress = IntPtr.Zero;
HasUnprocessedUpdate = true;
}
Address = IntPtr.Zero;
DrawObjectAddress = IntPtr.Zero;
Logger.Verbose(ObjectKind + " Changed: " + _name + ", now: " + Address + ", " + DrawObjectAddress);
}
}
@@ -98,33 +92,30 @@ namespace MareSynchronos.Models
}
}
if (ObjectKind is not ObjectKind.Mount)
var newHatState = Marshal.ReadByte((IntPtr)customizeData + 30, 0);
var newWeaponOrVisorState = Marshal.ReadByte((IntPtr)customizeData + 31, 0);
if (newHatState != HatState)
{
var newHatState = Marshal.ReadByte((IntPtr)customizeData + 30, 0);
var newWeaponOrVisorState = Marshal.ReadByte((IntPtr)customizeData + 31, 0);
if (newHatState != HatState)
if (HatState != null && !hasChanges && !HasUnprocessedUpdate)
{
if (HatState != null && !hasChanges && !HasUnprocessedUpdate)
{
Logger.Debug("Not Sending Update, only Hat changed");
DoNotSendUpdate = true;
}
HatState = newHatState;
hasChanges = true;
Logger.Debug("Not Sending Update, only Hat changed");
DoNotSendUpdate = true;
}
HatState = newHatState;
hasChanges = true;
}
newWeaponOrVisorState &= 0b1101; // ignore drawing weapon
newWeaponOrVisorState &= 0b1101; // ignore drawing weapon
if (newWeaponOrVisorState != VisorWeaponState)
if (newWeaponOrVisorState != VisorWeaponState)
{
if (VisorWeaponState != null && !hasChanges && !HasUnprocessedUpdate)
{
if (VisorWeaponState != null && !hasChanges && !HasUnprocessedUpdate)
{
Logger.Debug("Not Sending Update, only Visor/Weapon changed");
DoNotSendUpdate = true;
}
VisorWeaponState = newWeaponOrVisorState;
hasChanges = true;
Logger.Debug("Not Sending Update, only Visor/Weapon changed");
DoNotSendUpdate = true;
}
VisorWeaponState = newWeaponOrVisorState;
hasChanges = true;
}
return hasChanges;