Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ public List<Joystick> loadJoysticks(int joyId, InputManager inputManager) {

public boolean onGenericMotion(MotionEvent event) {
boolean consumed = false;
float rawValue, value;
// logger.log(Level.INFO, "onGenericMotion event: {0}", event);
event.getDeviceId();
event.getSource();
Expand All @@ -185,7 +186,8 @@ public boolean onGenericMotion(MotionEvent event) {
if (joystick != null) {
for (int androidAxis: joystick.getAndroidAxes()) {
String axisName = MotionEvent.axisToString(androidAxis);
float value = event.getAxisValue(androidAxis);
rawValue = event.getAxisValue(androidAxis);
value = JoystickCompatibilityMappings.remapAxisRange(joystick.getAxis(androidAxis), rawValue);
int action = event.getAction();
if (action == MotionEvent.ACTION_MOVE) {
// logger.log(Level.INFO, "MOVE axis num: {0}, axisName: {1}, value: {2}",
Expand All @@ -194,7 +196,7 @@ public boolean onGenericMotion(MotionEvent event) {
if (axis != null) {
// logger.log(Level.INFO, "MOVE axis num: {0}, axisName: {1}, value: {2}, deadzone: {3}",
// new Object[]{androidAxis, axisName, value, axis.getDeadZone()});
JoyAxisEvent axisEvent = new JoyAxisEvent(axis, value);
JoyAxisEvent axisEvent = new JoyAxisEvent(axis, value, rawValue);
joyInput.addEvent(axisEvent);
consumed = true;
} else {
Expand Down Expand Up @@ -316,7 +318,7 @@ protected JoystickButton addButton( int keyCode ) {
original = JoystickButton.BUTTON_11;
}

String logicalId = JoystickCompatibilityMappings.remapComponent( getName(), original );
String logicalId = JoystickCompatibilityMappings.remapButton( getName(), original );
if( logicalId == null ? original != null : !logicalId.equals(original) ) {
logger.log(Level.FINE, "Remapped: {0} to: {1}",
new Object[]{original, logicalId});
Expand Down Expand Up @@ -347,7 +349,7 @@ protected JoystickAxis addAxis(MotionRange motionRange) {
} else if (motionRange.getAxis() == MotionEvent.AXIS_HAT_Y) {
original = JoystickAxis.POV_Y;
}
String logicalId = JoystickCompatibilityMappings.remapComponent( getName(), original );
String logicalId = JoystickCompatibilityMappings.remapAxis( getName(), original );
if( logicalId == null ? original != null : !logicalId.equals(original) ) {
logger.log(Level.FINE, "Remapped: {0} to: {1}",
new Object[]{original, logicalId});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ private boolean updateOrientation() {
sensorData.haveData = true;
} else {
if (axis.isChanged()) {
joyInput.addEvent(new JoyAxisEvent(axis, axis.getJoystickAxisValue()));
joyInput.addEvent(new JoyAxisEvent(axis, axis.getJoystickAxisValue(), axis.getJoystickAxisValue()));
}
}
}
Expand Down Expand Up @@ -553,7 +553,7 @@ public void onSensorChanged(SensorEvent se) {
sensorData.haveData = true;
} else {
if (axis.isChanged()) {
JoyAxisEvent event = new JoyAxisEvent(axis, axis.getJoystickAxisValue());
JoyAxisEvent event = new JoyAxisEvent(axis, axis.getJoystickAxisValue(), axis.getJoystickAxisValue());
// logger.log(Level.INFO, "adding JoyAxisEvent: {0}", event);
joyInput.addEvent(event);
// joyHandler.addEvent(new JoyAxisEvent(axis, axis.getJoystickAxisValue()));
Expand Down
Loading