Jump to content
Team Fail

[GEN 3] e-Reader Event Injection

Recommended Posts

So I made a thread on The PokéCommunity Forums about how I got events given through Nintendo's e-Reader peripheral to work using a flashcard instead of an e-Reader or using VBA-Link and another ROM since access to an e-Reader for me was something I was not willing to wait for. I also wrote a tool for injecting event binaries into the e-Reader's save data so that the event can be sent to Pokémon Ruby/Sapphire (And Japanese FireRed/LeafGreen/Emerald if there's any card dumps of those).

Poké-Reader Event Injection tool 1.1: https://dl.dropboxusercontent.com/u/34957059/GBA%20Events/Poke-Reader%201.1.zip

GBA Event Pack 1.0 (You'll need this for the tool): https://dl.dropboxusercontent.com/u/34957059/GBA%20Events/GBA%20Event%20Pack%201.0.zip

There's a couple of things I'd like to accomplish with this:

1. Can we get a complete set of e-Card data from all regions for all games (There's some Japan-exclusive RS berries, as well as the FRLG Battle-e and Emerald Battle-e sets that are undumped)? [if you want to see what cards there are, download the GBA Event Pack and check the included list!]

2. Can we RE the e-Card data and create custom berries and trainers to be sent to games or distributed as challenges for 3rd Gen games?

3. Can the Event BINs that I have become some kind of Gen 3 event archive format (Perhaps rename it to something useful, like .g3e (Gen 3 e-Event)?

Note: If you do have e-Card events that are not in this set, and you'd like to have them added to the GBA Event Pack, PM me if you can dump your save and send me the .SAV file containing the scanned card. I don't have an e-Reader (yet), but if I can get my hands on one, I can perhaps just get scans of the cards and scan them in, providing the scans are of good enough quality.

Edited by Team Fail
  • Like 1

Share this post


Link to post
Share on other sites

Just wanted to give this a gentle nudge. Yesterday was a day full of research and coding, and with the help of SciresM, the application can now handle modified e-Card data safely. That is, it is now possible to edit the e-Card data, and the program will ensure that the checksums are correct (And if they're not, it'll attempt to fix it), as well as the size of the compressed data, known as VPK data, within the save file. It now means I can do this:

JPuNNhJ.png1Rgycxs.png

The data is now fully editable and recompressable with the assistance of caitsith's application, nvpktool. It was also caitsith that found the CRC method, and I attempted to port it to C# from C, while SciresM fixed it completely. So feel free to toss him a thanks if you do make use of the application!

Anyways, the OP has been updated with a new link to Poké-Reader 1.1.

Share this post


Link to post
Share on other sites

Kinda surprised this place isn't much in-tune with getting these events preserved. Anyways, Bond697 pointed me to the direction of some GBA save editor source code. After making my way through the source, I managed to find some checksum stuff I needed to validate the trainer data checksum in the save data. And with that...

SbXoRWw.jpg

Battle-e cards are now fully editable and distributable.

Share this post


Link to post
Share on other sites
Great job! It's nice to see that someone still works with GBA games, will you also try to dump/inject Gen3 Wondercards?

Right now, everything is based purely on the e-Reader end of things, since Mystery Events did not use Wondercards, rather stuff was sent and a message telling you something was displayed (Such as the Eon Ticket telling you to visit Norman or saying a new trainer arrived in Hoenn when using a Battle-e card). Mystery Gift, on the other hand, did. If I can find a way to rip Pokémon Fire Red/Leaf Green/Emerald events, then that'd definitely be a possibility, although some events were distributed as e-Reader events in Japan since the e-Reader flourished there much better than it did in North America (Hence its axing in Europe).

Share this post


Link to post
Share on other sites

That is really interesting! Thanks for your work and keep us updated!

Share this post


Link to post
Share on other sites

Wow, that is a great tool you made Team Fail!

Actually there are more e-Cards already dumped and out there on the internet. But they are all in raw format and not available as bin files as far as I know.

Though you could decode them to bin with Caitsith2's nedcenc.exe they wouldn't have the same format as yours. But they contain the proper vpk data which is still usefull in my opinion!

Just remove the first 81 bytes and the last 98 bytes of the decoded bin to get the vpk. This can then be "fixed" by recreating the 54 bytes header to get a proper bin in usable format.

Here's my fixed version of the Ginema Berry.

Maybe you already know, but Japanese e-Card data can only be used properly on Japanese e-Readers since the game will just get an loading error when trying to receive the data on an English game. Also the e-Card does contain text which will appear corrupted.

Ginema Berry (JP).zip

Ginema Berry (JP).zip

Share this post


Link to post
Share on other sites
Wow, that is a great tool you made Team Fail!

Actually there are more e-Cards already dumped and out there on the internet. But they are all in raw format and not available as bin files as far as I know.

Though you could decode them to bin with Caitsith2's nedcenc.exe they wouldn't have the same format as yours. But they contain the proper vpk data which is still usefull in my opinion!

Just remove the first 81 bytes and the last 98 bytes of the decoded bin to get the vpk. This can then be "fixed" by recreating the 54 bytes header to get a proper bin in usable format.

Here's my fixed version of the Ginema Berry.

Maybe you already know, but Japanese e-Card data can only be used properly on Japanese e-Readers since the game will just get an loading error when trying to receive the data on an English game. Also the e-Card does contain text which will appear corrupted.

I was given a bunch of Emerald and FRLG e-cards yesterday, so I'm working on being able to edit trainers, and I intend to start working on berry editing soon as well. I presume I can probably take the Ginema Berry data and perhaps region-convert it and get it working on a USA copy of the e-Reader (And perhaps get it imported into USA copies of Ruby/Sapphire!). Thanks for that card, it'll definitely be welcoming to get more additions to this collections after I sort through the Emerald and FRLG Japanese cards (These of which can lead to custom Battle Tower games in the Japanese copies of those games).

I've also been planning on working to creating a BIN converter to make them able to be scanned using a dot code. I plan to test this when I get an actual e-Reader, which I hope to accomplish tomorrow morning, else get one on eBay and hope that the card reader works.

Share this post


Link to post
Share on other sites

Nice work! I've actually been working on the same thing but for different games for quite a while now. It's great to see things moving on the Pokémon e-Reader front as well.

I've also been planning on working to creating a BIN converter to make them able to be scanned using a dot code.

CaitSith2's nedcmake and nedcenc can do this for you. Nedcmake takes vpk data and header info, and creates a bin file with header, and can create raw and bmp (!) files as well. Nedcenc can transform bin files to raw and vice versa. Personally I've found nedcenc is a bit more reliable when dealing with multi-card applications.

Is there an IRC channel for this?

Share this post


Link to post
Share on other sites
Nice work! I've actually been working on the same thing but for different games for quite a while now. It's great to see things moving on the Pokémon e-Reader front as well.

Haha what perfect timing for this! I had borrowed an e-Reader from a friend over a decade ago and I had a lot of fun scanning in my Pokémon cards that had minigames on them, but when I learned that you could also get events using Mystery Events in R/S, I was bummed that I couldn't do any of that until I thought of my workaround the other night.

CaitSith2's nedcmake and nedcenc can do this for you. Nedcmake takes vpk data and header info, and creates a bin file with header, and can create raw and bmp (!) files as well. Nedcenc can transform bin files to raw and vice versa. Personally I've found nedcenc is a bit more reliable when dealing with multi-card applications.

I was able to, after a bit of playing around, get a custom code to generate that could be scanned after I finally got the first ever custom Battle-e card working. I put a proof-of-concept trainer with my own team on it to try it out, and it does work. I'm working on purchasing an e-Reader (Hopefully today if any places in the city have one) and attempt to make use of the code by use of scanning.

Is there an IRC channel for this?

Not for e-Reader stuff specifically as far as I know, but there is an IRC I frequent on, and we can join their main channel, or even make an e-Reader specific channel on there.

Share this post


Link to post
Share on other sites

So I've slightly derailed from working on the e-Cards because I've found some very interesting stuff in regards to FireRed and LeafGreen support for the e-Reader. Here's the backstory:

In Japan, the e-Reader proved to be extremely popular and was run until the end of the GBA's life. Elsewhere, however, it flopped. FireRed and LeafGreen had support for the e-Reader in Japan alongside the Wireless Adapter, but during the localisation process, this was removed and only the Wireless Adapter functionality was retained. I was digging in knizz's FireRed IDA Pro database and found some interesting functions around where the Mystery Gift stuff was, and I did some hex editing, and this happened as a result:

MJ7047C.png

This is the menu screen, an almost vanilla copy of FireRed, of the Mystery Events menus. It's completely intact, but there's a few issues:

1. The text has been nulled out.

2. The embedded e-Reader VPK is untranslated (But is still there!)

3. It connects to a Japanese e-Reader, not a USA e-Reader

4. With the vanilla code, FireRed will only let you access it if you have the Wireless Adapter attached.

I've been working on this, and with a small amount of assistance, we've gotten past most of this. So far, this is what has been done:

1. Most of the most important text has been translated

2.The Wireless Adapter check has been removed. If the adapter is detected, the game will go to the Mystery Gift menu for use with the adapter. Otherwise, it defaults to Mystery Events.

Fg42lhj.gif

dRnOFAd.png

So, all that's really left is:

1. Fix the communication so it works with a USA e-Reader

2. Translate the embedded application

Edit: There was a little bit of information that I had in mind to add last night but didn't for whatever reason. Anyway, while doing my debugging in No$GBA, I've identified a subroutine as part of a large jump list at 08143A5C. It is this routine, I believe, that is responsible for completing handshake code to confirm that it is connected to an e-Reader, and if so, to set up and establish a communication with it so that the e-Reader can download the embedded application to it. Right now, I'm planning to look into this code, but I haven't had much in the way of success yet. Once I can finish this and patch this particular routine so that it connects with a USA e-Reader as opposed to a Japanese unit, I can probably release an early version of this patch.

Edit: I was talking with Prof9, and he directed me to an old post of his, and I was able to re-activate support for Emerald. It's broken in that none of the text is translated, but it is all present:

T5RQ6KI.png

"Change the byte at 0x02F97E to 0x02", as he said, in an English copy of Emerald, and you'll have virtually full support, for a Japanese e-Reader.

Edit 2: So Prof9 looked in No$GBA's debugger, and found the bytes sent that each game needs to connect with each other (And in the process showing my lack of knowledge of No$'s debugger).

J8L16uS.png

FireRed now communicates with a USA e-Reader properly. I'm going to play around with it this evening and see what FireRed is capable of working with, including importing various events and seeing what they do.

Edit 3: So I've been working with trying to scan in events into FireRed, however, I've hit a brick wall, so to speak. While it does communicate with the e-Reader, it cannot scan in cards for some reason, although I'm quite sure it's simply a region error. Here's what happens:

In my USA-enabled version, scanning in cards results in an error:

bbNeJAO.png

I'm sure that it's just failing a region check, since these are supposed to be used on Japanese e-Readers as opposed to English e-Readers. If I revert to an older version that is only Japan-enabled, I can scan cards in, up to 8 max, however, when it transmits the data, it fails and boots me to the error text (On the FireRed side), and the e-Reader app tells me something of an error occurring I presume. Both of these, I'm sure, are region-related errors, and require editing the actual event cards themselves to correct this error.

Edit 4: If anyone wants to try this and try fixing the region errors and try importing to their copies of FireRed, I have here a FireRed 1.0 patch that you can try out. Do note that you cannot properly scan in the files yet, although you can try editing them with Poké-Reader and whatnot. THIS PATCH IS FOR ADVANCED USERS, IT DOES NOT FUNCTION CORRECTLY AS OF YET.

https://dl.dropboxusercontent.com/u/34957059/GBA%20Events/FireRed%20eReader%20Patch%20Beta%201.ips

This should also work if you want to apply this to an existing hack, although it uses a few bytes for the translated text at 0x800000. You can apply this to a clean ROM though and edit it for your needs, but it is far from properly functional as of yet. To set up your e-Reader ROM with FireRed, use these instructions:

1. Use No$GBA for this. Load your edited FireRed (Or Emerald ROM if using the one-byte adjustment) into the FIRST MACHINE (This option is at the bottom of the ROM Select window)

2. If using Emerald, at this point, use a Japanese Card-e+ ROM, or if using FireRed with the patch, use a USA e-Reader ROM. Start this ROM in the SECOND MACHINE.

3. Download and extract the files from this event pack. It contains almost all trainer events for Ruby, Sapphire, FRLG, and Emerald. You will need 7zip for this.

4. Before starting a card scan, we need to generate calibration data for the e-Reader to scan the "cards". Using the 2nd Machine controls (You'll have to edit your controls settings and set up the 2nd machine, making sure they DO NOT conflict with the first machine running FireRed), select "Scan Card" from the e-Reader main menu (It will be the 1st option if using a Japanese e-Reader ROM). No$GBA will then pop up a message, and will reset the e-Reader ROM.

5. Go to "Mystery Gift" on FireRed and follow the instructions displayed. In the case of Emerald, from the main menu, select the second option, then the second option again. The background should show two Gameboy Advance units linking with a large blue box overlaying it. If it shows a GameCube, you're on the wrong menu option. In Emerald, select "Mystery Gift, and press A three times. The text will be garbled, as it's untranslated Japanese and the game does not show Japanese characters correctly, but it functions correctly nonetheless.

6. Once it shows the message to scan a card into the e-Reader, the other Gameboy will have a screen in which there is a Pikachu, and options for A and B. A tells the device to open up for card scanning, and B will ask you if you want to exit the application. To select a card, simply go to "File", then to "Load e-Reader Dotcode", then select one of the event RAW files.

This is about as far as you can get though, nothing is transferred to the games as it errors out on either end, depending on the game you use right now. Only use this patch if you're willing to dig into this and try getting this working.

Edit 5: So today has mostly been about the localisation aspect of this project, including fixing regional issues with the e-Cards, including translating any text. The FRLG Battle cards, when scanned without the FRLG application running (AKA using "Scan Card" from the main menu) in the Japanese version shows you this:

CTapUfm.png

I used a mix of machine translation, as well as my own knowledge of the language, and came up with this unofficial localisation (Edit: Got some input on the translation and adjusted it as necessary):

KBCKJUP.png

It's coming along rather decently, and I'm slowly working to fix these regional issues. I'm not sure what's causing the issue though.

Edited by Team Fail
updating screenshot - now with no double colon and an accented e!

Share this post


Link to post
Share on other sites

I encountered a problem when using e-Reader. I scan a berry, dad in Petalburg is giving it to me, then I save the game, then I reset and scan another berry and I got msg that Chilan Berry transformed into Nutpea Berry for example, then I check my bag and indeed the berry transformed. How can I get more than one event berry into my game?

Share this post


Link to post
Share on other sites
I encountered a problem when using e-Reader. I scan a berry, dad in Petalburg is giving it to me, then I save the game, then I reset and scan another berry and I got msg that Chilan Berry transformed into Nutpea Berry for example, then I check my bag and indeed the berry transformed. How can I get more than one event berry into my game?

It's actually not a glitch or anything of the like. The Enigma Berry, which is otherwise unused, transforms into the event berries that you scan in, however, the game can only take one at a time. If you scan in a new berry card, any event berries already in the game will become this newly scanned berry. You'll have to turn them into Pokéblocks first before sending in new ones.

Share this post


Link to post
Share on other sites

 So guys, i know this topic it's old but i want to make this, but the links for the two programs are dead, can someone put it in again?

Share this post


Link to post
Share on other sites

This tool is to inject the VPK data from e-Cards into the e-Reader save file so you could use it from the menu without scanning the cards.

There are some e-Reader Development Tools made by caitsith2 which can be found here https://www.caitsith2.com/ereader/devtools.htm (source is available as well)

I tried to translate the English Eon Ticket to Japanese a few years ago, it seems like the font is the big problem there. But I have no idea how to solve that.

Share this post


Link to post
Share on other sites

And what if we leave the Eon Ticket untranslated and just make it send the official Japanese Script? That kinda was my idea... something I tried without success though...
From what I remember the ingame messages (during the Mystery Event transfer process) are hardcoded, so in case of the game's side everything would be displayed in Japanese.
Only the eReader side would still remain in English in this case, which is no problem IMO because I prefer to leave things original and untouched if possible.
The big question is if the Japanese eReader can handle the data. (Maybe this is what you mean?)

I remember having used some of these Tools. I had some issues creating a proper bin after I was finished with editing the vpk and then I ended with a bin the eReader couldn't read at the end.
The header it was creating looked also completely different compared to an original one and I think that was the reason, but I was not so into fixing this issue manually.

Edited by ajxpk

Share this post


Link to post
Share on other sites

I took a Japanese save, wrote it to an English cart and scanned in the Eon ticket. Then I wrote it back to a Japanese cart. The results were.... interesting. But if the data is hardcoded into the game, shouldn't the text have been Japanese? Does that mean the English data is stored elsewhere from the Japanese?

  • Like 1

Share this post


Link to post
Share on other sites

Haha... what a mess! No, as you can see the Event (Script) it'self is not hardcoded.
The Script is actually sent from the eCard and finds it new home in the RAM until it gets permanently terminated.
So it's just temporarily on the save file until you received the Eon Ticket from the father and saved 2 times after that. 
I meant the Mystery Event Strings are hardcoded. Those on the Game's side you saw when you transferred the Ticket with your eReader.
The messages that guiding you during the Mystery Event process and then telling you to go to your dad. Not sure if you can force them to appear without a bit more hacking.

Edited by ajxpk
  • Like 2

Share this post


Link to post
Share on other sites
11 hours ago, Cloud9Skywalker said:

I thought that these events were Mystery Gift events? Or is that the same thing as E Reader events?

e-Reader used Mystery Events, which is only available in Ruby, Sapphire and Japanese Emerald. Yet despite having the Mystery Events functionality, Japanese Emerald doesn't support the Japanese Battle-e+ cards, yet we can assume it was used for the Eon Ticket since Japan did get a distribution for Emerald (as well as a repeat for Ruby and Sapphire).

Share this post


Link to post
Share on other sites
On 5/11/2015 at 4:58 AM, BlackShark said:

Wow, that is a great tool you made Team Fail!

Actually there are more e-Cards already dumped and out there on the internet. But they are all in raw format and not available as bin files as far as I know.

Though you could decode them to bin with Caitsith2's nedcenc.exe they wouldn't have the same format as yours. But they contain the proper vpk data which is still usefull in my opinion!

Just remove the first 81 bytes and the last 98 bytes of the decoded bin to get the vpk. This can then be "fixed" by recreating the 54 bytes header to get a proper bin in usable format.

Here's my fixed version of the Ginema Berry.

Maybe you already know, but Japanese e-Card data can only be used properly on Japanese e-Readers since the game will just get an loading error when trying to receive the data on an English game. Also the e-Card does contain text which will appear corrupted.

Ginema Berry (JP).zip

Ginema Berry (JP).zip 1.86 kB · 316 downloads

hello,does someone know how to get the 54 bytes header file,and how to fix the .bin file?THX.I want to use the sav file on a real E-reader JP.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...