Fix up Ipc Testers.
Some checks failed
.NET Build / build (push) Has been cancelled

This commit is contained in:
Ottermandias 2025-10-13 17:44:57 +02:00
parent 2d11a0ced8
commit 3f48cd6910
15 changed files with 843 additions and 625 deletions

2
Luna

@ -1 +1 @@
Subproject commit 8fab2f1622f6ccfdab34462bd3ebe7b4947c0589 Subproject commit 2542a4665aca0ee7a66ad940638ff84cd04e35b5

@ -1 +1 @@
Subproject commit 3ea62e440aff15a856d5555bb8a0dd1862c40f59 Subproject commit fcb443b79b0954967a959aa2f498699bd1a54923

View file

@ -1,12 +1,13 @@
using Dalamud.Plugin; using Dalamud.Plugin;
using ImSharp; using ImSharp;
using Luna;
using Penumbra.Api.Enums; using Penumbra.Api.Enums;
using Penumbra.Api.IpcSubscribers; using Penumbra.Api.IpcSubscribers;
using Penumbra.GameData.Data; using Penumbra.GameData.Data;
namespace Penumbra.Api.IpcTester; namespace Penumbra.Api.IpcTester;
public class CollectionsIpcTester(IDalamudPluginInterface pi) : Luna.IUiService public class CollectionsIpcTester(IDalamudPluginInterface pi) : IUiService
{ {
private int _objectIdx; private int _objectIdx;
private Guid? _collectionId; private Guid? _collectionId;
@ -46,14 +47,15 @@ public class CollectionsIpcTester(IDalamudPluginInterface pi) : Luna.IUiService
if (!table) if (!table)
return; return;
table.DrawColumn("Last Return Code"u8); table.DrawColumn("Last Return Code"u8);
table.DrawColumn($"{_returnCode}"); table.DrawColumn($"{_returnCode}");
if (_oldCollection is not null) if (_oldCollection is not null)
Im.Text(!_oldCollection.HasValue ? "Created" : _oldCollection.ToString()!); Im.Text(!_oldCollection.HasValue ? "Created" : _oldCollection.ToString()!);
table.NextRow(); table.NextRow();
table.DrawColumn(GetCollectionsByIdentifier.Label); using (IpcTester.DrawIntro(GetCollectionsByIdentifier.Label, "Collection Identifier"u8))
table.DrawColumn("Collection Identifier"u8); {
var collectionList = new GetCollectionsByIdentifier(pi).Invoke(_collectionId.GetValueOrDefault().ToString()); var collectionList = new GetCollectionsByIdentifier(pi).Invoke(_collectionId.GetValueOrDefault().ToString());
if (collectionList.Count == 0) if (collectionList.Count == 0)
{ {
@ -71,65 +73,74 @@ public class CollectionsIpcTester(IDalamudPluginInterface pi) : Luna.IUiService
DrawCollection(table, pair); DrawCollection(table, pair);
} }
} }
}
table.DrawColumn(GetCollection.Label); using (IpcTester.DrawIntro(GetCollection.Label, "Current Collection"u8))
table.DrawColumn("Current Collection"u8); {
DrawCollection(table, new GetCollection(pi).Invoke(ApiCollectionType.Current)); DrawCollection(table, new GetCollection(pi).Invoke(ApiCollectionType.Current));
}
table.DrawColumn(GetCollection.Label); using (IpcTester.DrawIntro(GetCollection.Label, "Default Collection"u8))
table.DrawColumn("Default Collection"u8); {
DrawCollection(table, new GetCollection(pi).Invoke(ApiCollectionType.Default)); DrawCollection(table, new GetCollection(pi).Invoke(ApiCollectionType.Default));
}
table.DrawColumn(GetCollection.Label); using (IpcTester.DrawIntro(GetCollection.Label, "Interface Collection"u8))
table.DrawColumn("Interface Collection"u8); {
DrawCollection(table, new GetCollection(pi).Invoke(ApiCollectionType.Interface)); DrawCollection(table, new GetCollection(pi).Invoke(ApiCollectionType.Interface));
}
table.DrawColumn(GetCollection.Label); using (IpcTester.DrawIntro(GetCollection.Label, "Special Collection"u8))
table.DrawColumn("Special Collection"u8); {
DrawCollection(table, new GetCollection(pi).Invoke(_type)); DrawCollection(table, new GetCollection(pi).Invoke(_type));
}
table.DrawColumn(GetCollections.Label); using (IpcTester.DrawIntro(GetCollections.Label, "Collections"u8))
table.DrawColumn("Collections"u8); {
DrawCollectionPopup(); DrawCollectionPopup();
table.NextColumn(); table.NextColumn();
if (Im.Button("Get##Collections"u8)) if (Im.SmallButton("Get##Collections"u8))
{ {
_collections = new GetCollections(pi).Invoke(); _collections = new GetCollections(pi).Invoke();
Im.Popup.Open("Collections"u8); Im.Popup.Open("Collections"u8);
} }
}
table.DrawColumn(GetCollectionForObject.Label); using (IpcTester.DrawIntro(GetCollectionForObject.Label, "Get Object Collection"u8))
table.DrawColumn("Get Object Collection"u8); {
var (valid, individual, effectiveCollection) = new GetCollectionForObject(pi).Invoke(_objectIdx); var (valid, individual, effectiveCollection) = new GetCollectionForObject(pi).Invoke(_objectIdx);
DrawCollection(table, effectiveCollection); DrawCollection(table, effectiveCollection);
Im.Line.Same(); Im.Line.Same();
Im.Text($"({(valid ? "Valid" : "Invalid")} Object{(individual ? ", Individual Assignment)" : ")")}"); Im.Text($"({(valid ? "Valid" : "Invalid")} Object{(individual ? ", Individual Assignment)" : ")")}");
}
table.DrawColumn(SetCollection.Label); using (IpcTester.DrawIntro(SetCollection.Label, "Set Special Collection"u8))
table.DrawColumn("Set Special Collection"u8); {
table.NextColumn(); table.NextColumn();
if (Im.Button("Set##SpecialCollection"u8)) if (Im.SmallButton("Set##SpecialCollection"u8))
(_returnCode, _oldCollection) = (_returnCode, _oldCollection) =
new SetCollection(pi).Invoke(_type, _collectionId.GetValueOrDefault(Guid.Empty), _allowCreation, _allowDeletion); new SetCollection(pi).Invoke(_type, _collectionId.GetValueOrDefault(Guid.Empty), _allowCreation, _allowDeletion);
table.NextColumn(); table.NextColumn();
if (Im.Button("Remove##SpecialCollection"u8)) if (Im.SmallButton("Remove##SpecialCollection"u8))
(_returnCode, _oldCollection) = new SetCollection(pi).Invoke(_type, null, _allowCreation, _allowDeletion); (_returnCode, _oldCollection) = new SetCollection(pi).Invoke(_type, null, _allowCreation, _allowDeletion);
}
table.DrawColumn(SetCollectionForObject.Label); using (IpcTester.DrawIntro(SetCollectionForObject.Label, "Set Object Collection"u8))
table.DrawColumn("Set Object Collection"u8); {
table.NextColumn(); table.NextColumn();
if (Im.Button("Set##ObjectCollection"u8)) if (Im.SmallButton("Set##ObjectCollection"u8))
(_returnCode, _oldCollection) = new SetCollectionForObject(pi).Invoke(_objectIdx, _collectionId.GetValueOrDefault(Guid.Empty), (_returnCode, _oldCollection) = new SetCollectionForObject(pi).Invoke(_objectIdx, _collectionId.GetValueOrDefault(Guid.Empty),
_allowCreation, _allowDeletion); _allowCreation, _allowDeletion);
table.NextColumn(); table.NextColumn();
if (Im.Button("Remove##ObjectCollection"u8)) if (Im.SmallButton("Remove##ObjectCollection"u8))
(_returnCode, _oldCollection) = new SetCollectionForObject(pi).Invoke(_objectIdx, null, _allowCreation, _allowDeletion); (_returnCode, _oldCollection) = new SetCollectionForObject(pi).Invoke(_objectIdx, null, _allowCreation, _allowDeletion);
}
table.DrawColumn(GetChangedItemsForCollection.Label); using (IpcTester.DrawIntro(GetChangedItemsForCollection.Label, "Changed Item List"u8))
table.DrawColumn("Changed Item List"u8); {
DrawChangedItemPopup(); DrawChangedItemPopup();
table.NextColumn(); table.NextColumn();
if (Im.Button("Get##ChangedItems"u8)) if (Im.SmallButton("Get##ChangedItems"u8))
{ {
var items = new GetChangedItemsForCollection(pi).Invoke(_collectionId.GetValueOrDefault(Guid.Empty)); var items = new GetChangedItemsForCollection(pi).Invoke(_collectionId.GetValueOrDefault(Guid.Empty));
_changedItems = items.Select(kvp => _changedItems = items.Select(kvp =>
@ -140,6 +151,7 @@ public class CollectionsIpcTester(IDalamudPluginInterface pi) : Luna.IUiService
Im.Popup.Open("Changed Item List"u8); Im.Popup.Open("Changed Item List"u8);
} }
} }
}
private void DrawChangedItemPopup() private void DrawChangedItemPopup()
{ {
@ -199,9 +211,6 @@ public class CollectionsIpcTester(IDalamudPluginInterface pi) : Luna.IUiService
Im.Text(collection.Value.Name); Im.Text(collection.Value.Name);
table.NextColumn(); table.NextColumn();
using (Im.Font.PushMono()) LunaStyle.DrawGuid(collection.Value.Id);
{
ImEx.CopyOnClickSelectable($"{collection.Value.Id}");
}
} }
} }

View file

@ -35,15 +35,20 @@ public class EditingIpcTester(IDalamudPluginInterface pi) : Luna.IUiService
if (!table) if (!table)
return; return;
IpcTester.DrawIntro(ConvertTextureFile.Label, "Convert Texture 1"u8); using (IpcTester.DrawIntro(ConvertTextureFile.Label, "Convert Texture 1"u8))
{
table.NextColumn();
if (ImEx.Button("Save 1"u8, Vector2.Zero, StringU8.Empty, _task1 is { IsCompleted: false })) if (ImEx.Button("Save 1"u8, Vector2.Zero, StringU8.Empty, _task1 is { IsCompleted: false }))
_task1 = new ConvertTextureFile(pi).Invoke(_inputPath, _outputPath, _typeSelector, _mipMaps); _task1 = new ConvertTextureFile(pi).Invoke(_inputPath, _outputPath, _typeSelector, _mipMaps);
Im.Line.Same(); Im.Line.Same();
Im.Text(_task1 is null ? "Not Initiated"u8 : $"{_task1.Status}"); Im.Text(_task1 is null ? "Not Initiated"u8 : $"{_task1.Status}");
if (Im.Item.Hovered() && _task1?.Status is TaskStatus.Faulted) if (Im.Item.Hovered() && _task1?.Status is TaskStatus.Faulted)
Im.Tooltip.Set($"{_task1.Exception}"); Im.Tooltip.Set($"{_task1.Exception}");
}
IpcTester.DrawIntro(ConvertTextureFile.Label, "Convert Texture 2"u8); using (IpcTester.DrawIntro(ConvertTextureFile.Label, "Convert Texture 2"u8))
{
table.NextColumn();
if (ImEx.Button("Save 2"u8, Vector2.Zero, StringU8.Empty, _task2 is { IsCompleted: false })) if (ImEx.Button("Save 2"u8, Vector2.Zero, StringU8.Empty, _task2 is { IsCompleted: false }))
_task2 = new ConvertTextureFile(pi).Invoke(_inputPath2, _outputPath2, _typeSelector, _mipMaps); _task2 = new ConvertTextureFile(pi).Invoke(_inputPath2, _outputPath2, _typeSelector, _mipMaps);
Im.Line.Same(); Im.Line.Same();
@ -51,4 +56,5 @@ public class EditingIpcTester(IDalamudPluginInterface pi) : Luna.IUiService
if (Im.Item.Hovered() && _task2?.Status is TaskStatus.Faulted) if (Im.Item.Hovered() && _task2?.Status is TaskStatus.Faulted)
Im.Tooltip.Set($"{_task2.Exception}"); Im.Tooltip.Set($"{_task2.Exception}");
} }
}
} }

View file

@ -1,12 +1,14 @@
using Dalamud.Plugin; using Dalamud.Plugin;
using ImSharp; using ImSharp;
using Luna;
using Penumbra.Api.Enums; using Penumbra.Api.Enums;
using Penumbra.Api.Helpers; using Penumbra.Api.Helpers;
using Penumbra.Api.IpcSubscribers; using Penumbra.Api.IpcSubscribers;
using Penumbra.GameData.Interop;
namespace Penumbra.Api.IpcTester; namespace Penumbra.Api.IpcTester;
public class GameStateIpcTester : Luna.IUiService, IDisposable public class GameStateIpcTester : IUiService, IDisposable
{ {
private readonly IDalamudPluginInterface _pi; private readonly IDalamudPluginInterface _pi;
public readonly EventSubscriber<nint, Guid, nint, nint, nint> CharacterBaseCreating; public readonly EventSubscriber<nint, Guid, nint, nint, nint> CharacterBaseCreating;
@ -29,8 +31,8 @@ public class GameStateIpcTester : Luna.IUiService, IDisposable
public GameStateIpcTester(IDalamudPluginInterface pi) public GameStateIpcTester(IDalamudPluginInterface pi)
{ {
_pi = pi; _pi = pi;
CharacterBaseCreating = IpcSubscribers.CreatingCharacterBase.Subscriber(pi, UpdateLastCreated); CharacterBaseCreating = CreatingCharacterBase.Subscriber(pi, UpdateLastCreated);
CharacterBaseCreated = IpcSubscribers.CreatedCharacterBase.Subscriber(pi, UpdateLastCreated2); CharacterBaseCreated = CreatedCharacterBase.Subscriber(pi, UpdateLastCreated2);
GameObjectResourcePathResolved = IpcSubscribers.GameObjectResourcePathResolved.Subscriber(pi, UpdateGameObjectResourcePath); GameObjectResourcePathResolved = IpcSubscribers.GameObjectResourcePathResolved.Subscriber(pi, UpdateGameObjectResourcePath);
CharacterBaseCreating.Disable(); CharacterBaseCreating.Disable();
CharacterBaseCreated.Disable(); CharacterBaseCreated.Disable();
@ -68,7 +70,9 @@ public class GameStateIpcTester : Luna.IUiService, IDisposable
if (!table) if (!table)
return; return;
IpcTester.DrawIntro(GetDrawObjectInfo.Label, "Draw Object Info"u8); using (IpcTester.DrawIntro(GetDrawObjectInfo.Label, "Draw Object Info"u8))
{
table.NextColumn();
if (_currentDrawObject == nint.Zero) if (_currentDrawObject == nint.Zero)
{ {
Im.Text("Invalid"u8); Im.Text("Invalid"u8);
@ -78,26 +82,37 @@ public class GameStateIpcTester : Luna.IUiService, IDisposable
var (ptr, (collectionId, collectionName)) = new GetDrawObjectInfo(_pi).Invoke(_currentDrawObject); var (ptr, (collectionId, collectionName)) = new GetDrawObjectInfo(_pi).Invoke(_currentDrawObject);
Im.Text(ptr == nint.Zero ? $"No Actor Associated, {collectionName}" : $"{ptr:X}, {collectionName}"); Im.Text(ptr == nint.Zero ? $"No Actor Associated, {collectionName}" : $"{ptr:X}, {collectionName}");
Im.Line.Same(); Im.Line.Same();
ImEx.MonoText($"{collectionId}"); LunaStyle.DrawGuid(collectionId);
}
} }
IpcTester.DrawIntro(GetCutsceneParentIndex.Label, "Cutscene Parent"u8); using (IpcTester.DrawIntro(GetCutsceneParentIndex.Label, "Cutscene Parent"u8))
Im.Text($"{new GetCutsceneParentIndex(_pi).Invoke(_currentCutsceneActor)}"); {
table.DrawColumn($"{new GetCutsceneParentIndex(_pi).Invoke(_currentCutsceneActor)}");
}
IpcTester.DrawIntro(SetCutsceneParentIndex.Label, "Cutscene Parent"u8); using (IpcTester.DrawIntro(SetCutsceneParentIndex.Label, "Cutscene Parent"u8))
if (Im.Button("Set Parent"u8)) {
table.NextColumn();
if (Im.SmallButton("Set Parent"u8))
_cutsceneError = new SetCutsceneParentIndex(_pi) _cutsceneError = new SetCutsceneParentIndex(_pi)
.Invoke(_currentCutsceneActor, _currentCutsceneParent); .Invoke(_currentCutsceneActor, _currentCutsceneParent);
}
IpcTester.DrawIntro(CreatingCharacterBase.Label, "Last Drawobject created"u8); using (IpcTester.DrawIntro(CreatingCharacterBase.Label, "Last Drawobject created"u8))
{
if (_lastCreatedGameObjectTime < DateTimeOffset.Now) if (_lastCreatedGameObjectTime < DateTimeOffset.Now)
Im.Text(_lastCreatedDrawObject != nint.Zero table.DrawColumn(_lastCreatedDrawObject != nint.Zero
? $"0x{_lastCreatedDrawObject:X} for <{_lastCreatedGameObjectName}> at {_lastCreatedGameObjectTime}" ? $"0x{_lastCreatedDrawObject:X} for <{_lastCreatedGameObjectName}> at {_lastCreatedGameObjectTime}"
: $"NULL for <{_lastCreatedGameObjectName}> at {_lastCreatedGameObjectTime}"); : $"NULL for <{_lastCreatedGameObjectName}> at {_lastCreatedGameObjectTime}");
}
IpcTester.DrawIntro(IpcSubscribers.GameObjectResourcePathResolved.Label, "Last GamePath resolved"u8); using (IpcTester.DrawIntro(IpcSubscribers.GameObjectResourcePathResolved.Label, "Last GamePath resolved"u8))
{
if (_lastResolvedGamePathTime < DateTimeOffset.Now) if (_lastResolvedGamePathTime < DateTimeOffset.Now)
Im.Text($"{_lastResolvedGamePath} -> {_lastResolvedFullPath} for <{_lastResolvedObject}> at {_lastResolvedGamePathTime}"); table.DrawColumn(
$"{_lastResolvedGamePath} -> {_lastResolvedFullPath} for <{_lastResolvedObject}> at {_lastResolvedGamePathTime}");
}
} }
private void UpdateLastCreated(nint gameObject, Guid _, nint _2, nint _3, nint _4) private void UpdateLastCreated(nint gameObject, Guid _, nint _2, nint _3, nint _4)
@ -122,9 +137,6 @@ public class GameStateIpcTester : Luna.IUiService, IDisposable
_lastResolvedGamePathTime = DateTimeOffset.Now; _lastResolvedGamePathTime = DateTimeOffset.Now;
} }
private static unsafe StringU8 GetObjectName(nint gameObject) private static StringU8 GetObjectName(nint gameObject)
{ => new(((Actor)gameObject).StoredName());
var obj = (FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)gameObject;
return new StringU8(obj is not null && obj->Name[0] != 0 ? obj->Name : "Unknown"u8);
}
} }

View file

@ -52,11 +52,13 @@ public class IpcTester(
} }
} }
internal static void DrawIntro(Utf8StringHandler<LabelStringHandlerBuffer> label, Utf8StringHandler<TextStringHandlerBuffer> info) internal static Im.IdDisposable DrawIntro(Utf8StringHandler<LabelStringHandlerBuffer> label, Utf8StringHandler<TextStringHandlerBuffer> info)
{ {
var id = Im.Id.Push(ref info);
Im.Table.NextRow(); Im.Table.NextRow();
Im.Table.DrawColumn(ref label); Im.Table.DrawColumn(ref label);
Im.Table.DrawColumn(ref info); Im.Table.DrawColumn(ref info);
return id;
} }
private void Subscribe() private void Subscribe()

View file

@ -28,21 +28,29 @@ public class MetaIpcTester(IDalamudPluginInterface pi) : Luna.IUiService
if (!table) if (!table)
return; return;
IpcTester.DrawIntro(GetPlayerMetaManipulations.Label, "Player Meta Manipulations"u8); using (IpcTester.DrawIntro(GetPlayerMetaManipulations.Label, "Player Meta Manipulations"u8))
if (Im.Button("Copy to Clipboard##Player"u8)) {
table.NextColumn();
if (Im.SmallButton("Copy to Clipboard##Player"u8))
{ {
var base64 = new GetPlayerMetaManipulations(pi).Invoke(); var base64 = new GetPlayerMetaManipulations(pi).Invoke();
Im.Clipboard.Set(base64); Im.Clipboard.Set(base64);
} }
}
IpcTester.DrawIntro(GetMetaManipulations.Label, "Game Object Manipulations"u8); using (IpcTester.DrawIntro(GetMetaManipulations.Label, "Game Object Manipulations"u8))
if (Im.Button("Copy to Clipboard##GameObject"u8)) {
table.NextColumn();
if (Im.SmallButton("Copy to Clipboard##GameObject"u8))
{ {
var base64 = new GetMetaManipulations(pi).Invoke(_gameObjectIndex); var base64 = new GetMetaManipulations(pi).Invoke(_gameObjectIndex);
Im.Clipboard.Set(base64); Im.Clipboard.Set(base64);
} }
}
IpcTester.DrawIntro(string.Empty, "Parsed Data"u8); using (IpcTester.DrawIntro(StringU8.Empty, "Parsed Data"u8))
Im.Text($"Version: {_parsedVersion}, Count: {_metaDict.Count}"); {
table.DrawColumn($"Version: {_parsedVersion}, Count: {_metaDict.Count}");
}
} }
} }

View file

@ -41,9 +41,7 @@ public class ModSettingsIpcTester : Luna.IUiService, IDisposable
} }
public void Dispose() public void Dispose()
{ => SettingChanged.Dispose();
SettingChanged.Dispose();
}
public void Draw() public void Draw()
{ {
@ -53,7 +51,7 @@ public class ModSettingsIpcTester : Luna.IUiService, IDisposable
Im.Input.Text("##settingsDir"u8, ref _settingsModDirectory, "Mod Directory Name..."u8); Im.Input.Text("##settingsDir"u8, ref _settingsModDirectory, "Mod Directory Name..."u8);
Im.Input.Text("##settingsName"u8, ref _settingsModName, "Mod Name..."u8); Im.Input.Text("##settingsName"u8, ref _settingsModName, "Mod Name..."u8);
ImEx.GuidInput("##settingsCollection"u8, ref _settingsCollection, "Collection..."u8); ImEx.GuidInput("Collection ID##settingsCollection"u8, ref _settingsCollection);
Im.Checkbox("Ignore Inheritance"u8, ref _settingsIgnoreInheritance); Im.Checkbox("Ignore Inheritance"u8, ref _settingsIgnoreInheritance);
Im.Checkbox("Ignore Temporary"u8, ref _settingsIgnoreTemporary); Im.Checkbox("Ignore Temporary"u8, ref _settingsIgnoreTemporary);
Im.Input.Scalar("Key"u8, ref _settingsKey); Im.Input.Scalar("Key"u8, ref _settingsKey);
@ -63,22 +61,29 @@ public class ModSettingsIpcTester : Luna.IUiService, IDisposable
if (!table) if (!table)
return; return;
IpcTester.DrawIntro("Last Error"u8, $"{_lastSettingsError}"); IpcTester.DrawIntro("Last Error"u8, $"{_lastSettingsError}").Dispose();
IpcTester.DrawIntro(ModSettingChanged.Label, "Last Mod Setting Changed"u8); using (IpcTester.DrawIntro(ModSettingChanged.Label, "Last Mod Setting Changed"u8))
Im.Text(_lastSettingChangeMod.Length > 0 {
table.DrawColumn(_lastSettingChangeMod.Length > 0
? $"{_lastSettingChangeType} of {_lastSettingChangeMod} in {_lastSettingChangeCollection}{(_lastSettingChangeInherited ? " (Inherited)" : string.Empty)} at {_lastSettingChange}" ? $"{_lastSettingChangeType} of {_lastSettingChangeMod} in {_lastSettingChangeCollection}{(_lastSettingChangeInherited ? " (Inherited)" : string.Empty)} at {_lastSettingChange}"
: "None"u8); : "None"u8);
}
IpcTester.DrawIntro(GetAvailableModSettings.Label, "Get Available Settings"u8); using (IpcTester.DrawIntro(GetAvailableModSettings.Label, "Get Available Settings"u8))
if (Im.Button("Get##Available"u8)) {
table.NextColumn();
if (Im.SmallButton("Get##Available"u8))
{ {
_availableSettings = new GetAvailableModSettings(_pi).Invoke(_settingsModDirectory, _settingsModName); _availableSettings = new GetAvailableModSettings(_pi).Invoke(_settingsModDirectory, _settingsModName);
_lastSettingsError = _availableSettings == null ? PenumbraApiEc.ModMissing : PenumbraApiEc.Success; _lastSettingsError = _availableSettings == null ? PenumbraApiEc.ModMissing : PenumbraApiEc.Success;
} }
}
IpcTester.DrawIntro(GetCurrentModSettings.Label, "Get Current Settings"u8); using (IpcTester.DrawIntro(GetCurrentModSettings.Label, "Get Current Settings"u8))
if (Im.Button("Get##Current"u8)) {
table.NextColumn();
if (Im.SmallButton("Get##Current"u8))
{ {
var ret = new GetCurrentModSettings(_pi) var ret = new GetCurrentModSettings(_pi)
.Invoke(collection, _settingsModDirectory, _settingsModName, _settingsIgnoreInheritance); .Invoke(collection, _settingsModDirectory, _settingsModName, _settingsIgnoreInheritance);
@ -96,9 +101,12 @@ public class ModSettingsIpcTester : Luna.IUiService, IDisposable
_currentSettings = null; _currentSettings = null;
} }
} }
}
IpcTester.DrawIntro(GetCurrentModSettingsWithTemp.Label, "Get Current Settings With Temp"u8); using (IpcTester.DrawIntro(GetCurrentModSettingsWithTemp.Label, "Get Current Settings With Temp"u8))
if (Im.Button("Get##CurrentTemp"u8)) {
table.NextColumn();
if (Im.SmallButton("Get##CurrentTemp"u8))
{ {
var ret = new GetCurrentModSettingsWithTemp(_pi) var ret = new GetCurrentModSettingsWithTemp(_pi)
.Invoke(collection, _settingsModDirectory, _settingsModName, _settingsIgnoreInheritance, _settingsIgnoreTemporary, .Invoke(collection, _settingsModDirectory, _settingsModName, _settingsIgnoreInheritance, _settingsIgnoreTemporary,
@ -117,9 +125,12 @@ public class ModSettingsIpcTester : Luna.IUiService, IDisposable
_currentSettings = null; _currentSettings = null;
} }
} }
}
IpcTester.DrawIntro(GetAllModSettings.Label, "Get All Mod Settings"u8); using (IpcTester.DrawIntro(GetAllModSettings.Label, "Get All Mod Settings"u8))
if (Im.Button("Get##All"u8)) {
table.NextColumn();
if (Im.SmallButton("Get##All"u8))
{ {
var ret = new GetAllModSettings(_pi).Invoke(collection, _settingsIgnoreInheritance, _settingsIgnoreTemporary, _settingsKey); var ret = new GetAllModSettings(_pi).Invoke(collection, _settingsIgnoreInheritance, _settingsIgnoreTemporary, _settingsKey);
_lastSettingsError = ret.Item1; _lastSettingsError = ret.Item1;
@ -131,40 +142,55 @@ public class ModSettingsIpcTester : Luna.IUiService, IDisposable
Im.Line.Same(); Im.Line.Same();
Im.Text($"{_allSettings.Count} Mods"); Im.Text($"{_allSettings.Count} Mods");
} }
}
IpcTester.DrawIntro(TryInheritMod.Label, "Inherit Mod"u8); using (IpcTester.DrawIntro(TryInheritMod.Label, "Inherit Mod"u8))
{
table.NextColumn();
Im.Checkbox("##inherit"u8, ref _settingsInherit); Im.Checkbox("##inherit"u8, ref _settingsInherit);
Im.Line.Same(); Im.Line.Same();
if (Im.Button("Set##Inherit"u8)) if (Im.SmallButton("Set##Inherit"u8))
_lastSettingsError = new TryInheritMod(_pi) _lastSettingsError = new TryInheritMod(_pi)
.Invoke(collection, _settingsModDirectory, _settingsInherit, _settingsModName); .Invoke(collection, _settingsModDirectory, _settingsInherit, _settingsModName);
}
IpcTester.DrawIntro(TrySetMod.Label, "Set Enabled"u8); using (IpcTester.DrawIntro(TrySetMod.Label, "Set Enabled"u8))
{
table.NextColumn();
Im.Checkbox("##enabled"u8, ref _settingsEnabled); Im.Checkbox("##enabled"u8, ref _settingsEnabled);
Im.Line.Same(); Im.Line.Same();
if (Im.Button("Set##Enabled"u8)) if (Im.SmallButton("Set##Enabled"u8))
_lastSettingsError = new TrySetMod(_pi) _lastSettingsError = new TrySetMod(_pi)
.Invoke(collection, _settingsModDirectory, _settingsEnabled, _settingsModName); .Invoke(collection, _settingsModDirectory, _settingsEnabled, _settingsModName);
}
IpcTester.DrawIntro(TrySetModPriority.Label, "Set Priority"u8); using (IpcTester.DrawIntro(TrySetModPriority.Label, "Set Priority"u8))
{
table.NextColumn();
Im.Item.SetNextWidthScaled(200); Im.Item.SetNextWidthScaled(200);
Im.Drag("##Priority"u8, ref _settingsPriority); Im.Drag("##Priority"u8, ref _settingsPriority);
Im.Line.Same(); Im.Line.Same();
if (Im.Button("Set##Priority"u8)) if (Im.SmallButton("Set##Priority"u8))
_lastSettingsError = new TrySetModPriority(_pi) _lastSettingsError = new TrySetModPriority(_pi)
.Invoke(collection, _settingsModDirectory, _settingsPriority, _settingsModName); .Invoke(collection, _settingsModDirectory, _settingsPriority, _settingsModName);
}
IpcTester.DrawIntro(CopyModSettings.Label, "Copy Mod Settings"u8); using (IpcTester.DrawIntro(CopyModSettings.Label, "Copy Mod Settings"u8))
if (Im.Button("Copy Settings"u8)) {
table.NextColumn();
if (Im.SmallButton("Copy Settings"u8))
_lastSettingsError = new CopyModSettings(_pi) _lastSettingsError = new CopyModSettings(_pi)
.Invoke(_settingsCollection, _settingsModDirectory, _settingsModName); .Invoke(_settingsCollection, _settingsModDirectory, _settingsModName);
Im.Tooltip.OnHover("Copy settings from Mod Directory Name to Mod Name (as directory) in collection."u8); Im.Tooltip.OnHover("Copy settings from Mod Directory Name to Mod Name (as directory) in collection."u8);
}
IpcTester.DrawIntro(TrySetModSetting.Label, "Set Setting(s)"u8);
using (IpcTester.DrawIntro(TrySetModSetting.Label, "Set Setting(s)"u8))
{
if (_availableSettings == null) if (_availableSettings == null)
return; return;
table.NextColumn();
foreach (var (group, (list, type)) in _availableSettings) foreach (var (group, (list, type)) in _availableSettings)
{ {
using var id = Im.Id.Push(group); using var id = Im.Id.Push(group);
@ -197,9 +223,10 @@ public class ModSettingsIpcTester : Luna.IUiService, IDisposable
} }
Im.Line.Same(); Im.Line.Same();
if (Im.Button("Set##setting"u8)) if (Im.SmallButton("Set##setting"u8))
_lastSettingsError = type is GroupType.Single _lastSettingsError = type is GroupType.Single
? new TrySetModSetting(_pi).Invoke(collection, _settingsModDirectory, group, current.Count > 0 ? current[0] : string.Empty, ? new TrySetModSetting(_pi).Invoke(collection, _settingsModDirectory, group,
current.Count > 0 ? current[0] : string.Empty,
_settingsModName) _settingsModName)
: new TrySetModSettings(_pi).Invoke(collection, _settingsModDirectory, group, current.ToArray(), _settingsModName); : new TrySetModSettings(_pi).Invoke(collection, _settingsModDirectory, group, current.ToArray(), _settingsModName);
@ -207,6 +234,7 @@ public class ModSettingsIpcTester : Luna.IUiService, IDisposable
Im.Text(group); Im.Text(group);
} }
} }
}
private void UpdateLastModSetting(ModSettingChange type, Guid collection, string mod, bool inherited) private void UpdateLastModSetting(ModSettingChange type, Guid collection, string mod, bool inherited)
{ {

View file

@ -82,72 +82,99 @@ public class ModsIpcTester : Luna.IUiService, IDisposable
if (!table) if (!table)
return; return;
IpcTester.DrawIntro(GetModList.Label, "Mods"u8); using (IpcTester.DrawIntro(GetModList.Label, "Mods"u8))
{
DrawModsPopup(); DrawModsPopup();
if (Im.Button("Get##Mods"u8)) table.NextColumn();
if (Im.SmallButton("Get##Mods"u8))
{ {
_mods = new GetModList(_pi).Invoke(); _mods = new GetModList(_pi).Invoke();
Im.Popup.Open("Mods"u8); Im.Popup.Open("Mods"u8);
} }
}
IpcTester.DrawIntro(ReloadMod.Label, "Reload Mod"u8); using (IpcTester.DrawIntro(ReloadMod.Label, "Reload Mod"u8))
if (Im.Button("Reload"u8)) {
table.NextColumn();
if (Im.SmallButton("Reload"u8))
_lastReloadEc = new ReloadMod(_pi).Invoke(_modDirectory, _modName); _lastReloadEc = new ReloadMod(_pi).Invoke(_modDirectory, _modName);
Im.Line.Same(); Im.Line.Same();
Im.Text($"{_lastReloadEc}"); Im.Text($"{_lastReloadEc}");
}
IpcTester.DrawIntro(InstallMod.Label, "Install Mod"u8);
if (Im.Button("Install"u8)) using (IpcTester.DrawIntro(InstallMod.Label, "Install Mod"u8))
{
table.NextColumn();
if (Im.SmallButton("Install"u8))
_lastInstallEc = new InstallMod(_pi).Invoke(_newInstallPath); _lastInstallEc = new InstallMod(_pi).Invoke(_newInstallPath);
Im.Line.Same(); Im.Line.Same();
Im.Text($"{_lastInstallEc}"); Im.Text($"{_lastInstallEc}");
}
IpcTester.DrawIntro(AddMod.Label, "Add Mod"u8); using (IpcTester.DrawIntro(AddMod.Label, "Add Mod"u8))
if (Im.Button("Add"u8)) {
table.NextColumn();
if (Im.SmallButton("Add"u8))
_lastAddEc = new AddMod(_pi).Invoke(_modDirectory); _lastAddEc = new AddMod(_pi).Invoke(_modDirectory);
Im.Line.Same(); Im.Line.Same();
Im.Text($"{_lastAddEc}"); Im.Text($"{_lastAddEc}");
}
IpcTester.DrawIntro(DeleteMod.Label, "Delete Mod"u8); using (IpcTester.DrawIntro(DeleteMod.Label, "Delete Mod"u8))
if (Im.Button("Delete"u8)) {
table.NextColumn();
if (Im.SmallButton("Delete"u8))
_lastDeleteEc = new DeleteMod(_pi).Invoke(_modDirectory, _modName); _lastDeleteEc = new DeleteMod(_pi).Invoke(_modDirectory, _modName);
Im.Line.Same(); Im.Line.Same();
Im.Text(_lastDeleteEc.ToString()); Im.Text(_lastDeleteEc.ToString());
}
IpcTester.DrawIntro(GetChangedItems.Label, "Get Changed Items"u8); using (IpcTester.DrawIntro(GetChangedItems.Label, "Get Changed Items"u8))
{
DrawChangedItemsPopup(); DrawChangedItemsPopup();
if (Im.Button("Get##ChangedItems"u8)) table.NextColumn();
if (Im.SmallButton("Get##ChangedItems"u8))
{ {
_changedItems = new GetChangedItems(_pi).Invoke(_modDirectory, _modName); _changedItems = new GetChangedItems(_pi).Invoke(_modDirectory, _modName);
Im.Popup.Open("ChangedItems"u8); Im.Popup.Open("ChangedItems"u8);
} }
}
IpcTester.DrawIntro(GetModPath.Label, "Current Path"u8); using (IpcTester.DrawIntro(GetModPath.Label, "Current Path"u8))
{
var (ec, path, def, nameDef) = new GetModPath(_pi).Invoke(_modDirectory, _modName); var (ec, path, def, nameDef) = new GetModPath(_pi).Invoke(_modDirectory, _modName);
Im.Text($"{path} ({(def ? "Custom" : "Default")} Path, {(nameDef ? "Custom" : "Default")} Name) [{ec}]"); table.DrawColumn($"{path} ({(def ? "Custom" : "Default")} Path, {(nameDef ? "Custom" : "Default")} Name) [{ec}]");
}
IpcTester.DrawIntro(SetModPath.Label, "Set Path"u8); using (IpcTester.DrawIntro(SetModPath.Label, "Set Path"u8))
if (Im.Button("Set"u8)) {
table.NextColumn();
if (Im.SmallButton("Set"u8))
_lastSetPathEc = new SetModPath(_pi).Invoke(_modDirectory, _pathInput, _modName); _lastSetPathEc = new SetModPath(_pi).Invoke(_modDirectory, _pathInput, _modName);
Im.Line.Same(); Im.Line.Same();
Im.Text($"{_lastSetPathEc}"); Im.Text($"{_lastSetPathEc}");
}
IpcTester.DrawIntro(ModDeleted.Label, "Last Mod Deleted"u8); using (IpcTester.DrawIntro(ModDeleted.Label, "Last Mod Deleted"u8))
{
if (_lastDeletedModTime > DateTimeOffset.UnixEpoch) if (_lastDeletedModTime > DateTimeOffset.UnixEpoch)
Im.Text($"{_lastDeletedMod} at {_lastDeletedModTime}"); table.DrawColumn($"{_lastDeletedMod} at {_lastDeletedModTime}");
}
IpcTester.DrawIntro(ModAdded.Label, "Last Mod Added"u8); using (IpcTester.DrawIntro(ModAdded.Label, "Last Mod Added"u8))
{
if (_lastAddedModTime > DateTimeOffset.UnixEpoch) if (_lastAddedModTime > DateTimeOffset.UnixEpoch)
Im.Text($"{_lastAddedMod} at {_lastAddedModTime}"); table.DrawColumn($"{_lastAddedMod} at {_lastAddedModTime}");
}
IpcTester.DrawIntro(ModMoved.Label, "Last Mod Moved"); using (IpcTester.DrawIntro(ModMoved.Label, "Last Mod Moved"))
{
if (_lastMovedModTime > DateTimeOffset.UnixEpoch) if (_lastMovedModTime > DateTimeOffset.UnixEpoch)
Im.Text($"{_lastMovedModFrom} -> {_lastMovedModTo} at {_lastMovedModTime}"); table.DrawColumn($"{_lastMovedModFrom} -> {_lastMovedModTo} at {_lastMovedModTime}");
}
} }
private void DrawModsPopup() private void DrawModsPopup()

View file

@ -1,3 +1,4 @@
using Dalamud.Interface.Utility.Table;
using Dalamud.Plugin; using Dalamud.Plugin;
using ImSharp; using ImSharp;
using Luna; using Luna;
@ -63,48 +64,65 @@ public class PluginStateIpcTester : IUiService, IDisposable
DrawList(IpcSubscribers.Initialized.Label, "Last Initialized"u8, _initializedList); DrawList(IpcSubscribers.Initialized.Label, "Last Initialized"u8, _initializedList);
DrawList(IpcSubscribers.Disposed.Label, "Last Disposed"u8, _disposedList); DrawList(IpcSubscribers.Disposed.Label, "Last Disposed"u8, _disposedList);
IpcTester.DrawIntro(ApiVersion.Label, "Current Version"u8); using (IpcTester.DrawIntro(ApiVersion.Label, "Current Version"u8))
{
var (breaking, features) = new ApiVersion(_pi).Invoke(); var (breaking, features) = new ApiVersion(_pi).Invoke();
Im.Text($"{breaking}.{features:D4}"); table.DrawColumn($"{breaking}.{features:D4}");
}
IpcTester.DrawIntro(GetEnabledState.Label, "Current State"u8); using (IpcTester.DrawIntro(GetEnabledState.Label, "Current State"u8))
Im.Text($"{new GetEnabledState(_pi).Invoke()}"); {
table.DrawColumn($"{new GetEnabledState(_pi).Invoke()}");
}
IpcTester.DrawIntro(IpcSubscribers.EnabledChange.Label, "Last Change"u8); using (IpcTester.DrawIntro(IpcSubscribers.EnabledChange.Label, "Last Change"u8))
Im.Text(_lastEnabledValue is { } v ? $"{_lastEnabledChange} (to {v})" : "Never"u8); {
table.DrawColumn(_lastEnabledValue is { } v ? $"{_lastEnabledChange} (to {v})" : "Never"u8);
}
IpcTester.DrawIntro(SupportedFeatures.Label, "Supported Features"u8); using (IpcTester.DrawIntro(SupportedFeatures.Label, "Supported Features"u8))
Im.Text(StringU8.Join(", "u8, new SupportedFeatures(_pi).Invoke())); {
table.DrawColumn(StringU8.Join(", "u8, new SupportedFeatures(_pi).Invoke()));
}
IpcTester.DrawIntro(CheckSupportedFeatures.Label, "Missing Features"u8); using (IpcTester.DrawIntro(CheckSupportedFeatures.Label, "Missing Features"u8))
Im.Text(StringU8.Join(", "u8, new CheckSupportedFeatures(_pi).Invoke(_requiredFeatures))); table.DrawColumn(StringU8.Join(", "u8, new CheckSupportedFeatures(_pi).Invoke(_requiredFeatures)));
using (IpcTester.DrawIntro(GetConfiguration.Label, "Configuration"u8))
{
DrawConfigPopup(); DrawConfigPopup();
IpcTester.DrawIntro(GetConfiguration.Label, "Configuration"u8); table.NextColumn();
if (Im.Button("Get"u8)) if (Im.SmallButton("Get"u8))
{ {
_currentConfiguration = new GetConfiguration(_pi).Invoke(); _currentConfiguration = new GetConfiguration(_pi).Invoke();
Im.Popup.Open("Config Popup"u8); Im.Popup.Open("Config Popup"u8);
} }
}
IpcTester.DrawIntro(GetModDirectory.Label, "Current Mod Directory"u8); using (IpcTester.DrawIntro(GetModDirectory.Label, "Current Mod Directory"u8))
Im.Text(new GetModDirectory(_pi).Invoke()); {
table.DrawColumn(new GetModDirectory(_pi).Invoke());
}
IpcTester.DrawIntro(IpcSubscribers.ModDirectoryChanged.Label, "Last Mod Directory Change"u8); using (IpcTester.DrawIntro(IpcSubscribers.ModDirectoryChanged.Label, "Last Mod Directory Change"u8))
Im.Text(_lastModDirectoryTime > DateTimeOffset.MinValue {
table.DrawColumn(_lastModDirectoryTime > DateTimeOffset.MinValue
? $"{_lastModDirectory} ({(_lastModDirectoryValid ? "Valid" : "Invalid")}) at {_lastModDirectoryTime}" ? $"{_lastModDirectory} ({(_lastModDirectoryValid ? "Valid" : "Invalid")}) at {_lastModDirectoryTime}"
: "None"u8); : "None"u8);
}
void DrawList(string label, ReadOnlySpan<byte> text, List<DateTimeOffset> list) return;
static void DrawList(string label, ReadOnlySpan<byte> text, List<DateTimeOffset> list)
{ {
IpcTester.DrawIntro(label, text); using var _ = IpcTester.DrawIntro(label, text);
if (list.Count is 0) if (list.Count is 0)
{ {
Im.Text("Never"u8); Im.Table.DrawColumn("Never"u8);
} }
else else
{ {
Im.Text(list[^1].LocalDateTime.ToString(CultureInfo.CurrentCulture)); Im.Table.DrawColumn(list[^1].LocalDateTime.ToString(CultureInfo.CurrentCulture));
if (list.Count > 1 && Im.Item.Hovered()) if (list.Count > 1 && Im.Item.Hovered())
Im.Tooltip.Set( Im.Tooltip.Set(
StringU8.Join((byte)'\n', list.SkipLast(1).Select(t => t.LocalDateTime.ToString(CultureInfo.CurrentCulture)))); StringU8.Join((byte)'\n', list.SkipLast(1).Select(t => t.LocalDateTime.ToString(CultureInfo.CurrentCulture))));

View file

@ -38,21 +38,29 @@ public class RedrawingIpcTester : Luna.IUiService, IDisposable
if (!table) if (!table)
return; return;
IpcTester.DrawIntro(RedrawObject.Label, "Redraw by Index"u8); using (IpcTester.DrawIntro(RedrawObject.Label, "Redraw by Index"u8))
{
var tmp = _redrawIndex; var tmp = _redrawIndex;
table.NextColumn();
Im.Item.SetNextWidthScaled(100); Im.Item.SetNextWidthScaled(100);
if (Im.Drag("##redrawIndex"u8, ref tmp, 0, _objects.TotalCount, 0.1f)) if (Im.Drag("##redrawIndex"u8, ref tmp, 0, _objects.TotalCount, 0.1f))
_redrawIndex = Math.Clamp(tmp, 0, _objects.TotalCount); _redrawIndex = Math.Clamp(tmp, 0, _objects.TotalCount);
Im.Line.Same(); Im.Line.Same();
if (Im.Button("Redraw##Index"u8)) if (Im.Button("Redraw##Index"u8))
new RedrawObject(_pi).Invoke(_redrawIndex); new RedrawObject(_pi).Invoke(_redrawIndex);
}
IpcTester.DrawIntro(RedrawAll.Label, "Redraw All"u8); using (IpcTester.DrawIntro(RedrawAll.Label, "Redraw All"u8))
if (Im.Button("Redraw##All"u8)) {
table.NextColumn();
if (Im.SmallButton("Redraw##All"u8))
new RedrawAll(_pi).Invoke(); new RedrawAll(_pi).Invoke();
}
IpcTester.DrawIntro(GameObjectRedrawn.Label, "Last Redrawn Object:"u8); using (IpcTester.DrawIntro(GameObjectRedrawn.Label, "Last Redrawn Object:"u8))
Im.Text(_lastRedrawnString); {
table.DrawColumn(_lastRedrawnString);
}
} }
private void SetLastRedrawn(nint address, int index) private void SetLastRedrawn(nint address, int index)

View file

@ -24,64 +24,82 @@ public class ResolveIpcTester(IDalamudPluginInterface pi) : Luna.IUiService
if (!table) if (!table)
return; return;
IpcTester.DrawIntro(ResolveDefaultPath.Label, "Default Collection Resolve"u8); using (IpcTester.DrawIntro(ResolveDefaultPath.Label, "Default Collection Resolve"u8))
{
if (_currentResolvePath.Length is not 0) if (_currentResolvePath.Length is not 0)
Im.Text(new ResolveDefaultPath(pi).Invoke(_currentResolvePath)); table.DrawColumn(new ResolveDefaultPath(pi).Invoke(_currentResolvePath));
}
IpcTester.DrawIntro(ResolveInterfacePath.Label, "Interface Collection Resolve"u8); using (IpcTester.DrawIntro(ResolveInterfacePath.Label, "Interface Collection Resolve"u8))
{
if (_currentResolvePath.Length is not 0) if (_currentResolvePath.Length is not 0)
Im.Text(new ResolveInterfacePath(pi).Invoke(_currentResolvePath)); table.DrawColumn(new ResolveInterfacePath(pi).Invoke(_currentResolvePath));
}
IpcTester.DrawIntro(ResolvePlayerPath.Label, "Player Collection Resolve"u8); using (IpcTester.DrawIntro(ResolvePlayerPath.Label, "Player Collection Resolve"u8))
{
if (_currentResolvePath.Length is not 0) if (_currentResolvePath.Length is not 0)
Im.Text(new ResolvePlayerPath(pi).Invoke(_currentResolvePath)); table.DrawColumn(new ResolvePlayerPath(pi).Invoke(_currentResolvePath));
}
IpcTester.DrawIntro(ResolveGameObjectPath.Label, "Game Object Collection Resolve"u8); using (IpcTester.DrawIntro(ResolveGameObjectPath.Label, "Game Object Collection Resolve"u8))
{
if (_currentResolvePath.Length is not 0) if (_currentResolvePath.Length is not 0)
Im.Text(new ResolveGameObjectPath(pi).Invoke(_currentResolvePath, _currentReverseIdx)); table.DrawColumn(new ResolveGameObjectPath(pi).Invoke(_currentResolvePath, _currentReverseIdx));
}
IpcTester.DrawIntro(ReverseResolvePlayerPath.Label, "Reversed Game Paths (Player)"u8); using (IpcTester.DrawIntro(ReverseResolvePlayerPath.Label, "Reversed Game Paths (Player)"u8))
{
if (_currentReversePath.Length is not 0) if (_currentReversePath.Length is not 0)
{ {
var list = new ReverseResolvePlayerPath(pi).Invoke(_currentReversePath); var list = new ReverseResolvePlayerPath(pi).Invoke(_currentReversePath);
if (list.Length > 0) if (list.Length > 0)
{ {
Im.Text(list[0]); table.DrawColumn(list[0]);
if (list.Length > 1 && Im.Item.Hovered()) if (list.Length > 1 && Im.Item.Hovered())
Im.Tooltip.Set(StringU8.Join((byte)'\n', list.Skip(1))); Im.Tooltip.Set(StringU8.Join((byte)'\n', list.Skip(1)));
} }
} }
}
IpcTester.DrawIntro(ReverseResolveGameObjectPath.Label, "Reversed Game Paths (Game Object)"u8); using (IpcTester.DrawIntro(ReverseResolveGameObjectPath.Label, "Reversed Game Paths (Game Object)"u8))
{
if (_currentReversePath.Length is not 0) if (_currentReversePath.Length is not 0)
{ {
var list = new ReverseResolveGameObjectPath(pi).Invoke(_currentReversePath, _currentReverseIdx); var list = new ReverseResolveGameObjectPath(pi).Invoke(_currentReversePath, _currentReverseIdx);
if (list.Length > 0) if (list.Length > 0)
{ {
Im.Text(list[0]); table.DrawColumn(list[0]);
if (list.Length > 1 && Im.Item.Hovered()) if (list.Length > 1 && Im.Item.Hovered())
Im.Tooltip.Set(StringU8.Join((byte)'\n', list.Skip(1))); Im.Tooltip.Set(StringU8.Join((byte)'\n', list.Skip(1)));
} }
} }
}
string[] forwardArray = _currentResolvePath.Length > 0 ? [_currentResolvePath] : []; string[] forwardArray = _currentResolvePath.Length > 0 ? [_currentResolvePath] : [];
string[] reverseArray = _currentReversePath.Length > 0 ? [_currentReversePath] : []; string[] reverseArray = _currentReversePath.Length > 0 ? [_currentReversePath] : [];
IpcTester.DrawIntro(ResolvePlayerPaths.Label, "Resolved Paths (Player)"u8); using (IpcTester.DrawIntro(ResolvePlayerPaths.Label, "Resolved Paths (Player)"u8))
{
if (forwardArray.Length > 0 || reverseArray.Length > 0) if (forwardArray.Length > 0 || reverseArray.Length > 0)
{ {
var ret = new ResolvePlayerPaths(pi).Invoke(forwardArray, reverseArray); var ret = new ResolvePlayerPaths(pi).Invoke(forwardArray, reverseArray);
Im.Text(ConvertText(ret)); table.DrawColumn(ConvertText(ret));
}
} }
IpcTester.DrawIntro(ResolvePlayerPathsAsync.Label, "Resolved Paths Async (Player)"u8); using (IpcTester.DrawIntro(ResolvePlayerPathsAsync.Label, "Resolved Paths Async (Player)"u8))
if (Im.Button("Start"u8)) {
table.NextColumn();
if (Im.SmallButton("Start"u8))
_task = new ResolvePlayerPathsAsync(pi).Invoke(forwardArray, reverseArray); _task = new ResolvePlayerPathsAsync(pi).Invoke(forwardArray, reverseArray);
var hovered = Im.Item.Hovered(); var hovered = Im.Item.Hovered();
Im.Line.Same(); Im.Line.Same();
ImEx.TextFrameAligned($"{_task.Status}"); ImEx.TextFrameAligned($"{_task.Status}");
if ((hovered || Im.Item.Hovered()) && _task.IsCompletedSuccessfully) if ((hovered || Im.Item.Hovered()) && _task.IsCompletedSuccessfully && _task.Result.Item1.Length > 0)
Im.Tooltip.Set(ConvertText(_task.Result)); Im.Tooltip.Set(ConvertText(_task.Result));
}
return; return;
static StringU8 ConvertText((string[], string[][]) data) static StringU8 ConvertText((string[], string[][]) data)

View file

@ -34,15 +34,19 @@ public class ResourceTreeIpcTester(IDalamudPluginInterface pi, ObjectManager obj
return; return;
Im.Input.Text("GameObject indices"u8, ref _gameObjectIndices); Im.Input.Text("GameObject indices"u8, ref _gameObjectIndices);
EnumCombo<ResourceType>.Instance.Draw("Resource type"u8, ref _type, default, Im.Item.Size.X); EnumCombo<ResourceType>.Instance.Draw("Resource type"u8, ref _type, default, Im.Item.CalculateWidth());
Im.Checkbox("Also get names and icons"u8, ref _withUiData); Im.Checkbox("Also get names and icons"u8, ref _withUiData);
using var table = Im.Table.Begin(StringU8.Empty, 3, TableFlags.SizingFixedFit); using var table = Im.Table.Begin(StringU8.Empty, 3, TableFlags.SizingFixedFit);
if (!table) if (!table)
return; return;
IpcTester.DrawIntro(GetGameObjectResourcePaths.Label, "Get GameObject resource paths"u8); using (IpcTester.DrawIntro(GetGameObjectResourcePaths.Label, "Get GameObject resource paths"u8))
if (Im.Button("Get##GameObjectResourcePaths"u8)) {
DrawPopup("GetGameObjectResourcePaths"u8, ref _lastGameObjectResourcePaths, DrawResourcePaths,
_lastCallDuration);
table.NextColumn();
if (Im.SmallButton("Get##GameObjectResourcePaths"u8))
{ {
var gameObjects = GetSelectedGameObjects(); var gameObjects = GetSelectedGameObjects();
var subscriber = new GetGameObjectResourcePaths(pi); var subscriber = new GetGameObjectResourcePaths(pi);
@ -57,9 +61,13 @@ public class ResourceTreeIpcTester(IDalamudPluginInterface pi, ObjectManager obj
Im.Popup.Open("GetGameObjectResourcePaths"u8); Im.Popup.Open("GetGameObjectResourcePaths"u8);
} }
}
IpcTester.DrawIntro(GetPlayerResourcePaths.Label, "Get local player resource paths"u8); using (IpcTester.DrawIntro(GetPlayerResourcePaths.Label, "Get local player resource paths"u8))
if (Im.Button("Get##PlayerResourcePaths"u8)) {
DrawPopup("GetPlayerResourcePaths"u8, ref _lastPlayerResourcePaths!, DrawResourcePaths, _lastCallDuration);
table.NextColumn();
if (Im.SmallButton("Get##PlayerResourcePaths"u8))
{ {
var subscriber = new GetPlayerResourcePaths(pi); var subscriber = new GetPlayerResourcePaths(pi);
_stopwatch.Restart(); _stopwatch.Restart();
@ -72,9 +80,14 @@ public class ResourceTreeIpcTester(IDalamudPluginInterface pi, ObjectManager obj
Im.Popup.Open("GetPlayerResourcePaths"u8); Im.Popup.Open("GetPlayerResourcePaths"u8);
} }
}
IpcTester.DrawIntro(GetGameObjectResourcesOfType.Label, "Get GameObject resources of type"u8); using (IpcTester.DrawIntro(GetGameObjectResourcesOfType.Label, "Get GameObject resources of type"u8))
if (Im.Button("Get##GameObjectResourcesOfType"u8)) {
DrawPopup("GetGameObjectResourcesOfType"u8, ref _lastGameObjectResourcesOfType, DrawResourcesOfType,
_lastCallDuration);
table.NextColumn();
if (Im.SmallButton("Get##GameObjectResourcesOfType"u8))
{ {
var gameObjects = GetSelectedGameObjects(); var gameObjects = GetSelectedGameObjects();
var subscriber = new GetGameObjectResourcesOfType(pi); var subscriber = new GetGameObjectResourcesOfType(pi);
@ -89,9 +102,14 @@ public class ResourceTreeIpcTester(IDalamudPluginInterface pi, ObjectManager obj
Im.Popup.Open("GetGameObjectResourcesOfType"u8); Im.Popup.Open("GetGameObjectResourcesOfType"u8);
} }
}
IpcTester.DrawIntro(GetPlayerResourcesOfType.Label, "Get local player resources of type"u8); using (IpcTester.DrawIntro(GetPlayerResourcesOfType.Label, "Get local player resources of type"u8))
if (Im.Button("Get##PlayerResourcesOfType"u8)) {
DrawPopup("GetPlayerResourcesOfType"u8, ref _lastPlayerResourcesOfType, DrawResourcesOfType,
_lastCallDuration);
table.NextColumn();
if (Im.SmallButton("Get##PlayerResourcesOfType"u8))
{ {
var subscriber = new GetPlayerResourcesOfType(pi); var subscriber = new GetPlayerResourcesOfType(pi);
_stopwatch.Restart(); _stopwatch.Restart();
@ -104,9 +122,14 @@ public class ResourceTreeIpcTester(IDalamudPluginInterface pi, ObjectManager obj
Im.Popup.Open("GetPlayerResourcesOfType"u8); Im.Popup.Open("GetPlayerResourcesOfType"u8);
} }
}
IpcTester.DrawIntro(GetGameObjectResourceTrees.Label, "Get GameObject resource trees"u8); using (IpcTester.DrawIntro(GetGameObjectResourceTrees.Label, "Get GameObject resource trees"u8))
if (Im.Button("Get##GameObjectResourceTrees"u8)) {
DrawPopup("GetGameObjectResourceTrees"u8, ref _lastGameObjectResourceTrees, DrawResourceTrees,
_lastCallDuration);
table.NextColumn();
if (Im.SmallButton("Get##GameObjectResourceTrees"u8))
{ {
var gameObjects = GetSelectedGameObjects(); var gameObjects = GetSelectedGameObjects();
var subscriber = new GetGameObjectResourceTrees(pi); var subscriber = new GetGameObjectResourceTrees(pi);
@ -121,9 +144,13 @@ public class ResourceTreeIpcTester(IDalamudPluginInterface pi, ObjectManager obj
Im.Popup.Open("GetGameObjectResourceTrees"u8); Im.Popup.Open("GetGameObjectResourceTrees"u8);
} }
}
IpcTester.DrawIntro(GetPlayerResourceTrees.Label, "Get local player resource trees"u8); using (IpcTester.DrawIntro(GetPlayerResourceTrees.Label, "Get local player resource trees"u8))
if (Im.Button("Get##PlayerResourceTrees"u8)) {
DrawPopup("GetPlayerResourceTrees"u8, ref _lastPlayerResourceTrees, DrawResourceTrees!, _lastCallDuration);
table.NextColumn();
if (Im.SmallButton("Get##PlayerResourceTrees"u8))
{ {
var subscriber = new GetPlayerResourceTrees(pi); var subscriber = new GetPlayerResourceTrees(pi);
_stopwatch.Restart(); _stopwatch.Restart();
@ -136,19 +163,7 @@ public class ResourceTreeIpcTester(IDalamudPluginInterface pi, ObjectManager obj
Im.Popup.Open("GetPlayerResourceTrees"u8); Im.Popup.Open("GetPlayerResourceTrees"u8);
} }
}
DrawPopup("GetGameObjectResourcePaths"u8, ref _lastGameObjectResourcePaths, DrawResourcePaths,
_lastCallDuration);
DrawPopup("GetPlayerResourcePaths"u8, ref _lastPlayerResourcePaths!, DrawResourcePaths, _lastCallDuration);
DrawPopup("GetGameObjectResourcesOfType"u8, ref _lastGameObjectResourcesOfType, DrawResourcesOfType,
_lastCallDuration);
DrawPopup("GetPlayerResourcesOfType"u8, ref _lastPlayerResourcesOfType, DrawResourcesOfType,
_lastCallDuration);
DrawPopup("GetGameObjectResourceTrees"u8, ref _lastGameObjectResourceTrees, DrawResourceTrees,
_lastCallDuration);
DrawPopup("GetPlayerResourceTrees"u8, ref _lastPlayerResourceTrees, DrawResourceTrees!, _lastCallDuration);
} }
private static void DrawPopup<T>(ReadOnlySpan<byte> popupId, ref T? result, Action<T> drawResult, TimeSpan duration) where T : class private static void DrawPopup<T>(ReadOnlySpan<byte> popupId, ref T? result, Action<T> drawResult, TimeSpan duration) where T : class

View file

@ -45,7 +45,7 @@ public class TemporaryIpcTester(
Im.Input.Text("##identity"u8, ref _identity, "Identity..."u8); Im.Input.Text("##identity"u8, ref _identity, "Identity..."u8);
Im.Input.Text("##tempCollection"u8, ref _tempCollectionName, "Collection Name..."u8); Im.Input.Text("##tempCollection"u8, ref _tempCollectionName, "Collection Name..."u8);
ImEx.GuidInput("##guid"u8, ref _tempGuid, "Collection GUID..."u8); ImEx.GuidInput("Collection ID##guid"u8, ref _tempGuid);
Im.Input.Scalar("##tempActorIndex"u8, ref _tempActorIndex); Im.Input.Scalar("##tempActorIndex"u8, ref _tempActorIndex);
Im.Input.Text("##tempMod"u8, ref _tempModName, "Temporary Mod Name..."u8); Im.Input.Text("##tempMod"u8, ref _tempModName, "Temporary Mod Name..."u8);
Im.Input.Text("##mod"u8, ref _modDirectory, "Existing Mod Name..."u8); Im.Input.Text("##mod"u8, ref _modDirectory, "Existing Mod Name..."u8);
@ -58,40 +58,57 @@ public class TemporaryIpcTester(
if (!table) if (!table)
return; return;
IpcTester.DrawIntro("Last Error", $"{_lastTempError}"); using (IpcTester.DrawIntro("Last Error", $"{_lastTempError}"))
{
table.DrawColumn("Last Created Collection"u8); table.DrawColumn("Last Created Collection"u8);
table.NextColumn(); table.NextColumn();
LunaStyle.DrawGuid(LastCreatedCollectionId); LunaStyle.DrawGuid(LastCreatedCollectionId);
}
IpcTester.DrawIntro(CreateTemporaryCollection.Label, "Create Temporary Collection"u8); using (IpcTester.DrawIntro(CreateTemporaryCollection.Label, "Create Temporary Collection"u8))
if (Im.Button("Create##Collection"u8)) {
table.NextColumn();
if (Im.SmallButton("Create##Collection"u8))
{ {
_lastTempError = new CreateTemporaryCollection(pi).Invoke(_identity, _tempCollectionName, out LastCreatedCollectionId); _lastTempError = new CreateTemporaryCollection(pi).Invoke(_identity, _tempCollectionName, out LastCreatedCollectionId);
if (_tempGuid is null) if (_tempGuid is null)
_tempGuid = LastCreatedCollectionId; _tempGuid = LastCreatedCollectionId;
} }
}
var guid = _tempGuid.GetValueOrDefault(Guid.Empty); var guid = _tempGuid.GetValueOrDefault(Guid.Empty);
IpcTester.DrawIntro(DeleteTemporaryCollection.Label, "Delete Temporary Collection"u8); using (IpcTester.DrawIntro(DeleteTemporaryCollection.Label, "Delete Temporary Collection"u8))
if (Im.Button("Delete##Collection"u8)) {
table.NextColumn();
if (Im.SmallButton("Delete##Collection"u8))
_lastTempError = new DeleteTemporaryCollection(pi).Invoke(guid); _lastTempError = new DeleteTemporaryCollection(pi).Invoke(guid);
Im.Line.Same(); Im.Line.Same();
if (Im.Button("Delete Last##Collection"u8)) if (Im.SmallButton("Delete Last##Collection"u8))
_lastTempError = new DeleteTemporaryCollection(pi).Invoke(LastCreatedCollectionId); _lastTempError = new DeleteTemporaryCollection(pi).Invoke(LastCreatedCollectionId);
}
IpcTester.DrawIntro(AssignTemporaryCollection.Label, "Assign Temporary Collection"u8); using (IpcTester.DrawIntro(AssignTemporaryCollection.Label, "Assign Temporary Collection"u8))
if (Im.Button("Assign##NamedCollection"u8)) {
table.NextColumn();
if (Im.SmallButton("Assign##NamedCollection"u8))
_lastTempError = new AssignTemporaryCollection(pi).Invoke(guid, _tempActorIndex, _forceOverwrite); _lastTempError = new AssignTemporaryCollection(pi).Invoke(guid, _tempActorIndex, _forceOverwrite);
}
IpcTester.DrawIntro(AddTemporaryMod.Label, "Add Temporary Mod to specific Collection"u8); using (IpcTester.DrawIntro(AddTemporaryMod.Label, "Add Temporary Mod to specific Collection"u8))
if (Im.Button("Add##Mod"u8)) {
table.NextColumn();
if (Im.SmallButton("Add##Mod"u8))
_lastTempError = new AddTemporaryMod(pi).Invoke(_tempModName, guid, _lastTempError = new AddTemporaryMod(pi).Invoke(_tempModName, guid,
new Dictionary<string, string> { { _tempGamePath, _tempFilePath } }, new Dictionary<string, string> { { _tempGamePath, _tempFilePath } },
_tempManipulation.Length > 0 ? _tempManipulation : string.Empty, int.MaxValue); _tempManipulation.Length > 0 ? _tempManipulation : string.Empty, int.MaxValue);
}
IpcTester.DrawIntro(CreateTemporaryCollection.Label, "Copy Existing Collection"u8); using (IpcTester.DrawIntro(CreateTemporaryCollection.Label, "Copy Existing Collection"u8))
if (ImEx.Button("Copy##Collection"u8, Vector2.Zero, "Copies the effective list from the collection named in Temporary Mod Name..."u8, {
table.NextColumn();
if (ImEx.Button("Copy##Collection"u8, Vector2.Zero,
"Copies the effective list from the collection named in Temporary Mod Name..."u8,
!collections.Storage.ByName(_tempModName, out var copyCollection)) !collections.Storage.ByName(_tempModName, out var copyCollection))
&& copyCollection is { HasCache: true }) && copyCollection is { HasCache: true })
{ {
@ -99,63 +116,94 @@ public class TemporaryIpcTester(
var manips = MetaApi.CompressMetaManipulations(copyCollection); var manips = MetaApi.CompressMetaManipulations(copyCollection);
_lastTempError = new AddTemporaryMod(pi).Invoke(_tempModName, guid, files, manips, 999); _lastTempError = new AddTemporaryMod(pi).Invoke(_tempModName, guid, files, manips, 999);
} }
}
IpcTester.DrawIntro(AddTemporaryModAll.Label, "Add Temporary Mod to all Collections"u8); using (IpcTester.DrawIntro(AddTemporaryModAll.Label, "Add Temporary Mod to all Collections"u8))
if (Im.Button("Add##All"u8)) {
table.NextColumn();
if (Im.SmallButton("Add##All"u8))
_lastTempError = new AddTemporaryModAll(pi).Invoke(_tempModName, _lastTempError = new AddTemporaryModAll(pi).Invoke(_tempModName,
new Dictionary<string, string> { { _tempGamePath, _tempFilePath } }, new Dictionary<string, string> { { _tempGamePath, _tempFilePath } },
_tempManipulation.Length > 0 ? _tempManipulation : string.Empty, int.MaxValue); _tempManipulation.Length > 0 ? _tempManipulation : string.Empty, int.MaxValue);
}
IpcTester.DrawIntro(RemoveTemporaryMod.Label, "Remove Temporary Mod from specific Collection"u8); using (IpcTester.DrawIntro(RemoveTemporaryMod.Label, "Remove Temporary Mod from specific Collection"u8))
if (Im.Button("Remove##Mod"u8)) {
table.NextColumn();
if (Im.SmallButton("Remove##Mod"u8))
_lastTempError = new RemoveTemporaryMod(pi).Invoke(_tempModName, guid, int.MaxValue); _lastTempError = new RemoveTemporaryMod(pi).Invoke(_tempModName, guid, int.MaxValue);
}
IpcTester.DrawIntro(RemoveTemporaryModAll.Label, "Remove Temporary Mod from all Collections"u8); using (IpcTester.DrawIntro(RemoveTemporaryModAll.Label, "Remove Temporary Mod from all Collections"u8))
if (Im.Button("Remove##ModAll"u8)) {
table.NextColumn();
if (Im.SmallButton("Remove##ModAll"u8))
_lastTempError = new RemoveTemporaryModAll(pi).Invoke(_tempModName, int.MaxValue); _lastTempError = new RemoveTemporaryModAll(pi).Invoke(_tempModName, int.MaxValue);
}
IpcTester.DrawIntro(SetTemporaryModSettings.Label, "Set Temporary Mod Settings (to default) in specific Collection"u8); using (IpcTester.DrawIntro(SetTemporaryModSettings.Label, "Set Temporary Mod Settings (to default) in specific Collection"u8))
if (Im.Button("Set##SetTemporary"u8)) {
table.NextColumn();
if (Im.SmallButton("Set##SetTemporary"u8))
_lastTempError = new SetTemporaryModSettings(pi).Invoke(guid, _modDirectory, false, true, 1337, _lastTempError = new SetTemporaryModSettings(pi).Invoke(guid, _modDirectory, false, true, 1337,
new Dictionary<string, IReadOnlyList<string>>(), new Dictionary<string, IReadOnlyList<string>>(),
"IPC Tester", 1337); "IPC Tester", 1337);
}
IpcTester.DrawIntro(SetTemporaryModSettingsPlayer.Label, "Set Temporary Mod Settings (to default) in game object collection"u8); using (IpcTester.DrawIntro(SetTemporaryModSettingsPlayer.Label, "Set Temporary Mod Settings (to default) in game object collection"u8))
if (Im.Button("Set##SetTemporaryPlayer"u8)) {
table.NextColumn();
if (Im.SmallButton("Set##SetTemporaryPlayer"u8))
_lastTempError = new SetTemporaryModSettingsPlayer(pi).Invoke(_tempActorIndex, _modDirectory, false, true, 1337, _lastTempError = new SetTemporaryModSettingsPlayer(pi).Invoke(_tempActorIndex, _modDirectory, false, true, 1337,
new Dictionary<string, IReadOnlyList<string>>(), new Dictionary<string, IReadOnlyList<string>>(),
"IPC Tester", 1337); "IPC Tester", 1337);
}
IpcTester.DrawIntro(RemoveTemporaryModSettings.Label, "Remove Temporary Mod Settings from specific Collection"u8); using (IpcTester.DrawIntro(RemoveTemporaryModSettings.Label, "Remove Temporary Mod Settings from specific Collection"u8))
if (Im.Button("Remove##RemoveTemporary"u8)) {
table.NextColumn();
if (Im.SmallButton("Remove##RemoveTemporary"u8))
_lastTempError = new RemoveTemporaryModSettings(pi).Invoke(guid, _modDirectory, 1337); _lastTempError = new RemoveTemporaryModSettings(pi).Invoke(guid, _modDirectory, 1337);
Im.Line.Same(); Im.Line.Same();
if (Im.Button("Remove (Wrong Key)##RemoveTemporary"u8)) if (Im.SmallButton("Remove (Wrong Key)##RemoveTemporary"u8))
_lastTempError = new RemoveTemporaryModSettings(pi).Invoke(guid, _modDirectory, 1338); _lastTempError = new RemoveTemporaryModSettings(pi).Invoke(guid, _modDirectory, 1338);
}
IpcTester.DrawIntro(RemoveTemporaryModSettingsPlayer.Label, "Remove Temporary Mod Settings from game object Collection"u8); using (IpcTester.DrawIntro(RemoveTemporaryModSettingsPlayer.Label, "Remove Temporary Mod Settings from game object Collection"u8))
if (Im.Button("Remove##RemoveTemporaryPlayer"u8)) {
table.NextColumn();
if (Im.SmallButton("Remove##RemoveTemporaryPlayer"u8))
_lastTempError = new RemoveTemporaryModSettingsPlayer(pi).Invoke(_tempActorIndex, _modDirectory, 1337); _lastTempError = new RemoveTemporaryModSettingsPlayer(pi).Invoke(_tempActorIndex, _modDirectory, 1337);
Im.Line.Same(); Im.Line.Same();
if (Im.Button("Remove (Wrong Key)##RemoveTemporaryPlayer"u8)) if (Im.SmallButton("Remove (Wrong Key)##RemoveTemporaryPlayer"u8))
_lastTempError = new RemoveTemporaryModSettingsPlayer(pi).Invoke(_tempActorIndex, _modDirectory, 1338); _lastTempError = new RemoveTemporaryModSettingsPlayer(pi).Invoke(_tempActorIndex, _modDirectory, 1338);
}
IpcTester.DrawIntro(RemoveAllTemporaryModSettings.Label, "Remove All Temporary Mod Settings from specific Collection"u8); using (IpcTester.DrawIntro(RemoveAllTemporaryModSettings.Label, "Remove All Temporary Mod Settings from specific Collection"u8))
if (Im.Button("Remove##RemoveAllTemporary"u8)) {
table.NextColumn();
if (Im.SmallButton("Remove##RemoveAllTemporary"u8))
_lastTempError = new RemoveAllTemporaryModSettings(pi).Invoke(guid, 1337); _lastTempError = new RemoveAllTemporaryModSettings(pi).Invoke(guid, 1337);
Im.Line.Same(); Im.Line.Same();
if (Im.Button("Remove (Wrong Key)##RemoveAllTemporary"u8)) if (Im.SmallButton("Remove (Wrong Key)##RemoveAllTemporary"u8))
_lastTempError = new RemoveAllTemporaryModSettings(pi).Invoke(guid, 1338); _lastTempError = new RemoveAllTemporaryModSettings(pi).Invoke(guid, 1338);
}
IpcTester.DrawIntro(RemoveAllTemporaryModSettingsPlayer.Label, "Remove All Temporary Mod Settings from game object Collection"u8); using (IpcTester.DrawIntro(RemoveAllTemporaryModSettingsPlayer.Label,
if (Im.Button("Remove##RemoveAllTemporaryPlayer"u8)) "Remove All Temporary Mod Settings from game object Collection"u8))
{
table.NextColumn();
if (Im.SmallButton("Remove##RemoveAllTemporaryPlayer"u8))
_lastTempError = new RemoveAllTemporaryModSettingsPlayer(pi).Invoke(_tempActorIndex, 1337); _lastTempError = new RemoveAllTemporaryModSettingsPlayer(pi).Invoke(_tempActorIndex, 1337);
Im.Line.Same(); Im.Line.Same();
if (Im.Button("Remove (Wrong Key)##RemoveAllTemporaryPlayer"u8)) if (Im.SmallButton("Remove (Wrong Key)##RemoveAllTemporaryPlayer"u8))
_lastTempError = new RemoveAllTemporaryModSettingsPlayer(pi).Invoke(_tempActorIndex, 1338); _lastTempError = new RemoveAllTemporaryModSettingsPlayer(pi).Invoke(_tempActorIndex, 1338);
}
IpcTester.DrawIntro(QueryTemporaryModSettings.Label, "Query Temporary Mod Settings from specific Collection"u8); using (IpcTester.DrawIntro(QueryTemporaryModSettings.Label, "Query Temporary Mod Settings from specific Collection"u8))
Im.Button("Query##QueryTemporaryModSettings"u8); {
table.NextColumn();
Im.SmallButton("Query##QueryTemporaryModSettings"u8);
if (Im.Item.Hovered()) if (Im.Item.Hovered())
{ {
_lastTempError = new QueryTemporaryModSettings(pi).Invoke(guid, _modDirectory, out var settings, out var source, 1337); _lastTempError = new QueryTemporaryModSettings(pi).Invoke(guid, _modDirectory, out var settings, out var source, 1337);
@ -163,15 +211,18 @@ public class TemporaryIpcTester(
} }
Im.Line.Same(); Im.Line.Same();
Im.Button("Query (Wrong Key)##RemoveAllTemporary"u8); Im.SmallButton("Query (Wrong Key)##RemoveAllTemporary"u8);
if (Im.Item.Hovered()) if (Im.Item.Hovered())
{ {
_lastTempError = new QueryTemporaryModSettings(pi).Invoke(guid, _modDirectory, out var settings, out var source, 1338); _lastTempError = new QueryTemporaryModSettings(pi).Invoke(guid, _modDirectory, out var settings, out var source, 1338);
DrawTooltip(settings, source); DrawTooltip(settings, source);
} }
}
IpcTester.DrawIntro(QueryTemporaryModSettingsPlayer.Label, "Query Temporary Mod Settings from game object Collection"u8); using (IpcTester.DrawIntro(QueryTemporaryModSettingsPlayer.Label, "Query Temporary Mod Settings from game object Collection"u8))
Im.Button("Query##QueryTemporaryModSettingsPlayer"u8); {
table.NextColumn();
Im.SmallButton("Query##QueryTemporaryModSettingsPlayer"u8);
if (Im.Item.Hovered()) if (Im.Item.Hovered())
{ {
_lastTempError = _lastTempError =
@ -180,13 +231,14 @@ public class TemporaryIpcTester(
} }
Im.Line.Same(); Im.Line.Same();
Im.Button("Query (Wrong Key)##RemoveAllTemporaryPlayer"u8); Im.SmallButton("Query (Wrong Key)##RemoveAllTemporaryPlayer"u8);
if (Im.Item.Hovered()) if (Im.Item.Hovered())
{ {
_lastTempError = _lastTempError =
new QueryTemporaryModSettingsPlayer(pi).Invoke(_tempActorIndex, _modDirectory, out var settings, out var source, 1338); new QueryTemporaryModSettingsPlayer(pi).Invoke(_tempActorIndex, _modDirectory, out var settings, out var source, 1338);
DrawTooltip(settings, source); DrawTooltip(settings, source);
} }
}
return; return;

View file

@ -60,16 +60,20 @@ public class UiIpcTester : Luna.IUiService, IDisposable
if (!_) if (!_)
return; return;
EnumCombo<TabType>.Instance.Draw("Tab to Open at"u8, ref _selectTab, default, 0);
Im.Input.Text("##openMod"u8, ref _modName, "Mod to Open at..."u8); Im.Input.Text("##openMod"u8, ref _modName, "Mod to Open at..."u8);
EnumCombo<TabType>.Instance.Draw("Tab to Open at"u8, ref _selectTab, default, Im.Item.CalculateWidth());
using var table = Im.Table.Begin(StringU8.Empty, 3, TableFlags.SizingFixedFit); using var table = Im.Table.Begin(StringU8.Empty, 3, TableFlags.SizingFixedFit);
if (!table) if (!table)
return; return;
IpcTester.DrawIntro(PostSettingsDraw.Label, "Last Drawn Mod"u8); using (IpcTester.DrawIntro(PostSettingsDraw.Label, "Last Drawn Mod"u8))
Im.Text(_lastDrawnMod.Length > 0 ? $"{_lastDrawnMod} at {_lastDrawnModTime}" : "None"u8); {
table.DrawColumn(_lastDrawnMod.Length > 0 ? $"{_lastDrawnMod} at {_lastDrawnModTime}" : "None"u8);
}
IpcTester.DrawIntro(IpcSubscribers.ChangedItemTooltip.Label, "Add Tooltip"u8); using (IpcTester.DrawIntro(IpcSubscribers.ChangedItemTooltip.Label, "Add Tooltip"u8))
{
table.NextColumn();
if (Im.Checkbox("##tooltip"u8, ref _subscribedToTooltip)) if (Im.Checkbox("##tooltip"u8, ref _subscribedToTooltip))
{ {
if (_subscribedToTooltip) if (_subscribedToTooltip)
@ -79,9 +83,12 @@ public class UiIpcTester : Luna.IUiService, IDisposable
} }
Im.Line.Same(); Im.Line.Same();
Im.Text(_lastHovered); ImEx.TextFrameAligned(_lastHovered);
}
IpcTester.DrawIntro(IpcSubscribers.ChangedItemClicked.Label, "Subscribe Click"u8); using (IpcTester.DrawIntro(IpcSubscribers.ChangedItemClicked.Label, "Subscribe Click"u8))
{
table.NextColumn();
if (Im.Checkbox("##click"u8, ref _subscribedToClick)) if (Im.Checkbox("##click"u8, ref _subscribedToClick))
{ {
if (_subscribedToClick) if (_subscribedToClick)
@ -91,18 +98,26 @@ public class UiIpcTester : Luna.IUiService, IDisposable
} }
Im.Line.Same(); Im.Line.Same();
Im.Text(_lastClicked); ImEx.TextFrameAligned(_lastClicked);
IpcTester.DrawIntro(OpenMainWindow.Label, "Open Mod Window"u8); }
if (Im.Button("Open##window"u8))
using (IpcTester.DrawIntro(OpenMainWindow.Label, "Open Mod Window"u8))
{
table.NextColumn();
if (Im.SmallButton("Open##window"u8))
_ec = new OpenMainWindow(_pi).Invoke(_selectTab, _modName, _modName); _ec = new OpenMainWindow(_pi).Invoke(_selectTab, _modName, _modName);
Im.Line.Same(); Im.Line.Same();
Im.Text($"{_ec}"); Im.Text($"{_ec}");
}
IpcTester.DrawIntro(CloseMainWindow.Label, "Close Mod Window"u8); using (IpcTester.DrawIntro(CloseMainWindow.Label, "Close Mod Window"u8))
if (Im.Button("Close##window"u8)) {
table.NextColumn();
if (Im.SmallButton("Close##window"u8))
new CloseMainWindow(_pi).Invoke(); new CloseMainWindow(_pi).Invoke();
} }
}
private void UpdateLastDrawnMod(string name) private void UpdateLastDrawnMod(string name)
=> (_lastDrawnMod, _lastDrawnModTime) = (new StringU8(name), DateTimeOffset.Now); => (_lastDrawnMod, _lastDrawnModTime) = (new StringU8(name), DateTimeOffset.Now);