Editing the Rom Header

Posted May 11, 2020

Has this happened to you? You spend days crafting and coding an amazing Pong game for the Mega Drive. You create artistic, beautiful graphics, use highly advanced coding techniques and magical algorithms, and have composed a soundtrack that sounds like Streets of Rage as arranged and conducted by John Williams. Then you compile the game, fire it up in your emulator and see this:

images/sampleheader.png

That just ruins the whole thing, doesn’t it?

But luckily it’s very easy to change the title of your game if you know where to look. And where you need to look is inside your project folder. There you will find a folder named src and inside that, a folder named boot. See that file named rom_head.c? That is where the information is stored that will go in the header of your rom.

The header basically stores meta information about your game, such as the title, release date, copyright information and more. If you simply open rom_head.c in a text editor, you will see all of this information in plain text. All the information is stored in a single struct:

const struct
{
    char console[16];               /* Console Name (16) */
    char copyright[16];             /* Copyright Information (16) */
    char title_local[48];           /* Domestic Name (48) */
    char title_int[48];             /* Overseas Name (48) */
    char serial[14];                /* Serial Number (2, 12) */
    u16 checksum;                   /* Checksum (2) */
    char IOSupport[16];             /* I/O Support (16) */
    u32 rom_start;                  /* ROM Start Address (4) */
    u32 rom_end;                    /* ROM End Address (4) */
    u32 ram_start;                  /* Start of Backup RAM (4) */
    u32 ram_end;                    /* End of Backup RAM (4) */
    char sram_sig[2];               /* "RA" for save ram (2) */
    u16 sram_type;                  /* 0xF820 for save ram on odd bytes (2) */
    u32 sram_start;                 /* SRAM start address - normally 0x200001 (4) */
    u32 sram_end;                   /* SRAM end address - start + 2*sram_size (4) */
    char modem_support[12];         /* Modem Support (24) */
    char notes[40];                 /* Memo (40) */
    char region[16];                /* Country Support (16) */
} rom_header = {
    "SEGA MEGA DRIVE ",
    "(C)FLEMTEAM 2013",
    "SAMPLE PROGRAM                                  ",
    "SAMPLE PROGRAM                                  ",
    "GM 00000000-00",
    0x0000,
    "JD              ",
    0x00000000,
    0x00100000,
    0x00FF0000,
    0x00FFFFFF,
    "  ",
    0x0000,
    0x00200000,
    0x002001FF,
    "            ",
    "DEMONSTRATION PROGRAM                   ",
    "JUE             "
};

And if you change any of the values, they will be incorporated into the rom the next time you compile your project! So if you wanted to change the title of your game that is displayed in the emulator, you would change the third (and fourth) lines of the rom header struct. Be aware however that you cannot exceed the amount of characters reserved for an item. For example, your title_local can only consist of 48 characters, while your copyright note can only be 16 characters long.

So if I change the two instances of SAMPLE PROGRAM to MEGAPONG I will end up with this:

images/realheader.png

Much better! Now the game is fit to be sold on itch.io. (See what I did there?)

And if you want some more information on what each field contains and what values are permissible, check out this great breakdown by Plutiedev.

If you've got problems or questions, join the official SGDK Discord! It's full of people a lot smarter and skilled than me. Of course you're also welcome to just hang out and have fun!

Take It to the Next Level!

Become an excellent patron on Patreon and snatch yourself some kickass perks such as early access, early builds, exclusive updates and more!

You will also be added to the Wall of Excellent People!

Check out the rest of this tutorial series!

  • Creating Graphics for the Mega Drive
  • How to Quickly Generate C Prototype Functions in VSCode
  • Color Swapping
  • 4 Programs For Creating Mega Drive Graphics
  • Editing the Rom Header
  • Simple Game States
  • Creating a Simple Menu
  • Changing The Text Color in SGDK
  • Playing Music in SGDK
  • Converting VGZ to VGM
  • Processing Resets
  • Drawing Tiles From Code
  • Make a Text Crawl, Streets of Rage Style
  • Scrolling Maps
  • Placing Tiles
  • Simple Animated Tiles in SGDK
  • Simple Password System
  • By using the Disqus service you confirm that you have read and agreed to the privacy policy.

    comments powered by Disqus