Skip to content

Commit dfdb3d2

Browse files
Fix dyes being off-by-one
1 parent 33dbcfb commit dfdb3d2

File tree

1 file changed

+4
-2
lines changed
  • xivModdingFramework/Materials/FileTypes

1 file changed

+4
-2
lines changed

xivModdingFramework/Materials/FileTypes/STM.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,13 @@ public StainingTemplateEntry(byte[] data, int offset, EStainingTemplate template
287287
if(type == StainingTemplateArrayType.Indexed)
288288
{
289289
var nArray = new List<Half[]>();
290-
for (int i = 0; i < numDyes; i++)
290+
// The first entry in the list is an 0xFF byte that we skip
291+
// Since that would leave us with one less value than we need, as dummy value is added for the last dye
292+
for (int i = 1; i < numDyes + 1; i++)
291293
{
292294
try
293295
{
294-
var index = data[indexStart + i];
296+
var index = (i == numDyes) ? 255 : data[indexStart + i];
295297
if (index == 255 || index == 0)
296298
{
297299
if (x < 3)

0 commit comments

Comments
 (0)