mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-14 20:54:16 +01:00
Some small fixes, parse directly into MetaDictionary.
This commit is contained in:
parent
0445ed0ef9
commit
d9b63320f0
5 changed files with 17 additions and 30 deletions
|
|
@ -159,8 +159,7 @@ public class TemporaryApi(
|
|||
/// The empty string is treated as an empty set.
|
||||
/// Only returns true if all conversions are successful and distinct.
|
||||
/// </summary>
|
||||
private static bool ConvertManips(string manipString,
|
||||
[NotNullWhen(true)] out MetaDictionary? manips)
|
||||
private static bool ConvertManips(string manipString, [NotNullWhen(true)] out MetaDictionary? manips)
|
||||
{
|
||||
if (manipString.Length == 0)
|
||||
{
|
||||
|
|
@ -168,23 +167,10 @@ public class TemporaryApi(
|
|||
return true;
|
||||
}
|
||||
|
||||
if (Functions.FromCompressedBase64<MetaManipulation[]>(manipString, out var manipArray) != MetaManipulation.CurrentVersion)
|
||||
{
|
||||
manips = null;
|
||||
return false;
|
||||
}
|
||||
if (Functions.FromCompressedBase64(manipString, out manips!) == MetaManipulation.CurrentVersion)
|
||||
return true;
|
||||
|
||||
manips = [];
|
||||
foreach (var manip in manipArray!.Where(m => m.Validate()))
|
||||
{
|
||||
if (manips.Add(manip))
|
||||
continue;
|
||||
|
||||
Penumbra.Log.Warning($"Manipulation {manip} {manip.EntryToString()} is invalid and was skipped.");
|
||||
manips = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
manips = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using ImGuiNET;
|
|||
using OtterGui;
|
||||
using OtterGui.Raii;
|
||||
using OtterGui.Services;
|
||||
using OtterGui.Text;
|
||||
using Penumbra.Api.Enums;
|
||||
using Penumbra.Api.IpcSubscribers;
|
||||
using Penumbra.Collections.Manager;
|
||||
|
|
@ -49,7 +50,7 @@ public class TemporaryIpcTester(
|
|||
ImGui.InputTextWithHint("##tempMod", "Temporary Mod Name...", ref _tempModName, 32);
|
||||
ImGui.InputTextWithHint("##tempGame", "Game Path...", ref _tempGamePath, 256);
|
||||
ImGui.InputTextWithHint("##tempFile", "File Path...", ref _tempFilePath, 256);
|
||||
ImGui.InputTextWithHint("##tempManip", "Manipulation Base64 String...", ref _tempManipulation, 256);
|
||||
ImUtf8.InputText("##tempManip"u8, ref _tempManipulation, "Manipulation Base64 String..."u8);
|
||||
ImGui.Checkbox("Force Character Collection Overwrite", ref _forceOverwrite);
|
||||
|
||||
using var table = ImRaii.Table(string.Empty, 3, ImGuiTableFlags.SizingFixedFit);
|
||||
|
|
|
|||
|
|
@ -52,16 +52,16 @@ public sealed class MetaDictionary : IEnumerable<MetaManipulation>
|
|||
IEnumerator IEnumerable.GetEnumerator()
|
||||
=> GetEnumerator();
|
||||
|
||||
public bool Add(IMetaIdentifier identifier, object entry)
|
||||
public bool TryAdd(IMetaIdentifier identifier, object entry)
|
||||
=> identifier switch
|
||||
{
|
||||
EqdpIdentifier eqdpIdentifier => entry is EqdpEntryInternal e && Add(eqdpIdentifier, e),
|
||||
EqpIdentifier eqpIdentifier => entry is EqpEntryInternal e && Add(eqpIdentifier, e),
|
||||
EstIdentifier estIdentifier => entry is EstEntry e && Add(estIdentifier, e),
|
||||
GlobalEqpManipulation globalEqpManipulation => Add(globalEqpManipulation),
|
||||
GmpIdentifier gmpIdentifier => entry is GmpEntry e && Add(gmpIdentifier, e),
|
||||
ImcIdentifier imcIdentifier => entry is ImcEntry e && Add(imcIdentifier, e),
|
||||
RspIdentifier rspIdentifier => entry is RspEntry e && Add(rspIdentifier, e),
|
||||
EqdpIdentifier eqdpIdentifier => entry is EqdpEntryInternal e && TryAdd(eqdpIdentifier, e),
|
||||
EqpIdentifier eqpIdentifier => entry is EqpEntryInternal e && TryAdd(eqpIdentifier, e),
|
||||
EstIdentifier estIdentifier => entry is EstEntry e && TryAdd(estIdentifier, e),
|
||||
GlobalEqpManipulation globalEqpManipulation => TryAdd(globalEqpManipulation),
|
||||
GmpIdentifier gmpIdentifier => entry is GmpEntry e && TryAdd(gmpIdentifier, e),
|
||||
ImcIdentifier imcIdentifier => entry is ImcEntry e && TryAdd(imcIdentifier, e),
|
||||
RspIdentifier rspIdentifier => entry is RspEntry e && TryAdd(rspIdentifier, e),
|
||||
_ => false,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ public class ItemSwapContainer
|
|||
break;
|
||||
case IMetaSwap meta:
|
||||
if (!meta.SwapAppliedIsDefault)
|
||||
convertedManips.Add(meta.SwapFromIdentifier, meta.SwapToModdedEntry);
|
||||
convertedManips.TryAdd(meta.SwapFromIdentifier, meta.SwapToModdedEntry);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -432,7 +432,7 @@ public class DebugTab : Window, ITab
|
|||
|
||||
foreach (var obj in _objects)
|
||||
{
|
||||
ImGuiUtil.DrawTableColumn($"{((GameObject*)obj.Address)->ObjectIndex}");
|
||||
ImGuiUtil.DrawTableColumn(obj.Address == nint.Zero ? $"{((GameObject*)obj.Address)->ObjectIndex}" : "NULL");
|
||||
ImGuiUtil.DrawTableColumn($"0x{obj.Address:X}");
|
||||
ImGuiUtil.DrawTableColumn(obj.Address == nint.Zero
|
||||
? string.Empty
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue