RGBFIX(1)

NAME
rgbfix - Game Boy header utility and checksum fixer

SYNOPSIS
rgbfix [-jsVv] [-C | -c] [-f fix_spec] [-i game_id] [-k licensee_str] [-l licensee_id] [-m mbc_type] [-n rom_version] [-p pad_value] [-r ram_size] [-t title_str] file

DESCRIPTION
The rgbfix program changes headers of Game Boy ROM images. It also performs other correctness operations, such as padding.

Note that options can be abbreviated as long as the abbreviation is unambiguous: - -verb is - -verbose, but - -ver is invalid because it could also be - -version. The arguments are as follows:

-C, - -color-only
    Set the Game Boy Color–only flag: 0x143 = 0xC0. If both this and the -c flag are set, this takes precedence.

-c, - -color-compatible
    Set the Game Boy Color–compatible flag: 0x143 = 0x80. If both this and the -C flag are set, -C takes precedence.

-f fix_spec, - -fix-spec fix_spec
    Fix certain header values that the Game Boy checks for correctness. Alternatively, intentionally trash these values by writing their binary inverse instead. fix_spec is a string containing any combination of the following characters:

    l   Fix the Nintendo logo (0x104–0x133).
    L   Trash the Nintendo logo.
    h   Fix the header checksum (0x14D).
    H   Trash the header checksum.
    g   Fix the global checksum (0x14E–0x14F).
    G   Trash the global checksum.

-i game_id, - -game-id game_id
    Set the game ID string (0x13F–0x142) to a given string of exactly 4 characters. If both this and the title are set, the game ID will overwrite the overlapping portion of the title.

-j, - -non-japanese
    Set the non-Japanese region flag: 0x14A = 1.

-k licensee_str, - -new-licensee licensee_str
    Set the new licensee string (0x144–0x145) to a given string, truncated to at most two characters.

-l licensee_id, - -old-licensee licensee_id
    Set the old licensee code, 0x14B, to a given value from 0 to 0xFF. This value is deprecated and should be set to 0x33 in all new software.

-m mbc_type, - -mbc-type mbc_type
    Set the MBC type, 0x147, to a given value from 0 to 0xFF.

-n rom_version, - -rom-version rom_version
    Set the ROM version, 0x14C, to a given value from 0 to 0xFF.

-p pad_value, - -pad-value pad_value
    Pad the image to a valid size with a given pad value from 0 to 0xFF. rgbfix will automatically pick a size from 32 KiB, 64 KiB, 128 KiB, ..., 8192 KiB. The cartridge size byte (0x148) will be changed to reflect this new size.

-r ram_size, - -ram-size ram_size
    Set the RAM size, 0x149, to a given value from 0 to 0xFF.

-s, - -sgb-compatible
    Set the SGB flag: 0x146 = 3. This flag will be ignored by the SGB unless the old licensee code is 0x33!

-t title, - -title title
    Set the title string (0x134–0x143) to a given string, truncated to at most 16 characters. It is recommended to use 15 characters instead, to avoid clashing with the CGB flag (-c or -C). If both this and the game ID are set, the game ID will overwrite the overlapping portion of the title.

-V, - -version
    Print the version of the program and exit.

-v, - -validate
    Equivalent to -f lhg.

EXAMPLES
Most values in the ROM header are only cosmetic. The bare minimum requirements for a workable program are the header checksum, the Nintendo logo, and (if needed) the CGB/SGB flags. It is a good idea to pad the image to a valid size as well (“valid” meaning a power of 2, times 32 KiB).

The following will make a plain, non-color Game Boy game without checking for a valid size:

    $ rgbfix -v foo.gb

The following will make a SGB-enabled, color-enabled game with a title of “foobar”, and pad it to a valid size. ( The Game Boy itself does not use the title, but some emulators or ROM managers do.)

    $ rgbfix -vcs -l 0x33 -p 255 -t foobar baz.gb

The following will duplicate the header (sans global checksum) of the game “Survival Kids”:

    $ rgbfix -cjsv -k A4 -l 0x33 -m 0x1B -p 0xFF -r 3 -t SURVIVALKIDAVKE SurvivalKids.gbc

BUGS
Please report bugs on GitHub: https://github.com/rednex/rgbds/issues.

SEE ALSO
rgbasm(1), rgblink(1), rgbds(7)

HISTORY
rgbfix was originally released by Carsten Sørensen as a standalone program called gbfix, and was later packaged in RGBDS by Justin Lloyd. It is now maintained by a number of contributors at https://github.com/rednex/rgbds.