Android: Let WiimoteEmu know whether we have accelerometer/gyroscope

This commit is contained in:
JosJuice
2019-11-20 19:40:47 +01:00
parent 4d838212e2
commit c8b8a60033
5 changed files with 54 additions and 12 deletions

View File

@ -265,6 +265,9 @@ public final class NativeLibrary
Rumble.checkRumble(padID, state);
}
public static native void SetMotionSensorsEnabled(boolean accelerometerEnabled,
boolean gyroscopeEnabled);
public static native void NewGameIniFile();
public static native void LoadGameIniFile(String gameId);

View File

@ -101,10 +101,14 @@ public class MotionListener implements SensorEventListener
mSensorManager.registerListener(this, mAccelSensor, SAMPLING_PERIOD_US);
if (mGyroSensor != null)
mSensorManager.registerListener(this, mGyroSensor, SAMPLING_PERIOD_US);
NativeLibrary.SetMotionSensorsEnabled(mAccelSensor != null, mGyroSensor != null);
}
public void disable()
{
mSensorManager.unregisterListener(this);
NativeLibrary.SetMotionSensorsEnabled(false, false);
}
}