News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: How to change GB rom's header so to trick GBC/GBA to load a custom palette?  (Read 7011 times)

keropi

  • Jr. Member
  • **
  • Posts: 46
    • View Profile
Hiya!

I have a question regarding B/W Gameboy games when played on a GBC/GBA device. Allow me to explain  ;D
When you boot a GB classic game on a GBA/GBC the default palette uses some strange colors with normal B/W games (I am told they look ok-ish in a GBC screen but I don't own one). The user can also choose a palette by pressing a button combo when the GameBoy logo is displayed on boot.
All that is explained here: http://tcrf.net/GBC_BIOS

So I went on and purchased the EverDrive GB flashcart and use it with my GBA AGS-101 with it's nice backlit screen. GBC games are looking fine as expected but GB ones use the strange color palette... I wrote in the EverDrive forum about the possibility of forcing a palette automatically on boot and a user pointed out that the game "X" is hardcoded in the GBC bios to use the B/W palette - which looks awesome IMHO   :thumbsup:

I read the GBC BIOS page linked above and it seems that if I change a game's internal name to X and fix the header and rom CRCs to reflect the change , then the game would boot with the B/W palette. I googled and found RGBFIX that does both renaming and CRC fixing: https://www.anjbe.name/rgbds/manual/rgbfix/
My test roms were Super Mario Land 1 and 2. And it was a success! Changed both internal names to "X" , fixed CRCs and both booted with the B/W palette. No more keypresses , just load an play with my preferred palette  :laugh:

Sadly, this doesn't seem to work in all games though... For example Castlevania 1.
It just won't boot with any palette other than the default one. The internal name change doesn't affect it and I have tried other internal names that are linked to other palettes (I did some research when I thought that name changing worked in all games):

Quote
LEFT+B palette needs game_title "X" (that's the BW/palette)
UP palette needs game_title "F1RACE" (that's the brown palette, also nice)
Pocketcamera palette needs game_title "POCKETCAMERA" (it's a nice palette embedded in the BIOS)

DOWN+A  palette needs game_title "TETRIS"
RIGHT+A  palette needs game_title "MILLI/CENTI/PEDE"
RIGHT+B  palette needs game_title "SOLARSTRIKER"
UP+A palette needs game_title "ZELDA" (this is a close palette to the UP+A one, NOT the exact one)

So, does anyone here have a clue why some games are not affected with the internal_name change?

I know this is nitpicking but if someone knows I can pass this knowledge down and a tool will be created for lazy users - like myself! - to auto-patch games for special flashcart setups.
TIA for any info/tips!

henke37

  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Some games were released after the console, as such they contain author defined palettes. Many even change palette on the fly!

keropi

  • Jr. Member
  • **
  • Posts: 46
    • View Profile
yes, it's true , these are fine with the palettes the system chooses... my question is about the old b/w-only games that predate any coloring schemes  :)

Chippy2000

  • Jr. Member
  • **
  • Posts: 76
  • I'm the CREATOR Pokemon Gold Beta/Alpha Revival!
    • View Profile
Don't Pokemon Red, Blue, Yellow and Green change palette when on the GBA?
COO of The Chippy Cooperation (TCC)

I'm...just here...floating in space and stuff...

streeker

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
Sorry for digging out this old thread. But since playing GB ROMs in monochrome/grayscale while using an "EZ-Flash jr." on a GBA was exactly what I wanted to achieve, I've been digging a little further and finally found the solution: in addition to changing a game's name to "X" in the header you also have to switch the Licensee Code to "Nintendo" (i.e. 01).

Here's a short tutorial:
1. Download RGBFIX (https://github.com/rednex/rgbds/releases/tag/v0.3.9) and extract it to a new folder.
2. Copy all the ROMs you want to convert to that folder.
3. Create a new text document within the folder and copy/paste the following inside:
Code: [Select]
@echo off
for /R %%f in (*.gb) do (
rgbfix -f hg -l 0x01 -t "X" "%%f"
 )
echo done.
4. Save it and rename the document from .txt to .bat
5. Run the batch (.bat) file and wait a few seconds until everything is done. VoilĂ !

NOTES:
- This procedure only works for classic GB ROMs (=the gray cartridges, not the black ones)
- A short, flashing Nintendo logo will be seen on boot-up for most (not all) games, that have not been developed by Nintendo itself
- If you want any color palette other than B/W, you have to replace X in the code above with the ROM header's name string of a desired game out of the following listing: https://tcrf.net/Notes:Game_Boy_Color_Bootstrap_ROM

« Last Edit: January 31, 2020, 02:26:32 am by streeker »

PowerPanda

  • Full Member
  • ***
  • Posts: 186
    • View Profile
From a video I happened to be watching while reading through this topic, the default palettes are actually in the GBC bios, not in the rom itself.

https://youtu.be/ZEJVOH6Pxkg?t=670

streeker

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
Yes, that's true. But all of these palettes are triggered by the name strings within the ROM headers. Trust me, changing the name and the licensee code in the headers works, if the games are played on original hardware (GBC or GBA) afterwards.
« Last Edit: January 31, 2020, 07:28:02 pm by streeker »

keropi

  • Jr. Member
  • **
  • Posts: 46
    • View Profile
From a video I happened to be watching while reading through this topic, the default palettes are actually in the GBC bios, not in the rom itself.

https://youtu.be/ZEJVOH6Pxkg?t=670

yes and the bios checks the game's checksum on boot and chooses a palette accordingly

February 01, 2020, 03:43:30 am - (Auto Merged - Double Posts are not allowed before 7 days.)
Sorry for digging out this old thread. But since playing GB ROMs in monochrome/grayscale while using an "EZ-Flash jr." on a GBA was exactly what I wanted to achieve, I've been digging a little further and finally found the solution: in addition to changing a game's name to "X" in the header you also have to switch the Licensee Code to "Nintendo" (i.e. 01).

Here's a short tutorial:
1. Download RGBFIX (https://github.com/rednex/rgbds/releases/tag/v0.3.9) and extract it to a new folder.
2. Copy all the ROMs you want to convert to that folder.
3. Create a new text document within the folder and copy/paste the following inside:
Code: [Select]
@echo off
for /R %%f in (*.gb) do (
rgbfix -f hg -l 0x01 -t "X" "%%f"
 )
echo done.
4. Save it and rename the document from .txt to .bat
5. Run the batch (.bat) file and wait a few seconds until everything is done. VoilĂ !

NOTES:
- This procedure only works for classic GB ROMs (=the gray cartridges, not the black ones)
- A short, flashing Nintendo logo will be seen on boot-up for most (not all) games, that have not been developed by Nintendo itself
- If you want any color palette other than B/W, you have to replace X in the code above with the ROM header's name string of a desired game out of the following listing: https://tcrf.net/Notes:Game_Boy_Color_Bootstrap_ROM

thanks for that! I will try it!

siras

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: How to change GB rom's header so to trick GBC/GBA to load a custom palette?
« Reply #8 on: September 10, 2020, 03:41:10 am »
Great thread and I've succesfully added the predefined palettes to other roms by changing the header name. It also runs good on my EverdriveGB.

I'm wondering if it would be possible to use the unused palettes https://tcrf.net/Game_Boy_Color_Bootstrap_ROM ? Some pepople mentions that it's the checksum that matters but obviously its the game name in the header. But these unused palettes doesnt seem to have a string associated with them.