@@ -241,12 +241,6 @@ public async Task<XivModStatus> IsModEnabled(string internalPath, bool indexChec
241
241
{
242
242
return XivModStatus . Original ;
243
243
}
244
- // If modEntry not null but modded offset and original offset are the same as is the case with matadd textures
245
- if ( modEntry . data . modOffset == modEntry . data . originalOffset )
246
- {
247
- // Return original to disable the disable/enable button as there's nothing to toggle between
248
- return XivModStatus . MatAdd ;
249
- }
250
244
251
245
return modEntry . enabled ? XivModStatus . Enabled : XivModStatus . Disabled ;
252
246
}
@@ -276,17 +270,28 @@ public async Task ToggleModStatus(string internalFilePath, bool enable)
276
270
// Matadd textures have the same mod offset as original so nothing to toggle
277
271
if ( modEntry . data . originalOffset == modEntry . data . modOffset )
278
272
{
279
- return ;
280
- }
281
-
273
+ // Added file.
274
+ if ( enable && ! modEntry . enabled )
275
+ {
276
+ await index . AddFileDescriptor ( modEntry . fullPath , modEntry . data . modOffset , IOUtil . GetDataFileFromPath ( modEntry . fullPath ) ) ;
277
+ }
278
+ else if ( ! enable && modEntry . enabled )
279
+ {
280
+ await index . DeleteFileDescriptor ( modEntry . fullPath , IOUtil . GetDataFileFromPath ( modEntry . fullPath ) ) ;
281
+ }
282
282
283
- if ( enable )
284
- {
285
- await index . UpdateDataOffset ( modEntry . data . modOffset , internalFilePath ) ;
286
283
}
287
284
else
288
- {
289
- await index . UpdateDataOffset ( modEntry . data . originalOffset , internalFilePath ) ;
285
+ {
286
+ // Standard mod (file replacement)
287
+ if ( enable )
288
+ {
289
+ await index . UpdateDataOffset ( modEntry . data . modOffset , internalFilePath ) ;
290
+ }
291
+ else
292
+ {
293
+ await index . UpdateDataOffset ( modEntry . data . originalOffset , internalFilePath ) ;
294
+ }
290
295
}
291
296
292
297
var modListDirectory = new DirectoryInfo ( Path . Combine ( _gameDirectory . Parent . Parent . FullName , XivStrings . ModlistFilePath ) ) ;
@@ -338,17 +343,32 @@ public async Task ToggleModPackStatus(string modPackName, bool enable)
338
343
{
339
344
if ( modEntry . name . Equals ( string . Empty ) ) continue ;
340
345
// Matadd textures have the same mod offset as original so nothing to toggle
341
- if ( modEntry . data . modOffset == modEntry . data . originalOffset ) continue ;
342
-
343
- if ( enable )
346
+ if ( modEntry . data . originalOffset == modEntry . data . modOffset )
344
347
{
345
- await index . UpdateDataOffset ( modEntry . data . modOffset , modEntry . fullPath ) ;
346
- modEntry . enabled = true ;
348
+ // Added file.
349
+ if ( enable && ! modEntry . enabled )
350
+ {
351
+ await index . AddFileDescriptor ( modEntry . fullPath , modEntry . data . modOffset , IOUtil . GetDataFileFromPath ( modEntry . fullPath ) ) ;
352
+ }
353
+ else if ( ! enable && modEntry . enabled )
354
+ {
355
+ await index . DeleteFileDescriptor ( modEntry . fullPath , IOUtil . GetDataFileFromPath ( modEntry . fullPath ) ) ;
356
+ }
357
+
347
358
}
348
359
else
349
360
{
350
- await index . UpdateDataOffset ( modEntry . data . originalOffset , modEntry . fullPath ) ;
351
- modEntry . enabled = false ;
361
+ // Standard file (file replacement)
362
+ if ( enable )
363
+ {
364
+ await index . UpdateDataOffset ( modEntry . data . modOffset , modEntry . fullPath ) ;
365
+ modEntry . enabled = true ;
366
+ }
367
+ else
368
+ {
369
+ await index . UpdateDataOffset ( modEntry . data . originalOffset , modEntry . fullPath ) ;
370
+ modEntry . enabled = false ;
371
+ }
352
372
}
353
373
}
354
374
@@ -372,18 +392,34 @@ public async Task ToggleAllMods(bool enable, IProgress<(int current, int total,
372
392
{
373
393
if ( string . IsNullOrEmpty ( modEntry . name ) ) continue ;
374
394
if ( string . IsNullOrEmpty ( modEntry . fullPath ) ) continue ;
375
- // Matadd textures have the same mod offset as original so nothing to toggle
376
- if ( modEntry . data . modOffset == modEntry . data . originalOffset ) continue ;
377
-
378
- if ( enable && ! modEntry . enabled )
395
+ if ( modEntry . data . modOffset == modEntry . data . originalOffset )
379
396
{
380
- await index . UpdateDataOffset ( modEntry . data . modOffset , modEntry . fullPath ) ;
381
- modEntry . enabled = true ;
397
+ // Added file.
398
+ if ( enable && ! modEntry . enabled )
399
+ {
400
+ await index . AddFileDescriptor ( modEntry . fullPath , modEntry . data . modOffset , IOUtil . GetDataFileFromPath ( modEntry . fullPath ) ) ;
401
+ modEntry . enabled = true ;
402
+ }
403
+ else if ( ! enable && modEntry . enabled )
404
+ {
405
+ await index . DeleteFileDescriptor ( modEntry . fullPath , IOUtil . GetDataFileFromPath ( modEntry . fullPath ) ) ;
406
+ modEntry . enabled = false ;
407
+ }
408
+
382
409
}
383
- else if ( ! enable && modEntry . enabled )
410
+ else
384
411
{
385
- await index . UpdateDataOffset ( modEntry . data . originalOffset , modEntry . fullPath ) ;
386
- modEntry . enabled = false ;
412
+ // Standard mod.
413
+ if ( enable && ! modEntry . enabled )
414
+ {
415
+ await index . UpdateDataOffset ( modEntry . data . modOffset , modEntry . fullPath ) ;
416
+ modEntry . enabled = true ;
417
+ }
418
+ else if ( ! enable && modEntry . enabled )
419
+ {
420
+ await index . UpdateDataOffset ( modEntry . data . originalOffset , modEntry . fullPath ) ;
421
+ modEntry . enabled = false ;
422
+ }
387
423
}
388
424
389
425
progress ? . Report ( ( ++ modNum , modList . Mods . Count , string . Empty ) ) ;
0 commit comments