• 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.

[EM] Extending item names to 16 characters

thechurchofcage

a.k.a. The Cancer Fairy
124
Posts
15
Years
    • Seen Jul 24, 2023
    How to extend item names to 16 characters

    Hello! Long time lurker and leech here, finally getting round to posting my own contribution. It's not exactly new or difficult, it's just something that I haven't seen on here yet, so I thought I might as well post it.

    Dream_Thunder_Stone_Sprite.png

    So, making item names longer has obvious benefits - you can have a Thunder Stone, as opposed to a THUNDERSTONE, and you can have Terrain Extender as opposed to TerrainExtnd. Item names that do actually have 16-characters will look fine in the bag, but will look weird stored in the PC and during PokéMart dialogue; otherwise it's perfectly harmless. Here's what you need:

    1) A Hex Editor
    2) Free Space Finder

    and that's it!
    Disclaimer: Note that after doing this PGE Item Editor will not work, nor will its other parts that require Item data - e.g. Trainer Editor. Also, Chacha Dinosaurs's various Emerald engines will not work correctly - however, this can be applied after you use their engines anyway. This can be fixed by modifying the their respective source files, but as they're not my programs I shall ask for permission before explaining that bit.

    Open HXD and go to the coordinate 5839A0 (Emerald), or whichever offset your Item Data is kept. Copy the entirety of the item data into a new tab. In HXD, this can be done by pressing Ctrl + E, then selecting the number of bytes equal to your number of items * 44. Once you have pasted the Item data into a new tab/file, press Ctrl + R or Ctlr + H to open the Find + Replace dialogue, and replace all instances of FF 00 with FF 00 00 00 00 00 (the same, but with eight extra zeros). This will insert four extra bytes into each unit of item data, thus extending the possible name from 12 to 16 characters.

    You will need to make a correction for your 256th item. This is because its index is FF/255, meaning it will also be replaced by the above process. Go to the offset which is exactly 12,260 bytes (255*48 + 16 + 2 padding bytes) from the beginning and delete the four following bytes of 00's. You will also have to make similar corrections for every multiple-of-256th item in a similar way, if you have an expanded list of items. Once this has all been done, you will have your reformed Item data table which has sixteen bytes available for each Item's name.

    Then, in FSF find free space corresponding to the number of items in your ROM multiplied by 48 (That's 44 bytes for base Item data + 4 bytes for the extended name). So, if you have 377 items then you will need to look for 18,096 bytes of data.

    Copy your reformed Item data table to the offset FSF gives you, and paste-overwrite (Ctrl+B in HxD).

    Now, go to the offset 0d7482 (Emerald), and paste-overwrite the following hex data after replacing all instances of XX XX XX with the inverse of the offset you found just now in FSF:
    Spoiler:

    (By inverse offset, I of course mean 12 34 56 -> 56 34 12)

    What this code does is replace the functions to fetch Item data with modified ones that are offset by four bytes to account for the extended name. And that's it!
    image.png

    Join me next time when we look at Moves, Abilities, and possibly Pokémon (seeing as only Fletchinder and Crabominable are longer than 10 characters, I may not bother).
     
    Last edited:
    Back
    Top