XInput Wrapper for DS3 and USB Dual DS2 Controller
Regarding DualShock 3 Controllers compatibility with Vista / 7.

DS3 Controllers do send a correctly formed HID Descriptor and it is correctly recognised by the OS as a game-controller. You can view it in Devices and Printers, and it displays properly in Game Controllers.

[Image: attachment.php?aid=29681]
[Note the Dual PSX-USB Adaptor displays in Devices and Printers, but not in Game Controllers]

There is one issue with it though, it requires a Start command to be sent to wake it up before it will start issuing Reports. This is a well known issue, Linux has had a kernel quirk for it for a long time.

The Start command is a Set Feature Report with Report ID 0xF4, the problem is this Feature Report is not in the HID Descriptor. So it is not accessible from a user application. The HidUsb driver will refuse any Report ID that is not included in the HID Descriptor.

To get around this it is possible to write a Lower Filter driver which can issue the Set Feature Report. The following is code from a filter driver which modifies the Report ID and TransferBuffer contents, of a User application issued Set Feature Report with Report ID 0xEE (valid in HID Descriptor), to issue the Start Command.

/** Startup  Filter for DualShock 3 **/

    DebugPrint(("FilterPass %d - %d \n", irpStack->MajorFunction, irpStack->MinorFunction));

    if (irpStack->MajorFunction == IRP_MJ_INTERNAL_DEVICE_CONTROL)
        DebugPrint(("IoControlCode %d\n", irpStack->Parameters.DeviceIoControl.IoControlCode));

        if(irpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_INTERNAL_USB_SUBMIT_URB)
            PURB pHxp = (PURB) irpStack->Parameters.Others.Argument1;

            DebugPrint(("Report [%d] - [%d]\n", (int) pHxp->UrbHeader.Length, (int) pHxp->UrbHeader.Function));

            if (pHxp->UrbHeader.Function == URB_FUNCTION_CLASS_INTERFACE)
                UCHAR* Buffer = (UCHAR*) pHxp->UrbControlVendorClassRequest.TransferBuffer;

                DebugPrint(("Flags [0x%04X] Length [0x%04X]\n",

                DebugPrint(("Request [0x%02X] Value [0x%04X] Index [0x%04X]\n",
                    (int) pHxp->UrbControlVendorClassRequest.Request,
                    (int) pHxp->UrbControlVendorClassRequest.Value,
                    (int) pHxp->UrbControlVendorClassRequest.Index));

                if ((pHxp->UrbControlVendorClassRequest.Value == 0x3EE)
                &&  (USBD_TRANSFER_DIRECTION_FLAG(pHxp->UrbControlVendorClassRequest.TransferFlags) == USBD_TRANSFER_DIRECTION_OUT)
                &&  (Buffer[0] == (UCHAR) 0xEE))
                    if(Buffer[1] == (UCHAR) 0x01)
                        pHxp->UrbControlVendorClassRequest.Value = 0x3F4;
                        pHxp->UrbControlVendorClassRequest.TransferBufferLength = 4;

                        Buffer[0] = 0x42;
                        Buffer[1] = 0x0C;
                        Buffer[2] = 0x00;
                        Buffer[3] = 0x00;

/** END - Startup Filter **/

This code would be inserted into the one of the DDK Samples (general\toaster\wdm\filter) in the FilterPass function, and built as a Kernel Mode Device Lower Filter. Code could be modified and used on the return of a Query Descriptor request if automatic start was required.

This in essence what the MotionInJoy drivers do for you, with a few extra features (setting the LEDs etc).

I've used this on XP, DS3 starts properly and is usable in games. Again for Vista / 7 the Driver must be signed, so as a general solution it's not recommended.

Attached Files Thumbnail(s)

Sponsored links

wow, thats awesome xD.

now if only someone as cluey as you was working with me and truthunknown to improve XBCD >Laugh

Though, it shouldn't be impossible to send the start command as a usermode driver. the device is already being spoken to properly.
I didn't mean to imply that this was the only way to write a filter to send the Start command, it was just the way I did it and was presenting it as a 'known working' solution.

I wrote it a few years ago when I came across the the Linux kernel quirk by chance. I knew it was doable on Windows since the MotioInJoy drivers worked, so I set about finding out how it could be done. My origional intention was to rewrite the HID Descriptor to expose the Report ID and pass it up on a Query Descriptor request, this was a proof of concept before attempting anything more involved.

I had a lot of work on at the time, and I was quite happy using my DualShock 2 controllers (code was much more hacky than the version posted here - but it worked well enough). So this got shelved and I never got back to it. I only looked at it again when I was rewriting the XInput wrapper to post here and thought it might be of some interest.

Glad that you found it interesting.

-- Added updated version, see first post for details.
Added a DualShock 3 Filter + XInput Wrapper, see first post.
Updated DualShock 3 Filter + XInput Wrapper, see first post.

If there is any interest in this I'll look in to BlueTooth support and getting it Signed for use in Vista / 7.

Also tested on SixAxis Controller, works as per DualShock 3, w/o Rumble support.

I've been testing the Rumble functionality in the adaptor, seems it has a few problems. Under heavy use of Rumble (testing with SSX Tricky), the adaptor can drop out which hangs the driver. Also the device does not support fully overlapped operation. Currently looking for a workaround, I may have to remove the Rumble support.
I would just like to personally thank you scarlet crush! The only thing on the internet to make that dammed thing work on pcsx2 without crashing dreadfully. You sir saved me £5 on buying a cheap joypad Smile
Added version which includes support for both DS2 and DS3 pads - XInput-Wrapper-DS2-DS3-

DS3 initialisation support added via libusb-win32- (installed as a filter driver)

Tested DS3 with PCSX2 0.98 (FFX-2, SSX Tricky), Batman AA, Batman AC on Windows 7 x64.
Posted new version.

- Signed Filter Driver
- Added Speedlink Strike FX
Oh my, this is great! And with source. Laugh

I've been thinking about DS2/3 native support (and also about using the big X in the X360 controller under Windows) so this seems like an excellent source of info.

Have you thought about making an API for DualShock controllers? Ye know, the ScarletInput API or something.

Now where did I put that DualShock2...

#EDIT/PS: How about googlecode?
[Image: nbKSK.jpg]
Added modified Lilypad from r5350 source to support DS3 native mode using the Filter Driver in XInput-Wrapper-DS2-DS3-

[Basically just removed the Libusb dependancy.]


Users browsing this thread: 9 Guest(s)