Skip to content

Commit 86a7acc

Browse files
committed
- Set dyeable byte appropriately if not already set when bringing in dye data.
1 parent c7bf074 commit 86a7acc

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

xivModdingFramework/Materials/DataContainers/XivMtrl.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -465,13 +465,16 @@ public void SetShaderInfo(ShaderInfo info, bool forced = false)
465465
{
466466
TexturePathUnknownList[idx] = 0;
467467
}
468+
468469
for (var idx = 0; idx < Unknown2.Length; idx++)
469470
{
470-
Unknown2[idx] = 0;
471-
}
472-
if (Unknown2.Length > 0)
473-
{
474-
Unknown2[0] = 12;
471+
if(idx == 0)
472+
{
473+
Unknown2[idx] = 12;
474+
} else
475+
{
476+
Unknown2[idx] = 0;
477+
}
475478
}
476479
}
477480

xivModdingFramework/Textures/FileTypes/Tex.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -992,16 +992,16 @@ public async Task<int> TexColorImporter(XivMtrl xivMtrl, DirectoryInfo ddsFileDi
992992

993993

994994
colorSetData = GetColorsetDataFromDDS(ddsFileDirectory);
995-
996-
// If the colorset size is 544, it contains extra data that must be imported
997-
if (xivMtrl.ColorSetDataSize == 544)
998-
{
999-
colorSetExtraData = GetColorsetExtraDataFromDDS(ddsFileDirectory);
1000-
}
995+
colorSetExtraData = GetColorsetExtraDataFromDDS(ddsFileDirectory);
1001996

1002997
// Replace the color set data with the imported data
1003998
xivMtrl.ColorSetData = colorSetData;
1004999
xivMtrl.ColorSetExtraData = colorSetExtraData;
1000+
if (xivMtrl.Unknown2.Length > 0)
1001+
{
1002+
// This byte enables the dye set if it's not already enabled.
1003+
xivMtrl.Unknown2[0] = 12;
1004+
}
10051005

10061006
var mtrl = new Mtrl(_gameDirectory, xivMtrl.TextureTypePathList[0].DataFile, lang);
10071007
return await mtrl.ImportMtrl(xivMtrl, item, source);
@@ -1110,6 +1110,12 @@ public byte[] DDStoMtrlData(XivMtrl xivMtrl, DirectoryInfo ddsFileDirectory, IIt
11101110
xivMtrl.ColorSetData = colorSetData;
11111111
xivMtrl.ColorSetExtraData = colorSetExtraData;
11121112

1113+
if (xivMtrl.Unknown2.Length > 0)
1114+
{
1115+
// This byte enables the dye set if it's not already enabled.
1116+
xivMtrl.Unknown2[0] = 12;
1117+
}
1118+
11131119
var mtrl = new Mtrl(_gameDirectory, xivMtrl.TextureTypePathList[0].DataFile, lang);
11141120
return mtrl.CreateMtrlFile(xivMtrl, item);
11151121
}

0 commit comments

Comments
 (0)