xenia-project/xenia

Add PS4 controller input driver.

benvanik opened this issue · 14 comments

Not sure what this requires, but it'd be nice to support them. Going forward they may be easier to support than 360 pads as (in theory) in OSX 10.9 they just work.

DS4 Tool is open-source and has like a million forks, you could use that. You wouldn't have access to the touchpad (I'm working on that), but everything else would be good. Doesn't the 360 controller work on OS X? I have friends who use it for Steam and emulators and such, but do you need special software or something?

Also, how does OS X interact with input devices? Is it like Windows with DirectInput and XInput and then generic HID stuff? I'm use to just making emulators support DirectInput and XInput and calling it a day. LOL.

Actually, now that I have dug through the source, you do have access to the touchpad, LED, and even some of the motion features.

IIRC (but it's been a year or two) there is a HID-like API on OSX, but it's pretty gnarly and finding good sources of documentation are hard (most are poorly written and only work with specific devices). Someone may have a good solution out there now and I'd love to reuse it and check this off the list :)

OSX support being deemphasized for now; but Windows/Linux PS4 pad access would be nice.

I figured, Mac support these days is a real pain. Even for somebody who has done it before! I remember trying to compile my NES emulator for Mac. That was the worst week and a half of my life!

Yeah - Apple hasn't been keeping up with graphics tech, and we need crazy new stuff. If they ever decide to give some love to OSX it shouldn't be too hard to port whatever works on Linux over. You know, if I ever get around to that ;P

It's funny that they have a 5K iMac, but no good GPU tech support. LOL.

I have some Linux experience (a whole hell of a lot more than Mac support, that's for sure!), so I may be able to help with the port if you need anything. The only problem is my CPU is not an AVX2 compatible chip, so I can't test anything I write, I would have to rely on others. I just spent a crap ton of money upgrading my PC too. 😭

@vgturtle127: Can't you use this ? never tested it but worth trying may be, even if it's software emulation, https://software.intel.com/en-us/articles/intel-software-development-emulator/

@sasukedotca Huh, I had never heard of such a thing. I suppose I could try it, but I'm not sure how it works or how it would affect things like performance or my current setup. I will look into it, but I don't have an extremely fast PC, so it may not even work in the long run anyway.

hlide commented

Intel SDE is built upon the Pin dynamic binary instrumentation system and the XED encoder decoder. Pin controls the execution of an application. Pin examines each static instruction in the application approximately once, as it builds traces for execution. During this process, which is called instrumentation, for each instruction encountered Pin asks Intel SDE if this instruction should be emulated or not. If the instruction is to be emulated, then Intel SDE tells Pin to skip over that instruction and instead branch to the appropriate emulation routine. It also tells Pin how to invoke that emulation function, what arguments to pass, etc.

As you can see, it is more and less like a just-in-time partial dynamic recompilation. So the more your cpu is recent, the less instructions are emulated. So if your cpu has AVX but no AVX2, it only needs to emulate AVX2 instructions. The only drawback is it needs to instrument the instructions when first encountered (slow process).

Alright, that makes sense. I wonder if Intel has ever considered a sort of Dolphin-esque cached recompiler? Maybe that would speed it up? I will give it a try when I finish upgrading to Windows 10 and updating all my dev tools and what not.

mirh commented

You'll need to support DirectInput under Windows then
In linux it should be just about plain joystick api
as for osx.. I believe you have to pass through IOHID.

@benvanik I am doing some research on the DS4 here:

Jays2Kings/DS4Windows#17

Just in case you are interested...

Fixed by #1493.