fix ipc probably
This commit is contained in:
2
MareAPI
2
MareAPI
Submodule MareAPI updated: 73100c5405...b4b8ff4a52
@@ -13,7 +13,7 @@ public class IpcProvider : IHostedService, IMediatorSubscriber
|
||||
{
|
||||
private readonly ILogger<IpcProvider> _logger;
|
||||
private readonly IDalamudPluginInterface _pi;
|
||||
private readonly DalamudUtilService _dalamudUtil;
|
||||
private readonly CharaDataManager _charaDataManager;
|
||||
private ICallGateProvider<string, IGameObject, bool>? _loadFileProvider;
|
||||
private ICallGateProvider<string, IGameObject, Task<bool>>? _loadFileAsyncProvider;
|
||||
private ICallGateProvider<List<nint>>? _handledGameAddresses;
|
||||
@@ -22,16 +22,13 @@ public class IpcProvider : IHostedService, IMediatorSubscriber
|
||||
public MareMediator Mediator { get; init; }
|
||||
|
||||
public IpcProvider(ILogger<IpcProvider> logger, IDalamudPluginInterface pi,
|
||||
DalamudUtilService dalamudUtil,
|
||||
MareMediator mareMediator)
|
||||
CharaDataManager charaDataManager, MareMediator mareMediator)
|
||||
{
|
||||
_logger = logger;
|
||||
_pi = pi;
|
||||
_dalamudUtil = dalamudUtil;
|
||||
_charaDataManager = charaDataManager;
|
||||
Mediator = mareMediator;
|
||||
|
||||
// todo: fix ipc to use CharaDataManager
|
||||
|
||||
Mediator.Subscribe<GameObjectHandlerCreatedMessage>(this, (msg) =>
|
||||
{
|
||||
if (msg.OwnedObject) return;
|
||||
@@ -69,9 +66,6 @@ public class IpcProvider : IHostedService, IMediatorSubscriber
|
||||
|
||||
private async Task<bool> LoadMcdfAsync(string path, IGameObject target)
|
||||
{
|
||||
//if (_mareCharaFileManager.CurrentlyWorking || !_dalamudUtil.IsInGpose)
|
||||
return false;
|
||||
|
||||
await ApplyFileAsync(path, target).ConfigureAwait(false);
|
||||
|
||||
return true;
|
||||
@@ -79,9 +73,6 @@ public class IpcProvider : IHostedService, IMediatorSubscriber
|
||||
|
||||
private bool LoadMcdf(string path, IGameObject target)
|
||||
{
|
||||
//if (_mareCharaFileManager.CurrentlyWorking || !_dalamudUtil.IsInGpose)
|
||||
return false;
|
||||
|
||||
_ = Task.Run(async () => await ApplyFileAsync(path, target).ConfigureAwait(false)).ConfigureAwait(false);
|
||||
|
||||
return true;
|
||||
@@ -89,20 +80,9 @@ public class IpcProvider : IHostedService, IMediatorSubscriber
|
||||
|
||||
private async Task ApplyFileAsync(string path, IGameObject target)
|
||||
{
|
||||
/*
|
||||
try
|
||||
{
|
||||
var expectedLength = _mareCharaFileManager.LoadMareCharaFile(path);
|
||||
await _mareCharaFileManager.ApplyMareCharaFile(target, expectedLength).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.LogError(e, "Failure of IPC call");
|
||||
}
|
||||
finally
|
||||
{
|
||||
_mareCharaFileManager.ClearMareCharaFile();
|
||||
}*/
|
||||
_charaDataManager.LoadMcdf(path);
|
||||
await (_charaDataManager.LoadedMcdfHeader ?? Task.CompletedTask).ConfigureAwait(false);
|
||||
_charaDataManager.McdfApplyToTarget(target.Name.TextValue);
|
||||
}
|
||||
|
||||
private List<nint> GetHandledAddresses()
|
||||
|
||||
@@ -28,6 +28,12 @@
|
||||
<AssemblyVersion></AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="PlayerData\Export\**" />
|
||||
<EmbeddedResource Remove="PlayerData\Export\**" />
|
||||
<None Remove="PlayerData\Export\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DalamudPackager" Version="11.0.0" />
|
||||
<PackageReference Include="Downloader" Version="3.1.2" />
|
||||
@@ -107,8 +113,4 @@
|
||||
<None Include="..\.editorconfig" Link=".editorconfig" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="PlayerData\Export\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -123,7 +123,7 @@ public sealed class Plugin : IDalamudPlugin
|
||||
collection.AddSingleton((s) => new BlockedCharacterHandler(s.GetRequiredService<ILogger<BlockedCharacterHandler>>(), gameInteropProvider));
|
||||
collection.AddSingleton((s) => new IpcProvider(s.GetRequiredService<ILogger<IpcProvider>>(),
|
||||
pluginInterface,
|
||||
s.GetRequiredService<DalamudUtilService>(),
|
||||
s.GetRequiredService<CharaDataManager>(),
|
||||
s.GetRequiredService<MareMediator>()));
|
||||
collection.AddSingleton<SelectPairForTagUi>();
|
||||
collection.AddSingleton((s) => new EventAggregator(pluginInterface.ConfigDirectory.FullName,
|
||||
|
||||
@@ -8,7 +8,7 @@ using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MareSynchronos.Services;
|
||||
|
||||
internal sealed class CharaDataCharacterHandler : DisposableMediatorSubscriberBase
|
||||
public sealed class CharaDataCharacterHandler : DisposableMediatorSubscriberBase
|
||||
{
|
||||
private readonly GameObjectHandlerFactory _gameObjectHandlerFactory;
|
||||
private readonly DalamudUtilService _dalamudUtilService;
|
||||
|
||||
@@ -14,7 +14,7 @@ using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MareSynchronos.Services;
|
||||
|
||||
internal sealed class CharaDataFileHandler : IDisposable
|
||||
public sealed class CharaDataFileHandler : IDisposable
|
||||
{
|
||||
private readonly DalamudUtilService _dalamudUtilService;
|
||||
private readonly FileCacheManager _fileCacheManager;
|
||||
|
||||
@@ -15,7 +15,7 @@ using System.Text;
|
||||
|
||||
namespace MareSynchronos.Services;
|
||||
|
||||
internal sealed partial class CharaDataManager : DisposableMediatorSubscriberBase
|
||||
public sealed partial class CharaDataManager : DisposableMediatorSubscriberBase
|
||||
{
|
||||
private readonly ApiController _apiController;
|
||||
private readonly CharaDataConfigService _configService;
|
||||
@@ -429,12 +429,12 @@ internal sealed partial class CharaDataManager : DisposableMediatorSubscriberBas
|
||||
LoadedMcdfHeader = _fileHandler.LoadCharaFileHeader(filePath);
|
||||
}
|
||||
|
||||
public void McdfApplyToGposeTarget()
|
||||
public void McdfApplyToTarget(string charaName)
|
||||
{
|
||||
if (LoadedMcdfHeader == null || !LoadedMcdfHeader.IsCompletedSuccessfully) return;
|
||||
var charaName = _dalamudUtilService.GposeTargetGameObject?.Name.TextValue ?? string.Empty;
|
||||
|
||||
List<string> actuallyExtractedFiles = [];
|
||||
|
||||
UiBlockingComputation = McdfApplicationTask = Task.Run(async () =>
|
||||
{
|
||||
Guid applicationId = Guid.NewGuid();
|
||||
@@ -480,6 +480,14 @@ internal sealed partial class CharaDataManager : DisposableMediatorSubscriberBas
|
||||
});
|
||||
}
|
||||
|
||||
public void McdfApplyToGposeTarget()
|
||||
{
|
||||
if (CanApplyInGpose(out string target))
|
||||
{
|
||||
McdfApplyToTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveMareCharaFile(string description, string filePath)
|
||||
{
|
||||
UiBlockingComputation = Task.Run(async () => await _fileHandler.SaveCharaFileAsync(description, filePath).ConfigureAwait(false));
|
||||
|
||||
@@ -6,14 +6,13 @@ using MareSynchronos.Services.CharaData.Models;
|
||||
using MareSynchronos.Services.Mediator;
|
||||
using MareSynchronos.Services.ServerConfiguration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using System.Numerics;
|
||||
|
||||
namespace MareSynchronos.Services;
|
||||
|
||||
internal sealed class CharaDataNearbyManager : DisposableMediatorSubscriberBase
|
||||
public sealed class CharaDataNearbyManager : DisposableMediatorSubscriberBase
|
||||
{
|
||||
internal record NearbyCharaDataEntry
|
||||
public record NearbyCharaDataEntry
|
||||
{
|
||||
public float Direction { get; init; }
|
||||
public float Distance { get; init; }
|
||||
|
||||
@@ -4,7 +4,7 @@ using MareSynchronos.Services.CharaData.Models;
|
||||
|
||||
namespace MareSynchronos.Services.CharaData;
|
||||
|
||||
internal sealed class MareCharaFileDataFactory
|
||||
public sealed class MareCharaFileDataFactory
|
||||
{
|
||||
private readonly FileCacheManager _fileCacheManager;
|
||||
|
||||
|
||||
@@ -533,7 +533,7 @@ internal sealed partial class CharaDataHubUi
|
||||
+ "Be mindful that when you share your Character Data with other people there is a chance that, with the help of unsanctioned 3rd party plugins, your appearance could be stolen irreversibly, just like when using MCDF.");
|
||||
|
||||
ImGuiHelpers.ScaledDummy(5);
|
||||
using (ImRaii.Disabled(_charaDataManager.GetAllDataTask != null
|
||||
using (ImRaii.Disabled((!_charaDataManager.GetAllDataTask?.IsCompleted ?? false)
|
||||
|| (_charaDataManager.DataGetTimeoutTask != null && !_charaDataManager.DataGetTimeoutTask.IsCompleted)))
|
||||
{
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.ArrowCircleDown, "Download your Character Data from Server"))
|
||||
|
||||
@@ -1235,7 +1235,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
ImGui.SameLine();
|
||||
using (ImRaii.Disabled(string.IsNullOrEmpty(_uidToAddForIgnore)))
|
||||
{
|
||||
if (_uiShared.IconTextButton(FontAwesomeIcon.Plus, "Add UID to whitelist"))
|
||||
if (_uiShared.IconTextButton(FontAwesomeIcon.Plus, "Add UID/Vanity ID to whitelist"))
|
||||
{
|
||||
if (!_playerPerformanceConfigService.Current.UIDsToIgnore.Contains(_uidToAddForIgnore, StringComparer.Ordinal))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user