• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • It's time to vote for your favorite Pokémon Battle Revolution protagonist in our new weekly protagonist poll! Click here to cast your vote and let us know which PBR protagonist you like most.
  • 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.

[ASM & Hex] How can i increase the total number of trainer sprites on a emerald rom hack.

  • 5
    Posts
    3
    Years
    • Seen Oct 2, 2023
    I think emerald has 94 trainer sprites but I need to know how to add a 95th and so on, I don't really understand the hex codes and the offsets so i'm confused about how to do it, any help is appreciated.
     
    I can explain from a data POV but not sure about which tools to use.

    Emerald -
    Trainer Data: 0x310030
    Trainer Sprites: 0x305654
    Trainer Palettes: 0x30593C

    Trainer Data -
    Each trainer is represented consecutively by 40-byte groupings. There is a lot to the data, just know the trainer sprite ID is the 4th byte.
    To get a specific trainer data offset, you can do (0x310030 + (40 * trainer ID)).

    Sprites -
    The table for trainer sprites is located at 0x305654 and each trainer sprite is represented by 8 bytes. The first 4 are the pointer to the sprite in little endian format (ignore the leading 08). I think the other 4 are for elevation in battle.
    To get a specific trainer sprite offset, you can do (0x305654 + (8 * sprite ID)), then grab and reverse the next 3 bytes (the offset in little endian format).

    Palettes -
    Very similar 8-byte structure to the sprites. The first 4 bytes are the pointer to the palette in little endian format. No clue what the other 4 are.
    To get a specific trainer palette offset, you can do (0x30593C + (8 * sprite ID)), then grab and reverse the next 3 bytes (the offset in little endian format).

    Expansion -
    To create new trainers, you are best off replacing existing ones. If you truly want to expand the table, you will likely need to repoint your table altogether to prevent the expanded table's data from running into import bytes, which could break your entire ROM. A quick HEX search for the table offset as a pointer (e.g. 54463008) shows a few possible locations where the table is currently being referenced and will need to be changed to the new table offset:
    0x1CC408
    0x18D07C
    0xB5F3C
    0xB5EF8
    0xB5DF78

    Good luck
     
    I'm not sure where to find the codes your talking about, I assume with a tool like HxD?, but just having the codes is a big help, Thank you for the help.
     
    I didn't know that was a thing lol, I'm still pretty new at this so that's going to help, Thanks.
     
    Back
    Top