feat: Epic Games Launcher for Linux (#928)

* feat: Epic Games Launcher for Linux

Install Epic's official Linux launcher (EGLv2) from Epic's CDN with Valve's
Steam Runtime 4 and run it under FEX, signed in with the linked Epic account.
Epic games launch through a hidden launcher instance so they get the
launcher's own arguments, with the exchange-code launch as the fallback, and
DroidDeck installs show up in the launcher as installed.

In the launcher, touch scrolls like a phone app and the gamepad drives the UI:
D-pad and left stick move the selection, A opens, B goes back, the right stick
and triggers scroll proportionally, X opens the options menu, Y the keyboard
and LB/RB switch tabs.

* feat: Epic Games Launcher for Linux

Install Epic's official Linux launcher (EGLv2) from Epic's CDN with Valve's
Steam Runtime 4 and run it under FEX, signed in with the linked Epic account.
Epic games launch through a hidden launcher instance so they get the
launcher's own arguments, with the exchange-code launch as the fallback, and
DroidDeck installs show up in the launcher as installed.

In the launcher, touch scrolls like a phone app and the gamepad drives the UI:
D-pad and left stick move the selection, A opens, B goes back, the right stick
and triggers scroll proportionally, X opens the options menu, Y the keyboard
and LB/RB switch tabs.

* Route Epic games through Steam, import launcher installs, offer the second library

- Every Epic launch goes Steam -> Epic Games Launcher -> game; Play inside the open launcher hands the game to Steam
- Games installed from inside the launcher get a Games-tab entry and launch through Steam; the launcher installs to the last Stores target
- Stores install picker offers the Steam second library, with side-by-side choices
- uruntime xattr-only failures no longer fail the launcher unpack (app-extract)

* Hand launcher Play and Steam links to Steam, wait for FEX on first run

Play on a game the launcher just installed is matched to its install
record and handed to Steam. Steam games listed in the launcher open
steam://rungameid links, which now start the game in a Steam session.
Opening the launcher before Steam has downloaded FEX asks Steam for it
and starts Steam instead of failing with no-fex.

* Address review: FEX check, play-in-Steam action, touch route thread, scroll scale

fexReady needs a FEX binary in Steam's FEX tool, not just its folder.
The play-in-Steam action stays until the link is handled, so Run Steam
at startup can't start a session first. The pad touch route reads the
mouse mode without side effects off the main thread and posts the pad
update there. Vertical scroll uses the output height. A status-2 unpack
counts only when AppRun is there. The xdg-open command is tested
end to end for Steam links.

* Open the launcher through Steam, recover dropped shortcuts, sign out of both

The Epic Games Launcher now runs as its own Steam shortcut, so opening
it starts Steam, which opens the launcher, and Play inside it goes to
the running Steam.

Steam dropped a running shortcut from its library when the game exited
after a sleep/wake replay or a server re-logon, and launching it then
waited forever at ShowInterstitials. login1 only replays sleep/wake
when Steam is asleep. The session restarts Steam when a requested
shortcut is missing, and when a game exits with its shortcut gone and
nothing else runs.

Resuming after a long pause no longer reports failure while traced
processes are still waking, so "Steam is paused" goes away on the first
tap.

Signing out of the launcher signs DroidDeck's Epic store out, and
signing out in DroidDeck restarts the launcher signed out and clears
the Epic web cookies.

* Address review: one session-switch poll, Epic setup can't block a session

A new switch confirmation replaces the pending poll instead of adding a
second one that could start the session again. Epic library sync and
install-folder setup at session start are each guarded, so a bad
preference no longer stops the guest from launching.

* Uninstall the Epic Games Launcher from the Games tab

An Uninstall button next to Launch asks first, closes a running
session, and removes the launcher and its runtime. The launcher's
sign-in and install records stay, so its games keep their Games-tab
entries and a reinstall comes back signed in. Its Steam shortcut goes
away on the next Steam start.

* Address review: uninstall only after the session has ended

The launcher's files are removed only once the session is not running
and its phase has ended; a shutdown still in progress after the wait
reports failure instead. The confirmation reads the session state from
the front-end state.

* Find FEX that Steam installed on the second library

Steam's tools on a second library live in DroidDeck's private copy,
which the session binds over the library. The launcher's FEX check
only looked on the shared storage, so with FEX there it always asked
Steam for FEX and only Steam opened. It now checks the private copy
too.

* Start games without Steam, per-game Settings menu with Wine sync

"Start without Steam" now really leaves the Steam client out: the game
runs in its own Proton/FEX through droiddeck-proton-run in a run
session, and the Epic Games Launcher opens on its own with its games
playing in it. Run sessions for these games are not pinned to the big
cores and get DirectAudio and the added-games list like Steam.

The Games tab card is now "Settings", titled "<game> Settings": Start
without Steam, FEX preset, Wine sync (ntsync, fsync, esync, wineserver
or the app default) and Default, which puts everything changed for the
game back to the app's settings. The app-wide Wine sync choice is shown
in the Steam settings Session tab.

* Address review: uninstall guard, routed games, shortcut matching

Opening or reinstalling the Epic Games Launcher waits while it is being
uninstalled. Added games that are Steam installs keep their Start
without Steam setting under their Steam app id and start as that Steam
game. Live shortcut lookups wait for Steam's library to load and match
a same-name shortcut by its executable, so no duplicate is added. The
session treats the open launcher as itself even when it could not tell
its Steam app id.

* Address review: drop a queued launcher switch when it is uninstalled

A confirmed switch to the Epic Games Launcher that is still waiting for
the old session to end is cancelled when the launcher is uninstalled,
and never starts while the uninstall runs. The launcher id test sets
its environment for its own runs only.
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-10-17 14:40:39 -04:00
1 parent 16f9916825
commit 2fe4d5303c
107 files changed
+8860 -371

No files matched your search

@@ -0,0 +1,226 @@
package com.droiddeck.launcher.input
import android.view.KeyEvent
import android.view.MotionEvent
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [28], manifest = Config.NONE)
class PadMouseTest {
private val events = mutableListOf<String>()
private var scrolledX = 0f
private var scrolledY = 0f
private var now = 1000L
private lateinit var pad: PadMouse
private val listener = object : PadMouse.Listener {
override fun active() = true
override fun onScrollStart() { events += "scroll start" }
override fun onScroll(dx: Float, dy: Float) {
scrolledX += dx
scrolledY += dy
}
override fun onKey(evdev: Int, pressed: Boolean) { events += "key $evdev ${if (pressed) "down" else "up"}" }
override fun onKeyboard() { events += "keyboard" }
override fun onNavigate() {}
override fun scrollSpeed() = 2000f
}
@Before fun setUp() {
pad = PadMouse(listener) { now }
}
@Test fun aOpensTheSelection() {
key(KeyEvent.KEYCODE_BUTTON_A, true)
key(KeyEvent.KEYCODE_BUTTON_A, false)
key(KeyEvent.KEYCODE_DPAD_DOWN, true)
key(KeyEvent.KEYCODE_DPAD_DOWN, false)
key(KeyEvent.KEYCODE_BUTTON_A, true)
key(KeyEvent.KEYCODE_BUTTON_A, false)
assertEquals(listOf("key 28 down", "key 28 up", "key 108 down", "key 108 up", "key 28 down", "key 28 up"), events)
}
@Test fun rightStickScrollsByHowFarItIsPushedThenSettlesTheSelection() {
motion(rightY = 0.5f)
pad.step(0.1f)
assertEquals(33.9f, scrolledY, 0.1f)
motion(rightY = 1f, rightX = -1f)
pad.step(0.1f)
assertEquals(175.3f, scrolledY, 0.1f)
assertEquals(-141.4f, scrolledX, 0.1f)
motion()
pad.step(0.1f)
pad.step(0.1f)
assertEquals(listOf("scroll start", "key 183 down", "key 183 up"), events)
}
@Test fun eachControllerKeepsItsOwnSticksAndButtons() {
motion(rightY = 1f, device = 1)
motion(device = 2)
pad.step(0.1f)
assertEquals(200f, scrolledY, 0.01f)
key(KeyEvent.KEYCODE_BUTTON_A, true, device = 1)
key(KeyEvent.KEYCODE_BUTTON_A, true, device = 2)
key(KeyEvent.KEYCODE_BUTTON_A, false, device = 2)
assertEquals(listOf("scroll start", "key 28 down"), events)
key(KeyEvent.KEYCODE_BUTTON_A, false, device = 1)
assertEquals(listOf("scroll start", "key 28 down", "key 28 up"), events)
}
@Test fun resetLetsGoOfAHeldModifierAndTheNextPressWorks() {
key(KeyEvent.KEYCODE_BUTTON_L1, true)
pad.reset()
key(KeyEvent.KEYCODE_BUTTON_L1, false)
key(KeyEvent.KEYCODE_BUTTON_Y, true)
pad.reset()
key(KeyEvent.KEYCODE_BUTTON_Y, true)
assertEquals(listOf("key 29 down", "key 104 down", "key 104 up", "key 29 up", "keyboard", "keyboard"), events)
}
@Test fun leftStickMovesFromHalfway() {
motion(leftX = 0.45f)
pad.step(0.016f)
motion(leftX = 0.55f)
pad.step(0.016f)
assertEquals(listOf("key 106 down", "key 106 up"), events)
}
@Test fun otherButtons() {
for (code in listOf(KeyEvent.KEYCODE_BUTTON_X, KeyEvent.KEYCODE_BUTTON_B, KeyEvent.KEYCODE_BUTTON_START,
KeyEvent.KEYCODE_BUTTON_L1, KeyEvent.KEYCODE_BUTTON_R1)) {
key(code, true)
key(code, false)
}
assertEquals(listOf("key 127 down", "key 127 up", "key 1 down", "key 158 down", "key 158 up", "key 1 up", "key 28 down", "key 28 up",
"key 29 down", "key 104 down", "key 104 up", "key 29 up", "key 29 down", "key 109 down", "key 109 up", "key 29 up"), events)
}
@Test fun yOpensTheKeyboardOnce() {
key(KeyEvent.KEYCODE_BUTTON_Y, true)
pad.onKey(KeyEvent(0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BUTTON_Y, 1))
key(KeyEvent.KEYCODE_BUTTON_Y, false)
assertEquals(listOf("keyboard"), events)
}
@Test fun guideAndSelectStayWithTheGamepad() {
assertFalse(pad.onKey(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BUTTON_MODE)))
assertFalse(pad.onKey(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BUTTON_SELECT)))
assertTrue(pad.onKey(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BUTTON_R2)))
assertEquals(emptyList<String>(), events)
}
@Test fun dpadKeysAndHatShareOnePress() {
key(KeyEvent.KEYCODE_DPAD_RIGHT, true)
motion(hatX = 1f)
key(KeyEvent.KEYCODE_DPAD_RIGHT, false)
motion()
motion(hatY = -1f)
motion()
assertEquals(listOf("key 106 down", "key 106 up", "key 103 down", "key 103 up"), events)
}
@Test fun heldDpadRepeatsAtTheMenuPace() {
key(KeyEvent.KEYCODE_DPAD_RIGHT, true)
pad.step(0.016f)
now += 299
pad.step(0.016f)
now += 1
pad.step(0.016f)
now += 120
pad.step(0.016f)
key(KeyEvent.KEYCODE_DPAD_RIGHT, false)
pad.step(0.016f)
now += 1000
pad.step(0.016f)
assertEquals(List(3) { listOf("key 106 down", "key 106 up") }.flatten(), events)
}
@Test fun leftStickStepsThroughItemsAndRepeats() {
motion(leftY = 1f)
pad.step(0.016f)
pad.step(0.016f)
now += 400
pad.step(0.016f)
now += 100
pad.step(0.016f)
now += 50
pad.step(0.016f)
motion()
pad.step(0.016f)
motion(leftX = -0.3f)
pad.step(0.016f)
assertEquals(listOf("key 108 down", "key 108 up", "key 108 down", "key 108 up", "key 108 down", "key 108 up"), events)
}
@Test fun touchPadDrivesTheSameMapping() {
val state = PadState()
state.press(PadState.A, true)
pad.onTouchPad(state)
state.press(PadState.A, false)
state.down = true
pad.onTouchPad(state)
state.down = false
state.rightTrigger = 1f
pad.onTouchPad(state)
pad.step(0.1f)
assertEquals(listOf("key 28 down", "key 28 up", "key 108 down", "key 108 up", "scroll start"), events)
assertEquals(200f, scrolledY, 0.01f)
}
@Test fun resetReleasesEverythingHeld() {
key(KeyEvent.KEYCODE_BUTTON_X, true)
key(KeyEvent.KEYCODE_DPAD_DOWN, true)
pad.reset()
key(KeyEvent.KEYCODE_DPAD_DOWN, false)
assertEquals(listOf("key 127 down", "key 108 down", "key 108 up", "key 127 up"), events)
}
@Test fun stickCurveIsGentleNearTheMiddle() {
val (half, _) = PadMouse.curve(0.575f, 0f)
assertEquals(0.25f, half, 0.01f)
assertEquals(0f to 0f, PadMouse.curve(0.1f, 0.1f))
}
@Test fun triggersScroll() {
motion(rightTrigger = 1f)
pad.step(0.1f)
assertEquals(200f, scrolledY, 0.01f)
motion(leftTrigger = 1f)
pad.step(0.1f)
assertEquals(0f, scrolledY, 0.01f)
motion()
pad.step(0.1f)
assertEquals(listOf("scroll start", "key 183 down", "key 183 up"), events)
}
private fun key(code: Int, down: Boolean, device: Int = 0) {
val action = if (down) KeyEvent.ACTION_DOWN else KeyEvent.ACTION_UP
assertTrue(pad.onKey(KeyEvent(0, 0, action, code, 0, 0, device, 0)))
}
private fun motion(leftX: Float = 0f, leftY: Float = 0f, rightX: Float = 0f, rightY: Float = 0f, hatX: Float = 0f, hatY: Float = 0f,
leftTrigger: Float = 0f, rightTrigger: Float = 0f, device: Int = 0) {
val properties = arrayOf(MotionEvent.PointerProperties().apply { id = 0; toolType = MotionEvent.TOOL_TYPE_UNKNOWN })
val coords = arrayOf(MotionEvent.PointerCoords().apply {
setAxisValue(MotionEvent.AXIS_X, leftX)
setAxisValue(MotionEvent.AXIS_Y, leftY)
setAxisValue(MotionEvent.AXIS_Z, rightX)
setAxisValue(MotionEvent.AXIS_RZ, rightY)
setAxisValue(MotionEvent.AXIS_HAT_X, hatX)
setAxisValue(MotionEvent.AXIS_HAT_Y, hatY)
setAxisValue(MotionEvent.AXIS_LTRIGGER, leftTrigger)
setAxisValue(MotionEvent.AXIS_RTRIGGER, rightTrigger)
})
val event = MotionEvent.obtain(0, 0, MotionEvent.ACTION_MOVE, 1, properties, coords, 0, 0, 1f, 1f, device, 0,
android.view.InputDevice.SOURCE_JOYSTICK, 0)
pad.onMotion(event)
event.recycle()
}
}
@@ -0,0 +1,190 @@
package com.droiddeck.launcher.input
import android.os.Looper
import android.view.MotionEvent
import java.time.Duration
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.Shadows.shadowOf
import org.robolectric.annotation.Config
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [28], manifest = Config.NONE)
class ScrollTouchGesturesTest {
private val events = mutableListOf<String>()
private var scrolledX = 0f
private var scrolledY = 0f
private lateinit var gestures: ScrollTouchGestures
private var time = 1000L
private var downTime = 0L
private val listener = object : ScrollTouchGestures.Listener {
override fun onMove(x: Float, y: Float) { events += "move ${x.toInt()},${y.toInt()}" }
override fun onButton(button: Int, pressed: Boolean) {
val name = if (button == PointerGestures.BTN_RIGHT) "right" else "left"
events += "$name ${if (pressed) "down" else "up"}"
}
override fun onScroll(dx: Float, dy: Float) {
scrolledX += dx
scrolledY += dy
}
override fun onLongPress() { events += "long press" }
}
@Before fun setUp() {
gestures = ScrollTouchGestures(SLOP, MIN_FLING, listener)
}
@Test fun tapClicksWhereTheFingerIs() {
touch(MotionEvent.ACTION_DOWN, 400f, 300f)
advance(80)
touch(MotionEvent.ACTION_UP, 400f, 300f)
advance(100)
assertEquals(listOf("move 400,300", "left down", "left up"), events)
}
@Test fun draggingScrollsWithTheFingerAndNeverClicks() {
touch(MotionEvent.ACTION_DOWN, 400f, 800f)
advance(200)
touch(MotionEvent.ACTION_MOVE, 403f, 600f)
advance(200)
touch(MotionEvent.ACTION_MOVE, 405f, 300f)
advance(200)
touch(MotionEvent.ACTION_UP, 405f, 300f)
advance(100)
assertEquals(500f, scrolledY, 0.01f)
assertEquals(0f, scrolledX, 0.01f)
assertEquals(listOf("move 400,800"), events)
}
@Test fun sidewaysDragScrollsSideways() {
touch(MotionEvent.ACTION_DOWN, 900f, 400f)
advance(200)
touch(MotionEvent.ACTION_MOVE, 600f, 410f)
advance(200)
touch(MotionEvent.ACTION_UP, 600f, 410f)
assertEquals(300f, scrolledX, 0.01f)
assertEquals(0f, scrolledY, 0.01f)
}
@Test fun quickSwipeKeepsScrollingAfterLiftingAndATapStopsIt() {
touch(MotionEvent.ACTION_DOWN, 400f, 900f)
advance(16)
touch(MotionEvent.ACTION_MOVE, 400f, 800f)
advance(16)
touch(MotionEvent.ACTION_MOVE, 400f, 700f)
advance(16)
touch(MotionEvent.ACTION_UP, 400f, 600f)
val lifted = scrolledY
repeat(3) { shadowOf(Looper.getMainLooper()).runOneTask() }
assertTrue(scrolledY > lifted)
touch(MotionEvent.ACTION_DOWN, 400f, 300f)
val stopped = scrolledY
advance(80)
touch(MotionEvent.ACTION_UP, 400f, 300f)
advance(500)
assertEquals(stopped, scrolledY, 0.01f)
assertFalse(events.contains("left down"))
}
@Test fun longPressRightClicks() {
touch(MotionEvent.ACTION_DOWN, 400f, 300f)
advance(600)
touch(MotionEvent.ACTION_UP, 402f, 301f)
advance(100)
assertEquals(listOf("move 400,300", "long press", "right down", "right up"), events)
}
@Test fun longPressThenMoveDragsWithTheLeftButton() {
touch(MotionEvent.ACTION_DOWN, 400f, 300f)
advance(600)
touch(MotionEvent.ACTION_MOVE, 500f, 300f)
advance(50)
touch(MotionEvent.ACTION_UP, 500f, 300f)
assertEquals(listOf("move 400,300", "long press", "left down", "move 500,300", "left up"), events)
assertEquals(0f, scrolledY, 0.01f)
}
@Test fun cancelReleasesAHeldDrag() {
touch(MotionEvent.ACTION_DOWN, 400f, 300f)
advance(600)
touch(MotionEvent.ACTION_MOVE, 500f, 300f)
gestures.cancel()
assertEquals("left up", events.last())
events.clear()
touch(MotionEvent.ACTION_UP, 500f, 300f)
advance(100)
assertEquals(emptyList<String>(), events)
}
@Test fun aLiftAfterACancelDoesNotClick() {
touch(MotionEvent.ACTION_DOWN, 400f, 300f)
advance(50)
gestures.cancel()
touch(MotionEvent.ACTION_UP, 400f, 300f)
advance(100)
assertEquals(listOf("move 400,300"), events)
}
@Test fun aSecondFingerDoesNotJumpTheScroll() {
touch(MotionEvent.ACTION_DOWN, 400f, 900f)
advance(100)
touch(MotionEvent.ACTION_MOVE, 400f, 700f)
advance(100)
pointers(MotionEvent.ACTION_POINTER_DOWN, 1, 0 to (400f to 700f), 1 to (900f to 200f))
advance(100)
pointers(MotionEvent.ACTION_POINTER_UP, 0, 0 to (400f to 700f), 1 to (900f to 200f))
advance(100)
pointers(MotionEvent.ACTION_UP, 0, 1 to (900f to 150f))
advance(500)
assertEquals(200f, scrolledY, 0.01f)
assertFalse(events.contains("left down"))
}
@Test fun wheelUnitsLandOnWholePixelsOfWebKitsLineStep() {
for (view in listOf(720, 1280)) {
val step = kotlin.math.floor(Math.pow(view.toDouble(), 2.0 / 3.0)).toFloat()
for (pixels in -300..300) {
val scrolled = ScrollTouchGestures.wheelUnits(pixels, view) / 120f * step
assertEquals(pixels, scrolled.toInt())
}
}
assertEquals(0, ScrollTouchGestures.wheelUnits(0, 720))
assertEquals(2, ScrollTouchGestures.wheelUnits(1, 720))
assertEquals(-2, ScrollTouchGestures.wheelUnits(-1, 720))
}
private fun advance(ms: Long) {
time += ms
shadowOf(Looper.getMainLooper()).idleFor(Duration.ofMillis(ms))
}
private fun touch(action: Int, x: Float, y: Float) {
if (action == MotionEvent.ACTION_DOWN) downTime = time
val event = MotionEvent.obtain(downTime, time, action, x, y, 0)
gestures.onTouch(event)
event.recycle()
}
private fun pointers(action: Int, index: Int, vararg at: Pair<Int, Pair<Float, Float>>) {
val properties = at.map { (id, _) ->
MotionEvent.PointerProperties().apply { this.id = id; toolType = MotionEvent.TOOL_TYPE_FINGER }
}.toTypedArray()
val coords = at.map { (_, xy) ->
MotionEvent.PointerCoords().apply { x = xy.first; y = xy.second; pressure = 1f; size = 1f }
}.toTypedArray()
val event = MotionEvent.obtain(downTime, time, action or (index shl MotionEvent.ACTION_POINTER_INDEX_SHIFT), at.size, properties, coords, 0, 0, 1f, 1f, 0, 0, 0, 0)
gestures.onTouch(event)
event.recycle()
}
private companion object {
const val SLOP = 8f
const val MIN_FLING = 50f
}
}