diff --git a/UndertaleModLib/Models/UndertaleFont.cs b/UndertaleModLib/Models/UndertaleFont.cs index 7b2dd5b11..34a495aff 100644 --- a/UndertaleModLib/Models/UndertaleFont.cs +++ b/UndertaleModLib/Models/UndertaleFont.cs @@ -295,7 +295,7 @@ public void Serialize(UndertaleWriter writer) writer.Write(AscenderOffset); if (writer.undertaleData.IsVersionAtLeast(2022, 2)) writer.Write(Ascender); - if (writer.undertaleData.IsVersionAtLeast(2023, 2)) + if (writer.undertaleData.IsNonLTSVersionAtLeast(2023, 2)) writer.Write(SDFSpread); if (writer.undertaleData.IsVersionAtLeast(2023, 6)) writer.Write(LineHeight); @@ -335,7 +335,7 @@ public void Unserialize(UndertaleReader reader) AscenderOffset = reader.ReadInt32(); if (reader.undertaleData.IsVersionAtLeast(2022, 2)) Ascender = reader.ReadUInt32(); - if (reader.undertaleData.IsVersionAtLeast(2023, 2)) + if (reader.undertaleData.IsNonLTSVersionAtLeast(2023, 2)) SDFSpread = reader.ReadUInt32(); if (reader.undertaleData.IsVersionAtLeast(2023, 6)) LineHeight = reader.ReadUInt32(); @@ -350,7 +350,7 @@ public static uint UnserializeChildObjectCount(UndertaleReader reader) skipSize += 4; // AscenderOffset if (reader.undertaleData.IsVersionAtLeast(2022, 2)) skipSize += 4; // Ascender - if (reader.undertaleData.IsVersionAtLeast(2023, 2)) + if (reader.undertaleData.IsNonLTSVersionAtLeast(2023, 2)) skipSize += 4; // SDFSpread if (reader.undertaleData.IsVersionAtLeast(2023, 6)) skipSize += 4; // LineHeight diff --git a/UndertaleModLib/UndertaleChunks.cs b/UndertaleModLib/UndertaleChunks.cs index 69614070f..c80846906 100644 --- a/UndertaleModLib/UndertaleChunks.cs +++ b/UndertaleModLib/UndertaleChunks.cs @@ -754,7 +754,10 @@ private void CheckForGM2023_6(UndertaleReader reader) if (reader.ReadUInt32() > 0) // Font count { uint firstFontPointer = reader.ReadUInt32(); - reader.AbsPosition = firstFontPointer + 56; // Two more values: SDFSpread and LineHeight. 48 + 4 + 4 = 56. + reader.AbsPosition = firstFontPointer + 52; // Also the LineHeight value. 48 + 4 = 52. + if (reader.undertaleData.IsNonLTSVersionAtLeast(2023, 2)) // SDFSpread is present from 2023.2 non-LTS onward + reader.AbsPosition += 4; // (detected by PSEM/PSYS chunk existence) + uint glyphsLength = reader.ReadUInt32(); GMS2023_6 = true; if ((glyphsLength * 4) > this.Length)