..:: PCSX2 Forums ::..

Full Version: DS4 To XInput Wrapper
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
(01-15-2014, 04:43 PM)electrobrains Wrote: [ -> ]For now I'd prefer to leave your repository alone and let you pull in the changes using git merge or whatever. This is actually the first time I've used git versus all the other times I've ever used CVS, Subversion, Perforce, etc. I can easily make the suggested change for exclusive mode to be a toggle, until you guys can provide exact bug reports for what doesn't work right with Big Picture mode and such. I need precise steps to reproduce problems, including indication as to whether USB or Bluetooth is in use.

The redundant USB/Bluetooth input should be solved by locking out attachment of a USB proxy interface when Bluetooth is already attached, or vice versa. Does anyone have a reverse-engineered reference for the DS4 protocols? I'd like to get speaker output going to audibly warn at low battery levels. I might have to actually upgrade to a Bluetooth 2.1 adapter for that, but I have a feeling 2.0 works fine still too, because a controller just can't use that much bandwidth.

One of the possible ways is Windows 7 + Uplay + AC3 or AC4 causes computer to hang, Also it was reported that TeamSpeak causes hang as well. AFAIK it doesn't happen on Win 8.1
There is no documentation on DS4 Protocol, everything regarding communication with DS4 you see in the source I had to find myself, correct addresses to read/write data. I am pretty sure that full audio is available only through BT and it most likely not part of the HID.
Okay, I'm guessing that turning on the audio portion of the device is an operation that we have to reverse-engineer, then, and it will suddenly appear as another device of that HID class as well. I don't have Windows 7 anymore -- I upgraded to 8.1 distinctly because the Bluetooth was purported here to be less wonky. I could probably test in Windows 7 on a VM eventually using USB passthrough to expose one Bluetooth adapter inside the VM. Do you have any tools for viewing either the Bluetooth or the USB HID descriptors? I think they will hint at the remaining protocol.

BTW, if I didn't say so already, thanks for working on this adapter. I love DS4's ergonomics compared to DS3 and X360 controllers, and soon enough we'll have by far the most advanced Windows controller options possible... until the Steam controllers come out, perhaps.

I think I want to eventually use the motion sensors on the DS4 to implement gestures. Flip the controller over to turn off, rather than hold the Guide button, if the Guide button can be programmatically disabled, for example.
Just a short question: Why did you choose to use for example 1 << 2 - 1 instead of just 2?
How is it going with the Uplay bug? Does anyone know what's causing it? :o
(01-15-2014, 05:28 PM)electrobrains Wrote: [ -> ]Okay, I'm guessing that turning on the audio portion of the device is an operation that we have to reverse-engineer, then, and it will suddenly appear as another device of that HID class as well. I don't have Windows 7 anymore -- I upgraded to 8.1 distinctly because the Bluetooth was purported here to be less wonky. I could probably test in Windows 7 on a VM eventually using USB passthrough to expose one Bluetooth adapter inside the VM. Do you have any tools for viewing either the Bluetooth or the USB HID descriptors? I think they will hint at the remaining protocol.

BTW, if I didn't say so already, thanks for working on this adapter. I love DS4's ergonomics compared to DS3 and X360 controllers, and soon enough we'll have by far the most advanced Windows controller options possible... until the Steam controllers come out, perhaps.

I think I want to eventually use the motion sensors on the DS4 to implement gestures. Flip the controller over to turn off, rather than hold the Guide button, if the Guide button can be programmatically disabled, for example.

Great ideas good luck, you should create a bugtracker as http://flyspray.org
(01-15-2014, 02:11 PM)headegg Wrote: [ -> ]Thanks for the information! Have now modded it so I can use the touchpad as a start button.

I think I will now try to work on a solution to custom-map buttons.

@Rocquito: Although I think electrobrain would be faster at that, I will try to implement a way to do that, as I think electrobrain will be busy working on his new addition. You would just need to tell me, which buttons you would prefer to use for the mouse buttons.

Thank you man. Personally I think using the touchpad click or the share button as the left mouse click would be far less messy. Even an option to enable trackpad without any button acting as mouse buttons could suffice. I think it's better to ignore the right mouse button until the button mapping is implemented.
(01-15-2014, 05:41 PM)Rocquito Wrote: [ -> ]Thank you man. Personally I think using the touchpad click or the share button as the left mouse click would be far less messy. Even an option to enable trackpad without any button acting as mouse buttons could suffice. I think it's better to ignore the right mouse button until the button mapping is implemented.

Please guys if anyone is working on significant button remapping/touchpad support, hold off a day if you want it to be easier on you. I'll be overhauling that part entirely and it will be far easier when you can reuse the mouse/keyboard binding stuff that I do. By all means, everyone work on whatever part you'd like, but as a practical software development consideration we should coordinate what area people are working on.

I'm about to go make the controller shared/exclusive access mode a toggle and post a new update.
if you mean to assign an axis for each trigger, it would also be interresting.
(01-15-2014, 06:43 PM)Pro_info Wrote: [ -> ]if you mean to assign an axis for each trigger, it would also be interresting.

I am initially adding three kinds of programmability:
Share/PS button remap to another controller button, mouse button or to a keyboard press.
Value remap for triggers so you can trigger them more quickly (hair triggers.)
Hybrid mappable buttons + cursor/mouse click control for the touchpad.
I'm trying to make it try exclusive mode first then shared mode but can't for the life of me figure out what's going wrong with the CreateFile calls. I think something is up with the two NativeMethods.CreateFiles being overloaded? Don't we only need just one of them? Here's what I'm trying to do:
Code:
/*
         * Attempt to open in exclusive mode, if possible, to work-around double input reported in some programs.
         * Always try to open in shared mode for people whose controllers get disconnected while a program is actively using the controller.
         */
        private SafeFileHandle OpenHandle(String devicePathName, Boolean readAndWrite)
        {
            const int Exclusive = 0, Shared = NativeMethods.FILE_SHARE_READ | NativeMethods.FILE_SHARE_WRITE;
            uint Access = readAndWrite ? NativeMethods.GENERIC_READ | NativeMethods.GENERIC_WRITE : 0;

            for (int sharing = Exclusive; ; sharing = Shared)
            {
                try
                {
                    SafeFileHandle fh = NativeMethods.CreateFile(devicePathName, Access, sharing, IntPtr.Zero, NativeMethods.OpenExisting, 0, 0);
                    if (fh.IsInvalid)
                        Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
                    else
                        return fh;
                }
                catch (Exception)
                {
                    if (sharing == Shared)
                        throw;
                }
            }
        }