Ryochan7 / DS4Windows

Like those other ds4tools, but sexier
https://ryochan7.github.io/ds4windows-site/
GNU General Public License v3.0
6.94k stars 807 forks source link

Can't connect to DS4Windows UDP server from other PCs #710

Closed F2FG closed 5 years ago

F2FG commented 5 years ago

Hello, thank you very much for this fantastic tool!

Everything (Cemu + Cemuhook + DS4Windows with motion) works fine on my gaming PC.

What I am trying to do is to install DS4Windows on a laptop (that is connected to the same local network as the gaming PC), connect the DS4 controller to the laptop, then make the laptop provide the motion control data to the gaming PC.

I can't get Padtest_1011 on my gaming PC to see the DS4Windows UDP server on the laptop, it looks like DS4Windows can only provide the data to the local address 127.0.0.1.

Both the gaming PC and the laptop have a clean installation of Windows 10 Home and Windows firewall disabled.

Am I trying to do something that is not possible or am I missing something?

mika-n commented 5 years ago

Jep. The current version of UDPServer in DS4Win app listens only in the localhost address. Sometimes I have considered to imporove the UDPServer with few changes, but haven't got around to do it (time). Let's see if I can find time and energy to do few improvements there.

mika-n commented 5 years ago

I guess you have seen this page. Ryochan7 has documented few details about the UDP implementation. The one who originally implemented it and done the ground work has moved on to do some other projects, but Ryochan7's fork has tried to keep it alive. https://github.com/Ryochan7/DS4Windows/wiki/UDP-Server-Output-Packet-Information

Until the UDP implementation in DS4Win app is changed then one way to do what you want would be to use UDP redirector to redirect UDP requests from a remote client to another local UDP port (ie. remote laptop client -> local PC UDP redirector app -> local PC UDP in DS4Winapp).

F2FG commented 5 years ago

Hello mika-n, thank you very much for the clear pieces of information.

I used a UDP forwarder - http://www.porttunnel.com - and it worked immediately. I was also able to make it work connecting from a different network via OpenVPN, and using Moonlight to stream my gaming PC screen.

My setup was very quick and dirty so I experienced a 1-second lag only for motion controls (regular controls and streaming via Moonlight work flawlessly, 1080p 60FPS without noticeable lag for casual BOTW gaming).

I'll play with my setup and I will try to make the motion controls lag acceptable. This could lead to a complete streaming solution for WiiU games with a DS4 controller.

I will update you as soon as I make some progress.

F2FG commented 5 years ago

I used a UDP forwarder - http://www.porttunnel.com - and it worked immediately. ... My setup was very quick and dirty so I experienced a 1-second lag only for motion controls

I already had great results using this free forwarder: https://www.networkactiv.com/AUTAPF.html

mika-n commented 5 years ago

Your setup sounds really interesting and good to hear that it works reasonably good.

I have used DS4Win with Sony's PS RemotePlay to play PS4 games on PC because my laptop is usually in a different room than PS4 and sometimes I want to re-map DS4 controller keys. RemotePlay would work without DS4Win app but then I could not re-map keys and axies. For example DS4Win app allows to re-map gyro steering wheel feature to Left X-axis and this way DS4 racing games can be played with my do-it-yourself steering wheel rig: https://github.com/Ryochan7/DS4Windows/pull/491#issuecomment-439821245 https://github.com/Ryochan7/DS4Windows/wiki/Settings#steering-wheel

However, doing this other way around has been something I haven't figured out how to do it. Sometimes I'd like to play EurotruckSimulator2 running on PC from an another room or in big screen in living room where I (editors note: wife) don't want to see any PCs. Your setup actually sounds like something which might be able to following sequence: client laptop running some streaming client -> DS4Win UDP server on gaming PC and doing required re-maps (unless it could be done in client side already)-> ETS2.

Sure, there are several solutions to stream games from PC but all those are missing the capability to use re-mapped DS4 buttons/axies (especially gyro steering wheel feature) from a client side. But your setup actually sounds like something which could work. Hmm.... Now you gave me a motivation to take time to improve DS4Win UDPServer in a way that it would work without additional UDP proxies/forwarders.

Ryochan7 commented 5 years ago

Making that setting configurable was attempted once. It ended up slowing down the app so the idea was scrapped. I guess I could try it again soon and see if I have better luck with it.

F2FG commented 5 years ago

Your setup sounds really interesting and good to hear that it works reasonably good.

Thank you again for the hints!

Sometimes I'd like to play EurotruckSimulator2 running on PC from an another room or in big screen in living room where I (editors note: wife) don't want to see any PCs.

Then I have great news for you! I just finished to test this solution on this setup with great results:

Gaming PC info (server):

Client info:

Cemu - Breath of the Wild - 1080p 60FPS screen streaming testing with DS4Windows motion support:

https://vimeo.com/338531671

Now you gave me a motivation to take time to improve DS4Win UDPServer in a way that it would work without additional UDP proxies/forwarders.

That would be awesome. As you see the setup is working, but there is a lot of room for improvement, AUTAPF (the forwarder) is not free and is not as smooth as it should be. If you find some time you can count on my help for testing.

Can anybody suggest a good UDP forwarder with a very low latency?

F2FG commented 5 years ago

Making that setting configurable was attempted once. It ended up slowing down the app so the idea was scrapped. I guess I could try it again soon and see if I have better luck with it.

Thank you for the info, that would be fantastic!

mika-n commented 5 years ago

Here is a test build of DS4Windows.exe app executable with a new "UDP Server Listen Address" config option. Unzip the attachment of this post and replace (backup the original file) DS4Windows.exe file.

By default DS4Win app uses localhost only (ie. 127.0.0.1 address), so remote client UDP connections are not possible.

The new config option supports also 0.0.0.0 (=all host IPV4 interfaces), a specific host name (DNS lookup) and IP address values (specific ipv4 interface IP in case there are multiple network cards in a host). These "non localhost" values support also remote incoming UDP connections. Typically "0.0.0.0" value should work just fine if remote connections are required.

However, please remember that incoming UDP connections are not authenticated in anyway, so use this only in "safe" local networks. It may not be a smart idea to open DS4Win UDPServer to a public internet.

64bit executable: DS4Windows_UDPServerListenAddressTest.zip

32bit executable: DS4Windows_UDPServerListenAddressTest_32bit.zip

Feel free to test this and let us know how it works in your setup. At first simply try setting UDP server address as value 0.0.0.0

mika-n commented 5 years ago

DS4Win_UDPServerAddress

superhubit commented 5 years ago

Feel free to test this and let us know how it works in your setup. At first simply try setting UDP server address as value 0.0.0.0

mika-n, thank you so much!!!

I tested your executable, and it is already working so much better than the UDP forwarder...

I just tested it connecting to the gaming PC (the server) remotely via OpenVPN and the results are great, you can check how well it works from this video:

https://vimeo.com/338673515

As you see every time I use the bow, I use the motions controls, and it is precise and very usable: this is fantastic!

mika-n commented 5 years ago

Looks great! Thanks for testing. I will create a pull request for this UDP change, so Ryochan7 can review it and hopefully include it in one of the upcoming official versions.

The test version was compiled based on the latest V1.7.9 version (released today). The only difference in the test version is that version tag is not V1.7.9 (it is V178 even when the code base behind it is identical with V1.7.9 official version release which is missing this UDP remote connection capability).

Keep eye on the official releases and hopefully soon you will see there "What's new - UDP Server supports remote incoming connections" comment. https://github.com/Ryochan7/DS4Windows/releases

Now the next step is that I will setup an environment to play EurotruckSimulator2 remotely (streaming) and using motion sensor (gyro) steering wheel emulation feature of DS4Windows app.

F2FG commented 5 years ago

Thank you for the info, if you are using an Nvidia card I suggest you use Nvidia Geforce Experience + Moonlight, feel free to ask if you run into problems with your setup.

F2FG commented 5 years ago

@mika-n Were you able to test this in your setup? I noticed that Ryochan7 included this fix in the latest official release.

Thank you again for your efforts @Ryochan7 @mika-n !!!