11 March 2016 - Forum Rules

Main Menu

NES Rom Hacking

Started by Barbour18, June 09, 2021, 12:54:31 PM

Previous topic - Next topic


Hello, everyone. I'm new to Rom Hacking so I apologize if this is a very simple question to answer.

But I was wondering what sort of coding triggers a Palette Swap upon an Item pickup? (Think Mario obtaining a Fire Flower or Samus picking up the Varia Suit)

I assume the actual Item Pickup triggers some kind of code to change the sprite to a new color (or entirely new sprite shape and size like Mario obtaining the Super Mushroom)

If someone could help me answer this and find a utility to edit, I'd be very appreciative. All the editors I've found are mostly for maps and the actual player sprite layout itself. (For reference, I'm trying to make it so grabbing the Blue Ring in Zelda will change the Palette to a darker blue, much like the Item Itself.)

Again, I'm an absolute newbie when it comes to this. Thanks.

Sliver X

What you're specifically asking about wouldn't even require altering code: It would be a simple palette data edit.

Using an emulator like FCEUX will allow you to view the palette table via it's PPU debug menu. This table holds four, four color palettes for background tiles,with the first color shared across all four palettes, and four, four color palettes for sprites (Though the first color is actually transparent in each set of four)

The actual colors are stored in an index, with each color represented by a specific hexadecimal value. Most typically, the order the palette values are listed in the table is the order you will find them in the ROM (Hover over a color in the PPU Viewer to see a color's hex value). Use FCEUX's Hex editor to view the ROM data to do this.

Note that if you aren't finding matches for all four sprite palette colors omit the transparent value and you'll probably have better luck: This is common going by the dozens of games I messed with over the years. Changing the colors will be as simple as substituting new values.

Do be aware that most graphics will share palettes, so altering a palette will typically have a side effect of changing their colors as well.

A thorough explanation of all this can be found here (Along with a chart that shows you all the color values):