..:: 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-17-2014, 02:53 PM)electrobrains Wrote: [ -> ]When I overhaul touchpad support, you're going to have the ability to map areas of it to a number of different keyboard/mouse/controller button presses. I'd explain the exact ideas I have for implementing this but I'd rather leave it a bit of a surprise for the excitement factor Smile


Do you think you'll be able to get multiple touches working, because I'd like to see in a mouse mode tap to click, double tap to right click, and two finger dragging to scroll (like a laptop touchpad)?
Mutltiple touches are possible, hardware is able to recognize 2 fingers. Thanks to electrobrains for working on this as I right now don't have much time to spend on this project.
And i would prefer to spend it on keeping reverse engineering the DS4 protocol.
InhexSTER: Just a suggestion - but maybe you should add the link to your code repository, to the OP. So it doesn't get lost in the sea of posts : )
Hi all,

I am having a bit of a trouble getting the drivers work properly.
I connected my DS4 with my PC and then this Wireless controller popped up.
I wanted to play FIFA14 with it and actually almost everything works, except the right analog.
But when I try to install this Virtual Bus driver, this succeeds, but when running ScpServer, then there are no controllers shown in the list.

Then I downloaded Xbox 360 controller driver from Microsoft but while installing it, an "unexpected error" popped up and the installation is cancelled. I can't try to reinstall because it says I already have some kind of a version of it installed. I can try after uninstalling, but still the same error.
I even found a tutorial which said to extract the .exe file with winrar, then search for a driver manually from Device Manager and locate the INF file from xbox360\setup64\files\driver\win7 folder. But that did not work either.

So my PC identifies the DS4 itself, but I can't seem to use it with this driver and make it look like it's an xbox360 controller.
I even thought that maybe the problem is that I can't install the xbox360 driver without a xbox360 controller connected to the computer, but i'm just not sure.

And there are 80 pages here which is a lot to go through, so maybe someone has had the same problem and can help me Smile

Thanks in advance.
(01-17-2014, 06:46 PM)nismo44 Wrote: [ -> ]Hi all,

I am having a bit of a trouble getting the drivers work properly.
I connected my DS4 with my PC and then this Wireless controller popped up.
I wanted to play FIFA14 with it and actually almost everything works, except the right analog.
But when I try to install this Virtual Bus driver, this succeeds, but when running ScpServer, then there are no controllers shown in the list.

Then I downloaded Xbox 360 controller driver from Microsoft but while installing it, an "unexpected error" popped up and the installation is cancelled. I can't try to reinstall because it says I already have some kind of a version of it installed. I can try after uninstalling, but still the same error.
I even found a tutorial which said to extract the .exe file with winrar, then search for a driver manually from Device Manager and locate the INF file from xbox360\setup64\files\driver\win7 folder. But that did not work either.

So my PC identifies the DS4 itself, but I can't seem to use it with this driver and make it look like it's an xbox360 controller.
I even thought that maybe the problem is that I can't install the xbox360 driver without a xbox360 controller connected to the computer, but i'm just not sure.

And there are 80 pages here which is a lot to go through, so maybe someone has had the same problem and can help me Smile

Thanks in advance.

Go back from this page just a little and you'll find the 1.1 version that I puit out. Give that a shot, it works flawlessly for me with Final Fantasy.
New version 1.1.1:
Log message

Further reduce fastpath overhead by removing unnecessary use of Tasks
(and their associated memory allocations.) Also removed unnecessary
queue flushing as we should not get seriously behind in processing
USB or Bluetooth HID data. Read timeout behavior has been removed
because it is not necessary, even to detect disappearing devices.

Because of these changes, input lag should be even further reduced.
There probably is nothing more I can do for performance until taking
a look at the SCP Xinput virtual bus/device drivers.
(01-17-2014, 08:38 PM)electrobrains Wrote: [ -> ]New version 1.1.1:
Log message

Further reduce fastpath overhead by removing unnecessary use of Tasks
(and their associated memory allocations.) Also removed unnecessary
queue flushing as we should not get seriously behind in processing
USB or Bluetooth HID data. Read timeout behavior has been removed
because it is not necessary, even to detect disappearing devices.

Because of these changes, input lag should be even further reduced.
There probably is nothing more I can do for performance until taking
a look at the SCP Xinput virtual bus/device drivers.

Big mistake here, some version of timeout is absolutely essential (Mainly for Bluetooth connection). Because Readfile will never finish in some cases (Incorrect length of report received, bt signal issues) You going to bring some old bugs back. Task are needed for asynchronous read/write which prevents waiting, especially useful for write
(01-17-2014, 08:46 PM)InhexSTER Wrote: [ -> ]Big mistake here, some version of timeout is absolutely essential (Mainly for Bluetooth connection). Because Readfile will never finish in some cases (Incorrect length of report received, bt signal issues) You going to bring some old bugs back. Task are needed for asynchronous read/write which prevents waiting, especially useful for write

You absolutely need to comment your code to express intent if you expect me to understand why certain mistakes were made. If a timeout is necessary, it can be done using ReadFileEx and using a watchdog to perform cancellations. A Task+Action is not actually light-weight construct. Tasks are not needed, even if we implement timeouts. Why is asynchronous I/O useful for a write? As I said, if the SCP virtual Xinput driver needs optimization, I am going to work on that. All of this Task-in-the-middle stuff is a recipe for input lag.

Now, how did you come to the conclusion timeouts are necessary? Under what condition can you desynchronize a stream of Bluetooth HID data? It sounds not at all like timeouts are necessary but simply using the hid.dll queue flushing, in the case that we know we got bogus data. It should be quite possible to detect bogus data and resynchronize the stream if desynchronization is at all possible.

I truly do not want to take it on blind faith that such strange bugs exist. Most programs would just assume HID drivers work and trust the data. I will add back work-arounds for problems when problems are proven, but for now, I'm just going to claim total ownership of this branch. I would love for you to keep working on reverse-engineering! There's so much more the DS4 can do yet.
First the reason for asynchronous I/O. Since we sending report to controller LED/Rumble and it's happening after each input iteration it's not important to wait for success status, because there is around 8ms delay for sending/receiving the signal in best conditions i witnessed. When signal worsens the input/output delay becomes longer. Therefore, Read/Write will wait longer to return the status.
FileSteam has ability to do ReadAsync which is implemented only in .NET 4.5
So task where used which is a way async jobs work in 4.5

ReadFile will wait indefinitely for correct input to be present.

Second point to arrive at this conclusion i spent few weeks testing multiple controllers/dongles/OS's using different methods, (in game, usb sniffer and bt sniffer).

Also, usage of FileStream provided me with better results, more responsive input (analog stick sensitivity and so on). I believe it's due to large size of input report with BT (i think hid report size is incorrectly detected by default driver, because majority of BT report is "0')

Also i've been using DS4 with PS4 and i can say that the input sticking and signal issues exist there too.
hi,i will begin thanking who created this wrapper becouse is fantastic, but i have little truble with DS4Tool_1.1_Beta_3.zip, when i use the wrapper with a DS4 connected, some application like TeamSpeak3 when launched freeze the system for few second,then all work fine, but i get the same issue when i play with many pc game that have a secondary overlay over the one of steam. for example i get the issue with the new Assassin creed liberation hd, that freeze when start for over 30 second, then freeze again when load steam overlay, then freeze again when uplay load, and everytime i load steam/uplay overlay. the sum of all thing make system unusable for long time (ctrl+al+canc don't work too) but system continue to work becouse talking through teamspeak continue with no plroblem (exclunding the black screen or the image freezed for a minute or more, the longest freeze time until now was 5 minutes).
this issue is very frustrating, can take a look to fix it?
thanks Laugh