Skip to content

Commit 3828645

Browse files
authored
Merge pull request #107 from Haselnussbomber/uld-theme-support
Update WidgetData, TextureEntry
2 parents fd934c2 + 912b9a0 commit 3828645

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

src/Lumina/Data/Files/UldFile.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ public override void LoadFile()
3434

3535
Reader.Seek( preComponentPos + ComponentHeader.AssetListOffset );
3636
AssetList = UldRoot.PartHeader.Read( Reader );
37+
var assetListVersionU32 = uint.Parse( new string( AssetList.Version ) );
3738
AssetData = new UldRoot.TextureEntry[AssetList.ElementCount];
3839
for( var i = 0; i < AssetList.ElementCount; i++ )
39-
AssetData[ i ] = UldRoot.TextureEntry.Read( Reader, AssetList.Version[ 3 ] );
40+
AssetData[ i ] = UldRoot.TextureEntry.Read( Reader, assetListVersionU32 );
4041

4142
Reader.Seek( preComponentPos + ComponentHeader.PartListOffset );
4243
PartList = UldRoot.PartHeader.Read( Reader );

src/Lumina/Data/Parsing/Uld/UldRoot.cs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Lumina.Data.Parsing.Uld
1111
/// </summary>
1212
public static class UldRoot
1313
{
14-
public enum AlignmentType
14+
public enum AlignmentType : byte
1515
{
1616
TopLeft = 0x0,
1717
Top = 0x1,
@@ -119,18 +119,24 @@ public struct TextureEntry
119119
{
120120
public uint Id;
121121
public char[] Path; // 44? wtf?
122+
public uint IconId;
123+
public byte ThemeSupportBitmask; // Only used when WidgetData.AssetsHaveThemeSupport is true. Example: 4 (0b100) means it's only available in fourth/, while 7 (0b111) means it's available in light/, third/ and fourth/
122124

123-
//unk2 seems to always be 1
124-
public uint Unk1;
125-
public uint Unk2;
126-
127-
public static TextureEntry Read( LuminaBinaryReader br, char minorVersion )
125+
public static TextureEntry Read( LuminaBinaryReader br, uint version )
128126
{
129127
TextureEntry ret = new TextureEntry();
130128
ret.Id = br.ReadUInt32();
131129
ret.Path = br.ReadChars( 44 );
132-
ret.Unk1 = br.ReadUInt32();
133-
ret.Unk2 = minorVersion == '1' ? br.ReadUInt32() : 0;
130+
ret.IconId = br.ReadUInt32();
131+
if ( version >= 100 )
132+
{
133+
ret.ThemeSupportBitmask = br.ReadByte();
134+
br.BaseStream.Position += 3;
135+
}
136+
else
137+
{
138+
ret.ThemeSupportBitmask = 0;
139+
}
134140
return ret;
135141
}
136142
}
@@ -611,6 +617,7 @@ public struct WidgetData
611617
{
612618
public uint Id;
613619
public AlignmentType AlignmentType;
620+
public bool AssetsHaveThemeSupport;
614621
public short X;
615622
public short Y;
616623
public ushort NodeCount;
@@ -622,7 +629,9 @@ public static WidgetData Read( LuminaBinaryReader br, ComponentData[] definedCom
622629
{
623630
WidgetData ret = new WidgetData();
624631
ret.Id = br.ReadUInt32();
625-
ret.AlignmentType = (AlignmentType)br.ReadInt32();
632+
ret.AlignmentType = (AlignmentType)br.ReadByte();
633+
ret.AssetsHaveThemeSupport = br.ReadBoolean();
634+
br.BaseStream.Position += 2;
626635
ret.X = br.ReadInt16();
627636
ret.Y = br.ReadInt16();
628637
ret.NodeCount = br.ReadUInt16();

0 commit comments

Comments
 (0)