Identifying sprite locations in ROM memory with FCEUX

Started by cschifani, August 07, 2022, 11:15:17 PM

Previous topic - Next topic

cschifani

I'm trying to fix the sprites in a hack of Rockman 2 that I made, and I'd like to be able to find the data for sprites in the ROM. I know that, in Mesen, you can view sprites directly from the PPU viewer, then search for the data located in PRG ROM. This isn't getting me where I had hoped, however. Is there a better way to do this if I use FCEUX instead?

To be clearer, what I want to do is find the sprite data for enemies and replace them with my own sprite data. As an example of what I'd like to find, how would I locate the sprite data for the first enemy in Heat Man's stage using FCEUX? My tests suggest that that data is somewhere between df10 and df8f, but every time I overwrite all of that data, I break some other sprites, so I'd like to be as accurate as possible.

You have my thanks in advance for any help you might provide.

Bavi_H

I think using Mesen will be easier than trying to use FCEUX. I took a quick look and this method seems to work for me:

Quote from: cschifani on August 07, 2022, 11:15:17 PMin Mesen, you can view sprites directly from the PPU viewer, then search for the data located in PRG ROM.

The NES file I used has a PRG+CHR CRC32 of 6150517C. You can see the PRG+CHR CRC32 in Mesen's Log Window -- go to the Tools menu and choose the Log Viewer command.


Steps I used:

In Mesen's PPU viewer, go to the Sprite Viewer page.

In the top display, mouse over the sprite tiles. In the bottom display you'll see a red box around where the sprite is on the screen. (Note if you do it the other way around -- mousing over the tiles in the bottom display -- Mesen will only highlight one of the tiles for areas made of stacked tiles.)

Right-click on a tile and choose "Edit in Memory Viewer". The Memory Viewer will open in the "PPU Memory" view at the beginning of the corresponding tile definition.

A tile definition takes an entire 16-byte row in the memory view, so select the entire row of hex bytes and copy it.

Change the Memory Viewer to the "PRG ROM" view.

Press Ctrl+F to bring up the Find bar at the bottom.

In the find box, paste in the hex bytes and make sure "Text search" is unchecked. Press Enter to search, and Mesen will find the same row of hex bytes in PRG ROM.

(The PRG ROM address doesn't have a header, so you have to add hex 10 to the PRG ROM address to get the NES file offset.)

Example: In the Heat Man stage, the first enemy is a green helicopter-head/spring-foot thing. I found the tile definition bytes for its helicopter blade start at PRG ROM address hex 5400 (NES file offset hex 5410).


Quote from: cschifani on August 07, 2022, 11:15:17 PMdata [] somewhere between df10 and df8f

I see PRG ROM addresses DF00 to DF7F to DFEF (NES file offsets DF10 to DF8F to DFFF) are various tile definition bytes for an enemy a little later on in the Heat Man stage, a blue bump thing that springs up at you. This map's legend calls it "Spring Head": GameFAQs - Mega Man 2 - Heat Man Stage Map (PNG)


Quote from: cschifani on August 07, 2022, 11:15:17 PMevery time I overwrite all of that data, I break some other sprites
Can you give more details: How did you overwrite the data? What sprites broke?

I didn't play very far into the level, but the few test changes I made only seemed to affect one sprite.


cschifani

This is extremely helpful, and exactly what I was hoping to find out! Thank you very, very much!

tygerbug

I would also suggest looking at the ROM within YY-CHR, a pixel/graphics editor.