Jump to content
LaunchBox Community Forums

Challenges with USB remapping


DavidJ
 Share

Recommended Posts

I could use some guidance please.  I'm having trouble with the "Stable Controller ID's" issue.  I've been to https://docs.mamedev.org/advanced/devicemap.html to learn how to remap device-id's to controllers.  But when I run MAME in verbose mode, my two EasyGet USB controllers and my two GameCube controllers all show the device id of "USB Joystick".  And when I go into Windows device manager, they all have the HardwareID of "HID\VID_0079&PID_0006&REV_0107".  So there doesn't seem to be any differentiation between the hardware id's that would allow me to remap them to JOYCODE_1 and JOYCODE_2.

Can you please help?  What am I missing?

Link to comment
Share on other sites

Made some progress by renaming the "device description" by going to HKEY_LOCAL_MACHINE->SYSTEM->ControlSet001->Enum for both controllers to USBJoy1 and USBJoy2... so at least a human can differentiate the two which is nice.  I tried to change the "HardwareID" in the registry but it always reverts back to a seemingly generic hardware id.

Device manager for the two looks like the attached images.  

MAME in verbose mode says (notice there's no unique "device id;"):

Input: Adding joystick #0: USB Joystick           (device id: USB Joystick           product_00060079-0000-0000-0000-504944564944 instance_bff7ddf0-3bc5-11ea-8001-444553540000)
Input: Adding joystick #1: USB Joystick           (device id: USB Joystick           product_00060079-0000-0000-0000-504944564944 instance_df7d0510-3bc5-11ea-8002-444553540000)

 

So I'm still unclear what to include in the "mapdevice" element of the new ctrlr file:

<mameconfig version=”10”>
<system name=”default”>
<input>
<mapdevice device=”VID_D209&amp;PID_1601” controller=”GUNCODE_1” />
<mapdevice device=”VID_D209&amp;PID_1602” controller=”GUNCODE_2” />
<mapdevice device=”XInput Player 1” controller=”JOYCODE_1” />
<mapdevice device=”XInput Player 2” controller=”JOYCODE_2” />

Any help please?

 

Device Manager 2.png

Device Manager.png

Link to comment
Share on other sites

If you look at the first MAME verbose output you posted, you can see that the instance variables ARE different.

You don't have to match strictly on HID and VID IDs. Try matching on the instance variable.

Something like this:

<mapdevice device=product_00060079-0000-0000-0000-504944564944 instance_df7d0510-3bc5-11ea-8002-444553540000” controller=”JOYCODE_2” />
Edited by Headrush69
Add example.
Link to comment
Share on other sites

Oops, thought it worked till I plugged in the GameCube controllers.

It appears that Windows enumeration 'feature' changes the instance variables.  When only the two joystick controllers are plugged in, line #1 and #2 below properly represent joy1 and joy2:

#1   Input: Adding joystick #0: USB Joystick           (device id: USB Joystick           product_00060079-0000-0000-0000-504944564944 instance_bff7ddf0-3bc5-11ea-8001-444553540000)
#2   Input: Adding joystick #1: USB Joystick           (device id: USB Joystick           product_00060079-0000-0000-0000-504944564944 instance_df7d0510-3bc5-11ea-8002-444553540000)

After plugging in additional GC controllers, line#1 and #4 represent joy1 and joy2.

#1  Input: Adding joystick #0: USB Joystick           (device id: USB Joystick           product_00060079-0000-0000-0000-504944564944 instance_bff7ddf0-3bc5-11ea-8001-444553540000)
#2  Input: Adding joystick #1: USB Joystick           (device id: USB Joystick           product_00060079-0000-0000-0000-504944564944 instance_df7d0510-3bc5-11ea-8002-444553540000)
#3  Input: Adding joystick #2: USB Joystick           (device id: USB Joystick           product_00060079-0000-0000-0000-504944564944 instance_4d456930-4138-11ea-8001-444553540000)
#4  Input: Adding joystick #3: USB Joystick           (device id: USB Joystick           product_00060079-0000-0000-0000-504944564944 instance_e09c7f90-413b-11ea-8002-444553540000)

Any further ideas?

Link to comment
Share on other sites

The GC controllers are connected to a USB hub, which is connected to the mobo.  Here's the entire -v

C:\Users\Public\LaunchBox\Emulators\MAME>mame64 -v
Attempting load of mame.ini
Parsing mame.ini
Attempting load of mame.ini
Parsing mame.ini
Reading translation file English: 1 strings, original table at word offset 7, translated table at word offset 9
Loaded 0 translations from file English
Starting plugin data...
Attempting load of mame.ini
Parsing mame.ini
Attempting load of mame.ini
Parsing mame.ini
Video: Monitor                                                            65537 = "\\.\DISPLAY1" (primary)
Direct3D: Using Direct3D 9
Physical width 1920, height 1080
Direct3D: Initialize
Direct3D: Configuring adapter #0 = NVIDIA GeForce GTX 1070
Direct3D: Using dynamic textures
Direct3D: YUV format = RGB
Direct3D: Max texture size = 16384x16384
Direct3D: Device created at 1920x1080
Direct3D: Initialize HLSL
RawInput: APIs detected
RawInput: APIs detected
RawInput: APIs detected
DirectSound: Primary buffer: 48000 Hz, 16 bits, 2 channels
Input: Adding keyboard #0: HID Keyboard Device (device id: \\?\HID#VID_046D&PID_C52B&MI_00#7&335f0d9f&0&0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd})
Input: Adding keyboard #1: HID Keyboard Device (device id: \\?\HID#VID_046D&PID_C52B&MI_00#8&2dd8c6cf&0&0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd})
Input: Adding mouse #0: HID-compliant mouse (device id: \\?\HID#VID_046D&PID_C52B&MI_01&Col01#7&af45fd6&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd})
Input: Adding mouse #1: HID-compliant mouse (device id: \\?\HID#VID_1241&PID_1111#9&e0e5631&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd})
Input: Adding mouse #2: HID-compliant mouse (device id: \\?\HID#VID_046D&PID_C52B&MI_01&Col01#8&56e1906&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd})
Input: Adding mouse #3: HID-compliant mouse (device id: \\?\HID#VID_046D&PID_C52B&MI_03#8&21615069&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd})
Input: Adding lightgun #0: HID-compliant mouse (device id: \\?\HID#VID_046D&PID_C52B&MI_01&Col01#7&af45fd6&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd})
Input: Adding lightgun #1: HID-compliant mouse (device id: \\?\HID#VID_1241&PID_1111#9&e0e5631&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd})
Input: Adding lightgun #2: HID-compliant mouse (device id: \\?\HID#VID_046D&PID_C52B&MI_01&Col01#8&56e1906&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd})
Input: Adding lightgun #3: HID-compliant mouse (device id: \\?\HID#VID_046D&PID_C52B&MI_03#8&21615069&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd})
Input: Adding joystick #0: USB Joystick           (device id: USB Joystick           product_00060079-0000-0000-0000-504944564944 instance_bff7ddf0-3bc5-11ea-8001-444553540000)
Input: Adding joystick #1: USB Joystick           (device id: USB Joystick           product_00060079-0000-0000-0000-504944564944 instance_df7d0510-3bc5-11ea-8002-444553540000)
Input: Adding joystick #2: USB Joystick           (device id: USB Joystick           product_00060079-0000-0000-0000-504944564944 instance_4d456930-4138-11ea-8001-444553540000)
Input: Adding joystick #3: USB Joystick           (device id: USB Joystick           product_00060079-0000-0000-0000-504944564944 instance_e09c7f90-413b-11ea-8002-444553540000)
Region ':user1' created
Optional memory region ':screen' not found
Starting No Driver Loaded ':'
  (missing dependencies; rescheduling)
Starting Video Screen ':screen'
Starting No Driver Loaded ':'
Checking for icons in directory icons
No candidate icons found for machines
Attempting to parse: remap.cfg
Input: Remapped joystick #0: USB Joystick           (device id: USB Joystick           product_00060079-0000-0000-0000-504944564944 instance_bff7ddf0-3bc5-11ea-8001-444553540000)
Input: Remapped joystick #1: USB Joystick           (device id: USB Joystick           product_00060079-0000-0000-0000-504944564944 instance_e09c7f90-413b-11ea-8002-444553540000)
Attempting to parse: default.cfg
Attempting to parse: ___empty.cfg

 

Link to comment
Share on other sites

Just to be clear, these aren't real GameCube controllers using an adapter?

They look to be PC TWIN SHOCK Gamepads which is made by Dragonrise which also makes Zero Delay controllers.

This may be an issue with their controllers/products and how they report to Windows, not Windows itself. If they all report the same product (basically USBJoy) to Windows, this may be a problem.Doing some searching for you, see if I can find more out. 

 

Edited by Headrush69
Link to comment
Share on other sites

You saw all that from the -v!  Nicely done.  You're right in that they are not real GameCube controllers.  On Amazon they're called "Mekela Classic Wired USB PC Controller Joystick Gamepad resembles Gamecube Game Cube for PC Windows MAC".  

 

Link to comment
Share on other sites

Unfortunetaly it's seems a problem with these cheaper Chinese encoders and although they work OK on their own, when you get into situations with multiple devices you sort of get what you pay for. Having said that, I see people using Linux using udev rules to help with naming these, but that only helps them if the USB port is constant.

We are limited in MAME by the input information it gives us, so not sure there is anything on that level that will or can help us.

I don't know if this will work, but a thought was carefully using a hex editor on the Windows device driver file and change the name slightly for each and in device manager force it to use the modified driver. (The driver itself is the same, just the name we would change)

I really don't know what protections Windows enforces on drivers and if it will work, but might be worth a try. 

Link to comment
Share on other sites

You've gone above and beyond in your research... so thank you. 

Not sure I'm ready for the hex editor (haven't done that since the MS-DOS days!).  I'll try to sequence the devices in the USB hub and/or mobo to see if I can get some predictability out of the 'instance' assignment.

Link to comment
Share on other sites

Have you checked the static IDs rebooting after having all 4 devices connected?

I asked because according to this Microsoft Doc, that device instance variable is suppose to be persistent across reboots as well.

You might be able to maintain static device mapping IF they all remain plugged in at least. (Even across reboots)

Pricier option, but you could always upgrade to a better USB encoder as well. I can vouch for the iPac line.

Edited by Headrush69
More info
Link to comment
Share on other sites

Yes, it does appear to be consistent after reboots and only changes when the GC controllers are disconnected.  My arcade cabinet design has USB ports on the sides of the cabinet to plug misc USB controllers in as desired (to switch between GC, Xbox, etc).  But I'll have to rethink that to avoid this issue as much as possible.

Thanks again Headrush.  You've been a tremendous help!

Link to comment
Share on other sites

  • 1 month later...

I had the same issue where all of my controllers (4) showed as USB Joystick.  I spent a lot of time trying to prevent Windows from changing the instance ID's but was fruitless.  I switched to using SharpDX (Directinput) so I could poll for the devices and then create a custom ctrlr file that Mame could use. 

I built a quick console app that allows for a remap and the plan is to add this as an option (Platform System, for example) within BigBox that I can launch to reconfig (If needed) without needing to break out the keyboard.

Still a work in progress but so far the testing works.  I can disconnect/reconnect in random order (Along with the powered USB hub) and then create a config file that maps correctly.

image.thumb.png.853f062c8ab921300116cb5ff86cd15c.png

This is the output and I use this .cfg file when loading Mame (Above screenshot is pointing at different controllers, just as an FYI)

<mameconfig version='10'>
     <system name='default'>
            <input>
                 <mapdevice device='fcfc7af0-c120-11e9-8003-444553540000' controller='JOYCODE_1' />
                 <mapdevice device='f223fdb0-c120-11e9-8001-444553540000' controller='JOYCODE_2' />
                 <mapdevice device='fadea400-c120-11e9-8002-444553540000' controller='JOYCODE_3' />
                 <mapdevice device='ff1fd020-c120-11e9-8004-444553540000' controller='JOYCODE_4' />
             </input>
     </system>
</mameconfig>

  • Like 1
Link to comment
Share on other sites

  • 7 months later...

Just ran into this same problem on my build.  Got one of those 4 arcade control bundles from Amazon that came with 4 EG Start USB Controllers.  Price was right, but now experiencing the same issue. Running MAME in verbose modes shows the controllers as identical HID and VIDs with different instance IDs.  And like you discovered, the instance IDs don't tie specifically to any one controller but appear to be assigned and reassigned as controllers are plugged in.  Oh well, may need to pony up for a set of decent usb controllers now. :P 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...