Changes for ApiX

Unfinished
This commit is contained in:
Aspher0 2024-07-09 11:53:45 +02:00
parent 3f99d11179
commit 3316c26b1c
41 changed files with 64 additions and 59 deletions

View file

@ -12,7 +12,7 @@ public sealed class IpcProviders : IDisposable, IApiService
private readonly EventProvider _disposedProvider;
private readonly EventProvider _initializedProvider;
public IpcProviders(DalamudPluginInterface pi, IGlamourerApi api)
public IpcProviders(IDalamudPluginInterface pi, IGlamourerApi api)
{
_disposedProvider = IpcSubscribers.Disposed.Provider(pi);
_initializedProvider = IpcSubscribers.Initialized.Provider(pi);

View file

@ -1,5 +1,5 @@
using Dalamud.Game.ClientState.Objects.Enums;
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using Glamourer.Designs;
using Glamourer.Designs.Special;
using Glamourer.Events;

View file

@ -1,4 +1,4 @@
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using Glamourer.Designs;
using Glamourer.Interop;
using Newtonsoft.Json.Linq;

View file

@ -1,6 +1,6 @@
using Dalamud.Configuration;
using Dalamud.Game.ClientState.Keys;
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using Glamourer.Designs;
using Glamourer.Gui;
using Glamourer.Gui.Tabs.DesignTab;

View file

@ -1,4 +1,4 @@
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using Glamourer.Automation;
using Glamourer.Designs.Links;
using Glamourer.Interop.Material;

View file

@ -1,4 +1,4 @@
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using Glamourer.GameData;
using Glamourer.Interop.Material;
using Glamourer.Services;

View file

@ -1,5 +1,5 @@
using Dalamud.Interface;
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using Dalamud.Interface.Utility.Raii;
using Glamourer.Gui;
using Glamourer.Services;

View file

@ -1,4 +1,4 @@
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using Glamourer.Events;
using Glamourer.Services;
using Newtonsoft.Json;

View file

@ -1,4 +1,4 @@
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using OtterGui;
using OtterGui.Classes;
using OtterGui.Services;
@ -16,12 +16,12 @@ public sealed class DesignLinkLoader(DesignStorage designStorage, MessageService
protected override void HandleChildNotFound(Design parent, LinkData data)
{
Messager.AddMessage(new Notification(
Messager.AddMessage(new OtterGui.Classes.Notification(
$"Could not find the design {data.Identity}. If this design was deleted, please re-save {parent.Identifier}.",
NotificationType.Warning));
}
protected override void HandleChildNotSet(Design parent, Design child, string error)
=> Messager.AddMessage(new Notification($"Could not link {child.Identifier} to {parent.Identifier}: {error}",
=> Messager.AddMessage(new OtterGui.Classes.Notification($"Could not link {child.Identifier} to {parent.Identifier}: {error}",
NotificationType.Warning));
}

View file

@ -1,4 +1,4 @@
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using Glamourer.Gui;
using Glamourer.Services;
using Newtonsoft.Json;

View file

@ -1,4 +1,5 @@
using Dalamud.Interface.Internal;
using Dalamud.Interface.Textures;
using Dalamud.Plugin.Services;
using OtterGui.Classes;
using OtterGui.Services;
@ -32,7 +33,7 @@ public class CustomizeManager : IAsyncDataContainer
}
/// <summary> Get specific icons. </summary>
public IDalamudTextureWrap GetIcon(uint id)
public ISharedImmediateTexture GetIcon(uint id)
=> _icons.LoadIcon(id)!;
/// <summary> Iterate over all supported genders and clans. </summary>

View file

@ -1,4 +1,5 @@
using Dalamud;
using Dalamud.Game;
using Dalamud.Plugin.Services;
using Dalamud.Utility;
using Lumina.Excel;

View file

@ -28,7 +28,7 @@ public class Glamourer : IDalamudPlugin
private readonly ServiceManager _services;
public Glamourer(DalamudPluginInterface pluginInterface)
public Glamourer(IDalamudPluginInterface pluginInterface)
{
try
{
@ -128,7 +128,7 @@ public class Glamourer : IDalamudPlugin
[
"Penumbra", "MareSynchronos", "CustomizePlus", "SimpleHeels", "VfxEditor", "heliosphere-plugin", "Ktisis", "Brio", "DynamicBridge",
];
var plugins = _services.GetService<DalamudPluginInterface>().InstalledPlugins
var plugins = _services.GetService<IDalamudPluginInterface>().InstalledPlugins
.GroupBy(p => p.InternalName)
.ToDictionary(g => g.Key, g =>
{

View file

@ -1,4 +1,5 @@
using Dalamud.Interface.Internal;
using Dalamud.Interface.Textures;
using Dalamud.Interface.Utility;
using Dalamud.Plugin;
using Glamourer.GameData;
@ -13,7 +14,7 @@ using Penumbra.GameData.Structs;
namespace Glamourer.Gui.Customization;
public partial class CustomizationDrawer(
DalamudPluginInterface pi,
IDalamudPluginInterface pi,
CustomizeService _service,
CodeService _codes,
Configuration _config,
@ -22,7 +23,7 @@ public partial class CustomizationDrawer(
: IDisposable
{
private readonly Vector4 _redTint = new(0.6f, 0.3f, 0.3f, 1f);
private readonly IDalamudTextureWrap? _legacyTattoo = GetLegacyTattooIcon(pi);
private readonly ISharedImmediateTexture? _legacyTattoo = GetLegacyTattooIcon(pi);
private Exception? _terminate;
@ -190,7 +191,7 @@ public partial class CustomizationDrawer(
_raceSelectorWidth = _inputIntSize + _comboSelectorSize - _framedIconSize.X;
}
private static IDalamudTextureWrap? GetLegacyTattooIcon(DalamudPluginInterface pi)
private static ISharedImmediateTexture? GetLegacyTattooIcon(IDalamudPluginInterface pi)
{
using var resource = Assembly.GetExecutingAssembly().GetManifestResourceStream("Glamourer.LegacyTattoo.raw");
if (resource == null)

View file

@ -1,4 +1,4 @@
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using Dalamud.Interface.Windowing;
using Dalamud.Plugin;
using Glamourer.Designs;
@ -64,7 +64,7 @@ public class MainWindow : Window, IDisposable
public TabType SelectTab;
public MainWindow(DalamudPluginInterface pi, Configuration config, SettingsTab settings, ActorTab actors, DesignTab designs,
public MainWindow(IDalamudPluginInterface pi, Configuration config, SettingsTab settings, ActorTab actors, DesignTab designs,
DebugTab debugTab, AutomationTab automation, UnlocksTab unlocks, TabSelected @event, MessagesTab messages, DesignQuickBar quickBar,
NpcTab npcs, MainWindowPosition position, PenumbraService penumbra)
: base("GlamourerMainWindow")

View file

@ -1,6 +1,6 @@
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Interface;
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Client.Game;
using Glamourer.Automation;

View file

@ -10,7 +10,7 @@ using OtterGui.Services;
namespace Glamourer.Gui.Tabs.DebugTab.IpcTester;
public class DesignIpcTester(DalamudPluginInterface pluginInterface) : IUiService
public class DesignIpcTester(IDalamudPluginInterface pluginInterface) : IUiService
{
private Dictionary<Guid, string> _designs = [];
private int _gameObjectIndex;

View file

@ -7,7 +7,7 @@ using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab.IpcTester;
public class IpcTesterPanel(
DalamudPluginInterface pluginInterface,
IDalamudPluginInterface pluginInterface,
DesignIpcTester designs,
ItemsIpcTester items,
StateIpcTester state,

View file

@ -11,7 +11,7 @@ using Penumbra.GameData.Structs;
namespace Glamourer.Gui.Tabs.DebugTab.IpcTester;
public class ItemsIpcTester(DalamudPluginInterface pluginInterface) : IUiService
public class ItemsIpcTester(IDalamudPluginInterface pluginInterface) : IUiService
{
private int _gameObjectIndex;
private string _gameObjectName = string.Empty;

View file

@ -18,7 +18,7 @@ namespace Glamourer.Gui.Tabs.DebugTab.IpcTester;
public class StateIpcTester : IUiService, IDisposable
{
private readonly DalamudPluginInterface _pluginInterface;
private readonly IDalamudPluginInterface _pluginInterface;
private int _gameObjectIndex;
private string _gameObjectName = string.Empty;
@ -41,7 +41,7 @@ public class StateIpcTester : IUiService, IDisposable
private int _numUnlocked;
public StateIpcTester(DalamudPluginInterface pluginInterface)
public StateIpcTester(IDalamudPluginInterface pluginInterface)
{
_pluginInterface = pluginInterface;
StateChanged = Api.IpcSubscribers.StateChangedWithType.Subscriber(_pluginInterface, OnStateChanged);

View file

@ -1,5 +1,5 @@
using Dalamud.Interface;
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using Glamourer.Designs;
using Glamourer.Services;
using ImGuiNET;

View file

@ -1,5 +1,5 @@
using Dalamud.Interface;
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using Dalamud.Plugin.Services;
using Glamourer.Designs;
using Glamourer.Events;

View file

@ -1,6 +1,6 @@
using Dalamud.Interface;
using Dalamud.Interface.ImGuiFileDialog;
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using FFXIVClientStructs.FFXIV.Client.System.Framework;
using Glamourer.Automation;
using Glamourer.Designs;

View file

@ -1,4 +1,4 @@
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using Dalamud.Interface.Utility;
using Glamourer.Designs;
using Glamourer.Interop;

View file

@ -1,5 +1,5 @@
using Dalamud.Interface;
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using Dalamud.Interface.Utility;
using Dalamud.Utility;
using Glamourer.Designs;

View file

@ -1,5 +1,5 @@
using Dalamud.Interface;
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using FFXIVClientStructs.FFXIV.Client.Game.Object;
using Glamourer.Designs;
using Glamourer.Gui.Customization;

View file

@ -47,7 +47,7 @@ public class ContextMenuService : IDisposable
};
}
private unsafe void OnMenuOpened(MenuOpenedArgs args)
private unsafe void OnMenuOpened(IMenuOpenedArgs args)
{
if (args.MenuType is ContextMenuType.Inventory)
{
@ -96,7 +96,7 @@ public class ContextMenuService : IDisposable
public void Dispose()
=> Disable();
private void OnClick(MenuItemClickedArgs _)
private void OnClick(IMenuItemClickedArgs _)
{
var (id, playerData) = _objects.PlayerData;
if (!playerData.Valid)

View file

@ -1,5 +1,5 @@
using Dalamud.Interface.DragDrop;
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using Glamourer.Designs;
using Glamourer.Interop.CharaFile;
using Glamourer.Services;

View file

@ -14,7 +14,7 @@ public class ObjectManager(
IFramework framework,
IClientState clientState,
IObjectTable objects,
DalamudPluginInterface pi,
IDalamudPluginInterface pi,
Logger log,
ActorManager actors,
ITargetManager targets)

View file

@ -6,7 +6,7 @@ using OtterGui.Services;
namespace Glamourer.Interop.PalettePlus;
public class PaletteImport(DalamudPluginInterface pluginInterface, DesignManager designManager, DesignFileSystem designFileSystem) : IService
public class PaletteImport(IDalamudPluginInterface pluginInterface, DesignManager designManager, DesignFileSystem designFileSystem) : IService
{
private string ConfigFile
=> Path.Combine(Path.GetDirectoryName(pluginInterface.GetPluginConfigDirectory())!, "PalettePlus.json");

View file

@ -1,4 +1,4 @@
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using Dalamud.Plugin;
using OtterGui.Classes;
using OtterGui.Services;
@ -9,9 +9,9 @@ public sealed class PalettePlusChecker : IRequiredService, IDisposable
{
private readonly Timer _paletteTimer;
private readonly Configuration _config;
private readonly DalamudPluginInterface _pluginInterface;
private readonly IDalamudPluginInterface _pluginInterface;
public PalettePlusChecker(Configuration config, DalamudPluginInterface pluginInterface)
public PalettePlusChecker(Configuration config, IDalamudPluginInterface pluginInterface)
{
_config = config;
_pluginInterface = pluginInterface;
@ -36,7 +36,7 @@ public sealed class PalettePlusChecker : IRequiredService, IDisposable
{
var subscriber = _pluginInterface.GetIpcSubscriber<string>("PalettePlus.ApiVersion");
subscriber.InvokeFunc();
Glamourer.Messager.AddMessage(new Notification(
Glamourer.Messager.AddMessage(new OtterGui.Classes.Notification(
"You currently have Palette+ installed. This conflicts with Glamourers advanced options and will cause invalid state.\n\n"
+ "Please uninstall Palette+ and restart your game. Palette+ is deprecated and no longer supported by Mare Synchronos.",
NotificationType.Warning, 10000));

View file

@ -1,4 +1,4 @@
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using Dalamud.Plugin;
using Glamourer.Events;
using OtterGui.Classes;
@ -36,7 +36,7 @@ public unsafe class PenumbraService : IDisposable
public const int RequiredPenumbraBreakingVersion = 5;
public const int RequiredPenumbraFeatureVersion = 0;
private readonly DalamudPluginInterface _pluginInterface;
private readonly IDalamudPluginInterface _pluginInterface;
private readonly EventSubscriber<ChangedItemType, uint> _tooltipSubscriber;
private readonly EventSubscriber<MouseButton, ChangedItemType, uint> _clickSubscriber;
private readonly EventSubscriber<nint, Guid, nint, nint, nint> _creatingCharacterBase;
@ -68,7 +68,7 @@ public unsafe class PenumbraService : IDisposable
public int CurrentMinor { get; private set; }
public DateTime AttachTime { get; private set; }
public PenumbraService(DalamudPluginInterface pi, PenumbraReloaded penumbraReloaded)
public PenumbraService(IDalamudPluginInterface pi, PenumbraReloaded penumbraReloaded)
{
_pluginInterface = pi;
_penumbraReloaded = penumbraReloaded;

View file

@ -14,7 +14,7 @@ public unsafe class ScalingService : IDisposable
{
interop.InitializeFromAttributes(this);
_setupMountHook =
interop.HookFromAddress<SetupMount>((nint)Character.MountContainer.MemberFunctionPointers.SetupMount, SetupMountDetour);
interop.HookFromAddress<SetupMount>(MountContainer.MemberFunctionPointers.SetupMount, SetupMountDetour);
_setupOrnamentHook = interop.HookFromAddress<SetupOrnament>((nint)Ornament.MemberFunctionPointers.SetupOrnament, SetupOrnamentDetour);
_calculateHeightHook =
interop.HookFromAddress<CalculateHeight>((nint)Character.MemberFunctionPointers.CalculateHeight, CalculateHeightDetour);
@ -33,7 +33,7 @@ public unsafe class ScalingService : IDisposable
_calculateHeightHook.Dispose();
}
private delegate void SetupMount(Character.MountContainer* container, short mountId, uint unk1, uint unk2, uint unk3, byte unk4);
private delegate void SetupMount(MountContainer* container, short mountId, uint unk1, uint unk2, uint unk3, byte unk4);
private delegate void SetupOrnament(Ornament* ornament, uint* unk1, float* unk2);
private delegate void PlaceMinion(Companion* character);
private delegate float CalculateHeight(Character* character);
@ -48,7 +48,7 @@ public unsafe class ScalingService : IDisposable
[Signature("48 89 5C 24 ?? 55 57 41 57 48 8D 6C 24", DetourName = nameof(PlaceMinionDetour))]
private readonly Hook<PlaceMinion> _placeMinionHook = null!;
private void SetupMountDetour(Character.MountContainer* container, short mountId, uint unk1, uint unk2, uint unk3, byte unk4)
private void SetupMountDetour(MountContainer* container, short mountId, uint unk1, uint unk2, uint unk3, byte unk4)
{
var (race, clan, gender) = GetScaleRelevantCustomize(&container->OwnerObject->Character);
SetScaleCustomize(&container->OwnerObject->Character, container->OwnerObject->Character.GameObject.DrawObject);

View file

@ -1,4 +1,4 @@
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using Glamourer.Interop.Penumbra;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

View file

@ -8,7 +8,7 @@ namespace Glamourer.Services;
public class DalamudServices
{
public static void AddServices(ServiceManager services, DalamudPluginInterface pi)
public static void AddServices(ServiceManager services, IDalamudPluginInterface pi)
{
services.AddExistingService(pi);
services.AddExistingService(pi.UiBuilder);

View file

@ -19,7 +19,7 @@ public class FilenameService
public readonly string NpcAppearanceFile;
public readonly string CollectionOverrideFile;
public FilenameService(DalamudPluginInterface pi)
public FilenameService(IDalamudPluginInterface pi)
{
ConfigDirectory = pi.ConfigDirectory.FullName;
ConfigFile = pi.ConfigFile.FullName;

View file

@ -33,7 +33,7 @@ namespace Glamourer.Services;
public static class StaticServiceManager
{
public static ServiceManager CreateProvider(DalamudPluginInterface pi, Logger log, Glamourer glamourer)
public static ServiceManager CreateProvider(IDalamudPluginInterface pi, Logger log, Glamourer glamourer)
{
EventWrapperBase.ChangeLogger(log);
var services = new ServiceManager(log)

View file

@ -1,5 +1,7 @@
using Dalamud.Interface;
using Dalamud.Interface.Internal;
using Dalamud.Interface.Textures;
using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Plugin.Services;
using OtterGui.Classes;
using Penumbra.GameData.Enums;
@ -10,7 +12,7 @@ namespace Glamourer.Services;
public sealed class TextureService(UiBuilder uiBuilder, IDataManager dataManager, ITextureProvider textureProvider)
: TextureCache(dataManager, textureProvider), IDisposable
{
private readonly IDalamudTextureWrap?[] _slotIcons = CreateSlotIcons(uiBuilder);
private readonly ISharedImmediateTexture?[] _slotIcons = CreateSlotIcons(uiBuilder);
public (nint, Vector2, bool) GetIcon(EquipItem item, EquipSlot slot)
{
@ -32,9 +34,9 @@ public sealed class TextureService(UiBuilder uiBuilder, IDataManager dataManager
}
}
private static IDalamudTextureWrap?[] CreateSlotIcons(UiBuilder uiBuilder)
private static ISharedImmediateTexture?[] CreateSlotIcons(UiBuilder uiBuilder)
{
var ret = new IDalamudTextureWrap?[12];
var ret = new ISharedImmediateTexture?[12];
using var uldWrapper = uiBuilder.LoadUld("ui/uld/ArmouryBoard.uld");
@ -63,7 +65,7 @@ public sealed class TextureService(UiBuilder uiBuilder, IDataManager dataManager
{
try
{
ret[slot.ToIndex()] = uldWrapper.LoadTexturePart("ui/uld/ArmouryBoard_hr1.tex", index)!;
ret[slot.ToIndex()] = (ISharedImmediateTexture?)uldWrapper.LoadTexturePart("ui/uld/ArmouryBoard_hr1.tex", index)!;
}
catch (Exception ex)
{

View file

@ -1,5 +1,5 @@
using Dalamud.Game.ClientState.Objects.Enums;
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using Glamourer.Designs;
using Glamourer.Gui;
using Glamourer.Services;
@ -198,7 +198,7 @@ public unsafe class FunModule : IDisposable
private static bool ValidFunTarget(Actor actor)
=> actor.IsCharacter
&& actor.AsObject->ObjectKind is (byte)ObjectKind.Player
&& actor.AsObject->ObjectKind is (FFXIVClientStructs.FFXIV.Client.Game.Object.ObjectKind)(byte)ObjectKind.Player
&& !actor.IsTransformed
&& actor.AsCharacter->CharacterData.ModelCharaId == 0;

View file

@ -1,4 +1,4 @@
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using Glamourer.Services;
using Newtonsoft.Json;
using OtterGui.Classes;

View file

@ -1,4 +1,4 @@
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.ImGuiNotification;
using OtterGui.Classes;
namespace Glamourer.Unlocks;