Fix accented-a/i for spanish in-game trade

I think this was a PKHeX issue that went unnoticed; originally, we didn't include the Á and Í chars in the dictionary.

I checked the transporter code:
The app maintains the international & japanese character tables, and depending on the ROM language, it may change a char to the language-specific entry. Refer to Bulbapedia's notes on the char tables for different languages:

https://bulbapedia.bulbagarden.net/wiki/Character_encoding_in_Generation_II

However, none of these char-changes are able to be reached with a legal char.

Á and Í (only accessible from the Spanish in-game trades) and the german 0xC0 && z <= 0xC6 chars are already in the international table. Every single difference in the VC1/VC2 table is an un-enterable char.

tl;dr -- all possible char codes are transferred fine with the VC2 table without extra language logic. We just keep out any inaccessible char (replaced with space).
This commit is contained in:
Kurt 2020-11-27 16:49:06 -08:00
parent e9075436b7
commit 67b7d44ced
2 changed files with 11 additions and 29 deletions

View file

@ -1,6 +1,4 @@
using static PKHeX.Core.Species;
namespace PKHeX.Core
namespace PKHeX.Core
{
public sealed class EncounterTrade2 : EncounterTradeGB
{
@ -54,27 +52,6 @@ namespace PKHeX.Core
if (pkm.Korean)
return GetOT((int)LanguageID.Korean) == OT;
if (pkm.Format >= 7)
{
switch (Species)
{
case (int)Voltorb:
// Spanish FALCÁN trade loses the accented A on transfer
if (OT == "FALCÁN")
return false;
if (OT == "FALC N")
return true;
break;
case (int)Shuckle:
// Spanish MANÍA trade loses the accented I on transfer
if (OT == "MANÍA")
return false;
if (OT == "MAN A")
return true;
break;
}
}
const int start = (int)LanguageID.English;
const int end = (int)LanguageID.Spanish;

View file

@ -15,14 +15,14 @@ namespace PKHeX.Core
public static string GetString(byte[] data, bool jp)
{
var table = jp ? jp_table : us_table;
var chars = GetG1ConvertedChar(data, table, jp ? 1 : 2);
var chars = GetG1ConvertedChar(data, table);
if (jp)
chars = CheckKata(chars);
return string.Concat(chars);
}
private static IEnumerable<char> GetG1ConvertedChar(byte[] data, ushort[] table, int lang = -1)
private static IEnumerable<char> GetG1ConvertedChar(byte[] data, ushort[] table)
{
foreach (var b in data)
{
@ -72,10 +72,15 @@ namespace PKHeX.Core
private static readonly char[] Katakana = { 'ベ', 'ペ', 'ヘ', 'リ' };
private static readonly char[] Hiragana = { 'べ', 'ぺ', 'へ', 'り' };
/// <summary>
/// International 1->7 character translation table
/// </summary>
/// <remarks>
/// Exported from Gen1's VC string transferring, with manual modifications for the two permitted accent marks:
/// <br>0xC1 at arr[0xBF] = Á (Spanish In-game Trade Voltorb, FALCÁN)</br>
/// <br>0xCD at arr[0xC9] = Í (Spanish In-game Trade Shuckle, MANÍA)</br>
/// <br>All other new language sensitive re-mapping (or lack thereof) are inaccessible via the character entry screen.</br>
/// </remarks>
private static readonly ushort[] us_table =
{
0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, // 0
@ -89,8 +94,8 @@ namespace PKHeX.Core
0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, // 8
0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x0028, 0x0029, 0x003A, 0x003B, 0x0028, 0x0029, // 9
0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, // A
0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, // B
0x00C4, 0x00D6, 0x00DC, 0x00E4, 0x00F6, 0x00FC, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, // C
0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x00C1, // B
0x00C4, 0x00D6, 0x00DC, 0x00E4, 0x00F6, 0x00FC, 0x0020, 0x0020, 0x0020, 0x00CD, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, // C
0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, // D
0x0020, 0x0050, 0x004D, 0x002D, 0x0020, 0x0020, 0x003F, 0x0021, 0x002D, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0xE08E, // E
0x0020, 0x0078, 0x002E, 0x002F, 0x002C, 0xE08F, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, // F