Mesen - NES Emulator

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
Sour
Posts: 890
Joined: Sun Feb 07, 2016 6:16 pm

Re: Mesen - NES Emulator

Post by Sour »

uVSthem wrote:
Sour wrote:I tried deleting the app from my google account setting. It didn't change anything.
It looks like Google Drive integration was simply broken - it tried downloading the data before ever uploading it a single time, which made it crash.
Should be fixed in 0.5.1, let me know if you still get problems with it.
uVSthem
Posts: 40
Joined: Thu Feb 26, 2015 2:37 am

Re: Mesen - NES Emulator

Post by uVSthem »

Google Drive is fixed for me 0.5.1

http://www.emucr.com/2016/09/mesen-v051.html
Sour
Posts: 890
Joined: Sun Feb 07, 2016 6:16 pm

Re: Mesen - NES Emulator

Post by Sour »

Haven't bumped this for a new release in a while but.. I just released 0.6.0.

Changes for 0.5.2, 0.5.3 and 0.6.0:
-Debugger: Several new features and improvements (thanks for all the feedback!)
-Audio: Much lower sound latency, option to reduce popping sounds on DMC channel, panning and crossfeed options
-Video: Added a few video options (disable sprites/bg, force sprites/bg in first 8pixels on the left) and more preset palettes
-Added support for 41 UNIF boards
-Added support for 10 iNES mappers (about ~216 mappers supported)
-A few bug fixes and other small changes/additions
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: Mesen - NES Emulator

Post by Zepper »

(...)force sprites/bg in first 8pixels on the left(...)
Wait, what do you mean? AFAIK, the emulator can ignore the $2001:$06 setting. A few games look OK when there's no scrolling (Mega Man VI), but others have a messed up column. You meant such column is... fixable!?
Sour
Posts: 890
Joined: Sun Feb 07, 2016 6:16 pm

Re: Mesen - NES Emulator

Post by Sour »

Zepper wrote:
(...)force sprites/bg in first 8pixels on the left(...)
Wait, what do you mean? AFAIK, the emulator can ignore the $2001:$06 setting. A few games look OK when there's no scrolling (Mega Man VI), but others have a messed up column. You meant such column is... fixable!?
All it does is what you first guessed: it ignores bits 1 & 2 of $2001 and forces the display of the BG & sprite layers.
So it does look bad in most cases, but it was something that a user requested, if I remember correctly, so I added the option.
User avatar
Eugene.S
Posts: 317
Joined: Sat Apr 18, 2009 4:36 am
Location: UTC+3
Contact:

Re: Mesen - NES Emulator

Post by Eugene.S »

Thank you for channel panning, this is great feature.
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: Mesen - NES Emulator

Post by koitsu »

I'll file an issue for this in GitHub, but: what layer/framework are you using for things like joypad input? I can't seem to find any kind of definitive information on this. All I can tell you is that no input from my Playstation/Playstation 2-to-USB adapter (and I have several, but the one I use has the best overall support/reliability) is detected when trying to define buttons/inputs. Said adapter works fine with DirectInput (read: Nestopia, Steam games, etc. -- barring games which exclusively use XInput (shame on them)), hence my question.
Sour
Posts: 890
Joined: Sun Feb 07, 2016 6:16 pm

Re: Mesen - NES Emulator

Post by Sour »

koitsu wrote:I'll file an issue for this in GitHub, but: what layer/framework are you using for things like joypad input? I can't seem to find any kind of definitive information on this. All I can tell you is that no input from my Playstation/Playstation 2-to-USB adapter (and I have several, but the one I use has the best overall support/reliability) is detected when trying to define buttons/inputs. Said adapter works fine with DirectInput (read: Nestopia, Steam games, etc. -- barring games which exclusively use XInput (shame on them)), hence my question.
That's odd - Mesen uses both XInput & DirectInput. It uses XInput for devices that support it (because it is easier to use and more reliable from a code perspective), and falls back to DirectInput when the device doesn't support XInput.
At the very least, it works for XBox 360/One (XInput) and PS4 controllers (DirectInput). But unfortunately that's all I have to test with, I'm pretty sure my old Gravis Gamepad has been thrown in the trash long long ago :)
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: Mesen - NES Emulator

Post by koitsu »

Sour wrote:That's odd - Mesen uses both XInput & DirectInput. It uses XInput for devices that support it (because it is easier to use and more reliable from a code perspective), and falls back to DirectInput when the device doesn't support XInput.
At the very least, it works for XBox 360/One (XInput) and PS4 controllers (DirectInput). But unfortunately that's all I have to test with, I'm pretty sure my old Gravis Gamepad has been thrown in the trash long long ago :)
Is there anything I can do to help? Some kind of debug build I can run that might display enumerated DirectInput devices (to verify Mesen is seeing it at all), or a lower-level DirectInput dump for device input? Or maybe buy you one of these PS/PS2-to-USB adapters (I could even include a PS2 joypad if you need one)?

Edit: I figured it out. Mesen makes the blind assumption that the system only has 1 single joypad/game input device. If you have more than one, and "the default" (or, more likely, whatever the first entry in enumeration returns) chosen is not what you actually have hooked up/are using, then yeah, no input is detected. Let me rephrase:

The PS/PS2-to-USB adapter I use has 2 PS/PS2 joypad ports on it, i.e. it can be used for up to 2 players. So, in Windows, what shows up (in Device Manager) is 2 HID-compliant game controllers (one for each port). I had my PS2 joypad hooked up to the 2nd port ("2nd device"). Mesen only cared about the 1st device. This is why Nestopia (as a comparative example) under Options -> Input gives you a pulldown of joysticks/devices you can pick from (with the above adapter, you get 2 devices named "Twin USB Joystick" (one per port)). I simply moved the joypad to the other port and instantly Mesen was able to detect the input.

I've run into this problem in other games (commercial ones on Steam), many which don't give you the ability to pick which device/thing you want as your joypad. Some using SDL end up picking the 2nd device/port (?!?!?) by default, while other titles would pick the 1st. I think the enumeration order just happens to vary based on several factors, which is why being able to get a list of devices + select the one you want is important. Not picking on Mesen at all in the least, but it's almost like these programmers are blindly assuming you only have one joypad or HID-compliant device. Bad assumption!
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Mesen - NES Emulator

Post by tepples »

koitsu wrote:it's almost like these programmers are blindly assuming you only have one joypad or HID-compliant device. Bad assumption!
And they get away with making that assumption because the producer is telling the programmers to prioritize online multiplayer over split- or otherwise shared-screen multiplayer, in an attempt to sell two to four copies of a single game to a single household.
Sour
Posts: 890
Joined: Sun Feb 07, 2016 6:16 pm

Re: Mesen - NES Emulator

Post by Sour »

koitsu wrote:Edit: I figured it out. Mesen makes the blind assumption that the system only has 1 single joypad/game input device. If you have more than one, and "the default" (or, more likely, whatever the first entry in enumeration returns) chosen is not what you actually have hooked up/are using, then yeah, no input is detected.
That's odd, this definitely works on my end, and I know the code is meant to support this.
I just retested to be 100% sure - I can connect and use a PS4 controller (directinput) + a 8bitdo snes gamepad (directinput) + a xbox 360 controller (xinput) all at once without any issues.

There must be more to this than just picking the first device. Maybe the way the devices are returned is slightly different due to both ports being on the same physical device?

Edit: Taking a look at the code I see 2 possibilities mostly:
A) both ports share the same GUID identifier (this sounds like it might be fairly likely - although it would be odd for a GUID to not be unique...). I have code that prevents Mesen from attempting to reconfigure GUIDs that it already knows about (to speed things up)
B) one of the ports isn't classified as a "DI8DEVCLASS_GAMECTRL" (which leaves KEYBOARD, POINTER, or DEVICE as the only alternatives - seems a bit unlikely)
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: Mesen - NES Emulator

Post by koitsu »

Sour wrote:That's odd, this definitely works on my end, and I know the code is meant to support this.
I just retested to be 100% sure - I can connect and use a PS4 controller (directinput) + a 8bitdo snes gamepad (directinput) + a xbox 360 controller (xinput) all at once without any issues.

There must be more to this than just picking the first device. Maybe the way the devices are returned is slightly different due to both ports being on the same physical device?
That would be my suspicion. The results of device enumeration, as I said, varies based on several factors (you've got how the USB stack detected things (this can and does vary), how whatever framework used to access said USB device defines the order, then the DirectInput layer on top of that, then "how" that makes it into the PL (e.g. the order in a linked list might be consistent, but in a hash it might not be), etc...).

As mentioned, if you'd like, I can send you one of these devices (I'll have to figure out how to ship something to Canada without paying an arm and a leg, as standard international mail would require me to go to the PO and stand in line for 30 minutes (no joke)) and you can play with it yourself. There are also 4-port versions, and 1-port versions that actually advertise 2 ports/devices on the USB bus (I have a couple of these from different vendors too. Can't make this crap up -- the IC obviously supports 2 ports but the manufacturer/vendor didn't disable the other port in firmware or otherwise). So you can see why there's a need to be able to select the actual device ("port") associated with the input... :-)

If this complicates the code and detection of such a thing (for a menu/selection pulldown) is needed, I can get you USB descriptor data for several different devices I have access to.
Sour
Posts: 890
Joined: Sun Feb 07, 2016 6:16 pm

Re: Mesen - NES Emulator

Post by Sour »

I'm pretty sure this is just a silly mistake on my part.
In the device's info, I used "guidProduct", but there is also "guidInstance". https://msdn.microsoft.com/en-us/librar ... s.85).aspx

I'm fairly confident using guidInstance will fix this.
I'll make a quick build w/ guidInstance instead and post it here in a few minutes.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Mesen - NES Emulator

Post by tepples »

I forget: Are USB "composite devices" allowed to have two devices of the same class?
Sour
Posts: 890
Joined: Sun Feb 07, 2016 6:16 pm

Re: Mesen - NES Emulator

Post by Sour »

test build link
Let me know if that fixes it.
tepples wrote:I forget: Are USB "composite devices" allowed to have two devices of the same class?
Not much of an expert on the hardware side of things, so I don't really know.
Post Reply