Comments (18)
Here 'tis --
wormyrocks@6e50108
from xjoy.
WORKS LIKE A CHARM!!!
Thank YOU!!
from xjoy.
@XepherX thank you so much for this I will look through and see what I can find
from xjoy.
Thank you for this +10 looking forward to it.
from xjoy.
Hey there! Great project - just got it up and running with a few tweaks for my particular setup and it worked like a charm.
I did however run into the 8-direction limitation in a game I'm playing - I'm also a developer and wouldn't mind helping out with the implementation if you have a feature branch in progress I could contribute to or need any help with debug / testing etc.
from xjoy.
@sjobeek I would really appreciate the help as I have no time to work on this. The link @XepherX posted above should help you get started. Basically my understanding is there is some sort of initialization sequence that needs to be sent to the joycon to tell it to send full analog data. Otherwise that data just doesn't get broadcast in any way. By default if you dont do the initialization sequence it will stay in 8-directional mode and the LED will continue blinking as if it is trying to pair, so you may be able to kill two birds with one stone with this. I'd be happy to answer any questions you have about the code or to help brainstorm -- I just don't have time to work on the code myself.
Feel free to simply clone the repo and do your changes there and then I will merge any working pull requests that get sent in.
Thanks again!!
-Sam
from xjoy.
Sam,
I ended up doing a bit more searching and came across another emulation project which has apparently has the analog input configured:
https://github.com/Davidobot/BetterJoyForCemu
This ended up solving my needs for now - thanks again though!
from xjoy.
@sjobeek I would really appreciate the help as I have no time to work on this. The link @XepherX posted above should help you get started. Basically my understanding is there is some sort of initialization sequence that needs to be sent to the joycon to tell it to send full analog data. Otherwise that data just doesn't get broadcast in any way. By default if you dont do the initialization sequence it will stay in 8-directional mode and the LED will continue blinking as if it is trying to pair, so you may be able to kill two birds with one stone with this. I'd be happy to answer any questions you have about the code or to help brainstorm -- I just don't have time to work on the code myself.
Looking at that reverse engineering page, the JoyCon is in "Simple HID Mode", using subcommand 0x03 to set it to "Standard Full mode" would hopefully return the data we want.
I'll look into it a bit and see if I can make any progress
from xjoy.
@HarryPeach thanks I appreciate it. Again I haven't had any time to work on this but I'll test and do a release if you guys can get it working
from xjoy.
I managed to get the JoyCon to report full data, but interpreting it would require lots of refactoring as the format of the report is different to the values coded to the enums. I'll try doing this over the week if I have time
from xjoy.
nice -- would be great if we could use the full data!!
from xjoy.
I won't have very much time to work on this anymore as exams and coursework are piling up over the next few months so I'll write up a bit about what I've gotten working and what I learned here:
The code below will make the JoyCon switch to its full reporting mode:
const unsigned char buf[40] = { 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x03, 0x30 }; hid_write(left_joycon, buf, sizeof(buf));
- The first bit is 0x1 which is the prefix for all subcommands.
- The second bit is 0x0, and is the global packet number, this should increment by one for each packet that you send.
- The next 8 bits are rumble data.
- Bit number 11 is 0x03, which is the subcommand to change the joycon's reporting mode.
- The final bit is 0x30, which is the id for the standard full report mode. By default the joycon is in basic mode which is 0x3F.
Once you are in full report mode the JoyCon will start reporting at 60Hz rather than whenever an input is pressed. The data is sends will also be in this format.
To get the full analog data you have to send a subcommand to read from the SPI Flash the correct calibration data for the specific controller.
I managed to decode the JoyCon data for the left stick in my own fork and have posted it in this gist.
I hope these notes help anyone else who wants to continue work on this issue as well as the following resources:
SPI Flash interfacing: https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/spi_flash_notes.md
Output Reports: https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/bluetooth_hid_notes.md#standard-input-report-format
Subcommands to the controller: https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/bluetooth_hid_subcommands_notes.md
from xjoy.
@HarryPeach thanks a bunch for your work
from xjoy.
@DavidSL448 For the moment I don't have any time to work on this. If analog support was a quick little patch I'd just do it, but the problem is it turns out you have to communicate with the joycons in an entirely different mode, which basically means I'd have to change the commands I use for doing everything, not just analog. I'm really, really hoping that another programmer can step in and help a little bit but eventually I will add this when I find the time. So I guess my answer is no, but only for now.
That said, this would be a very fun project to learn some C++ hint hint nudge nudge ;)
from xjoy.
@sam0x17 I implemented this for the Unity Joy-Con library and am working on a pull request.
from xjoy.
from xjoy.
from xjoy.
now included in https://github.com/sam0x17/XJoy/releases/tag/v0.1.9
Thanks again @wormyrocks!
from xjoy.
Related Issues (20)
- Unable to control anything, does connect HOT 1
- Does this support USB? HOT 2
- Is there a way to turn off the home led ring on version 0.1.8? HOT 1
- Issue Building Solution in Visual Studio 2019 (cant open openvr_api.lib ) HOT 2
- not working
- Doesn't register Joy Cons
- can it support two pairs of joy-cons for one pc? HOT 1
- Xjoy bus not found HOT 2
- my left joycon don't work with xjoy, apparently HOT 7
- Double input on left stick HOT 1
- MSVCP140.dll Not Found And VCRUNTIME140.dll Not Found.
- JoyCon Analog Stick Signal Bounces - Debouncing Needed
- i have made a single left controller fork, what do i do with it? HOT 3
- Crazy left and right stick HOT 1
- the xjoy seems to start lagging when I connect 3+ controllers, but xjoy and another controller seem to be working fine HOT 1
- connection error: bus not found HOT 2
- USB Support possible, what to change? HOT 1
- Left Analog Stick moving on its own when playing Kingdom Hearts 3 on PC HOT 2
- Full analog support not working for 0.2.0 HOT 2
- Multiple inputs with each keystroke
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xjoy.