Davidobot / BetterJoy

Allows the Nintendo Switch Pro Controller, Joycons and SNES controller to be used with CEMU, Citra, Dolphin, Yuzu and as generic XInput
Other
3.74k stars 340 forks source link

Add Support For Nintendo Switch N64 Controller #866

Open mattdog1000000 opened 2 years ago

mattdog1000000 commented 2 years ago

It is possible to use the "Add Controller" button and add the Nintendo Switch N64 Controller using the "Add 3rd-Party Controllers" mapping window, but this does not map the joy stick if mapping a "Pro Controller" or "Right Joycon" (if "Left Joycon" is used, the joy stick is mapped but many buttons are not).

If the mapping was handled as cleanly as the Nintendo Switch SNES Controller is, that would be ideal -- but any support for the analog stick with all functioning buttons would be excellent!

v5tge commented 2 years ago

Yes, please. I would love that and it would make this program even better.

mattdog1000000 commented 2 years ago

If it would be easier to just add a "swap sticks" option, that would also provide all the functionality that is needed for the "Add 3rd-Party Controllers" to get Nintendo Switch N64 Controllers running, too.

mattdog1000000 commented 2 years ago

I don't really know how to use github, but I attempted to add the n64 support here: https://github.com/mattdog1000000/BetterJoy/releases/tag/n64

v5tge commented 2 years ago

I don't really know how to use github, but I attempted to add the n64 support here: https://github.com/mattdog1000000/BetterJoy/releases/tag/n64

Can't try it. I don't have a n64 controller yet, but at least I know as soon as I get one I will be able to use it on pc without issues, so thanks

Phinixx commented 2 years ago

I don't really know how to use github, but I attempted to add the n64 support here: https://github.com/mattdog1000000/BetterJoy/releases/tag/n64

I just tested it and it works great, just needed to recalibrate the stick in windows. Nice work.

Nerrel commented 2 years ago

mattdog1000000 do you mind if I ask how you decided the stick calibration? Testing the controller directly (no betterjoy) via Mupen64plus yielded values of only about 55-60, but there are a lot of complications with that:
image of stick

In Project64 using N-rage, which lets you control the range manually, the stick seems to respond perfectly with range set to 100%. I think it's outputting 85 for its raw value, like an original stick, but the tester unfortunately doesn't work in Project64 so I can't confirm it.

I think Mupen64plus automatically scales range to 66% because it only expects modern sticks, which ends up reducing the Switch N64's 85 down to the 50-60 range I saw in the tests. Ares does something similar. It's hard to tell what exactly is going on due to all the plugin quirks, so if you could shed any light on what the stick is actually outputting and how you measured it I'd appreciate it.

mattdog1000000 commented 2 years ago

@Nerrel I just eyeballed numbers -- nothing scientific (and almost certainly not ideal).

andrebrait commented 2 years ago

@mattdog1000000 you just need to open a pull request to this repository, I believe. And possibly rebase your changes on this repository's master branch first so you can have a clean PR.

Avoozle commented 1 year ago

I can't get the c-buttons of the Switch N64 controller with Better Joy to work on Project 64.

mattdog1000000 commented 1 year ago

I can't get the c-buttons of the Switch N64 controller with Better Joy to work on Project 64.

I recommend installing HIDGuardian using the included "HIDGuardian Install (Run as Admin).bat" file -- otherwise Project 64 seems to get all sorts of bad inputs from the N64 controller simultaneously.

Pasta-55 commented 1 year ago

@mattdog1000000 I'm sorry to necro this thread, and not directly related to original BetterJoy repository, however, could you please rewrite the code to assign Z-Button and C-Down as buttons, not as a Z-Rotation on the 360 controller?

Using Z-Rotation for buttons makes it impossible to double press, and also makes it unable to bind controls on certain emulator

I can't get the c-buttons of the Switch N64 controller with Better Joy to work on Project 64.

(Pj64 seems to be the case; my assumption is that the emulator cannot bind Z-Rotation as a button)

Since I'm not a coder (sorry for that), I can't (although I can try with my basic coding knowledge) modify your code on N64 version, and also I'm not sure whether there is a limitation for this matter or not.

mattdog1000000 commented 1 year ago

@mattdog1000000 I'm sorry to necro this thread, and not directly related to original BetterJoy repository, however, could you please rewrite the code to assign Z-Button and C-Down as buttons, not as a Z-Rotation on the 360 controller?

Using Z-Rotation for buttons makes it impossible to double press, and also makes it unable to bind controls on certain emulator

I can't get the c-buttons of the Switch N64 controller with Better Joy to work on Project 64.

(Pj64 seems to be the case; my assumption is that the emulator cannot bind Z-Rotation as a button)

Since I'm not a coder (sorry for that), I can't (although I can try with my basic coding knowledge) modify your code on N64 version, and also I'm not sure whether there is a limitation for this matter or not.

I'm not sure what you mean by "double press," but I recommend using the N-Rage plugin that is included with Project 64. image

I personally prefer using Simple64 over Project 64, but I hope that helps in any case :)

Pasta-55 commented 1 year ago

@mattdog1000000 Thanks for the quick reply! What I meant by "double press", it was about pushing the both buttons (Z-Trigger and C-Down) at the same time.

Pressing Z-Trigger (increases Z-rotation (Z軸)) Z-Trigger

Pressing C-Down (decreases Z-rotation (Z軸)) C-Down

Since those button share the axis, pressing buttons at the same time would result neutralizing the axis, practically negates the input.

And for emulator, actually I mainly uses Mupen64plus core in RetroArch, so it is totally fine for binding inputs! ParaLLEl-RDP is awesome... It might take time to set it up properly, but the emulation accuracy is unmatched.

mattdog1000000 commented 1 year ago

@Pasta-55 I see! I think it would be reasonable to map the c-down to a right stick click click instead.

I totally agree on ParaLLEl-RDP -- Mupen64Plus (now Simple64) is great.

Perhaps I'll branch from the most recent build of BetterJoy when I have some time in the future to make merging the features back into mainline more feasible. Mappings that are compatible with more emulators/plugins would be for the best, regardless. :)

njscode commented 1 year ago

@mattdog1000000 is it possible to remap the c down button to something else? Which files are responsible for the button mappings, maybe I can just remap it myself.

mattdog1000000 commented 1 year ago

Should totally be possible -- I'm not sure where it's at but it shouldn't be hard. Go for it! :)

njscode commented 1 year ago

Did you map and choose the buttons for the n64 controllers mapping yourself?

mattdog1000000 commented 1 year ago

Did you map and choose the buttons for the n64 controllers mapping yourself?

Nope.

mattdog1000000 commented 1 year ago

I think I found the location -- I'll go ahead and update the code and post a new release on the branch I created :) Edit: new version here: https://github.com/mattdog1000000/BetterJoy/releases/tag/n64_no_triggers

njscode commented 1 year ago

Thank you so much, now it works flawlessly, just had to enable useHIDG in the betterjoy settings so it would recognize the N64 pad

GinoMoena commented 7 months ago

Hi! i added n64 control support with the following mapping:

hope you like it! https://github.com/GinoMoena/BetterJoy/releases/tag/7.1.1