• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Pokeemerald] Customising e-Reader Cards

paccy

Pokeholic
  • 42
    Posts
    15
    Years
    Not sure how many would actually be interested in this but I recently discovered an archived thread by Háčky and their disassembly of some e-Reader cards for Ruby & Sapphire, pokecarde.


    The e-Reader functionality was inaccessible in Pokemon Emerald versions outside of Japan but is still within the code and can be enabled to accept eCards.
    And with pokeemerald eTrainers can be customised further to have 6 pokemon and use expanded pokemon, moves and items.
    The Eon Ticket eCard works as well and also can be customised to create event gifts.

    I've been playing around with making custom eCards and thought I'd write a tutorial in case anyone else is interested.


    1. Setting Up pokeemerald

    I found out how to reactivate the e-Reader from CitrusBolt's Pokemon Heliodor and the translation is from Sierraffinity's CrystalDust, so big thanks to them!

    1.1 Activating e-Reader functionality
    This will show the Mystery Event option when Mystery Gift is unlocked. And also gives translations for the Japanese text.
    Code changes here.

    1.2 Removing region lock (Optional)
    This is only necessary if you want to use eCards from different regions.
    Code changes here.


    2. Building eCards
    Hatschky's original repository can be used for Ruby, Sapphire and our now modified Emerald, albeit with some differences (eg. Trainer classes won't be correct in Emerald).
    But I have also made branches for Emerald, to fix the differences, and also for Rom Hacking Hideout's pokeemerald-expansion to allow for the expanded pokemon, attacks and items.

    Pokecarde Disassemblies
    For Ruby&Sapphire
    For Emerald
    For pokeemerald-expansion

    • Download the one you'll require and unzip it somewhere.
    • Download rgbds v0.1.2.
    • Extract rgbasm.exe and rgblink.exe into the battle-e folder of the eCard disassembly and remove the .exe extension.
    • Download NEDC Make and NVPK Tool from CaitSith2's website.
    • Extract them both and move them to the battle-e folder as well.

    Now that's out of the way you can go to the battle-e directory using a command line tool (WSL works best, powershell causes some issues) and build them using
    Code:
    make
    The eCards should then compile into .raw files!

    To make the Eon Ticket copy the programs you extracted to pokecarde/battle-e to pokecarde/eonticket (rgbasm, rgblink, nedcmake, nevpk, nedclib.dll) and use the make command.
    This builds an English and German version of the card.

    How to use eCards
    For them to work you need to have unlocked Mystery Gift in your save.
    I've been able to get these cards working with VisualBoyAdvance-M v2.1.4. as well as mGBA.

    • Open up two instances of it and link them together by going Options>Link>Start Network Link…
    • Set one to being the server and the other the client and click connect.
    • Load up Emerald which can now access Mystery Events and load the other with the e-Reader gba file.
    • For the e-Reader go to File>e-Reader>Load Dot Code… and select one of the raw files we've just created.
    • In Emerald select Mystery Event on the starting screen and follow the prompts.

    [PokeCommunity.com] Customising e-Reader Cards


    You can also print them off for use with a real e-Reader using CaitSith2's Nintendo eReader DotCode Printer. I haven't got an e-Reader myself so I haven't confirmed that custom eCards work.


    3. Custom Cards

    3.1 Customising eTrainers
    Doing simple customisations of eTrainers is pretty straightforward. The data for each trainer is kept in battle-e/trainers. Just open one up in a text editor and you'll be greeted with this

    Spoiler:


    You're able to change the trainer's name and class and pretty much everything about their pokemon.
    In the constants folder there's text documents that list all the variables that are possible for making pokemon.
    I've created a natures.asm file there so you don't need to memorise what PID will create what nature, gender or shininess (shininess works only if you leave the Trainer ID and SID as 00000).
    In addition, pokemon can only have valid abilities but anything goes for their moves.

    As you may have seen each eCard is compiled to a file starting with 08-A and then a number. These codes refer to a specific eCard which can be seen here on bulbapedia.

    If you don't want to modify and replace one of the existing cards you'll need to create a new file in battle-e/ that follows this code pattern (eg. 08-A049.asm). Inside this file write something like this:

    Code:
    INCLUDE "../macros.asm"
    CLASS EQUS   "beauty"
    TRAINER EQUS "cynthia"
    INCLUDE "battletrainer-{REGION_NAME}.tx"
    The class determines what image the eCard will display on the e-Reader. The images can be found in battle-e/sprites/trainers and they all use the palette battle-e/sprites/battletrainer5.pal.

    The TRAINER variable should just be the name of your new trainer file that you'll put in battle-e/trainers.

    Inside the Makefile you'll need to add the code to SERIES_1_NUMS and the name to SERIES_1_TRAINERS.


    3.2 Further Customisation
    6 Pokemon
    Thanks to pokeemerald we can go even further with our customisation
    Normally each eTrainer just has 3 pokemon but we can expand that to 6!
    Both pokeemerald and pokecarde need to be edited for this to work.

    Adding 3 new pokemon requires 132 more bytes of space in Saveblock2 but this wiki tutorial by hjk321 should give us enough.
    Code change here.

    Pokecarde needs to have the location of the checksum changed so it doesn't overwrite the new pokemon.
    Code change here.

    And there you go, you can now create eTrainers with 6 pokemon.
    Each trainer must have data for 6 pokemon but If you want to use less, like 4 pokemon, just replace pokemon names with SPECIES_NULL or 0.


    Hidden Abilities
    If your hack has hidden abilities you can make use of them by changing one thing in pokecarde.
    Code change here.

    You can then use ABILITY3 or ABILITY_HIDDEN to assign hidden abilities to pokemon.

    [PokeCommunity.com] Customising e-Reader Cards
    [PokeCommunity.com] Customising e-Reader Cards



    3.3 Customising Scripting Cards (Eon Ticket)
    The Eon Ticket event card can be created in the eonticket folder, and the eonticket.asm file can be modified to send over different items and text. The most important parts to know are

    Code:
    db 8,1 ; Petalburg Gym
    db 1   ; Norman
    These lines give the map number and object ID to initiate the event script when spoken to, in this case Norman in Petalburg Gym. Pretty much any object can be chosen for this.

    Code:
    db 30 ; distribution limit from English release
    this line allows the chosen item to be shared with other players using mix records and states how many times that can happen.

    Code:
    NormanScriptStart:
    Here is the script Norman will use when spoken to, it deletes itself when it successfully gives the player the eon ticket.

    Code:
    PreloadScriptStart:
    This script does several checks to make sure the player hasn't already received the eon ticket.

    As an example I've customised eonticket.asm to give the character the Old Sea Map
    Spoiler:


    We make the delivery man on the 2nd floor of the PokeCenter appear by setting var 0x403F to 1 using the eCard and make the one in Sootopolis give you the Old Sea Map, but what if we want all the delivery men to give you it (because they will instead give you the Eon Ticket).
    We can't do anything about that in the eCard but we can change some code in pokeemerald to allow for it.
    Code changes here.

    gotoram goes to the script that the eCard sent over, but it does check first if there's a valid wondercard and since we're not using wondercards we circumvented that check.


    [PokeCommunity.com] Customising e-Reader Cards
    [PokeCommunity.com] Customising e-Reader Cards



    3.4 Customising Ribbon Cards
    In the ribbons folder you can make eCards that give a ribbon to each of your party members. Once again copy rgbds and CaitSith2's tools to this folder and use make to compile.
    There are only 2 lines of note here:
    Code:
    db MARINE_RIBBON ; Marine Ribbon
    db $01 ; description $01=2003 REGIONAL TOURNEY CHAMPION RIBBON
    The first line is the ribbon type which can be found in constants/ribbons.asm.
    The second is the ribbon description where the values can be found on bulbapedia where 0x01 is the starting description on the list.

    [PokeCommunity.com] Customising e-Reader Cards

    Now you too can be world champ.

    3.5 Customising Gift Pokemon Cards
    In the giftpokemon folder you can create eCards that give a pokemon to the player, providing the party isn't full. Once again copy rgbds and CaitSith2's tools to this folder and use make to compile.
    Edit the giftpokemon.asm file to change the pokemon to whatever you'd like.
    The pokemon follows the 100-byte structure in the game which you can see on Bulbapedia but hopefully my comments provide enough info for basic customisation.

    Make sure to back up your save when testing this one out in case you make a Bad Egg!

    [PokeCommunity.com] Customising e-Reader Cards


    3.6 Customising The Regi Decoration Card
    There's a Japan specific eCard that gives the player the Regi Dolls to use for decorating.
    What's notable about this card is there's actually a menu that let's you select which doll you want.

    It's (relatively) easy to change all the region checks to get it to send to English games but the text gets all messed up and doesn't look nice.
    So I decided to disassemble it which allows you to change the text to English but also edit everything out, like what items to send over.

    I've actually already translated all the text to English for your convenience
    [PokeCommunity.com] Customising e-Reader Cards


    The 08-O000.asm files contain the asm instructions for everything on the eReader side of things, so things like the text, graphics, menu that shows up on the eReader.
    The decoration.asm files contain the scripts that are sent to and are run on the game, so the script that gives the player the chosen item.

    I have provided an edited example (08-O002.asm and decoration-tickets.asm, Emerald only not R/S) that gives you some event tickets.
    I recommend editing this version because the original card uses one palette that's shared with all 3 Regi Dolls so I've modified the code to use the correct palette for each item.
    [PokeCommunity.com] Customising e-Reader Cards


    Things to note:
    The scripts in the decoration.asm file need to be the same length for all three scripts, if you have scripts that are shorter you can pad them out with zero bytes (db $00). Otherwise you're not limited to sending items but should be able to send over pokemon as well or doing things like setting flags.
    If editing these there are some manual changes that are needed for the code. You'll need to create the decorations section first using the following instructions
    Spoiler:

    Then open decoration-tickets-EN.bin in a hex editor and find the start of the 3 different scripts (one is always at 0x0000). They start with
    Code:
    01 00 00 00 02 02
    Take note of their position and add 0x170 to them. Then in 08-O001.asm near the start there's a section called DataPointers, swap the first and second position bytes and replace what's there. Eg. if a script start at 0x110, add 0x170 to get 0x280 and swap the two bytes to get 0x80 and 0x2. Put them in as db $80,$02.
    I've put comments in the files to tag things like text and graphics and what I think a couple of the functions do.
    If you've ever made pokeemerald you can use the 4bpp sprites it makes and the gbapal files for this. I recommend not using sprites over 32x32 pixels because they're quite large and you can end up needing to swipe in 6 or more strips to start the eReader program (but you can if you really, really want).
    All 3 sprites need to be the same size and if you do change their size 2 bytes need to be modified in 08-O001.asm to define their size.
    I've probably forgotten something so ask me for help if you get stuck.




    There are more types of eCards but I haven't looked into them yet so that's it for now.
    All in all this might not have too much value but I just think it's a neat thing to play around with.
    It would be possible to do things like changing the champion of the E4 every so often with a new card and it's a novel way to implement changes and events, especially if you print out the cards and use actual hardware!

    Updates
    Added the Battle-e Series 2 trainers to all branches
    Added the Regi Decoration card

    Links
    Hatscky's post and pokecarde disassembly
    My pokecarde fork with a branch for Emerald and an Emerald expansion branch that has 6 pokemon slots for trainers and set up for RHH's emerald-expansion.
    My pokeemerald branch that activates the e-Reader and a separate one that makes all the changes in this tutorial.
    RGBDS v0.1.2
    CaitSith2's tools
    GBATEK

    Credit
    Háčky/Hatschky for their post and disassembly
    CitrusBolt for their e-Reader activation code
    Sierraffinity for the e-Reader translations
    hjk321 for their save space tutorial
    CaitSith2 for their programs nvpktool, nedcmake and nedcprint
    Everyone who worked on rgbds
     
    Last edited:
    Hey, I followed your tutorial and finished setting up the pokeecard disassembly, but building it stops with the following error:

    Code:
    python3 ../scripts/regionalize.py trainers/alana.asm trainers/alana-EN.tx EN EN
    Traceback (most recent call last):
      File "../scripts/regionalize.py", line 13, in <module>    
        asms = asm.split('"')
    TypeError: a bytes-like object is required, not 'str'       
    Makefile:16: recipe for target 'trainers/alana-EN.tx' failed
    make: *** [trainers/alana-EN.tx] Error 1
    rm trainers/alana-EN.tx

    Do you have an idea what I messed up?
     
    I had a look into the error and did find mistakes in the makefile so you'll need to download that again...

    But it looks like this specific error is due to the script being run with python3. Do you have python2 installed on your system?
     
    Yeah, Python3 was indeed the problem. With Python2, it's working now, except for the eonticket, which has another unique error:

    Code:
    python ../scripts/regionalize.py eonticket.asm eonticket-DE.tx DE DE
    ./rgbasm -o eonticket-DE.o eonticket-DE.tx
    ERROR:  eonticket-DE.tx(4) -> ../constants/scriptcommands.asm(8) :
            syntax error
    : Assembly aborted in pass 1 (1 errors)!
    Makefile:9: recipe for target 'eonticket-DE.o' failed
    make: *** [eonticket-DE.o] Error 1
    rm eonticket-DE.tx
     
    Woops, that one's my fault. Updated it so it should be fixed now, sorry about that!

    Hi Paccy, I have this error in my terminal. I have put the necessary files rgbasm, rgblink, nedcmake, nevpk, nedclib.dll in my folder. I hope you can help. I am using python 2.7

    card 01\01, raw - Success
    md5sum --check battle-e.md5
    08-A001-EN.z80: FAILED
    08-A002-EN.z80: FAILED
    08-A003-EN.z80: FAILED
    08-A004-EN.z80: FAILED
    08-A005-EN.z80: FAILED
    08-A006-EN.z80: FAILED
    08-A007-EN.z80: FAILED
    08-A008-EN.z80: FAILED
    08-A009-EN.z80: FAILED
    08-A010-EN.z80: FAILED
    08-A011-EN.z80: FAILED
    08-A012-EN.z80: FAILED
    08-A013-EN.z80: FAILED
    08-A014-EN.z80: FAILED
    08-A015-EN.z80: FAILED
    08-A016-EN.z80: FAILED
    08-A017-EN.z80: FAILED
    08-A018-EN.z80: FAILED
    08-A019-EN.z80: FAILED
    08-A020-EN.z80: FAILED
    08-A021-EN.z80: FAILED
    08-A022-EN.z80: FAILED
    08-A023-EN.z80: FAILED
    08-A024-EN.z80: FAILED
    08-A025-EN.z80: FAILED
    08-A026-EN.z80: FAILED
    08-A027-EN.z80: FAILED
    08-A028-EN.z80: FAILED
    08-A029-EN.z80: FAILED
    08-A030-EN.z80: FAILED
    08-A031-EN.z80: FAILED
    08-A032-EN.z80: FAILED
    08-A033-EN.z80: FAILED
    08-A034-EN.z80: FAILED
    08-A035-EN.z80: FAILED
    08-A036-EN.z80: FAILED
    08-A037-EN.z80: FAILED
    08-A038-EN.z80: FAILED
    08-A039-EN.z80: FAILED
    08-A040-EN.z80: FAILED
    08-A041-EN.z80: FAILED
    08-A042-EN.z80: FAILED
    08-A043-EN.z80: FAILED
    08-A044-EN.z80: FAILED
    08-A045-EN.z80: FAILED
    08-A046-EN.z80: FAILED
    08-A047-EN.z80: FAILED
    08-A048-EN.z80: FAILED
    08-K001-EN.z80: FAILED
    08-K002-EN.z80: FAILED
    08-K003-EN.z80: FAILED
    08-K004-EN.z80: FAILED
    08-K005-EN.z80: FAILED
    08-K006-EN.z80: FAILED
    md5sum: WARNING: 54 computed checksums did NOT match
    make: *** [Makefile:12: verify] Error 1
     
    Hi Paccy, I have this error in my terminal. I have put the necessary files rgbasm, rgblink, nedcmake, nevpk, nedclib.dll in my folder. I hope you can help. I am using python 2.7

    Hey! Those errors are saying the cards created don't match what's expected. I hadn't updated the emerald and expansion branches to fix that but I have now.
    If you're making any custom cards then that check should fail, but that's fine since it is different.

    UPDATE!
    I've added the Battle-e Series 2 trainers, which were only released in Japan, to all branches. All names have been translated to English so there should be no errors there.
    There are some pokemon that appear as shiny when they shouldn't be because I thought their TID and SID would be 00000 when they are not. I'll fix that but otherwise everything should be good!
     
    Unbelievably cool work here!!

    I'm super fascinated in all of this and have been trying to get it working with my Ruby/Sapphire, but I seem to be running into an issue at the actual e-reader step. I downloaded the Ruby/Sapphire version of the pokecarde repo you linked and ran the make on it, and the .raw files all seemed to generate just fine, but none of them seem to be working when I try to run them.

    Both on vba and on console, when I load in the .raw file created on the e-reader, I'm just getting a black screen on the e-Reader with all of the files I've tried.

    I'm suspecting that something must have built wrong on my end... unless this is how it's supposed to be with these. However, when I load in one the .raws that I downloaded from elsewhere, this screen appears:
    [PokeCommunity.com] Customising e-Reader Cards


    Should this screen be showing up with these built/custom cards, or did I mess up somewhere in the process?
     
    Yeah you should definitely be getting that screen and not a black one so it's building wrong somewhere.

    When you build them do you get a bunch of lines near the end that look like this
    Code:
    08-A001-EN.z80: OK
    or did they fail like this?
    Code:
    08-A001-EN.z80: FAILED

    If they failed it could be the python version being used. Using python2.7 works but it does still seem to be a bit finicky for some people so if that doesn't work let me know and I can take a closer look at it.
     
    Yeah, I'm seeing them all fail at the checksum part (no custom changes made yet). I'm using Python 2.7, but I might try installing an older version to see if that does the trick!

    EDIT: It might actually still be a remnant of Python 3 getting called at some point along in the process - it's been a minute since I've worked with Python, and I don't have any sort of launcher installed on my machine. I'll experiment with that and ensure that version 2 is ACTUALLY the one being used for all the scripts

    EDIT 2: after making sure I'm running an older version and deleting all the .mevs/.pycs, it's still having issues, unfortunately. I went back and downloaded Hatchky's version of the repo and encountered the same issue, so I'm leaning towards it still being a machine issue for me. I'll keep troubleshooting and see if I can get it working!

    EDIT 3: figured it out!!! checksum.py and stripgbc.py were often adding additional "D0"s whenever they were parsing any "0A" because it was seeing it as a line ending symbol - I think this is a Windows quirk, but I can manually assemble the individual cards with a little hex editing now - I'm sure there's a different version of python I could be running or some kind of fix I could be doing to the program to make it work better on my machine, but for just making a couple custom cards and not really needing to build every card all at once, this is a totally fine solution for me
     
    Last edited:
    Instead of patching the language into Pokeemerald or Pokeruby, would it just be possible to alter the language check in the E Card? It's simple enough to get the cards region type to switch for the E-reader itself, but I presume the language check is in the vpk itself somewhere? Is there a way to go about searching for the region code of a card that is not disassembled?
     
    Instead of patching the language into Pokeemerald or Pokeruby, would it just be possible to alter the language check in the E Card? It's simple enough to get the cards region type to switch for the E-reader itself, but I presume the language check is in the vpk itself somewhere? Is there a way to go about searching for the region code of a card that is not disassembled?

    Yes you can alter the language region in the card, I was going to work on being able to change to any language easily but wasn't sure how much languages other than English would be used. For now you can edit the prologue.asm files and change the REGION text to any of these:
    REGION_JP
    REGION_EN
    REGION_FR
    REGION_IT
    REGION_DE
    REGION_ES

    The easy chat text would need to be changed to suit the language, otherwise the words in-game might be slightly off. Text in normal scripts should be fine (Except for Japanese, some characters cause an error).

    I don't know a way of checking the code without disassembling to z80 code, other than checking which country the card was released in or just testing with games from different regions and seeing which one works.
     
    I've been editing just the binary using a hex editor until this point. The goal was to get the regi doll exclusive JP e-card to boot on US e-reader and send to a US game, but I can only get the ladder working. It gives me a Loading Error every time on sapphire, whereas it seems to work fine on the E-Readers end. Hoping there was a quick way to find the Region check. EDIT: Part of the reason I'm sure it's a region check is because connecting the U.S. E-reader to a Japanese Sapphire actually loads the event into the game properly.
     
    Yeah there is a region check for both the game and the e-reader so it's interesting that it works fine on the e-reader side. I'll have a look into it when I have some free time.

    EDIT:
    Well I did it! Thanks to this site I figured out how to combine the 2 strips to disassemble the regi doll card.

    There would of been no way to do it without disassembling because I found out that there's actually 7 region checks for this card (1 for the reader and 2 for each doll when you try to send them over).

    Anyway here's how to do it if you'd like to attempt it yourself.

    Step 1.
    Decode each strip using the nedcenc tool.
    Code:
    ./nedcenc.exe -d -i strip1.raw -o strip1.bin
    ./nedcenc.exe -d -i strip2.raw -o strip2.bin

    Step 2.
    Open both bin files in a hex editor.
    Copy the strip2.bin data from 0x51 all the way to the end and paste it to the end of strip1.bin.

    Step 3.
    Delete the first 87 bytes in strip1.bin, so that it starts with 76 70 6B 30.

    Step 4.
    Use the nevpk tool to dissassemble strip1.bin to z80
    Code:
    ./nevpk.exe -d -i strip1.bin -o strip1.z80

    Step 5.
    Open strip1.z80 in a hex editor and change the 01 values at 0x5E, 0x75, 0x77, 0xE9, 0xEB, 0x15D and 0x15F to 02.

    Step 6.
    Reassemble strip1.z80 using nedcmake
    Code:
    ./nedcmake.exe -i strip1.z80 -type 1 -region 1

    It should create 2 raw files (01.raw and 02.raw) which you can now use for non-Japanese games!

    The text isn't translated so it would look weird but I tested it on Pokemon Ruby/Sapphire and a modified Emerald and it's fully functional!
     
    Last edited:
    This is awesome. A big part of my problem was not realizing I had to combine both VPKs. Gonna give this a go now. Thanks so much!

    EDIT: I had been using the vpk unpacking function, which actually seems to be the same as the disassemble function. This documentation is so helpful.

    EDIT 2: Got it working without issue. Cleaned out the text so it looks a bit less glitchy as well and gave it a proper header name for when you scan it into the E-Reader. Gonna print these on my day off! It really gets upset if you try to render english text in the card lol, maybe with enough work I'll get it going.
     
    Last edited:
    Good to hear you got it working!

    I was gonna have a go at changing the text too, and see how far I can go with modifying it to have different images and sending different items.
     
    do you think it would be possible to activate the unused altering cave event through the e reader by creating custom dot codes to scan?
     
    Hello, is it only possible to activate these cards in modified pokémon emerald? Can I just take a pure game and insert the cards?
    And how to activate the e-Reader functionality in pokémon emerald?
    Sorry, I don't have much programming skills.
     
    do you think it would be possible to activate the unused altering cave event through the e reader by creating custom dot codes to scan?
    It's definitely possible to change the pokemon in altering cave since that depends on a single var value. The "official" event (none were actually released for this) goes through Mystery Gift but these cards work through Mystery Event. I don't know how exactly the card structure differs for these but Mystery Gift cards would have text included for the wonder card.

    Hello, is it only possible to activate these cards in modified pokémon emerald? Can I just take a pure game and insert the cards?
    And how to activate the e-Reader functionality in pokémon emerald?
    Sorry, I don't have much programming skills.

    Unfortunately it does require a modified emerald because Mystery Event can't be activated normally.
    If you want try modifying it this way you're welcome to message me and I'll try and help or if you know binary hacking you can check this thread.
     
    Good to hear you got it working!

    I was gonna have a go at changing the text too, and see how far I can go with modifying it to have different images and sending different items.

    I'm super curious, so would this also work with nvpktool to use this without scanning in the dot codes? I'm currently trying to figure that out in hopes of localizing the events. I'd really appreciate a reply to see if it's been done already!!
     
    Back
    Top