Skip to content

Commit a7b9b7d

Browse files
committed
Update 2.0.12.7
2 parents 88ac960 + 9a720b0 commit a7b9b7d

File tree

15 files changed

+1324
-15
lines changed

15 files changed

+1324
-15
lines changed

xivModdingFramework/Cache/XivCache.cs

Lines changed: 1115 additions & 0 deletions
Large diffs are not rendered by default.

xivModdingFramework/General/Enums/XivLanguage.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ public enum XivLanguage
3333
[Description("de")] German,
3434
[Description("fr")] French,
3535
[Description("ko")] Korean,
36-
[Description("chs")] Chinese
36+
[Description("chs")] Chinese,
37+
[Description("none")] None
3738
}
3839

3940
/// <summary>

xivModdingFramework/Helpers/ProblemChecker.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
using xivModdingFramework.SqPack.FileTypes;
2424
using xivModdingFramework.Mods;
2525
using xivModdingFramework.Resources;
26+
using xivModdingFramework.Cache;
2627

2728
namespace xivModdingFramework.Helpers
2829
{
@@ -157,7 +158,7 @@ public Task<bool> CheckForOutdatedBackups(XivDataFile dataFile, DirectoryInfo ba
157158
});
158159
}
159160

160-
public Task PerformStartOver(DirectoryInfo backupsDirectory, IProgress<string> progress = null)
161+
public Task PerformStartOver(DirectoryInfo backupsDirectory, IProgress<string> progress = null, XivLanguage language = XivLanguage.None)
161162
{
162163
return Task.Run(async () =>
163164
{
@@ -184,7 +185,7 @@ public Task PerformStartOver(DirectoryInfo backupsDirectory, IProgress<string> p
184185
{
185186
throw new Exception("Start Over Failed: Index backups missing/outdated.");
186187
}
187-
}
188+
}
188189
finally
189190
{
190191
// If no exception occured, restore the backups anyway just to be safe but don't throw an exception if it fails
@@ -200,7 +201,7 @@ public Task PerformStartOver(DirectoryInfo backupsDirectory, IProgress<string> p
200201
{
201202
await BackupIndexFiles(backupsDirectory);
202203
}
203-
catch(Exception ex)
204+
catch (Exception ex)
204205
{
205206
throw new Exception("Start Over Failed: Failed to update outdated backups.\n\n" + ex.Message);
206207
}
@@ -235,6 +236,14 @@ public Task PerformStartOver(DirectoryInfo backupsDirectory, IProgress<string> p
235236
File.Delete(modListDirectory.FullName);
236237

237238
modding.CreateModlist();
239+
240+
progress?.Report("Rebuilding Cache...");
241+
242+
await Task.Run(async () =>
243+
{
244+
var _cache = new XivCache(_gameDirectory, language);
245+
_cache.RebuildCache();
246+
});
238247
}
239248
});
240249
}

xivModdingFramework/Items/Categories/Companions.cs

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
using System.Linq;
2121
using System.Text;
2222
using System.Threading.Tasks;
23+
using xivModdingFramework.Cache;
2324
using xivModdingFramework.Exd.Enums;
2425
using xivModdingFramework.Exd.FileTypes;
2526
using xivModdingFramework.General;
@@ -50,6 +51,11 @@ public Companions(DirectoryInfo gameDirectory, XivLanguage xivLanguage)
5051
_xivLanguage = xivLanguage;
5152
_ex = new Ex(_gameDirectory, _xivLanguage);
5253
}
54+
public async Task<List<XivMinion>> GetMinionList(string substring = null)
55+
{
56+
var cache = new XivCache(_gameDirectory, _xivLanguage);
57+
return await cache.GetCachedMinionsList(substring);
58+
}
5359

5460
/// <summary>
5561
/// Gets the list to be displayed in the Minion category
@@ -59,7 +65,7 @@ public Companions(DirectoryInfo gameDirectory, XivLanguage xivLanguage)
5965
/// The data within companion_0 exd contains a reference to the index for lookup in modelchara
6066
/// </remarks>
6167
/// <returns>A list containing XivMinion data</returns>
62-
public async Task<List<XivMinion>> GetMinionList()
68+
public async Task<List<XivMinion>> GetUncachedMinionList()
6369
{
6470
var minionLock = new object();
6571
var minionList = new List<XivMinion>();
@@ -117,6 +123,12 @@ await Task.Run(() => Parallel.ForEach(minionEx.Values, (minion) =>
117123
return minionList;
118124
}
119125

126+
public async Task<List<XivMount>> GetMountList(string substring = null, string category = null)
127+
{
128+
var cache = new XivCache(_gameDirectory, _xivLanguage);
129+
return await cache.GetCachedMountList(substring, category);
130+
}
131+
120132
/// <summary>
121133
/// Gets the list to be displayed in the Mounts category
122134
/// </summary>
@@ -125,7 +137,7 @@ await Task.Run(() => Parallel.ForEach(minionEx.Values, (minion) =>
125137
/// The data within mount_0 exd contains a reference to the index for lookup in modelchara
126138
/// </remarks>
127139
/// <returns>A list containing XivMount data</returns>
128-
public async Task<List<XivMount>> GetMountList()
140+
public async Task<List<XivMount>> GetUncachedMountList()
129141
{
130142
var mountLock = new object();
131143
var mountList = new List<XivMount>();
@@ -192,7 +204,7 @@ await Task.Run(() => Parallel.ForEach(mountEx.Values, (mount) =>
192204
/// The data format used by Ornaments is identical to mounts so XivMount can be used to store the data
193205
/// </remarks>
194206
/// <returns>A list containing XivMount data</returns>
195-
public async Task<List<XivMount>> GetOrnamentList()
207+
public async Task<List<XivMount>> GetUncachedOrnamentList()
196208
{
197209
var mountLock = new object();
198210
var ornamentList = new List<XivMount>();
@@ -250,6 +262,14 @@ await Task.Run(() => Parallel.ForEach(ornamentEx.Values, (ornament) =>
250262
return ornamentList;
251263
}
252264

265+
266+
public async Task<List<XivPet>> GetPetList(string substring = null)
267+
{
268+
var cache = new XivCache(_gameDirectory, _xivLanguage);
269+
return await cache.GetCachedPetList(substring);
270+
271+
}
272+
253273
/// <summary>
254274
/// Gets the list to be displayed in the Pets category
255275
/// </summary>
@@ -258,7 +278,7 @@ await Task.Run(() => Parallel.ForEach(ornamentEx.Values, (ornament) =>
258278
/// Because of this, the Pet data is hardcoded until a better way of obtaining it is found.
259279
/// </remarks>
260280
/// <returns>A list containing XivMount data</returns>
261-
public async Task<List<XivPet>> GetPetList()
281+
public async Task<List<XivPet>> GetUncachedPetList()
262282
{
263283
var petLock = new object();
264284
var petList = new List<XivPet>();

xivModdingFramework/Items/Categories/Gear.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using System.Linq;
2020
using System.Text;
2121
using System.Threading.Tasks;
22+
using xivModdingFramework.Cache;
2223
using xivModdingFramework.Exd.Enums;
2324
using xivModdingFramework.Exd.FileTypes;
2425
using xivModdingFramework.General;
@@ -54,12 +55,18 @@ public Gear(DirectoryInfo gameDirectory, XivLanguage xivLanguage)
5455
_xivLanguage = xivLanguage;
5556
_index = new Index(_gameDirectory);
5657
}
58+
public async Task<List<XivGear>> GetGearList(string substring = null)
59+
{
60+
var cache = new XivCache(_gameDirectory, _xivLanguage);
61+
62+
return await cache.GetCachedGearList(substring);
63+
}
5764

5865
/// <summary>
5966
/// A getter for available gear in the Item exd files
6067
/// </summary>
6168
/// <returns>A list containing XivGear data</returns>
62-
public async Task<List<XivGear>> GetGearList()
69+
public async Task<List<XivGear>> GetUnCachedGearList()
6370
{
6471
// These are the offsets to relevant data
6572
// These will need to be changed if data gets added or removed with a patch
@@ -96,6 +103,7 @@ await Task.Run(() => Parallel.ForEach(itemDictionary, (item) =>
96103

97104
var xivGear = new XivGear
98105
{
106+
ExdID = item.Key,
99107
PrimaryCategory = XivStrings.Gear,
100108
ModelInfo = primaryMi,
101109
SecondaryModelInfo = secondaryMi

xivModdingFramework/Items/Categories/Housing.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
using System.Linq;
2121
using System.Text;
2222
using System.Threading.Tasks;
23+
using xivModdingFramework.Cache;
2324
using xivModdingFramework.Exd.Enums;
2425
using xivModdingFramework.Exd.FileTypes;
2526
using xivModdingFramework.General.DataContainers;
@@ -47,7 +48,17 @@ public Housing(DirectoryInfo gameDirectory, XivLanguage xivLanguage)
4748
/// Gets the list of all Housing Items
4849
/// </summary>
4950
/// <returns>A list of XivFurniture objects containing housing items</returns>
50-
public async Task<List<XivFurniture>> GetFurnitureList()
51+
public async Task<List<XivFurniture>> GetFurnitureList(string substring = null)
52+
{
53+
var cache = new XivCache(_gameDirectory, _xivLanguage);
54+
return await cache.GetCachedFurnitureList(substring);
55+
}
56+
57+
/// <summary>
58+
/// Gets the list of all Housing Items
59+
/// </summary>
60+
/// <returns>A list of XivFurniture objects containing housing items</returns>
61+
public async Task<List<XivFurniture>> GetUncachedFurnitureList()
5162
{
5263
var furnitureList = new List<XivFurniture>();
5364

xivModdingFramework/Items/Categories/UI.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using System.IO;
1919
using System.Text;
2020
using System.Threading.Tasks;
21+
using xivModdingFramework.Cache;
2122
using xivModdingFramework.Exd.Enums;
2223
using xivModdingFramework.Exd.FileTypes;
2324
using xivModdingFramework.General.Enums;
@@ -44,6 +45,13 @@ public UI(DirectoryInfo gameDirectory, XivLanguage xivLanguage)
4445
_ex = new Ex(_gameDirectory, _xivLanguage);
4546
}
4647

48+
49+
public async Task<List<XivUi>> GetUIList()
50+
{
51+
var cache = new XivCache(_gameDirectory, _xivLanguage);
52+
return await cache.GetCachedUiList();
53+
}
54+
4755
/// <summary>
4856
/// Gets a list of UI elements from the Uld Files
4957
/// </summary>

xivModdingFramework/Items/DataContainers/XivGear.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ namespace xivModdingFramework.Items.DataContainers
2525
/// </summary>
2626
public class XivGear : IItemModel
2727
{
28+
29+
/// <summary>
30+
/// The ID of this item in items.exd
31+
/// </summary>
32+
public int ExdID { get; set; }
33+
2834
/// <summary>
2935
/// The name of the gear item
3036
/// </summary>

xivModdingFramework/Models/FileTypes/Mdl.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5618,6 +5618,7 @@ public static void CalculateTangentData(List<int> triangleIndices, List<Vector3>
56185618
{XivStrings.Ears, "ear"},
56195619
{XivStrings.Neck, "nek"},
56205620
{XivStrings.Rings, "rir"},
5621+
{XivStrings.LeftRing, "ril"},
56215622
{XivStrings.Wrists, "wrs"},
56225623
{XivStrings.Head_Body, "top"},
56235624
{XivStrings.Body_Hands, "top"},

xivModdingFramework/Mods/Modding.cs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,16 @@ where mod.fullPath.Equals(modItemPath)
370370
if (modToRemove.source == "FilesAddedByTexTools")
371371
{
372372
var index = new Index(_gameDirectory);
373-
index.DeleteFileDescriptor(modItemPath, XivDataFiles.GetXivDataFile(modToRemove.datFile));
374-
index.DeleteFileDescriptor($"{modItemPath}.flag", XivDataFiles.GetXivDataFile(modToRemove.datFile));
373+
var success = index.DeleteFileDescriptor(modItemPath, XivDataFiles.GetXivDataFile(modToRemove.datFile));
374+
if(!success)
375+
{
376+
throw new Exception("Failed to delete file descriptor.");
377+
}
378+
success = index.DeleteFileDescriptor($"{modItemPath}.flag", XivDataFiles.GetXivDataFile(modToRemove.datFile));
379+
if (!success)
380+
{
381+
throw new Exception("Failed to delete file descriptor.");
382+
}
375383
}
376384
if (modToRemove.enabled)
377385
{
@@ -419,8 +427,16 @@ where modPack.name.Equals(modPackName)
419427
if (modToRemove.source == "FilesAddedByTexTools")
420428
{
421429
var index = new Index(_gameDirectory);
422-
index.DeleteFileDescriptor(modToRemove.fullPath, XivDataFiles.GetXivDataFile(modToRemove.datFile));
423-
index.DeleteFileDescriptor($"{modToRemove.fullPath}.flag", XivDataFiles.GetXivDataFile(modToRemove.datFile));
430+
var success = index.DeleteFileDescriptor(modToRemove.fullPath, XivDataFiles.GetXivDataFile(modToRemove.datFile));
431+
if (!success)
432+
{
433+
throw new Exception("Failed to delete file descriptor.");
434+
}
435+
success = index.DeleteFileDescriptor($"{modToRemove.fullPath}.flag", XivDataFiles.GetXivDataFile(modToRemove.datFile));
436+
if (!success)
437+
{
438+
throw new Exception("Failed to delete file descriptor.");
439+
}
424440
}
425441
if (modToRemove.enabled)
426442
{

0 commit comments

Comments
 (0)