Skip to content

Commit aa2c760

Browse files
committed
- Split VFX IMC value into VFX and Animation bytes to reflect better understanding of IMC data.
1 parent f9cee90 commit aa2c760

File tree

2 files changed

+35
-20
lines changed

2 files changed

+35
-20
lines changed

xivModdingFramework/Variants/DataContainers/XivImc.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ public class XivImc : ICloneable
5454
/// Only a few items have VFX data associated with them
5555
/// Some examples would be any of the Lux weapons
5656
/// </remarks>
57-
public ushort Vfx { get; set; }
57+
public byte Vfx { get; set; }
58+
59+
/// <summary>
60+
/// Material animation byte
61+
/// </summary>
62+
public byte Animation { get; set; }
5863

5964
/// <summary>
6065
/// Returns the raw bytes that make up this IMC entry.
@@ -66,7 +71,8 @@ public byte[] GetBytes(ImcType type)
6671
bytes.Add(MaterialSet);
6772
bytes.Add(Decal);
6873
bytes.AddRange(BitConverter.GetBytes(Mask));
69-
bytes.AddRange(BitConverter.GetBytes(Vfx));
74+
bytes.Add(Vfx);
75+
bytes.Add(Animation);
7076
return bytes.ToArray();
7177
}
7278

xivModdingFramework/Variants/FileTypes/Imc.cs

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ public async Task<List<XivImc>> GetEntries(List<string> pathsWithOffsets, bool f
218218
MaterialSet = br.ReadByte(),
219219
Decal = br.ReadByte(),
220220
Mask = br.ReadUInt16(),
221-
Vfx = br.ReadUInt16()
221+
Vfx = br.ReadByte(),
222+
Animation = br.ReadByte()
222223
});
223224
}
224225

@@ -279,6 +280,7 @@ internal async Task SaveEntries(string path, string slot, List<XivImc> entries)
279280
e.Mask = entries[i].Mask;
280281
e.Decal = entries[i].Decal;
281282
e.Vfx = entries[i].Vfx;
283+
e.Animation = entries[i].Animation;
282284
e.MaterialSet = entries[i].MaterialSet;
283285

284286
if (i >= info.SubsetCount + 1)
@@ -298,7 +300,8 @@ public static byte[] SerializeEntry(XivImc entry)
298300
bytes.Add((byte)entry.MaterialSet);
299301
bytes.Add((byte)entry.Decal);
300302
bytes.AddRange(BitConverter.GetBytes((ushort)entry.Mask));
301-
bytes.AddRange(BitConverter.GetBytes((ushort)entry.Vfx));
303+
bytes.Add((byte)entry.Vfx);
304+
bytes.Add((byte)entry.Animation);
302305
return bytes.ToArray();
303306
}
304307

@@ -310,13 +313,15 @@ public static XivImc DeserializeEntry(byte[] data)
310313
byte variant = br.ReadByte();
311314
byte unknown = br.ReadByte();
312315
ushort mask = br.ReadUInt16();
313-
ushort vfx = br.ReadUInt16();
316+
byte vfx = br.ReadByte();
317+
byte anim = br.ReadByte();
314318
return new XivImc
315319
{
316320
MaterialSet = variant,
317321
Decal = unknown,
318322
Mask = mask,
319-
Vfx = vfx
323+
Vfx = vfx,
324+
Animation = anim
320325
};
321326

322327
}
@@ -364,29 +369,33 @@ public async Task<FullImcInfo> GetFullImcInfo(string path)
364369
byte variant = br.ReadByte();
365370
byte unknown = br.ReadByte();
366371
ushort mask = br.ReadUInt16();
367-
ushort vfx = br.ReadUInt16();
372+
byte vfx = br.ReadByte();
373+
byte anim = br.ReadByte();
368374

369375
imcData.DefaultSubset.Add(new XivImc
370376
{
371377
MaterialSet = variant,
372378
Decal = unknown,
373379
Mask = mask,
374-
Vfx = variant
380+
Vfx = variant,
381+
Animation = anim
375382
});
376383

377384
for (var i = 0; i < subsetCount; i++)
378385
{
379386
variant = br.ReadByte();
380387
unknown = br.ReadByte();
381388
mask = br.ReadUInt16();
382-
vfx = br.ReadUInt16();
389+
vfx = br.ReadByte();
390+
anim = br.ReadByte();
383391

384392
var newEntry = new XivImc
385393
{
386394
MaterialSet = variant,
387395
Decal = unknown,
388396
Mask = mask,
389-
Vfx = vfx
397+
Vfx = vfx,
398+
Animation = anim
390399
};
391400
var subset = new List<XivImc>() { newEntry };
392401
imcData.SubsetList.Add(subset);
@@ -398,15 +407,15 @@ public async Task<FullImcInfo> GetFullImcInfo(string path)
398407
imcData.DefaultSubset = new List<XivImc>()
399408
{
400409
new XivImc
401-
{MaterialSet = br.ReadByte(), Decal = br.ReadByte(), Mask = br.ReadUInt16(), Vfx = br.ReadUInt16()},
410+
{MaterialSet = br.ReadByte(), Decal = br.ReadByte(), Mask = br.ReadUInt16(), Vfx = br.ReadByte(), Animation = br.ReadByte()},
402411
new XivImc
403-
{MaterialSet = br.ReadByte(), Decal = br.ReadByte(), Mask = br.ReadUInt16(), Vfx = br.ReadUInt16()},
412+
{MaterialSet = br.ReadByte(), Decal = br.ReadByte(), Mask = br.ReadUInt16(), Vfx = br.ReadByte(), Animation = br.ReadByte()},
404413
new XivImc
405-
{MaterialSet = br.ReadByte(), Decal = br.ReadByte(), Mask = br.ReadUInt16(), Vfx = br.ReadUInt16()},
414+
{MaterialSet = br.ReadByte(), Decal = br.ReadByte(), Mask = br.ReadUInt16(), Vfx = br.ReadByte(), Animation = br.ReadByte()},
406415
new XivImc
407-
{MaterialSet = br.ReadByte(), Decal = br.ReadByte(), Mask = br.ReadUInt16(), Vfx = br.ReadUInt16()},
416+
{MaterialSet = br.ReadByte(), Decal = br.ReadByte(), Mask = br.ReadUInt16(), Vfx = br.ReadByte(), Animation = br.ReadByte()},
408417
new XivImc
409-
{MaterialSet = br.ReadByte(), Decal = br.ReadByte(), Mask = br.ReadUInt16(), Vfx = br.ReadUInt16()},
418+
{MaterialSet = br.ReadByte(), Decal = br.ReadByte(), Mask = br.ReadUInt16(), Vfx = br.ReadByte(), Animation = br.ReadByte()},
410419
};
411420

412421
for (var i = 0; i < subsetCount; i++)
@@ -415,15 +424,15 @@ public async Task<FullImcInfo> GetFullImcInfo(string path)
415424
var imcGear = new List<XivImc>()
416425
{
417426
new XivImc
418-
{MaterialSet = br.ReadByte(), Decal = br.ReadByte(), Mask = br.ReadUInt16(), Vfx = br.ReadUInt16()},
427+
{MaterialSet = br.ReadByte(), Decal = br.ReadByte(), Mask = br.ReadUInt16(), Vfx = br.ReadByte(), Animation = br.ReadByte()},
419428
new XivImc
420-
{MaterialSet = br.ReadByte(), Decal = br.ReadByte(), Mask = br.ReadUInt16(), Vfx = br.ReadUInt16()},
429+
{MaterialSet = br.ReadByte(), Decal = br.ReadByte(), Mask = br.ReadUInt16(), Vfx = br.ReadByte(), Animation = br.ReadByte()},
421430
new XivImc
422-
{MaterialSet = br.ReadByte(), Decal = br.ReadByte(), Mask = br.ReadUInt16(), Vfx = br.ReadUInt16()},
431+
{MaterialSet = br.ReadByte(), Decal = br.ReadByte(), Mask = br.ReadUInt16(), Vfx = br.ReadByte(), Animation = br.ReadByte()},
423432
new XivImc
424-
{MaterialSet = br.ReadByte(), Decal = br.ReadByte(), Mask = br.ReadUInt16(), Vfx = br.ReadUInt16()},
433+
{MaterialSet = br.ReadByte(), Decal = br.ReadByte(), Mask = br.ReadUInt16(), Vfx = br.ReadByte(), Animation = br.ReadByte()},
425434
new XivImc
426-
{MaterialSet = br.ReadByte(), Decal = br.ReadByte(), Mask = br.ReadUInt16(), Vfx = br.ReadUInt16()},
435+
{MaterialSet = br.ReadByte(), Decal = br.ReadByte(), Mask = br.ReadUInt16(), Vfx = br.ReadByte(), Animation = br.ReadByte()},
427436
};
428437
imcData.SubsetList.Add(imcGear);
429438
}

0 commit comments

Comments
 (0)