diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-09-10 17:16:52 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-09-10 17:16:52 -0400 |
commit | 1d82e3affd42c2336702af4a644baa8eec249ead (patch) | |
tree | aeea397863a7d2014bd960a9bd3ba090f841bcce /source/link.c | |
parent | 0882d1020d75bbddc8e8fbe30aed435e8814988a (diff) | |
download | gen3uploader-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 'source/link.c')
-rw-r--r-- | source/link.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/source/link.c b/source/link.c index 27837f8..c627039 100644 --- a/source/link.c +++ b/source/link.c | |||
@@ -12,7 +12,7 @@ | |||
12 | 12 | ||
13 | //from my tests 50us seems to be the lowest | 13 | //from my tests 50us seems to be the lowest |
14 | //safe si transfer delay in between calls | 14 | //safe si transfer delay in between calls |
15 | #define SI_TRANS_DELAY 50 | 15 | #define SI_TRANS_DELAY 500 |
16 | 16 | ||
17 | static u8* resbuf; | 17 | static u8* resbuf; |
18 | static u8* cmdbuf; | 18 | static u8* cmdbuf; |
@@ -61,7 +61,7 @@ u32 recv() | |||
61 | SI_Transfer(1, cmdbuf, 1, resbuf, 5, transcb, SI_TRANS_DELAY); | 61 | SI_Transfer(1, cmdbuf, 1, resbuf, 5, transcb, SI_TRANS_DELAY); |
62 | 62 | ||
63 | while (transval == 0); | 63 | while (transval == 0); |
64 | printf("%08lx\n", *(vu32*)resbuf); | 64 | //printf("%08lx\n", *(vu32*)resbuf); |
65 | return *(vu32*)resbuf; | 65 | return *(vu32*)resbuf; |
66 | } | 66 | } |
67 | 67 | ||
@@ -82,14 +82,7 @@ void send(u32 msg) | |||
82 | 82 | ||
83 | u32 getMsg() | 83 | u32 getMsg() |
84 | { | 84 | { |
85 | u32 val = 0; | 85 | u32 val = __builtin_bswap32(recv()); |
86 | while (val == 0) | ||
87 | { | ||
88 | val = __builtin_bswap32(recv()); | ||
89 | } | ||
90 | |||
91 | send(0); | ||
92 | while (recv()!=0); | ||
93 | send(0); | 86 | send(0); |
94 | 87 | ||
95 | return val; | 88 | return val; |
@@ -105,10 +98,7 @@ void getMsgArr(u32* arr, int len) | |||
105 | 98 | ||
106 | void sendMsg(u32 msg) | 99 | void sendMsg(u32 msg) |
107 | { | 100 | { |
108 | while (recv()==0); | ||
109 | send(msg); | 101 | send(msg); |
110 | while (recv()!=0); | ||
111 | send(0); | ||
112 | } | 102 | } |
113 | 103 | ||
114 | void waitForGBA() | 104 | void waitForGBA() |
@@ -157,5 +147,4 @@ void waitForGame() | |||
157 | void waitForAck() | 147 | void waitForAck() |
158 | { | 148 | { |
159 | while (recv() != 0) {sleep(1);} | 149 | while (recv() != 0) {sleep(1);} |
160 | send(0); | ||
161 | } | 150 | } |