Skip to content

Commit ee053ab

Browse files
committed
- Fixed mod enable/disables not properly updating the cache.
1 parent 5bc042e commit ee053ab

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

xivModdingFramework/Mods/Modding.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ public async Task<bool> ToggleModStatus(string internalFilePath, bool enable)
267267

268268
var modEntry = modList.Mods.FirstOrDefault(x => x.fullPath == internalFilePath);
269269

270-
var result = await ToggleModUnsafe(enable, modEntry);
270+
var result = await ToggleModUnsafe(enable, modEntry, false, true);
271271
if(!result)
272272
{
273273
return result;
@@ -319,7 +319,7 @@ public async Task ToggleModPackStatus(string modPackName, bool enable)
319319

320320
foreach (var modEntry in mods)
321321
{
322-
await ToggleModUnsafe(enable, modEntry);
322+
await ToggleModUnsafe(enable, modEntry, false, true);
323323
}
324324

325325
SaveModList(modList);
@@ -338,7 +338,7 @@ public async Task ToggleModPackStatus(string modPackName, bool enable)
338338
/// <param name="enable"></param>
339339
/// <param name="mod"></param>
340340
/// <returns></returns>
341-
public async Task<bool> ToggleModUnsafe(bool enable, Mod mod, bool includeInternal = false)
341+
public async Task<bool> ToggleModUnsafe(bool enable, Mod mod, bool includeInternal = false, bool updateCache = false)
342342
{
343343
if (mod == null) return false;
344344
if (string.IsNullOrEmpty(mod.name)) return false;
@@ -368,7 +368,7 @@ public async Task<bool> ToggleModUnsafe(bool enable, Mod mod, bool includeIntern
368368
// Added file.
369369
if (enable && !mod.enabled)
370370
{
371-
await index.AddFileDescriptor(mod.fullPath, mod.data.modOffset, IOUtil.GetDataFileFromPath(mod.fullPath), false);
371+
await index.AddFileDescriptor(mod.fullPath, mod.data.modOffset, IOUtil.GetDataFileFromPath(mod.fullPath), updateCache);
372372
mod.enabled = true;
373373

374374
// Check if we're re-enabling a metadata mod.
@@ -387,7 +387,7 @@ public async Task<bool> ToggleModUnsafe(bool enable, Mod mod, bool includeIntern
387387
{
388388

389389
// Delete file descriptor handles removing metadata as needed on its own.
390-
await index.DeleteFileDescriptor(mod.fullPath, IOUtil.GetDataFileFromPath(mod.fullPath), false);
390+
await index.DeleteFileDescriptor(mod.fullPath, IOUtil.GetDataFileFromPath(mod.fullPath), updateCache);
391391
mod.enabled = false;
392392
}
393393

@@ -397,12 +397,12 @@ public async Task<bool> ToggleModUnsafe(bool enable, Mod mod, bool includeIntern
397397
// Standard mod.
398398
if (enable && !mod.enabled)
399399
{
400-
await index.UpdateDataOffset(mod.data.modOffset, mod.fullPath, false);
400+
await index.UpdateDataOffset(mod.data.modOffset, mod.fullPath, updateCache);
401401
mod.enabled = true;
402402
}
403403
else if (!enable && mod.enabled)
404404
{
405-
await index.UpdateDataOffset(mod.data.originalOffset, mod.fullPath, false);
405+
await index.UpdateDataOffset(mod.data.originalOffset, mod.fullPath, updateCache);
406406
mod.enabled = false;
407407
}
408408
}
@@ -432,7 +432,7 @@ public async Task ToggleAllMods(bool enable, IProgress<(int current, int total,
432432
// Save disabling these for last.
433433
if (modEntry.IsInternal()) continue;
434434

435-
await ToggleModUnsafe(enable, modEntry);
435+
await ToggleModUnsafe(enable, modEntry, false, false);
436436
progress?.Report((++modNum, modList.Mods.Count, string.Empty));
437437
}
438438

@@ -442,7 +442,7 @@ public async Task ToggleAllMods(bool enable, IProgress<(int current, int total,
442442
var internalEntries = modList.Mods.Where(x => x.IsInternal());
443443
foreach (var modEntry in internalEntries)
444444
{
445-
await ToggleModUnsafe(enable, modEntry, true);
445+
await ToggleModUnsafe(enable, modEntry, true, false);
446446
}
447447
}
448448

0 commit comments

Comments
 (0)