All checks were successful
Tag and Release Lightless / tag-and-release (push) Successful in 2m9s
# Patchnotes 2.1.0 The changes in this update are more than just "patches". With a new UI, a new feature, and a bunch of bug fixes, improvements and a new member on the dev team, we thought this was more of a minor update. We would like to introduce @tsubasahane of MareCN to the team! We’re happy to work with them to bring Lightless and its features to the CN client as well as having another talented dev bring features and ideas to us. Speaking of which: # Location Sharing (Big shout out to @tsubasahane for bringing this feature) - Are you TIRED of scrambling to find the address of the venue you're in to share with your friends? We are introducing Location Sharing! An optional feature where you can share your location with direct pairs temporarily [30 minutes, 1 hour, 3 hours] minutes or until you turn it off for them. That's up to you! [#125](<#125>) [#49](<Lightless-Sync/LightlessServer#49>) - To share your location with a pair, click the three dots beside the pair and choose a duration to share with them. [#125](<#125>) [#49](<Lightless-Sync/LightlessServer#49>) - To view the location of someone who's shared with you, simply hover over the globe icon! [#125](<#125>) [#49](<Lightless-Sync/LightlessServer#49>) [1] # Model Optimization (Mesh Decimating) - This new option can automatically “simplify” incoming character meshes to help performance by reducing triangle counts. You choose how strong the reduction is (default/recommended is 80%). [#131](<#131>) - Decimation only kicks in when a mesh is above a certain triangle threshold, and only for the items that qualify for it and you selected for. [#131](<#131>) - Hair meshes is always excluded, since simplifying hair meshes is very prone to breaking. - You can find everything under Settings → Performance → Model Optimization. [#131](<#131>) + ** IF YOU HAVE USED DECIMATION IN TESTING, PLEASE CLEAR YOUR CACHE ❗ ** [2] # Animation (PAP) Validation (Safer animations) - Lightless now checks your currently animations to see if they work with your local skeleton/bone mod. If an animation matches, it’s included in what gets sent to other players. If it doesn’t, Lightless will skip it and write a warning to your log showing how many were skipped due to skeleton changes. Its defaulted to Unsafe (off). turn it on if you experience crashes from others users. [#131](<#131>) - Lightless also does the same kind of check for incoming animation files, to make sure they match the body/skeleton they were sent with. [#131](<#131>) - Because these checks can sometimes be a little picky, you can adjust how strict they are in Settings -> General -> Animation & Bones to reduce false positives. [#131](<#131>) # UI Changes (Thanks to @kyuwu for UI Changes) - The top part of the main screen has gotten a makeover. You can adjust the colors of the gradiant in the Color settings of Lightless. [#127](<#127>) [3] - Settings have gotten some changes as well to make this change more universal, and will use the same color settings. [#127](<#127>) - The particle effects of the gradient are toggleable in 'Settings -> UI -> Behavior' [#127](<#127>) - Instead of showing download/upload on bottom of Main UI, it will show VRAM usage and triangles with their optimization options next to it [#138](<#138>) # LightFinder / ShellFinder - UI Changes that follow our new design follow the color codes for the Gradient top as the main screen does. [#127](<#127>) [4] Co-authored-by: defnotken <itsdefnotken@gmail.com> Co-authored-by: azyges <aaaaaa@aaa.aaa> Co-authored-by: cake <admin@cakeandbanana.nl> Co-authored-by: Tsubasa <tsubasa@noreply.git.lightless-sync.org> Co-authored-by: choco <choco@patat.nl> Co-authored-by: celine <aaa@aaa.aaa> Co-authored-by: celine <celine@noreply.git.lightless-sync.org> Co-authored-by: Tsubasahane <wozaiha@gmail.com> Co-authored-by: cake <cake@noreply.git.lightless-sync.org> Reviewed-on: #123
222 lines
8.2 KiB
C#
222 lines
8.2 KiB
C#
using Dalamud.Plugin;
|
|
using LightlessSync.Interop.Ipc.Framework;
|
|
using LightlessSync.Interop.Ipc.Penumbra;
|
|
using LightlessSync.LightlessConfiguration.Models;
|
|
using LightlessSync.PlayerData.Handlers;
|
|
using LightlessSync.Services;
|
|
using LightlessSync.Services.Mediator;
|
|
using Microsoft.Extensions.Logging;
|
|
using Penumbra.Api.Enums;
|
|
using Penumbra.Api.Helpers;
|
|
using Penumbra.Api.IpcSubscribers;
|
|
|
|
namespace LightlessSync.Interop.Ipc;
|
|
|
|
public sealed class IpcCallerPenumbra : IpcServiceBase
|
|
{
|
|
private static readonly IpcServiceDescriptor PenumbraDescriptor = new("Penumbra", "Penumbra", new Version(1, 2, 0, 22));
|
|
|
|
private readonly PenumbraCollections _collections;
|
|
private readonly PenumbraResource _resources;
|
|
private readonly PenumbraRedraw _redraw;
|
|
private readonly PenumbraTexture _textures;
|
|
|
|
private readonly GetEnabledState _penumbraEnabled;
|
|
private readonly GetModDirectory _penumbraGetModDirectory;
|
|
private readonly EventSubscriber _penumbraInit;
|
|
private readonly EventSubscriber _penumbraDispose;
|
|
private readonly EventSubscriber<ModSettingChange, Guid, string, bool> _penumbraModSettingChanged;
|
|
|
|
private bool _shownPenumbraUnavailable;
|
|
private string? _modDirectory;
|
|
|
|
public IpcCallerPenumbra(
|
|
ILogger<IpcCallerPenumbra> logger,
|
|
IDalamudPluginInterface pluginInterface,
|
|
DalamudUtilService dalamudUtil,
|
|
LightlessMediator mediator,
|
|
RedrawManager redrawManager) : base(logger, mediator, pluginInterface, PenumbraDescriptor)
|
|
{
|
|
_penumbraEnabled = new GetEnabledState(pluginInterface);
|
|
_penumbraGetModDirectory = new GetModDirectory(pluginInterface);
|
|
_penumbraInit = Initialized.Subscriber(pluginInterface, HandlePenumbraInitialized);
|
|
_penumbraDispose = Disposed.Subscriber(pluginInterface, HandlePenumbraDisposed);
|
|
_penumbraModSettingChanged = ModSettingChanged.Subscriber(pluginInterface, HandlePenumbraModSettingChanged);
|
|
|
|
_collections = RegisterInterop(new PenumbraCollections(logger, pluginInterface, dalamudUtil, mediator));
|
|
_resources = RegisterInterop(new PenumbraResource(logger, pluginInterface, dalamudUtil, mediator));
|
|
_redraw = RegisterInterop(new PenumbraRedraw(logger, pluginInterface, dalamudUtil, mediator, redrawManager));
|
|
_textures = RegisterInterop(new PenumbraTexture(logger, pluginInterface, dalamudUtil, mediator, _redraw));
|
|
|
|
SubscribeMediatorEvents();
|
|
|
|
CheckAPI();
|
|
CheckModDirectory();
|
|
}
|
|
|
|
public string? ModDirectory
|
|
{
|
|
get => _modDirectory;
|
|
private set
|
|
{
|
|
if (string.Equals(_modDirectory, value, StringComparison.Ordinal))
|
|
{
|
|
return;
|
|
}
|
|
|
|
_modDirectory = value;
|
|
Mediator.Publish(new PenumbraDirectoryChangedMessage(_modDirectory));
|
|
}
|
|
}
|
|
|
|
public Task AssignTemporaryCollectionAsync(ILogger logger, Guid collectionId, int objectIndex)
|
|
=> _collections.AssignTemporaryCollectionAsync(logger, collectionId, objectIndex);
|
|
|
|
public Task<Guid> CreateTemporaryCollectionAsync(ILogger logger, string uid)
|
|
=> _collections.CreateTemporaryCollectionAsync(logger, uid);
|
|
|
|
public Task RemoveTemporaryCollectionAsync(ILogger logger, Guid applicationId, Guid collectionId)
|
|
=> _collections.RemoveTemporaryCollectionAsync(logger, applicationId, collectionId);
|
|
|
|
public Task SetTemporaryModsAsync(ILogger logger, Guid applicationId, Guid collectionId, Dictionary<string, string> modPaths)
|
|
=> _collections.SetTemporaryModsAsync(logger, applicationId, collectionId, modPaths);
|
|
|
|
public Task SetManipulationDataAsync(ILogger logger, Guid applicationId, Guid collectionId, string manipulationData)
|
|
=> _collections.SetManipulationDataAsync(logger, applicationId, collectionId, manipulationData);
|
|
|
|
public Task<Dictionary<string, HashSet<string>>?> GetCharacterData(ILogger logger, GameObjectHandler handler)
|
|
=> _resources.GetCharacterDataAsync(logger, handler);
|
|
|
|
public string GetMetaManipulations()
|
|
=> _resources.GetMetaManipulations();
|
|
|
|
public Task<(string[] forward, string[][] reverse)> ResolvePathsAsync(string[] forward, string[] reverse)
|
|
=> _resources.ResolvePathsAsync(forward, reverse);
|
|
|
|
public string ResolveGameObjectPath(string gamePath, int objectIndex)
|
|
=> _resources.ResolveGameObjectPath(gamePath, objectIndex);
|
|
|
|
public string[] ReverseResolveGameObjectPath(string moddedPath, int objectIndex)
|
|
=> _resources.ReverseResolveGameObjectPath(moddedPath, objectIndex);
|
|
|
|
public Task RedrawAsync(ILogger logger, GameObjectHandler handler, Guid applicationId, CancellationToken token)
|
|
=> _redraw.RedrawAsync(logger, handler, applicationId, token);
|
|
|
|
public void RequestImmediateRedraw(int objectIndex, RedrawType redrawType)
|
|
=> _redraw.RequestImmediateRedraw(objectIndex, redrawType);
|
|
|
|
public Task ConvertTextureFiles(ILogger logger, IReadOnlyList<TextureConversionJob> jobs, IProgress<TextureConversionProgress>? progress, CancellationToken token, bool requestRedraw = true)
|
|
=> _textures.ConvertTextureFilesAsync(logger, jobs, progress, token, requestRedraw);
|
|
|
|
public Task ConvertTextureFileDirectAsync(TextureConversionJob job, CancellationToken token)
|
|
=> _textures.ConvertTextureFileDirectAsync(job, token);
|
|
|
|
public void CheckModDirectory()
|
|
{
|
|
if (!APIAvailable)
|
|
{
|
|
ModDirectory = string.Empty;
|
|
return;
|
|
}
|
|
|
|
try
|
|
{
|
|
ModDirectory = _penumbraGetModDirectory.Invoke().ToLowerInvariant();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Logger.LogWarning(ex, "Failed to resolve Penumbra mod directory");
|
|
}
|
|
}
|
|
|
|
protected override bool IsPluginEnabled(IExposedPlugin plugin)
|
|
{
|
|
try
|
|
{
|
|
return _penumbraEnabled.Invoke();
|
|
}
|
|
catch
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
protected override void OnConnectionStateChanged(IpcConnectionState previous, IpcConnectionState current)
|
|
{
|
|
base.OnConnectionStateChanged(previous, current);
|
|
|
|
if (current == IpcConnectionState.Available)
|
|
{
|
|
_shownPenumbraUnavailable = false;
|
|
if (string.IsNullOrEmpty(ModDirectory))
|
|
{
|
|
CheckModDirectory();
|
|
}
|
|
return;
|
|
}
|
|
|
|
ModDirectory = string.Empty;
|
|
_redraw.CancelPendingRedraws();
|
|
|
|
if (_shownPenumbraUnavailable || current == IpcConnectionState.Unknown)
|
|
{
|
|
return;
|
|
}
|
|
|
|
_shownPenumbraUnavailable = true;
|
|
Mediator.Publish(new NotificationMessage(
|
|
"Penumbra inactive",
|
|
"Your Penumbra installation is not active or out of date. Update Penumbra and/or the Enable Mods setting in Penumbra to continue to use Lightless. If you just updated Penumbra, ignore this message.",
|
|
NotificationType.Error));
|
|
}
|
|
|
|
private void SubscribeMediatorEvents()
|
|
{
|
|
Mediator.Subscribe<PenumbraRedrawCharacterMessage>(this, msg =>
|
|
{
|
|
_redraw.RequestImmediateRedraw(msg.Character.ObjectIndex, RedrawType.AfterGPose);
|
|
});
|
|
|
|
Mediator.Subscribe<DalamudLoginMessage>(this, _ => _shownPenumbraUnavailable = false);
|
|
}
|
|
|
|
private void HandlePenumbraInitialized()
|
|
{
|
|
Mediator.Publish(new PenumbraInitializedMessage());
|
|
CheckModDirectory();
|
|
_redraw.RequestImmediateRedraw(0, RedrawType.Redraw);
|
|
CheckAPI();
|
|
}
|
|
|
|
private void HandlePenumbraDisposed()
|
|
{
|
|
_redraw.CancelPendingRedraws();
|
|
ModDirectory = string.Empty;
|
|
Mediator.Publish(new PenumbraDisposedMessage());
|
|
CheckAPI();
|
|
}
|
|
|
|
private void HandlePenumbraModSettingChanged(ModSettingChange change, Guid _, string __, bool ___)
|
|
{
|
|
if (change == ModSettingChange.EnableState)
|
|
{
|
|
Mediator.Publish(new PenumbraModSettingChangedMessage());
|
|
CheckAPI();
|
|
}
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
base.Dispose(disposing);
|
|
|
|
if (!disposing)
|
|
{
|
|
return;
|
|
}
|
|
|
|
_penumbraModSettingChanged.Dispose();
|
|
_penumbraDispose.Dispose();
|
|
_penumbraInit.Dispose();
|
|
}
|
|
}
|