Romhacking.net

Romhacking => ROM Hacking Discussion => Topic started by: keropi on July 20, 2014, 05:14:41 am

Title: How to change GB rom's header so to trick GBC/GBA to load a custom palette?
Post by: keropi on July 20, 2014, 05:14:41 am
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!
Title: Re: How to change GB rom's header so to trick GBC/GBA to load a custom palette?
Post by: henke37 on July 20, 2014, 06:55:30 am
Some games were released after the console, as such they contain author defined palettes. Many even change palette on the fly!
Title: Re: How to change GB rom's header so to trick GBC/GBA to load a custom palette?
Post by: keropi on July 21, 2014, 06:46:50 pm
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  :)
Title: Re: How to change GB rom's header so to trick GBC/GBA to load a custom palette?
Post by: Chippy2000 on July 26, 2014, 09:20:42 am
Don't Pokemon Red, Blue, Yellow and Green change palette when on the GBA?
Title: Re: How to change GB rom's header so to trick GBC/GBA to load a custom palette?
Post by: streeker on January 30, 2020, 02:19:44 pm
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 (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

Title: Re: How to change GB rom's header so to trick GBC/GBA to load a custom palette?
Post by: PowerPanda on January 31, 2020, 06:22:41 pm
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
Title: Re: How to change GB rom's header so to trick GBC/GBA to load a custom palette?
Post by: streeker on January 31, 2020, 07:21:09 pm
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.
Title: Re: How to change GB rom\'s header so to trick GBC/GBA to load a custom palette?
Post by: keropi on February 01, 2020, 03:43:02 am
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 (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!
Title: Re: How to change GB rom's header so to trick GBC/GBA to load a custom palette?
Post by: siras 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.