[EA] [WIP] A Guide To Inserting Everything Through EA

#Chapter 4 - Insertion Through the “Insert, Rip, and Paste” Pattern

In this chapter we’ll be looking at using other tools to correctly insert data, then we’ll copy that data out of the ROM and write an EA installer for it.

This is, quite honestly, a pain, especially when making a lot of quick or small changes. In Chapter 5, we’ll be looking at the tools specifically designed to avoid having to do this, but let’s look at this pattern, in case something comes up that there isn’t a tool for yet.


###Section 4.1 - Text

First, we insert the text we want with FEditor. It doesn’t have to be in the ROM you’re changing, so FEditor never has to touch your ROM; it can be into any ROM.

This is some tutorial text.
It's for nubs.[A][X]

Search for this text that was inserted in the hex of your ROM by searching for some part of the text. In this example, we could search for “This is some tutorial text.”. Find the start of your text. Note that there may be some control codes at the start. You may feel free to add some nonsense to the start of your text in that case, to mark where it starts. Example:

asdfgh[OpenRight][LoadPortrait][0x02][0x01]Hi! This is some text.[A][X]

so you can search for asdfgh and start copying after that. Then copy all of the data from the start of the text up to and including a 0x00.

Paste this data into an empty file. Let’s suppose you called it text.dmp

Now, in EA, you’ll want to install the text in this way:

#define TextTable (depends on your FE version)
#define setText(textID, offset) "PUSH; ORG (TextTable+4*textID); POIN (offset | 0x80000000); POP" //Anti-huffman

#define myText 0x100 //TextID
myText_Pointer:
    setText(myText, myText_Pointer)
    #incbin "text.dmp"

Note that TextTable and setText are defined in #include "Tools/Tool Helpers.txt". If you need to redefine TextTable for some reason, then just define it before including Tool Helpers.txt.


###Section 4.2 - Portraits/Mugs


###Section 4.3 - Maps and Map Changes


###Section 4.4 - Icons/Tilesets/Etc


###Section 4.5 - Battle Frames

Battle Frames Insertion, by @circleseverywhere
How to insert battle frames with EA:

  1. Follow the tutorial to make your battle frame

  2. Insert your graphics with GBAGE

  3. For each graphic, either use Raw Dump to get the hex and run it through an LZ77 compressor like NLCompressor or copy the data out using a hex editor

  4. Copy the TSA out of the rom into a new file (80210c - 802557)

  5. Copy the palette as well (802558-8025d7)

  6. Use the template here:

//New Battle Frame:
    ORG $51f68
    POIN BattleFrame
    ORG $51fc8
    POIN BF_EN
    ORG $52088
    POIN BF_PN
    ORG $52028
    POIN BF_EW
    ORG $52164
    POIN BF_PW
    ORG $80201c
    #incbin "bin\BF_TSA.bin"
    #incbin "bin\BF_Pal.bin"


//Put this part in free space
    BattleFrame:
    #incbin "bin\BattleFrame.bin"
    BF_EN:
    #incbin "bin\BF_Enemyname.bin"
    BF_PN:
    #incbin "bin\BF_Playername.bin"
    BF_EW:
    #incbin "bin\BF_Enemywep.bin"
    BF_PW:
    #incbin "bin\BF_Playerwep.bin"