From 8d0af0bd5ba71077dc0a9eacb0a612ea2d6b16da Mon Sep 17 00:00:00 2001 From: Kurt Date: Tue, 26 Sep 2017 19:56:08 -0700 Subject: [PATCH] Handle all gc remapped languages good stuff genius sonority --- PKHeX.Core/PKM/PKX.cs | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/PKHeX.Core/PKM/PKX.cs b/PKHeX.Core/PKM/PKX.cs index 3e4227fc1..7d9d022bc 100644 --- a/PKHeX.Core/PKM/PKX.cs +++ b/PKHeX.Core/PKM/PKX.cs @@ -788,18 +788,44 @@ namespace PKHeX.Core } /// - /// Gets the Main Series language ID from a GameCube (C/XD) language ID. Re-maps Spanish 6->7. + /// Gets the Main Series language ID from a GameCube (C/XD) language ID. /// /// GameCube (C/XD) language ID. /// Main Series language ID. - public static byte GetMainLangIDfromGC(byte value) => value == 6 ? (byte)7 : value; + public static byte GetMainLangIDfromGC(byte value) + { + if (value <= 2 || value > 7) + return value; + return GCtoMainSeries[value]; + } + private static readonly Dictionary GCtoMainSeries = new Dictionary + { + {3, 5}, // German + {4, 3}, // French + {5, 4}, // Italian + {6, 7}, // Spanish + {7, 6}, // Korean (Unused) + }; /// - /// Gets the GameCube (C/XD) language ID from a Main Series language ID. Re-maps Spanish 7->6. + /// Gets the GameCube (C/XD) language ID from a Main Series language ID. /// /// Main Series language ID. /// GameCube (C/XD) language ID. - public static byte GetGCLangIDfromMain(byte value) => value == 7 ? (byte)6 : value; + public static byte GetGCLangIDfromMain(byte value) + { + if (value <= 2 || value > 7) + return value; + return MainSeriesToGC[value]; + } + private static readonly Dictionary MainSeriesToGC = new Dictionary + { + {5, 3}, // German + {3, 4}, // French + {4, 5}, // Italian + {7, 6}, // Spanish + {6, 7}, // Korean (Unused) + }; /// /// Gets an array of valid file extensions.