about summary refs log tree commit diff stats
path: root/gba/source/link.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/link.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/link.c')
-rw-r--r--gba/source/link.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/gba/source/link.c b/gba/source/link.c index 26443c8..05e4732 100644 --- a/gba/source/link.c +++ b/gba/source/link.c
@@ -12,9 +12,9 @@
12 12
13void initializeLink() 13void initializeLink()
14{ 14{
15 REG_HS_CTRL |= JOY_RW;
16 REG_JOYTR = 0; 15 REG_JOYTR = 0;
17 while ((REG_HS_CTRL & JOY_WRITE) == 0); 16 REG_HS_CTRL |= JOY_RW;
17 while ((REG_HS_CTRL & JOY_READ) == 0);
18 REG_HS_CTRL |= JOY_RW; 18 REG_HS_CTRL |= JOY_RW;
19} 19}
20 20
@@ -22,29 +22,22 @@ void waitForAck()
22{ 22{
23 while ((REG_HS_CTRL & JOY_WRITE) == 0); 23 while ((REG_HS_CTRL & JOY_WRITE) == 0);
24 REG_HS_CTRL |= JOY_RW; 24 REG_HS_CTRL |= JOY_RW;
25 REG_JOYTR = 0;
26 while ((REG_HS_CTRL & JOY_WRITE) == 0);
27 REG_HS_CTRL |= JOY_RW;
28} 25}
29 26
30u32 waitForResponse() 27u32 waitForResponse()
31{ 28{
32 u32 val; 29 u32 val;
33 30
34 REG_JOYTR = 1;
35 while ((REG_HS_CTRL & JOY_WRITE) == 0);
36 val = REG_JOYRE;
37 REG_HS_CTRL |= JOY_RW;
38 REG_JOYTR = 0;
39 while ((REG_HS_CTRL & JOY_WRITE) == 0); 31 while ((REG_HS_CTRL & JOY_WRITE) == 0);
40 REG_HS_CTRL |= JOY_RW; 32 REG_HS_CTRL |= JOY_RW;
33 val = REG_JOYRE;
41 34
42 return val; 35 return val;
43} 36}
44 37
45void sendS32(s32 val) 38void sendS32(s32 val)
46{ 39{
47 REG_JOYTR = val; 40 sendU32(val);
48} 41}
49 42
50void sendU32(u32 val) 43void sendU32(u32 val)