Mesen - NES Emulator

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

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

Re: Mesen - NES Emulator

Post by Sour » Fri Feb 12, 2016 5:36 pm

zeroone wrote:Could you provide a zip download link? Antivirus software does not like downloading .exe files.
I figured this would end up happening!
I added a link to a zipped version in my first post. The website now links to the .zip version as well.

As for Battletoads, the freezes look like they are caused by the code enabling rendering on scanline 14, cycle 255, right after resetting the scrolling values. This triggers the vertical scrolling increment at cycle 256 one scanline too early, sprite 0 hit doesn't trigger because the background is drawn one pixel too high, and the game locks up. During normal gameplay on level 2, the writes to $2001 never seem to occur before cycle ~261.

Haven't been able to find an actual solution yet - everything that appears to fix Battletoads (or at least, the specific freeze I managed to record in a save state) makes one or more test roms fail.

Thanks to everyone who tried it out, very much appreciated!

User avatar
zeroone
Posts: 929
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: Mesen - NES Emulator

Post by zeroone » Fri Feb 12, 2016 6:26 pm

Sour wrote:I added a link to a zipped version in my first post. The website now links to the .zip version as well.
Thanks.

I got it running and I loaded SMB3. It seems to run at normal speed for a few seconds and then something goes wrong with the timing. The image is refreshed every few seconds, almost like it's keeping up in the background yet failing to show all the frames.

Here are the specs of my test box:

Windows 7 Professional
Service Pack 1
Dell
5.1 Windows Experience Index
Intel Core i5-2400 CPU @ 3.10GHz
8 GB RAM
64-bit OS

I never saw a problem like this with any other emulator thus far. It made me install VS2015 64-bit runtime before starting up. Maybe I need to bounce or something?

Edit: I tried a few more games. I can tell from the music and sound effects that the emulator is running, but it's definitely failing to render to the screen. It's not a mapper specific issue; all games seem to have this issue on my box.

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

Re: Mesen - NES Emulator

Post by Sour » Fri Feb 12, 2016 6:59 pm

zeroone wrote:I got it running and I loaded SMB3. It seems to run at normal speed for a few seconds and then something goes wrong with the timing. The image is refreshed every few seconds, almost like it's keeping up in the background yet failing to show all the frames.
Can you try displaying the FPS counter (F10) to see what it says? The first number is the number of frames emulated/sec, the second is the number of frames/sec actually sent to the video card.

e.g:
Normally this would be 60/60.
If you set the emu to "Max speed" (F9) , it might go up to, say, 300/60.
If you disable vertical sync, both numbers should be relatively similar. i.e 300/300.

Disabling vertical sync might change something. (it's in the video options)

Also, could you try running this utility?
https://technet.microsoft.com/en-us/sys ... 97568.aspx

The "Current timer internal" shown by ClockRes is set to 1ms on my computer - might be different on yours, which could be part of the problem, not quite sure.

User avatar
zeroone
Posts: 929
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: Mesen - NES Emulator

Post by zeroone » Fri Feb 12, 2016 9:39 pm

Sour wrote:Disabling vertical sync might change something. (it's in the video options)
That did the job. With vertical sync disabled, it plays fine.

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

Re: Mesen - NES Emulator

Post by Sour » Sun Feb 14, 2016 4:28 pm

I've updated the download to version 0.1.1, and pushed an update for it, too.

Technically, people who have 0.1.0 should get an update prompt when running 0.1.0 (if you didn't disable automatic updates in the options)
If any of the people who tried 0.1.0 still have it and could let me know if the upgrade process works correctly, that'd be great.

Changes in 0.1.1:
-Support for Arkanoid paddle/controller
-Debugger can now display/step through code that's being executed in cpu/cartridge ram
-Fixed (hopefully) the standard controller input bug mentioned by Dwedit.
-Fixed the Battletoads freeze issue (or at the very least, I can't seem to reproduce it anymore in level 2)
-Fixed Netplay (didn't work at all in 0.1.0 because of a silly mistake, whoops)

Thanks to everyone for the bug reports and trying the emulator out!

User avatar
zeroone
Posts: 929
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: Mesen - NES Emulator

Post by zeroone » Sun Feb 14, 2016 9:34 pm

Sour wrote:-Fixed the Battletoads freeze issue (or at the very least, I can't seem to reproduce it anymore in level 2)
Can you share you findings on this? Several others are experiencing the same issue.

User avatar
zeroone
Posts: 929
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: Mesen - NES Emulator

Post by zeroone » Sun Feb 14, 2016 9:39 pm

When I started up Mesen, it prompted me to upgrade, which resulted in this:

Image

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

Re: Mesen - NES Emulator

Post by tepples » Mon Feb 15, 2016 9:05 am

zeroone wrote:
tokumaru wrote:Can't you temporarily disable your Antivirus?
I can't :(
For the record, which AV is it, and what exact error does it give when it blocks a download? In fact, how do you download any other app? Or does AV complain only about those .exe files that aren't produced by an organization with a valid software publisher certificate issued by a Microsoft-certified Authenticode CA? Are you not a member of the Administrators group on the PC you use? Or is it behind a web proxy that intercepts all HTTP connections and scans all files?

I ask because other people who distribute test builds of emulators will likely have to put up with the same limits for other testers who use your AV product.

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

Re: Mesen - NES Emulator

Post by Sour » Mon Feb 15, 2016 9:18 am

The "fix" for battletoads is probably incorrect in some way or other. Basically, if rendering was disabled and is enabled on tick 255, the vertical scroll increment at cycle 256 will not be done (basically I added a 1 ppu cycle delay on the effect of the rendering flags in relation to the scrolling increments), which solved the tiny timing issue in my case, but it's unlikely the real hardware behaves this way.

As for the upgrade crash, I have a feeling this may be AV related as well. If you check your documents folder, there should be a mesen subfolder that contains MesenUpdater.exe - this file is probably blocked or missing on your computer?

User avatar
zeroone
Posts: 929
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: Mesen - NES Emulator

Post by zeroone » Mon Feb 15, 2016 9:23 am

tepples wrote:For the record, which AV is it, and what exact error does it give when it blocks a download? In fact, how do you download any other app? Or does AV complain only about those .exe files that aren't produced by an organization with a valid software publisher certificate issued by a Microsoft-certified Authenticode CA? Are you not a member of the Administrators group on the PC you use? Or is it behind a web proxy that intercepts all HTTP connections and scans all files?

I ask because other people who distribute test builds of emulators will likely have to put up with the same limits for other testers who use your AV product.
It's Symantec Endpoint Protection. It deletes the .exe shortly after download. In fact, Chrome popped up a warning saying not to download .exe files and it said that this particular .exe file was rarely downloaded (it's a newly posted file). Symantec even interfered when I tried downloading it with wget via Cygwin. I had no firewall issues. However, I do not have admin rights to this test box.

I was able to download and extract a .zip containing the .exe without an issue. The auto-update might be failing due to lack of admin rights or Symantec. Personally, I prefer .zip files anyway. I like to manually scan downloaded apps for malware (even though anyone on this forum could just create a custom executable that kills my machine). And, I prefer not to auto-update if I have something that works. Think about how annoying auto-update is in Windows.

User avatar
zeroone
Posts: 929
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: Mesen - NES Emulator

Post by zeroone » Mon Feb 15, 2016 9:28 am

Sour wrote:The "fix" for battletoads is probably incorrect in some way or other. Basically, if rendering was disabled and is enabled on tick 255, the vertical scroll increment at cycle 256 will not be done (basically I added a 1 ppu cycle delay on the effect of the rendering flags in relation to the scrolling increments), which solved the tiny timing issue in my case, but it's unlikely the real hardware behaves this way.
Others have suggested similar patches. I'm still hoping someone creates a new test ROM to fully vet this.
Sour wrote:As for the upgrade crash, I have a feeling this may be AV related as well. If you check your documents folder, there should be a mesen subfolder that contains MesenUpdater.exe - this file is probably blocked or missing on your computer?
No subfolder was created. At least for testing, please continue to provide .zip links.

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

Re: Mesen - NES Emulator

Post by tepples » Mon Feb 15, 2016 10:05 am

zeroone wrote:It's Symantec Endpoint Protection. [...] In fact, Chrome [...] said that this particular .exe file was rarely downloaded (it's a newly posted file).
Thank you for providing enough information to allow research.

My research shows that "Safe Browsing"-type things are less likely to trigger if the publisher of an application follows the following steps. Two should be free of charge; two require a periodic payment to a certificate authority.
  1. Offer the download through HTTPS. HTTPS is HTTP tunneled through TLS (Transport Layer Security), formerly called SSL (Secure Sockets Layer). TLS requires a valid TLS certificate, which is an X.509 certificate certifying that a certificate authority (CA) has verified that the owner of the private key corresponding to a particular public key controls a particular domain. Domain-validated TLS certificates are available without charge from StartSSL, WoSign, and Let's Encrypt; organizationally validated ones cost more. If you have a VPS, you can install it at no extra charge; if you have shared hosting, you'll have to have your hosting provider install the certificate (for StartSSL or WoSign) or an ACME client (for Let's Encrypt) on your behalf. I had to go through StartSSL because my web host has not yet installed an ACME client, despite two duplicate questions on its Stack Exchange knockoff to do so (1 | 2).
  2. Build a history of downloads by users of the same browser of executables hosted on the same domain. This is the most important step for Google Chrome's Safe Browsing feature.
  3. Digitally sign and timestamp each executable file with a valid Authenticode software publisher certificate. A software publisher certificate allows earned reputation to leak into other executables from the same publisher, such as new versions of a program. But unlike TLS certificates, Authenticode certificates aren't available without charge because there's no counterpart to a domain-validated certificate.
  4. Build a history of downloads by users of the same browser of executables signed with the same Authenticode certificate. This is the most important step for the SmartScreen feature of Internet Explorer. And in Windows 8 and Windows 10, even zipped executables are subject to SmartScreen. If the certificate that you bought in step C is an Extended Validation, Internet Explorer will let you skip this step.
  5. Submit the executable to Symantec for whitelisting prior to release.
Sources: Google Chrome Help Forum; Google internet explorer smartscreen; Adding software to the Symantec Whitelist

But then Symantec has a conflict of interest here, as it is also an Authenticode certificate authority.
However, I do not have admin rights to this test box.
Have you requested that your administrator add executables or web sites to the whitelist? If so, what reason was given for denial?
I was able to download and extract a .zip containing the .exe without an issue.
I guess that's a valid workaround for you, but looking forward, I can see that it might not be a valid workaround for users of SmartScreen on Windows 8 and Windows 10.
And, I prefer not to auto-update if I have something that works. Think about how annoying auto-update is in Windows.
But how do you know it works? What if the emulator has a bug that allows a ROM to escape from the emulator and run native code as the user, as ZSNES's SA-1 support is known to have? Does something "work" if it is unsafe in this manner?

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

Re: Mesen - NES Emulator

Post by Sour » Mon Feb 15, 2016 11:05 am

zeroone wrote:No subfolder was created.
There should definitely be a folder, otherwise the emulator wouldn't run at all. There's a button to open it in the emulator - in Options -> Preferences -> Open mesen folder

There should be a few subfolders and files in it, including MesenUpdater.exe

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

Re: Mesen - NES Emulator

Post by Sour » Sat Apr 30, 2016 6:57 pm

Hi folks,

I just released an updated version of Mesen (0.1.2)
The website has also been updated (now available in both French & Japanese, like Mesen itself).

If you try it out, let me know if you find any issues.

Thanks!

-----

Changelog:
New Features
UI: Mesen is now available in English, French and Japanese.
Compatibility: Added basic support for VS Unisystem games. (Mapper 99)
Compatibility: Added support for mapper 82 and 241.
Audio: Added customizable fake stereo effects.
Audio: Added option to swap Square 1 and Square 2's duty cycles.

Bug Fixes
Auto-updates: Fixed bug that caused auto-updates to fail (MesenUpdater.exe was missing)

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

Re: Mesen - NES Emulator

Post by Sour » Mon May 02, 2016 5:57 pm

Sorry for the bump!

I just updated Mesen to 0.1.3 to fix some startup crashes that were introduced in 0.1.2.

Also, Mesen is now open source: https://bitbucket.org/Souryo/mesen (Also updated the first post to mention this)
Parts of the code are not as clean as I would like, but it'll have to do for now!

Post Reply