mirror of
https://github.com/DrBeef/Doom3Quest.git
synced 2024-11-10 06:41:36 +00:00
CyberShoes Support
This commit is contained in:
parent
1bc947b132
commit
3283e8525c
4 changed files with 49 additions and 20 deletions
|
@ -1544,6 +1544,9 @@ void * AppThreadFunction(void * parm ) {
|
|||
ovrApp_Clear(&gAppState);
|
||||
gAppState.Java = java;
|
||||
|
||||
// This app will handle android gamepad events itself.
|
||||
vrapi_SetPropertyInt(&gAppState.Java, VRAPI_EAT_NATIVE_GAMEPAD_EVENTS, 0);
|
||||
|
||||
gAppState.CpuLevel = CPU_LEVEL;
|
||||
gAppState.GpuLevel = GPU_LEVEL;
|
||||
gAppState.MainThreadTid = gettid();
|
||||
|
@ -1773,14 +1776,18 @@ void Doom3Quest_getTrackedRemotesOrientation(int controlscheme, int switch_stick
|
|||
|
||||
//Call additional control schemes here
|
||||
if (controlscheme == RIGHT_HANDED_DEFAULT) {
|
||||
HandleInput_Default(controlscheme, switch_sticks, &rightTrackedRemoteState_new,
|
||||
&rightTrackedRemoteState_old, &rightRemoteTracking_new,
|
||||
HandleInput_Default(controlscheme, switch_sticks,
|
||||
&footTrackedRemoteState_new, &footTrackedRemoteState_old,
|
||||
&rightTrackedRemoteState_new, &rightTrackedRemoteState_old,
|
||||
&rightRemoteTracking_new,
|
||||
&leftTrackedRemoteState_new, &leftTrackedRemoteState_old,
|
||||
&leftRemoteTracking_new,
|
||||
ovrButton_A, ovrButton_B, ovrButton_X, ovrButton_Y);
|
||||
} else {
|
||||
//Left handed
|
||||
HandleInput_Default(controlscheme, switch_sticks, &leftTrackedRemoteState_new, &leftTrackedRemoteState_old,
|
||||
HandleInput_Default(controlscheme, switch_sticks,
|
||||
&footTrackedRemoteState_new, &footTrackedRemoteState_old,
|
||||
&leftTrackedRemoteState_new, &leftTrackedRemoteState_old,
|
||||
&leftRemoteTracking_new,
|
||||
&rightTrackedRemoteState_new, &rightTrackedRemoteState_old,
|
||||
&rightRemoteTracking_new,
|
||||
|
|
|
@ -19,6 +19,9 @@ ovrInputStateTrackedRemote rightTrackedRemoteState_old;
|
|||
ovrInputStateTrackedRemote rightTrackedRemoteState_new;
|
||||
ovrTracking rightRemoteTracking_new;
|
||||
|
||||
ovrInputStateGamepad footTrackedRemoteState_old;
|
||||
ovrInputStateGamepad footTrackedRemoteState_new;
|
||||
|
||||
ovrDeviceID controllerIDs[2];
|
||||
|
||||
float remote_movementSideways;
|
||||
|
@ -33,7 +36,7 @@ void sendButtonActionSimple(const char* action);
|
|||
|
||||
void acquireTrackedRemotesData(ovrMobile *Ovr, double displayTime);
|
||||
|
||||
void HandleInput_Default( int controlscheme, int switchsticks, ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, ovrInputStateTrackedRemote *pDominantTrackedRemoteOld, ovrTracking* pDominantTracking,
|
||||
void HandleInput_Default( int controlscheme, int switchsticks, ovrInputStateGamepad *pFootTrackingNew, ovrInputStateGamepad *pFootTrackingOld, ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, ovrInputStateTrackedRemote *pDominantTrackedRemoteOld, ovrTracking* pDominantTracking,
|
||||
ovrInputStateTrackedRemote *pOffTrackedRemoteNew, ovrInputStateTrackedRemote *pOffTrackedRemoteOld, ovrTracking* pOffTracking,
|
||||
int domButton1, int domButton2, int offButton1, int offButton2 );
|
||||
|
||||
|
|
|
@ -105,7 +105,22 @@ void acquireTrackedRemotesData(ovrMobile *Ovr, double displayTime) {//The amount
|
|||
break;
|
||||
}
|
||||
|
||||
if (capsHeader.Type == ovrControllerType_TrackedRemote) {
|
||||
if (capsHeader.Type == ovrControllerType_Gamepad) {
|
||||
|
||||
ovrInputGamepadCapabilities remoteCaps;
|
||||
remoteCaps.Header = capsHeader;
|
||||
if (vrapi_GetInputDeviceCapabilities(Ovr, &remoteCaps.Header) >= 0) {
|
||||
// remote is connected
|
||||
ovrInputStateGamepad remoteState;
|
||||
remoteState.Header.ControllerType = ovrControllerType_Gamepad;
|
||||
if ( vrapi_GetCurrentInputState( Ovr, capsHeader.DeviceID, &remoteState.Header ) >= 0 )
|
||||
{
|
||||
// act on device state returned in remoteState
|
||||
footTrackedRemoteState_new = remoteState;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (capsHeader.Type == ovrControllerType_TrackedRemote) {
|
||||
ovrTracking remoteTracking;
|
||||
ovrInputTrackedRemoteCapabilities remoteCaps;
|
||||
remoteCaps.Header = capsHeader;
|
||||
|
@ -114,17 +129,20 @@ void acquireTrackedRemotesData(ovrMobile *Ovr, double displayTime) {//The amount
|
|||
// remote is connected
|
||||
ovrInputStateTrackedRemote remoteState;
|
||||
remoteState.Header.ControllerType = ovrControllerType_TrackedRemote;
|
||||
if ( vrapi_GetInputTrackingState( Ovr, capsHeader.DeviceID, displayTime, &remoteTracking ) >= 0 )
|
||||
{
|
||||
// act on device state returned in remoteState
|
||||
if (remoteCaps.ControllerCapabilities & ovrControllerCaps_RightHand) {
|
||||
rightTrackedRemoteState_new = remoteState;
|
||||
rightRemoteTracking_new = remoteTracking;
|
||||
controllerIDs[1] = capsHeader.DeviceID;
|
||||
} else{
|
||||
leftTrackedRemoteState_new = remoteState;
|
||||
leftRemoteTracking_new = remoteTracking;
|
||||
controllerIDs[0] = capsHeader.DeviceID;
|
||||
|
||||
if(vrapi_GetCurrentInputState(Ovr, capsHeader.DeviceID, &remoteState.Header) >= 0) {
|
||||
if (vrapi_GetInputTrackingState(Ovr, capsHeader.DeviceID, displayTime,
|
||||
&remoteTracking) >= 0) {
|
||||
// act on device state returned in remoteState
|
||||
if (remoteCaps.ControllerCapabilities & ovrControllerCaps_RightHand) {
|
||||
rightTrackedRemoteState_new = remoteState;
|
||||
rightRemoteTracking_new = remoteTracking;
|
||||
controllerIDs[1] = capsHeader.DeviceID;
|
||||
} else {
|
||||
leftTrackedRemoteState_new = remoteState;
|
||||
leftRemoteTracking_new = remoteTracking;
|
||||
controllerIDs[0] = capsHeader.DeviceID;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,8 @@ extern bool objectiveSystemActive;
|
|||
extern bool inCinematic;
|
||||
|
||||
|
||||
void HandleInput_Default( int controlscheme, int switchsticks, ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, ovrInputStateTrackedRemote *pDominantTrackedRemoteOld, ovrTracking* pDominantTracking,
|
||||
|
||||
void HandleInput_Default( int controlscheme, int switchsticks, ovrInputStateGamepad *pFootTrackingNew, ovrInputStateGamepad *pFootTrackingOld, ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, ovrInputStateTrackedRemote *pDominantTrackedRemoteOld, ovrTracking* pDominantTracking,
|
||||
ovrInputStateTrackedRemote *pOffTrackedRemoteNew, ovrInputStateTrackedRemote *pOffTrackedRemoteOld, ovrTracking* pOffTracking,
|
||||
int domButton1, int domButton2, int offButton1, int offButton2 )
|
||||
|
||||
|
@ -458,10 +459,10 @@ void HandleInput_Default( int controlscheme, int switchsticks, ovrInputStateTrac
|
|||
|
||||
{
|
||||
//Apply a filter and quadratic scaler so small movements are easier to make
|
||||
float dist = length(pSecondaryJoystick->x, pSecondaryJoystick->y);
|
||||
float dist = length(pSecondaryJoystick->x - (pFootTrackingNew->LeftJoystick.x * 2), pSecondaryJoystick->y - (pFootTrackingNew->LeftJoystick.y * 2));
|
||||
float nlf = nonLinearFilter(dist);
|
||||
float x = nlf * pSecondaryJoystick->x;
|
||||
float y = nlf * pSecondaryJoystick->y;
|
||||
float x = nlf * (pSecondaryJoystick->x - (pFootTrackingNew->LeftJoystick.x * 2));
|
||||
float y = nlf * (pSecondaryJoystick->y - (pFootTrackingNew->LeftJoystick.y * 2));
|
||||
|
||||
pVRClientInfo->player_moving = (fabs(x) + fabs(y)) > 0.05f;
|
||||
|
||||
|
|
Loading…
Reference in a new issue