From 560320e2cc7efce1baf41b73ece84b6dcdf61c94 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 21 Jan 2024 23:44:12 -0800 Subject: [PATCH] Fix gen4 encoding of `?` --- .../Legality/Evolutions/Forward/EvolutionForwardPersonal.cs | 2 +- .../Legality/Evolutions/Forward/EvolutionForwardSpecies.cs | 2 +- PKHeX.Core/PKM/Strings/StringConverter4.cs | 2 +- PKHeX.Core/PKM/Strings/StringConverter4Util.cs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/PKHeX.Core/Legality/Evolutions/Forward/EvolutionForwardPersonal.cs b/PKHeX.Core/Legality/Evolutions/Forward/EvolutionForwardPersonal.cs index 9ee208e44..439f056ed 100644 --- a/PKHeX.Core/Legality/Evolutions/Forward/EvolutionForwardPersonal.cs +++ b/PKHeX.Core/Legality/Evolutions/Forward/EvolutionForwardPersonal.cs @@ -68,7 +68,7 @@ public sealed class EvolutionForwardPersonal(EvolutionMethod[][] Entries, IPerso Method = method.Method, // Temporarily store these and overwrite them when we clean the list. - LevelMin = Math.Max(min, method.Level), + LevelMin = Math.Max((byte)(min + method.LevelUp), method.Level), LevelUpRequired = GetLevelUp(method.LevelUp, currentMaxLevel, tweak), }; diff --git a/PKHeX.Core/Legality/Evolutions/Forward/EvolutionForwardSpecies.cs b/PKHeX.Core/Legality/Evolutions/Forward/EvolutionForwardSpecies.cs index 3c1461901..2e70b1d3d 100644 --- a/PKHeX.Core/Legality/Evolutions/Forward/EvolutionForwardSpecies.cs +++ b/PKHeX.Core/Legality/Evolutions/Forward/EvolutionForwardSpecies.cs @@ -69,7 +69,7 @@ public sealed class EvolutionForwardSpecies(EvolutionMethod[][] Entries) : IEvol Method = method.Method, // Temporarily store these and overwrite them when we clean the list. - LevelMin = Math.Max(min, method.Level), + LevelMin = Math.Max((byte)(min + method.LevelUp), method.Level), LevelUpRequired = method.LevelUp, // No need to tweak this, all games of this Type have the same default behavior. }; } diff --git a/PKHeX.Core/PKM/Strings/StringConverter4.cs b/PKHeX.Core/PKM/Strings/StringConverter4.cs index b93797e49..9c2825bfc 100644 --- a/PKHeX.Core/PKM/Strings/StringConverter4.cs +++ b/PKHeX.Core/PKM/Strings/StringConverter4.cs @@ -9,7 +9,7 @@ namespace PKHeX.Core; /// public static class StringConverter4 { - private const ushort Terminator = 0xFFFF; + public const ushort Terminator = 0xFFFF; /// Converts Generation 4 encoded data to decoded string. /// Encoded data diff --git a/PKHeX.Core/PKM/Strings/StringConverter4Util.cs b/PKHeX.Core/PKM/Strings/StringConverter4Util.cs index 950c58f69..63efdc725 100644 --- a/PKHeX.Core/PKM/Strings/StringConverter4Util.cs +++ b/PKHeX.Core/PKM/Strings/StringConverter4Util.cs @@ -68,8 +68,8 @@ public static class StringConverter4Util private const int TableKORStart = 0x400; private const int TableKOREnd = 0xD65; - private const ushort SaveInvalidAs = 0x0428; // '?' - private const char NUL = '?'; + private const ushort SaveInvalidAs = 0x1AC; // '?' + private const char NUL = (char)StringConverter4.Terminator; private const char EMP = NUL; // Empty, not available on keyboard. private const char YEN = NUL; // Yen, not available on keyboard.