about summary refs log tree commit diff stats
path: root/gba/source/main.c
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-09-10 17:16:52 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-09-10 17:16:52 -0400
commit1d82e3affd42c2336702af4a644baa8eec249ead (patch)
treeaeea397863a7d2014bd960a9bd3ba090f841bcce /gba/source/main.c
parent0882d1020d75bbddc8e8fbe30aed435e8814988a (diff)
downloadgen3uploader-1d82e3affd42c2336702af4a644baa8eec249ead.tar.gz
gen3uploader-1d82e3affd42c2336702af4a644baa8eec249ead.tar.bz2
gen3uploader-1d82e3affd42c2336702af4a644baa8eec249ead.zip
Increased stability and added support for non-English names
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.
Diffstat (limited to 'gba/source/main.c')
-rw-r--r--gba/source/main.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gba/source/main.c b/gba/source/main.c index aeb05af..0934e91 100644 --- a/gba/source/main.c +++ b/gba/source/main.c
@@ -113,6 +113,21 @@ int main(void)
113 sendU32(trainerIdNum); 113 sendU32(trainerIdNum);
114 waitForAck(); 114 waitForAck();
115 115
116 // Send cart language.
117 u8 cartLang = 0;
118 switch (*(u8*)(0x80000AF))
119 {
120 case 'J': cartLang = Japanese; break;
121 case 'E': cartLang = English; break;
122 case 'F': cartLang = French; break;
123 case 'I': cartLang = Italian; break;
124 case 'D': cartLang = German; break;
125 case 'S': cartLang = Spanish; break;
126 }
127
128 sendU32(cartLang);
129 waitForAck();
130
116 // Does the player want to import this game? 131 // Does the player want to import this game?
117 if (waitForResponse() == 0) 132 if (waitForResponse() == 0)
118 { 133 {
@@ -193,7 +208,7 @@ int main(void)
193 208
194 struct PokemonIntermediate pki; 209 struct PokemonIntermediate pki;
195 210
196 PokemonIntermediateInit(&pki, bpkm, trainerIdNum, secretIdNum, &gameData); 211 PokemonIntermediateInit(&pki, bpkm, trainerIdNum, secretIdNum);
197 PokemonIntermediateStream(&pki); 212 PokemonIntermediateStream(&pki);
198 } 213 }
199} 214}