Mesen-S - SNES Emulator

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Ice Man
Posts: 546
Joined: Fri Jul 04, 2014 2:34 pm

Re: Mesen-S - SNES Emulator

Post by Ice Man » Tue Feb 18, 2020 2:17 am

I'm afraid but SPC-7110 emulation still is not working properly, at least for Tengai Makyou Zero (not the translation, since that doesn't even boot yet).
The RTC fails to verify upon first time check. :( Or was RTC not even implemented yet?

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

Re: Mesen-S - SNES Emulator

Post by Sour » Tue Feb 18, 2020 7:39 am

Ice Man wrote:
Tue Feb 18, 2020 2:17 am
The RTC fails to verify upon first time check. :( Or was RTC not even implemented yet?
The RTC implementation is fairly incomplete and rough around the edges, but it (mostly) works. I think it can sometimes fail due to way it's implemented right now, but I just tried 4 times and it worked each time. Did you only try a single time? Or if you tried using the translation patch first and it had the same filename, you might have a buggy .srm and/or .rtc file in your saves folder that's causing an issue somehow?

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

Re: Mesen-S - SNES Emulator

Post by Ice Man » Tue Feb 18, 2020 8:18 am

Guess my old .srm/.rtc were the issue. Deleted them and now it works for the japanese version of the game. Thanks!
The translation still doesn't boot (though creates .srm and .rtc files) but then again it was expanded and most likely isn't supported yet because of its mapping.

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

Re: Mesen-S - SNES Emulator

Post by lidnariq » Tue Feb 18, 2020 11:12 am

The translation involves its own bespoke memory map, adding an extra 1MB ROM in banks $40-$4F, which are normally open bus. It does work on hardware, but requires extra parts. See this thread

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

Re: Mesen-S - SNES Emulator

Post by Ice Man » Sun Mar 01, 2020 2:28 am

Ah, I see. That explains it.

Also, when testing various official games I noticed that Chou Aniki - Bakuretsu Rantou Hen (Japan) isn't working.
Is there anything weird going on with that one?

Pokun
Posts: 1512
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Mesen-S - SNES Emulator

Post by Pokun » Sun Mar 01, 2020 3:56 am

Ice Man wrote:
Sun Mar 01, 2020 2:28 am
I noticed that Chou Aniki - Bakuretsu Rantou Hen (Japan) isn't working.
Is there anything weird going on with that one?
Is that a trick question?

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

Re: Mesen-S - SNES Emulator

Post by Ice Man » Sun Mar 01, 2020 5:11 am

Why should it be? The game isn't booting in Mesen-S and it's a simple LoROM game.

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

Re: Mesen-S - SNES Emulator

Post by Sour » Sun Mar 01, 2020 9:31 am

Ice Man wrote:
Sun Mar 01, 2020 2:28 am
Is there anything weird going on with that one?
It looks like the answer to that is "yes". :p I wasn't aware it froze at all (looks like it worked in 0.1.0, but not in any version after this).

The game enables NMI in the middle of vertical blank (with a 16-bit write to 4200+4201), and it expects the instruction that follows the write to run before the NMI handler is called. Mesen-S' current logic caused the NMI handler to run first, which caused the game to freeze. Should be fixed now - thanks!

Also, I added support for the Tengai Makyou translation yesterday, too.

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

Re: Mesen-S - SNES Emulator

Post by Ice Man » Sun Mar 01, 2020 10:06 am

Ah, I see. Thanks for the update. :D

EDIT: Backup RTC seems to be broken for Tengai (both, the original and translation). Deleted RTC and save data before.

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

Re: Mesen-S - SNES Emulator

Post by Sour » Sun Mar 01, 2020 4:46 pm

Ice Man wrote:
Sun Mar 01, 2020 10:06 am
EDIT: Backup RTC seems to be broken for Tengai (both, the original and translation). Deleted RTC and save data before.
Both seem to be working fine on my end. Are you fast forwarding through the initial setup? If so, you'll cause it to fail, because the game expects X seconds to pass between 2 parts of the code, and if you're fast forwarding, less time will pass (since time doesn't get fast forwarded when fast forwarding)
Ice Man wrote:
Mon Feb 17, 2020 2:08 am
Also, the hacks I've tested are mainly SMW hacks:
https://www.smwcentral.net/?p=section&a ... s&id=14812
https://www.smwcentral.net/?p=section&a ... s&id=11254
I took another look at these, and both fail to load in bsnes v114, too. They load in bsnes-plus because it doesn't restrict which CPU can write to which registers. I'm not completely certain which is correct, but as far as I know bsnes should be.

The Gradius/Contra 3 romhacks were broken because of the way I had implemented the SA-1's irq/etc vectors. Both should work now.
Oziphantom wrote:
Sat Feb 08, 2020 7:23 am
AHA, the code log persists. Is there an command line option to reset it.
I see that you want it to persists when hacking/reversing, but for dev not so much.
There's a new option in the debugger (in the file menu) to auto-reset the CDL log whenever the rom is altered.

.sym files are also tentatively supported - but in my testing, the labels generated by wla-dx seem to work differently between the 2 open source projects I tried compiling, so I'm not quite sure which way is the correct way. It also seems to have a lot of trouble properly exporting the code<->rom line mappings, too, which prevented me from implementing source view like what is available in CA65.

I also added a custom format (.msl files) which is similar to Mesen's .mlb label files that you can use to export/import labels in the debugger.

Near
Founder of higan project
Posts: 1550
Joined: Mon Mar 27, 2006 5:23 pm

Re: Mesen-S - SNES Emulator

Post by Near » Sun Mar 01, 2020 5:03 pm

Sour wrote:The game enables NMI in the middle of vertical blank (with a 16-bit write to 4200+4201), and it expects the instruction that follows the write to run before the NMI handler is called.
Isn't it just beyond incredible that there are seemingly hundreds of titles in a library of only ~2,000 unique non-regional-variant games that do crazy things like this and break if even the tiniest little detail is wrong? I get how things like this can slip through testing, but not the frequency with which it happens. It's madness.
Sour wrote:I took another look at these, and both fail to load in bsnes v114, too. They load in bsnes-plus because it doesn't restrict which CPU can write to which registers. I'm not completely certain which is correct, but as far as I know bsnes should be.
The newer bsnes builds are correct. Registers weren't locked to individual 65816 cores previously, but are correctly locked out now.

I guess it is only karmic justice that bsnes should have to become a bsnes emulator as well.

Oziphantom
Posts: 913
Joined: Tue Feb 07, 2017 2:03 am

Re: Mesen-S - SNES Emulator

Post by Oziphantom » Mon Mar 02, 2020 1:11 am

Oziphantom wrote:
Sat Feb 08, 2020 7:23 am
AHA, the code log persists. Is there an command line option to reset it.
I see that you want it to persists when hacking/reversing, but for dev not so much.
There's a new option in the debugger (in the file menu) to auto-reset the CDL log whenever the rom is altered.

.sym files are also tentatively supported - but in my testing, the labels generated by wla-dx seem to work differently between the 2 open source projects I tried compiling, so I'm not quite sure which way is the correct way. It also seems to have a lot of trouble properly exporting the code<->rom line mappings, too, which prevented me from implementing source view like what is available in CA65.

Is there binary release with this feature? also is there documentation on the like format? I've found docs for the NES emulator but not the SNES one?

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

Re: Mesen-S - SNES Emulator

Post by Ice Man » Mon Mar 02, 2020 2:17 am

Sour wrote:
Sun Mar 01, 2020 4:46 pm
Are you fast forwarding through the initial setup? If so, you'll cause it to fail, because the game expects X seconds to pass between 2 parts of the code, and if you're fast forwarding, less time will pass (since time doesn't get fast forwarded when fast forwarding)
Oh, that explains it. My fault on that one. However, it still does not work when one just "Resets" the system. It only seems to work when I "Power Cycle". All good now. :)

Thanks!

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

Re: Mesen-S - SNES Emulator

Post by Sour » Mon Mar 02, 2020 6:14 am

byuu wrote:
Sun Mar 01, 2020 5:03 pm
Isn't it just beyond incredible that there are seemingly hundreds of titles in a library of only ~2,000 unique non-regional-variant games that do crazy things like this and break if even the tiniest little detail is wrong? I get how things like this can slip through testing, but not the frequency with which it happens. It's madness.
Yea, it does somehow seem like a pretty high proportion of games somehow end up relying on really obscure behavior. The NES didn't seem like it had quite as many cases, but that's probably just to the system itself having far less features, which means far fewer ways to rely on a hardware quirk. :p
Oziphantom wrote:
Mon Mar 02, 2020 1:11 am
Is there binary release with this feature? also is there documentation on the like format? I've found docs for the NES emulator but not the SNES one?
Binaries for the latest commit are always available from appveyor (linked in the readme): https://ci.appveyor.com/project/Sour/me ... /artifacts

There is no documentation at all for Mesen-S. Took me several days/weeks of work to write Mesen's docs originally (and it didn't have documentation at all for like 2 years), so I'm not exactly in a hurry to get that done... There's a lot of overlap between both of them, so a lot of the Mesen documentation applies to Mesen-S, too, though.

The label format is pretty simple, it's just a prefix for the memory type (https://github.com/SourMesen/Mesen-S/bl ... bel.cs#L23) followed by the address, label and comment (optional). So e.g: "PRG:4000:MyLabel:This is a comment" would define a label for byte $4000 in the .sfc file.
Ice Man wrote:
Mon Mar 02, 2020 2:17 am
However, it still does not work when one just "Resets" the system.
The Japanese version of the game does explicitly say to power cycle, but the translation ends up saying to "reset". I'm guessing it's meant to fail if you just reset, but unsure?

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

Re: Mesen-S - SNES Emulator

Post by Ice Man » Mon Mar 02, 2020 8:06 am

Oh, good to know. Thank you! Might be worth telling the translator to fix it. :P

Post Reply