Mega Man 5 - Color Editing troubleshoot

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Mega Man 5 - Color Editing troubleshoot
by on (#185721)
Hey there.
So I've been working on a hacked rom of Mega Man V.
Everything I am planning to do works fine, but there's one problem that really bothers me.

I changed Mega Man's sprite colors, only the blue and cyan parts.
When I play everything works fine, until I shoot. When I look at the HEX code the color code changes back to Mega Man's original colors, but when Mega Man gets hit his edited colors return, how do I fix this?

Thank you very much.
Re: Mega Man 5 - Color Editing troubleshoot
by on (#185723)
Did you ask this over on the romhacking.net forum? If so, what'd they say? If not, why not?
Re: Mega Man 5 - Color Editing troubleshoot
by on (#185724)
I've been trying to make a account, but they still never accepted my request, so I hoped they could help me here.
Re: Mega Man 5 - Color Editing troubleshoot
by on (#185741)
Patience is virtue. That forum is a better place for romhacking than here. This forum is mainly for development (which can include romhacking, but isn't exclusively limited to such). No offense intended in the least (newbies are always welcome), but the technical calibre of folks here tends to be substantially higher.

Odds are, the location in the ROM you've modified to reflect the palette change needs to be done elsewhere in the ROM for the other "animation frames" (vaguely put). In other words: unless someone has already done the work for you, you get to reverse-engineer the game to figure out where it's being done.

I recommend using something like FCEUX to narrow down what exact palette entry (offset) is being used for the sprite/frame of animation in question. From that, you should be able to deduce the location in PPU RAM that correlates with that palette entry. You then can set a breakpoint in FCEUX's debugger for that PPU location, then reproduce the situation that causes the visual anomaly, and figure out what's responsible for writing that value to PPU RAM (the latter is the "heavy lifting" part). I can't tell exactly what you're referring to because grammatically your sentence is confusing; it refers to two separate things:

Quote:
... When I play everything works fine, until I shoot. When I look at the HEX code the color code changes back to Mega Man's original colors, but when Mega Man gets hit his edited colors return ...
Re: Mega Man 5 - Color Editing troubleshoot
by on (#186082)
Total guess: since Mega Man can power up a charged shot when B is held, I bet some routine related to checking the state of the B button after/around a shot resets his palette, since the shot charging changes his palette. You will want to maybe break on writes to $3F11-$3F1F once you press the B button, and find out what table or constants it's pulling from to write his palette.