mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-13 20:24:18 +01:00
fix crash on gpose exit when using brio
This commit is contained in:
parent
535554e6e5
commit
99f8060798
2 changed files with 30 additions and 6 deletions
|
|
@ -29,6 +29,7 @@ public sealed class IpcManager : DisposableMediatorSubscriberBase
|
||||||
private readonly ICallGateSubscriber<string, GameObject?, uint, object>? _glamourerApplyAll;
|
private readonly ICallGateSubscriber<string, GameObject?, uint, object>? _glamourerApplyAll;
|
||||||
private readonly ICallGateSubscriber<GameObject?, string>? _glamourerGetAllCustomization;
|
private readonly ICallGateSubscriber<GameObject?, string>? _glamourerGetAllCustomization;
|
||||||
private readonly ICallGateSubscriber<Character?, uint, object?> _glamourerRevert;
|
private readonly ICallGateSubscriber<Character?, uint, object?> _glamourerRevert;
|
||||||
|
private readonly ICallGateSubscriber<string, uint, object?> _glamourerRevertByName;
|
||||||
private readonly ICallGateSubscriber<Character?, uint, bool> _glamourerUnlock;
|
private readonly ICallGateSubscriber<Character?, uint, bool> _glamourerUnlock;
|
||||||
private readonly ICallGateSubscriber<(int, int)> _heelsGetApiVersion;
|
private readonly ICallGateSubscriber<(int, int)> _heelsGetApiVersion;
|
||||||
private readonly ICallGateSubscriber<string> _heelsGetOffset;
|
private readonly ICallGateSubscriber<string> _heelsGetOffset;
|
||||||
|
|
@ -109,6 +110,7 @@ public sealed class IpcManager : DisposableMediatorSubscriberBase
|
||||||
_glamourerGetAllCustomization = pi.GetIpcSubscriber<GameObject?, string>("Glamourer.GetAllCustomizationFromCharacter");
|
_glamourerGetAllCustomization = pi.GetIpcSubscriber<GameObject?, string>("Glamourer.GetAllCustomizationFromCharacter");
|
||||||
_glamourerApplyAll = pi.GetIpcSubscriber<string, GameObject?, uint, object>("Glamourer.ApplyAllToCharacterLock");
|
_glamourerApplyAll = pi.GetIpcSubscriber<string, GameObject?, uint, object>("Glamourer.ApplyAllToCharacterLock");
|
||||||
_glamourerRevert = pi.GetIpcSubscriber<Character?, uint, object?>("Glamourer.RevertCharacterLock");
|
_glamourerRevert = pi.GetIpcSubscriber<Character?, uint, object?>("Glamourer.RevertCharacterLock");
|
||||||
|
_glamourerRevertByName = pi.GetIpcSubscriber<string, uint, object?>("Glamourer.RevertLock");
|
||||||
_glamourerUnlock = pi.GetIpcSubscriber<Character?, uint, bool>("Glamourer.Unlock");
|
_glamourerUnlock = pi.GetIpcSubscriber<Character?, uint, bool>("Glamourer.Unlock");
|
||||||
|
|
||||||
_heelsGetApiVersion = pi.GetIpcSubscriber<(int, int)>("SimpleHeels.ApiVersion");
|
_heelsGetApiVersion = pi.GetIpcSubscriber<(int, int)>("SimpleHeels.ApiVersion");
|
||||||
|
|
@ -282,6 +284,19 @@ public sealed class IpcManager : DisposableMediatorSubscriberBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void GlamourerRevertByName(ILogger logger, string name, Guid applicationId)
|
||||||
|
{
|
||||||
|
if ((!CheckGlamourerApi()) || _dalamudUtil.IsZoning) return;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
logger.LogDebug("[{appid}] Calling On IPC: GlamourerRevertByName", applicationId);
|
||||||
|
_glamourerRevertByName.InvokeAction(name, LockCode);
|
||||||
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
Logger.LogWarning(ex, "Error during Glamourer RevertByName");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<string> GlamourerGetCharacterCustomizationAsync(IntPtr character)
|
public async Task<string> GlamourerGetCharacterCustomizationAsync(IntPtr character)
|
||||||
{
|
{
|
||||||
if (!CheckGlamourerApi()) return string.Empty;
|
if (!CheckGlamourerApi()) return string.Empty;
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ public class MareCharaFileManager : DisposableMediatorSubscriberBase
|
||||||
private readonly ILogger<MareCharaFileManager> _logger;
|
private readonly ILogger<MareCharaFileManager> _logger;
|
||||||
private readonly FileCacheManager _manager;
|
private readonly FileCacheManager _manager;
|
||||||
private int _globalFileCounter = 0;
|
private int _globalFileCounter = 0;
|
||||||
private readonly List<GameObjectHandler> _gposeGameObjects;
|
private readonly Dictionary<string, GameObjectHandler> _gposeGameObjects;
|
||||||
private bool _isInGpose = false;
|
private bool _isInGpose = false;
|
||||||
|
|
||||||
public MareCharaFileManager(ILogger<MareCharaFileManager> logger, GameObjectHandlerFactory gameObjectHandlerFactory,
|
public MareCharaFileManager(ILogger<MareCharaFileManager> logger, GameObjectHandlerFactory gameObjectHandlerFactory,
|
||||||
|
|
@ -46,8 +46,17 @@ public class MareCharaFileManager : DisposableMediatorSubscriberBase
|
||||||
CancellationTokenSource cts = new();
|
CancellationTokenSource cts = new();
|
||||||
foreach (var item in _gposeGameObjects)
|
foreach (var item in _gposeGameObjects)
|
||||||
{
|
{
|
||||||
await _ipcManager.GlamourerRevert(logger, item, Guid.NewGuid(), cts.Token);
|
if ((await dalamudUtil.RunOnFrameworkThread(() => item.Value.CurrentAddress())) != nint.Zero)
|
||||||
item.Dispose();
|
{
|
||||||
|
await _ipcManager.GlamourerRevert(logger, item.Value, Guid.NewGuid(), cts.Token);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogDebug("Reverting by name: {name}", item.Key);
|
||||||
|
_ipcManager.GlamourerRevertByName(logger, item.Key, Guid.NewGuid());
|
||||||
|
}
|
||||||
|
|
||||||
|
item.Value.Dispose();
|
||||||
}
|
}
|
||||||
_gposeGameObjects.Clear();
|
_gposeGameObjects.Clear();
|
||||||
});
|
});
|
||||||
|
|
@ -92,8 +101,8 @@ public class MareCharaFileManager : DisposableMediatorSubscriberBase
|
||||||
GameObjectHandler tempHandler = await _gameObjectHandlerFactory.Create(ObjectKind.Player,
|
GameObjectHandler tempHandler = await _gameObjectHandlerFactory.Create(ObjectKind.Player,
|
||||||
() => _dalamudUtil.GetGposeCharacterFromObjectTableByName(charaTarget.Name.ToString(), _isInGpose)?.Address ?? IntPtr.Zero, false).ConfigureAwait(false);
|
() => _dalamudUtil.GetGposeCharacterFromObjectTableByName(charaTarget.Name.ToString(), _isInGpose)?.Address ?? IntPtr.Zero, false).ConfigureAwait(false);
|
||||||
|
|
||||||
if (!_gposeGameObjects.Exists(o => o.Address == tempHandler.Address))
|
if (!_gposeGameObjects.ContainsKey(charaTarget.Name.ToString()))
|
||||||
_gposeGameObjects.Add(tempHandler);
|
_gposeGameObjects[charaTarget.Name.ToString()] = tempHandler;
|
||||||
|
|
||||||
await _ipcManager.GlamourerApplyAllAsync(_logger, tempHandler, LoadedCharaFile.CharaFileData.GlamourerData, applicationId, disposeCts.Token).ConfigureAwait(false);
|
await _ipcManager.GlamourerApplyAllAsync(_logger, tempHandler, LoadedCharaFile.CharaFileData.GlamourerData, applicationId, disposeCts.Token).ConfigureAwait(false);
|
||||||
_dalamudUtil.WaitWhileGposeCharacterIsDrawing(charaTarget.Address, 30000);
|
_dalamudUtil.WaitWhileGposeCharacterIsDrawing(charaTarget.Address, 30000);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue