SourMesen / Mesen

Mesen is a cross-platform (Windows & Linux) NES/Famicom emulator built in C++ and C#
https://www.mesen.ca
GNU General Public License v3.0
1.26k stars 320 forks source link

Rad Racer II Broken Graphics #262

Closed wildgoosespeeder closed 7 years ago

wildgoosespeeder commented 7 years ago

https://www.gamefaqs.com/nes/587551-rad-racer-ii

fceux rad racer ii FCEUX mesen rad racer ii Mesen

Mesen 0.9.3 has glitched graphics for Rad Racer II. It displays correctly in FCEUX. The game has been verified to be a good dump.

Specs: Windows 8.1 Pro 12GB PC3-12800 RAM Intel Core i5-3210M@2.5Ghz NVIDIA GeForce 610M

SourMesen commented 7 years ago

I'm not seeing any issue on my end. I tried a lot of options that could have potential impact, too, but don't get any weird graphics.

Either you have some obscure option enabled that I haven't tried, or maybe some cheat codes causing issues? Beyond that, I don't know - the ROM info from the Log Window would help validate that I am testing the same game.

wildgoosespeeder commented 7 years ago

No cheats enabled.

Log:

Loading rom: Rad Racer II.nes File CRC32: 0xD3E2A7D8

[DB] Initialized - 3100 games in DB PRG+CHR CRC32: 0x404B2E8B [iNes] Mapper: 4 Sub:0 [iNes] PRG ROM: 64 KB [iNes] CHR ROM: 64 KB [iNes] Mirroring: Horizontal [iNes] Battery: No [DB] Game found in database [DB] Mapper: 4 Sub: 0 [DB] System : NesNtsc [DB] Board: NES-TVROM [DB] Chip: MMC3B [DB] PRG ROM: 64 KB [DB] CHR ROM: 64 KB [DB] CHR RAM: 8 KB [DB] Battery: No [DB] Database info will be used instead of file header. [DB] Input: 2 standard controllers connected

Attached is my XML settings. settings.txt

SourMesen commented 7 years ago

It looks like the problem is (mostly) the ROM you're using.

This is mine (differences in bold):

File CRC32: 0x39D371EC PRG+CHR CRC32: 0x404B2E8B [iNes] Mirroring: Four Screens

So your rom's header is different from mine - it says horizontal mirroring, but Rad Racer 2 is a 4-screen game. If I edit my rom to make it horizontal mirroring, I get the same result.

When you open it in FCEUX and check the log, it says this:

The iNES header contains incorrect information. For now, the information will be corrected in RAM. Mirroring should be set to "Four-screen".
So that's why FCEUX works properly.

Essentially, there was a small bug in the way I converted Nestopia's & NesCartDb's databases into the format Mesen uses, which makes it lose the "4-screen" information that is in the DB. So for 4-screen games, if the ROM is incorrect, it can't correct the mirroring type. This is fixed (65dc9cb3a1655ddeed8ecf47a197fa32e36d4071)

I also ended up finding & fixing a few more bugs while looking at this: -Save states for 4-screen games were missing the 2 extra screens, so it could corrupt the display when loading a state (f14855bf6b19c282eb6a71b0cb95849ad37c865a) -The Edit iNES header feature was adding a few extra bytes at the end of the new rom file (0c97f4ab3dfa5418c7043550acf007e270187a39) -The pause screen was visible behind the game select screen when the "pause when in the background" option was enabled (028b2ff089f0a65d4c7d126eb3b93fa987dbd643)

wildgoosespeeder commented 7 years ago

So if I have this right, there is a problem with the ROM that I have, despite it being a verified good dump, and there was a problem with how Mesen was handling iNES errors, which my ROM contained? Thanks for the heads up. I'm glad I found the errors for you. I'm also glad you let me know there was something wrong with my ROM file. I wonder how long this issue would have gone unnoticed...

ghost commented 7 years ago

verifying nes roms only verify prg and chr data, it does not check for correct header info so a lof of roms out in the wild are verified to be correct but have wrong header info.

On Sun, Oct 8, 2017 at 11:52 AM, wildgoosespeeder notifications@github.com wrote:

So if I have this right, there is a problem with the ROM that I have, despite it being a verified good dump, and there was a problem with how Mesen was handling iNES errors? Thanks for the heads up. I'm glad I found the errors for you. I'm also glad you let me know there was something wrong with my ROM file. I wonder how long this issue would have gone unnoticed...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/SourMesen/Mesen/issues/262#issuecomment-334981145, or mute the thread https://github.com/notifications/unsubscribe-auth/AWPDtoKuj06Bve_nRQJbzLNHIcqgiKp8ks5sqEb4gaJpZM4PxfpH .

Cibomatto2002 commented 6 years ago

It would be nice if Mesen would correct the header for you and save it.

SourMesen commented 6 years ago

That's a bit of a complex issue. There's no guarantee Mesen's database is correct - the last thing I would want would be for Mesen to break a good rom due to a bad database entry. And then the complexity of other things like having to update roms that are stored inside zip/7z files, deciding what version of the .nes format the headers should be, etc. Basically, it's something I might eventually add as a feature to the iNES header editor tool, but probably never in any automated fashion.

Cibomatto2002 commented 6 years ago

Looks like someone already made a tool to do just that.

https://www.romhacking.net/utilities/1352/

1

SourMesen commented 6 years ago

Mesen has a built-in header editor as well, it's only accessible in the debugger window (unless developer mode is enabled) due to most people not actually needing this.