fix some shit maybe
This commit is contained in:
@@ -696,12 +696,9 @@ public sealed class IpcManager : DisposableMediatorSubscriberBase
|
||||
|
||||
private void ResourceLoaded(IntPtr ptr, string arg1, string arg2)
|
||||
{
|
||||
Task.Run(() =>
|
||||
if (ptr != IntPtr.Zero && string.Compare(arg1, arg2, ignoreCase: true, System.Globalization.CultureInfo.InvariantCulture) != 0)
|
||||
{
|
||||
if (ptr != IntPtr.Zero && string.Compare(arg1, arg2, ignoreCase: true, System.Globalization.CultureInfo.InvariantCulture) != 0)
|
||||
{
|
||||
Mediator.Publish(new PenumbraResourceLoadMessage(ptr, arg1, arg2));
|
||||
}
|
||||
});
|
||||
Mediator.Publish(new PenumbraResourceLoadMessage(ptr, arg1, arg2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@ public sealed class GameObjectHandler : DisposableMediatorSubscriberBase
|
||||
nint curPtr = IntPtr.Zero;
|
||||
try
|
||||
{
|
||||
curPtr = _getAddress.Invoke();
|
||||
curPtr = CurrentAddress;
|
||||
|
||||
if (curPtr == IntPtr.Zero) return true;
|
||||
|
||||
@@ -136,7 +136,7 @@ public sealed class GameObjectHandler : DisposableMediatorSubscriberBase
|
||||
{
|
||||
if (_haltProcessing) return;
|
||||
|
||||
var curPtr = _getAddress.Invoke();
|
||||
var curPtr = CurrentAddress;
|
||||
bool drawObjDiff = false;
|
||||
try
|
||||
{
|
||||
|
||||
@@ -530,7 +530,7 @@ public sealed class CachedPlayer : DisposableMediatorSubscriberBase
|
||||
missingPluginsForData.Add("Honorific");
|
||||
warning.ShownHonorificWarning = true;
|
||||
}
|
||||
|
||||
|
||||
if (missingPluginsForData.Any())
|
||||
{
|
||||
Mediator.Publish(new NotificationMessage("Missing plugins for " + PlayerName,
|
||||
@@ -570,7 +570,6 @@ public sealed class CachedPlayer : DisposableMediatorSubscriberBase
|
||||
CheckForNameAndThrow(tempHandler, name);
|
||||
Logger.LogDebug("[{applicationId}] Restoring Honorific for {alias}/{name}", applicationId, OnlineUser.User.AliasOrUID, name);
|
||||
await _ipcManager.HonorificClearTitle(address).ConfigureAwait(false);
|
||||
|
||||
}
|
||||
else if (objectKind == ObjectKind.MinionOrMount)
|
||||
{
|
||||
@@ -583,7 +582,7 @@ public sealed class CachedPlayer : DisposableMediatorSubscriberBase
|
||||
}
|
||||
else if (objectKind == ObjectKind.Pet)
|
||||
{
|
||||
var pet = await _dalamudUtil.GetPet(address);
|
||||
var pet = await _dalamudUtil.GetPet(address).ConfigureAwait(false);
|
||||
if (pet != IntPtr.Zero)
|
||||
{
|
||||
using GameObjectHandler tempHandler = _gameObjectHandlerFactory(ObjectKind.Pet, () => pet, false);
|
||||
@@ -592,7 +591,7 @@ public sealed class CachedPlayer : DisposableMediatorSubscriberBase
|
||||
}
|
||||
else if (objectKind == ObjectKind.Companion)
|
||||
{
|
||||
var companion = await _dalamudUtil.GetCompanion(address);
|
||||
var companion = await _dalamudUtil.GetCompanion(address).ConfigureAwait(false);
|
||||
if (companion != IntPtr.Zero)
|
||||
{
|
||||
using GameObjectHandler tempHandler = _gameObjectHandlerFactory(ObjectKind.Pet, () => companion, false);
|
||||
|
||||
@@ -90,14 +90,7 @@ public class DalamudUtilService : IHostedService
|
||||
|
||||
public async Task<IntPtr> GetCompanion(IntPtr? playerPointer = null)
|
||||
{
|
||||
return await RunOnFrameworkThread(() => GetCompanionInternal(playerPointer));
|
||||
}
|
||||
|
||||
private unsafe IntPtr GetCompanionInternal(IntPtr? playerPointer = null)
|
||||
{
|
||||
var mgr = CharacterManager.Instance();
|
||||
playerPointer ??= PlayerPointer;
|
||||
return (IntPtr)mgr->LookupBuddyByOwnerObject((BattleChara*)playerPointer);
|
||||
return await RunOnFrameworkThread(() => GetCompanionInternal(playerPointer)).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public unsafe IntPtr GetMinion(IntPtr? playerPointer = null)
|
||||
@@ -115,16 +108,7 @@ public class DalamudUtilService : IHostedService
|
||||
|
||||
public async Task<IntPtr> GetPet(IntPtr? playerPointer = null)
|
||||
{
|
||||
return await RunOnFrameworkThread(() => GetPetInternal(playerPointer));
|
||||
}
|
||||
|
||||
private unsafe IntPtr GetPetInternal(IntPtr? playerPointer = null)
|
||||
{
|
||||
if (ClassJobIdsIgnoredForPets.Contains(_classJobId ?? 0)) return IntPtr.Zero;
|
||||
var mgr = CharacterManager.Instance();
|
||||
playerPointer ??= PlayerPointer;
|
||||
if (playerPointer == IntPtr.Zero) return IntPtr.Zero;
|
||||
return (IntPtr)mgr->LookupPetByOwnerObject((BattleChara*)playerPointer);
|
||||
return await RunOnFrameworkThread(() => GetPetInternal(playerPointer)).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public PlayerCharacter? GetPlayerCharacterFromObjectTableByName(string characterName)
|
||||
@@ -161,9 +145,10 @@ public class DalamudUtilService : IHostedService
|
||||
public async Task RunOnFrameworkThread(Action act, [CallerMemberName] string callerMember = "",
|
||||
[CallerFilePath] string callerFilePath = "", [CallerLineNumber] int lineNumber = 0)
|
||||
{
|
||||
_logger.LogTrace("Running Action on framework thread (FrameworkContext: {ctx}): {member} in {file}:{line}", _framework.IsInFrameworkUpdateThread, callerMember, callerFilePath, lineNumber);
|
||||
if (!_framework.IsInFrameworkUpdateThread)
|
||||
{
|
||||
_logger.LogTrace("Running Action on framework thread (FrameworkContext: {ctx}): {member} in {file}:{line}", _framework.IsInFrameworkUpdateThread, callerMember, callerFilePath, lineNumber);
|
||||
|
||||
await _framework.RunOnFrameworkThread(act).ContinueWith((_) => Task.CompletedTask).ConfigureAwait(false);
|
||||
while (_framework.IsInFrameworkUpdateThread) // yield the thread again, should technically never be triggered
|
||||
{
|
||||
@@ -178,9 +163,10 @@ public class DalamudUtilService : IHostedService
|
||||
public async Task<T> RunOnFrameworkThread<T>(Func<T> func, [CallerMemberName] string callerMember = "",
|
||||
[CallerFilePath] string callerFilePath = "", [CallerLineNumber] int lineNumber = 0)
|
||||
{
|
||||
_logger.LogTrace("Running Func on framework thread (FrameworkContext: {ctx}): {member} in {file}:{line}", _framework.IsInFrameworkUpdateThread, callerMember, callerFilePath, lineNumber);
|
||||
if (!_framework.IsInFrameworkUpdateThread)
|
||||
{
|
||||
_logger.LogTrace("Running Func on framework thread (FrameworkContext: {ctx}): {member} in {file}:{line}", _framework.IsInFrameworkUpdateThread, callerMember, callerFilePath, lineNumber);
|
||||
|
||||
var result = await _framework.RunOnFrameworkThread(func).ContinueWith((task) => task.Result).ConfigureAwait(false);
|
||||
while (_framework.IsInFrameworkUpdateThread) // yield the thread again, should technically never be triggered
|
||||
{
|
||||
@@ -274,6 +260,7 @@ public class DalamudUtilService : IHostedService
|
||||
|
||||
private unsafe void FrameworkOnUpdateInternal()
|
||||
{
|
||||
if (_clientState.LocalPlayer?.IsDead ?? false) return;
|
||||
if (GposeTarget != null && !IsInGpose)
|
||||
{
|
||||
_logger.LogDebug("Gpose start");
|
||||
@@ -359,4 +346,21 @@ public class DalamudUtilService : IHostedService
|
||||
|
||||
_delayedFrameworkUpdateCheck = DateTime.Now;
|
||||
}
|
||||
|
||||
private unsafe IntPtr GetCompanionInternal(IntPtr? playerPointer = null)
|
||||
{
|
||||
var mgr = CharacterManager.Instance();
|
||||
playerPointer ??= PlayerPointer;
|
||||
if (playerPointer == IntPtr.Zero || (IntPtr)mgr == IntPtr.Zero) return IntPtr.Zero;
|
||||
return (IntPtr)mgr->LookupBuddyByOwnerObject((BattleChara*)playerPointer);
|
||||
}
|
||||
|
||||
private unsafe IntPtr GetPetInternal(IntPtr? playerPointer = null)
|
||||
{
|
||||
if (ClassJobIdsIgnoredForPets.Contains(_classJobId ?? 0)) return IntPtr.Zero;
|
||||
var mgr = CharacterManager.Instance();
|
||||
playerPointer ??= PlayerPointer;
|
||||
if (playerPointer == IntPtr.Zero || (IntPtr)mgr == IntPtr.Zero) return IntPtr.Zero;
|
||||
return (IntPtr)mgr->LookupPetByOwnerObject((BattleChara*)playerPointer);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user