Skip to content

Commit b078b60

Browse files
committed
- Additional Safety checks on Disable/Enable all mods and Item Conversions of null material set items.
1 parent d84127c commit b078b60

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

xivModdingFramework/Mods/Modding.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,9 @@ public async Task ToggleAllMods(bool enable, IProgress<(int current, int total,
436436
progress?.Report((++modNum, modList.Mods.Count, string.Empty));
437437
}
438438

439-
if (includeInternal)
439+
if (includeInternal && !enable)
440440
{
441-
// Disable these last, just to avoid any potential strangeness.
441+
// Disable these last.
442442
var internalEntries = modList.Mods.Where(x => x.IsInternal());
443443
foreach (var modEntry in internalEntries)
444444
{
@@ -449,6 +449,17 @@ public async Task ToggleAllMods(bool enable, IProgress<(int current, int total,
449449

450450
SaveModList(modList);
451451

452+
if (includeInternal && !enable)
453+
{
454+
// Now go ahead and delete the internal files, to prevent them
455+
// being accidentally re-enabled (They should be re-built by the metadata file imports)
456+
var internalEntries = modList.Mods.Where(x => x.IsInternal());
457+
foreach (var modEntry in internalEntries)
458+
{
459+
await DeleteMod(modEntry.fullPath, true);
460+
}
461+
}
462+
452463

453464
// Do these as a batch query at the end.
454465
progress?.Report((++modNum, modList.Mods.Count, "Adding modified files to Cache Queue..."));

xivModdingFramework/Mods/RootCloner.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,10 @@ public static async Task CloneRoot(XivDependencyRoot Source, XivDependencyRoot D
356356

357357
// Poke through the variants and adjust any that point to null Material Sets to instead use a valid one.
358358
var valid = newMetadata.ImcEntries.FirstOrDefault(x => x.MaterialSet != 0).MaterialSet;
359+
if(valid <= 0)
360+
{
361+
valid = originalMetadata.ImcEntries.FirstOrDefault(x => x.MaterialSet != 0).MaterialSet;
362+
}
359363

360364
for(int i = 0; i < newMetadata.ImcEntries.Count; i++)
361365
{

0 commit comments

Comments
 (0)