Giter VIP home page Giter VIP logo

Comments (18)

wormyrocks avatar wormyrocks commented on September 24, 2024 1

Here 'tis --
wormyrocks@6e50108

from xjoy.

Liberte78 avatar Liberte78 commented on September 24, 2024 1

WORKS LIKE A CHARM!!!
Thank YOU!!

from xjoy.

sam0x17 avatar sam0x17 commented on September 24, 2024

@XepherX thank you so much for this I will look through and see what I can find

from xjoy.

AceHack avatar AceHack commented on September 24, 2024

Thank you for this +10 looking forward to it.

from xjoy.

sjobeek avatar sjobeek commented on September 24, 2024

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.

sam0x17 avatar sam0x17 commented on September 24, 2024

@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.

sjobeek avatar sjobeek commented on September 24, 2024

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.

HarryPeach avatar HarryPeach commented on September 24, 2024

@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.

sam0x17 avatar sam0x17 commented on September 24, 2024

@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.

HarryPeach avatar HarryPeach commented on September 24, 2024

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.

sam0x17 avatar sam0x17 commented on September 24, 2024

nice -- would be great if we could use the full data!!

from xjoy.

HarryPeach avatar HarryPeach commented on September 24, 2024

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.

sam0x17 avatar sam0x17 commented on September 24, 2024

@HarryPeach thanks a bunch for your work

from xjoy.

sam0x17 avatar sam0x17 commented on September 24, 2024

@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.

wormyrocks avatar wormyrocks commented on September 24, 2024

@sam0x17 I implemented this for the Unity Joy-Con library and am working on a pull request.

from xjoy.

sam0x17 avatar sam0x17 commented on September 24, 2024

from xjoy.

sam0x17 avatar sam0x17 commented on September 24, 2024

from xjoy.

sam0x17 avatar sam0x17 commented on September 24, 2024

now included in https://github.com/sam0x17/XJoy/releases/tag/v0.1.9

Thanks again @wormyrocks!

from xjoy.

Related Issues (20)

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.