- added 4 key binding for thumb rest for Quest 2 controller

- inverted key bind mousewheel down/up
- added missing key definitions on doomkeys.h
This commit is contained in:
Emanuele Disco 2021-08-17 22:37:53 +09:00
parent 3f19e085a4
commit a035e9ab4e
2 changed files with 123 additions and 7 deletions

View file

@ -198,7 +198,7 @@ void HandleInput_Default( int control_scheme, ovrInputStateGamepad *pFootTrackin
vec3_t rotation = {0}; vec3_t rotation = {0};
QuatToYawPitchRoll(pOffTracking->HeadPose.Pose.Orientation, rotation, offhandangles); QuatToYawPitchRoll(pOffTracking->HeadPose.Pose.Orientation, rotation, offhandangles);
if (vr_moveuseoffhand != 0) { if (vr_moveuseoffhand) {
controllerYawHeading = offhandangles[YAW] - hmdorientation[YAW]; controllerYawHeading = offhandangles[YAW] - hmdorientation[YAW];
} else { } else {
controllerYawHeading = 0.0f; controllerYawHeading = 0.0f;
@ -303,6 +303,20 @@ void HandleInput_Default( int control_scheme, ovrInputStateGamepad *pFootTrackin
} }
} }
} }
Joy_GenerateButtonEvents((pSecondaryTrackedRemoteOld->Joystick.x > 0.7f ? 1 : 0), (pSecondaryTrackedRemoteNew->Joystick.x > 0.7f ? 1 : 0), 1, KEY_JOYAXIS1PLUS);
Joy_GenerateButtonEvents((pSecondaryTrackedRemoteOld->Joystick.x < -0.7f ? 1 : 0), (pSecondaryTrackedRemoteNew->Joystick.x < -0.7f ? 1 : 0), 1, KEY_JOYAXIS1MINUS);
Joy_GenerateButtonEvents((pPrimaryTrackedRemoteOld->Joystick.x > 0.7f ? 1 : 0), (pPrimaryTrackedRemoteNew->Joystick.x > 0.7f ? 1 : 0), 1, KEY_JOYAXIS2PLUS);
Joy_GenerateButtonEvents((pPrimaryTrackedRemoteOld->Joystick.x < -0.7f ? 1 : 0), (pPrimaryTrackedRemoteNew->Joystick.x < -0.7f ? 1 : 0), 1, KEY_JOYAXIS2MINUS);
Joy_GenerateButtonEvents((pSecondaryTrackedRemoteOld->Joystick.y < -0.7f ? 1 : 0), (pSecondaryTrackedRemoteNew->Joystick.y < -0.7f ? 1 : 0), 1, KEY_JOYAXIS3PLUS);
Joy_GenerateButtonEvents((pSecondaryTrackedRemoteOld->Joystick.y > 0.7f ? 1 : 0), (pSecondaryTrackedRemoteNew->Joystick.y > 0.7f ? 1 : 0), 1, KEY_JOYAXIS3MINUS);
Joy_GenerateButtonEvents((pPrimaryTrackedRemoteOld->Joystick.y < -0.7f ? 1 : 0), (pPrimaryTrackedRemoteNew->Joystick.y < -0.7f ? 1 : 0), 1, KEY_JOYAXIS4PLUS);
Joy_GenerateButtonEvents((pPrimaryTrackedRemoteOld->Joystick.y > 0.7f ? 1 : 0), (pPrimaryTrackedRemoteNew->Joystick.y > 0.7f ? 1 : 0), 1, KEY_JOYAXIS4MINUS);
// in level
} }
{ {
@ -318,18 +332,18 @@ void HandleInput_Default( int control_scheme, ovrInputStateGamepad *pFootTrackin
between(-1.0f, pPrimaryTrackedRemoteNew->Joystick.y, -0.8f))) { between(-1.0f, pPrimaryTrackedRemoteNew->Joystick.y, -0.8f))) {
if (itemSwitched == 0) { if (itemSwitched == 0) {
if (between(0.8f, pPrimaryTrackedRemoteNew->Joystick.y, 1.0f)) { if (between(0.8f, pPrimaryTrackedRemoteNew->Joystick.y, 1.0f)) {
Joy_GenerateButtonEvents(0, 1, 1, KEY_MWHEELDOWN); Joy_GenerateButtonEvents(0, 1, 1, KEY_MWHEELUP);
itemSwitched = 1; itemSwitched = 1;
} else { } else {
Joy_GenerateButtonEvents(0, 1, 1, KEY_MWHEELUP); Joy_GenerateButtonEvents(0, 1, 1, KEY_MWHEELDOWN);
itemSwitched = 2; itemSwitched = 2;
} }
} }
} else { } else {
if (itemSwitched == 1) { if (itemSwitched == 1) {
Joy_GenerateButtonEvents(1, 0, 1, KEY_MWHEELDOWN);
} else if (itemSwitched == 2) {
Joy_GenerateButtonEvents(1, 0, 1, KEY_MWHEELUP); Joy_GenerateButtonEvents(1, 0, 1, KEY_MWHEELUP);
} else if (itemSwitched == 2) {
Joy_GenerateButtonEvents(1, 0, 1, KEY_MWHEELDOWN);
} }
itemSwitched = 0; itemSwitched = 0;
} }
@ -385,7 +399,10 @@ void HandleInput_Default( int control_scheme, ovrInputStateGamepad *pFootTrackin
((pDominantTrackedRemoteNew->Buttons & ovrButton_Joystick) != 0) && !dominantGripPushedNew ? 1 : 0, ((pDominantTrackedRemoteNew->Buttons & ovrButton_Joystick) != 0) && !dominantGripPushedNew ? 1 : 0,
1, KEY_ENTER); 1, KEY_ENTER);
//No Default Binding
Joy_GenerateButtonEvents(((pDominantTrackedRemoteOld->Touches & ovrTouch_ThumbRest) != 0) && !dominantGripPushedOld ? 1 : 0,
((pDominantTrackedRemoteNew->Touches & ovrTouch_ThumbRest) != 0) && !dominantGripPushedNew ? 1 : 0,
1, KEY_JOY5);
if (vr_secondarybuttonmappings) { if (vr_secondarybuttonmappings) {
//Dominant Hand - Secondary keys (grip pushed) //Dominant Hand - Secondary keys (grip pushed)
@ -418,6 +435,13 @@ void HandleInput_Default( int control_scheme, ovrInputStateGamepad *pFootTrackin
((pDominantTrackedRemoteNew->Buttons & ovrButton_Joystick) != 0) && ((pDominantTrackedRemoteNew->Buttons & ovrButton_Joystick) != 0) &&
dominantGripPushedNew ? 1 : 0, dominantGripPushedNew ? 1 : 0,
1, KEY_TAB); 1, KEY_TAB);
//No Default Binding
Joy_GenerateButtonEvents(
((pDominantTrackedRemoteOld->Touches & ovrTouch_ThumbRest) != 0) && dominantGripPushedOld ? 1 : 0,
((pDominantTrackedRemoteNew->Touches & ovrTouch_ThumbRest) != 0) && dominantGripPushedNew ? 1 : 0,
1, KEY_JOY6);
} else { } else {
//Use grip as an extra button //Use grip as an extra button
//Alt-Fire //Alt-Fire
@ -451,6 +475,11 @@ void HandleInput_Default( int control_scheme, ovrInputStateGamepad *pFootTrackin
((pOffTrackedRemoteNew->Buttons & ovrButton_Joystick) != 0) && !dominantGripPushedNew ? 1 : 0, ((pOffTrackedRemoteNew->Buttons & ovrButton_Joystick) != 0) && !dominantGripPushedNew ? 1 : 0,
1, KEY_SPACE); 1, KEY_SPACE);
//No Default Binding
Joy_GenerateButtonEvents(((pOffTrackedRemoteOld->Touches & ovrTouch_ThumbRest) != 0) && !dominantGripPushedOld ? 1 : 0,
((pOffTrackedRemoteNew->Touches & ovrTouch_ThumbRest) != 0) && !dominantGripPushedNew ? 1 : 0,
1, KEY_JOY7);
if (!vr_twohandedweapons) if (!vr_twohandedweapons)
{ {
Joy_GenerateButtonEvents( Joy_GenerateButtonEvents(
@ -496,6 +525,12 @@ void HandleInput_Default( int control_scheme, ovrInputStateGamepad *pFootTrackin
dominantGripPushedNew ? 1 : 0, dominantGripPushedNew ? 1 : 0,
1, KEY_HOME); 1, KEY_HOME);
//No Default Binding
Joy_GenerateButtonEvents(
((pOffTrackedRemoteOld->Touches & ovrTouch_ThumbRest) != 0) && dominantGripPushedOld ? 1 : 0,
((pOffTrackedRemoteNew->Touches & ovrTouch_ThumbRest) != 0) && dominantGripPushedNew ? 1 : 0,
1, KEY_JOY8);
if (!vr_twohandedweapons) if (!vr_twohandedweapons)
{ {
Joy_GenerateButtonEvents( Joy_GenerateButtonEvents(

View file

@ -195,7 +195,88 @@
#define KEY_JOY4AXIS8PLUS 0x222 #define KEY_JOY4AXIS8PLUS 0x222
#define KEY_JOY4AXIS8MINUS 0x223 #define KEY_JOY4AXIS8MINUS 0x223
#define NUM_KEYS 0x224 #define KEY_PAD2_LTHUMB_RIGHT 0x224
#define KEY_PAD2_LTHUMB_LEFT 0x225
#define KEY_PAD2_LTHUMB_DOWN 0x226
#define KEY_PAD2_LTHUMB_UP 0x227
#define KEY_PAD2_RTHUMB_RIGHT 0x228
#define KEY_PAD2_RTHUMB_LEFT 0x229
#define KEY_PAD2_RTHUMB_DOWN 0x22A
#define KEY_PAD2_RTHUMB_UP 0x22B
#define KEY_PAD2_DPAD_UP 0x22C
#define KEY_PAD2_DPAD_DOWN 0x22D
#define KEY_PAD2_DPAD_LEFT 0x22E
#define KEY_PAD2_DPAD_RIGHT 0x22F
#define KEY_PAD2_START 0x230
#define KEY_PAD2_BACK 0x231
#define KEY_PAD2_LTHUMB 0x232
#define KEY_PAD2_RTHUMB 0x233
#define KEY_PAD2_LSHOULDER 0x234
#define KEY_PAD2_RSHOULDER 0x235
#define KEY_PAD2_LTRIGGER 0x236
#define KEY_PAD2_RTRIGGER 0x237
#define KEY_PAD2_A 0x238
#define KEY_PAD2_B 0x239
#define KEY_PAD2_X 0x23A
#define KEY_PAD2_Y 0x23B
#define KEY_PAD3_LTHUMB_RIGHT 0x23C
#define KEY_PAD3_LTHUMB_LEFT 0x23D
#define KEY_PAD3_LTHUMB_DOWN 0x23E
#define KEY_PAD3_LTHUMB_UP 0x23F
#define KEY_PAD3_RTHUMB_RIGHT 0x240
#define KEY_PAD3_RTHUMB_LEFT 0x241
#define KEY_PAD3_RTHUMB_DOWN 0x242
#define KEY_PAD3_RTHUMB_UP 0x243
#define KEY_PAD3_DPAD_UP 0x244
#define KEY_PAD3_DPAD_DOWN 0x245
#define KEY_PAD3_DPAD_LEFT 0x246
#define KEY_PAD3_DPAD_RIGHT 0x247
#define KEY_PAD3_START 0x248
#define KEY_PAD3_BACK 0x249
#define KEY_PAD3_LTHUMB 0x24A
#define KEY_PAD3_RTHUMB 0x24B
#define KEY_PAD3_LSHOULDER 0x24C
#define KEY_PAD3_RSHOULDER 0x24D
#define KEY_PAD3_LTRIGGER 0x24E
#define KEY_PAD3_RTRIGGER 0x24F
#define KEY_PAD3_A 0x250
#define KEY_PAD3_B 0x251
#define KEY_PAD3_X 0x252
#define KEY_PAD3_Y 0x253
#define KEY_PAD4_LTHUMB_RIGHT 0x254
#define KEY_PAD4_LTHUMB_LEFT 0x255
#define KEY_PAD4_LTHUMB_DOWN 0x256
#define KEY_PAD4_LTHUMB_UP 0x257
#define KEY_PAD4_RTHUMB_RIGHT 0x258
#define KEY_PAD4_RTHUMB_LEFT 0x259
#define KEY_PAD4_RTHUMB_DOWN 0x25A
#define KEY_PAD4_RTHUMB_UP 0x25B
#define KEY_PAD4_DPAD_UP 0x25C
#define KEY_PAD4_DPAD_DOWN 0x25D
#define KEY_PAD4_DPAD_LEFT 0x25E
#define KEY_PAD4_DPAD_RIGHT 0x25F
#define KEY_PAD4_START 0x260
#define KEY_PAD4_BACK 0x261
#define KEY_PAD4_LTHUMB 0x262
#define KEY_PAD4_RTHUMB 0x263
#define KEY_PAD4_LSHOULDER 0x264
#define KEY_PAD4_RSHOULDER 0x265
#define KEY_PAD4_LTRIGGER 0x266
#define KEY_PAD4_RTRIGGER 0x267
#define KEY_PAD4_A 0x268
#define KEY_PAD4_B 0x269
#define KEY_PAD4_X 0x26A
#define KEY_PAD4_Y 0x26B
#define NUM_KEYS 0x26C
#endif //QZDOOM_DOOMKEYS_H #endif //QZDOOM_DOOMKEYS_H