From 1d82e3affd42c2336702af4a644baa8eec249ead Mon Sep 17 00:00:00 2001
From: Kelly Rauchenberger <fefferburbia@gmail.com>
Date: Sun, 10 Sep 2017 17:16:52 -0400
Subject: Increased stability and added support for non-English names
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The GameCube side of the program now can convert from the propietary
character set to UTF-8. This is useful for representing names of Pokémon
and players in a neutral way. The propietary character set is mostly
compatible between the six languages supported by the games (as in, the
hiragana and katakana characters unique to Japanese occupy spaces not
used by the other languages for names, as do the letters with umlauts
unique to German). However, six codepoints differ between the Japanese
and non-Japanese character sets, and an additional two differ even
amongst the non-Japanese sets. Because of this, the function that
converts to UTF-8 takes a language as a parameter, and uses the correct
characters for that language.

From there, the behavior of this function differs slightly to that of
the games. In the non-Japanese games, the Japanese encoding is used if
the Pokémon in question originated in a Japanese game, and the
non-Japanese encoding (disregarding the regional differences in the two
codepoints mentioned earlier) otherwise. In the Japanese games, the
Japanese encoding is used regardless of the Pokémon's origin. The
decoding function I wrote always uses the character set corresponding to
the language of the Pokémon's origin, because that most accurately
represents the name given to it, and will not change just because the
Pokémon was traded to a different game. The character set used for the
name of the player is the one corresponding to the language of the
cartridge.

Additionally, a number of changes were made to the communication
protocol between the GameCube and the GBA that appear to have
dramatically increased stability. The most significant of these is
likely that the transfer delay was increased tenfold. This causes the
multiboot image to take slightly longer to download to the GBA, but the
difference is not large enough to outweigh the benefits of the increased
stability.
---
 include/pokemon.h | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

(limited to 'include')

diff --git a/include/pokemon.h b/include/pokemon.h
index 80e7ee7..d8a7265 100644
--- a/include/pokemon.h
+++ b/include/pokemon.h
@@ -11,6 +11,15 @@
 #define OT_NAME_LENGTH 7
 #define TILE_SIZE_4BPP 32
 
+enum PokemonLanguage {
+  Japanese = 1,
+  English = 2,
+  French = 3,
+  Italian = 4,
+  German = 5,
+  Spanish = 7
+};
+
 struct PokemonIntermediate {
   u32 otId;
   u32 experience;
@@ -35,7 +44,9 @@ struct PokemonIntermediate {
   u8 nickname[POKEMON_NAME_LENGTH];
   u8 otName[OT_NAME_LENGTH];
   u8 pokeball;
-  u8 altAbility; // waste of space but nothing to pack it with
+  u8 language:3;
+  u8 altAbility:1;
+  u8 filler:4; // waste of space but nothing to pack it with
 
   // the following values are generated from the personality value.
   u8 nature:6;
-- 
cgit 1.4.1