more checks on drawing
This commit is contained in:
@@ -958,22 +958,35 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
|
||||
if (address == nint.Zero)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
var gameObj = (GameObject*)address;
|
||||
|
||||
if (gameObj == null || gameObj->ObjectKind == 0)
|
||||
return;
|
||||
|
||||
if (!IsGameObjectPresent(address))
|
||||
{
|
||||
_logger.LogDebug("Character {name} at {addr} no longer present in object table", characterName, address.ToString("X"));
|
||||
return;
|
||||
}
|
||||
|
||||
var drawObj = gameObj->DrawObject;
|
||||
bool isDrawing = false;
|
||||
bool isDrawingChanged = false;
|
||||
|
||||
if ((nint)drawObj != IntPtr.Zero)
|
||||
{
|
||||
isDrawing = gameObj->RenderFlags == (VisibilityFlags)0b100000000000;
|
||||
if (!isDrawing)
|
||||
{
|
||||
isDrawing = ((CharacterBase*)drawObj)->HasModelInSlotLoaded != 0;
|
||||
var charBase = (CharacterBase*)drawObj;
|
||||
if (charBase != null)
|
||||
{
|
||||
isDrawing = charBase->HasModelInSlotLoaded != 0;
|
||||
if (!isDrawing)
|
||||
{
|
||||
isDrawing = ((CharacterBase*)drawObj)->HasModelFilesInSlotLoaded != 0;
|
||||
isDrawing = charBase->HasModelFilesInSlotLoaded != 0;
|
||||
if (isDrawing && !string.Equals(_lastGlobalBlockPlayer, characterName, StringComparison.Ordinal)
|
||||
&& !string.Equals(_lastGlobalBlockReason, "HasModelFilesInSlotLoaded", StringComparison.Ordinal))
|
||||
{
|
||||
@@ -993,6 +1006,7 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.Equals(_lastGlobalBlockPlayer, characterName, StringComparison.Ordinal)
|
||||
@@ -1012,6 +1026,11 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
|
||||
|
||||
IsAnythingDrawing |= isDrawing;
|
||||
}
|
||||
catch (AccessViolationException ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "access violation checking character {name} at {addr}", characterName, address.ToString("X"));
|
||||
}
|
||||
}
|
||||
|
||||
private void FrameworkOnUpdate(IFramework framework)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user