@@ -62,6 +62,7 @@ enum eDir
62
62
{
63
63
eDirNeg,
64
64
eDirPos,
65
+ eDirNegToPos,
65
66
eDirMax
66
67
};
67
68
@@ -79,7 +80,7 @@ enum eStick
79
80
struct SMappingLine
80
81
{
81
82
eJoy SourceAxisIndex; // 0 - 7
82
- eDir SourceAxisDir; // 0 - 1
83
+ eDir SourceAxisDir; // 0 - 2
83
84
eStick OutputAxisIndex; // 0/1 2/3 4 5
84
85
eDir OutputAxisDir; // 0 - 1
85
86
bool bEnabled;
@@ -652,6 +653,7 @@ void CJoystickManager::DoPulse(void)
652
653
// See if any axes have changed to over 0.75
653
654
for (int i = 0 ; i < NUMELMS (m_JoystickState.rgfAxis ); i++)
654
655
{
656
+ // Half axis movement (0 to 1)
655
657
if (fabs (m_JoystickState.rgfAxis [i]) > 0 .75f )
656
658
if (fabs (m_PreBindJoystickState.rgfAxis [i]) < 0 .75f )
657
659
{
@@ -662,6 +664,18 @@ void CJoystickManager::DoPulse(void)
662
664
m_currentMapping[m_iCaptureOutputIndex].SourceAxisDir = m_JoystickState.rgfAxis [i] < 0 .f ? eDirNeg : eDirPos;
663
665
m_SettingsRevision++;
664
666
}
667
+
668
+ // Full axis movement (-1 to 1)
669
+ if (m_JoystickState.rgfAxis [i] > 0 .75f )
670
+ if (m_PreBindJoystickState.rgfAxis [i] < -0 .75f )
671
+ {
672
+ m_bCaptureAxis = false ;
673
+ // Save the mapping
674
+ m_currentMapping[m_iCaptureOutputIndex].bEnabled = true ;
675
+ m_currentMapping[m_iCaptureOutputIndex].SourceAxisIndex = (eJoy)i;
676
+ m_currentMapping[m_iCaptureOutputIndex].SourceAxisDir = eDirNegToPos;
677
+ m_SettingsRevision++;
678
+ }
665
679
}
666
680
}
667
681
}
@@ -1037,7 +1051,11 @@ void CJoystickManager::ApplyAxes(CControllerState& cs, bool bInVehicle)
1037
1051
if (line.SourceAxisDir == eDirPos)
1038
1052
value = std::max (0 .f , value);
1039
1053
else
1054
+ if (line.SourceAxisDir == eDirNeg)
1040
1055
value = -std::min (0 .f , value);
1056
+ else
1057
+ if (line.SourceAxisDir == eDirNegToPos)
1058
+ value = value * 0 .5f + 0 .5f ;
1041
1059
1042
1060
if (line.OutputAxisDir == eDirNeg)
1043
1061
value = -value;
@@ -1575,6 +1593,8 @@ static string ToString(eDir value)
1575
1593
return " -" ;
1576
1594
if (value == eDirPos)
1577
1595
return " +" ;
1596
+ if (value == eDirNegToPos)
1597
+ return " " ;
1578
1598
return " unknown" ;
1579
1599
}
1580
1600
0 commit comments