Finding CPS 1/2 Palette Data/Locations with the MAME Debugger.
Guide by mountainmanjed, any mistakes injected by Preppy while converting it to HTML.

Tools You Need For This

MAME!
The best emulation software on the planet.
The ROM for the game you're interested in.
For this guide, use a CPS1 or CPS2 ROM.

Finding CPS 1/2 Palette Data with the MAME Debugger

If you're not familiar with the MAME debugger, they have an excellent guide here.

First we gotta get the debugger active.
If you're using a command line or a batch file just just add -debug to the end of the command. Another option you can use is to make a settings file for the game (romname.ini) and add Debug 1 to it.
Unfortunately with CPS 1/2 you see there isn't a dedicated palette ram just gfx_ram. This RAM holds tile map data for the backgrounds, scanline push offsets, as well palette data. It starts at 0x900000 and ends at 0x930000.
So to start looking we're going have start the game and get the memory viewer up.
With the debugger window selected pressing f5 will start the game and CTRL+m will pop out a memory viewer.
Since this set RAM can have many things we can just search in banks of 0x4000.

Good Places to Start

  • Alpha/Zero Engine games use 0x90c000 (Vsav, Vsav2, VHunter2 and SF Alpha Series)
  • Marvel Games usually 0x914000
  • SF2 0x900000
    One thing to note Palette data is going to look a little different in the RAM as palette data: the first digit is going to be F.
    Once we've identified palette RAM in gfxram we can bring up the palette viewer (f4 on the game window) and look for the palette line you want to edit. Just read the left number and take away a zero (f00 = f0). Now just have to use this to get the start of the specific palette in the ram:
    Palramstart+(viewerloc*0x20)
    So we have two options we can do set a watch point in the debugger see when it gets written in the code or we can edit the first digit and manually search with a hex editor.

    Setting a watchpoint in MAME

    In the console part of the debugger type:
    wp (palettelocation),2,w
    Now when something is written to that palette address the game stops and debugger tells you what is written. Look in the A registers for anything under 0x400000 and usually higher than 0x100000.
    So read the command up it stopped on afterwards if it's a move. l subtract 4, if it's move. w subtract 2. And there you go.