fossephate / JoyCon-Driver

A vJoy feeder for the Nintendo Switch JoyCons and Pro Controller
https://fosse.co/latest.zip
MIT License
1.07k stars 196 forks source link

Suggestion : Remap gyro controls for separated joycons #108

Open DevilBlackDeath opened 6 years ago

DevilBlackDeath commented 6 years ago

I was going to do it myself, but somehow the source available on github doesn't compile (I even tried to download boost from scratch since some files were missing, I made sure to try building the Release/x86 version, I ended up with an error on an obj file =/).

My suggestion is to make the binding for gyro controls on separated joycons mode different. A lot of softwares like FreePie or AHK won't read the Slider and Dial axises, preventing customization with gyron controls in these softwares. Since at least 3 of the normal axises (I believe it's Z, X rot and Y rot) are not used when joycons are not combined, it would be nice to bind gyro controls to these, allowing custom behaviour for those (like swing detection or that kind of stuff, for ANY game ;) )

If anyone knows what I'm doing wrong for building, I can do it myself, and won't mind any feature as I will be able to program them in myself !

DevilBlackDeath commented 6 years ago

My own supposed fix was to replace, at line 820, this block :

    if (settings.dolphinPointerMode) {
            iReport.wAxisZRot += (jc->gyro.roll * mult);
            iReport.wSlider += (jc->gyro.pitch * mult);
            iReport.wDial += (jc->gyro.yaw * mult);

            iReport.wAxisZRot = clamp(iReport.wAxisZRot, 0, 32678);
            iReport.wSlider = clamp(iReport.wSlider, 0, 32678);
            iReport.wDial = clamp(iReport.wDial, 0, 32678);
        } else {
            iReport.wAxisZRot = 16384 + (jc->gyro.roll * mult);
            iReport.wSlider = 16384 + (jc->gyro.pitch * mult);
            iReport.wDial = 16384 + (jc->gyro.yaw * mult);
        }

by this :

    if (settings.dolphinPointerMode) {
            iReport.wAxisZRot += (jc->gyro.roll * mult);
            iReport.wSlider += (jc->gyro.pitch * mult);
            iReport.wDial += (jc->gyro.yaw * mult);

            iReport.wAxisZRot = clamp(iReport.wAxisZRot, 0, 32678);
            iReport.wSlider = clamp(iReport.wSlider, 0, 32678);
            iReport.wDial = clamp(iReport.wDial, 0, 32678);
        } else {
            if (settings.combineJoyCons) {
                iReport.wAxisZRot = 16384 + (jc->gyro.roll * mult);
                iReport.wSlider = 16384 + (jc->gyro.pitch * mult);
                iReport.wDial = 16384 + (jc->gyro.yaw * mult);
            }
            else {
                iReport.wAxisZ = 16384 + (jc->gyro.roll * mult);
                iReport.wAxisXRot = 16384 + (jc->gyro.pitch * mult);
                iReport.wAxisYRot = 16384 + (jc->gyro.yaw * mult);
            }
        }

I included it in the else of Dolphin mode, since this is a pretty much useless feature in Dolphin mode anyway ;)