Override controller type when motion sensor emulation is enabled

Without this, the host will still select an Xbox controller even if it can't support motion sensors.
This commit is contained in:
Cameron Gutman 2023-09-16 22:48:38 -05:00
parent 7d69b53958
commit cafc4450b2
2 changed files with 11 additions and 1 deletions

View File

@ -33,6 +33,7 @@ import android.view.Surface;
import android.widget.Toast;
import com.limelight.LimeLog;
import com.limelight.R;
import com.limelight.binding.input.driver.AbstractController;
import com.limelight.binding.input.driver.UsbDriverListener;
import com.limelight.binding.input.driver.UsbDriverService;
@ -2906,6 +2907,12 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
capabilities |= MoonBridge.LI_CCAP_GYRO;
}
// Override the detected controller type if we're emulating motion sensors on an Xbox controller
if (type != MoonBridge.LI_CTYPE_PS && sensorManager != null) {
Toast.makeText(activityContext, activityContext.getResources().getText(R.string.toast_controller_type_changed), Toast.LENGTH_LONG).show();
type = MoonBridge.LI_CTYPE_UNKNOWN;
}
// We can perform basic rumble with any vibrator
if (vibrator != null) {
capabilities |= MoonBridge.LI_CCAP_RUMBLE;

View File

@ -188,7 +188,7 @@
<string name="title_checkbox_gamepad_motion_sensors">Allow use of gamepad motion sensors</string>
<string name="summary_checkbox_gamepad_motion_sensors">Enables supported hosts to request motion sensor data when emulating a gamepad with motion sensors. Disabling may slightly reduce power and network usage if motion sensors are not being used in game.</string>
<string name="title_checkbox_gamepad_motion_fallback">Emulate gamepad motion sensor support</string>
<string name="summary_checkbox_gamepad_motion_fallback">Uses your device\'s built-in motion sensors if gamepad sensors are not supported by your connected gamepad or your Android version.\nNote: Enabling this option may cause your gamepad to appear on the host as a PlayStation controller.</string>
<string name="summary_checkbox_gamepad_motion_fallback">Uses your device\'s built-in motion sensors if gamepad sensors are not supported by your connected gamepad or your Android version.\nNote: Enabling this option may cause your gamepad to appear as a PlayStation controller on the host.</string>
<string name="category_input_settings">Input Settings</string>
<string name="title_checkbox_touchscreen_trackpad">Use the touchscreen as a trackpad</string>
@ -257,6 +257,9 @@
<string name="title_privacy_policy">Privacy policy</string>
<string name="summary_privacy_policy">View Moonlight\'s privacy policy</string>
<!-- Toasts -->
<string name="toast_controller_type_changed">Gamepad type may be changed due to motion sensor emulation</string>
<!-- Array strings -->
<string name="resolution_360p">360p</string>
<string name="resolution_480p">480p</string>