mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 12:56:06 +00:00
Add a Controller section to Setup with an on-screen pad editor
The on-screen pad is now placed from the panel's physical size: the sticks and face buttons sit at the two-thumb rest point (about 17% of the width inboard, 28% of the height up, clamped in millimetres), with the d-pad and right stick below-inboard, shoulders above, and nothing ever placed off screen or under a display cutout. Button sizes are unchanged. Setup > Controller holds the on-screen controls mode, a tint (Steam blue #1A9FFF by default), opacity, button size, stick click (double-tap for L3/R3), a full-screen layout editor, per-button mapping including LT/RT, and resets for each. Also from WinNative #772: the fakeinput ring poll backoff is capped at 2 ms instead of 16 ms, the session asks for unbuffered joystick input, and the on-screen controls request unbuffered dispatch per gesture and release everything when detached. The QAM button no longer draws at the top-left corner in full-pad mode.
This commit is contained in:
1 parent
4a46e16702
commit
3fac2e8945
9 files changed
+728
-197
No files matched your search
@@ -458,7 +458,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
// was 16:9 - the picture came back squashed sideways. While a session runs, keep its size.
|
||||
val size = if (SessionState.running) SessionState.outputSize else outputSize()
|
||||
SessionState.outputSize = size
|
||||
onScreenControls?.setPicture(drawnRect())
|
||||
if (!SessionState.running) SessionState.refreshHz = refreshHz()
|
||||
// Letterbox, never stretch or crop: the output can be a different shape from the panel,
|
||||
// and a game's picture must keep its proportions with bars, not lose its edges.
|
||||
@@ -532,8 +531,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
val resized = surfaceW != 0 && (width != surfaceW || height != surfaceH)
|
||||
surfaceW = width
|
||||
surfaceH = height
|
||||
// The on-screen controls follow the picture: into the bars beside or under it when there are any.
|
||||
onScreenControls?.setPicture(drawnRect())
|
||||
if (resized) {
|
||||
Log.i(TAG, "surface resized to ${width}x$height - rebinding the compositor")
|
||||
CompositorHost.resize(holder.surface) { applyFrameGen() }
|
||||
@@ -1146,6 +1143,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
}
|
||||
(getSystemService(INPUT_SERVICE) as? InputManager)
|
||||
?.registerInputDeviceListener(deviceListener, Handler(Looper.getMainLooper()))
|
||||
onScreenControls?.reload()
|
||||
updateOnScreenControls()
|
||||
readPrefs()
|
||||
if (CompositorHost.isStarted) applyFrameGen()
|
||||
@@ -1160,6 +1158,14 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) return
|
||||
val decor = window.decorView
|
||||
decor.requestUnbufferedDispatch(UNBUFFERED_SOURCES)
|
||||
decor.viewTreeObserver.addOnGlobalFocusChangeListener { _, _ -> decor.post { decor.requestUnbufferedDispatch(UNBUFFERED_SOURCES) } }
|
||||
}
|
||||
|
||||
override fun onWindowFocusChanged(hasFocus: Boolean) {
|
||||
super.onWindowFocusChanged(hasFocus)
|
||||
if (hasFocus) goFullscreen()
|
||||
@@ -1207,6 +1213,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "SessionActivity"
|
||||
private const val UNBUFFERED_SOURCES = InputDevice.SOURCE_CLASS_JOYSTICK or InputDevice.SOURCE_CLASS_TRACKBALL or InputDevice.SOURCE_CLASS_POSITION
|
||||
private const val BACK_DOUBLE_PRESS_TIMEOUT_MS = 500L
|
||||
private const val DRAWER_HAT_THRESHOLD = 0.5f
|
||||
private const val DRAWER_STICK_ENTER_THRESHOLD = 0.55f
|
||||
|
||||
Reference in new issue
Block a user