Skip to content

Commit 2884787

Browse files
committed
Update v2.3.4.18
2 parents c5707ff + 797a796 commit 2884787

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

xivModdingFramework/Models/Helpers/ModelModifiers.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,14 @@ public void Apply(TTModel ttModel, XivMdl currentMdl = null, XivMdl originalMdl
133133
throw new Exception("Cannot copy settings from null MDL.");
134134
}
135135
ModelModifiers.ClearShapeData(ttModel, loggingFunction);
136-
ModelModifiers.MergeShapeData(ttModel, originalMdl, loggingFunction);
136+
try
137+
{
138+
ModelModifiers.MergeShapeData(ttModel, originalMdl, loggingFunction);
139+
}
140+
catch
141+
{
142+
throw new Exception("Failed to apply the original shape data.\nThis is likely due to changes to the original model without preserving the vertices' order.");
143+
}
137144
}
138145

139146
if (AutoScale)

xivModdingFramework/Mods/FileTypes/TTMP.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ public async Task<int> CreateWizardModPack(ModPackData modPackData, IProgress<do
192192
var zf = new ZipFile();
193193
zf.UseZip64WhenSaving = Zip64Option.AsNecessary;
194194
zf.CompressionLevel = Ionic.Zlib.CompressionLevel.None;
195-
zf.UseZip64WhenSaving = Zip64Option.AsNecessary;
196195
zf.AddFile(_tempMPL, "");
197196
zf.AddFile(_tempMPD, "");
198197
zf.Save(modPackPath);
@@ -319,7 +318,6 @@ public async Task<int> CreateSimpleModPack(SimpleModPackData modPackData, Direct
319318
var zf = new ZipFile();
320319
zf.UseZip64WhenSaving = Zip64Option.AsNecessary;
321320
zf.CompressionLevel = Ionic.Zlib.CompressionLevel.None;
322-
zf.UseZip64WhenSaving = Zip64Option.AsNecessary;
323321
zf.AddFile(_tempMPL, "");
324322
zf.AddFile(_tempMPD, "");
325323
zf.Save(modPackPath);

xivModdingFramework/SqPack/FileTypes/Dat.cs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,18 @@ await Task.Run(async () =>
242242
using (var binaryReader = new BinaryReader(File.OpenRead(datFilePath)))
243243
{
244244
binaryReader.BaseStream.Seek(24, SeekOrigin.Begin);
245-
var b = binaryReader.ReadByte();
246-
if (b != 0)
245+
bool anyNonZero = false;
246+
for (int byteIdx = 0; byteIdx < 8; byteIdx++)
247+
{
248+
if (binaryReader.ReadByte() != 0)
249+
{
250+
anyNonZero = true;
251+
break;
252+
}
253+
}
254+
255+
// If there is any data in these bytes, it is an original dat.
256+
if (anyNonZero)
247257
{
248258
datList.Add(datFilePath);
249259
}
@@ -293,8 +303,18 @@ await Task.Run(async () =>
293303
using (var binaryReader = new BinaryReader(File.OpenRead(datFilePath)))
294304
{
295305
binaryReader.BaseStream.Seek(24, SeekOrigin.Begin);
306+
bool anyNonZero = false;
307+
for (int byteIdx = 0; byteIdx < 8; byteIdx++)
308+
{
309+
if (binaryReader.ReadByte() != 0)
310+
{
311+
anyNonZero = true;
312+
break;
313+
}
314+
}
296315

297-
if (binaryReader.ReadByte() == 0)
316+
// If it's all zeros, this is a custom modded dat.
317+
if(!anyNonZero)
298318
{
299319
datList.Add(datFilePath);
300320
}

0 commit comments

Comments
 (0)