mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-22 00:19:19 +01:00
Some further cleanup.
This commit is contained in:
parent
70e72f5790
commit
b53a2f1def
24 changed files with 90 additions and 112 deletions
|
|
@ -3,6 +3,7 @@ using Penumbra.Collections;
|
||||||
using Penumbra.Collections.Manager;
|
using Penumbra.Collections.Manager;
|
||||||
using Penumbra.Communication;
|
using Penumbra.Communication;
|
||||||
using Penumbra.Mods;
|
using Penumbra.Mods;
|
||||||
|
using Penumbra.Mods.Editor;
|
||||||
using Penumbra.Services;
|
using Penumbra.Services;
|
||||||
using Penumbra.String.Classes;
|
using Penumbra.String.Classes;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ using Penumbra.Meta.Manipulations;
|
||||||
using Penumbra.Mods;
|
using Penumbra.Mods;
|
||||||
using Penumbra.Api.Enums;
|
using Penumbra.Api.Enums;
|
||||||
using Penumbra.Communication;
|
using Penumbra.Communication;
|
||||||
|
using Penumbra.Mods.Editor;
|
||||||
using Penumbra.String.Classes;
|
using Penumbra.String.Classes;
|
||||||
using Penumbra.Mods.Manager;
|
using Penumbra.Mods.Manager;
|
||||||
using Penumbra.Mods.Subclasses;
|
using Penumbra.Mods.Subclasses;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using Penumbra.Meta.Manipulations;
|
using Penumbra.Meta.Manipulations;
|
||||||
using Penumbra.Mods;
|
using Penumbra.Mods;
|
||||||
|
using Penumbra.Mods.Editor;
|
||||||
using Penumbra.String.Classes;
|
using Penumbra.String.Classes;
|
||||||
|
|
||||||
namespace Penumbra.Collections.Cache;
|
namespace Penumbra.Collections.Cache;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ using Penumbra.Interop.Structs;
|
||||||
using Penumbra.Meta;
|
using Penumbra.Meta;
|
||||||
using Penumbra.Meta.Manipulations;
|
using Penumbra.Meta.Manipulations;
|
||||||
using Penumbra.Mods;
|
using Penumbra.Mods;
|
||||||
|
using Penumbra.Mods.Editor;
|
||||||
using Penumbra.String.Classes;
|
using Penumbra.String.Classes;
|
||||||
|
|
||||||
namespace Penumbra.Collections.Cache;
|
namespace Penumbra.Collections.Cache;
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ using Penumbra.Meta.Manipulations;
|
||||||
using Penumbra.String.Classes;
|
using Penumbra.String.Classes;
|
||||||
using Penumbra.Collections.Cache;
|
using Penumbra.Collections.Cache;
|
||||||
using Penumbra.Interop.Services;
|
using Penumbra.Interop.Services;
|
||||||
|
using Penumbra.Mods.Editor;
|
||||||
|
|
||||||
namespace Penumbra.Collections;
|
namespace Penumbra.Collections;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using OtterGui.Classes;
|
using OtterGui.Classes;
|
||||||
using Penumbra.Collections;
|
using Penumbra.Collections;
|
||||||
using Penumbra.Mods;
|
using Penumbra.Mods;
|
||||||
|
using Penumbra.Mods.Editor;
|
||||||
using Penumbra.String.Classes;
|
using Penumbra.String.Classes;
|
||||||
|
|
||||||
namespace Penumbra.Communication;
|
namespace Penumbra.Communication;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using Dalamud.Hooking;
|
using Dalamud.Hooking;
|
||||||
using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle;
|
|
||||||
using OtterGui.Services;
|
using OtterGui.Services;
|
||||||
|
|
||||||
namespace Penumbra.Interop.Hooks;
|
namespace Penumbra.Interop.Hooks;
|
||||||
|
|
@ -32,12 +31,12 @@ public sealed unsafe class DebugHook : IHookService
|
||||||
public bool Finished
|
public bool Finished
|
||||||
=> _task?.IsCompletedSuccessfully ?? true;
|
=> _task?.IsCompletedSuccessfully ?? true;
|
||||||
|
|
||||||
private delegate nint Delegate(ResourceHandle* resourceHandle);
|
private delegate void Delegate(nint a, int b, nint c, float* d);
|
||||||
|
|
||||||
private nint Detour(ResourceHandle* resourceHandle)
|
private void Detour(nint a, int b, nint c, float* d)
|
||||||
{
|
{
|
||||||
Penumbra.Log.Information($"[Debug Hook] Triggered with 0x{(nint)resourceHandle:X}.");
|
_task!.Result.Original(a, b, c, d);
|
||||||
return _task!.Result.Original(resourceHandle);
|
Penumbra.Log.Information($"[Debug Hook] Results with 0x{a:X} {b} {c:X} {d[0]} {d[1]} {d[2]} {d[3]}.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
using OtterGui.Services;
|
|
||||||
using Penumbra.Mods.Manager;
|
using Penumbra.Mods.Manager;
|
||||||
using Penumbra.Mods.Subclasses;
|
using Penumbra.Mods.Subclasses;
|
||||||
using Penumbra.Services;
|
using Penumbra.Services;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using OtterGui.Classes;
|
using OtterGui.Classes;
|
||||||
using Penumbra.Mods.Subclasses;
|
using Penumbra.Mods.Subclasses;
|
||||||
|
|
||||||
namespace Penumbra.Mods;
|
namespace Penumbra.Mods.Editor;
|
||||||
|
|
||||||
public interface IMod
|
public interface IMod
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,25 +2,19 @@ using OtterGui;
|
||||||
using OtterGui.Compression;
|
using OtterGui.Compression;
|
||||||
using Penumbra.GameData.Enums;
|
using Penumbra.GameData.Enums;
|
||||||
using Penumbra.GameData.Files;
|
using Penumbra.GameData.Files;
|
||||||
using Penumbra.Mods.Editor;
|
|
||||||
|
|
||||||
namespace Penumbra.Mods;
|
namespace Penumbra.Mods.Editor;
|
||||||
|
|
||||||
public partial class MdlMaterialEditor
|
public partial class MdlMaterialEditor(ModFileCollection files)
|
||||||
{
|
{
|
||||||
[GeneratedRegex(@"/mt_c(?'RaceCode'\d{4})b0001_(?'Suffix'.*?)\.mtrl", RegexOptions.ExplicitCapture | RegexOptions.NonBacktracking)]
|
[GeneratedRegex(@"/mt_c(?'RaceCode'\d{4})b0001_(?'Suffix'.*?)\.mtrl", RegexOptions.ExplicitCapture | RegexOptions.NonBacktracking)]
|
||||||
private static partial Regex MaterialRegex();
|
private static partial Regex MaterialRegex();
|
||||||
|
|
||||||
private readonly ModFileCollection _files;
|
private readonly List<ModelMaterialInfo> _modelFiles = [];
|
||||||
|
|
||||||
private readonly List<ModelMaterialInfo> _modelFiles = new();
|
|
||||||
|
|
||||||
public IReadOnlyList<ModelMaterialInfo> ModelFiles
|
public IReadOnlyList<ModelMaterialInfo> ModelFiles
|
||||||
=> _modelFiles;
|
=> _modelFiles;
|
||||||
|
|
||||||
public MdlMaterialEditor(ModFileCollection files)
|
|
||||||
=> _files = files;
|
|
||||||
|
|
||||||
public void SaveAllModels(FileCompactor compactor)
|
public void SaveAllModels(FileCompactor compactor)
|
||||||
{
|
{
|
||||||
foreach (var info in _modelFiles)
|
foreach (var info in _modelFiles)
|
||||||
|
|
@ -73,7 +67,7 @@ public partial class MdlMaterialEditor
|
||||||
public void ScanModels(Mod mod)
|
public void ScanModels(Mod mod)
|
||||||
{
|
{
|
||||||
_modelFiles.Clear();
|
_modelFiles.Clear();
|
||||||
foreach (var file in _files.Mdl)
|
foreach (var file in files.Mdl)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,16 +4,25 @@ using Penumbra.Mods.Subclasses;
|
||||||
|
|
||||||
namespace Penumbra.Mods.Editor;
|
namespace Penumbra.Mods.Editor;
|
||||||
|
|
||||||
public class ModEditor : IDisposable
|
public class ModEditor(
|
||||||
|
ModNormalizer modNormalizer,
|
||||||
|
ModMetaEditor metaEditor,
|
||||||
|
ModFileCollection files,
|
||||||
|
ModFileEditor fileEditor,
|
||||||
|
DuplicateManager duplicates,
|
||||||
|
ModSwapEditor swapEditor,
|
||||||
|
MdlMaterialEditor mdlMaterialEditor,
|
||||||
|
FileCompactor compactor)
|
||||||
|
: IDisposable
|
||||||
{
|
{
|
||||||
public readonly ModNormalizer ModNormalizer;
|
public readonly ModNormalizer ModNormalizer = modNormalizer;
|
||||||
public readonly ModMetaEditor MetaEditor;
|
public readonly ModMetaEditor MetaEditor = metaEditor;
|
||||||
public readonly ModFileEditor FileEditor;
|
public readonly ModFileEditor FileEditor = fileEditor;
|
||||||
public readonly DuplicateManager Duplicates;
|
public readonly DuplicateManager Duplicates = duplicates;
|
||||||
public readonly ModFileCollection Files;
|
public readonly ModFileCollection Files = files;
|
||||||
public readonly ModSwapEditor SwapEditor;
|
public readonly ModSwapEditor SwapEditor = swapEditor;
|
||||||
public readonly MdlMaterialEditor MdlMaterialEditor;
|
public readonly MdlMaterialEditor MdlMaterialEditor = mdlMaterialEditor;
|
||||||
public readonly FileCompactor Compactor;
|
public readonly FileCompactor Compactor = compactor;
|
||||||
|
|
||||||
public Mod? Mod { get; private set; }
|
public Mod? Mod { get; private set; }
|
||||||
public int GroupIdx { get; private set; }
|
public int GroupIdx { get; private set; }
|
||||||
|
|
@ -22,20 +31,6 @@ public class ModEditor : IDisposable
|
||||||
public IModGroup? Group { get; private set; }
|
public IModGroup? Group { get; private set; }
|
||||||
public ISubMod? Option { get; private set; }
|
public ISubMod? Option { get; private set; }
|
||||||
|
|
||||||
public ModEditor(ModNormalizer modNormalizer, ModMetaEditor metaEditor, ModFileCollection files,
|
|
||||||
ModFileEditor fileEditor, DuplicateManager duplicates, ModSwapEditor swapEditor, MdlMaterialEditor mdlMaterialEditor,
|
|
||||||
FileCompactor compactor)
|
|
||||||
{
|
|
||||||
ModNormalizer = modNormalizer;
|
|
||||||
MetaEditor = metaEditor;
|
|
||||||
Files = files;
|
|
||||||
FileEditor = fileEditor;
|
|
||||||
Duplicates = duplicates;
|
|
||||||
SwapEditor = swapEditor;
|
|
||||||
MdlMaterialEditor = mdlMaterialEditor;
|
|
||||||
Compactor = compactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LoadMod(Mod mod)
|
public void LoadMod(Mod mod)
|
||||||
=> LoadMod(mod, -1, 0);
|
=> LoadMod(mod, -1, 0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,20 @@ namespace Penumbra.Mods.Editor;
|
||||||
|
|
||||||
public class ModFileCollection : IDisposable
|
public class ModFileCollection : IDisposable
|
||||||
{
|
{
|
||||||
private readonly List<FileRegistry> _available = new();
|
private readonly List<FileRegistry> _available = [];
|
||||||
private readonly List<FileRegistry> _mtrl = new();
|
private readonly List<FileRegistry> _mtrl = [];
|
||||||
private readonly List<FileRegistry> _mdl = new();
|
private readonly List<FileRegistry> _mdl = [];
|
||||||
private readonly List<FileRegistry> _tex = new();
|
private readonly List<FileRegistry> _tex = [];
|
||||||
private readonly List<FileRegistry> _shpk = new();
|
private readonly List<FileRegistry> _shpk = [];
|
||||||
|
|
||||||
private readonly SortedSet<FullPath> _missing = new();
|
private readonly SortedSet<FullPath> _missing = [];
|
||||||
private readonly HashSet<Utf8GamePath> _usedPaths = new();
|
private readonly HashSet<Utf8GamePath> _usedPaths = [];
|
||||||
|
|
||||||
public IReadOnlySet<FullPath> Missing
|
public IReadOnlySet<FullPath> Missing
|
||||||
=> Ready ? _missing : new HashSet<FullPath>();
|
=> Ready ? _missing : [];
|
||||||
|
|
||||||
public IReadOnlySet<Utf8GamePath> UsedPaths
|
public IReadOnlySet<Utf8GamePath> UsedPaths
|
||||||
=> Ready ? _usedPaths : new HashSet<Utf8GamePath>();
|
=> Ready ? _usedPaths : [];
|
||||||
|
|
||||||
public IReadOnlyList<FileRegistry> Available
|
public IReadOnlyList<FileRegistry> Available
|
||||||
=> Ready ? _available : Array.Empty<FileRegistry>();
|
=> Ready ? _available : Array.Empty<FileRegistry>();
|
||||||
|
|
@ -38,9 +38,6 @@ public class ModFileCollection : IDisposable
|
||||||
|
|
||||||
public bool Ready { get; private set; } = true;
|
public bool Ready { get; private set; } = true;
|
||||||
|
|
||||||
public ModFileCollection()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
public void UpdateAll(Mod mod, ISubMod option)
|
public void UpdateAll(Mod mod, ISubMod option)
|
||||||
{
|
{
|
||||||
UpdateFiles(mod, new CancellationToken());
|
UpdateFiles(mod, new CancellationToken());
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,13 @@
|
||||||
using Penumbra.Mods.Editor;
|
|
||||||
using Penumbra.Mods.Manager;
|
using Penumbra.Mods.Manager;
|
||||||
using Penumbra.Mods.Subclasses;
|
using Penumbra.Mods.Subclasses;
|
||||||
using Penumbra.String.Classes;
|
using Penumbra.String.Classes;
|
||||||
|
|
||||||
namespace Penumbra.Mods;
|
namespace Penumbra.Mods.Editor;
|
||||||
|
|
||||||
public class ModFileEditor
|
public class ModFileEditor(ModFileCollection files, ModManager modManager)
|
||||||
{
|
{
|
||||||
private readonly ModFileCollection _files;
|
|
||||||
private readonly ModManager _modManager;
|
|
||||||
|
|
||||||
public bool Changes { get; private set; }
|
public bool Changes { get; private set; }
|
||||||
|
|
||||||
public ModFileEditor(ModFileCollection files, ModManager modManager)
|
|
||||||
{
|
|
||||||
_files = files;
|
|
||||||
_modManager = modManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
Changes = false;
|
Changes = false;
|
||||||
|
|
@ -27,21 +17,21 @@ public class ModFileEditor
|
||||||
{
|
{
|
||||||
var dict = new Dictionary<Utf8GamePath, FullPath>();
|
var dict = new Dictionary<Utf8GamePath, FullPath>();
|
||||||
var num = 0;
|
var num = 0;
|
||||||
foreach (var file in _files.Available)
|
foreach (var file in files.Available)
|
||||||
{
|
{
|
||||||
foreach (var path in file.SubModUsage.Where(p => p.Item1 == option))
|
foreach (var path in file.SubModUsage.Where(p => p.Item1 == option))
|
||||||
num += dict.TryAdd(path.Item2, file.File) ? 0 : 1;
|
num += dict.TryAdd(path.Item2, file.File) ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_modManager.OptionEditor.OptionSetFiles(mod, option.GroupIdx, option.OptionIdx, dict);
|
modManager.OptionEditor.OptionSetFiles(mod, option.GroupIdx, option.OptionIdx, dict);
|
||||||
_files.UpdatePaths(mod, option);
|
files.UpdatePaths(mod, option);
|
||||||
Changes = false;
|
Changes = false;
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Revert(Mod mod, ISubMod option)
|
public void Revert(Mod mod, ISubMod option)
|
||||||
{
|
{
|
||||||
_files.UpdateAll(mod, option);
|
files.UpdateAll(mod, option);
|
||||||
Changes = false;
|
Changes = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -53,16 +43,16 @@ public class ModFileEditor
|
||||||
var newDict = subMod.Files.Where(kvp => CheckAgainstMissing(mod, subMod, kvp.Value, kvp.Key, subMod == option))
|
var newDict = subMod.Files.Where(kvp => CheckAgainstMissing(mod, subMod, kvp.Value, kvp.Key, subMod == option))
|
||||||
.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
|
.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
|
||||||
if (newDict.Count != subMod.Files.Count)
|
if (newDict.Count != subMod.Files.Count)
|
||||||
_modManager.OptionEditor.OptionSetFiles(mod, groupIdx, optionIdx, newDict);
|
modManager.OptionEditor.OptionSetFiles(mod, groupIdx, optionIdx, newDict);
|
||||||
}
|
}
|
||||||
|
|
||||||
ModEditor.ApplyToAllOptions(mod, HandleSubMod);
|
ModEditor.ApplyToAllOptions(mod, HandleSubMod);
|
||||||
_files.ClearMissingFiles();
|
files.ClearMissingFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Return whether the given path is already used in the current option. </summary>
|
/// <summary> Return whether the given path is already used in the current option. </summary>
|
||||||
public bool CanAddGamePath(Utf8GamePath path)
|
public bool CanAddGamePath(Utf8GamePath path)
|
||||||
=> !_files.UsedPaths.Contains(path);
|
=> !files.UsedPaths.Contains(path);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Try to set a given path for a given file.
|
/// Try to set a given path for a given file.
|
||||||
|
|
@ -72,17 +62,17 @@ public class ModFileEditor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool SetGamePath(ISubMod option, int fileIdx, int pathIdx, Utf8GamePath path)
|
public bool SetGamePath(ISubMod option, int fileIdx, int pathIdx, Utf8GamePath path)
|
||||||
{
|
{
|
||||||
if (!CanAddGamePath(path) || fileIdx < 0 || fileIdx > _files.Available.Count)
|
if (!CanAddGamePath(path) || fileIdx < 0 || fileIdx > files.Available.Count)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var registry = _files.Available[fileIdx];
|
var registry = files.Available[fileIdx];
|
||||||
if (pathIdx > registry.SubModUsage.Count)
|
if (pathIdx > registry.SubModUsage.Count)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((pathIdx == -1 || pathIdx == registry.SubModUsage.Count) && !path.IsEmpty)
|
if ((pathIdx == -1 || pathIdx == registry.SubModUsage.Count) && !path.IsEmpty)
|
||||||
_files.AddUsedPath(option, registry, path);
|
files.AddUsedPath(option, registry, path);
|
||||||
else
|
else
|
||||||
_files.ChangeUsedPath(registry, pathIdx, path);
|
files.ChangeUsedPath(registry, pathIdx, path);
|
||||||
|
|
||||||
Changes = true;
|
Changes = true;
|
||||||
|
|
||||||
|
|
@ -93,10 +83,10 @@ public class ModFileEditor
|
||||||
/// Transform a set of files to the appropriate game paths with the given number of folders skipped,
|
/// Transform a set of files to the appropriate game paths with the given number of folders skipped,
|
||||||
/// and add them to the given option.
|
/// and add them to the given option.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int AddPathsToSelected(ISubMod option, IEnumerable<FileRegistry> files, int skipFolders = 0)
|
public int AddPathsToSelected(ISubMod option, IEnumerable<FileRegistry> files1, int skipFolders = 0)
|
||||||
{
|
{
|
||||||
var failed = 0;
|
var failed = 0;
|
||||||
foreach (var file in files)
|
foreach (var file in files1)
|
||||||
{
|
{
|
||||||
var gamePath = file.RelPath.ToGamePath(skipFolders);
|
var gamePath = file.RelPath.ToGamePath(skipFolders);
|
||||||
if (gamePath.IsEmpty)
|
if (gamePath.IsEmpty)
|
||||||
|
|
@ -107,7 +97,7 @@ public class ModFileEditor
|
||||||
|
|
||||||
if (CanAddGamePath(gamePath))
|
if (CanAddGamePath(gamePath))
|
||||||
{
|
{
|
||||||
_files.AddUsedPath(option, file, gamePath);
|
files.AddUsedPath(option, file, gamePath);
|
||||||
Changes = true;
|
Changes = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -120,9 +110,9 @@ public class ModFileEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Remove all paths in the current option from the given files. </summary>
|
/// <summary> Remove all paths in the current option from the given files. </summary>
|
||||||
public void RemovePathsFromSelected(ISubMod option, IEnumerable<FileRegistry> files)
|
public void RemovePathsFromSelected(ISubMod option, IEnumerable<FileRegistry> files1)
|
||||||
{
|
{
|
||||||
foreach (var file in files)
|
foreach (var file in files1)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < file.SubModUsage.Count; ++i)
|
for (var i = 0; i < file.SubModUsage.Count; ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -130,7 +120,7 @@ public class ModFileEditor
|
||||||
if (option != opt)
|
if (option != opt)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
_files.RemoveUsedPath(option, file, path);
|
files.RemoveUsedPath(option, file, path);
|
||||||
Changes = true;
|
Changes = true;
|
||||||
--i;
|
--i;
|
||||||
}
|
}
|
||||||
|
|
@ -138,10 +128,10 @@ public class ModFileEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Delete all given files from your filesystem </summary>
|
/// <summary> Delete all given files from your filesystem </summary>
|
||||||
public void DeleteFiles(Mod mod, ISubMod option, IEnumerable<FileRegistry> files)
|
public void DeleteFiles(Mod mod, ISubMod option, IEnumerable<FileRegistry> files1)
|
||||||
{
|
{
|
||||||
var deletions = 0;
|
var deletions = 0;
|
||||||
foreach (var file in files)
|
foreach (var file in files1)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -158,18 +148,18 @@ public class ModFileEditor
|
||||||
if (deletions <= 0)
|
if (deletions <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_modManager.Creator.ReloadMod(mod, false, out _);
|
modManager.Creator.ReloadMod(mod, false, out _);
|
||||||
_files.UpdateAll(mod, option);
|
files.UpdateAll(mod, option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private bool CheckAgainstMissing(Mod mod, ISubMod option, FullPath file, Utf8GamePath key, bool removeUsed)
|
private bool CheckAgainstMissing(Mod mod, ISubMod option, FullPath file, Utf8GamePath key, bool removeUsed)
|
||||||
{
|
{
|
||||||
if (!_files.Missing.Contains(file))
|
if (!files.Missing.Contains(file))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (removeUsed)
|
if (removeUsed)
|
||||||
_files.RemoveUsedPath(option, file, key);
|
files.RemoveUsedPath(option, file, key);
|
||||||
|
|
||||||
Penumbra.Log.Debug($"[RemoveMissingPaths] Removing {key} -> {file} from {mod.Name}.");
|
Penumbra.Log.Debug($"[RemoveMissingPaths] Removing {key} -> {file} from {mod.Name}.");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -4,16 +4,14 @@ using Penumbra.Mods.Subclasses;
|
||||||
|
|
||||||
namespace Penumbra.Mods;
|
namespace Penumbra.Mods;
|
||||||
|
|
||||||
public class ModMetaEditor
|
public class ModMetaEditor(ModManager modManager)
|
||||||
{
|
{
|
||||||
private readonly ModManager _modManager;
|
private readonly HashSet<ImcManipulation> _imc = [];
|
||||||
|
private readonly HashSet<EqpManipulation> _eqp = [];
|
||||||
private readonly HashSet<ImcManipulation> _imc = new();
|
private readonly HashSet<EqdpManipulation> _eqdp = [];
|
||||||
private readonly HashSet<EqpManipulation> _eqp = new();
|
private readonly HashSet<GmpManipulation> _gmp = [];
|
||||||
private readonly HashSet<EqdpManipulation> _eqdp = new();
|
private readonly HashSet<EstManipulation> _est = [];
|
||||||
private readonly HashSet<GmpManipulation> _gmp = new();
|
private readonly HashSet<RspManipulation> _rsp = [];
|
||||||
private readonly HashSet<EstManipulation> _est = new();
|
|
||||||
private readonly HashSet<RspManipulation> _rsp = new();
|
|
||||||
|
|
||||||
public int OtherImcCount { get; private set; }
|
public int OtherImcCount { get; private set; }
|
||||||
public int OtherEqpCount { get; private set; }
|
public int OtherEqpCount { get; private set; }
|
||||||
|
|
@ -22,11 +20,7 @@ public class ModMetaEditor
|
||||||
public int OtherEstCount { get; private set; }
|
public int OtherEstCount { get; private set; }
|
||||||
public int OtherRspCount { get; private set; }
|
public int OtherRspCount { get; private set; }
|
||||||
|
|
||||||
|
public bool Changes { get; private set; }
|
||||||
public ModMetaEditor(ModManager modManager)
|
|
||||||
=> _modManager = modManager;
|
|
||||||
|
|
||||||
public bool Changes { get; private set; } = false;
|
|
||||||
|
|
||||||
public IReadOnlySet<ImcManipulation> Imc
|
public IReadOnlySet<ImcManipulation> Imc
|
||||||
=> _imc;
|
=> _imc;
|
||||||
|
|
@ -156,7 +150,7 @@ public class ModMetaEditor
|
||||||
if (!Changes)
|
if (!Changes)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_modManager.OptionEditor.OptionSetManipulations(mod, groupIdx, optionIdx, Recombine().ToHashSet());
|
modManager.OptionEditor.OptionSetManipulations(mod, groupIdx, optionIdx, Recombine().ToHashSet());
|
||||||
Changes = false;
|
Changes = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ namespace Penumbra.Mods.Editor;
|
||||||
|
|
||||||
public class ModNormalizer(ModManager _modManager, Configuration _config)
|
public class ModNormalizer(ModManager _modManager, Configuration _config)
|
||||||
{
|
{
|
||||||
private readonly List<List<Dictionary<Utf8GamePath, FullPath>>> _redirections = new();
|
private readonly List<List<Dictionary<Utf8GamePath, FullPath>>> _redirections = [];
|
||||||
|
|
||||||
public Mod Mod { get; private set; } = null!;
|
public Mod Mod { get; private set; } = null!;
|
||||||
private string _normalizationDirName = null!;
|
private string _normalizationDirName = null!;
|
||||||
|
|
@ -141,7 +141,7 @@ public class ModNormalizer(ModManager _modManager, Configuration _config)
|
||||||
{
|
{
|
||||||
var directory = Directory.CreateDirectory(_normalizationDirName);
|
var directory = Directory.CreateDirectory(_normalizationDirName);
|
||||||
for (var i = _redirections.Count; i < Mod.Groups.Count + 1; ++i)
|
for (var i = _redirections.Count; i < Mod.Groups.Count + 1; ++i)
|
||||||
_redirections.Add(new List<Dictionary<Utf8GamePath, FullPath>>());
|
_redirections.Add([]);
|
||||||
|
|
||||||
if (_redirections[0].Count == 0)
|
if (_redirections[0].Count == 0)
|
||||||
_redirections[0].Add(new Dictionary<Utf8GamePath, FullPath>(Mod.Default.Files.Count));
|
_redirections[0].Add(new Dictionary<Utf8GamePath, FullPath>(Mod.Default.Files.Count));
|
||||||
|
|
@ -169,7 +169,7 @@ public class ModNormalizer(ModManager _modManager, Configuration _config)
|
||||||
{
|
{
|
||||||
_redirections[groupIdx + 1].EnsureCapacity(group.Count);
|
_redirections[groupIdx + 1].EnsureCapacity(group.Count);
|
||||||
for (var i = _redirections[groupIdx + 1].Count; i < group.Count; ++i)
|
for (var i = _redirections[groupIdx + 1].Count; i < group.Count; ++i)
|
||||||
_redirections[groupIdx + 1].Add(new Dictionary<Utf8GamePath, FullPath>());
|
_redirections[groupIdx + 1].Add([]);
|
||||||
|
|
||||||
var groupDir = ModCreator.CreateModFolder(directory, group.Name, _config.ReplaceNonAsciiOnImport, true);
|
var groupDir = ModCreator.CreateModFolder(directory, group.Name, _config.ReplaceNonAsciiOnImport, true);
|
||||||
foreach (var option in group.OfType<SubMod>())
|
foreach (var option in group.OfType<SubMod>())
|
||||||
|
|
|
||||||
|
|
@ -4,17 +4,13 @@ using Penumbra.Mods.Subclasses;
|
||||||
using Penumbra.String.Classes;
|
using Penumbra.String.Classes;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
|
|
||||||
public class ModSwapEditor
|
public class ModSwapEditor(ModManager modManager)
|
||||||
{
|
{
|
||||||
private readonly ModManager _modManager;
|
private readonly Dictionary<Utf8GamePath, FullPath> _swaps = [];
|
||||||
private readonly Dictionary<Utf8GamePath, FullPath> _swaps = new();
|
|
||||||
|
|
||||||
public IReadOnlyDictionary<Utf8GamePath, FullPath> Swaps
|
public IReadOnlyDictionary<Utf8GamePath, FullPath> Swaps
|
||||||
=> _swaps;
|
=> _swaps;
|
||||||
|
|
||||||
public ModSwapEditor(ModManager modManager)
|
|
||||||
=> _modManager = modManager;
|
|
||||||
|
|
||||||
public void Revert(ISubMod option)
|
public void Revert(ISubMod option)
|
||||||
{
|
{
|
||||||
_swaps.SetTo(option.FileSwaps);
|
_swaps.SetTo(option.FileSwaps);
|
||||||
|
|
@ -26,7 +22,7 @@ public class ModSwapEditor
|
||||||
if (!Changes)
|
if (!Changes)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_modManager.OptionEditor.OptionSetFileSwaps(mod, groupIdx, optionIdx, _swaps);
|
modManager.OptionEditor.OptionSetFileSwaps(mod, groupIdx, optionIdx, _swaps);
|
||||||
Changes = false;
|
Changes = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using OtterGui;
|
using OtterGui;
|
||||||
using OtterGui.Classes;
|
using OtterGui.Classes;
|
||||||
|
using Penumbra.Mods.Editor;
|
||||||
using Penumbra.Mods.Subclasses;
|
using Penumbra.Mods.Subclasses;
|
||||||
using Penumbra.String.Classes;
|
using Penumbra.String.Classes;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Penumbra.Meta.Manipulations;
|
using Penumbra.Meta.Manipulations;
|
||||||
|
using Penumbra.Mods.Editor;
|
||||||
using Penumbra.String.Classes;
|
using Penumbra.String.Classes;
|
||||||
|
|
||||||
namespace Penumbra.Mods.Subclasses;
|
namespace Penumbra.Mods.Subclasses;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using OtterGui.Classes;
|
using OtterGui.Classes;
|
||||||
using Penumbra.Collections;
|
using Penumbra.Collections;
|
||||||
using Penumbra.Meta.Manipulations;
|
using Penumbra.Meta.Manipulations;
|
||||||
|
using Penumbra.Mods.Editor;
|
||||||
using Penumbra.Mods.Manager;
|
using Penumbra.Mods.Manager;
|
||||||
using Penumbra.Mods.Subclasses;
|
using Penumbra.Mods.Subclasses;
|
||||||
using Penumbra.Services;
|
using Penumbra.Services;
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ using Penumbra.UI.ModsTab;
|
||||||
using Penumbra.UI.ResourceWatcher;
|
using Penumbra.UI.ResourceWatcher;
|
||||||
using Penumbra.UI.Tabs;
|
using Penumbra.UI.Tabs;
|
||||||
using Penumbra.UI.Tabs.Debug;
|
using Penumbra.UI.Tabs.Debug;
|
||||||
|
using MdlMaterialEditor = Penumbra.Mods.Editor.MdlMaterialEditor;
|
||||||
using ResidentResourceManager = Penumbra.Interop.Services.ResidentResourceManager;
|
using ResidentResourceManager = Penumbra.Interop.Services.ResidentResourceManager;
|
||||||
|
|
||||||
namespace Penumbra.Services;
|
namespace Penumbra.Services;
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ using Penumbra.String;
|
||||||
using Penumbra.String.Classes;
|
using Penumbra.String.Classes;
|
||||||
using Penumbra.UI.Classes;
|
using Penumbra.UI.Classes;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
|
using MdlMaterialEditor = Penumbra.Mods.Editor.MdlMaterialEditor;
|
||||||
|
|
||||||
namespace Penumbra.UI.AdvancedWindow;
|
namespace Penumbra.UI.AdvancedWindow;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ using Penumbra.Collections.Cache;
|
||||||
using Penumbra.Collections.Manager;
|
using Penumbra.Collections.Manager;
|
||||||
using Penumbra.Meta.Manipulations;
|
using Penumbra.Meta.Manipulations;
|
||||||
using Penumbra.Mods;
|
using Penumbra.Mods;
|
||||||
|
using Penumbra.Mods.Editor;
|
||||||
using Penumbra.String.Classes;
|
using Penumbra.String.Classes;
|
||||||
using Penumbra.UI.Classes;
|
using Penumbra.UI.Classes;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ using OtterGui.Widgets;
|
||||||
using Penumbra.Api.Enums;
|
using Penumbra.Api.Enums;
|
||||||
using Penumbra.Collections.Manager;
|
using Penumbra.Collections.Manager;
|
||||||
using Penumbra.Mods;
|
using Penumbra.Mods;
|
||||||
|
using Penumbra.Mods.Editor;
|
||||||
using Penumbra.Services;
|
using Penumbra.Services;
|
||||||
using Penumbra.UI.Classes;
|
using Penumbra.UI.Classes;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ using Penumbra.Collections.Cache;
|
||||||
using Penumbra.Collections.Manager;
|
using Penumbra.Collections.Manager;
|
||||||
using Penumbra.Meta.Manipulations;
|
using Penumbra.Meta.Manipulations;
|
||||||
using Penumbra.Mods;
|
using Penumbra.Mods;
|
||||||
|
using Penumbra.Mods.Editor;
|
||||||
using Penumbra.String.Classes;
|
using Penumbra.String.Classes;
|
||||||
using Penumbra.UI.Classes;
|
using Penumbra.UI.Classes;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue