Help! 2nd DS4 input problem

[QUOTE=Acaos;40902]I’m actually very interested in how you did this, since I’m pretty much trying to do the same thing as you have done. If you have time, would you be willing to go into it?

Thanks![/QUOTE] Sure. In a way I’m happy that someone else is interested, because it took me a long time to figure this out and I’d like to share it.

So this method is not perfect, and what I really wish there was a way to do was explicitly set the order of DirectInput controllers in Windows. As far as I’m aware, there’s no way to do that. I only really have experience tinkering with this in Windows 8, so I don’t know if there’s a better method in Windows 7, or if this still works in Windows 10.

But as I said, the idea is to have there be four virtual DirectInput controllers (in my case vJoy controllers) that are consistently the first four controllers enumerated by DirectInput, as this seems to be the method all DirectInput games including RetroArch use to determine the order of the controllers. You can see what the order is by pressing Win+R and typing in joy.cpl to open the Game Controllers control panel. By and large this order seems to be arbitrary, but what I discovered is that disconnecting the controllers and reconnecting them sends them to the end of the list. So if your controller is a wired USB controller, just unplugging it and plugging it back in should place it after the vJoy devices.

For wireless controllers it gets more complicated. The trick seems to be that if you unplug and replug the USB device that acts as the receiver for a wireless controller, that will also send it to the back of the list. For a wireless Xbox 360 controller, you can unplug and replug the Microsoft wireless receiver. For a bluetooth controller like a DualShock 4, my method is to unplug and replug my USB bluetooth receiver.

Now physically unplugging and replugging all of these devices is a huge pain in the ass. Every time your computer boots up you have to do it because rebooting resets the DirectInput controller order. My gaming PC is a home theater PC where my goal is to make it so that everything “just works” 100% of the time, so I needed some way to automate this crap. The last thing I want is for me and some friends to sit down and play games in an emulator only to realize that the controller order is messed up or some other stupid thing is going wrong. It’s really frustrating and sucks all the fun out of the situation.

It turns out you can simulate unplugging and replugging USB devices using the Windows devcon command. I have a batch script that runs everytime my computer boots up that executes the following:

:: Remove my Xbox 360 Wireless Receiver devcon remove “VID_045E&PID_0291

:: Stupid trick to wait one second in a batch file ping 192.0.2.2 -n 1 -w 1000 > nul

:: Remove my Bluetooth dongle devcon remove “VID_0A12&PID_0001

:: Wait another second ping 192.0.2.2 -n 1 -w 1000 > nul

:: Rescan for connected USB devices, causing all of these devices to be found and reinstalled devcon rescan

Anyone could adapt this script to work for their own USB devices. Just replace the strings that look like “VID_####&PID_####” with the vendor ID and product ID of your USB device, and save it to a .bat file. Each #### needs to be replaced with a four character hexadecimal number. If the number is less than four characters, add some zeroes to the beginning like I did. You can find the vendor ID / product ID by using the Device Manager, finding the USB device (which can be easier said than done), and then getting its properties, switching to the Details tab, and selecting the “Hardware IDs” property. That should list the vendor and product ID in the right format.

This will cause the devices to be reinstalled. You should see some windows appear indicating the driver is being reinstalled for your device(s) (this is fine) and showing progress. Once those windows are gone, it is now safe to turn on your wireless controllers.

The next annoying detail is that this script needs to be run with administrator privileges. If you don’t care about everything being automatic to the same extent I do, then you can just right-click the bat file and run it as an administrator. But if you want it to be automatic, you have to set it up so that it runs at startup as an admin. This is possible using a scheduled task as documented here: http://www.digitalcitizen.life/use-task-scheduler-launch-programs-without-uac-prompts

I did all that and also made the schedule task run at startup.

There are some limitations to this method:

All of your wireless controllers need to be disconnected in order for it to work, and preferably no applications are games that access the controllers (including Steam) are running. If there are any connected, when ‘devcon remove’ runs, it will say that Windows needs to reboot for everything to finish, and that ruins everything. If you have this script run at startup, though, then there should be no problem. (Just don’t turn on your wireless controllers until after their drives are done reinstalling!)

If you’re using an internal bluetooth card (like one built into your motherboard) instead of a USB dongle, I don’t know how to simulate it unplugging and replugging. There may be no good way to get your bluetooth controller to the end of the DirectInput controller list. I don’t know how to solve that since all of my wireless devices connect through a USB device of some sort.

Okay, so that’s the gist of it. Hopefully this is of use to you and anyone else.

This is great information, thank you again!

I am using Windows 7, but I feel confident I will be able to use your procedure to solve my remaining issues. Unfortunately, I’m also using a motherboard-based Bluetooth device, so that will take some additional hacking on my part. I’ll post when I’ve managed to get everything working along with any modifications I had to make for Windows 7.

I should mention that, in researching how to change controller order, I found some people talking about there being a method of doing it in Windows 7 that no longer works in Windows 8. Unfortunately I’m just remembering stuff off the top of my head, so I don’t have any concrete info or links I can provide you. But if you google around a bit you may be able to find a less obnoxious way for you to do it.