about summary refs log tree commit diff stats
path: root/gba/source/exptables.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-07-11 18:14:18 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-07-11 18:14:18 -0400
commitec66a022a8879a5300f2ae64cd86a5d8cfbd1a36 (patch)
tree06e096126cf673be5cfd9dd1ff164c8d46520de9 /gba/source/exptables.h
parent57afb4058710a978bd7b07a368125d04378c62f1 (diff)
downloadgen3uploader-ec66a022a8879a5300f2ae64cd86a5d8cfbd1a36.tar.gz
gen3uploader-ec66a022a8879a5300f2ae64cd86a5d8cfbd1a36.tar.bz2
gen3uploader-ec66a022a8879a5300f2ae64cd86a5d8cfbd1a36.zip
Things are semi-reliably working now!
A good portion of the time, the Wii will display:

Pokemon LeafGreen
Trainer: Starla (34182)

which is the correct data on the cartridge I am testing with.

Most of the GBA changes are within comments and are unimportant. I did
uncomment the portion where it sends over the trainer's name, and I
fixed how it reads the trainer ID from memory.

The Wii changes involve properly cooperating in the message sending
protocol I'm having the GBA and Wii use.

More description regarding protocol: I'm not super familiar with the
JOY BUS protocol because it's undocumented, but there seems to be this
issue where the Wii reads the same value multiple times from the cable,
and since the cable is used to negotiate the multiboot image, I need to
make sure that the Wii and GBA are on the same page. Since the last
message that the GBA sends is nonzero, I have the GBA image start by
sending a zero and waiting for a response, and I have the Wii wait for a
zero. The Wii then sends a zero in response to the GBA. From then on,
the message sending protocol works like so:

Wii: waits for non-zero value
GBA: sends non-zero value, waits for any response
Wii: reads message, sends 0 response, waits for 0 response
GBA: receives response, sends 0 response, waits for any response
Wii: reads 0, continues on with program

The reason for this is to prevent incorrect communication caused by the
Wii reading the same value from the GBA multiple times by essentially
delimiting the message. This is currently pretty slow because I have
debugging messages and sleeps everywhere. I will clean this code up, but
this project is slightly dark magic right now and I wanted to commit
something that worked in the slightest.

Also added a debug function that transcodes from the proprietary gen 3
encoding to ASCII in the domain of characters that can actually be used
in names (except for the 6 special German ones). Thanks to Bulbapedia
(https://bulbapedia.bulbagarden.net/wiki/Character_encoding_in_Generation_III)
for this. It's used for now to display the Trainer name on the console.
It assumes that the cartridge is non-Japanese; this will be addressed.
I'm not currently planning on transcoding names before transmitting them,
because of the fact that there are characters in the character set that
are not present in any other character set, and thus transcoding them
spuriously (like PK -> P,K) is a loss of data. However, it is true that
no such characters exist in the set of characters that can be used for
names (in either the Japanese or non-Japanese encoding), so I may later
decide to transcode to Unicode on the Wii before transmitting.
Diffstat (limited to 'gba/source/exptables.h')
0 files changed, 0 insertions, 0 deletions