Update for API 9

This commit is contained in:
Ottermandias 2023-09-28 18:12:27 +02:00
parent 50f6de7809
commit 21d503a8cd
61 changed files with 210 additions and 192 deletions

@ -1 +1 @@
Subproject commit 9b431c1f491c0739132da65da08bc092d7ff79da Subproject commit c70fcc069ea44e1ffb8b33fc409c4ccfdef5e298

@ -1 +1 @@
Subproject commit d400686c8bfb0b9f72fa0c3301d1fe1df9be525b Subproject commit 3c9e0d03281c350f8260debb0eab4059408cd0cd

View file

@ -1,4 +1,5 @@
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Utility;
using Dalamud.Plugin; using Dalamud.Plugin;
using ImGuiNET; using ImGuiNET;
using OtterGui; using OtterGui;
@ -15,7 +16,6 @@ using Penumbra.Services;
using Penumbra.UI; using Penumbra.UI;
using Penumbra.Collections.Manager; using Penumbra.Collections.Manager;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
namespace Penumbra.Api; namespace Penumbra.Api;

View file

@ -1,4 +1,4 @@
using Dalamud.Game; using Dalamud.Plugin.Services;
using OtterGui.Classes; using OtterGui.Classes;
using Penumbra.Api; using Penumbra.Api;
using Penumbra.Api.Enums; using Penumbra.Api.Enums;
@ -382,7 +382,7 @@ public class CollectionCacheManager : IDisposable
/// <summary> /// <summary>
/// Update forced files only on framework. /// Update forced files only on framework.
/// </summary> /// </summary>
private void OnFramework(Framework _) private void OnFramework(IFramework _)
{ {
while (_changeQueue.TryDequeue(out var changeData)) while (_changeQueue.TryDequeue(out var changeData))
changeData.Apply(); changeData.Apply();

View file

@ -1,6 +1,4 @@
using Dalamud.Game;
using Dalamud.Game.Command; using Dalamud.Game.Command;
using Dalamud.Game.Gui;
using Dalamud.Game.Text.SeStringHandling; using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using ImGuiNET; using ImGuiNET;
@ -23,7 +21,7 @@ public class CommandHandler : IDisposable
private readonly ICommandManager _commandManager; private readonly ICommandManager _commandManager;
private readonly RedrawService _redrawService; private readonly RedrawService _redrawService;
private readonly ChatGui _chat; private readonly IChatGui _chat;
private readonly Configuration _config; private readonly Configuration _config;
private readonly ConfigWindow _configWindow; private readonly ConfigWindow _configWindow;
private readonly ActorManager _actors; private readonly ActorManager _actors;
@ -32,7 +30,7 @@ public class CommandHandler : IDisposable
private readonly Penumbra _penumbra; private readonly Penumbra _penumbra;
private readonly CollectionEditor _collectionEditor; private readonly CollectionEditor _collectionEditor;
public CommandHandler(Framework framework, ICommandManager commandManager, ChatGui chat, RedrawService redrawService, Configuration config, public CommandHandler(IFramework framework, ICommandManager commandManager, IChatGui chat, RedrawService redrawService, Configuration config,
ConfigWindow configWindow, ModManager modManager, CollectionManager collectionManager, ActorService actors, Penumbra penumbra, ConfigWindow configWindow, ModManager modManager, CollectionManager collectionManager, ActorService actors, Penumbra penumbra,
CollectionEditor collectionEditor) CollectionEditor collectionEditor)
{ {

View file

@ -103,7 +103,7 @@ public readonly struct BaseImage : IDisposable
{ {
null => 0, null => 0,
ScratchImage s => s.Meta.MipLevels, ScratchImage s => s.Meta.MipLevels,
TexFile t => t.Header.MipLevels, TexFile t => t.Header.MipLevelsCount,
_ => 1, _ => 1,
}; };
} }

View file

@ -2,7 +2,7 @@ using ImGuiNET;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui; using OtterGui;
using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.PixelFormats;
using Dalamud.Interface; using Dalamud.Interface.Utility;
using Penumbra.UI; using Penumbra.UI;
namespace Penumbra.Import.Textures; namespace Penumbra.Import.Textures;
@ -13,11 +13,11 @@ public partial class CombinedTexture
private Vector4 _constantLeft = Vector4.Zero; private Vector4 _constantLeft = Vector4.Zero;
private Matrix4x4 _multiplierRight = Matrix4x4.Identity; private Matrix4x4 _multiplierRight = Matrix4x4.Identity;
private Vector4 _constantRight = Vector4.Zero; private Vector4 _constantRight = Vector4.Zero;
private int _offsetX = 0; private int _offsetX;
private int _offsetY = 0; private int _offsetY;
private CombineOp _combineOp = CombineOp.Over; private CombineOp _combineOp = CombineOp.Over;
private ResizeOp _resizeOp = ResizeOp.None; private ResizeOp _resizeOp = ResizeOp.None;
private Channels _copyChannels = Channels.Red | Channels.Green | Channels.Blue | Channels.Alpha; private Channels _copyChannels = Channels.Red | Channels.Green | Channels.Blue | Channels.Alpha;
private RgbaPixelData _leftPixels = RgbaPixelData.Empty; private RgbaPixelData _leftPixels = RgbaPixelData.Empty;
private RgbaPixelData _rightPixels = RgbaPixelData.Empty; private RgbaPixelData _rightPixels = RgbaPixelData.Empty;

View file

@ -79,7 +79,7 @@ public static class TexFileParser
w.Write(header.Width); w.Write(header.Width);
w.Write(header.Height); w.Write(header.Height);
w.Write(header.Depth); w.Write(header.Depth);
w.Write((byte)header.MipLevels); w.Write(header.MipLevelsCount);
w.Write((byte)0); // TODO Lumina Update w.Write((byte)0); // TODO Lumina Update
unsafe unsafe
{ {
@ -96,11 +96,11 @@ public static class TexFileParser
var meta = scratch.Meta; var meta = scratch.Meta;
var ret = new TexFile.TexHeader() var ret = new TexFile.TexHeader()
{ {
Height = (ushort)meta.Height, Height = (ushort)meta.Height,
Width = (ushort)meta.Width, Width = (ushort)meta.Width,
Depth = (ushort)Math.Max(meta.Depth, 1), Depth = (ushort)Math.Max(meta.Depth, 1),
MipLevels = (byte)Math.Min(meta.MipLevels, 13), MipLevelsCount = (byte)Math.Min(meta.MipLevels, 13),
Format = meta.Format.ToTexFormat(), Format = meta.Format.ToTexFormat(),
Type = meta.Dimension switch Type = meta.Dimension switch
{ {
_ when meta.IsCubeMap => TexFile.Attribute.TextureTypeCube, _ when meta.IsCubeMap => TexFile.Attribute.TextureTypeCube,
@ -143,7 +143,7 @@ public static class TexFileParser
Height = header.Height, Height = header.Height,
Width = header.Width, Width = header.Width,
Depth = Math.Max(header.Depth, (ushort)1), Depth = Math.Max(header.Depth, (ushort)1),
MipLevels = header.MipLevels, MipLevels = header.MipLevelsCount,
ArraySize = 1, ArraySize = 1,
Format = header.Format.ToDXGI(), Format = header.Format.ToDXGI(),
Dimension = header.Type.ToDimension(), Dimension = header.Type.ToDimension(),

View file

@ -1,4 +1,4 @@
using ImGuiScene; using Dalamud.Interface.Internal;
using OtterTex; using OtterTex;
namespace Penumbra.Import.Textures; namespace Penumbra.Import.Textures;
@ -21,7 +21,7 @@ public sealed class Texture : IDisposable
internal string? TmpPath; internal string? TmpPath;
// If the load failed, an exception is stored. // If the load failed, an exception is stored.
public Exception? LoadError = null; public Exception? LoadError;
// The pixels of the main image in RGBA order. // The pixels of the main image in RGBA order.
// Empty if LoadError != null or Path is empty. // Empty if LoadError != null or Path is empty.
@ -29,7 +29,7 @@ public sealed class Texture : IDisposable
// The ImGui wrapper to load the image. // The ImGui wrapper to load the image.
// null if LoadError != null or Path is empty. // null if LoadError != null or Path is empty.
public TextureWrap? TextureWrap = null; public IDalamudTextureWrap? TextureWrap;
// The base image in whatever format it has. // The base image in whatever format it has.
public BaseImage BaseImage; public BaseImage BaseImage;
@ -76,9 +76,9 @@ public sealed class Texture : IDisposable
try try
{ {
(BaseImage, Type) = textures.Load(path); (BaseImage, Type) = textures.Load(path);
(RgbaPixels, var width, var height) = BaseImage.GetPixelData(); (RgbaPixels, _, _) = BaseImage.GetPixelData();
TextureWrap = textures.LoadTextureWrap(BaseImage, RgbaPixels); TextureWrap = textures.LoadTextureWrap(BaseImage, RgbaPixels);
Loaded?.Invoke(true); Loaded?.Invoke(true);
} }
catch (Exception e) catch (Exception e)

View file

@ -94,7 +94,7 @@ public static class TextureDrawer
ImGuiUtil.DrawTableColumn("Format"); ImGuiUtil.DrawTableColumn("Format");
ImGuiUtil.DrawTableColumn(t.Header.Format.ToString()); ImGuiUtil.DrawTableColumn(t.Header.Format.ToString());
ImGuiUtil.DrawTableColumn("Mip Levels"); ImGuiUtil.DrawTableColumn("Mip Levels");
ImGuiUtil.DrawTableColumn(t.Header.MipLevels.ToString()); ImGuiUtil.DrawTableColumn(t.Header.MipLevelsCount.ToString());
ImGuiUtil.DrawTableColumn("Data Size"); ImGuiUtil.DrawTableColumn("Data Size");
ImGuiUtil.DrawTableColumn($"{Functions.HumanReadableSize(t.ImageData.Length)} ({t.ImageData.Length} Bytes)"); ImGuiUtil.DrawTableColumn($"{Functions.HumanReadableSize(t.ImageData.Length)} ({t.ImageData.Length} Bytes)");
break; break;
@ -106,7 +106,7 @@ public static class TextureDrawer
private int _skipPrefix = 0; private int _skipPrefix = 0;
public PathSelectCombo(TextureManager textures, ModEditor editor) public PathSelectCombo(TextureManager textures, ModEditor editor)
: base(() => CreateFiles(textures, editor)) : base(() => CreateFiles(textures, editor), Penumbra.Log)
{ } { }
protected override string ToString((string, bool) obj) protected override string ToString((string, bool) obj)

View file

@ -1,6 +1,6 @@
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Internal;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using ImGuiScene;
using Lumina.Data.Files; using Lumina.Data.Files;
using OtterGui.Log; using OtterGui.Log;
using OtterGui.Tasks; using OtterGui.Tasks;
@ -19,7 +19,7 @@ public sealed class TextureManager : SingleTaskQueue, IDisposable
private readonly IDataManager _gameData; private readonly IDataManager _gameData;
private readonly ConcurrentDictionary<IAction, (Task, CancellationTokenSource)> _tasks = new(); private readonly ConcurrentDictionary<IAction, (Task, CancellationTokenSource)> _tasks = new();
private bool _disposed = false; private bool _disposed;
public TextureManager(UiBuilder uiBuilder, IDataManager gameData, Logger logger) public TextureManager(UiBuilder uiBuilder, IDataManager gameData, Logger logger)
{ {
@ -209,14 +209,14 @@ public sealed class TextureManager : SingleTaskQueue, IDisposable
} }
/// <summary> Load a texture wrap for a given image. </summary> /// <summary> Load a texture wrap for a given image. </summary>
public TextureWrap LoadTextureWrap(BaseImage image, byte[]? rgba = null, int width = 0, int height = 0) public IDalamudTextureWrap LoadTextureWrap(BaseImage image, byte[]? rgba = null, int width = 0, int height = 0)
{ {
(rgba, width, height) = GetData(image, rgba, width, height); (rgba, width, height) = GetData(image, rgba, width, height);
return LoadTextureWrap(rgba, width, height); return LoadTextureWrap(rgba, width, height);
} }
/// <summary> Load a texture wrap for a given image. </summary> /// <summary> Load a texture wrap for a given image. </summary>
public TextureWrap LoadTextureWrap(byte[] rgba, int width, int height) public IDalamudTextureWrap LoadTextureWrap(byte[] rgba, int width, int height)
=> _uiBuilder.LoadImageRaw(rgba, width, height, 4); => _uiBuilder.LoadImageRaw(rgba, width, height, 4);
/// <summary> Load any supported file from game data or drive depending on extension and if the path is rooted. </summary> /// <summary> Load any supported file from game data or drive depending on extension and if the path is rooted. </summary>
@ -335,7 +335,7 @@ public sealed class TextureManager : SingleTaskQueue, IDisposable
if (numMips == input.Meta.MipLevels) if (numMips == input.Meta.MipLevels)
return input; return input;
var flags = (Dalamud.Utility.Util.IsLinux() ? FilterFlags.ForceNonWIC : 0) | FilterFlags.SeparateAlpha; var flags = (Dalamud.Utility.Util.IsWine() ? FilterFlags.ForceNonWIC : 0) | FilterFlags.SeparateAlpha;
var ec = input.GenerateMipMaps(out var ret, numMips, flags); var ec = input.GenerateMipMaps(out var ret, numMips, flags);
if (ec != ErrorCode.Ok) if (ec != ErrorCode.Ok)
throw new Exception( throw new Exception(

View file

@ -1,7 +1,5 @@
using Dalamud.Game;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel; using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
using FFXIVClientStructs.FFXIV.Client.Graphics.Render;
using Penumbra.GameData.Files; using Penumbra.GameData.Files;
using Penumbra.Interop.SafeHandles; using Penumbra.Interop.SafeHandles;
@ -13,7 +11,7 @@ public sealed unsafe class LiveColorTablePreviewer : LiveMaterialPreviewerBase
public const int TextureHeight = MtrlFile.ColorTable.NumRows; public const int TextureHeight = MtrlFile.ColorTable.NumRows;
public const int TextureLength = TextureWidth * TextureHeight * 4; public const int TextureLength = TextureWidth * TextureHeight * 4;
private readonly Framework _framework; private readonly IFramework _framework;
private readonly Texture** _colorTableTexture; private readonly Texture** _colorTableTexture;
private readonly SafeTextureHandle _originalColorTableTexture; private readonly SafeTextureHandle _originalColorTableTexture;
@ -24,7 +22,7 @@ public sealed unsafe class LiveColorTablePreviewer : LiveMaterialPreviewerBase
public Half[] ColorTable public Half[] ColorTable
=> _colorTable; => _colorTable;
public LiveColorTablePreviewer(IObjectTable objects, Framework framework, MaterialInfo materialInfo) public LiveColorTablePreviewer(IObjectTable objects, IFramework framework, MaterialInfo materialInfo)
: base(objects, materialInfo) : base(objects, materialInfo)
{ {
_framework = framework; _framework = framework;
@ -66,7 +64,7 @@ public sealed unsafe class LiveColorTablePreviewer : LiveMaterialPreviewerBase
_updatePending = true; _updatePending = true;
} }
private void OnFrameworkUpdate(Framework _) private void OnFrameworkUpdate(IFramework _)
{ {
if (!_updatePending) if (!_updatePending)
return; return;

View file

@ -21,13 +21,13 @@ public unsafe class AnimationHookService : IDisposable
private readonly CollectionResolver _collectionResolver; private readonly CollectionResolver _collectionResolver;
private readonly DrawObjectState _drawObjectState; private readonly DrawObjectState _drawObjectState;
private readonly CollectionResolver _resolver; private readonly CollectionResolver _resolver;
private readonly Condition _conditions; private readonly ICondition _conditions;
private readonly ThreadLocal<ResolveData> _animationLoadData = new(() => ResolveData.Invalid, true); private readonly ThreadLocal<ResolveData> _animationLoadData = new(() => ResolveData.Invalid, true);
private readonly ThreadLocal<ResolveData> _characterSoundData = new(() => ResolveData.Invalid, true); private readonly ThreadLocal<ResolveData> _characterSoundData = new(() => ResolveData.Invalid, true);
public AnimationHookService(PerformanceTracker performance, IObjectTable objects, CollectionResolver collectionResolver, public AnimationHookService(PerformanceTracker performance, IObjectTable objects, CollectionResolver collectionResolver,
DrawObjectState drawObjectState, CollectionResolver resolver, Condition conditions) DrawObjectState drawObjectState, CollectionResolver resolver, ICondition conditions, IGameInteropProvider interop)
{ {
_performance = performance; _performance = performance;
_objects = objects; _objects = objects;
@ -36,7 +36,7 @@ public unsafe class AnimationHookService : IDisposable
_resolver = resolver; _resolver = resolver;
_conditions = conditions; _conditions = conditions;
SignatureHelper.Initialise(this); interop.InitializeFromAttributes(this);
_loadCharacterSoundHook.Enable(); _loadCharacterSoundHook.Enable();
_loadTimelineResourcesHook.Enable(); _loadTimelineResourcesHook.Enable();

View file

@ -20,9 +20,9 @@ public class DrawObjectState : IDisposable, IReadOnlyDictionary<nint, (nint, boo
public nint LastGameObject public nint LastGameObject
=> _lastGameObject.IsValueCreated && _lastGameObject.Value!.Count > 0 ? _lastGameObject.Value.Peek() : nint.Zero; => _lastGameObject.IsValueCreated && _lastGameObject.Value!.Count > 0 ? _lastGameObject.Value.Peek() : nint.Zero;
public DrawObjectState(IObjectTable objects, GameEventManager gameEvents) public DrawObjectState(IObjectTable objects, GameEventManager gameEvents, IGameInteropProvider interop)
{ {
SignatureHelper.Initialise(this); interop.InitializeFromAttributes(this);
_enableDrawHook.Enable(); _enableDrawHook.Enable();
_objects = objects; _objects = objects;
_gameEvents = gameEvents; _gameEvents = gameEvents;

View file

@ -85,7 +85,7 @@ public unsafe class IdentifiedCollectionCache : IDisposable, IEnumerable<(nint A
_dirty = _cache.Count > 0; _dirty = _cache.Count > 0;
} }
private void TerritoryClear(object? _1, ushort _2) private void TerritoryClear(ushort _2)
=> _dirty = _cache.Count > 0; => _dirty = _cache.Count > 0;
private void OnCharacterDestruct(Character* character) private void OnCharacterDestruct(Character* character)

View file

@ -1,4 +1,5 @@
using Dalamud.Hooking; using Dalamud.Hooking;
using Dalamud.Plugin.Services;
using Dalamud.Utility.Signatures; using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.Game.Character; using FFXIVClientStructs.FFXIV.Client.Game.Character;
using FFXIVClientStructs.FFXIV.Client.Game.Object; using FFXIVClientStructs.FFXIV.Client.Game.Object;
@ -59,7 +60,7 @@ public unsafe class MetaState : IDisposable
private DisposableContainer _characterBaseCreateMetaChanges = DisposableContainer.Empty; private DisposableContainer _characterBaseCreateMetaChanges = DisposableContainer.Empty;
public MetaState(PerformanceTracker performance, CommunicatorService communicator, CollectionResolver collectionResolver, public MetaState(PerformanceTracker performance, CommunicatorService communicator, CollectionResolver collectionResolver,
ResourceLoader resources, GameEventManager gameEventManager, CharacterUtility characterUtility, Configuration config) ResourceLoader resources, GameEventManager gameEventManager, CharacterUtility characterUtility, Configuration config, IGameInteropProvider interop)
{ {
_performance = performance; _performance = performance;
_communicator = communicator; _communicator = communicator;
@ -68,8 +69,8 @@ public unsafe class MetaState : IDisposable
_gameEventManager = gameEventManager; _gameEventManager = gameEventManager;
_characterUtility = characterUtility; _characterUtility = characterUtility;
_config = config; _config = config;
SignatureHelper.Initialise(this); interop.InitializeFromAttributes(this);
_onModelLoadCompleteHook = Hook<OnModelLoadCompleteDelegate>.FromAddress(_humanVTable[58], OnModelLoadCompleteDetour); _onModelLoadCompleteHook = interop.HookFromAddress<OnModelLoadCompleteDelegate>(_humanVTable[58], OnModelLoadCompleteDetour);
_getEqpIndirectHook.Enable(); _getEqpIndirectHook.Enable();
_updateModelsHook.Enable(); _updateModelsHook.Enable();
_onModelLoadCompleteHook.Enable(); _onModelLoadCompleteHook.Enable();

View file

@ -1,3 +1,4 @@
using Dalamud.Plugin.Services;
using Dalamud.Utility.Signatures; using Dalamud.Utility.Signatures;
using Penumbra.Collections; using Penumbra.Collections;
using Penumbra.GameData; using Penumbra.GameData;
@ -34,16 +35,16 @@ public unsafe class PathState : IDisposable
public IList<ResolveData> CurrentData public IList<ResolveData> CurrentData
=> _resolveData.Values; => _resolveData.Values;
public PathState(CollectionResolver collectionResolver, MetaState metaState, CharacterUtility characterUtility) public PathState(CollectionResolver collectionResolver, MetaState metaState, CharacterUtility characterUtility, IGameInteropProvider interop)
{ {
SignatureHelper.Initialise(this); interop.InitializeFromAttributes(this);
CollectionResolver = collectionResolver; CollectionResolver = collectionResolver;
MetaState = metaState; MetaState = metaState;
CharacterUtility = characterUtility; CharacterUtility = characterUtility;
_human = new ResolvePathHooks(this, _humanVTable, ResolvePathHooks.Type.Human); _human = new ResolvePathHooks(interop, this, _humanVTable, ResolvePathHooks.Type.Human);
_weapon = new ResolvePathHooks(this, _weaponVTable, ResolvePathHooks.Type.Weapon); _weapon = new ResolvePathHooks(interop, this, _weaponVTable, ResolvePathHooks.Type.Weapon);
_demiHuman = new ResolvePathHooks(this, _demiHumanVTable, ResolvePathHooks.Type.Other); _demiHuman = new ResolvePathHooks(interop, this, _demiHumanVTable, ResolvePathHooks.Type.Other);
_monster = new ResolvePathHooks(this, _monsterVTable, ResolvePathHooks.Type.Other); _monster = new ResolvePathHooks(interop, this, _monsterVTable, ResolvePathHooks.Type.Other);
_human.Enable(); _human.Enable();
_weapon.Enable(); _weapon.Enable();
_demiHuman.Enable(); _demiHuman.Enable();

View file

@ -1,4 +1,5 @@
using Dalamud.Hooking; using Dalamud.Hooking;
using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene; using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
using OtterGui.Classes; using OtterGui.Classes;
using Penumbra.Collections; using Penumbra.Collections;
@ -35,21 +36,21 @@ public unsafe class ResolvePathHooks : IDisposable
private readonly PathState _parent; private readonly PathState _parent;
public ResolvePathHooks(PathState parent, nint* vTable, Type type) public ResolvePathHooks(IGameInteropProvider interop, PathState parent, nint* vTable, Type type)
{ {
_parent = parent; _parent = parent;
_resolveDecalPathHook = Create<GeneralResolveDelegate>(vTable[83], type, ResolveDecalWeapon, ResolveDecal); _resolveDecalPathHook = Create<GeneralResolveDelegate>(interop, vTable[83], type, ResolveDecalWeapon, ResolveDecal);
_resolveEidPathHook = Create<EidResolveDelegate>(vTable[85], type, ResolveEidWeapon, ResolveEid); _resolveEidPathHook = Create<EidResolveDelegate>(interop, vTable[85], type, ResolveEidWeapon, ResolveEid);
_resolveImcPathHook = Create<GeneralResolveDelegate>(vTable[81], type, ResolveImcWeapon, ResolveImc); _resolveImcPathHook = Create<GeneralResolveDelegate>(interop, vTable[81], type, ResolveImcWeapon, ResolveImc);
_resolveMPapPathHook = Create<MPapResolveDelegate>(vTable[79], type, ResolveMPapWeapon, ResolveMPap); _resolveMPapPathHook = Create<MPapResolveDelegate>(interop, vTable[79], type, ResolveMPapWeapon, ResolveMPap);
_resolveMdlPathHook = Create<GeneralResolveDelegate>(vTable[73], type, ResolveMdlWeapon, ResolveMdl, ResolveMdlHuman); _resolveMdlPathHook = Create<GeneralResolveDelegate>(interop, vTable[73], type, ResolveMdlWeapon, ResolveMdl, ResolveMdlHuman);
_resolveMtrlPathHook = Create<MaterialResolveDelegate>(vTable[82], type, ResolveMtrlWeapon, ResolveMtrl); _resolveMtrlPathHook = Create<MaterialResolveDelegate>(interop, vTable[82], type, ResolveMtrlWeapon, ResolveMtrl);
_resolvePapPathHook = Create<MaterialResolveDelegate>(vTable[76], type, ResolvePapWeapon, ResolvePap, ResolvePapHuman); _resolvePapPathHook = Create<MaterialResolveDelegate>(interop, vTable[76], type, ResolvePapWeapon, ResolvePap, ResolvePapHuman);
_resolvePhybPathHook = Create<GeneralResolveDelegate>(vTable[75], type, ResolvePhybWeapon, ResolvePhyb, ResolvePhybHuman); _resolvePhybPathHook = Create<GeneralResolveDelegate>(interop, vTable[75], type, ResolvePhybWeapon, ResolvePhyb, ResolvePhybHuman);
_resolveSklbPathHook = Create<GeneralResolveDelegate>(vTable[72], type, ResolveSklbWeapon, ResolveSklb, ResolveSklbHuman); _resolveSklbPathHook = Create<GeneralResolveDelegate>(interop, vTable[72], type, ResolveSklbWeapon, ResolveSklb, ResolveSklbHuman);
_resolveSkpPathHook = Create<GeneralResolveDelegate>(vTable[74], type, ResolveSkpWeapon, ResolveSkp, ResolveSkpHuman); _resolveSkpPathHook = Create<GeneralResolveDelegate>(interop, vTable[74], type, ResolveSkpWeapon, ResolveSkp, ResolveSkpHuman);
_resolveTmbPathHook = Create<EidResolveDelegate>(vTable[77], type, ResolveTmbWeapon, ResolveTmb); _resolveTmbPathHook = Create<EidResolveDelegate>(interop, vTable[77], type, ResolveTmbWeapon, ResolveTmb);
_resolveVfxPathHook = Create<MaterialResolveDelegate>(vTable[84], type, ResolveVfxWeapon, ResolveVfx); _resolveVfxPathHook = Create<MaterialResolveDelegate>(interop, vTable[84], type, ResolveVfxWeapon, ResolveVfx);
} }
public void Enable() public void Enable()
@ -217,7 +218,7 @@ public unsafe class ResolvePathHooks : IDisposable
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
private static Hook<T> Create<T>(nint address, Type type, T weapon, T other, T human) where T : Delegate private static Hook<T> Create<T>(IGameInteropProvider interop, nint address, Type type, T weapon, T other, T human) where T : Delegate
{ {
var del = type switch var del = type switch
{ {
@ -225,12 +226,12 @@ public unsafe class ResolvePathHooks : IDisposable
Type.Weapon => weapon, Type.Weapon => weapon,
_ => other, _ => other,
}; };
return Hook<T>.FromAddress(address, del); return interop.HookFromAddress(address, del);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
private static Hook<T> Create<T>(nint address, Type type, T weapon, T other) where T : Delegate private static Hook<T> Create<T>(IGameInteropProvider interop, nint address, Type type, T weapon, T other) where T : Delegate
=> Create(address, type, weapon, other, other); => Create(interop, address, type, weapon, other, other);
// Implementation // Implementation

View file

@ -1,4 +1,5 @@
using Dalamud.Hooking; using Dalamud.Hooking;
using Dalamud.Plugin.Services;
using Dalamud.Utility.Signatures; using Dalamud.Utility.Signatures;
using Penumbra.Api.Enums; using Penumbra.Api.Enums;
using Penumbra.Collections; using Penumbra.Collections;
@ -30,9 +31,9 @@ public unsafe class SubfileHelper : IDisposable, IReadOnlyCollection<KeyValuePai
private readonly ConcurrentDictionary<nint, ResolveData> _subFileCollection = new(); private readonly ConcurrentDictionary<nint, ResolveData> _subFileCollection = new();
public SubfileHelper(PerformanceTracker performance, ResourceLoader loader, GameEventManager events, CommunicatorService communicator) public SubfileHelper(PerformanceTracker performance, ResourceLoader loader, GameEventManager events, CommunicatorService communicator, IGameInteropProvider interop)
{ {
SignatureHelper.Initialise(this); interop.InitializeFromAttributes(this);
_performance = performance; _performance = performance;
_loader = loader; _loader = loader;

View file

@ -1,4 +1,5 @@
using Dalamud.Hooking; using Dalamud.Hooking;
using Dalamud.Plugin.Services;
using Penumbra.String; using Penumbra.String;
using Penumbra.String.Classes; using Penumbra.String.Classes;
using Penumbra.String.Functions; using Penumbra.String.Functions;
@ -14,9 +15,9 @@ public unsafe class CreateFileWHook : IDisposable
{ {
public const int RequiredSize = 28; public const int RequiredSize = 28;
public CreateFileWHook() public CreateFileWHook(IGameInteropProvider interop)
{ {
_createFileWHook = Hook<CreateFileWDelegate>.FromImport(null, "KERNEL32.dll", "CreateFileW", 0, CreateFileWDetour); _createFileWHook = interop.HookFromImport<CreateFileWDelegate>(null, "KERNEL32.dll", "CreateFileW", 0, CreateFileWDetour);
_createFileWHook.Enable(); _createFileWHook.Enable();
} }

View file

@ -1,4 +1,5 @@
using Dalamud.Hooking; using Dalamud.Hooking;
using Dalamud.Plugin.Services;
using Dalamud.Utility.Signatures; using Dalamud.Utility.Signatures;
using Penumbra.GameData; using Penumbra.GameData;
using Penumbra.Interop.Structs; using Penumbra.Interop.Structs;
@ -8,11 +9,11 @@ namespace Penumbra.Interop.ResourceLoading;
public unsafe class FileReadService : IDisposable public unsafe class FileReadService : IDisposable
{ {
public FileReadService(PerformanceTracker performance, ResourceManagerService resourceManager) public FileReadService(PerformanceTracker performance, ResourceManagerService resourceManager, IGameInteropProvider interop)
{ {
_resourceManager = resourceManager; _resourceManager = resourceManager;
_performance = performance; _performance = performance;
SignatureHelper.Initialise(this); interop.InitializeFromAttributes(this);
_readSqPackHook.Enable(); _readSqPackHook.Enable();
} }

View file

@ -1,3 +1,4 @@
using Dalamud.Plugin.Services;
using Dalamud.Utility.Signatures; using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.System.Resource; using FFXIVClientStructs.FFXIV.Client.System.Resource;
using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle; using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle;
@ -10,8 +11,8 @@ namespace Penumbra.Interop.ResourceLoading;
public unsafe class ResourceManagerService public unsafe class ResourceManagerService
{ {
public ResourceManagerService() public ResourceManagerService(IGameInteropProvider interop)
=> SignatureHelper.Initialise(this); => interop.InitializeFromAttributes(this);
/// <summary> The SE Resource Manager as pointer. </summary> /// <summary> The SE Resource Manager as pointer. </summary>
public ResourceManager* ResourceManager public ResourceManager* ResourceManager

View file

@ -1,8 +1,8 @@
using Dalamud.Hooking; using Dalamud.Hooking;
using Dalamud.Plugin.Services;
using Dalamud.Utility.Signatures; using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.System.Resource; using FFXIVClientStructs.FFXIV.Client.System.Resource;
using Penumbra.Api.Enums; using Penumbra.Api.Enums;
using Penumbra.Collections;
using Penumbra.GameData; using Penumbra.GameData;
using Penumbra.Interop.Structs; using Penumbra.Interop.Structs;
using Penumbra.String; using Penumbra.String;
@ -16,19 +16,19 @@ public unsafe class ResourceService : IDisposable
private readonly PerformanceTracker _performance; private readonly PerformanceTracker _performance;
private readonly ResourceManagerService _resourceManager; private readonly ResourceManagerService _resourceManager;
public ResourceService(PerformanceTracker performance, ResourceManagerService resourceManager) public ResourceService(PerformanceTracker performance, ResourceManagerService resourceManager, IGameInteropProvider interop)
{ {
_performance = performance; _performance = performance;
_resourceManager = resourceManager; _resourceManager = resourceManager;
SignatureHelper.Initialise(this); interop.InitializeFromAttributes(this);
_getResourceSyncHook.Enable(); _getResourceSyncHook.Enable();
_getResourceAsyncHook.Enable(); _getResourceAsyncHook.Enable();
_resourceHandleDestructorHook.Enable(); _resourceHandleDestructorHook.Enable();
_incRefHook = Hook<ResourceHandlePrototype>.FromAddress( _incRefHook = interop.HookFromAddress<ResourceHandlePrototype>(
(nint)FFXIVClientStructs.FFXIV.Client.System.Resource.Handle.ResourceHandle.MemberFunctionPointers.IncRef, (nint)FFXIVClientStructs.FFXIV.Client.System.Resource.Handle.ResourceHandle.MemberFunctionPointers.IncRef,
ResourceHandleIncRefDetour); ResourceHandleIncRefDetour);
_incRefHook.Enable(); _incRefHook.Enable();
_decRefHook = Hook<ResourceHandleDecRefPrototype>.FromAddress( _decRefHook = interop.HookFromAddress<ResourceHandleDecRefPrototype>(
(nint)FFXIVClientStructs.FFXIV.Client.System.Resource.Handle.ResourceHandle.MemberFunctionPointers.DecRef, (nint)FFXIVClientStructs.FFXIV.Client.System.Resource.Handle.ResourceHandle.MemberFunctionPointers.DecRef,
ResourceHandleDecRefDetour); ResourceHandleDecRefDetour);
_decRefHook.Enable(); _decRefHook.Enable();

View file

@ -1,4 +1,5 @@
using Dalamud.Hooking; using Dalamud.Hooking;
using Dalamud.Plugin.Services;
using Dalamud.Utility.Signatures; using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle; using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle;
using Penumbra.Api.Enums; using Penumbra.Api.Enums;
@ -19,9 +20,9 @@ public unsafe class TexMdlService
public IReadOnlySet<ulong> CustomFileCrc public IReadOnlySet<ulong> CustomFileCrc
=> _customFileCrc; => _customFileCrc;
public TexMdlService() public TexMdlService(IGameInteropProvider interop)
{ {
SignatureHelper.Initialise(this); interop.InitializeFromAttributes(this);
_checkFileStateHook.Enable(); _checkFileStateHook.Enable();
_loadTexFileExternHook.Enable(); _loadTexFileExternHook.Enable();
_loadMdlFileExternHook.Enable(); _loadMdlFileExternHook.Enable();

View file

@ -1,4 +1,4 @@
using FFXIVClientStructs.FFXIV.Client.Graphics.Render; using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
using Penumbra.Interop.Structs; using Penumbra.Interop.Structs;
namespace Penumbra.Interop.SafeHandles; namespace Penumbra.Interop.SafeHandles;

View file

@ -1,4 +1,4 @@
using Dalamud.Game; using Dalamud.Plugin.Services;
using Dalamud.Utility.Signatures; using Dalamud.Utility.Signatures;
using Penumbra.Collections.Manager; using Penumbra.Collections.Manager;
using Penumbra.GameData; using Penumbra.GameData;
@ -6,7 +6,7 @@ using Penumbra.Interop.Structs;
namespace Penumbra.Interop.Services; namespace Penumbra.Interop.Services;
public unsafe partial class CharacterUtility : IDisposable public unsafe class CharacterUtility : IDisposable
{ {
public record struct InternalIndex(int Value); public record struct InternalIndex(int Value);
@ -52,12 +52,12 @@ public unsafe partial class CharacterUtility : IDisposable
public (nint Address, int Size) DefaultResource(InternalIndex idx) public (nint Address, int Size) DefaultResource(InternalIndex idx)
=> _lists[idx.Value].DefaultResource; => _lists[idx.Value].DefaultResource;
private readonly Framework _framework; private readonly IFramework _framework;
public readonly ActiveCollectionData Active; public readonly ActiveCollectionData Active;
public CharacterUtility(Framework framework, ActiveCollectionData active) public CharacterUtility(IFramework framework, IGameInteropProvider interop, ActiveCollectionData active)
{ {
SignatureHelper.Initialise(this); interop.InitializeFromAttributes(this);
_lists = Enumerable.Range(0, RelevantIndices.Length) _lists = Enumerable.Range(0, RelevantIndices.Length)
.Select(idx => new MetaList(this, new InternalIndex(idx))) .Select(idx => new MetaList(this, new InternalIndex(idx)))
.ToArray(); .ToArray();

View file

@ -1,3 +1,4 @@
using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Client.System.Framework; using FFXIVClientStructs.FFXIV.Client.System.Framework;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using Penumbra.GameData; using Penumbra.GameData;
@ -24,7 +25,7 @@ public unsafe class FontReloader
private AtkModule* _atkModule = null!; private AtkModule* _atkModule = null!;
private delegate* unmanaged<AtkModule*, bool, bool, void> _reloadFontsFunc = null!; private delegate* unmanaged<AtkModule*, bool, bool, void> _reloadFontsFunc = null!;
public FontReloader(Dalamud.Game.Framework dFramework) public FontReloader(IFramework dFramework)
{ {
dFramework.RunOnFrameworkThread(() => dFramework.RunOnFrameworkThread(() =>
{ {

View file

@ -1,4 +1,5 @@
using Dalamud.Hooking; using Dalamud.Hooking;
using Dalamud.Plugin.Services;
using Dalamud.Utility.Signatures; using Dalamud.Utility.Signatures;
using Penumbra.GameData; using Penumbra.GameData;
using FFXIVClientStructs.FFXIV.Client.Game.Character; using FFXIVClientStructs.FFXIV.Client.Game.Character;
@ -20,9 +21,9 @@ public unsafe class GameEventManager : IDisposable
public event WeaponReloadingEvent? WeaponReloading; public event WeaponReloadingEvent? WeaponReloading;
public event WeaponReloadedEvent? WeaponReloaded; public event WeaponReloadedEvent? WeaponReloaded;
public GameEventManager() public GameEventManager(IGameInteropProvider interop)
{ {
SignatureHelper.Initialise(this); interop.InitializeFromAttributes(this);
_characterDtorHook.Enable(); _characterDtorHook.Enable();
_copyCharacterHook.Enable(); _copyCharacterHook.Enable();
_resourceHandleDestructorHook.Enable(); _resourceHandleDestructorHook.Enable();

View file

@ -100,10 +100,10 @@ public unsafe partial class RedrawService
public sealed unsafe partial class RedrawService : IDisposable public sealed unsafe partial class RedrawService : IDisposable
{ {
private readonly Framework _framework; private readonly IFramework _framework;
private readonly IObjectTable _objects; private readonly IObjectTable _objects;
private readonly ITargetManager _targets; private readonly ITargetManager _targets;
private readonly Condition _conditions; private readonly ICondition _conditions;
private readonly List<int> _queue = new(100); private readonly List<int> _queue = new(100);
private readonly List<int> _afterGPoseQueue = new(GPoseSlots); private readonly List<int> _afterGPoseQueue = new(GPoseSlots);
@ -111,7 +111,7 @@ public sealed unsafe partial class RedrawService : IDisposable
public event GameObjectRedrawnDelegate? GameObjectRedrawn; public event GameObjectRedrawnDelegate? GameObjectRedrawn;
public RedrawService(Framework framework, IObjectTable objects, ITargetManager targets, Condition conditions) public RedrawService(IFramework framework, IObjectTable objects, ITargetManager targets, ICondition conditions)
{ {
_framework = framework; _framework = framework;
_objects = objects; _objects = objects;

View file

@ -1,3 +1,4 @@
using Dalamud.Plugin.Services;
using Dalamud.Utility.Signatures; using Dalamud.Utility.Signatures;
using Penumbra.GameData; using Penumbra.GameData;
@ -21,10 +22,8 @@ public unsafe class ResidentResourceManager
public Structs.ResidentResourceManager* Address public Structs.ResidentResourceManager* Address
=> *_residentResourceManagerAddress; => *_residentResourceManagerAddress;
public ResidentResourceManager() public ResidentResourceManager(IGameInteropProvider interop)
{ => interop.InitializeFromAttributes(this);
SignatureHelper.Initialise(this);
}
// Reload certain player resources by force. // Reload certain player resources by force.
public void Reload() public void Reload()

View file

@ -1,4 +1,5 @@
using Dalamud.Hooking; using Dalamud.Hooking;
using Dalamud.Plugin.Services;
using Dalamud.Utility.Signatures; using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.Graphics.Render; using FFXIVClientStructs.FFXIV.Client.Graphics.Render;
using OtterGui.Classes; using OtterGui.Classes;
@ -48,13 +49,13 @@ public sealed unsafe class SkinFixer : IDisposable
public int ModdedSkinShpkCount public int ModdedSkinShpkCount
=> _moddedSkinShpkCount; => _moddedSkinShpkCount;
public SkinFixer(GameEventManager gameEvents, CharacterUtility utility, CommunicatorService communicator) public SkinFixer(GameEventManager gameEvents, CharacterUtility utility, CommunicatorService communicator, IGameInteropProvider interop)
{ {
SignatureHelper.Initialise(this); interop.InitializeFromAttributes(this);
_gameEvents = gameEvents; _gameEvents = gameEvents;
_utility = utility; _utility = utility;
_communicator = communicator; _communicator = communicator;
_onRenderMaterialHook = Hook<OnRenderMaterialDelegate>.FromAddress(_humanVTable[62], OnRenderHumanMaterial); _onRenderMaterialHook = interop.HookFromAddress<OnRenderMaterialDelegate>(_humanVTable[62], OnRenderHumanMaterial);
_communicator.MtrlShpkLoaded.Subscribe(OnMtrlShpkLoaded, MtrlShpkLoaded.Priority.SkinFixer); _communicator.MtrlShpkLoaded.Subscribe(OnMtrlShpkLoaded, MtrlShpkLoaded.Priority.SkinFixer);
_gameEvents.ResourceHandleDestructor += OnResourceHandleDestructor; _gameEvents.ResourceHandleDestructor += OnResourceHandleDestructor;
_onRenderMaterialHook.Enable(); _onRenderMaterialHook.Enable();

View file

@ -1,4 +1,4 @@
using FFXIVClientStructs.FFXIV.Client.Graphics.Render; using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene; using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
namespace Penumbra.Interop.Structs; namespace Penumbra.Interop.Structs;

View file

@ -1,4 +1,4 @@
using FFXIVClientStructs.FFXIV.Client.Graphics.Render; using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
namespace Penumbra.Interop.Structs; namespace Penumbra.Interop.Structs;

View file

@ -1,37 +1,31 @@
using Dalamud.Plugin.Services;
using Dalamud.Utility.Signatures; using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel; using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
using FFXIVClientStructs.FFXIV.Client.Graphics.Render;
namespace Penumbra.Interop.Structs; namespace Penumbra.Interop.Structs;
public static unsafe class TextureUtility public unsafe class TextureUtility
{ {
private static readonly Functions Funcs = new(); public TextureUtility(IGameInteropProvider interop)
=> interop.InitializeFromAttributes(this);
[Signature("E8 ?? ?? ?? ?? 8B 0F 48 8D 54 24")]
private static nint _textureCreate2D = nint.Zero;
[Signature("E9 ?? ?? ?? ?? 8B 02 25")]
private static nint _textureInitializeContents = nint.Zero;
public static Texture* Create2D(Device* device, int* size, byte mipLevel, uint textureFormat, uint flags, uint unk) public static Texture* Create2D(Device* device, int* size, byte mipLevel, uint textureFormat, uint flags, uint unk)
=> ((delegate* unmanaged<Device*, int*, byte, uint, uint, uint, Texture*>)Funcs.TextureCreate2D)(device, size, mipLevel, textureFormat, => ((delegate* unmanaged<Device*, int*, byte, uint, uint, uint, Texture*>)_textureCreate2D)(device, size, mipLevel, textureFormat,
flags, unk); flags, unk);
public static bool InitializeContents(Texture* texture, void* contents) public static bool InitializeContents(Texture* texture, void* contents)
=> ((delegate* unmanaged<Texture*, void*, bool>)Funcs.TextureInitializeContents)(texture, contents); => ((delegate* unmanaged<Texture*, void*, bool>)_textureInitializeContents)(texture, contents);
public static void IncRef(Texture* texture) public static void IncRef(Texture* texture)
=> ((delegate* unmanaged<Texture*, void>)(*(void***)texture)[2])(texture); => ((delegate* unmanaged<Texture*, void>)(*(void***)texture)[2])(texture);
public static void DecRef(Texture* texture) public static void DecRef(Texture* texture)
=> ((delegate* unmanaged<Texture*, void>)(*(void***)texture)[3])(texture); => ((delegate* unmanaged<Texture*, void>)(*(void***)texture)[3])(texture);
private sealed class Functions
{
[Signature("E8 ?? ?? ?? ?? 8B 0F 48 8D 54 24")]
public nint TextureCreate2D = nint.Zero;
[Signature("E9 ?? ?? ?? ?? 8B 02 25")]
public nint TextureInitializeContents = nint.Zero;
public Functions()
{
SignatureHelper.Initialise(this);
}
}
} }

View file

@ -29,7 +29,7 @@ public unsafe class MetaFileManager
public MetaFileManager(CharacterUtility characterUtility, ResidentResourceManager residentResources, IDataManager gameData, public MetaFileManager(CharacterUtility characterUtility, ResidentResourceManager residentResources, IDataManager gameData,
ActiveCollectionData activeCollections, Configuration config, ValidityChecker validityChecker, IdentifierService identifier, ActiveCollectionData activeCollections, Configuration config, ValidityChecker validityChecker, IdentifierService identifier,
FileCompactor compactor) FileCompactor compactor, IGameInteropProvider interop)
{ {
CharacterUtility = characterUtility; CharacterUtility = characterUtility;
ResidentResources = residentResources; ResidentResources = residentResources;
@ -39,7 +39,7 @@ public unsafe class MetaFileManager
ValidityChecker = validityChecker; ValidityChecker = validityChecker;
Identifier = identifier; Identifier = identifier;
Compactor = compactor; Compactor = compactor;
SignatureHelper.Initialise(this); interop.InitializeFromAttributes(this);
} }
public void WriteAllTexToolsMeta(Mod mod) public void WriteAllTexToolsMeta(Mod mod)

View file

@ -12,7 +12,7 @@ public class ModCombo : FilterComboCache<Mod>
=> obj.Name.Text; => obj.Name.Text;
public ModCombo(Func<IReadOnlyList<Mod>> generator) public ModCombo(Func<IReadOnlyList<Mod>> generator)
: base(generator) : base(generator, Penumbra.Log)
{ } { }
} }

View file

@ -19,7 +19,9 @@ using Penumbra.UI.Tabs;
using ChangedItemClick = Penumbra.Communication.ChangedItemClick; using ChangedItemClick = Penumbra.Communication.ChangedItemClick;
using ChangedItemHover = Penumbra.Communication.ChangedItemHover; using ChangedItemHover = Penumbra.Communication.ChangedItemHover;
using OtterGui.Tasks; using OtterGui.Tasks;
using Penumbra.Interop.Structs;
using Penumbra.UI; using Penumbra.UI;
using ResidentResourceManager = Penumbra.Interop.Services.ResidentResourceManager;
namespace Penumbra; namespace Penumbra;
@ -53,7 +55,7 @@ public class Penumbra : IDalamudPlugin
var startTimer = new StartTracker(); var startTimer = new StartTracker();
using var timer = startTimer.Measure(StartTimeType.Total); using var timer = startTimer.Measure(StartTimeType.Total);
_services = ServiceManager.CreateProvider(this, pluginInterface, Log, startTimer); _services = ServiceManager.CreateProvider(this, pluginInterface, Log, startTimer);
Chat = _services.GetRequiredService<ChatService>(); Chat = _services.GetRequiredService<ChatService>();
_validityChecker = _services.GetRequiredService<ValidityChecker>(); _validityChecker = _services.GetRequiredService<ValidityChecker>();
var startup = _services.GetRequiredService<DalamudServices>().GetDalamudConfig(DalamudServices.WaitingForPluginsOption, out bool s) var startup = _services.GetRequiredService<DalamudServices>().GetDalamudConfig(DalamudServices.WaitingForPluginsOption, out bool s)
? s.ToString() ? s.ToString()
@ -73,11 +75,13 @@ public class Penumbra : IDalamudPlugin
_communicatorService = _services.GetRequiredService<CommunicatorService>(); _communicatorService = _services.GetRequiredService<CommunicatorService>();
_services.GetRequiredService<ResourceService>(); // Initialize because not required anywhere else. _services.GetRequiredService<ResourceService>(); // Initialize because not required anywhere else.
_services.GetRequiredService<ModCacheManager>(); // Initialize because not required anywhere else. _services.GetRequiredService<ModCacheManager>(); // Initialize because not required anywhere else.
_services.GetRequiredService<TextureUtility>(); // Initialize because not required anywhere else.
_collectionManager.Caches.CreateNecessaryCaches(); _collectionManager.Caches.CreateNecessaryCaches();
using (var t = _services.GetRequiredService<StartTracker>().Measure(StartTimeType.PathResolver)) using (var t = _services.GetRequiredService<StartTracker>().Measure(StartTimeType.PathResolver))
{ {
_services.GetRequiredService<PathResolver>(); _services.GetRequiredService<PathResolver>();
} }
_services.GetRequiredService<SkinFixer>(); _services.GetRequiredService<SkinFixer>();
SetupInterface(); SetupInterface();
@ -187,7 +191,7 @@ public class Penumbra : IDalamudPlugin
sb.Append($"> **`Commit Hash: `** {_validityChecker.CommitHash}\n"); sb.Append($"> **`Commit Hash: `** {_validityChecker.CommitHash}\n");
sb.Append($"> **`Enable Mods: `** {_config.EnableMods}\n"); sb.Append($"> **`Enable Mods: `** {_config.EnableMods}\n");
sb.Append($"> **`Enable HTTP API: `** {_config.EnableHttpApi}\n"); sb.Append($"> **`Enable HTTP API: `** {_config.EnableHttpApi}\n");
sb.Append($"> **`Operating System: `** {(Dalamud.Utility.Util.IsLinux() ? "Mac/Linux (Wine)" : "Windows")}\n"); sb.Append($"> **`Operating System: `** {(Dalamud.Utility.Util.IsWine() ? "Mac/Linux (Wine)" : "Windows")}\n");
sb.Append($"> **`Root Directory: `** `{_config.ModDirectory}`, {(exists ? "Exists" : "Not Existing")}\n"); sb.Append($"> **`Root Directory: `** `{_config.ModDirectory}`, {(exists ? "Exists" : "Not Existing")}\n");
sb.Append( sb.Append(
$"> **`Free Drive Space: `** {(drive != null ? Functions.HumanReadableSize(drive.AvailableFreeSpace) : "Unknown")}\n"); $"> **`Free Drive Space: `** {(drive != null ? Functions.HumanReadableSize(drive.AvailableFreeSpace) : "Unknown")}\n");

View file

@ -1,8 +1,8 @@
using Dalamud.Game.Gui;
using Dalamud.Game.Text; using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling; using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads; using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Plugin; using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using Lumina.Excel.GeneratedSheets; using Lumina.Excel.GeneratedSheets;
using OtterGui.Log; using OtterGui.Log;
@ -10,9 +10,9 @@ namespace Penumbra.Services;
public class ChatService : OtterGui.Classes.ChatService public class ChatService : OtterGui.Classes.ChatService
{ {
private readonly ChatGui _chat; private readonly IChatGui _chat;
public ChatService(Logger log, DalamudPluginInterface pi, ChatGui chat) public ChatService(Logger log, DalamudPluginInterface pi, IChatGui chat)
: base(log, pi) : base(log, pi)
=> _chat = chat; => _chat = chat;
@ -37,7 +37,7 @@ public class ChatService : OtterGui.Classes.ChatService
var payload = new SeString(payloadList); var payload = new SeString(payloadList);
_chat.PrintChat(new XivChatEntry _chat.Print(new XivChatEntry
{ {
Message = payload, Message = payload,
}); });

View file

@ -1,8 +1,5 @@
using Dalamud.Game; using Dalamud.Game;
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.ClientState.Keys;
using Dalamud.Game.ClientState.Objects; using Dalamud.Game.ClientState.Objects;
using Dalamud.Game.Gui;
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.IoC; using Dalamud.IoC;
using Dalamud.Plugin; using Dalamud.Plugin;
@ -75,6 +72,8 @@ public class DalamudServices
services.AddSingleton(DragDropManager); services.AddSingleton(DragDropManager);
services.AddSingleton(TextureProvider); services.AddSingleton(TextureProvider);
services.AddSingleton(TextureSubstitutionProvider); services.AddSingleton(TextureSubstitutionProvider);
services.AddSingleton(Interop);
services.AddSingleton(Log);
} }
// TODO remove static // TODO remove static
@ -83,18 +82,20 @@ public class DalamudServices
[PluginService][RequiredVersion("1.0")] public ICommandManager Commands { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public ICommandManager Commands { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public IDataManager GameData { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public IDataManager GameData { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public IClientState ClientState { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public IClientState ClientState { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public ChatGui Chat { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public IChatGui Chat { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public Framework Framework { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public IFramework Framework { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public Condition Conditions { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public ICondition Conditions { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public ITargetManager Targets { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public ITargetManager Targets { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public IObjectTable Objects { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public IObjectTable Objects { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public TitleScreenMenu TitleScreenMenu { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public ITitleScreenMenu TitleScreenMenu { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public IGameGui GameGui { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public IGameGui GameGui { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public KeyState KeyState { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public IKeyState KeyState { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public ISigScanner SigScanner { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public ISigScanner SigScanner { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public IDragDropManager DragDropManager { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public IDragDropManager DragDropManager { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public ITextureProvider TextureProvider { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public ITextureProvider TextureProvider { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public ITextureSubstitutionProvider TextureSubstitutionProvider { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public ITextureSubstitutionProvider TextureSubstitutionProvider { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public IGameInteropProvider Interop { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public IPluginLog Log { get; private set; } = null!;
// @formatter:on // @formatter:on
public UiBuilder UiBuilder public UiBuilder UiBuilder

View file

@ -13,6 +13,7 @@ using Penumbra.Interop.PathResolving;
using Penumbra.Interop.ResourceLoading; using Penumbra.Interop.ResourceLoading;
using Penumbra.Interop.ResourceTree; using Penumbra.Interop.ResourceTree;
using Penumbra.Interop.Services; using Penumbra.Interop.Services;
using Penumbra.Interop.Structs;
using Penumbra.Meta; using Penumbra.Meta;
using Penumbra.Mods; using Penumbra.Mods;
using Penumbra.Mods.Editor; using Penumbra.Mods.Editor;
@ -23,6 +24,7 @@ using Penumbra.UI.Classes;
using Penumbra.UI.ModsTab; using Penumbra.UI.ModsTab;
using Penumbra.UI.ResourceWatcher; using Penumbra.UI.ResourceWatcher;
using Penumbra.UI.Tabs; using Penumbra.UI.Tabs;
using ResidentResourceManager = Penumbra.Interop.Services.ResidentResourceManager;
namespace Penumbra.Services; namespace Penumbra.Services;
@ -88,7 +90,8 @@ public static class ServiceManager
.AddSingleton<CreateFileWHook>() .AddSingleton<CreateFileWHook>()
.AddSingleton<ResidentResourceManager>() .AddSingleton<ResidentResourceManager>()
.AddSingleton<FontReloader>() .AddSingleton<FontReloader>()
.AddSingleton<RedrawService>(); .AddSingleton<RedrawService>()
.AddSingleton<TextureUtility>();
private static IServiceCollection AddConfiguration(this IServiceCollection services) private static IServiceCollection AddConfiguration(this IServiceCollection services)
=> services.AddTransient<ConfigMigrationService>() => services.AddTransient<ConfigMigrationService>()

View file

@ -12,7 +12,7 @@ public class StainService : IDisposable
public sealed class StainTemplateCombo : FilterComboCache<ushort> public sealed class StainTemplateCombo : FilterComboCache<ushort>
{ {
public StainTemplateCombo(IEnumerable<ushort> items) public StainTemplateCombo(IEnumerable<ushort> items)
: base(items) : base(items, Penumbra.Log)
{ } { }
} }
@ -21,12 +21,12 @@ public class StainService : IDisposable
public readonly StmFile StmFile; public readonly StmFile StmFile;
public readonly StainTemplateCombo TemplateCombo; public readonly StainTemplateCombo TemplateCombo;
public StainService(StartTracker timer, DalamudPluginInterface pluginInterface, IDataManager dataManager) public StainService(StartTracker timer, DalamudPluginInterface pluginInterface, IDataManager dataManager, IPluginLog dalamudLog)
{ {
using var t = timer.Measure(StartTimeType.Stains); using var t = timer.Measure(StartTimeType.Stains);
StainData = new StainData(pluginInterface, dataManager, dataManager.Language); StainData = new StainData(pluginInterface, dataManager, dataManager.Language, dalamudLog);
StainCombo = new FilterComboColors(140, StainCombo = new FilterComboColors(140,
StainData.Data.Prepend(new KeyValuePair<byte, (string Name, uint Dye, bool Gloss)>(0, ("None", 0, false)))); StainData.Data.Prepend(new KeyValuePair<byte, (string Name, uint Dye, bool Gloss)>(0, ("None", 0, false))), Penumbra.Log);
StmFile = new StmFile(dataManager); StmFile = new StmFile(dataManager);
TemplateCombo = new StainTemplateCombo(StmFile.Entries.Keys.Prepend((ushort)0)); TemplateCombo = new StainTemplateCombo(StmFile.Entries.Keys.Prepend((ushort)0));
Penumbra.Log.Verbose($"[{nameof(StainService)}] Created."); Penumbra.Log.Verbose($"[{nameof(StainService)}] Created.");

View file

@ -11,24 +11,24 @@ namespace Penumbra.Services;
public sealed class IdentifierService : AsyncServiceWrapper<IObjectIdentifier> public sealed class IdentifierService : AsyncServiceWrapper<IObjectIdentifier>
{ {
public IdentifierService(StartTracker tracker, DalamudPluginInterface pi, IDataManager data, ItemService items) public IdentifierService(StartTracker tracker, DalamudPluginInterface pi, IDataManager data, ItemService items, IPluginLog log)
: base(nameof(IdentifierService), tracker, StartTimeType.Identifier, : base(nameof(IdentifierService), tracker, StartTimeType.Identifier,
() => GameData.GameData.GetIdentifier(pi, data, items.AwaitedService)) () => GameData.GameData.GetIdentifier(pi, data, items.AwaitedService, log))
{ } { }
} }
public sealed class ItemService : AsyncServiceWrapper<ItemData> public sealed class ItemService : AsyncServiceWrapper<ItemData>
{ {
public ItemService(StartTracker tracker, DalamudPluginInterface pi, IDataManager gameData) public ItemService(StartTracker tracker, DalamudPluginInterface pi, IDataManager gameData, IPluginLog log)
: base(nameof(ItemService), tracker, StartTimeType.Items, () => new ItemData(pi, gameData, gameData.Language)) : base(nameof(ItemService), tracker, StartTimeType.Items, () => new ItemData(pi, gameData, gameData.Language, log))
{ } { }
} }
public sealed class ActorService : AsyncServiceWrapper<ActorManager> public sealed class ActorService : AsyncServiceWrapper<ActorManager>
{ {
public ActorService(StartTracker tracker, DalamudPluginInterface pi, IObjectTable objects, IClientState clientState, public ActorService(StartTracker tracker, DalamudPluginInterface pi, IObjectTable objects, IClientState clientState,
Framework framework, IDataManager gameData, IGameGui gui, CutsceneService cutscene) IFramework framework, IDataManager gameData, IGameGui gui, CutsceneService cutscene, IPluginLog log, IGameInteropProvider interop)
: base(nameof(ActorService), tracker, StartTimeType.Actors, : base(nameof(ActorService), tracker, StartTimeType.Actors,
() => new ActorManager(pi, objects, clientState, framework, gameData, gui, idx => (short)cutscene.GetParentIndex(idx))) () => new ActorManager(pi, objects, clientState, framework, interop, gameData, gui, idx => (short)cutscene.GetParentIndex(idx), log))
{ } { }
} }

View file

@ -279,7 +279,7 @@ public class FileEditor<T> : IDisposable where T : class, IWritable
private readonly Configuration _config; private readonly Configuration _config;
public Combo(Configuration config, Func<IReadOnlyList<FileRegistry>> generator) public Combo(Configuration config, Func<IReadOnlyList<FileRegistry>> generator)
: base(generator) : base(generator, Penumbra.Log)
=> _config = config; => _config = config;
protected override bool DrawSelectable(int globalIdx, bool selected) protected override bool DrawSelectable(int globalIdx, bool selected)

View file

@ -129,7 +129,7 @@ public class ItemSwapTab : IDisposable, ITab
private class ItemSelector : FilterComboCache<EquipItem> private class ItemSelector : FilterComboCache<EquipItem>
{ {
public ItemSelector(ItemService data, FullEquipType type) public ItemSelector(ItemService data, FullEquipType type)
: base(() => data.AwaitedService[type]) : base(() => data.AwaitedService[type], Penumbra.Log)
{ } { }
protected override string ToString(EquipItem obj) protected override string ToString(EquipItem obj)
@ -139,7 +139,7 @@ public class ItemSwapTab : IDisposable, ITab
private class WeaponSelector : FilterComboCache<FullEquipType> private class WeaponSelector : FilterComboCache<FullEquipType>
{ {
public WeaponSelector() public WeaponSelector()
: base(FullEquipTypeExtensions.WeaponTypes.Concat(FullEquipTypeExtensions.ToolTypes)) : base(FullEquipTypeExtensions.WeaponTypes.Concat(FullEquipTypeExtensions.ToolTypes), Penumbra.Log)
{ } { }
protected override string ToString(FullEquipType type) protected override string ToString(FullEquipType type)

View file

@ -1,4 +1,5 @@
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Utility;
using ImGuiNET; using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;

View file

@ -1,4 +1,5 @@
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Utility;
using ImGuiNET; using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;

View file

@ -1,6 +1,7 @@
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Components; using Dalamud.Interface.Components;
using Dalamud.Interface.DragDrop; using Dalamud.Interface.DragDrop;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using ImGuiNET; using ImGuiNET;

View file

@ -1,4 +1,4 @@
using Dalamud.Interface; using Dalamud.Interface.Utility;
using ImGuiNET; using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;

View file

@ -1,4 +1,5 @@
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Utility;
using ImGuiNET; using ImGuiNET;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui; using OtterGui;

View file

@ -1,9 +1,9 @@
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Internal;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Dalamud.Utility; using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene; using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
using ImGuiNET; using ImGuiNET;
using ImGuiScene;
using Lumina.Data.Files; using Lumina.Data.Files;
using Lumina.Excel; using Lumina.Excel;
using Lumina.Excel.GeneratedSheets; using Lumina.Excel.GeneratedSheets;
@ -46,11 +46,11 @@ public class ChangedItemDrawer : IDisposable
public const ChangedItemIcon AllFlags = (ChangedItemIcon)0x01FFFF; public const ChangedItemIcon AllFlags = (ChangedItemIcon)0x01FFFF;
public const ChangedItemIcon DefaultFlags = AllFlags & ~ChangedItemIcon.Offhand; public const ChangedItemIcon DefaultFlags = AllFlags & ~ChangedItemIcon.Offhand;
private readonly Configuration _config; private readonly Configuration _config;
private readonly ExcelSheet<Item> _items; private readonly ExcelSheet<Item> _items;
private readonly CommunicatorService _communicator; private readonly CommunicatorService _communicator;
private readonly Dictionary<ChangedItemIcon, TextureWrap> _icons = new(16); private readonly Dictionary<ChangedItemIcon, IDalamudTextureWrap> _icons = new(16);
private float _smallestIconWidth; private float _smallestIconWidth;
public ChangedItemDrawer(UiBuilder uiBuilder, IDataManager gameData, ITextureProvider textureProvider, CommunicatorService communicator, public ChangedItemDrawer(UiBuilder uiBuilder, IDataManager gameData, ITextureProvider textureProvider, CommunicatorService communicator,
Configuration config) Configuration config)
@ -357,7 +357,7 @@ public class ChangedItemDrawer : IDisposable
if (!equipTypeIcons.Valid) if (!equipTypeIcons.Valid)
return false; return false;
void Add(ChangedItemIcon icon, TextureWrap? tex) void Add(ChangedItemIcon icon, IDalamudTextureWrap? tex)
{ {
if (tex != null) if (tex != null)
_icons.Add(icon, tex); _icons.Add(icon, tex);
@ -387,7 +387,7 @@ public class ChangedItemDrawer : IDisposable
return true; return true;
} }
private static unsafe TextureWrap? LoadUnknownTexture(IDataManager gameData, UiBuilder uiBuilder) private static unsafe IDalamudTextureWrap? LoadUnknownTexture(IDataManager gameData, UiBuilder uiBuilder)
{ {
var unk = gameData.GetFile<TexFile>("ui/uld/levelup2_hr1.tex"); var unk = gameData.GetFile<TexFile>("ui/uld/levelup2_hr1.tex");
if (unk == null) if (unk == null)
@ -402,7 +402,7 @@ public class ChangedItemDrawer : IDisposable
return uiBuilder.LoadImageRaw(bytes, unk.Header.Height, unk.Header.Height, 4); return uiBuilder.LoadImageRaw(bytes, unk.Header.Height, unk.Header.Height, 4);
} }
private static unsafe TextureWrap? LoadEmoteTexture(IDataManager gameData, UiBuilder uiBuilder) private static unsafe IDalamudTextureWrap? LoadEmoteTexture(IDataManager gameData, UiBuilder uiBuilder)
{ {
var emote = gameData.GetFile<TexFile>("ui/icon/000000/000019_hr1.tex"); var emote = gameData.GetFile<TexFile>("ui/icon/000000/000019_hr1.tex");
if (emote == null) if (emote == null)

View file

@ -13,7 +13,7 @@ public sealed class CollectionCombo : FilterComboCache<ModCollection>
private readonly ImRaii.Color _color = new(); private readonly ImRaii.Color _color = new();
public CollectionCombo(CollectionManager manager, Func<IReadOnlyList<ModCollection>> items) public CollectionCombo(CollectionManager manager, Func<IReadOnlyList<ModCollection>> items)
: base(items) : base(items, Penumbra.Log)
=> _collectionManager = manager; => _collectionManager = manager;
protected override void DrawFilter(int currentSelected, float width) protected override void DrawFilter(int currentSelected, float width)

View file

@ -2,6 +2,7 @@ using Dalamud.Game.ClientState.Objects;
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Components; using Dalamud.Interface.Components;
using Dalamud.Interface.GameFonts; using Dalamud.Interface.GameFonts;
using Dalamud.Interface.Utility;
using Dalamud.Plugin; using Dalamud.Plugin;
using ImGuiNET; using ImGuiNET;
using OtterGui; using OtterGui;

View file

@ -126,12 +126,12 @@ public class IndividualAssignmentUi : IDisposable
/// <summary> Create combos when ready. </summary> /// <summary> Create combos when ready. </summary>
private void SetupCombos() private void SetupCombos()
{ {
_worldCombo = new WorldCombo(_actorService.AwaitedService.Data.Worlds); _worldCombo = new WorldCombo(_actorService.AwaitedService.Data.Worlds, Penumbra.Log);
_mountCombo = new NpcCombo("##mountCombo", _actorService.AwaitedService.Data.Mounts); _mountCombo = new NpcCombo("##mountCombo", _actorService.AwaitedService.Data.Mounts, Penumbra.Log);
_companionCombo = new NpcCombo("##companionCombo", _actorService.AwaitedService.Data.Companions); _companionCombo = new NpcCombo("##companionCombo", _actorService.AwaitedService.Data.Companions, Penumbra.Log);
_ornamentCombo = new NpcCombo("##ornamentCombo", _actorService.AwaitedService.Data.Ornaments); _ornamentCombo = new NpcCombo("##ornamentCombo", _actorService.AwaitedService.Data.Ornaments, Penumbra.Log);
_bnpcCombo = new NpcCombo("##bnpcCombo", _actorService.AwaitedService.Data.BNpcs); _bnpcCombo = new NpcCombo("##bnpcCombo", _actorService.AwaitedService.Data.BNpcs, Penumbra.Log);
_enpcCombo = new NpcCombo("##enpcCombo", _actorService.AwaitedService.Data.ENpcs); _enpcCombo = new NpcCombo("##enpcCombo", _actorService.AwaitedService.Data.ENpcs, Penumbra.Log);
_ready = true; _ready = true;
_actorService.FinishedCreation -= SetupCombos; _actorService.FinishedCreation -= SetupCombos;
} }

View file

@ -1,6 +1,7 @@
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Internal;
using Dalamud.Plugin; using Dalamud.Plugin;
using ImGuiScene; using Dalamud.Plugin.Services;
namespace Penumbra.UI; namespace Penumbra.UI;
@ -10,18 +11,18 @@ namespace Penumbra.UI;
/// </summary> /// </summary>
public class LaunchButton : IDisposable public class LaunchButton : IDisposable
{ {
private readonly ConfigWindow _configWindow; private readonly ConfigWindow _configWindow;
private readonly UiBuilder _uiBuilder; private readonly UiBuilder _uiBuilder;
private readonly TitleScreenMenu _title; private readonly ITitleScreenMenu _title;
private readonly string _fileName; private readonly string _fileName;
private TextureWrap? _icon; private IDalamudTextureWrap? _icon;
private TitleScreenMenu.TitleScreenMenuEntry? _entry; private TitleScreenMenuEntry? _entry;
/// <summary> /// <summary>
/// Register the launch button to be created on the next draw event. /// Register the launch button to be created on the next draw event.
/// </summary> /// </summary>
public LaunchButton(DalamudPluginInterface pi, TitleScreenMenu title, ConfigWindow ui) public LaunchButton(DalamudPluginInterface pi, ITitleScreenMenu title, ConfigWindow ui)
{ {
_uiBuilder = pi.UiBuilder; _uiBuilder = pi.UiBuilder;
_configWindow = ui; _configWindow = ui;

View file

@ -2,6 +2,7 @@ using Dalamud.Game.ClientState.Keys;
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.DragDrop; using Dalamud.Interface.DragDrop;
using Dalamud.Interface.Internal.Notifications; using Dalamud.Interface.Internal.Notifications;
using Dalamud.Plugin.Services;
using ImGuiNET; using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Classes; using OtterGui.Classes;
@ -35,10 +36,10 @@ public sealed class ModFileSystemSelector : FileSystemSelector<Mod, ModFileSyste
public ModSettings SelectedSettings { get; private set; } = ModSettings.Empty; public ModSettings SelectedSettings { get; private set; } = ModSettings.Empty;
public ModCollection SelectedSettingCollection { get; private set; } = ModCollection.Empty; public ModCollection SelectedSettingCollection { get; private set; } = ModCollection.Empty;
public ModFileSystemSelector(KeyState keyState, CommunicatorService communicator, ModFileSystem fileSystem, ModManager modManager, public ModFileSystemSelector(IKeyState keyState, CommunicatorService communicator, ModFileSystem fileSystem, ModManager modManager,
CollectionManager collectionManager, Configuration config, TutorialService tutorial, FileDialogService fileDialog, ChatService chat, CollectionManager collectionManager, Configuration config, TutorialService tutorial, FileDialogService fileDialog, ChatService chat,
ModImportManager modImportManager, IDragDropManager dragDrop) ModImportManager modImportManager, IDragDropManager dragDrop)
: base(fileSystem, keyState, HandleException, allowMultipleSelection: true) : base(fileSystem, keyState, Penumbra.Log, HandleException, allowMultipleSelection: true)
{ {
_communicator = communicator; _communicator = communicator;
_modManager = modManager; _modManager = modManager;

View file

@ -1,4 +1,4 @@
using Dalamud.Interface; using Dalamud.Interface.Utility;
using ImGuiNET; using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;

View file

@ -1,4 +1,4 @@
using Dalamud.Interface; using Dalamud.Interface.Utility;
using ImGuiNET; using ImGuiNET;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui; using OtterGui;

View file

@ -1,6 +1,7 @@
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Components; using Dalamud.Interface.Components;
using Dalamud.Interface.Internal.Notifications; using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.Utility;
using ImGuiNET; using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;

View file

@ -1,5 +1,6 @@
using Dalamud.Game.ClientState.Objects; using Dalamud.Game.ClientState.Objects;
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Utility;
using Dalamud.Plugin; using Dalamud.Plugin;
using ImGuiNET; using ImGuiNET;
using OtterGui; using OtterGui;

View file

@ -1,4 +1,5 @@
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using Dalamud.Utility; using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Client.Game.Character; using FFXIVClientStructs.FFXIV.Client.Game.Character;
@ -9,7 +10,6 @@ using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using ImGuiNET; using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Classes; using OtterGui.Classes;
using OtterGui.Raii;
using OtterGui.Widgets; using OtterGui.Widgets;
using Penumbra.Api; using Penumbra.Api;
using Penumbra.Collections.Manager; using Penumbra.Collections.Manager;
@ -33,6 +33,7 @@ using ObjectKind = Dalamud.Game.ClientState.Objects.Enums.ObjectKind;
using ResidentResourceManager = Penumbra.Interop.Services.ResidentResourceManager; using ResidentResourceManager = Penumbra.Interop.Services.ResidentResourceManager;
using Penumbra.Interop.Services; using Penumbra.Interop.Services;
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel; using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
using ImGuiClip = OtterGui.ImGuiClip;
namespace Penumbra.UI.Tabs; namespace Penumbra.UI.Tabs;
@ -72,7 +73,7 @@ public class DebugTab : Window, ITab
DrawObjectState drawObjectState, PathState pathState, SubfileHelper subfileHelper, IdentifiedCollectionCache identifiedCollectionCache, DrawObjectState drawObjectState, PathState pathState, SubfileHelper subfileHelper, IdentifiedCollectionCache identifiedCollectionCache,
CutsceneService cutsceneService, ModImportManager modImporter, ImportPopup importPopup, FrameworkManager framework, CutsceneService cutsceneService, ModImportManager modImporter, ImportPopup importPopup, FrameworkManager framework,
TextureManager textureManager, SkinFixer skinFixer, IdentifierService identifier) TextureManager textureManager, SkinFixer skinFixer, IdentifierService identifier)
: base("Penumbra Debug Window", ImGuiWindowFlags.NoCollapse, false) : base("Penumbra Debug Window", ImGuiWindowFlags.NoCollapse)
{ {
IsOpen = true; IsOpen = true;
SizeConstraints = new WindowSizeConstraints SizeConstraints = new WindowSizeConstraints

View file

@ -1,5 +1,5 @@
using Dalamud.Interface;
using Dalamud.Interface.Internal.Notifications; using Dalamud.Interface.Internal.Notifications;
using Dalamud.Interface.Utility;
using ImGuiNET; using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;