Glitch City Laboratories Archives

Glitch City Laboratories closed on 1 September 2020 (announcement). This is an archived copy of a thread from Glitch City Laboratories Forums.

You can join Glitch City Research Institute to ask questions or discuss current developments.

You may also download the archive of this forum in .tar.gz, .sql.gz, or .sqlite.gz formats.

Emulation & ROM Hacking

Anatomy of an e-Reader Mystery Event - Page 2

Re: Anatomy of an e-Reader Mystery Event

Posted by: Torchickens
Date: 2014-11-24 16:43:42
Thanks for your reply.


Interesting. Is that Berry data in the final game too?

No. It doesnt even exist coherently in the debug ROMits pieced together at runtime from the actual Cheri Berry data and a few scattered stringsbut those strings arent in the final Japanese ROM.


Oh, OK.

Re: Anatomy of an e-Reader Mystery Event

Posted by: Háčky
Date: 2014-11-25 03:46:16
$45E606: In-game clock adjustment?
The type $0E chunk has zero bytes of data, and results in the message Das spielinterne Zeiteingabe-System ist jetzt verfügbar. (The in-game clock adjustment system is now useable.)

Does anyone know what the in-game clock adjustment system is? It didnt enable me to change the time on the clock in my bedroom.

The clock function sends this. Im not convinced of TCRFs claim that this is related to the berry glitch.

Found it! After this Mystery Event is sent, pressing Left + Select + B on the games title screen will activate a screen that asks Reset RTC? A: Confirm, B: Cancel. Its the same as the Time in game option on the debug ROMs menu, but this makes it accessible on retail cartridges. Ill certainly want to make an e-Reader card that activates this.

Re: Anatomy of an e-Reader Mystery Event

Posted by: SatoMew
Date: 2015-01-26 15:48:35
Does any of this apply to Japanese Emerald, considering that it has both Mystery Events from Ruby/Sapphire and Mystery Gift from FireRed/LeafGreen (video)?

Re: Anatomy of an e-Reader Mystery Event

Posted by: Háčky
Date: 2015-01-26 18:32:47

Does any of this apply to Japanese Emerald, considering that it has both Mystery Events from Ruby/Sapphire and Mystery Gift from FireRed/LeafGreen (video)?

I didnt know about that. It seems that Mystery Events in Japanese Emerald doesnt accept any of the Ruby/Sapphire cards (I tried a Battle Trainer, a Berry, and the Decoration Present), giving the cannot be used in this version message. It also doesnt accept the Trainer Hill cards that were released for Emerald, because those are for Mystery Gift. Was Mystery Events used for anything at all in that game?

My guess would be that the data structures are the same as for Ruby/Sapphire, and some version number needs to be changed in the headers to make a Mystery Events card be recognized as Emerald-compatible.

Re: Anatomy of an e-Reader Mystery Event

Posted by: SatoMew
Date: 2015-01-26 18:46:46

Was Mystery Events used for anything at all in that game?


I honestly don't know. I found out that it had both systems by accident/out of curiosity since all the sources I read mentioned that Japanese Emerald used the Mystery Events system instead of the Mystery Gift system used by the international versions.

Re: Anatomy of an e-Reader Mystery Event

Posted by: Háčky
Date: 2015-02-01 12:17:22
My guess would be that the data structures are the same as for Ruby/Sapphire, and some version number needs to be changed in the headers to make a Mystery Events card be recognized as Emerald-compatible.

That was a good guess. Bytes $D and $E of the header are a version compatibility bitfield: bit 7 is Ruby, bit 8 is Sapphire, and bit 9 is Emerald. All released Mystery Events e-Reader cards have this field set to $180, allowing them to be used with Ruby and Sapphire but not Emerald. Changing it to $380 will make a card work with all three Japanese versions. Emerald seems to support the same data types as Ruby and Sapphire, with nothing new added. (Scanning a card with a chunk of type $11 or higher just produces the Japanese equivalent of The event was safely loaded., implying its not doing anything.)

While I was experimenting with the header, another thing I discovered is that its actually treated as chunk type $01 (16 bytes long). If the initial $01 byte is replaced with a different chunk type, the game will still read the data, but anything involving pointers will behave wrongsometimes spectacularly wrong! (That happened when I changed the Eon Tickets header to type $07 and the region code to Japanese. I think the game was trying to print the Obtained a [name] BERRY! DAD has it at PETALBURG GYM. message, but the name was something hideously long. no$gba eventually halted on an unknown opcode.)

Re: Anatomy of an e-Reader Mystery Event

Posted by: SatoMew
Date: 2015-02-02 18:05:15
Thanks for the reply, Háčky.

This Japanese Wikipedia article has info on Mystery Events and Mystery Gift.

Mystery Events:

に場でなe+読み込まな追できではのでのe+信は不可


My translation: "Appears in Ruby, Sapphire, and Emerald. Special data was distributed in the campaign, and new Trainers and items can be added by reading the Cards e+ (Communicating with the Cards e+ in this manner is not possible in Emerald)."

Mystery Gift:

とに場e+読み込まな追でき現にはふなくのとの要でには表示な


My translation: "Appears in FireRed, LeafGreen, and Emerald. New Trainers and maps can be added by reading the Cards e+. Shows up as 'ふなくの' and the process is identical. It is not displayed when the Wireless Adapter is connected."

I'm not sure if it makes sense, especially since my knowledge of Japanese is limited and I had trouble parsing the last two sentences on the Mystery Gift part.

Re: Anatomy of an e-Reader Mystery Event

Posted by: Team Fail
Date: 2015-06-06 00:43:23
Considering this is a "significant reason" as per forum rules, I'll go ahead and post it here.

I've been working, for the past month, on e-Reader content and generating custom content for fangames, and I've come a long way even before I found this thread. Anyways, last night, I found some interesting content in copies of Pokémon FireRed's ROM, as well as similar data being in Emerald (I have backed up my own copies for this research (If you need proof I can provide it)). Anyways, there is a chunk of data in each game that is actually e-Card data that can be saved to a Card-e+ console and run. I'm not entirely sure what it's for though. After decompressing the VPK data (VPK data is the data that the RGBDS assembly creates, but as is, not re-compressed), I found similarities and important differences to the data that you have established.

Main differences:
1. The card is in ARM/Thumb rather than Z80
2. The cards do vastly different things from regular cards (They seem to take an e-Card for some form of input):

FireRed Card data:
[img]http://i.imgur.com/9kZfMuZ.png[/img]

Emerald Card data:
[img]http://i.imgur.com/N2lOMLP.png[/img]

3. The 10-byte Unknown is actually different, although I'm not sure what the difference is supposed to be for yet (It shows as 00 00 00 00 02 55 00 00 00 00 in the data)

I'm not sure what this is for, perhaps could someone shed some light on this application? Also, if you guys want me to, I can upload the decompressed copies of these applications onto my dropbox if you'd like to take a peek at them or disassemble them. I'm trying to find what I can for game data in there, as well as the strings, but I've been preoccupied with other things at the moment.

Re: Anatomy of an e-Reader Mystery Event

Posted by: Háčky
Date: 2015-06-06 01:05:34
The Ruby/Sapphire Battle-e cards work by scanning them using the e-Readers Scan Card () option. The FireRed/LeafGreen/Emerald cards require the e-Readers Communication (つ) option; if you try to scan them using Scan Card, you just get this message telling you to use Communication instead:

[img]http://i.imgur.com/1PGlXUk.png[/img]

The e-Reader menu describes the Communication option as Load application from Game Boy ® Advance or Nintendo GameCube . I think what youve found is the application thats sent to the e-Reader when this option is used.

Re: Anatomy of an e-Reader Mystery Event

Posted by: Team Fail
Date: 2015-06-06 01:13:24
Ah, that'd explain it, that was going to be my next theory, however, I don't have a Card-e+ so I couldn't test that without having region issues. I was given a large set of unnamed e-Cards and if memory serves, there's some of the cards that, presumably, these applications can use. I'll have to dig them out, but did you want a peek at those? You may be able to add them to your disassembly that you have going and it'd probably complete the set a bit more.

Re: Anatomy of an e-Reader Mystery Event

Posted by: Háčky
Date: 2015-06-06 01:47:17

Ah, that'd explain it, that was going to be my next theory, however, I don't have a Card-e+ so I couldn't test that without having region issues. I was given a large set of unnamed e-Cards and if memory serves, there's some of the cards that, presumably, these applications can use. I'll have to dig them out, but did you want a peek at those? You may be able to add them to your disassembly that you have going and it'd probably complete the set a bit more.

Nearly all of the Battle-e cards have been dumped and are generally available online; the ones that arent include seven cards from the Emerald set (19-A029, 19-A057~A060, 19-A062, 19-A064) and the Club Nintendo exclusive cards (08-N001~N008 and 15-N001~N004). There are a few other missing promo cards which Ive recently obtained myself and will be dumping soon.

Re: Anatomy of an e-Reader Mystery Event

Posted by: Team Fail
Date: 2015-06-07 19:21:09
I'll probably look at the FireRed-based cards for now then, I've been working for the past few hours to re-activate the e-Reader functionality in an English copy of FireRed to a varying degree of success.

Re: Anatomy of an e-Reader Mystery Event

Posted by: SatoMew
Date: 2015-06-08 05:51:31

I'll probably look at the FireRed-based cards for now then, I've been working for the past few hours to re-activate the e-Reader functionality in an English copy of FireRed to a varying degree of success.


The localizations of FireRed and LeafGreen still have the e-Reader code from the Japanese versions, right? What about Mystery Events? I tried replicating this in the Japanese versions and it didn't work but they likely left it in completely unused, unlike in Japanese Emerald.

Re: Anatomy of an e-Reader Mystery Event

Posted by: Team Fail
Date: 2015-06-08 14:01:23


I'll probably look at the FireRed-based cards for now then, I've been working for the past few hours to re-activate the e-Reader functionality in an English copy of FireRed to a varying degree of success.


The localizations of FireRed and LeafGreen still have the e-Reader code from the Japanese versions, right? What about Mystery Events? I tried replicating this in the Japanese versions and it didn't work but they likely left it in completely unused, unlike in Japanese Emerald.
They do have the e-Reader code, it's just skipped out on. Normally, if a Wireless Adapter is not detected, it will default to e-Reader mode in the Japanese versions (Otherwise go to Mystery Gift if it is attached), but this check simply errors out on you and tells you it's not attached (Or if attached, it does go to Mystery Gift), so it never does jump to the code responsible for e-Reader usage in the international releases. However, by editing the Main Menu option to allow the original Japanese behaviour, you can connect to an e-Reader, all the code is still there and completely functional:


[img]http://i.imgur.com/Fg42lhj.gif[/img]
(Note that the text is not actually in the ROM, so I had it ripped from the Japanese games and translated. This is how it looks without the text.)



It also seems that in FireRed and LeafGreen, both are unlocked at the same time, as opposed to Emerald needing two methods of unlocking to have both options. However, I can't seem to get the game and the e-Reader to communicate, and I'm not sure what I'm doing wrong. The code that's left over is virtually identical to the Japanese games, so it should be able to communicate, but it doesn't for some reason. I've even tried it on hardware, but because I lack a card e-Reader+ unit, I can't do a full hardware test to troubleshoot.

Re: Anatomy of an e-Reader Mystery Event

Posted by: SatoMew
Date: 2015-06-10 10:05:00

They do have the e-Reader code, it's just skipped out on. Normally, if a Wireless Adapter is not detected, it will default to e-Reader mode in the Japanese versions (Otherwise go to Mystery Gift if it is attached), but this check simply errors out on you and tells you it's not attached (Or if attached, it does go to Mystery Gift), so it never does jump to the code responsible for e-Reader usage in the international releases. However, by editing the Main Menu option to allow the original Japanese behaviour, you can connect to an e-Reader, all the code is still there and completely functional:


[img]http://i.imgur.com/Fg42lhj.gif[/img]
(Note that the text is not actually in the ROM, so I had it ripped from the Japanese games and translated. This is how it looks without the text.)


I see, thanks. So, to clarify, the Japanese FireRed and LeafGreen will load the same Mystery Gift screen as the localizations when the Wireless Adapter is attached and detected by the game, correct?