Code Monkey home page Code Monkey logo

fossephate / joycon-driver Goto Github PK

View Code? Open in Web Editor NEW
1.1K 41.0 196.0 590.22 MB

A vJoy feeder for the Nintendo Switch JoyCons and Pro Controller

Home Page: https://fosse.co/latest.zip

License: MIT License

C 6.93% C++ 76.81% Makefile 3.27% M4 0.65% Shell 0.93% Python 0.13% XSLT 0.04% WebAssembly 1.61% AppleScript 0.01% Batchfile 0.03% Inno Setup 0.01% Module Management System 0.18% HTML 4.48% R 0.54% CSS 0.02% PHP 0.04% JavaScript 0.08% Objective-C 4.23% TeX 0.01% Lua 0.01%
joycon vjoy gyro-controls cpp nintendo-switch

joycon-driver's Introduction

JoyCon-Driver

A vJoy feeder / Driver for the Nintendo Switch JoyCons and Pro Controller on Windows with analog stick support and motion controls

How to use

  1. Install vJoy, here: https://sourceforge.net/projects/vjoystick/

  2. Setup your vJoy Devices to look like this (search for configure vJoy in Windows search):

    • Imgur
    • Add a device for every controller you have, so if you have 4 JoyCons and 1 Pro Controller, enable 5 devices
  3. Pair the JoyCon(s) / Pro Controller(s) to your PC

  4. Run the Application, if it doesn't detect your JoyCon(s) / Pro Controller, make sure they are fully paired / connected and restart the program.

    • For the latest features and updates, just click check for updates, updating is (mostly) automatic
  5. Once the program is running vJoy should register the input from the JoyCon(s) / Pro Controller.

    • To verify it's working you can use the vJoy monitor that comes with vJoy, it should look something like this: http://i.imgur.com/x4Fn7Cq.png
    • To re-pair the JoyCon(s) / Pro Controller go into Settings and remove them and then pair them again.
    • You'll likely want to use this with something like x360ce (http://www.x360ce.com), which will let you map the vJoy device to a virtual xbox controller for games that support them.
  6. Here's a screenshot of the actual program:

    • Imgur

Settings and features (some settings are only in the config file!)

  • Combine JoyCons
    • Combines a pair of JoyCons into a single vJoy device
  • Reverse Stick X/Y
    • Reverses the X/Y direction(s) for both sticks
  • Gyro Controls
    • Enables controlling the mouse with a JoyCon like a WiiMote
  • Prefer Left JoyCon
    • By default, the right JoyCon is used (if found), this forces the program to use the left JoyCon (if found)
  • Gyro Controls Sensitivity X/Y
    • Controls the sensitivity -> higher = more sensitive
    • The X sensitivity also controls the gyro sensitivity for Rz/sl0/sl1 in vJoy
  • Gyroscope Combo Code
    • A number that tells the program which button or set of buttons to use to toggle gyro controls
    • To figure out what number to put in the config, look at the Gyro Combo Code when you press your desired keycombo
  • Quick Toggle Gyro
    • Changes the behavior of the Gyro toggle from a standard switch, to a "always off unless keycombo is pressed" mode
  • Invert Quick Toggle
    • Changes the behavior of the quick toggle from always off unless keycombo is pressed to always on unless keycombo is pressed
  • Gyro Window
    • Opens up a visualizer for the JoyCon's gyroscope
  • Dolphin Mode
    • Makes it so that the Rz/sl0/sl1 sliders in vJoy don't reset back to 0 when the JoyCon stops moving
  • Mario Theme
    • Plays the Mario theme on the first connected JoyCon at startup
  • Debug Mode
    • Prints debug info to the console
  • Write Debug to File
    • Writes the debug info to a file
  • Force Poll Update
    • Don't use this, probably
  • Broadcast mode
    • Don't use this, probably

Important Notes

  • The JoyCons need to be re-paired anytime after they've reconnected to the switch

Contact

Donate

  • If you like the project and would like to donate:
  • https://paypal.me/fossephate
  • BTC Address: 17hDC2X7a1SWjsqBJRt9mJb9fJjqLCwgzG
  • ETH Address: 0xFdcA914e1213af24fD20fB6855E89141DF8caF96

Thanks

joycon-driver's People

Contributors

aperson avatar fossephate avatar joshuaeagles avatar misspokeycat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

joycon-driver's Issues

setting for autodetecting offsets at start.

would be awesome if some kind of --auto or whatever could be passed which assumes that the sticks are in neutral upon start/Connect and sets the offsets acting on the detected stick's values.

by the way, this is exactly how nintendo handled their controllers' sticks for a while (I know from Gamecube and Wii personally, dunno about the rest) so wouldnt even be that weird to introduce that.

another way would be a calibration application where you do the usual (conform the middle position of the stick, and rotate in fully) to understand the Stick's data and store the data along with the Hardware-ID into a config file.

Enabling Gyro controls doesn't seem to do anything

Heya,

Enabling Gyro controls doesn't seem to do anything. I see output to show that they're moving in the cmd window that opens -- but it doesn't seem to move my mouse or anything.

Is this intended or did I miss a step?

Thanks!

Windows 7 support

Hi, would it be possible to add windows 7 support for this driver?

Thanks.

Joycon autocentering not working properly

whenever I activate joycon autocentering both joysticks are off center by a fair amount. I believe center should be somewhere around 16384 but I am getting readings of left stick X -2696 Y 3144 and right stick X 18360 and Y 15640 and these results are consistent over multiple trials

build folder and binaries not included in gitignore

Noticed that the bin folder is included in the gitignore, but the build folder is not, and the project has been set to build to the build folder instead of bin. Any reason for this?

Committing those exe's every commit is causing the repository to grow because I believe git cannot store the diff of the binary, so it has to store a fresh copy of the binaries every time. It's 500 MB now, but I feel like it probably shouldn't be that big?

Left JoyCon analog stick doesn't seem to work

The right JoyCon analog stick does work fine, like any other button from both JoyCons.
But the left ones analog stick just doesn't. The button from analog work aswell.

On vJoy Monitor, the right X,Y,Z moves nice, while the left X,Y are stuck in the middle, and Z on the bottom.
image

Either left or right joycon stops working and disconnects after a minute of opening joycon-driver.exe

I'm so excited to use your driver, please answer if you can >_<
To give some background, both of the JoyCons work fine by themselves, but the moment I open joycon-driver.exe, it all works fine, and after 30 - 60 seconds either the left or the right joycon just stops responding and usually disconnects it from the bluetooth as well.
This is what i'm getting from the CMD.

vJoy device 1 is free
Acquired device number 1 - OK
vJoy device 2 is free
Acquired device number 2 - OK
Found joycon L 0: UnKnownFound joycon R 1: UnKnownEnabling vibration...
Enabling IMU data...
Increase data rate for Bluetooth...
Pairing1?...
Pairing2?...
Pairing3?...
Successfully initialized Joy-Con (L) !
Enabling vibration...
Enabling IMU data...
Increase data rate for Bluetooth...
Pairing1?...
Pairing2?...
Pairing3?...
Successfully initialized Joy-Con (R) !
setting LEDs...
vibrating JoyCon(s).
Done.
0.0000
0.0617
0.0000
0.0000
0.0000

Then i'm just endlessly bombarded with 0.0000 messages.
Do you think this could be a problem with my bluetooth? I don't really think so because of what I mentioned earlier.. I was playing with Dolphin really nicely, and when I turned on joycon-driver.exe it was way more fun obviously, but one JoyCon just randomly stops working..
More info, when I connect my JoyCons to the Bluetooth, they start flashing up and down like they should. They keep on doing this for pretty much forever, which is definitely normal. As soon as I open joycon-driver.exe the lights stop, by that I mean its still lit but it isn't moving up and down. Only 1 cube is lit. When the error occurs and one of the JoyCons stop working, the lights either start going up and down again or just turn off completely. Then if I check my Bluetooth, that joycon is disconnected and I have to connect it all over again.

Pro Controller Crash

The pro controller is recognized and appears to initialize correctly, but the program crashes immediately after. No change in config makes it work

Left joystick not working

The left joystick doesn't seem to be working anymore. I tried an older version and the stick worked just fine.

joysticks left max elongation === max right elongation

For both JoyCons maximally pushing the joystick left (vertical layout each hand) gives maximal right input to the game I'm playing. Could also be the games controls settings manager but other joysticks / gamepads work or vJoy.

I have got the neon yellow JoyCons.

Application stuck on vibrating, no input from controller

While running precompiled version of the app, it gets stuck on vibrating the JoyCon, console output below.

vJoy device 1 is free
Acquired device number 1 - OK
vJoy device 2 is free
Acquired device number 2 - OK
Found joycon R 0: 98b6e94ca6de \\?\hid#{00001124-0000-1000-8000-00805f9b34fb}_vi
d&0002057e_pid&2007#9&86fa39&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Enabling vibration...
Enabling IMU data...
Increase data rate for Bluetooth...
Successfully initialized Joy-Con (R)!
setting LEDs...
LEDs should be set.
vibrating JoyCon(s).

Step 2 Broken Link

On step 2 "Setup your vJoy Devices to look like this:
the first link is broken... I'm assuming its not the same setup as link 2 because I couldn't get the driver to work.

Hide the Nintendo Drivers from Other Programs

This is something that causes issues in some games, basically since the (bad) Nintendo supplied drivers are still there, some games that don't use controller-selectors and just pick up the first thing they see (Dark Souls looking at you) will pick up one of the Joy-Cons and get inputs from them. This is a small issue, and not likely easy to solve, however squashing it would be very nice.

On a similar note, built in direct SCP support would be nice, to eliminate the vJoy -> XInput layer, optionally of course. Again, for games like Dark Souls, where having extra controllers results in problems.

Skip unnecessary files commit

Currently the .gitignore is commented so it commits almost everything especially the unnecessary db.

The best way to have clean commits, reduce the repo size and still keep build releases, is to use the default .gitignore and just comment the following line.
https://github.com/mfosse/JoyCon-Driver/blob/f71e5d9a995d5148ff25359492c5574702e2da02/.gitignore#L19
Or even specialize it to only commit the needed exe/dll/txt, without symbols/object files.

This way, you don't lose anything. You can still download repo, fire the project and build right away.
Additionally, having clean commits, will also help you with the saving style you have, reminding you easily/cleanly what you changed between your PCs.
And for users, easier follow up of the project.

If you don't have time, I can arrange a PR.

Cannot run application

I do not see what to run.When I open joycon-driver in:
JoyCon-Driver-master\JoyCon-Driver-master\joycon-driver\build\Win32\Release
I get the error message:
"The program can't start because MSVCP140.dll is missing from your computer. Try reinstalling the program to fix this problem."

Joycon autocenter doesn't work with right joycon

Sorry to open another issue but while you fixed the issue with the left joycon autocentering, the right one, whether in the combined mode or not, doesn't center at all, it remains in its default position. I still love what your doing with this, keep up the good work!

Feature Request: Force Feedback (Vibration)

I'm enjoying the use of the Joy Cons as an emulated Xbox 360 controller, and I'm using it to play a couple of different games on Steam, but one of the downsides about using the Joy Cons over an Xbox 360 controller on PC is that I don't get any Vibration, I'm so used to using vibration all the time when playing games both on my Switch and on PC, and I would like to see its inclusion, at the very least in a "dumb" format with all motors vibrating whenever my Xbox 360 controller would, but if its possible I would love to see something more articulate utilizing individual parts of the Joy Con somehow.


A side question while I'm here: The Joy Cons work fine with Steam, but I'm playing a bit of Titanfall 2 on Origin as a new update for the game has just come out, I wondered if anyone has managed to get the controllers working with the Origin client as none of my games work with them or respond to anything other than an Xbox 360 controller when I was using it previously.

Work with More Than Two Controllers

If you have two pairs of controllers (4 in total), you cannot combine the second set into a second combined controller. Also, currently, the four can not all be added as controllers, instead the last two added are ignored.

Support for Pro Controller

I have a Pro joycon controller, but the driver does not detect it. Looking into the code, I can see this block

			// pro controller:
			// (probably won't work right, I'm just putting this here so it detects it,
			// I don't have a pro controller to test with.)
			if (cur_dev->product_id == PRO_CONTROLLER) {
				found_joycon(cur_dev);
			}

Right away, it seems odd to me that the above block for joycon R and L has this line, but the Pro block does not

settings.usingBluetooth = true;

If you wanted to test out some pro controller related code, I can try to run it. I would like to have this working and I think it should be pretty simple.

Im actually connecting a home-made joycon emulator, not a real controller. and I can make the actual Switch console think im either a R, L, or Pro device by changing a single byte, so I don't think there is much difference code-wise as far as parsing the data and this should be an easy feature to add .
(and of course, it works fine with your driver as long as it appears to be a L or R joycon)

Important input lag

There seems to be non-negligible latency (roughly half a second) between the moment a button is pressed and the moment the vJoy driver handles the input, as seen for example in joy.cpl or Dolphin's controller settings. I haven't seen this discussed here, is it a common issue?

Accellerometer data seems stuck

Hi, I wish to convert your code in a Unity Plugin so joycons can be implemented as a motion controller more easily, and as a Nintendo Dev, this could speed up the development process incredibly.
I have some problem getting data from gyro and accellerometer, for the gyro i saw that another issue is open, for the accellerometer when trying to get data values are stuck on a value, that is the same for the right and the left controller, there's some command to send to the joycon to activate the stream?

Add "shake" virtual buttons

It would be a good idea to add "shake" virtual buttons for emulators/games which don't support motion controls. Basically, when the driver detects that one of the Joy Cons was shaken, it presses the appropriate button.

Multiple buttons could be added : one per JoyCon, and one for any Joy Con.

A good example would be the Dolphin Wii emulator, with the WiiMote shake control.

Button Layout in combined mode

isnt the button Layout Kinda weird when going for combine?
wouldnt it make a lot more sense if the vjoy buttons were set like on a normal controller, especially considering some games use Direct input but heavily rely on the Layout most controllers have regarding the number of buttons etc (for example some games wont reconize buttons past 13 since that's what most controllers have or they have problems displaying button icons because xbox controllers dont above 10 buttons and most other directinput controllers dont go above 13.

I think we should go a bit like this:

first and foremost, the d-pad should be properly associated to the d-pad.
ABXY to butons 1-4
L,R,L2 and R2 become 5,6,7 and 8 respectively.
minus and plus being essentially select and start buttons get 9 and 10,
LStick Press and RStick Press becom 11 and 12.
the Axes are fine as they are.
and the rest can be arranged however needed, although I do it this way, with the previous hacky way I combined the joycons:
jc1

vJoy device number customisation

I might like to choose vJoy device numbers other than 1 and 2 for Windows controller numbering reasons. I haven't seen an option for this thus I suggest it here :)
But I haven't figured out how vJoy device numbers relate to Windows internal game controller numbering as for example referencable by Unity (Unity input setup supports joysticks until number 11 as "this number only" or "all joysticks").

Gyro controlls cursor drift

When using Gyro controlls the cursor slowly moves to the left. It's probably gyroscopic drift, but for some reason it never stops, no matter how long you wait.

Separate joy cons don't seem to work

I just downloaded this application 2hrs ago and it seemed to have no trouble when I combined the joy cons (I haven't really tested it, but the gyro seemed to detect my joy cons' feedback and it showed on vjoy monitor), however when I tried to use the joy cons individually they decided they want to connect to devices 0 and 3. 3 was no problem, 0, on the other hand, I had no idea how to connect to. I then closed the application, vjoy and disconnected the joy cons then connected them again and opened the application first hoping it will register them to vjoy automatically, but it told me I had to open vjoy and when I opened it I was right back at where I started.I then checked the config for an option to change which vjoy device the joy con would connect to, except there was no such option. There's probably an easy fix for this but I have been racking my brain for a while and I have absolutely no idea.

Gyro Data

I'm creating this because I'm not sure how I'm going to handle motion controls with vJoy yet, and I might want some feedback. currently it's just roll and pitch in the Rz and sl0 sliders in vJoy.

Sideways Joycon Default Right Analog Values

When using XOutput for example, there is no axis to put the right analog stick on, so games read the empty stick axes as the stick always being held in a direction. Giving at least one of the unused vJoy axes a centered value so that the right analog stick can be put on it and not constantly send input would make the sideways Joycons work far better for games.

(Side anecdote: After using the joycons on network hid-to-vpad, I learned Mario Kart 8 start boost is impossible if the right analog is held)

Cannot compile 64 bit version

When attempting to compile in 64 bit VS tells me that the module device is 32 bit.
32 bit version compiles fine, but it doesn't seem to run on my pc. Which is weird, because the last release does.

This is annoying because I made some tweaks that will make it way better (including deadzones for thumbsticks and gyro. I also want to add gyro calibration, as well as native motion control support for apps like Cemu)

Release dependency issue

The executable file from Release.zip notifies me about missing dependencies like "vcruntime140d.dll" and "ucrtbased.dll" which are obviously debug versions. I tried modifying the configurations and recompiled in VS2013, and it worked normally on a computer without VS installed, but I'm not sure if there would be issues when I recompile the 2015 project in VS2013.
Could you fix this? Thanks

My mouse is getting stuck in the upper right corner when I enable gyro controls

I can move my mouse but it gets back really quickly to the upper right corner of the screen. I have to Alt-F4 the application if I want to use my mouse again.

Plus when I watch the vjoy monitor while the gyro functions are enabled only the left joy-con's inputs are recognized. And I don't know where to check if the gyroscope functions are working either (the monitor doesn't show anything more than the left joy-con's buttons).

capture
capture2

I hope that someday I will be able to play Dolphin (Wii) games with this. ๐Ÿ‘

toggle on/off right stick mouse cursor control

Before I get to the issue, thank you SO MUCH for making this driver.

Would it be possible to have an on/off toggle for right analog stick mouse control? I've been attempting to use this set up with PS Now and Xbox One streaming, but the cursor renders it unusable in anything but fullscreen mode in games.

Thanks!

Both Joycon Sticks Slightly Broken

For some reason, both sticks values are messed up, and alternate constantly between the value you expect and a value far lower. This can easily be seen in the joy.cpl calibration screen. It seems to mess with the overall calibration and the effects can be seen in some games, even after going through XOutput. The problem can be found in both Combined and not Combined, which makes me think there's an error in how the stick values are read.

Full protocol reverse engineering

We need to get the packets fully reversed, or at least to a point where we can be confident that the sticks and motion control fields are correct.

Going to try to get some profiling done on un-explored sections of the packets, and maybe hand this off to a friend of mine who loves protocol reversing.

Add cemuhook motion control support

Cemuhook recently added a backend to cemu for hosting a udp server and having motion data and controller data sent to cemu. I think this would be the perfect program to implement this feature since this is a Nintendo emulator and these controllers are designed for those games.

DLL Files Missing!!!

So, I stumbled across this tool today. I downloaded it and tried to run it. I found myself at these windows:
time
How do I fix this issue? Do I need to install an extra program? Do I have all the right files?
problem
Please help! I really want to try this driver out!

  • Thanks!
    RarePika

Setting LEDs... doesn't end

It successfully combines both JoyCons but gets stuck setting the LED for the right JoyCon. After running it a few times, it eventually set both LEDs but I still had to manually stop the execution. Hope to be helpful!
image

neon yellow JoyCons: no gyro input registered (if it should)

--enable-gyro (in conjunction with --auto-center, I haven't tried without, sorry for not thinking about it before) has the Ri values not changing in either vJoy monitor or Windows game controller configuration (Windows 10). I suppose from your screenshots of vJoy Ri are the gyro readings.

If this should work at all already I'm mentioning this :) I have the neon yellow JoyCons.

If I can run some raw readings logger for you or similar I'm glad to assist!

Joycon Input Delay

I believe the developer is already aware of this but for anyone else that is experiencing this issue, I am here to let you know that you are not alone. The bug is that the longer the amount of time the joycons are connected, the greater input delay becomes apparent. I have seen my own setup get as bad as 3 seconds. If it's worth noting, this is using the combined joycon configuration. Also, for anyone getting the VCRUNTIME140D.dll error, what I did was copy a vcruntime140.dll file into the system32 folder on my computer are rename it VCRUNTIME140D.dll. It just worked after that, it seems really strange but I hope this either gets fixed or that information helps someone else out.

Dualshock 4 emulation

I don't know if this is the right place to write this, since this project depends on vJoy, and as far as my knowledge goes - it's not possible to "emulate" Dualshock on that without tinkering with project and building it manually, but I'd like to describe the idea anyways.

First of all, what is the point of this? The thing is, Dualshock 4 is the only controller besides Steam Controller that has gyro support via Steam Controller Configurator.
Why would I want to use that? Because it allows to use gyro in conjunction with regular controls, instead of regular "gyro OR regular controls".
Also, the Steam Controller Configurator will allow user to switch between single/dual Joy-Con mode more easily - it will be possible to make "mirrored JoyCons" config for single mode, and "Independent Joy-Cons" for dual mode, it also will allow to use Joy-Cons on Desktop (browsing Internet, for example) more conveniently.

A lot of cool things come with this feature, and I'd like to ask if it's ever planned or even possible to implement.

Sorry if what I've just said sounds stupid though.

Error after aquiring 64 bit versions of ucrtbased and vcruntime140d dlls

After putting both Dlls in my win32 build folder, I get the following message when I try to run the program:

"The procedure entry point _CrtDbgReportW could not be located in the dynamic link library"
Then it displays the file path of the hidapi dll.

Do I need a clean copy of this dll? Is it not 64 bit?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.