Skip to content

Commit 7cef371

Browse files
committed
refactor: remove multi-controller support, keep vibration fixes
Another contributor is owning multi-controller work, so this branch drops our per-slot routing while keeping all of the Player 1 vibration improvements (dual-motor CombinedVibration, FileObserver rumble wake, 240ms keepalive, device-vibrator refresh, intensity/mode settings, evshim APK-copy + defensive LD_PRELOAD). ControllerManager.java and PhysicalControllerHandler.kt are restored wholesale from upstream/master. WinHandler.java is edited in place to keep the vibration pipeline intact: - MAX_PLAYERS: 4 → 1 (per-slot arrays auto-shrink to size 1; for-p-in-MAX_PLAYERS loops become single-iteration for slot 0) - Dropped extraGamepadBuffers, extraControllers, and the getBufferForSlot / getControllerForSlot / setControllerForSlot / resolveControllerSlot helpers - onGenericMotionEvent and onKeyEvent replaced with upstream's single-controller adoption flow (profile.getController → fallback, adopt only if id == "*") - refreshControllerMappings and initializeAssignedControllers simplified to slot 0 only - startRumblePoller: memPaths[] array reduced to a single gamepad.mem BionicProgramLauncherComponent.java: pre-creates only gamepad.mem and hardcodes EVSHIM_MAX_PLAYERS="1". evshim APK-copy and LD_PRELOAD guard preserved. XServerScreen.kt: removed the InputManager.InputDeviceListener that forwarded onDeviceDisconnected to PhysicalControllerHandler (method no longer exists upstream). The onDispose cleanup for the handler and exit-watch jobs is preserved. Deleted tests that exercised the removed multi-slot code: - app/src/test/java/app/gamenative/input/MultiControllerTest.kt - app/src/test/java/com/winlator/inputcontrols/ControllerManagerTest.kt Verification: JDK 17 compileDebugJavaWithJavac + compileDebugKotlin clean. testDebugUnitTest shows the same 38 pre-existing failures as baseline (PreInstallStepsTest, SteamUtilsFileSearchTest, etc.) — zero new regressions. Debug APK built and installed on device; full controller input + vibration chain traced end-to-end.
1 parent 501eaa7 commit 7cef371

7 files changed

Lines changed: 215 additions & 902 deletions

File tree

app/src/main/java/app/gamenative/ui/screen/xserver/PhysicalControllerHandler.kt

Lines changed: 85 additions & 174 deletions
Large diffs are not rendered by default.

app/src/main/java/app/gamenative/ui/screen/xserver/XServerScreen.kt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -408,21 +408,7 @@ fun XServerScreen(
408408
var gracefulExitJob: Job? by remember { mutableStateOf(null) }
409409

410410
DisposableEffect(Unit) {
411-
// Forward controller-removed events so PhysicalControllerHandler can
412-
// release stale axis state and d-pad suppression for the lost device
413-
// before Android potentially recycles its deviceId for a new controller.
414-
val inputManager = context.getSystemService(Context.INPUT_SERVICE) as InputManager
415-
val deviceListener = object : InputManager.InputDeviceListener {
416-
override fun onInputDeviceAdded(deviceId: Int) = Unit
417-
override fun onInputDeviceChanged(deviceId: Int) = Unit
418-
override fun onInputDeviceRemoved(deviceId: Int) {
419-
physicalControllerHandler?.onDeviceDisconnected(deviceId)
420-
}
421-
}
422-
inputManager.registerInputDeviceListener(deviceListener, null)
423-
424411
onDispose {
425-
inputManager.unregisterInputDeviceListener(deviceListener)
426412
physicalControllerHandler?.cleanup()
427413
physicalControllerHandler = null
428414
exitWatchJob?.cancel()

0 commit comments

Comments
 (0)