Mesen - NES Emulator

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

NewRisingSun
Posts: 1178
Joined: Thu May 19, 2005 11:30 am

Re: Mesen - NES Emulator

Post by NewRisingSun » Sat Apr 11, 2020 4:11 am

That translation hack is too broken to deserve being emulated in its current form. In addition to the oversize PRG-ROM, it also writes to $6008 to bankswitch PRG-ROM. The LZ93D50 ASIC that the original circuit board used however only responds in the $8000-$FFFF address range; the $6000-$7FFF address range is only used by the predecessor ASIC; the FCG-1/2. All occurrences of "STA $6008" should be replaced with "STA $8008". Please, do not emulate this translation until at least that address issue is resolved.

Pennywise
Posts: 67
Joined: Tue Jul 14, 2009 11:04 am

Re: Mesen - NES Emulator

Post by Pennywise » Sat Apr 11, 2020 8:50 am

So broken it took 30 seconds to fix...

Although I know some of you guys get up in arms when a ROM is expanded past mapper limitations. It happens that this project was inherited from someone else years ago along with the ROM expansion. Anyhow it's been so long, it's not worth the effort of scraping everything and redoing the project from scratch with no guarantee of there being enough room for the translated script and assembly hacks.

NewRisingSun
Posts: 1178
Joined: Thu May 19, 2005 11:30 am

Re: Mesen - NES Emulator

Post by NewRisingSun » Sat Apr 11, 2020 8:58 am

If the .BPS file is replaced with one that no longer has the game write to $6008, then at least I will be happy. ;)

Another comment is that I had some difficulty finding the correct ROM file to apply the patch on, because BPS unfortunately includes the hash of the entire file including the NES header. This resulted in the file, named as specified in the README which sounded like a No-Intro name, to not be accepted by the BPS patching utility I was using (Flips). I had to go back to GoodNES 3.23b, where the correct file was named "SD Gundam Gaiden - Knight Gundam Monogatari (J) (V1.0) [!].nes".

I am not as adamant about "disciplining translation authors" against using oversize PRG-ROM as some others here. Maybe if you feel like it someday, you could consider porting the whole game over to MMC5, which will have all the mapper features that you need.

Pennywise
Posts: 67
Joined: Tue Jul 14, 2009 11:04 am

Re: Mesen - NES Emulator

Post by Pennywise » Sat Apr 11, 2020 9:03 am

I also include xdelta patches with my translations and I don't think that has the same issue as BPS, but I shall look at my ROM again.

Ice Man
Posts: 526
Joined: Fri Jul 04, 2014 2:34 pm

Re: Mesen - NES Emulator

Post by Ice Man » Sun Apr 12, 2020 3:12 am

I haven't had issues applying the .bps at all.
The ROM found in the No-Intro set works fine.

NewRisingSun
Posts: 1178
Joined: Thu May 19, 2005 11:30 am

Re: Mesen - NES Emulator

Post by NewRisingSun » Sun Apr 12, 2020 5:34 am

There are several No-Intro sets, unfortunately. One (completely useless one) without headers at all, one with normal but not always correct iNES headers, and one with fake NES 2.0 headers that only contain nonsense information in the extended NES 2.0 header fields, such as setting PRG-RAM to 64 KiB on all cartridges. The latter set seems to be becoming more common on archive.org.

Ice Man
Posts: 526
Joined: Fri Jul 04, 2014 2:34 pm

Re: Mesen - NES Emulator

Post by Ice Man » Wed Apr 22, 2020 2:18 am

Apparantly the ROM needed is the one with corrupt iNES2.0 header from latest No-Intro set.

I'd still suggest to allow adding custom entries to the MesenDB file.

Examples:
Metal Force MMC3 Hack needs single screen mirroring which is not an option in Mesen (nor the iNES header) at all.
Dragon Ninja (Rev 1) (and problaby other mapper 19 games) have wrong mirroring. Oddly enough Dragon Ninja itself is fine.
Kaijuu Monogatari's English translation (mapper 19 as well) glitches or even crashes, maybe because PRG was expanded to 256KB?

And last not least, Haradius Zero (or mapper 406 in general) should be added/supported.
The iNES mapper assigned to it was 406 because it is basically MMC3 but the register writes/reads are different iirc.

Cheers!

Sour
Posts: 799
Joined: Sun Feb 07, 2016 6:16 pm

Re: Mesen - NES Emulator

Post by Sour » Wed Apr 22, 2020 1:27 pm

Ice Man wrote:
Wed Apr 22, 2020 2:18 am
I'd still suggest to allow adding custom entries to the MesenDB file.
I'm pretty sure I've told you this already, but there is nothing that adding an entry in the database would let you do that a NES 2.0 header wouldn't also be able to do, so allowing people to add entries to the database is counter-productive.

MMC3 doesn't support single screen mirroring: https://wiki.nesdev.com/w/index.php/MMC ... 2C_even.29
So I'm not sure how a hack is meant to use single screen mirroring with MMC3. For virtually all mappers that can switch mirroring, the mirroring type in the header has no meaning (and is not used), unless the cartridge has extra RAM for 4-screen mirroring.

Re: Mapper 19, you've already mentioned this 2-3 times already, and I've already told you I need to do some cleanup/fixes in mapper 19's emulation - mentioning it repeatedly is not going to make me fix it any faster :P

As for adding support for more mappers, there are dozens of mappers that are missing at this point - adding support for more mappers is not really a priority at the moment.

tepples
Posts: 21947
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Mesen - NES Emulator

Post by tepples » Wed Apr 22, 2020 9:17 pm

If you want to use single-screen mirroring with MMC3, use TLSROM (mapper 118) and set bit 7 of the bank number for all $0000 windows to the desired half of nametable memory.

Ice Man
Posts: 526
Joined: Fri Jul 04, 2014 2:34 pm

Re: Mesen - NES Emulator

Post by Ice Man » Thu Apr 23, 2020 1:04 am

While Mesen does play the game with mapper 118 TLSROM, the majority of other emulators does not.
TLSROM is not really single screen miroring as it relies on CHR A17 and the Metal Force 3 Hack for example relies on CIRAM A10 to be on low (GND).
This is easily done on real hardware and FCEUX can change nametable attributes easily and when set to single screen (with mapper 4) works fine, too!

Sadness for the custom entries as it would allow adding missing games (if needed) as well as experimental use for hackers maybe.

Thanks for everything so far!

NewRisingSun
Posts: 1178
Joined: Thu May 19, 2005 11:30 am

Re: Mesen - NES Emulator

Post by NewRisingSun » Thu Apr 23, 2020 1:22 am

You have not fully grasped the point of his objection: a database cannot contain anything that a NES 2.0 header cannot. No NES 2.0 header can specify an MMC3 board that uses single-screen mirroring in the way that this so-called "MMC3 hack of Metal Force" would require. You are asking for the database to specify game-specific hacks that supersede every other setting in the database. And all this for a badly-done modification of a game that is well-emulated in its original version, a modification that (I assume) was done for the purpose of increasing compatibility for emulators and flashcarts that do not emulate Metal Force's original mapper. No, I agree that no such hoops should be jumped through to accomodate the errors of a broken MMC3 hack.

Whoever made that MMC3 hack should have picked a mapper that actually has support for single-screen mirroring. I myself have created VRC6 conversions for this game at the request of a PowerPak user, which work without problems.

Ice Man
Posts: 526
Joined: Fri Jul 04, 2014 2:34 pm

Re: Mesen - NES Emulator

Post by Ice Man » Thu Apr 23, 2020 1:53 am

Oh, my bad for misunderstanding it then. Sorry.

User avatar
za909
Posts: 207
Joined: Fri Jan 24, 2014 9:05 am
Location: Hungary

Re: Mesen - NES Emulator

Post by za909 » Sun May 03, 2020 4:24 pm

Hello, I am hopefully running into an issue that IS an issue I can "report" and is not just my ignorance, but if it is I would like to apologize in advance. However, this issue has never been present on other emulators, or the PowerPak, so I'm fairly confident that I haven't suddenly messed up my code.

For my game I'm using BNROM (mapper 34) with only a 1-bit register to allow 64kB of PRG-ROM. CHR-ROM is used instead of RAM, and it is not bankswitched. It seems like Mesen ignores the mapper writes, which makes the CPU go off-course only a few instructions into the initialization. This reset code has always existed in both banks throughout development, so the initial mapper state does not matter. The bulk of the "real" reset code only exists in one bank though, so it is swapped in immediately after taking care of interrupts and the reset bulk is called as a subroutine. The "failed" bankswitch causes this JSR to point to the middle of a multi-byte instruction related to moving game objects, making it an illegal opcode, which Mesen treats as a "CPU crash".

To account for bus-conflicts, both banks have a two-entry dummy table right before the interrupt vectors, so I use these addresses for writing to the mapper ($FFF8 = $00, $FFF9 = $01). Could Mesen be looking for these writes somewhere else (the event viewer does not show the write either)? I don't know where Paperboy 2 or any other commercial games took care of this, but it might be the case the Mesen is only looking for mapper writes at specific locations? Due to mirroring this should not matter, any address equal to or higher than $8000 should suffice.
Annotation 2020-05-04 012048.png
Annotation 2020-05-04 012048.png (13.35 KiB) Viewed 949 times
PS: I see that there is a wrong STA instead of an STX to write to $2000, but that should not be related to the highlighted bankswitch issue (no NMI fires, and the bankswitch still fails).

Any ideas on how to proceed? I would love to switch to this emulator for development due to its many advantages over fceux, but this issue is preventing me from doing that. Thank you!

Sour
Posts: 799
Joined: Sun Feb 07, 2016 6:16 pm

Re: Mesen - NES Emulator

Post by Sour » Sun May 03, 2020 4:39 pm

za909 wrote:
Sun May 03, 2020 4:24 pm
CHR-ROM is used instead of RAM
This is most likely the cause - Mesen defaults to using the NINA-001 mapper (which is also mapper 34) when there is CHR ROM in the cart (because all commercial BNROM games use CHR RAM.)

You can force mapper 34 to use BNROM by using a NES 2.0 header and specifying a submapper:
http://wiki.nesdev.com/w/index.php/NES_ ... F_NINA-001

lidnariq
Posts: 9305
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Mesen - NES Emulator

Post by lidnariq » Sun May 03, 2020 4:50 pm

Alternatively, BNROM with 8KB of CHR ROM is the same as Color Dreams, and equivalent to GNROM.

Post Reply