Skip to content

Commit c9be3d0

Browse files
committed
- Bump Version Number
- Include VFX/AVFX files along with other files when using [Include All] Options.
1 parent d24a362 commit c9be3d0

File tree

2 files changed

+81
-5
lines changed

2 files changed

+81
-5
lines changed

xivModdingFramework/Cache/XivDependencyGraph.cs

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
using xivModdingFramework.Resources;
2323
using xivModdingFramework.SqPack.DataContainers;
2424
using xivModdingFramework.SqPack.FileTypes;
25+
using xivModdingFramework.Textures.FileTypes;
2526
using xivModdingFramework.Variants.FileTypes;
2627
using static xivModdingFramework.Cache.XivCache;
2728

@@ -490,6 +491,76 @@ public override int GetHashCode()
490491
return Info.ToString().GetHashCode();
491492
}
492493

494+
/// <summary>
495+
/// Retrieves ALL files used by this root.
496+
/// </summary>
497+
/// <param name="index"></param>
498+
/// <param name="modlist"></param>
499+
/// <returns></returns>
500+
public async Task<SortedSet<string>> GetAllFiles(IndexFile index = null, ModList modlist = null)
501+
{
502+
503+
var df = IOUtil.GetDataFileFromPath(Info.GetRootFile());
504+
505+
var _imc = new Imc(XivCache.GameInfo.GameDirectory);
506+
var _mdl = new Mdl(XivCache.GameInfo.GameDirectory, df);
507+
var _dat = new Dat(XivCache.GameInfo.GameDirectory);
508+
var _index = new Index(XivCache.GameInfo.GameDirectory);
509+
var _mtrl = new Mtrl(XivCache.GameInfo.GameDirectory);
510+
var _modding = new Modding(XivCache.GameInfo.GameDirectory);
511+
var _atex = new ATex(XivCache.GameInfo.GameDirectory, df);
512+
513+
var files = new HashSet<string>();
514+
515+
if (index == null)
516+
{
517+
index = await _index.GetIndexFile(df);
518+
modlist = await _modding.GetModListAsync();
519+
}
520+
521+
ItemMetadata originalMetadata = await ItemMetadata.GetFromCachedIndex(this, index);
522+
523+
var originalModelPaths = await GetModelFiles(index, modlist);
524+
var originalMaterialPaths = await GetMaterialFiles(-1, index, modlist);
525+
var originalTexturePaths = await GetTextureFiles(-1, index, modlist);
526+
527+
var originalVfxPaths = new HashSet<string>();
528+
if (Imc.UsesImc(this))
529+
{
530+
var avfxSets = originalMetadata.ImcEntries.Select(x => x.Vfx).Distinct();
531+
foreach (var avfx in avfxSets)
532+
{
533+
var avfxStuff = await ATex.GetVfxPath(Info, avfx);
534+
if (String.IsNullOrEmpty(avfxStuff.Folder) || String.IsNullOrEmpty(avfxStuff.File)) continue;
535+
536+
var path = avfxStuff.Folder + "/" + avfxStuff.File;
537+
if (index.FileExists(path))
538+
{
539+
originalVfxPaths.Add(path);
540+
var ttpaths = await _atex.GetAtexPaths(path);
541+
foreach (var ttp in ttpaths)
542+
{
543+
originalVfxPaths.Add(ttp.Path);
544+
}
545+
}
546+
}
547+
}
548+
549+
var af = originalModelPaths.Select(x => x).Union(
550+
originalMaterialPaths.Select(x => x)).Union(
551+
originalTexturePaths.Select(x => x)).Union(
552+
originalVfxPaths.Select(x => x));
553+
554+
var allFiles = new SortedSet<string>();
555+
foreach (var f in af)
556+
{
557+
allFiles.Add(f);
558+
}
559+
560+
allFiles.Add(Info.GetRootFile());
561+
562+
return allFiles;
563+
}
493564

494565
/// <summary>
495566
/// Gets all the model files in this dependency chain.

xivModdingFramework/Textures/FileTypes/ATex.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,22 @@ public async Task<List<TexTypePath>> GetAtexPaths(IItemModel itemModel)
5353
// Gear is the only type we know how to retrieve atex information for.
5454
if (itemModel.GetType() != typeof(XivGear)) return new List<TexTypePath>();
5555

56-
var atexTexTypePathList = new List<TexTypePath>();
5756

58-
var index = new Index(_gameDirectory);
59-
var avfx = new Avfx(_gameDirectory, _dataFile);
6057

6158
var itemType = ItemType.GetPrimaryItemType(itemModel);
6259

6360
var vfxPath = await GetVfxPath(itemModel);
61+
return await GetAtexPaths(vfxPath.Folder + '/' + vfxPath.File);
62+
}
63+
public async Task<List<TexTypePath>> GetAtexPaths(string vfxPath)
64+
{
65+
var index = new Index(_gameDirectory);
66+
var avfx = new Avfx(_gameDirectory, _dataFile);
6467

65-
var vfxOffset = await index.GetDataOffset(HashGenerator.GetHash(vfxPath.Folder), HashGenerator.GetHash(vfxPath.File),
66-
_dataFile);
68+
var folder = vfxPath.Substring(0, vfxPath.LastIndexOf("/"));
69+
var file = Path.GetFileName(vfxPath);
70+
var vfxOffset = await index.GetDataOffset(HashGenerator.GetHash(folder), HashGenerator.GetHash(file), _dataFile);
71+
var atexTexTypePathList = new List<TexTypePath>();
6772

6873
if (vfxOffset <= 0)
6974
{

0 commit comments

Comments
 (0)