MTCKC / ProconXInput

A Windows user-mode XInput driver for the Switch Pro Controller.
198 stars 29 forks source link

Extract motion sensor data and steam data via udp protocol #14

Closed nagua closed 6 years ago

nagua commented 6 years ago

Hey MTCKC,

I made a woking implementation to:

with this changes I am able to use motion data with cemu.

I also changed the eventloop to use the pushed notifications of controller changes instead of polling with a hid command. Sometimes when I start the application there are no motion sensor data available. Most of the time I am able to restart the application and I get the sensor data. I do not know why this happens currently.

I restructured the Controller.cpp a bit in this process (I hope this will not be any problem). I also updated the windows sdk and added a sln file.

The server is not completly correcly implemented. If a client disconnects we do not account for it and still sends data to him. I think this is also the problem why the application leaks a bit of memory. After ca 2h of usage the applications memory grow from ~20MB to ~40MB. This should be corrected with another PR. I think this also leads to the higher cpu usage after time passes.

Have a nice holiday.

Greetings nagua

MTCKC commented 6 years ago

Woah nice, I'll take a look at this soon but right now I'm bogged down in holiday stuff.

Edit: I got carried away, meant to only glance at the code but I spent a few hours reviewing it lol. Whoops.

nagua commented 6 years ago

I will look further at your comments in the following days. At least I found the bug with the cpu/memory usage. Most of the controller based stuff is taken from the Switch Reverse Engineering repository and the jc_toolkit implementation. The udp protocol is from the DS4Windows/ScpToolkit project.

MTCKC commented 6 years ago

After mulling it over, I think I'm going to almost completely rewrite ProconXInput for the next release. It needs a bunch of changes, not limited to multithreading for events, hotplugging support, switching the virtual bus used from ScpVBus to ViGEmBus, properly timing polls of the Procon instead of requesting updates at maximum frequency, and purging of all GPL code resulting in a relicense back to exclusive MIT for my code.

All of this combined makes working on the current set of code super undesirable for me. The last issue is especially touchy, since if I accept your pull request then I cannot freely relicense.

I'm going to reject the pull request because of the impending rewrite and licensing issue. I do appreciate the pull request, I was never expecting to get one with my horrible code. I might ask you in the future if you'd like to contribute your Spi code to the next version since I haven't read through the Spi stuff in quite a while.

nagua commented 6 years ago

Ok, no problem. When you are ready to get PRs again, please get in touch with me. Or if you want to discuss implementation details. I also thought about a nicer way to handle the the datastreams.