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.88k stars 344 forks source link

[Suggestion] Map Gyro to Mouse / Joystick #198

Open B1G11 opened 5 years ago

B1G11 commented 5 years ago

Can you do it? Desire option: Joy Con (Gyroscope) PC-XINPUT Xbox 360 Controller

Is it Possible to enable the GYRO [Joy Con] by Pressing Capture Button or by Software BJFC. Targeting with the Right Joystick on an EGO-Shooter is very difficult and inaccurate.

So the best solution and help would be the GYRO function.

Thanks for your work.

kirk0306 commented 4 years ago

Dear developer, I have the same question, can you add a function that making two joycon into a NS Pro ? So that we can adjust the gyro settings on the steam. Thank you for this.

Davidobot commented 4 years ago

If you "join" the joycons together (by clicking their icon), then it acts as a single Pro Controller. I can't make it look like a whole pro controller to the system though.

kirk0306 commented 4 years ago

Thanks for replying! I understand. Another way is to use one of the GYRO inputs as the right joystick input. I saw this feature on another joycon project, but the one-click pairing in the your software is more convenient

PascalLeroi commented 4 years ago

This was also what I was looking for, but now I'm curious as to why it can't be seen as a Pro Controller systemwide. Is it something that is impossible because of the nature of XInput? How does Steam see a Pro controller? Would really love being able to use the gyro of my Joy-Con, that would make aiming in games so much easier :P Thanks in advance.

aurbit-ogob commented 4 years ago

I made an account to voice my support for this feature request. BetterJoyForCemu is the best way I've found to use JoyCons on a PC, and the addition of gyro aiming for Steam games and other games outside of Cemu would make it just about perfect.

Fossephate's JoyCon-Driver vJoy feeder has some gyro support but it's more difficult to set up and hasn't operated smoothly for me. Also not sure if it supports rumble.

My thoughts on an ideal implementation of gyro aiming:

The ability to use the gyro to output a mouse would also be nice, but is not as important since not all games support simultaneous controller and mouse/keyboard input. Fossephate's JoyCon-Driver can output a mouse and has the assignable button to toggle or hold for gyro output, but doesn't have native support for X-Input or rumble (as far as I know).

Anyways, huge thanks to you Davidobot for creating such a valuable and usable tool. I don't know how to code things like this but if there's something I can do to support please let me know.

Davidobot commented 4 years ago

@aurbit-ogob could you check out the latest nightly and let me know your thoughts?

aurbit-ogob commented 4 years ago

@Davidobot Thanks for the update! This is a great step in the right direction. I tested with the following games:

So far, Half Life 2 installed locally was the only shooter I found that could benefit from the gyro aiming as it exists in this build. But the experience was very rewarding so I hope it can be made to work in other games as well. I tried running betterjoyforcemu.exe as Administrator, but that didn't change anything.

I really appreciate your continued work on this. Let me know what I can do to help.

Davidobot commented 4 years ago

BJFC_v6-12_x64.zip

Peculiar how it works on some and not on others. In the above-attached version, I changed the way I do mouse movement. Could you please test it and see if it works on the programs?

aurbit-ogob commented 4 years ago

This version is working much better, the gyro is outputting a mouse in every situation I have tested, including all the games I tried yesterday. Excellent work, I look forward to using this feature quite often.

I did have some difficulty in Risk of Rain 2 where left stick click is bound to sprint. Since left stick click also centers the mouse, trying to sprint would also change the direction my character was moving. Borderlands 2 has a similar control scheme with left click bound to sprint, but there was no issue there.

It's also a little difficult to move through menus with the gyro always on. I found myself moving the mouse around unintentionally when I would otherwise be using a controller based interface.

I don't want to be too greedy with feature requests, but in my opinion the way to make this perfect would be to have the gyro input as a mouse only when a button is held down. So for example:

For me, I would assign SL on the right joycon to activate the gyro mouse input, since my finger rests there easily. However it could also be useful to assign gyro activation to one of the triggers or bumpers is held down.

Thanks for the revised version and for reading my rambling request!

kirk0306 commented 4 years ago

The quick response of the Gyro mouse is really impressive! I think mapping the Xbox 360 Controller to the keyboard through other software ( such like using steam to set stick to WASD... ) can get a better experience. It works pretty well in those games with mouse display, because of the new reset function.

But for FPS or TPS games, this function will not be available. For my understanding, in FPS or TPS, it can not use the fuction that move the mouse cursor to an absolute position on the screen, it need simulate relative mouse movement. In logitech API, it looks like this:

-- Simulate relative mouse movement upwards in 1 pixel increments
for i = 0, 50 do
    MoveMouseRelative(0, -1)
    Sleep(8)
end

In conclusion, my point is this - most games cannot support mouse and controller input at the same time, we need to choose one bellow to get a better gaming experience, mapping the controller to the keyboard or making the gyro mouse to right stick.

Thank you devs for making a good project!

Davidobot commented 4 years ago

I'll look into implementing both options in due time!

PascalLeroi commented 4 years ago

Awesome that it is getting implemented!! I may be missing something, but do you configure the gyro? Steam sees my joy-con as a Xbox one controller. Thanks :D

Davidobot commented 4 years ago

The gyro cannot be used by Steam - it's for UDP server-compliant programs. Like Cemu, Dolphin and Citra.

PascalLeroi commented 4 years ago

I see, thanks for the quick answer :) I do have to ask how @aurbit-ogob got it working on games like Half Life 2.

Davidobot commented 4 years ago

@aurbit-ogob turned on the gyro-to-mouse setting and basically emulated looking around using a mouse with gyro :)

PascalLeroi commented 4 years ago

I turned that option on as well. How would I go about emulating a mouse? I tried using Xpadder, but it can't see the gyro. Thanks ^^

aurbit-ogob commented 4 years ago

@PascalLeroi did you type "mouse" in the setting like in the attached screenshot? As soon as I did that and then clicked Apply my right joycon started controlling the mouse.

It's listed in the readme under App Settings, 3rd bullet from the bottom: "GyroToJoyOrMouse (default: none) "mouse" allows you to use gyro input as mouse input. Press stick buttons to reset"

BetterJoyForCemu_HmEaRnhG89

PascalLeroi commented 4 years ago

@PascalLeroi did you type "mouse" in the setting like in the attached screenshot? As soon as I did that and then clicked Apply my right joycon started controlling the mouse.

It's listed in the readme under App Settings, 3rd bullet from the bottom: "GyroToJoyOrMouse (default: none) "mouse" allows you to use gyro input as mouse input. Press stick buttons to reset"

BetterJoyForCemu_HmEaRnhG89

Awesome, gonna try that. I thought you had to type in true :p thanks ^^

PascalLeroi commented 4 years ago

Just wanted to let you know that it works great! Tried it out in Skyrim and works pretty great. Gotta figure out how to center it and then it should be good to go :D Thanks :D

Davidobot commented 4 years ago

Gotta figure out how to center it and then it should be good to go :D Thanks :D

If you press either stick down (stick press, L3, R3, etc) then it centres it to the middle of your primary monitor.

rsilva48 commented 4 years ago

Is there a way to map some button to left or right click in the mouse?

Davidobot commented 4 years ago

@rsilva48 not yet! Why, if I may, would you like to map keyboard to joycon? Usually games allow you to mix keyboard and joystick inputs.

rsilva48 commented 4 years ago

Oh because I'm using bluestacks and sometimes I just need to move around some menus with the mouse with items that aren't always in the same place so I can't bind them to a certain key

rsilva48 commented 4 years ago

I could even use it to navigate through Windows, I just installed antimicro and assigned certain buttons to some keyboard and mouse buttons, because bluestacks wont let me use plus, or minus

aurbit-ogob commented 3 years ago

@Davidobot I know that activate-gyro button has been implemented since version 6.1, but I only recently had a chance to check it out. It's working great, exactly as I had hoped. Thank you for adding that feature!