questzdoom/Projects/Android/jni/QzDoom/VrInputDefault.cpp

566 lines
24 KiB
C++
Raw Normal View History

/************************************************************************************
Filename : VrInputDefault.c
Content : Handles default controller input
Created : August 2019
Authors : Simon Brown
*************************************************************************************/
2022-12-27 23:27:29 +00:00
#include <android/keycodes.h>
#include "VrInput.h"
2020-03-05 22:30:08 +00:00
#include "doomkeys.h"
extern ovrInputStateTrackedRemote leftTrackedRemoteState_old;
extern ovrInputStateTrackedRemote leftTrackedRemoteState_new;
2022-12-27 23:27:29 +00:00
extern ovrTrackedController leftRemoteTracking_new;
extern ovrInputStateTrackedRemote rightTrackedRemoteState_old;
extern ovrInputStateTrackedRemote rightTrackedRemoteState_new;
2022-12-27 23:27:29 +00:00
extern ovrTrackedController rightRemoteTracking_new;
extern float remote_movementSideways;
extern float remote_movementForward;
extern float remote_movementUp;
extern float positional_movementSideways;
extern float positional_movementForward;
extern float snapTurn;
extern float cinemamodeYaw;
extern float cinemamodePitch;
2022-12-27 23:27:29 +00:00
extern bool weaponStabilised;
2020-03-07 00:31:49 +00:00
int getGameState();
int getMenuState();
2020-03-07 00:31:49 +00:00
void Joy_GenerateButtonEvents(int oldbuttons, int newbuttons, int numbuttons, int base);
2020-06-07 21:32:20 +00:00
float getViewpointYaw();
2020-03-07 00:31:49 +00:00
2022-12-27 23:27:29 +00:00
void HandleInput_Default( int control_scheme, ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, ovrInputStateTrackedRemote *pDominantTrackedRemoteOld, ovrTrackedController* pDominantTracking,
ovrInputStateTrackedRemote *pOffTrackedRemoteNew, ovrInputStateTrackedRemote *pOffTrackedRemoteOld, ovrTrackedController* pOffTracking,
int domButton1, int domButton2, int offButton1, int offButton2 )
{
//Menu button - invoke menu
2022-12-27 23:27:29 +00:00
handleTrackedControllerButton(&leftTrackedRemoteState_new, &leftTrackedRemoteState_old, xrButton_Enter, KEY_ESCAPE);
handleTrackedControllerButton(&rightTrackedRemoteState_new, &rightTrackedRemoteState_old, xrButton_Enter, KEY_ESCAPE); // For users who have switched the buttons
//Dominant Grip works like a shift key
2022-12-27 23:27:29 +00:00
bool dominantGripPushedOld = vr_secondary_button_mappings ?
(pDominantTrackedRemoteOld->Buttons & xrButton_GripTrigger) : false;
bool dominantGripPushedNew = vr_secondary_button_mappings ?
(pDominantTrackedRemoteNew->Buttons & xrButton_GripTrigger) : false;
ovrInputStateTrackedRemote *pPrimaryTrackedRemoteNew, *pPrimaryTrackedRemoteOld, *pSecondaryTrackedRemoteNew, *pSecondaryTrackedRemoteOld;
2022-12-27 23:27:29 +00:00
if (vr_switch_sticks)
{
pPrimaryTrackedRemoteNew = pOffTrackedRemoteNew;
pPrimaryTrackedRemoteOld = pOffTrackedRemoteOld;
pSecondaryTrackedRemoteNew = pDominantTrackedRemoteNew;
pSecondaryTrackedRemoteOld = pDominantTrackedRemoteOld;
}
else
{
pPrimaryTrackedRemoteNew = pDominantTrackedRemoteNew;
pPrimaryTrackedRemoteOld = pDominantTrackedRemoteOld;
pSecondaryTrackedRemoteNew = pOffTrackedRemoteNew;
pSecondaryTrackedRemoteOld = pOffTrackedRemoteOld;
}
//All this to allow stick and button switching!
uint32_t primaryButtonsNew;
uint32_t primaryButtonsOld;
uint32_t secondaryButtonsNew;
uint32_t secondaryButtonsOld;
int primaryButton1;
int primaryButton2;
int secondaryButton1;
int secondaryButton2;
if (control_scheme == 11) // Left handed Alt
{
primaryButtonsNew = pOffTrackedRemoteNew->Buttons;
primaryButtonsOld = pOffTrackedRemoteOld->Buttons;
secondaryButtonsNew = pDominantTrackedRemoteNew->Buttons;
secondaryButtonsOld = pDominantTrackedRemoteOld->Buttons;
primaryButton1 = offButton1;
primaryButton2 = offButton2;
secondaryButton1 = domButton1;
secondaryButton2 = domButton2;
}
else // Left and right handed
{
primaryButtonsNew = pDominantTrackedRemoteNew->Buttons;
primaryButtonsOld = pDominantTrackedRemoteOld->Buttons;
secondaryButtonsNew = pOffTrackedRemoteNew->Buttons;
secondaryButtonsOld = pOffTrackedRemoteOld->Buttons;
primaryButton1 = domButton1;
primaryButton2 = domButton2;
secondaryButton1 = offButton1;
secondaryButton2 = offButton2;
}
//In cinema mode, right-stick controls mouse
const float mouseSpeed = 3.0f;
if (cinemamode)
{
if (fabs(pPrimaryTrackedRemoteNew->Joystick.x) > 0.1f) {
cinemamodeYaw -= mouseSpeed * pPrimaryTrackedRemoteNew->Joystick.x;
}
if (fabs(pPrimaryTrackedRemoteNew->Joystick.y) > 0.1f) {
cinemamodePitch -= mouseSpeed * pPrimaryTrackedRemoteNew->Joystick.y;
}
}
// Only do the following if we are definitely not in the menu
if (getMenuState() == 0)
{
2022-12-27 23:27:29 +00:00
float distance = sqrtf(powf(pOffTracking->Pose.position.x -
pDominantTracking->Pose.position.x, 2) +
powf(pOffTracking->Pose.position.y -
pDominantTracking->Pose.position.y, 2) +
powf(pOffTracking->Pose.position.z -
pDominantTracking->Pose.position.z, 2));
//Turn on weapon stabilisation?
2022-12-27 23:27:29 +00:00
if (vr_two_handed_weapons &&
(pOffTrackedRemoteNew->Buttons & xrButton_GripTrigger) !=
(pOffTrackedRemoteOld->Buttons & xrButton_GripTrigger)) {
2022-12-27 23:27:29 +00:00
if (pOffTrackedRemoteNew->Buttons & xrButton_GripTrigger) {
if (distance < 0.50f) {
2020-03-05 22:30:08 +00:00
weaponStabilised = true;
}
} else {
2020-03-05 22:30:08 +00:00
weaponStabilised = false;
}
}
//dominant hand stuff first
{
///Weapon location relative to view
2022-12-27 23:27:29 +00:00
weaponoffset[0] = pDominantTracking->Pose.position.x - hmdPosition[0];
weaponoffset[1] = pDominantTracking->Pose.position.y - hmdPosition[1];
weaponoffset[2] = pDominantTracking->Pose.position.z - hmdPosition[2];
vec2_t v;
float yawRotation = getViewpointYaw() - hmdorientation[YAW];
rotateAboutOrigin(weaponoffset[0], weaponoffset[2], -yawRotation, v);
weaponoffset[0] = v[1];
weaponoffset[2] = v[0];
//Set gun angles
vec3_t rotation = {0};
2022-12-27 23:27:29 +00:00
rotation[PITCH] = vr_weaponRotate;
QuatToYawPitchRoll(pDominantTracking->Pose.orientation, rotation, weaponangles);
if (weaponStabilised) {
2022-12-27 23:27:29 +00:00
float z = pOffTracking->Pose.position.z -
pDominantTracking->Pose.position.z;
float x = pOffTracking->Pose.position.x -
pDominantTracking->Pose.position.x;
float y = pOffTracking->Pose.position.y -
pDominantTracking->Pose.position.y;
float zxDist = length(x, z);
if (zxDist != 0.0f && z != 0.0f) {
2022-12-27 23:27:29 +00:00
VectorSet(weaponangles, -RAD2DEG(atanf(y / zxDist)), -RAD2DEG(atan2f(x, -z)),
weaponangles[ROLL]);
}
}
}
float controllerYawHeading = 0.0f;
2020-03-09 23:59:38 +00:00
//off-hand stuff
{
2022-12-27 23:27:29 +00:00
offhandoffset[0] = pOffTracking->Pose.position.x - hmdPosition[0];
offhandoffset[1] = pOffTracking->Pose.position.y - hmdPosition[1];
offhandoffset[2] = pOffTracking->Pose.position.z - hmdPosition[2];
vec2_t v;
float yawRotation = getViewpointYaw() - hmdorientation[YAW];
rotateAboutOrigin(offhandoffset[0], offhandoffset[2], -yawRotation, v);
offhandoffset[0] = v[1];
offhandoffset[2] = v[0];
vec3_t rotation = {0};
2022-12-27 23:27:29 +00:00
rotation[PITCH] = vr_weaponRotate;
QuatToYawPitchRoll(pOffTracking->Pose.orientation, rotation, offhandangles);
2022-12-27 23:27:29 +00:00
if (vr_move_use_offhand) {
controllerYawHeading = offhandangles[YAW] - hmdorientation[YAW];
} else {
controllerYawHeading = 0.0f;
}
}
2020-03-10 18:51:35 +00:00
//Positional movement
{
ALOGV(" Right-Controller-Position: %f, %f, %f",
2022-12-27 23:27:29 +00:00
pDominantTracking->Pose.position.x,
pDominantTracking->Pose.position.y,
pDominantTracking->Pose.position.z);
vec2_t v;
rotateAboutOrigin(positionDeltaThisFrame[0], positionDeltaThisFrame[2],
-(doomYaw - hmdorientation[YAW]), v);
positional_movementSideways = v[1];
positional_movementForward = v[0];
ALOGV(" positional_movementSideways: %f, positional_movementForward: %f",
positional_movementSideways,
positional_movementForward);
}
2020-03-09 23:59:38 +00:00
//Off-hand specific stuff
{
ALOGV(" Left-Controller-Position: %f, %f, %f",
2022-12-27 23:27:29 +00:00
pOffTracking->Pose.position.x,
pOffTracking->Pose.position.y,
pOffTracking->Pose.position.z);
//Teleport - only does anything if vr_teleport cvar is true
2022-12-27 23:27:29 +00:00
if (vr_teleport) {
2020-04-23 19:21:00 +00:00
if ((pSecondaryTrackedRemoteOld->Joystick.y > 0.7f) && !ready_teleport) {
ready_teleport = true;
2020-04-23 19:21:00 +00:00
} else if ((pSecondaryTrackedRemoteOld->Joystick.y < 0.7f) && ready_teleport) {
ready_teleport = false;
trigger_teleport = true;
}
}
//Apply a filter and quadratic scaler so small movements are easier to make
//and we don't get movement jitter when the joystick doesn't quite center properly
float dist = length(pSecondaryTrackedRemoteNew->Joystick.x, pSecondaryTrackedRemoteNew->Joystick.y);
float nlf = nonLinearFilter(dist);
2022-12-27 23:27:29 +00:00
float x = nlf * pSecondaryTrackedRemoteNew->Joystick.x;
float y = nlf * pSecondaryTrackedRemoteNew->Joystick.y;
2020-03-10 18:51:35 +00:00
//Apply a simple deadzone
player_moving = (fabs(x) + fabs(y)) > 0.05f;
2020-03-10 18:51:35 +00:00
x = player_moving ? x : 0;
y = player_moving ? y : 0;
//Adjust to be off-hand controller oriented
vec2_t v;
rotateAboutOrigin(x, y, controllerYawHeading, v);
remote_movementSideways = v[0];
remote_movementForward = v[1];
ALOGV(" remote_movementSideways: %f, remote_movementForward: %f",
remote_movementSideways,
remote_movementForward);
if (!cinemamode && !dominantGripPushedNew)
{
// Turning logic
static int increaseSnap = true;
if (pPrimaryTrackedRemoteNew->Joystick.x > 0.6f) {
if (increaseSnap) {
resetDoomYaw = true;
2022-12-27 23:27:29 +00:00
snapTurn -= vr_snapTurn;
if (vr_snapTurn > 10.0f) {
increaseSnap = false;
}
if (snapTurn < -180.0f) {
snapTurn += 360.f;
}
}
} else if (pPrimaryTrackedRemoteNew->Joystick.x < 0.4f) {
increaseSnap = true;
}
static int decreaseSnap = true;
if (pPrimaryTrackedRemoteNew->Joystick.x < -0.6f) {
if (decreaseSnap) {
resetDoomYaw = true;
2022-12-27 23:27:29 +00:00
snapTurn += vr_snapTurn;
//If snap turn configured for less than 10 degrees
2022-12-27 23:27:29 +00:00
if (vr_snapTurn > 10.0f) {
decreaseSnap = false;
}
if (snapTurn > 180.0f) {
snapTurn -= 360.f;
}
}
} else if (pPrimaryTrackedRemoteNew->Joystick.x > -0.4f) {
decreaseSnap = true;
}
}
}
}
2020-03-09 23:59:38 +00:00
//if in cinema mode, then the dominant joystick is used differently
if (!cinemamode)
{
//Default this is Weapon Chooser - This _could_ be remapped
Joy_GenerateButtonEvents(
(pPrimaryTrackedRemoteOld->Joystick.y < -0.7f && !dominantGripPushedOld ? 1 : 0),
(pPrimaryTrackedRemoteNew->Joystick.y < -0.7f && !dominantGripPushedNew ? 1 : 0),
1, KEY_MWHEELDOWN);
//Default this is Weapon Chooser - This _could_ be remapped
Joy_GenerateButtonEvents(
(pPrimaryTrackedRemoteOld->Joystick.y > 0.7f && !dominantGripPushedOld ? 1 : 0),
(pPrimaryTrackedRemoteNew->Joystick.y > 0.7f && !dominantGripPushedNew ? 1 : 0),
1, KEY_MWHEELUP);
//If snap turn set to 0, then we can use left/right on the stick as mappable functions
Joy_GenerateButtonEvents(
2022-12-27 23:27:29 +00:00
(pPrimaryTrackedRemoteOld->Joystick.x > 0.7f && !dominantGripPushedOld && !vr_snapTurn ? 1 : 0),
(pPrimaryTrackedRemoteNew->Joystick.x > 0.7f && !dominantGripPushedNew && !vr_snapTurn ? 1 : 0),
1, KEY_MWHEELLEFT);
Joy_GenerateButtonEvents(
2022-12-27 23:27:29 +00:00
(pPrimaryTrackedRemoteOld->Joystick.x < -0.7f && !dominantGripPushedOld && !vr_snapTurn ? 1 : 0),
(pPrimaryTrackedRemoteNew->Joystick.x < -0.7f && !dominantGripPushedNew && !vr_snapTurn ? 1 : 0),
1, KEY_MWHEELRIGHT);
}
2020-03-09 23:59:38 +00:00
//Dominant Hand - Primary keys (no grip pushed) - All keys are re-mappable, default bindngs are shown below
{
//Fire
Joy_GenerateButtonEvents(
2022-12-27 23:27:29 +00:00
((pDominantTrackedRemoteOld->Buttons & xrButton_Trigger) != 0) && !dominantGripPushedOld ? 1 : 0,
((pDominantTrackedRemoteNew->Buttons & xrButton_Trigger) != 0) && !dominantGripPushedNew ? 1 : 0,
1, KEY_PAD_RTRIGGER);
//"Use" (open door, toggle switch etc)
Joy_GenerateButtonEvents(
((primaryButtonsOld & primaryButton1) != 0) && !dominantGripPushedOld ? 1 : 0,
((primaryButtonsNew & primaryButton1) != 0) && !dominantGripPushedNew ? 1 : 0,
1, KEY_PAD_A);
//No Binding
Joy_GenerateButtonEvents(
((primaryButtonsOld & primaryButton2) != 0) && !dominantGripPushedOld ? 1 : 0,
((primaryButtonsNew & primaryButton2) != 0) && !dominantGripPushedNew ? 1 : 0,
1, KEY_PAD_B);
// Inv Use
Joy_GenerateButtonEvents(
2022-12-27 23:27:29 +00:00
((pDominantTrackedRemoteOld->Buttons & xrButton_Joystick) != 0) && !dominantGripPushedOld ? 1 : 0,
((pDominantTrackedRemoteNew->Buttons & xrButton_Joystick) != 0) && !dominantGripPushedNew ? 1 : 0,
1, KEY_ENTER);
//No Default Binding
Joy_GenerateButtonEvents(
2022-12-29 09:49:50 +00:00
((pDominantTrackedRemoteOld->Touches & xrButton_ThumbRest) != 0) && !dominantGripPushedOld ? 1 : 0,
((pDominantTrackedRemoteNew->Touches & xrButton_ThumbRest) != 0) && !dominantGripPushedNew ? 1 : 0,
1, KEY_JOY5);
2022-12-29 09:49:50 +00:00
}
//Dominant Hand - Secondary keys (grip pushed)
{
//Alt-Fire
Joy_GenerateButtonEvents(
2022-12-27 23:27:29 +00:00
((pDominantTrackedRemoteOld->Buttons & xrButton_Trigger) != 0) && dominantGripPushedOld ? 1 : 0,
((pDominantTrackedRemoteNew->Buttons & xrButton_Trigger) != 0) && dominantGripPushedNew ? 1 : 0,
1, KEY_PAD_LTRIGGER);
//Crouch
Joy_GenerateButtonEvents(
((primaryButtonsOld & primaryButton1) != 0) && dominantGripPushedOld ? 1 : 0,
((primaryButtonsNew & primaryButton1) != 0) && dominantGripPushedNew ? 1 : 0,
1, KEY_PAD_LTHUMB);
//No Binding
Joy_GenerateButtonEvents(
((primaryButtonsOld & primaryButton2) != 0) && dominantGripPushedOld ? 1 : 0,
((primaryButtonsNew & primaryButton2) != 0) && dominantGripPushedNew ? 1 : 0,
1, KEY_RSHIFT);
//No Binding
Joy_GenerateButtonEvents(
2022-12-27 23:27:29 +00:00
((pDominantTrackedRemoteOld->Buttons & xrButton_Joystick) != 0) && dominantGripPushedOld ? 1 : 0,
((pDominantTrackedRemoteNew->Buttons & xrButton_Joystick) != 0) && dominantGripPushedNew ? 1 : 0,
1, KEY_TAB);
//No Default Binding
Joy_GenerateButtonEvents(
2022-12-29 09:49:50 +00:00
((pDominantTrackedRemoteOld->Touches & xrButton_ThumbRest) != 0) && dominantGripPushedOld ? 1 : 0,
((pDominantTrackedRemoteNew->Touches & xrButton_ThumbRest) != 0) && dominantGripPushedNew ? 1 : 0,
1, KEY_JOY6);
//Use grip as an extra button
//Alt-Fire
Joy_GenerateButtonEvents(
2022-12-27 23:27:29 +00:00
((pDominantTrackedRemoteOld->Buttons & xrButton_GripTrigger) != 0) && !dominantGripPushedOld ? 1 : 0,
((pDominantTrackedRemoteNew->Buttons & xrButton_GripTrigger) != 0) && !dominantGripPushedNew ? 1 : 0,
1, KEY_PAD_LTRIGGER);
}
2020-03-09 23:59:38 +00:00
//Off Hand - Primary keys (no grip pushed)
{
//No Default Binding
Joy_GenerateButtonEvents(
2022-12-27 23:27:29 +00:00
((pOffTrackedRemoteOld->Buttons & xrButton_Trigger) != 0) && !dominantGripPushedOld ? 1 : 0,
((pOffTrackedRemoteNew->Buttons & xrButton_Trigger) != 0) && !dominantGripPushedNew ? 1 : 0,
1, KEY_LSHIFT);
//No Default Binding
Joy_GenerateButtonEvents(
((secondaryButtonsOld & secondaryButton1) != 0) && !dominantGripPushedOld ? 1 : 0,
((secondaryButtonsNew & secondaryButton1) != 0) && !dominantGripPushedNew ? 1 : 0,
1, KEY_PAD_X);
//Toggle Map
Joy_GenerateButtonEvents(
((secondaryButtonsOld & secondaryButton2) != 0) && !dominantGripPushedOld ? 1 : 0,
((secondaryButtonsNew & secondaryButton2) != 0) && !dominantGripPushedNew ? 1 : 0,
1, KEY_PAD_Y);
//"Use" (open door, toggle switch etc) - Can be rebound for other uses
Joy_GenerateButtonEvents(
2022-12-27 23:27:29 +00:00
((pOffTrackedRemoteOld->Buttons & xrButton_Joystick) != 0) && !dominantGripPushedOld ? 1 : 0,
((pOffTrackedRemoteNew->Buttons & xrButton_Joystick) != 0) && !dominantGripPushedNew ? 1 : 0,
1, KEY_SPACE);
//No Default Binding
Joy_GenerateButtonEvents(
2022-12-29 09:49:50 +00:00
((pOffTrackedRemoteOld->Touches & xrButton_ThumbRest) != 0) && !dominantGripPushedOld ? 1 : 0,
((pOffTrackedRemoteNew->Touches & xrButton_ThumbRest) != 0) && !dominantGripPushedNew ? 1 : 0,
1, KEY_JOY7);
Joy_GenerateButtonEvents(
2022-12-27 23:27:29 +00:00
((pOffTrackedRemoteOld->Buttons & xrButton_GripTrigger) != 0) && !dominantGripPushedOld ? 1 : 0,
((pOffTrackedRemoteNew->Buttons & xrButton_GripTrigger) != 0) && !dominantGripPushedNew ? 1 : 0,
1, KEY_PAD_RTHUMB);
}
2020-03-05 22:30:08 +00:00
//Off Hand - Secondary keys (grip pushed)
{
//No Default Binding
Joy_GenerateButtonEvents(
2022-12-27 23:27:29 +00:00
((pOffTrackedRemoteOld->Buttons & xrButton_Trigger) != 0) && dominantGripPushedOld ? 1 : 0,
((pOffTrackedRemoteNew->Buttons & xrButton_Trigger) != 0) && dominantGripPushedNew ? 1 : 0,
1, KEY_LALT);
//Move Down
Joy_GenerateButtonEvents(
((secondaryButtonsOld & secondaryButton1) != 0) && dominantGripPushedOld ? 1 : 0,
((secondaryButtonsNew & secondaryButton1) != 0) && dominantGripPushedNew ? 1 : 0,
1, KEY_PGDN);
//Move Up
Joy_GenerateButtonEvents(
((secondaryButtonsOld & secondaryButton2) != 0) && dominantGripPushedOld ? 1 : 0,
((secondaryButtonsNew & secondaryButton2) != 0) && dominantGripPushedNew ? 1 : 0,
1, KEY_PGUP);
//Land
Joy_GenerateButtonEvents(
2022-12-27 23:27:29 +00:00
((pOffTrackedRemoteOld->Buttons & xrButton_Joystick) != 0) && dominantGripPushedOld ? 1 : 0,
((pOffTrackedRemoteNew->Buttons & xrButton_Joystick) != 0) && dominantGripPushedNew ? 1 : 0,
1, KEY_HOME);
//No Default Binding
Joy_GenerateButtonEvents(
2022-12-29 09:49:50 +00:00
((pOffTrackedRemoteOld->Touches & xrButton_ThumbRest) != 0) && dominantGripPushedOld ? 1 : 0,
((pOffTrackedRemoteNew->Touches & xrButton_ThumbRest) != 0) && dominantGripPushedNew ? 1 : 0,
1, KEY_JOY8);
Joy_GenerateButtonEvents(
2022-12-27 23:27:29 +00:00
((pOffTrackedRemoteOld->Buttons & xrButton_GripTrigger) != 0) && dominantGripPushedOld && !vr_two_handed_weapons ? 1 : 0,
((pOffTrackedRemoteNew->Buttons & xrButton_GripTrigger) != 0) && dominantGripPushedNew && !vr_two_handed_weapons ? 1 : 0,
1, KEY_PAD_DPAD_UP);
}
Joy_GenerateButtonEvents(
(pSecondaryTrackedRemoteOld->Joystick.x > 0.7f && !dominantGripPushedOld ? 1 : 0),
(pSecondaryTrackedRemoteNew->Joystick.x > 0.7f && !dominantGripPushedNew ? 1 : 0),
1, KEY_JOYAXIS1PLUS);
Joy_GenerateButtonEvents(
(pSecondaryTrackedRemoteOld->Joystick.x < -0.7f && !dominantGripPushedOld ? 1 : 0),
(pSecondaryTrackedRemoteNew->Joystick.x < -0.7f && !dominantGripPushedNew ? 1 : 0),
1, KEY_JOYAXIS1MINUS);
Joy_GenerateButtonEvents(
(pPrimaryTrackedRemoteOld->Joystick.x > 0.7f && !dominantGripPushedOld ? 1 : 0),
(pPrimaryTrackedRemoteNew->Joystick.x > 0.7f && !dominantGripPushedNew ? 1 : 0),
1, KEY_JOYAXIS3PLUS);
Joy_GenerateButtonEvents(
(pPrimaryTrackedRemoteOld->Joystick.x < -0.7f && !dominantGripPushedOld ? 1 : 0),
(pPrimaryTrackedRemoteNew->Joystick.x < -0.7f && !dominantGripPushedNew ? 1 : 0),
1, KEY_JOYAXIS3MINUS);
Joy_GenerateButtonEvents(
(pSecondaryTrackedRemoteOld->Joystick.y < -0.7f && !dominantGripPushedOld ? 1 : 0),
(pSecondaryTrackedRemoteNew->Joystick.y < -0.7f && !dominantGripPushedNew ? 1 : 0),
1, KEY_JOYAXIS2MINUS);
Joy_GenerateButtonEvents(
(pSecondaryTrackedRemoteOld->Joystick.y > 0.7f && !dominantGripPushedOld ? 1 : 0),
(pSecondaryTrackedRemoteNew->Joystick.y > 0.7f && !dominantGripPushedNew ? 1 : 0),
1, KEY_JOYAXIS2PLUS);
Joy_GenerateButtonEvents(
(pPrimaryTrackedRemoteOld->Joystick.y < -0.7f && !dominantGripPushedOld ? 1 : 0),
(pPrimaryTrackedRemoteNew->Joystick.y < -0.7f && !dominantGripPushedNew ? 1 : 0),
1, KEY_JOYAXIS4MINUS);
Joy_GenerateButtonEvents(
(pPrimaryTrackedRemoteOld->Joystick.y > 0.7f && !dominantGripPushedOld ? 1 : 0),
(pPrimaryTrackedRemoteNew->Joystick.y > 0.7f && !dominantGripPushedNew ? 1 : 0),
1, KEY_JOYAXIS4PLUS);
Joy_GenerateButtonEvents(
(pSecondaryTrackedRemoteOld->Joystick.x > 0.7f && dominantGripPushedOld ? 1 : 0),
(pSecondaryTrackedRemoteNew->Joystick.x > 0.7f && dominantGripPushedNew ? 1 : 0),
1, KEY_JOYAXIS5PLUS);
Joy_GenerateButtonEvents(
(pSecondaryTrackedRemoteOld->Joystick.x < -0.7f && dominantGripPushedOld ? 1 : 0),
(pSecondaryTrackedRemoteNew->Joystick.x < -0.7f && dominantGripPushedNew ? 1 : 0),
1, KEY_JOYAXIS5MINUS);
Joy_GenerateButtonEvents(
(pPrimaryTrackedRemoteOld->Joystick.x > 0.7f && dominantGripPushedOld ? 1 : 0),
(pPrimaryTrackedRemoteNew->Joystick.x > 0.7f && dominantGripPushedNew ? 1 : 0),
1, KEY_JOYAXIS7PLUS);
Joy_GenerateButtonEvents(
(pPrimaryTrackedRemoteOld->Joystick.x < -0.7f && dominantGripPushedOld ? 1 : 0),
(pPrimaryTrackedRemoteNew->Joystick.x < -0.7f && dominantGripPushedNew ? 1 : 0),
1, KEY_JOYAXIS7MINUS);
Joy_GenerateButtonEvents(
(pSecondaryTrackedRemoteOld->Joystick.y < -0.7f && dominantGripPushedOld ? 1 : 0),
(pSecondaryTrackedRemoteNew->Joystick.y < -0.7f && dominantGripPushedNew ? 1 : 0),
1, KEY_JOYAXIS6MINUS);
Joy_GenerateButtonEvents(
(pSecondaryTrackedRemoteOld->Joystick.y > 0.7f && dominantGripPushedOld ? 1 : 0),
(pSecondaryTrackedRemoteNew->Joystick.y > 0.7f && dominantGripPushedNew ? 1 : 0),
1, KEY_JOYAXIS6PLUS);
Joy_GenerateButtonEvents(
(pPrimaryTrackedRemoteOld->Joystick.y < -0.7f && dominantGripPushedOld ? 1 : 0),
(pPrimaryTrackedRemoteNew->Joystick.y < -0.7f && dominantGripPushedNew ? 1 : 0),
1, KEY_JOYAXIS8MINUS);
Joy_GenerateButtonEvents(
(pPrimaryTrackedRemoteOld->Joystick.y > 0.7f && dominantGripPushedOld ? 1 : 0),
(pPrimaryTrackedRemoteNew->Joystick.y > 0.7f && dominantGripPushedNew ? 1 : 0),
1, KEY_JOYAXIS8PLUS);
//Save state
rightTrackedRemoteState_old = rightTrackedRemoteState_new;
leftTrackedRemoteState_old = leftTrackedRemoteState_new;
}