Parse cmap properly for newer bffnt

This commit is contained in:
KillzXGaming 2019-07-17 19:10:52 -04:00
parent 80655a6aaa
commit de13d285b1
2 changed files with 16 additions and 4 deletions

Binary file not shown.

View file

@ -711,7 +711,7 @@ namespace FirstPlugin
reader.ReadSignature(4, "CMAP");
SectionSize = reader.ReadUInt32();
if (header.Version.SwapBytes() > 0x3000000 || header.Version > 0x00000103)
if (header.Version > 0x3000000 || header.Version > 0x00000103)
{
CodeBegin = reader.ReadUInt32();
CodeEnd = reader.ReadUInt32();
@ -754,9 +754,21 @@ namespace FirstPlugin
var CharEntryCount = reader.ReadUInt16();
for (int i = 0; i < CharEntryCount; i++)
{
char charCode = reader.ReadChar();
short index = reader.ReadInt16();
if (index != -1) header.FontSection.CodeMapDictionary[charCode] = index;
if (header.Version > 0x3000000 || header.Version > 0x00000103)
{
//Seems to have a spacing of a ushort for each entry
char charCode = reader.ReadChar();
short padding = reader.ReadInt16();
short index = reader.ReadInt16();
short padding2 = reader.ReadInt16();
if (index != -1) header.FontSection.CodeMapDictionary[charCode] = index;
}
else
{
char charCode = reader.ReadChar();
short index = reader.ReadInt16();
if (index != -1) header.FontSection.CodeMapDictionary[charCode] = index;
}
}
break;
}