Compare commits

..

2 Commits

Author SHA1 Message Date
defnotken
5cee5e0fbe maybe? 2026-01-20 14:30:47 -06:00
defnotken
e00f80d7bd 2.1.1 2026-01-20 14:10:05 -06:00
2 changed files with 81 additions and 55 deletions

View File

@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<Authors></Authors> <Authors></Authors>
<Company></Company> <Company></Company>
<Version>2.1.0</Version> <Version>2.1.1</Version>
<Description></Description> <Description></Description>
<Copyright></Copyright> <Copyright></Copyright>
<PackageProjectUrl>https://github.com/Light-Public-Syncshells/LightlessClient</PackageProjectUrl> <PackageProjectUrl>https://github.com/Light-Public-Syncshells/LightlessClient</PackageProjectUrl>

View File

@@ -173,6 +173,8 @@ public sealed class GameObjectHandler : DisposableMediatorSubscriberBase, IHighP
private void CheckAndUpdateObject() => CheckAndUpdateObject(allowPublish: true); private void CheckAndUpdateObject() => CheckAndUpdateObject(allowPublish: true);
private unsafe void CheckAndUpdateObject(bool allowPublish) private unsafe void CheckAndUpdateObject(bool allowPublish)
{
try
{ {
var prevAddr = Address; var prevAddr = Address;
var prevDrawObj = DrawObjectAddress; var prevDrawObj = DrawObjectAddress;
@@ -229,10 +231,28 @@ public sealed class GameObjectHandler : DisposableMediatorSubscriberBase, IHighP
bool drawObjDiff = DrawObjectAddress != prevDrawObj; bool drawObjDiff = DrawObjectAddress != prevDrawObj;
bool addrDiff = Address != prevAddr; bool addrDiff = Address != prevAddr;
if (Address != IntPtr.Zero && DrawObjectAddress != IntPtr.Zero if (Address == IntPtr.Zero || DrawObjectAddress == IntPtr.Zero)
&& PtrGuard.IsReadable(Address, (nuint)sizeof(Character))
&& PtrGuard.IsReadable(DrawObjectAddress, (nuint)sizeof(DrawObject)))
{ {
if (addrDiff || drawObjDiff)
{
CurrentDrawCondition = DrawCondition.DrawObjectZero;
Logger.LogTrace("[{this}] Changed", this);
if (_isOwnedObject && ObjectKind != ObjectKind.Player)
Mediator.Publish(new ClearCacheForObjectMessage(this));
}
return;
}
if (!PtrGuard.IsReadable(Address, (nuint)sizeof(Character)) ||
!PtrGuard.IsReadable(DrawObjectAddress, (nuint)sizeof(DrawObject)))
{
Logger.LogTrace("[{this}] Pointers became invalid during update", this);
Address = IntPtr.Zero;
DrawObjectAddress = IntPtr.Zero;
CurrentDrawCondition = DrawCondition.DrawObjectZero;
return;
}
var chara = (Character*)Address; var chara = (Character*)Address;
var drawObj = (DrawObject*)DrawObjectAddress; var drawObj = (DrawObject*)DrawObjectAddress;
@@ -315,12 +335,11 @@ public sealed class GameObjectHandler : DisposableMediatorSubscriberBase, IHighP
Mediator.Publish(new CreateCacheForObjectMessage(this)); Mediator.Publish(new CreateCacheForObjectMessage(this));
} }
} }
else if (addrDiff || drawObjDiff) catch (Exception ex)
{ {
Address = IntPtr.Zero;
DrawObjectAddress = IntPtr.Zero;
CurrentDrawCondition = DrawCondition.DrawObjectZero; CurrentDrawCondition = DrawCondition.DrawObjectZero;
Logger.LogTrace("[{this}] Changed", this);
if (_isOwnedObject && ObjectKind != ObjectKind.Player)
Mediator.Publish(new ClearCacheForObjectMessage(this));
} }
} }
@@ -443,11 +462,18 @@ public sealed class GameObjectHandler : DisposableMediatorSubscriberBase, IHighP
{ {
if (Address == IntPtr.Zero) return DrawCondition.ObjectZero; if (Address == IntPtr.Zero) return DrawCondition.ObjectZero;
if (DrawObjectAddress == IntPtr.Zero) return DrawCondition.DrawObjectZero; if (DrawObjectAddress == IntPtr.Zero) return DrawCondition.DrawObjectZero;
if (!PtrGuard.IsReadable(Address, (nuint)sizeof(FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject)))
return DrawCondition.ObjectZero;
var visibilityFlags = ((FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)Address)->RenderFlags; var visibilityFlags = ((FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)Address)->RenderFlags;
if (visibilityFlags != VisibilityFlags.None) return DrawCondition.RenderFlags; if (visibilityFlags != VisibilityFlags.None) return DrawCondition.RenderFlags;
if (ObjectKind == ObjectKind.Player) if (ObjectKind == ObjectKind.Player)
{ {
if (!PtrGuard.IsReadable(DrawObjectAddress, (nuint)sizeof(CharacterBase)))
return DrawCondition.DrawObjectZero;
var modelInSlotLoaded = (((CharacterBase*)DrawObjectAddress)->HasModelInSlotLoaded != 0); var modelInSlotLoaded = (((CharacterBase*)DrawObjectAddress)->HasModelInSlotLoaded != 0);
if (modelInSlotLoaded) return DrawCondition.ModelInSlotLoaded; if (modelInSlotLoaded) return DrawCondition.ModelInSlotLoaded;
var modelFilesInSlotLoaded = (((CharacterBase*)DrawObjectAddress)->HasModelFilesInSlotLoaded != 0); var modelFilesInSlotLoaded = (((CharacterBase*)DrawObjectAddress)->HasModelFilesInSlotLoaded != 0);