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) |     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; |             nint curPtr = IntPtr.Zero; | ||||||
|             try |             try | ||||||
|             { |             { | ||||||
|                 curPtr = _getAddress.Invoke(); |                 curPtr = CurrentAddress; | ||||||
|  |  | ||||||
|                 if (curPtr == IntPtr.Zero) return true; |                 if (curPtr == IntPtr.Zero) return true; | ||||||
|  |  | ||||||
| @@ -136,7 +136,7 @@ public sealed class GameObjectHandler : DisposableMediatorSubscriberBase | |||||||
|     { |     { | ||||||
|         if (_haltProcessing) return; |         if (_haltProcessing) return; | ||||||
|  |  | ||||||
|         var curPtr = _getAddress.Invoke(); |         var curPtr = CurrentAddress; | ||||||
|         bool drawObjDiff = false; |         bool drawObjDiff = false; | ||||||
|         try |         try | ||||||
|         { |         { | ||||||
|   | |||||||
| @@ -570,7 +570,6 @@ public sealed class CachedPlayer : DisposableMediatorSubscriberBase | |||||||
|             CheckForNameAndThrow(tempHandler, name); |             CheckForNameAndThrow(tempHandler, name); | ||||||
|             Logger.LogDebug("[{applicationId}] Restoring Honorific for {alias}/{name}", applicationId, OnlineUser.User.AliasOrUID, name); |             Logger.LogDebug("[{applicationId}] Restoring Honorific for {alias}/{name}", applicationId, OnlineUser.User.AliasOrUID, name); | ||||||
|             await _ipcManager.HonorificClearTitle(address).ConfigureAwait(false); |             await _ipcManager.HonorificClearTitle(address).ConfigureAwait(false); | ||||||
|              |  | ||||||
|         } |         } | ||||||
|         else if (objectKind == ObjectKind.MinionOrMount) |         else if (objectKind == ObjectKind.MinionOrMount) | ||||||
|         { |         { | ||||||
| @@ -583,7 +582,7 @@ public sealed class CachedPlayer : DisposableMediatorSubscriberBase | |||||||
|         } |         } | ||||||
|         else if (objectKind == ObjectKind.Pet) |         else if (objectKind == ObjectKind.Pet) | ||||||
|         { |         { | ||||||
|             var pet = await _dalamudUtil.GetPet(address); |             var pet = await _dalamudUtil.GetPet(address).ConfigureAwait(false); | ||||||
|             if (pet != IntPtr.Zero) |             if (pet != IntPtr.Zero) | ||||||
|             { |             { | ||||||
|                 using GameObjectHandler tempHandler = _gameObjectHandlerFactory(ObjectKind.Pet, () => pet, false); |                 using GameObjectHandler tempHandler = _gameObjectHandlerFactory(ObjectKind.Pet, () => pet, false); | ||||||
| @@ -592,7 +591,7 @@ public sealed class CachedPlayer : DisposableMediatorSubscriberBase | |||||||
|         } |         } | ||||||
|         else if (objectKind == ObjectKind.Companion) |         else if (objectKind == ObjectKind.Companion) | ||||||
|         { |         { | ||||||
|             var companion = await _dalamudUtil.GetCompanion(address); |             var companion = await _dalamudUtil.GetCompanion(address).ConfigureAwait(false); | ||||||
|             if (companion != IntPtr.Zero) |             if (companion != IntPtr.Zero) | ||||||
|             { |             { | ||||||
|                 using GameObjectHandler tempHandler = _gameObjectHandlerFactory(ObjectKind.Pet, () => companion, false); |                 using GameObjectHandler tempHandler = _gameObjectHandlerFactory(ObjectKind.Pet, () => companion, false); | ||||||
|   | |||||||
| @@ -90,14 +90,7 @@ public class DalamudUtilService : IHostedService | |||||||
|  |  | ||||||
|     public async Task<IntPtr> GetCompanion(IntPtr? playerPointer = null) |     public async Task<IntPtr> GetCompanion(IntPtr? playerPointer = null) | ||||||
|     { |     { | ||||||
|         return await RunOnFrameworkThread(() => GetCompanionInternal(playerPointer)); |         return await RunOnFrameworkThread(() => GetCompanionInternal(playerPointer)).ConfigureAwait(false); | ||||||
|     } |  | ||||||
|  |  | ||||||
|     private unsafe IntPtr GetCompanionInternal(IntPtr? playerPointer = null) |  | ||||||
|     { |  | ||||||
|         var mgr = CharacterManager.Instance(); |  | ||||||
|         playerPointer ??= PlayerPointer; |  | ||||||
|         return (IntPtr)mgr->LookupBuddyByOwnerObject((BattleChara*)playerPointer); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public unsafe IntPtr GetMinion(IntPtr? playerPointer = null) |     public unsafe IntPtr GetMinion(IntPtr? playerPointer = null) | ||||||
| @@ -115,16 +108,7 @@ public class DalamudUtilService : IHostedService | |||||||
|  |  | ||||||
|     public async Task<IntPtr> GetPet(IntPtr? playerPointer = null) |     public async Task<IntPtr> GetPet(IntPtr? playerPointer = null) | ||||||
|     { |     { | ||||||
|         return await RunOnFrameworkThread(() => GetPetInternal(playerPointer)); |         return await RunOnFrameworkThread(() => GetPetInternal(playerPointer)).ConfigureAwait(false); | ||||||
|     } |  | ||||||
|  |  | ||||||
|     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); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public PlayerCharacter? GetPlayerCharacterFromObjectTableByName(string characterName) |     public PlayerCharacter? GetPlayerCharacterFromObjectTableByName(string characterName) | ||||||
| @@ -161,9 +145,10 @@ public class DalamudUtilService : IHostedService | |||||||
|     public async Task RunOnFrameworkThread(Action act, [CallerMemberName] string callerMember = "", |     public async Task RunOnFrameworkThread(Action act, [CallerMemberName] string callerMember = "", | ||||||
|         [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int lineNumber = 0) |         [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) |         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); |             await _framework.RunOnFrameworkThread(act).ContinueWith((_) => Task.CompletedTask).ConfigureAwait(false); | ||||||
|             while (_framework.IsInFrameworkUpdateThread) // yield the thread again, should technically never be triggered |             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 = "", |     public async Task<T> RunOnFrameworkThread<T>(Func<T> func, [CallerMemberName] string callerMember = "", | ||||||
|         [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int lineNumber = 0) |         [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) |         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); |             var result = await _framework.RunOnFrameworkThread(func).ContinueWith((task) => task.Result).ConfigureAwait(false); | ||||||
|             while (_framework.IsInFrameworkUpdateThread) // yield the thread again, should technically never be triggered |             while (_framework.IsInFrameworkUpdateThread) // yield the thread again, should technically never be triggered | ||||||
|             { |             { | ||||||
| @@ -274,6 +260,7 @@ public class DalamudUtilService : IHostedService | |||||||
|  |  | ||||||
|     private unsafe void FrameworkOnUpdateInternal() |     private unsafe void FrameworkOnUpdateInternal() | ||||||
|     { |     { | ||||||
|  |         if (_clientState.LocalPlayer?.IsDead ?? false) return; | ||||||
|         if (GposeTarget != null && !IsInGpose) |         if (GposeTarget != null && !IsInGpose) | ||||||
|         { |         { | ||||||
|             _logger.LogDebug("Gpose start"); |             _logger.LogDebug("Gpose start"); | ||||||
| @@ -359,4 +346,21 @@ public class DalamudUtilService : IHostedService | |||||||
|  |  | ||||||
|         _delayedFrameworkUpdateCheck = DateTime.Now; |         _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
	 rootdarkarchon
					rootdarkarchon