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

Author Topic: Dr. Mario and changing palettes on Game Boy Color ROMs?  (Read 770 times)

pangenttech

  • Jr. Member
  • **
  • Posts: 33
    • View Profile
Dr. Mario and changing palettes on Game Boy Color ROMs?
« on: November 18, 2020, 12:57:55 pm »
Hi. As a followup to the NES version of Dr. Garfield, I did a quick graphics hack for the Game Boy version of Dr. Mario, also for Game Boy Color.

http://www.romhacking.net/hacks/5542/

This is based off of the Dr. Mario DX Game Boy hack by marc_max and Da_GPer, seen here:

https://www.romhacking.net/hacks/5281/

This hack added color to Dr. Mario (making it a Game Boy Color game) and also created more NES-like graphics for the viruses.


I've worked on a few NES hacks and gotten familiar with that format. This is my first time attempting Game Boy and Game Boy Color.

I'm using Visual Boy Advance for an emulator, which can look at and export palettes. Not as good as Mesen for NES, but all right.

I don't know much about Game Boy Color palettes, how to generate them, and how to change them. Google searching hasn't been helpful on this topic.

The Dr. Mario DX game cycles through a few different palettes on the title screen and during gameplay. Some work better than others. I need a palette that's basically one color to work with my greyscale title graphics (or I'll have to simplify them).

Since I haven't changed Mario/Garfield's palette, he's a bit pink right now instead of orange.

There is a Mario happy "winning" sprite, I'm not sure where that shows up in gameplay.

I also don't know how to access 2 player mode for testing.



On an unrelated NES note, I am trying to learn how to enable custom music and custom backgrounds in Mesen HDPacks. There's a lot of discussion about this but not much good info, probably because it differs for each game and isn't done automatically by Mesen or related tools.

FAST6191

  • Hero Member
  • *****
  • Posts: 3013
    • View Profile
Re: Dr. Mario and changing palettes on Game Boy Color ROMs?
« Reply #1 on: November 18, 2020, 04:57:39 pm »
For GB/GBC hardware you will tend to be pointed at the pandocs, few different versions out there as various emulators have their own take on them but
https://bgb.bircd.org/pandocs.htm#lcdcolorpalettescgbonly

VBA can import and export palettes but it will just be the palettes as stored in RAM, and subject to change at the whim of the game. VBA is also primarily a GBA emulator with its GB/GBC something of an afterthought. Might want to then grab a more dedicated one, especially if you end up debugging things https://bgb.bircd.org/ being a good start on that one.

Palettes on the GB/GBC are then like most other later devices and generated at runtime.
If you want to dump it from RAM and search the ROM for it (compression of palettes is not much of a thing even on later systems -- so very little space saving after all) then you will find it a lot of the time. Otherwise you get to trace things (get debugger, set break on write to the palette section shortly before the palette you want is loaded into memory, usually a few instructions up will be some write instruction for it and its source will be somewhere in the ROM area).

2 player mode. There are emulators with a measure of link cable support. I have not paid attention to what goes here for a while though as it was not as advanced as some of the GBA stuff when I last went looking, though as you are presumably looking to link with the same game then it should not be an issue. no$gmb then being one such emulator.
http://problemkaputt.de/gmb.htm

Never looked at mesen before so have no idea what "Mesen HDPacks" entail.

pangenttech

  • Jr. Member
  • **
  • Posts: 33
    • View Profile
Re: Dr. Mario and changing palettes on Game Boy Color ROMs?
« Reply #2 on: November 19, 2020, 06:14:37 am »
Thanks, I figured it out! The Dr Mario DX color palettes appear around 00FA00 in the ROM.

The bytes are as they appear in RAM in an emulator but appear in reverse order for some reason. So a color 5B1F appears as 1F5B. From there I was able to change some colors.


  The music does need to loop; I'm trying to add
   lda $01
        sta $4100
or A5018D0041
  which gets it going in one of your older ASMs (which is all I have). Not sure where to add that without breaking the ROM though. So I just overwrote some of the other music logic with this (I think it was a mute command at $4105). Seems to work all right though.

   I also figured out some stuff about backgrounds and music in NES HDpacks for Mesen emulator.

Basic conditions format is something like:
<condition>titlescreen,tileAtPosition,57,89,507,0F302712
[titlescreen]<background>DrGarfieldBG2.png,1,0,0,N,0,0

  Where tileAtPosition or spriteAtPosition is followed by x and y position (checkable in Photoshop), tile number and palette (as output from right-clicking in Mesen's PPU).


  Music requires writing some numbers to certain registers in the ROM. Bogaa was trying to teach me this but I've never done anything with Assembly.
https://www.mesen.ca/docs/hdpacks.html#lt-bgm-gt-tag
« Last Edit: November 19, 2020, 01:02:37 pm by pangenttech »