Move push to talk bindings to overlaycontroller
The old system used the old OpenVR input system which is incompatible with the new IVRInput. This change broke the AccessbilityTabController, but that is to be removed because the functionality can be found elsewhere.
This commit is contained in:
@@ -222,118 +222,8 @@ void PttController::savePttConfig()
|
||||
|
||||
void PttController::checkPttStatus()
|
||||
{
|
||||
static auto handleControllerState
|
||||
= []( const vr::VRControllerState_t& state,
|
||||
PttControllerConfig* config ) -> bool {
|
||||
if ( state.ulButtonPressed & config->digitalButtonMask )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if ( config->triggerMode )
|
||||
{
|
||||
if ( state.ulButtonPressed
|
||||
& vr::ButtonMaskFromId( vr::k_EButton_SteamVR_Trigger ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if ( config->touchpadMode )
|
||||
{
|
||||
if ( ( ( config->touchpadMode & 1 )
|
||||
&& ( state.ulButtonTouched
|
||||
& vr::ButtonMaskFromId(
|
||||
vr::k_EButton_SteamVR_Touchpad ) ) )
|
||||
|| ( ( config->touchpadMode & 2 )
|
||||
&& ( state.ulButtonPressed
|
||||
& vr::ButtonMaskFromId(
|
||||
vr::k_EButton_SteamVR_Touchpad ) ) ) )
|
||||
{
|
||||
if ( config->touchpadAreas
|
||||
== ( PAD_AREA_LEFT + PAD_AREA_TOP + PAD_AREA_RIGHT
|
||||
+ PAD_AREA_BOTTOM ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
float x = state.rAxis[0].x;
|
||||
float y = state.rAxis[0].y;
|
||||
if ( std::abs( x ) >= 0.2 || std::abs( y ) >= 0.2 )
|
||||
{ // deadzone in the middle
|
||||
if ( x < 0 && std::abs( y ) < -x
|
||||
&& ( config->touchpadAreas & PAD_AREA_LEFT ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if ( y > 0 && std::abs( x ) < y
|
||||
&& ( config->touchpadAreas & PAD_AREA_TOP ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if ( x > 0 && std::abs( y ) < x
|
||||
&& ( config->touchpadAreas
|
||||
& PAD_AREA_RIGHT ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if ( y < 0 && std::abs( x ) < -y
|
||||
&& ( config->touchpadAreas
|
||||
& PAD_AREA_BOTTOM ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
if ( m_pttEnabled )
|
||||
{
|
||||
bool newState = false;
|
||||
if ( m_pttLeftControllerEnabled )
|
||||
{
|
||||
auto leftId
|
||||
= vr::VRSystem()->GetTrackedDeviceIndexForControllerRole(
|
||||
vr::TrackedControllerRole_LeftHand );
|
||||
if ( leftId != vr::k_unTrackedDeviceIndexInvalid )
|
||||
{
|
||||
vr::VRControllerState_t state;
|
||||
if ( vr::VRSystem()->GetControllerState(
|
||||
leftId, &state, sizeof( vr::VRControllerState_t ) ) )
|
||||
{
|
||||
// logControllerState(state, "Left ");
|
||||
newState |= handleControllerState( state,
|
||||
m_pttControllerConfigs );
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( m_pttRightControllerEnabled )
|
||||
{
|
||||
auto rightId
|
||||
= vr::VRSystem()->GetTrackedDeviceIndexForControllerRole(
|
||||
vr::TrackedControllerRole_RightHand );
|
||||
if ( rightId != vr::k_unTrackedDeviceIndexInvalid )
|
||||
{
|
||||
vr::VRControllerState_t state;
|
||||
if ( vr::VRSystem()->GetControllerState(
|
||||
rightId, &state, sizeof( vr::VRControllerState_t ) ) )
|
||||
{
|
||||
// logControllerState(state, "Right ");
|
||||
newState |= handleControllerState(
|
||||
state, m_pttControllerConfigs + 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( newState && !m_pttActive && pttChangeValid() )
|
||||
{
|
||||
startPtt();
|
||||
}
|
||||
else if ( !newState && m_pttActive && pttChangeValid() )
|
||||
{
|
||||
stopPtt();
|
||||
}
|
||||
}
|
||||
// PTT Controls are now handled in the overlaycontroller using public
|
||||
// functions.
|
||||
}
|
||||
|
||||
void PttController::startPtt()
|
||||
|
||||
Reference in New Issue
Block a user