Author Topic: Is there a tool to mass-change the internal names of GB roms?  (Read 8839 times)

0 Members and 1 Guest are viewing this topic.

Offline keropi

  • Sr. Member
  • ****
  • Posts: 305
  • Karma: +17/-1
    • View Profile
Hiya!

As per topic, is there a tool to  mass-change the internal names of GB roms to make them all use the Japanese "X" game's internal name?

The reason for this is that in the GBC/SGB BIOS (and by extend the GBA one) this particular game defaults to using the B/W palette , thus avoiding the puke-color default one or having to press LEFT+B each time a GB game boots on a GBC/SGB. 

GBC and SGB BIOS palette options are described here: http://tcrf.net/GBC_BIOS and http://tcrf.net/Super_Game_Boy_1_and_2
and the thread with mrpopsicleman's heads up on this is here: http://krikzz.com/forum/index.php?topic=1929.msg19072

It would be great to have a tool making this change and give end users control of the default palette, even if this means patching roms...
TIA for any info!  :)

edit:

according to the info here: http://students.washington.edu/fidelp/galp/megaguides/devrs-faqs.html#GBCTitle

Quote
With the introduction of the GBC, the internal cart name has been made smaller. Is this correct ?

Yes. Rom location $143 was turned into a flag that indicated a GBC game so the internal cart name was reduced in size from 16 to 15 characters. The GBC flag is $80 for a GBC compatible or dedicated game. Any other value signifies a non-GBC game.

As of 1-Mar-99, all GBC games have an even smaller internal cart name of 11 characters. The four ascii characters following the internal cart name are now dedicated to the game product code. As part of this change, the GBC flag byte was changed: $80 = GBC compatible game, $c0 = GBC dedicated game. Any other values signify a non-GBC game.

all you need to do is replace these 16bytes with the X ones and then recalculate the rom's checksum...
« Last Edit: July 16, 2014, 02:29 PM by keropi »

Offline nuu

  • Hero Member
  • *****
  • Posts: 1809
  • Karma: +81/-2
    • View Profile
Re: Is there a tool to mass-change the internal names of GB roms?
« Reply #1 on: July 16, 2014, 02:44 PM »
You could use a batch (dos/windows) or bash (unix/linux/mac) script together with a command-based hexeditor. You should be able to find info on how to script by googling.

Offline Kyle

  • Sr. Member
  • ****
  • Posts: 463
  • Karma: +55/-0
  • Game Genie Guy
    • View Profile
Re: Is there a tool to mass-change the internal names of GB roms?
« Reply #2 on: July 16, 2014, 03:23 PM »
I'll confirm this. Change the header at 134 to "X" and fix the checksum to get a black and white palette. If you change the name without fixing the checksum you don't get past the BIOS logo.

If you can wait until the weekend I'll put something together.

Offline keropi

  • Sr. Member
  • ****
  • Posts: 305
  • Karma: +17/-1
    • View Profile
Re: Is there a tool to mass-change the internal names of GB roms?
« Reply #3 on: July 16, 2014, 03:26 PM »
@Kyle
thanks for that! I can wait for as much time as you need my friend  :)

edit:
I just checked with Super Mario Land that I edited the name to the "X" string (58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00) and a new checksum,  it does boot with the B/W palette on my GBA as default, no need to mess with combos  :)

here is the file for anyone that want to test it: https://www.mediafire.com/?muhnozzuu6oub2y

edit2:

rgbfix https://www.anjbe.name/rgbds/manual/rgbfix/ (a part of the RGBDS package) also works, used this command line: rgbfix -t X -v <insert name>.gb
the problem is ofcourse that it does not accept wildcards so each file needs processing manualy
« Last Edit: July 16, 2014, 05:08 PM by keropi »

Offline Kyle

  • Sr. Member
  • ****
  • Posts: 463
  • Karma: +55/-0
  • Game Genie Guy
    • View Profile
Re: Is there a tool to mass-change the internal names of GB roms?
« Reply #4 on: July 16, 2014, 10:35 PM »
A for loop will take care of that via a batch file. See if you can find it on Google. We're out of town on vacation through Friday so all I have is my phone.

Offline keropi

  • Sr. Member
  • ****
  • Posts: 305
  • Karma: +17/-1
    • View Profile
Re: Is there a tool to mass-change the internal names of GB roms?
« Reply #5 on: July 16, 2014, 10:57 PM »
^ yeah will probably find some crude way to do that, no need to worry about crap like that, enjoy your time off!!!

I have found another "problem" which I am not so sure how to handle. The game title was max 16bytes and when GBC was released they decided to reserve the 16th byte (0x143) to indicate GBC only or compatibility.

Now, some old games do use the full 16bytes name space, for example "Arcade Classics No2" uses this 16byte title: MILLI/CENTI/PEDE.
RGBFIX when it renames the file_name leaves the 16th byte alone, so making it have the name X results in a "X ....E" title (... are 14 00 hex bytes)  , thus the name hash for B/W palette does not check and it reverts to the stock one.
One way is to first force a dummy 16byte name like "1111111111111111" and then force the real "X" one, then all the 15bytes after the X are FFs and B/W palette works.

My question is if this can break something in classic GB roms, maybe messing with the 16th byte makes some GBC-aware games act up?  Because I was thinking in order to be sure to have all the roms have a dummy 16byte name and then the B/W (or whatever palette) name, just to be sure.
Anyone knows this detail?

edit: turns out that RGBFIX fails to alter the 16th byte if it's anything else than FF or the GBC flag. It simply won't change it correctly to either FF or GBC flags... it displays this error: "Color flag conflicts with game title" when you try to force it , the result is wrong  :-X
So basically, whatever tool gets find/created it will need to first clear all the 16 bytes that are the game_title in the header (checking if the last one is either 0x80 or 0xC0 and bypass it if it is) and then recalculate both header and global checksum.

I've also done some research on the USER palettes and the GAME palettes in the GBC BIOS. Not all USER palettes have corresponding game palettes in the BIOS to get autoselected, for example RIGHT and DOWN palettes can't be auto-selected with simple game_title header change.

Here is what I found working fine:

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 custom-game 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)

ofcourse one can chose other games titles that work, it's just what I found easier.
« Last Edit: July 17, 2014, 10:40 AM by keropi »

Offline keropi

  • Sr. Member
  • ****
  • Posts: 305
  • Karma: +17/-1
    • View Profile
Re: Is there a tool to mass-change the internal names of GB roms?
« Reply #6 on: July 17, 2014, 11:22 AM »
OH man, I am bummed... the name_title does not work with all games... take for example Castlevania 1 , nomatter what name I put in it, manually or with rgbfix and with fixed checksums it always uses the default puke-palette unless you force one with the key-combo at boot time ...  :'(
some games work, some not. Perhaps I am missing something.

maybe another way to enforce a palette is this , taken from the GBC information page:

Quote
To access the unused palettes using an emulator that allows the bootstrap ROM to load, use the Gameshark code 01??08D0 with the ID of the desired entry. The selected palette will load regardless of whether or not buttons have been pressed.

I tried to find how to convert the code to GameGenie that EDGB supports but I did not succeed, so I cannot test that...  :-[ :-X

or maybe the checksum that is checked for the auto-palettes also includes other rom information like MBC used etc... in that case the game_title should be random chars that along with the rest info generate the checksum that the BIOS expects...

this is getting complicated  ;D , damn the moron in Nintendo that decided that b/w games should have a puke-palette as default  >:(
« Last Edit: July 17, 2014, 12:02 PM by keropi »

Offline Asaki

  • Full Member
  • ***
  • Posts: 158
  • Karma: +3/-0
    • View Profile
Re: Is there a tool to mass-change the internal names of GB roms?
« Reply #7 on: July 18, 2014, 01:16 PM »
damn the moron in Nintendo that decided that b/w games should have a puke-palette as default  >:(

A lot of the colors look pretty good on an actual GBC.  On something with a backlight...not so much. I don't like the B&W palette though, it seems especially prone to "interlace flicker", or whatever it is (on a GBC, at least).

You could always get an original DMG or a GB Pocket (I've been using my new Pocket a lot lately)...or you could just get used to pressing the keys every time you boot ;) Nintendo pulled something similar on the 3DS, where you have to hold start + select every time you load a DS/DSi/VC game, unless you want it stretched out all ugly.

Offline Kyle

  • Sr. Member
  • ****
  • Posts: 463
  • Karma: +55/-0
  • Game Genie Guy
    • View Profile
Re: Is there a tool to mass-change the internal names of GB roms?
« Reply #8 on: July 19, 2014, 01:45 AM »
Howdy. Do you still want this automated assuming the limitations and all. Wouldn't take me long to do.

Offline keropi

  • Sr. Member
  • ****
  • Posts: 305
  • Karma: +17/-1
    • View Profile
Re: Is there a tool to mass-change the internal names of GB roms?
« Reply #9 on: July 19, 2014, 10:51 AM »
^ hiya!
yes, if it isn't too much trouble for you , maybe your way of doing it proves to be better since you won't rely in other people's tools  :)
TIA!

Offline Kyle

  • Sr. Member
  • ****
  • Posts: 463
  • Karma: +55/-0
  • Game Genie Guy
    • View Profile
Re: Is there a tool to mass-change the internal names of GB roms?
« Reply #10 on: July 19, 2014, 04:55 PM »
I spent a couple of hours on this and ended up in the same place. The title alone is not enough to override the game's colors if it is intent on setting them. I'd recommend a thread on gamehacking.org to see if you can get further assistance.

Offline keropi

  • Sr. Member
  • ****
  • Posts: 305
  • Karma: +17/-1
    • View Profile
Re: Is there a tool to mass-change the internal names of GB roms?
« Reply #11 on: July 19, 2014, 06:20 PM »
damn... thanks anyways for the time you spent on it, I really appreciate it!  :)
will write up a thread there later, maybe one on romhaching.net as well , I am already a member there