Giter VIP home page Giter VIP logo

xjoy's Introduction

XJoy

XJoy allows you to use a pair of Nintendo Joy-Cons as a virtual Xbox 360 controller on Windows. XJoy is made possible by ViGEm and hidapi.

Support this project

XJoy is a free product that I work on in my free time, so any contributions are greatly appreciated.

Note

Currently the newer versions containing analog support appear to have some issues. I recommend using the last version before analog support was introduced v0.1.8.

Installation

  1. Install the ViGEm Bus Driver (install all requirements as well)
  2. Install the Visual C++ Redistributable for Visual Studio 2017
  3. Download the latest zip from the releases page and extract it somewhere permanent like your Documents folder
  4. That's it!

Usage

  1. Pair each of your Joy-Cons with Windows (hold down the button on the side to put into pairing mode, then go to add bluetooth device in Windows)
  2. Ensure that both Joy-Cons show as "Connected" in your bluetooth devices page
  3. Run XJoy.exe
  4. Start playing games with your Joy-Cons. A virtual xbox controller should show up as soon as XJoy.exe starts running (you will hear the USB device inserted sound).
  5. To confirm that it is working, try pressing some buttons on your Joy-Cons. You should see the names of the buttons currently being pressed printed in the terminal.
  6. To exit, press [ENTER] in the terminal window. You can also simply close the window however this may not disconnect from the Joy-Cons and the virtual controller properly.

When you launch XJoy.exe, you should get output similar to this:

XJoy v0.1.0

initializing emulated Xbox 360 controller...
 => connected successfully
 => added target Xbox 360 Controller

initializing threads...
 => created report mutex
 => left Joy-Con thread started
 => found left Joy-Con
 => successfully connected to left Joy-Con
 => right Joy-Con thread started
 => found right Joy-Con
 => successfully connected to right Joy-Con

Customization

Right now all buttons are hard-coded to their "default" xbox equivalents. If you wish to customize these mappings, feel free to modify the process_button method in XJoy.cpp and recompile yourself. I plan to add support for a configuration file and maybe a GUI in later versions. The default mappings are shown below:

Joy-Con Button Xbox Button
A B
B A
X Y
Y X
Left Trigger Left Trigger
Right Trigger Right Trigger
Left Shoulder Left Shoulder
Right Shoulder Right Shoulder
D-PAD D-PAD
Left Analog Left Analog
Right Analog Right Analog
Left Stick Left Thumb
Right Stick Right Thumb
Home Start
Capture Back
Plus Start
Minus Back
SL on Joy-Con (L) A
SR on Joy-Con (L) X
SL on Joy-Con (R) B
SR on Joy-Con (R) Y

Building

If you wish to build XJoy yourself, simply install the ViGEm Bus Driver as outlined in the installation steps, open the XJoy.sln file in Visual Studio 2017, and build. Everything should work out of the box but if it does not feel free to submit an issue. Note that at least on my end it seems to be working in Visual Studio 2019 as well, which is good.

Contributing

  1. create a fork for your feature/bugfix/whatever
  2. make your additions/modifications, following our C++ Coding Style Guidelines
  3. test your changes, doing your best to ensure you aren't introducing any environment-specific behavior that may cause issues for users without your exact setup. XJoy's target audience is freshly installed Windows 10 users who have followed the ViGEm installation instructions.
  4. submit a pull request

xjoy's People

Contributors

13thsymphony avatar albfan avatar andrekorol avatar davidemorales avatar gloix avatar harrypeach avatar jexell avatar kljzndx avatar megadrago88 avatar sam0x17 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

xjoy's Issues

connection error: bus not found

confused, getting the above error when running the program, and not sure what it means.

my gut instinct is telling me it has something to do with my wireless perhaps, but both joycons show up as connected in my bluetooth settings.

Support for only one joycon at a time.

I've tinkered with XJoy a bit, including the code and I love it. My main use case for connecting the switch joycon to my windows machine, is to use the left joycon for movement in game (instead of the wasd keys) and use mouse for aiming. Suggestion: Do not require the presence of both left and right controllers.

There's no Visual Studio 2018

In the Building section of README.md there's a mention to Visual Studio 2018, but the latest version of Visual Studio is Visual Studio 2017.
Visual Studio is released every other year.

add full analog stick support

By default (with no calibration / messages sent back to the Joy-Con), the Joy-Con supports 8-direction movement of both analog sticks, which is sent via data slot 3. Looking at other Joy-Con libraries, it is difficult to determine whether this can be increased to something more analog with some calibration. If anyone has any idea whether it is possible to do this, and what the procedure is for getting the Joy-Con out of the default 8-direction mode for analog sticks, it would be greatly appreciated.

update: this is fully possible, and I am working on adding it to XJoy

Cannot connect 2 pairs of Joycons

Hello!
I tried to use 4 joycons to play with a friends and it turns out Xjoy only recognize one pair of Joycons
Do have any solution for us? Or is connecting 4 joycons juts impossible for now?

Thank you for your help!

Significant input delay

The left joy con has a significant input delay compared to the right joy con. It's so bad, that it renders the whole setup unplayable. It's very peculiar since the right joy con seems to have no input delay whatsoever.

Support analog stick acceleration

When moving the analog sticks, the full force is registered rather than the appropriate amount based on how much the analog stick is pushed.

For example, in a game if the stick is pushed slightly the character walks slower than if it was pushed entirely. I have not been able to replicate this functionality in Xjoy.

Thanks for the great work, hope its possible to add this!

input lag

@wormyrocks not sure if you noticed before but it looks like some of the new analog support changes introduce some significant input lag / glitchiness. I'm going to investigate and see if I can figure it out.

Controller vibration?

This is probably very low-priority, but are there plans to add the vibration feature to this?

Left Joycon not detected

I have both joycons connected to my pc, and have everything installed, yet whenever I open the program it says that the left joycon wasn't detected and says press enter to exit. I've tried reconnecting my joycons and reopening the program, and restarting my pc multiple times, but still nothing.

Switch Online NES Joycons not working.

I’ve been trying to use Xjoy for the NES Switch Online controllers that you can buy from Nintendo if you have a Switch online subscription but they don’t work, on the button mapping screen everything registers a left input and the d-pad doesn’t work at all.
These are still technically joy-cons but i haven’t found anything that works on PC for them.

Setting the LEDs

Probably not a top priority or anything, but I'd find it nice if this Program set the LEDs of the Joycons once connected, instead of letting them continue cycling them.

Error when building: unresolved external symbol

I tried rebuilding the application because I wanted to remap some buttons, but I couldn't get it to work. I'm not experienced in building .cpp files, but when I try I get an error log saying that the builder can't resolve external symbols.

The full log after running cl XJoy.cpp:

XJoy.cpp
Microsoft (R) Incremental Linker Version 14.00.24210.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:XJoy.exe 
/machine:arm 
XJoy.obj 
XJoy.obj : error LNK2019: unresolved external symbol vigem_alloc referenced in function "void __cdecl `dynamic initializer for 'client''(void)" (??__Eclient@@YAXXZ)
XJoy.obj : error LNK2019: unresolved external symbol vigem_free referenced in function "void __cdecl initialize_left_joycon(void)" (?initialize_left_joycon@@YAXXZ)
XJoy.obj : error LNK2019: unresolved external symbol vigem_connect referenced in function "void __cdecl initialize_xbox(void)" (?initialize_xbox@@YAXXZ)
XJoy.obj : error LNK2019: unresolved external symbol vigem_disconnect referenced in function "void __cdecl disconnect_exit(void)" (?disconnect_exit@@YAXXZ)
XJoy.obj : error LNK2019: unresolved external symbol vigem_target_x360_alloc referenced in function "void __cdecl initialize_xbox(void)" (?initialize_xbox@@YAXXZ)
XJoy.obj : error LNK2019: unresolved external symbol vigem_target_free referenced in function "void __cdecl disconnect_exit(void)" (?disconnect_exit@@YAXXZ)
XJoy.obj : error LNK2019: unresolved external symbol vigem_target_add referenced in function "void __cdecl initialize_xbox(void)" (?initialize_xbox@@YAXXZ)
XJoy.obj : error LNK2019: unresolved external symbol vigem_target_remove referenced in function "void __cdecl disconnect_exit(void)" (?disconnect_exit@@YAXXZ)
XJoy.obj : error LNK2019: unresolved external symbol vigem_target_x360_update referenced in function "unsigned long __cdecl left_joycon_thread(void *)" (?left_joycon_thread@@YAKPAX@Z)
XJoy.obj : error LNK2019: unresolved external symbol hid_init referenced in function main
XJoy.obj : error LNK2019: unresolved external symbol hid_exit referenced in function "void __cdecl initialize_left_joycon(void)" (?initialize_left_joycon@@YAXXZ)
XJoy.obj : error LNK2019: unresolved external symbol hid_enumerate referenced in function "void __cdecl initialize_left_joycon(void)" (?initialize_left_joycon@@YAXXZ)
XJoy.obj : error LNK2019: unresolved external symbol hid_open referenced in function "void __cdecl initialize_left_joycon(void)" (?initialize_left_joycon@@YAXXZ)
XJoy.obj : error LNK2019: unresolved external symbol hid_write referenced in function "void __cdecl subcomm(struct hid_device_ *,unsigned char *,unsigned char,unsigned char,unsigned char,unsigned char)" (?subcomm@@YAXPAUhid_device_@@PAEEEEE@Z)
XJoy.obj : error LNK2019: unresolved external symbol hid_read_timeout referenced in function "void __cdecl subcomm(struct hid_device_ *,unsigned char *,unsigned char,unsigned char,unsigned char,unsigned char)" (?subcomm@@YAXPAUhid_device_@@PAEEEEE@Z)
XJoy.obj : error LNK2019: unresolved external symbol hid_read referenced in function "unsigned long __cdecl left_joycon_thread(void *)" (?left_joycon_thread@@YAKPAX@Z)
XJoy.exe : fatal error LNK1120: 16 unresolved externals

I might just be doing something wrong, but I thought I would let you decide whether or not it's a bug or just me not knowing how things work.

Multiple controllers

is there a way to have more than one pair of joycons working at the same time? I tried but all I got was the first pair registering the inputs on both instances of the application.

unable to find XJoy.cpp

So I downloaded XJoy and I want to fix the controls to where a is a, etc. but i can't find XJoy.cpp.

files
these are all the files I have. How would I change the controls? If I can't change the controls without building the program, would x360ce be able to do it?

Missing dll

Hi, when i'm using the latest version (0.1.8) i get the error that i'm missing the dll: VCRUNTIME140D.dll
Using an older version (0.1.4) works fine.

user cal not found

for me it keeps saying "user cal not found". what can i do about that error? i followed all the instructions and can't seem to make it work.

XJoy doesn't detect joy-cons

It worked perfectly before, but now they aren't detected anymore
I have tried various other methods and Xjoy was the most efficient, but for whatever reason it doesn't detect anything
All dependencies are installed.

Error 0xc000007b

I see that others have been having the same issue a few months back,
I have reinstalled multiple versions of Visual C++ and multiple versions of XJoy but I can't get it to work.
First it gives the error Msvcp140.dll is missing so I found it online seperately and put it in the same folder, but then it brings out the 0xc000007b error and doesn't work, I have installed the ViGE bus drivers and what not and really want to get this working.

Error

Everytime I attempt to open the XJoy.exe I get an application error that reads "The application was unable to start correctly (0xc000007b). How do I fix this? Before this occurred it said I was missing msvcp140.dll and vcruntime140.dll although I had both of them installed so I put the before mentioned dlls into the folder where XJoy.exe resides and got the application error.
error
folder

"could not find __ Joy-Con"

Not sure what I did wrong but when I get to the finding-Joy-Cons step, XJoy says "could not find left Joy-Con" (or right Joy-Con, depending). Both are connected/paired to Windows as "Joy-Con (L)" and "Joy-Con (R)" under "Mouse, keyboard, & pen."

Note a possible complicating factor: I'm running Windows on a Mac via KB Parallels virtual machine. I might be overlooking something as I'm not great with Windows.

Thanks.

could not find left Joy-Con

Hi,

XJoy stopped recognizing my JoyCons. Sometimes the left one, sometimes the right one.
I've re-paired them multiple times (remove and re-pair via windows settings), but it won't change anything.

Running Windows 10 Pro 1903.

Output:

XJoy v0.1.9

initializing emulated Xbox 360 controller...
=> connected successfully
=> added target Xbox 360 Controller

initializing threads...
=> created report mutex
=> left Joy-Con thread started
=> could not find left Joy-Con
press [ENTER] to exit

[BUG] Left JoyCon spams inputs instead of holding inputs

As the title suggests, pressing any button on JoyCon (L) registers way more than 1 input of said button depending on how long the button is held for. Also, ANALOG doesn't work on JoyCon (L) but works fine on JoyCon (R).

EDIT: There's a line I found that maybe the root cause of this.

warning: user calibration data not found

EDIT 2: Don't know what happened, but this can apparently affect both controllers.

How to Customize

I'm having trouble learning how to customize the button inputs and would like to know how?

Complete Freeze

I did everything according to the installation instructions, I get the console, the sound and the output as described. And then my system just freezes. No can do but brute force restart.

I'm using Windows 7 64x.

Option to use each joycon as a full controller?

It would be really usefull if they joycons could be used individually (at least on some games). Is there a way to map de main buttons (axis, triggers and the 4 buttons) to it's xbox counterparts and use 2 joycons as 2 "full"(no really full) xbox controllers?

missing dll files

Hi! I've been browsing the issues page to find a fix but so far everything i tryed has failed.

I've also left a comment on an old issue about the same thing, but just in case I'm oppening a new issue.

When I open the program, it prompts that i'm missing several .dll files wich are on the same folder as xjoy.exe.

I'm on windows 10, installed vgem and all c++ redistributables from 2015 to 2019.

I also tried ussing older versions and I always get the same missing .dll files.

Bus not found error

When I open xjoy it always says bus not found. The problem is I correctly installed the driver and restarted my computer. Any help?

All buttons pressed at all times.

The title is self-explanatory, when I start the program all the buttons are being pressed so nothing is playable. Log looks like this and it just keeps going and going. What am I doing wrong?
Bez názvu

EDIT: I tried both the older and newer versions, 0.14, 0.15, 0.17 and 0.18.

XJoy not reading analog stick controls

Is the software not supposed to be able to pick up the analog stick controls? Everything works fine except the left and right analog sticks. It doesn't even show up in the command lines in XJoy.exe when I try moving them. I've tried it on both my Windows 8.1 and my Windows 10 laptops, and neither works.

I'm on XJoy v0.2.0.

Error in program

When I open xJoy.exe with the Nintendo Switch Joy Cons connected, it says:

XJoy v0.1.5

initializing emulated Xbox 360 controller...
connection error: bus not found
press [ENTER] to exit

image

Right joy-con analog input lag

Hey, I'm not sure if this is simply how the program interacts with games on steam but I've noticed when trying the program that when using the right joy-con analog, there is either an input lag of around half a second to a full second when adjusting camera angles and in other game I've tried, the camera seems to jerk around instead of smoothly following the analog inputs. Is there a way to fix this or something I can do to help in the config or something to that affect?
Games I've tried where the camera proved to be a bit of an issue: Dark Souls III, Risk of Rain 2

Cant find a EXE?

As the title says. I can't find the XJoy.exe file anywhere in the zip. Help?

warning: user calibration data not found

The joycons are connected to my pc using bluetooth, I follow all the steps and everything is good,
but when I open xJoy it says

warning: user calibration data not found
Only in 1 joycon

right analog stick interrupts current action

Turns out this is caused by the left and right reports overwriting each other. We need to keep track of left_buttons and right_buttons separately, and only reset the currently active controller's buttons at the start of button processing for that controller (left_buttons = 0, instead of report.wButtons = 0).

Virtual controller before joy connection.

Dark Souls 2 is only using the first connected controller and there is no way to change it. Could XJoy be implemented as working before connecting Joy Cons?

Right now, XJoy can only be closed if running before connection of Joy Cons. It can be implemented as waiting for Joy Cons to be connected.

Input config.

Look i know u dont have time, but can u please change the input of the buttons to be like the xbox controller like x=Y and B=a pls

i will do it myself but i dont know how :(

i only have left joycon

Hi, I want to be able to just use the left joycon as an xbox controller, but when I start up xjoy is detects the left controller, doesn't detect the right controller, and then tells me to hit enter to quit the program. I was hoping to do some PC gaming on steam using the left joycon as my WASD plus other functions that i'd be able to map in through steam, and then a mouse for aiming. but i didn't realize that i'd need both joycons if that's the case. an Xbox controller does seem to appear in my device list on steam, but the joy con won't do anything still. There's also no virtual controller appearing like the readme file suggests.

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.