Dolphin from the rail: guide toggles full screen (its window and settings), drawn in the main window

This commit is contained in:
The412Banner committed 2026-09-24 21:00:43 -04:00
1 parent 7fbfeb2edd
commit ee3fd4d6b8
2 files changed
+29 -5

No files matched your search

@@ -736,6 +736,20 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
return super.dispatchKeyEvent(event)
}
if (pcKeyboardOpen && event.device != null && PadBridge.isFromController(event.device)) return super.dispatchKeyEvent(event)
// Dolphin (PC) has no controller menu of its own: in a Dolphin game from the rail the guide
// button is its Toggle Fullscreen hotkey (Alt+Return, Dolphin's default) instead, which
// brings up Dolphin's window with its Config / Graphics / Stop buttons, and back again.
if (event.keyCode == KeyEvent.KEYCODE_BUTTON_MODE && guideIsDolphinFullscreen() &&
event.device != null && PadBridge.isFromController(event.device)
) {
if (event.action == KeyEvent.ACTION_DOWN && event.repeatCount == 0 && CompositorHost.isStarted) {
WaylandCompositor.nativeSendKey(KEY_LEFTALT, 1)
WaylandCompositor.nativeSendKey(KEY_ENTER, 1)
WaylandCompositor.nativeSendKey(KEY_ENTER, 0)
WaylandCompositor.nativeSendKey(KEY_LEFTALT, 0)
}
return true
}
if (event.keyCode != KeyEvent.KEYCODE_BACK && padBridge?.onKeyEvent(event) == true) return true
// A hardware keyboard, forwarded to the compositor's wl_keyboard. Back is left to the
// activity, which opens the drawer.
@@ -994,6 +1008,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
if (reset) secondScreenMode = SecondScreenMode.NONE
}
private fun guideIsDolphinFullscreen(): Boolean =
SessionState.mode == SessionService.MODE_RUN &&
SessionState.program?.substringAfterLast('/')?.startsWith("dolphin") == true
/** Touchpad on the desktop, direct in Steam, unless the drawer says otherwise. */
private fun usingTouchpad(): Boolean = when (SessionPrefs.touchMode(this)) {
SessionPrefs.TOUCH_PAD -> true
@@ -1191,6 +1209,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
}
companion object {
// evdev codes (linux/input-event-codes.h) for the Alt+Return sent to Dolphin.
private const val KEY_LEFTALT = 56
private const val KEY_ENTER = 28
private const val TAG = "SessionActivity"
private const val BACK_DOUBLE_PRESS_TIMEOUT_MS = 500L
private const val DRAWER_HAT_THRESHOLD = 0.5f
@@ -219,13 +219,16 @@ object Library {
"armsx2" -> listOf("-batch", "-bigpicture", "-fullscreen", "--", guestPath)
// DuckStation shares PCSX2's flags (src/duckstation-qt/qthost.cpp): the same launch and exit.
"duckstation" -> listOf("-batch", "-bigpicture", "-fullscreen", "--", guestPath)
// Dolphin: full screen, and gone when the game stops (-b), without its "stop the emulation?"
// Dolphin: full screen, drawn inside its own main window, without its "stop the emulation?"
// question; no warning boxes either, which wait for a click a controller cannot give
// (they still go to Dolphin's log). -C sets a Dolphin.ini value for this run only, so
// Dolphin started from the desktop keeps its window and its warnings.
// (they still go to Dolphin's log). The guide button toggles full screen (SessionActivity),
// which shows Dolphin's window and its settings - so no -b, which hides that window.
// Closing Dolphin ends the session. -C sets a Dolphin.ini value for this run only, so
// Dolphin started from the desktop keeps its own window and its warnings.
"dolphin" -> listOf(
"-b", "-C", "Dolphin.Display.Fullscreen=True", "-C", "Dolphin.Interface.ConfirmStop=False",
"-C", "Dolphin.Interface.UsePanicHandlers=False", "-e", guestPath,
"-C", "Dolphin.Display.Fullscreen=True", "-C", "Dolphin.Display.RenderToMain=True",
"-C", "Dolphin.Interface.ConfirmStop=False", "-C", "Dolphin.Interface.UsePanicHandlers=False",
"-e", guestPath,
)
"cemu" -> listOf("-g", guestPath)
else -> listOf(guestPath)