Compare commits

..
Author SHA1 Message Date
The412Banner f8fb1db3c8 fix(dual-screen): DiRT stand-in put back for the Proton the game ran on
When a DiRT 3 / DiRT Showdown game was switched to another Proton, the first
launch swapped the stand-in in for the old Proton's ws2_32.dll link; Proton
then relinked the prefix's other DLLs to itself but left the stand-in, and
the old link went back after the game. With telemetry off the game would then
load the old Proton's ws2_32.dll under the new Wine. The launch now links the
running Proton's ws2_32.dll back instead when the saved link belongs to
another Proton (compared by real path, so esync packs that reach the stock
files through a linked folder count as the same Proton).
2026-10-31 23:39:19 +00:00
The412Banner e6e3673709 feat(dual-screen): speed leads the racing dashes, in mph or km/h
- Speedometer, Circuit and Glance show the speed as the big number; the
  unit and the gear sit under it.
- Speed units: Automatic (default), km/h or mph, a row on the In-game stats
  page; a tap moves to the next one. Automatic is mph where road speed limits
  are signed in mph (the United States and its territories, the United
  Kingdom and its Crown Dependencies, Liberia, the Bahamas, Belize) by the
  phone's region, else km/h. Every dash follows it: speed numbers, the
  speedometer dial (0-140 mph or 0-220 km/h), the Dials gauge and the Trace
  chart.
2026-10-31 22:40:29 +00:00
The412Banner 268dcef559 fix(dual-screen): DiRT 3 and DiRT Showdown telemetry no longer stops the game (error 10038)
DiRT 3 and DiRT Showdown keep sending motion telemetry on the UDP socket they
closed at the end of a race (and when leaving Joyride); sendto() fails with
WSAENOTSOCK and the game stops with "sendto failed with error 10038".

- tools/dirt-ws2: a 32-bit ws2_32.dll stand-in. Every export jumps to the
  same-ordinal export of Wine's own ws2_32.dll; only a sendto() failing with
  10038 reports 0 bytes sent. Built in CI (components recipe dirt-ws2, clang +
  lld) with its exports checked against Wine 11's list, staged to
  /usr/local/lib/droiddeck-dirt.
- droiddeck-game-env: for dirt3_game.exe / showdown.exe / showdown_avx.exe
  with the game's UDP/motion output on, and a Proton whose own ws2_32.dll lacks
  the fix, the stand-in replaces the prefix's syswow64/ws2_32.dll (Wine loads
  ws2_32 as a KnownDLL from there, so a copy beside the game is ignored) with
  WINEDLLOVERRIDES=ws2_32=n,b; the launch waits for the game and puts the
  prefix's own file back. A copy left by a killed launch is put back at the
  next launch in that prefix.
- Automatic turns DiRT 3 and DiRT Showdown on like the other games again; the
  crash warning and the switched-on-by-hand memory from the previous build
  are gone.

Same behaviour as DiRTTelemetryErrorFix by RoccoC (MIT), based on the fix by
Carsten Gottschling. DroidDeck-Proton gets the same rule in its own ws2_32
(branch fix/dirt-telemetry-sendto); the swap is skipped there.
2026-10-31 21:55:36 +00:00
The412Banner 66abf0c707 fix(dual-screen): tap-only In-game stats styles; Automatic leaves DiRT 3 and Showdown off
- The Layout row is gone; tapping the top strip or the dash changes its
  style, and one line under the page says so.
- DiRT 3 and DiRT Showdown can stop at the end of a race with WinSock error
  10038 while their UDP output is on (a known game bug; the community
  workaround by RoccoC/DiRTTelemetryErrorFix intercepts that error).
  Automatic now leaves those two off and puts back one it had switched on;
  their switch says why, and turning it on by hand is remembered.
- A switch locked while its game runs keeps its on colours instead of
  looking off.
- The Circuit dash hides the fuel and tyre cards when the game sends
  neither (DiRT Showdown).
2026-10-31 20:26:16 +00:00
The412Banner 5be04466af feat(dual-screen): In-game stats strips and dashes with the DroidDeck logo
The In-game stats page gets a top strip and a racing dash the user picks
separately; both are remembered and cleared by Reset settings.

Top strip, in FusionHUD's metric colors: Panel (an outlined panel with the
DroidDeck badge beside the FPS, frame time, a frame-time graph, CPU, GPU,
RAM and battery rows), Tiles (four tiles with a 30-second line) and Rings.
Tiles and Rings carry the DroidDeck mark, wordmark and clock above them.

Dash: Speedometer (speed dial with the rev band, gear, pedals, G-force and
steering), Circuit (shift lights, gear, timing with best lap, fuel, tire
temperatures), Trace (10 s of throttle and brake, speed below), Dials
(speed and rev dials, OutGauge dashboard lights, turbo and temperatures)
and Glance; Auto picks Speedometer for Codemasters, Circuit for Forza and
Dials for OutGauge. War Thunder gets a Flight layout (IAS and altitude
tapes, throttle, G, fuel) and Elite Dangerous a Ship layout (pips, fuel,
cargo, legal state, credits). Every readout card shows the DroidDeck mark
in its title, drawn with the HUD's own DroidDeckMark.

Tapping the strip or the dash moves to the next style; a Layout row at the
bottom of the page picks either directly.

Telemetry now also reads Codemasters steering and G-force (DiRT Showdown's
38 floats carry them), Forza best lap, steering, G-force and tire
temperatures (read as Fahrenheit, as community parsers do; unit not checked
on a device), and OutGauge turbo, engine and oil temperature and dashboard
lights. War Thunder keeps every number so the Flight layout finds fuel and
throttle; its list still shows the first 12.
2026-10-31 19:49:47 +00:00
The412Banner 63ad5a722f feat(dual-screen): Send dashboard data Automatic, on by default
Automatic keeps the data output on for every game the In-game stats page
finds. The session applies it whenever the focused game changes (session
start, a game starting, a game closing) on devices with a second screen,
skipping the running game. Games the user switches off by hand stay off;
switching Automatic off puts every game DroidDeck changed back to its own
setting. Both settings are cleared by Reset settings.
2026-10-31 19:49:47 +00:00
The412Banner f896d7fa75 feat(dual-screen): Send dashboard data switch on the In-game stats page
Codemasters games keep their UDP/motion output in
My Games/<game>/hardwaresettings/hardware_settings_config.xml inside the
game's Proton prefix. The page finds those files in every library's
compatdata and offers a switch per game: on points the udp (or motion) line
at 127.0.0.1:20777 with extradata 3 and keeps the file as it was beside it;
off puts that line back. Only that line changes, the file is replaced in one
rename, and a game's switch is locked while that game runs. Installed games
whose output is a menu setting only (Forza, BeamNG.drive) get a line with
what to turn on. Library.compatdataDirs shares protonPrefix's library roots.
2026-10-31 19:49:46 +00:00
The412Banner 995cbc411c fix(dual-screen): show the online friends above Steam chat's group chat list
Steam gives its group chat list a fixed 114 px height plus an empty-list
note, which covered the online friends in the bottom-screen chat. The list
now shrinks to its rows (at most a quarter of the panel) and the note is
hidden; the GROUP CHATS bar and its + button stay.
2026-10-31 19:49:46 +00:00
The412Banner 5045002de1 feat(dual-screen): Dashboard opens on Chat; a game start shows In-game stats
With no tab picked yet the Dashboard opens on Chat; the last tab the user
tapped still opens next time. When a game starts while the Dashboard is
showing it switches to In-game stats. That switch is not saved, so the
user's own pick is kept.
2026-10-31 19:49:45 +00:00
The412Banner e75505c019 feat(dual-screen): open the Dashboard on the bottom screen by default
When nothing has been picked in the menu yet, the bottom screen opens on
the Dashboard on every dual-screen device. A mode the user picked is still
remembered and opens as before; a pick that can't open right now (deck
controls without the deck pad, Dashboard without pages) keeps the old
fallback.
2026-10-31 19:49:45 +00:00
The412Banner 264c0fc0f6 fix(dual-screen): one-line hint on the In-game stats page
The user found the per-game port list too long. The page shows the hint only
while no game sends data; setup details belong in the docs.
2026-10-31 19:49:44 +00:00
The412Banner 0f93fd75c4 fix(dual-screen): call the race dash tab In-game stats
The user found "Telemetry" sounded like DroidDeck collects data. The help
text now says the numbers come from the game's own output setting and stay
on the device (the page only listens on 127.0.0.1 and reads local files).
2026-10-31 19:49:43 +00:00
The412Banner 4deff589e5 fix(dual-screen): give the Steam chat WebView a real height; open chat with its tab
Probe from build 6 (now reverted): <html> itself was 0 px tall even with
height:100%!important, i.e. the page had a 0 px tall viewport. Compose's
AndroidView gives the WebView WRAP_CONTENT layout params, which make WebView
lay pages out at zero height, so the WebView is now MATCH_PARENT and the
height rules from 5468ae37 are dropped (Steam's own full-height layout should
then apply; not device-tested yet).

The chat now opens as soon as its tab is shown (user request), and after
Android ends its renderer in picture-in-picture it reopens on resume.
2026-10-31 19:49:43 +00:00
The412Banner 97853d0fde Revert "test(dual-screen): record the Steam chat element tree to events.jsonl"
This reverts commit cd452edca8.
2026-10-31 19:49:42 +00:00
The412Banner 2d5061c986 test(dual-screen): record the Steam chat element tree to events.jsonl
Test-only probe (sizes, flex settings, inline heights under .chat_main; no
text) to measure what still limits the friends column. Revert before merge.
2026-10-31 19:49:42 +00:00
The412Banner 6dab2cef17 fix(dual-screen): fill Steam chat's friends column; close the chat when its renderer ends
Build 5 hid the header but the friends column stayed short, so the full-height
rule now also covers .chat_main_flex, .friendsListContainer and .friendlist.

On the Retroid Pocket Duo Android ends the WebView renderer about a second after
DroidDeck goes to picture-in-picture (am_kill 'isolated not needed', seen twice);
the page left on the bottom screen was dead. Handle onRenderProcessGone by closing
the chat with a note to open it again.
2026-10-31 19:49:42 +00:00
The412Banner 3a4866e2ea fix(dual-screen): give Steam chat its full height and hide its site header
Measured on the Retroid Pocket Duo (layout probe, now removed): in the
WebView body, #friendslist-container and .chat_main came out 0 px tall,
which folded the friends list, and the site header is the element before
.chat_main_flex (its class name is generated, #global_header is not on
this page). Removes the test-only probe from 083bdc05/ac08f48b.
2026-10-31 19:49:42 +00:00
The412Banner 499b06ff2c test(dual-screen): write the chat layout probe to events.jsonl
The Retroid Pocket Duo's logcat keeps only error-level app lines, so the
Log.i probe from 083bdc05 never showed up. Test-only; remove with the fix.
2026-10-31 19:49:42 +00:00
The412Banner abca04336a test(dual-screen): log the Steam chat page's layout structure
Temporary, for the next device test only: 4 s and 12 s after the chat page
loads, log the element chain at the top, at the friends list and at the
bottom of the page, plus the body's children (tag, id, classes, position,
height; no text, long digit runs masked). Steam's header is not
#global_header there and the friends list stops short of the bottom, so
the real elements are needed before fixing it. To be removed with that fix.
2026-10-31 19:49:42 +00:00
The412Banner 5eaa6a76cc fix(dual-screen): listen for game telemetry on 127.0.0.1, not ::1
Android's InetAddress.getLoopbackAddress() always returns the IPv6
loopback (libcore InetAddress.java, "Android-changed"), so the listeners
were bound to [::1] and never saw the games' IPv4 packets to 127.0.0.1.
A listener bound to 127.0.0.1:20777 on the same Duo received DiRT
Showdown's packets.
2026-10-31 19:49:41 +00:00
The412Banner 42df3a78b3 fix(dual-screen): give the bottom-screen Steam chat room to lay out
At the panel's own scale Steam's desktop chat got about 600x300 CSS
pixels and its friends list collapsed under the group chats bar. The page
is now laid out wider and drawn at 0.75 of the panel's scale, Steam's site
header is hidden, and while the chat is open Close, mic and volume share
one row so the chat gets the rest of the screen.
2026-10-31 19:49:41 +00:00
The412Banner 30e009a651 fix(dual-screen): read DiRT Showdown's shorter telemetry packet
DiRT Showdown sends 152-byte packets (38 floats) on port 20777 even with
extradata 3; the page only accepted 256 bytes and stayed empty. The first
38 floats carry speed, rpm, gear, pedals, lap and lap time in the same
places, so they are read now and the rest (lap count, position, fuel, max
rpm) stays empty for these games. The page also says when a port gets
packets it cannot read, with their count and size.
2026-10-31 19:49:41 +00:00
The412Banner 9e28a11270 feat(dual-screen): bottom-screen Steam chat uses the Steam client's sign-in
Open Steam Chat copies the web sign-in Steam's built-in browser already
holds (its Chromium cookie store under config/htmlcache, "v10" values) for
steamcommunity.com and steam-chat.com into the chat page before it loads,
so no second login is needed. Values are never logged; the copy of the
store is deleted right after reading. With no Steam web sign-in yet, the
page shows Steam's sign-in as before.
2026-10-31 19:49:41 +00:00
The412Banner ed3cfaf9c6 fix(dual-screen): notification access page was hidden under the dashboard
Android opens the settings page on the bottom screen, under the dashboard
window, so the button seemed to do nothing. Open DroidDeck's own switch
there (Android 11+), hide the dashboard, and bring it back once access is
on (or when Dashboard is chosen again). The Chat page now says how to turn
the microphone on when the session has none.
2026-10-31 19:49:41 +00:00
The412Banner 082ea000dc fix(dual-screen): avoid name clashes in the bottom-screen pages; stop a telemetry listener on socket errors 2026-10-31 19:49:41 +00:00
The412Banner a251e8cc23 fix(dual-screen): close the screenshot folder comment 2026-10-31 19:49:41 +00:00
The412Banner 60184418ba feat(dual-screen): Telemetry page on the bottom screen
DroidDeck's own numbers (FPS while the HUD runs, CPU, GPU, battery, from
the HUD's sources) plus a live dash for racing games that send UDP
telemetry to 127.0.0.1: Codemasters "extradata 3" (DiRT Rally, DiRT 4,
GRID) on 20777, Forza Data Out (Motorsport 7/2023, Horizon 4/5) on 5300,
OutGauge (BeamNG.drive, Live for Speed) on 4444. War Thunder's local
state page and Elite Dangerous' Status.json show without setup. The
listeners and readers run only while the page is shown.
2026-10-31 19:49:41 +00:00
The412Banner 125e39ea9c feat(dual-screen): Chat & voice page on the bottom screen
Mic on/off for the session and game volume buttons (no Android volume
panel over the game), plus Steam's web chat, loaded only when opened and
kept to Steam's own sites. Keyboard keys typed on the dashboard stay on
the bottom screen; controller buttons still go to the game.
2026-10-31 19:49:40 +00:00
The412Banner ee8911a382 feat(dual-screen): Screenshots page on the bottom screen
A Take screenshot button copies the game frame (without the overlay) and
saves it to Pictures/DroidDeck. The gallery shows those plus the
screenshots Steam keeps under userdata; tap one to see it full size.
2026-10-31 19:49:40 +00:00
The412Banner 3be85906e9 feat(dual-screen): Downloads and Notifications pages on the bottom screen
Downloads: Steam downloads and updates (read from Steam's appmanifests,
including SD-card libraries), shader-cache downloads from the content log,
and DroidDeck store downloads, with progress and speed.

Notifications: other apps' notifications, after the user allows
notification access once. Kept in memory only, never saved or logged;
ongoing, summary and empty ones are skipped.
2026-10-31 19:49:40 +00:00
The412Banner e76592ba4e feat(dual-screen): Dashboard mode for the bottom screen
A new bottom-screen mode that holds pages (downloads, screenshots,
telemetry and more come in the next commits). It sizes itself from the
bottom display it is shown on, is offered only while it has pages, and
follows the existing Dual screen Auto/On/Off setting and display pick.
The last page is remembered.
2026-10-31 19:49:40 +00:00
18 changed files with 62 additions and 276 deletions

No files matched your search

+1 -3
View File
@@ -303,9 +303,7 @@ tasks.named('preBuild').configure { dependsOn(stageGogNotices) }
def verifyRuntimeInputs = tasks.register('verifyRuntimeInputs', Exec) {
mustRunAfter(stageSessionScripts, stageRuntimeAssets)
workingDir rootProject.projectDir
def allowStale = (project.findProperty('allowStaleRuntime')
?: localBuildOptions.getProperty('droiddeck.allowStaleRuntime', 'false')).toString().toBoolean()
commandLine([pythonExecutable, 'tools/release/runtime_inputs.py', 'verify'] + (allowStale ? ['--allow-stale-sources'] : []))
commandLine pythonExecutable, 'tools/release/runtime_inputs.py', 'verify'
}
tasks.configureEach { task ->
if (task.name in ['packageDebug', 'packageRelease']) task.dependsOn(verifyRuntimeInputs)
@@ -919,8 +919,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
window.setBackgroundDrawable(android.graphics.drawable.ColorDrawable(android.graphics.Color.BLACK))
},
)
// Also runs when a second screen appears, so Automatic applies then with the running game known.
LaunchedEffect(AgentGuest.focusRevision, secondScreenDisplays.isNotEmpty()) {
LaunchedEffect(AgentGuest.focusRevision) {
val nextGame = kotlinx.coroutines.withContext(kotlinx.coroutines.Dispatchers.IO) {
if (SessionState.mode == SessionService.MODE_RUN) SessionState.program?.let { "program:$it" }
else {
@@ -3133,9 +3132,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
dashboard = if (bottomPages().isEmpty()) null else ({
DroidDeckTheme {
BottomDashboard(
bottomPages(), com.droiddeck.launcher.ui.SessionBottomTab.picked(SessionState.sessionId),
bottomPages(), SessionPrefs.bottomPage(this),
gameStarts = gameStarts,
onPage = { com.droiddeck.launcher.ui.SessionBottomTab.pick(SessionState.sessionId, it) },
onPage = { SessionPrefs.setBottomPage(this, it) },
onClose = { selectSecondScreenMode(SecondScreenMode.NONE) },
onMenu = if (dockDrawer()) ({ drawerOpen = true }) else null,
)
@@ -3152,8 +3151,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
))
// A settings page opened on the bottom screen sits under the dashboard window, so the dashboard hides
// until the setting is on, or for at most SETTINGS_WATCH_CHECKS seconds when it is left off (another
// app's page closing cannot be seen); choosing Dashboard in the menu again shows it sooner.
// until the setting is on; choosing Dashboard in the menu again shows it sooner.
private fun openSettingsBelow(intent: android.content.Intent, done: () -> Boolean) {
val presentation = secondScreenPresentation ?: return
val options = android.app.ActivityOptions.makeBasic().setLaunchDisplayId(presentation.display.displayId)
@@ -3165,34 +3163,23 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
if (!opened) return
presentation.hide()
var checks = 0
// Show throws if the display went away while the settings page was open, as in showSecondScreen.
fun showAgain() {
try {
presentation.show()
} catch (e: Exception) {
Log.w(TAG, "could not show the dashboard again", e)
if (secondScreenPresentation === presentation) closeSecondScreen(reset = true)
}
}
uiHandler.postDelayed(object : Runnable {
override fun run() {
if (secondScreenPresentation !== presentation || presentation.isShowing) return
if (done()) {
showAgain()
presentation.show()
return
}
if (++checks < SETTINGS_WATCH_CHECKS) uiHandler.postDelayed(this, SETTINGS_WATCH_MS) else showAgain()
if (++checks < SETTINGS_WATCH_CHECKS) uiHandler.postDelayed(this, SETTINGS_WATCH_MS)
}
}, SETTINGS_WATCH_MS)
}
/** Copies the game frame (no overlay) at the size it is shown and saves it to Pictures/DroidDeck. */
private fun captureScreenshot(onDone: (Boolean) -> Unit) {
// With the glasses as the output the game is drawn on their surface; the phone's surface is hidden then.
val source = if (glassesOutputActive) glassesScreen?.surfaceView else if (::surfaceView.isInitialized) surfaceView else null
val width = source?.width ?: 0
val height = source?.height ?: 0
if (source == null || width <= 0 || height <= 0 || source.holder.surface?.isValid != true) {
val width = if (::surfaceView.isInitialized) surfaceView.width else 0
val height = if (::surfaceView.isInitialized) surfaceView.height else 0
if (width <= 0 || height <= 0 || surfaceView.holder.surface?.isValid != true) {
onDone(false)
return
}
@@ -3203,7 +3190,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
return
}
try {
android.view.PixelCopy.request(source, bitmap, { result ->
android.view.PixelCopy.request(surfaceView, bitmap, { result ->
if (result != android.view.PixelCopy.SUCCESS) {
bitmap.recycle()
onDone(false)
@@ -53,13 +53,10 @@ object BottomNotifications {
class BottomNotificationListener : NotificationListenerService() {
override fun onListenerConnected() {
BottomNotifications.clear()
runCatching { activeNotifications }.getOrNull()?.sortedBy { it.postTime }?.forEach { BottomNotifications.post(this, it) }
}
override fun onNotificationPosted(sbn: StatusBarNotification) = BottomNotifications.post(this, sbn)
override fun onNotificationRemoved(sbn: StatusBarNotification) = BottomNotifications.remove(sbn.key)
override fun onListenerDisconnected() = BottomNotifications.clear()
}
@@ -100,6 +100,12 @@ object SessionPrefs {
prefs(context).edit().putString("secondScreenPanel", mode).apply()
}
fun bottomPage(context: Context): String? = prefs(context).getString("bottomPage", null)
fun setBottomPage(context: Context, page: String) {
prefs(context).edit().putString("bottomPage", page).apply()
}
fun statsStrip(context: Context): String? = prefs(context).getString("statsStrip", null)
fun setStatsStrip(context: Context, id: String) {
@@ -23,7 +23,7 @@ object SteamDownloads {
val name = SteamDownloadMonitor.value(text, "name") ?: id
names[id] = name
fromManifest(id, name, text)
}.let(::onePerApp)
}
val homes = client?.let { listOf(if (it == "x86_64") SteamDownloadMonitor.STEAM_HOMES[1] else SteamDownloadMonitor.STEAM_HOMES[0]) }
?: SteamDownloadMonitor.STEAM_HOMES
val log = homes.map { File(runtimeRoot, "$it/logs/content_log.txt") }.filter { it.isFile }.maxByOrNull { it.lastModified() }
@@ -32,10 +32,6 @@ object SteamDownloads {
return apps + shaders
}
/** The arm64 and x86-64 Steam homes can both hold an unfinished manifest of one app; the page keys rows by app. */
internal fun onePerApp(downloads: List<SteamDownload>): List<SteamDownload> =
downloads.groupBy { it.appId }.values.map { same -> same.maxBy { it.done } }
internal fun fromManifest(id: String, name: String, text: String): SteamDownload? {
val flags = SteamDownloadMonitor.value(text, "StateFlags")?.toLongOrNull() ?: 0L
if (flags == FULLY_INSTALLED) return null
@@ -56,25 +56,7 @@ class BottomPage(
internal fun pickBottomPage(remembered: String?, ids: List<String>): String? =
ids.firstOrNull { it == remembered } ?: ids.firstOrNull { it == DEFAULT_PAGE } ?: ids.firstOrNull()
/**
* The tab picked during one session. Each Steam session starts with no pick, so the dashboard opens on Chat; reopened
* later in the same session it shows the tab picked last.
*/
internal object SessionBottomTab {
private var session: String? = null
private var tab: String? = null
@Synchronized
fun picked(sessionId: String?): String? = tab.takeIf { sessionId != null && sessionId == session }
@Synchronized
fun pick(sessionId: String?, id: String) {
session = sessionId
tab = id
}
}
/** The page a game start switches to; not remembered as the user's pick. */
/** The page a game start switches to; not saved, so the page the user picked still opens next time. */
internal fun pageForGameStart(ids: List<String>): String? = GAME_PAGE.takeIf { it in ids }
private const val DEFAULT_PAGE = "chat"
@@ -47,9 +47,7 @@ import com.droiddeck.launcher.hud.MangoReadings
import com.droiddeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.session.GameStatusFiles
import com.droiddeck.launcher.session.GameTelemetry
import com.droiddeck.launcher.input.SteamTouchConfig
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.session.SessionService
import com.droiddeck.launcher.session.SessionState
import com.droiddeck.launcher.session.SpeedUnit
import com.droiddeck.launcher.session.StatsDash
@@ -98,8 +96,6 @@ fun BottomTelemetryPage(fps: () -> Float?, runningGame: () -> String? = { null }
var outputs by remember { mutableStateOf<List<TelemetryOutput.Game>>(emptyList()) }
var menuGames by remember { mutableStateOf<List<TelemetryOutput.MenuGame>>(emptyList()) }
var running by remember { mutableStateOf<String?>(null) }
var gameName by remember { mutableStateOf<String?>(null) }
val steamClient = remember { if (SessionState.mode == SessionService.MODE_STEAM) SessionPrefs.activeSteamClientArch(context) else null }
var outputFailed by remember { mutableStateOf<String?>(null) }
var rescan by remember { mutableIntStateOf(0) }
var auto by remember { mutableStateOf(SessionPrefs.telemetryAuto(context)) }
@@ -220,11 +216,6 @@ fun BottomTelemetryPage(fps: () -> Float?, runningGame: () -> String? = { null }
runCatching { Library.steamGames(context).mapNotNull { TelemetryOutput.MENU_GAMES[it.appId] }.distinct() }.getOrDefault(emptyList())
}
}
LaunchedEffect(running) {
val id = running?.toLongOrNull()
gameName = if (id == null) null
else withContext(Dispatchers.IO) { runCatching { SteamTouchConfig.gameName(context, id.toInt()) }.getOrNull() }
}
LaunchedEffect(rescan) {
while (isActive) {
outputs = withContext(Dispatchers.IO) { runCatching { TelemetryOutput.scan(Library.compatdataDirs(context)) }.getOrDefault(emptyList()) }
@@ -235,8 +226,7 @@ fun BottomTelemetryPage(fps: () -> Float?, runningGame: () -> String? = { null }
Column(Modifier.fillMaxSize().verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(10.dp)) {
perfTick.let {
StatsStripView(strip, StripData(fpsNow, device, fpsHistory.snapshot(), cpuHistory.snapshot(), gpuHistory.snapshot(), wattsHistory.snapshot(), clock,
if (running != null) gameName else steamClient?.let { stringResource(steamClientLabel(it)) })) {
StatsStripView(strip, StripData(fpsNow, device, fpsHistory.snapshot(), cpuHistory.snapshot(), gpuHistory.snapshot(), wattsHistory.snapshot(), clock)) {
strip = strip.next()
SessionPrefs.setStatsStrip(context, strip.id)
}
@@ -335,9 +325,6 @@ private fun httpGet(url: String): String {
}
/** The Steam client the session runs, shown in the strip's top line while no game runs. */
internal fun steamClientLabel(arch: String): Int = if (arch == "x86_64") R.string.stats_steam_client_x86 else R.string.stats_steam_client_arm
@Composable
private fun ChoiceRow(title: String, value: String, onClick: () -> Unit) {
val colors = MaterialTheme.colorScheme
@@ -166,13 +166,18 @@ object DualScreenPanel {
return ownerTask.takeIf { it >= 0 }
}
internal fun tookFocus(fresh: Boolean, touchedAt: Long, now: Long): Boolean =
fresh || now - touchedAt in 0..TOUCH_FOCUS_MS
private const val TOUCH_FOCUS_MS = 1000L
internal fun returnFocus(context: Context, fromPanel: Boolean = false) {
val task = focusTask(fromPanel) ?: return
runCatching { (context.getSystemService(Context.ACTIVITY_SERVICE) as android.app.ActivityManager).moveTaskToFront(task, 0) }
}
internal fun reclaimFocus(context: Context) {
val task = focusTask(true) ?: return
val task = focusTask(false) ?: return
val manager = context.getSystemService(Context.ACTIVITY_SERVICE) as android.app.ActivityManager
runCatching {
manager.appTasks.firstOrNull {
@@ -240,16 +245,21 @@ class DualScreenActivity : ComponentActivity() {
}
private var topResumed = false
private var fresh = true
private var touchedAt = Long.MIN_VALUE
override fun onTopResumedActivityChanged(isTopResumedActivity: Boolean) {
super.onTopResumedActivityChanged(isTopResumedActivity)
topResumed = isTopResumedActivity
if (isTopResumedActivity && !DualScreenPanel.typingShown) DualScreenPanel.returnFocus(this, fromPanel = true)
val took = DualScreenPanel.tookFocus(fresh, touchedAt, android.os.SystemClock.uptimeMillis())
fresh = false
if (isTopResumedActivity && !DualScreenPanel.typingShown) DualScreenPanel.returnFocus(this, fromPanel = took)
}
override fun dispatchTouchEvent(event: android.view.MotionEvent): Boolean {
if (event.actionMasked == android.view.MotionEvent.ACTION_DOWN && topResumed && !DualScreenPanel.typingShown) {
DualScreenPanel.returnFocus(this, fromPanel = true)
if (event.actionMasked == android.view.MotionEvent.ACTION_DOWN) {
touchedAt = event.downTime
if (topResumed && !DualScreenPanel.typingShown) DualScreenPanel.returnFocus(this, fromPanel = true)
}
return super.dispatchTouchEvent(event)
}
@@ -39,7 +39,6 @@ import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
@@ -96,16 +95,13 @@ private fun LogoBadge(size: Dp) {
}
}
/** The mark and "DroidDeck" on the left, the running game's name in the middle, the clock on the right. */
@Composable
private fun LogoHeader(clock: String, game: String?) {
private fun LogoHeader(clock: String) {
val colors = MaterialTheme.colorScheme
Row(Modifier.fillMaxWidth().padding(horizontal = 2.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp), modifier = Modifier.padding(horizontal = 2.dp)) {
DroidDeckLogo(16.dp)
Text("DroidDeck", fontSize = 13.sp, fontWeight = FontWeight.Bold, color = colors.onBackground)
Text(game.orEmpty(), fontSize = 13.sp, fontWeight = FontWeight.Bold, color = colors.onBackground, textAlign = TextAlign.Center,
maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f))
if (clock.isNotEmpty()) Text(clock, fontSize = 12.sp, fontFamily = FontFamily.Monospace, color = colors.onSurfaceVariant)
if (clock.isNotEmpty()) Text("· $clock", fontSize = 12.sp, fontFamily = FontFamily.Monospace, color = colors.onSurfaceVariant)
}
}
@@ -150,7 +146,6 @@ internal class StripData(
val gpuHistory: List<Float>,
val wattsHistory: List<Float>,
val clock: String,
val game: String? = null,
)
private fun percentTemp(percent: Int?, temp: Int?): String =
@@ -217,7 +212,7 @@ private fun TilesStrip(d: StripData) {
val gpuPercent: Int? = s?.gpuPercent
val gpuTemp: Int? = s?.gpuTempC
Column(Modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(6.dp)) {
LogoHeader(d.clock, d.game)
LogoHeader(d.clock)
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
HistoryTile("FPS", accent, fpsText(d.fps), "fps", d.fpsHistory, 75f)
HistoryTile("CPU", StatsColors.cpu, s?.cpuPercent?.let { "$it%" } ?: "–", s?.cpuTempC?.let { "$it°" } ?: "", d.cpuHistory, 100f)
@@ -253,7 +248,7 @@ private fun RingsStrip(d: StripData) {
val gpuPercent: Int? = s?.gpuPercent
val gpuTemp: Int? = s?.gpuTempC
Column(Modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(6.dp)) {
LogoHeader(d.clock, d.game)
LogoHeader(d.clock)
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
RingTile("CPU", StatsColors.cpu, s?.cpuPercent?.let { it / 100f }, s?.cpuPercent?.let { "$it%" } ?: "–", s?.cpuTempC?.let { "$it °C" } ?: "")
RingTile("GPU", StatsColors.gpu, gpuPercent?.let { it / 100f }, gpuPercent?.let { "$it%" } ?: gpuTemp?.let { "$it°" } ?: "–",
-2
View File
@@ -1903,8 +1903,6 @@
<string name="stats_gear">Gear</string>
<string name="stats_speed_units">Speed units</string>
<string name="stats_speed_units_auto">Automatic (%1$s)</string>
<string name="stats_steam_client_arm">Steam Client ARM</string>
<string name="stats_steam_client_x86">Steam Client x86</string>
<string name="stats_throttle">Throttle</string>
<string name="stats_brake">Brake</string>
<string name="stats_lights">Dashboard</string>
@@ -17,13 +17,6 @@ class SteamDownloadsTest {
}
""".trimIndent()
@Test fun anAppUnfinishedInBothSteamHomesIsListedOnce() {
val arm = SteamDownload("220", "Half-Life 2", 10L, 100L)
val x86 = SteamDownload("220", "Half-Life 2", 60L, 100L)
val other = SteamDownload("440", "Team Fortress 2", 5L, 50L)
assertEquals(listOf(x86, other), SteamDownloads.onePerApp(listOf(arm, x86, other)))
}
@Test fun anInstalledGameIsNotADownload() {
assertNull(SteamDownloads.fromManifest("220", "Half-Life 2", manifest(4, 100, 100)))
}
@@ -55,17 +55,4 @@ class BottomTelemetryLapTimeTest {
assertEquals("1:23.456", lapTime(83.456f))
assertEquals("0:05.000", lapTime(5f))
}
@Test fun eachSessionStartsWithoutAPickedTab() {
SessionBottomTab.pick("2026-11-01-01-steam", "screenshots")
assertEquals("screenshots", SessionBottomTab.picked("2026-11-01-01-steam"))
assertNull(SessionBottomTab.picked("2026-11-01-02-steam"))
assertNull(SessionBottomTab.picked(null))
assertEquals("chat", pickBottomPage(SessionBottomTab.picked("2026-11-01-02-steam"), listOf("telemetry", "chat", "screenshots")))
}
@Test fun theStripNamesTheSteamClient() {
assertEquals(com.droiddeck.launcher.R.string.stats_steam_client_x86, steamClientLabel("x86_64"))
assertEquals(com.droiddeck.launcher.R.string.stats_steam_client_arm, steamClientLabel("arm64"))
}
}
@@ -81,4 +81,13 @@ class DualScreenPanelOwnerTest {
DualScreenPanel.show(app, 2, 10)
assertEquals(10, DualScreenPanel.focusTask(fromPanel = false))
}
@Test fun thePanelTookFocusWhenItJustOpenedOrWasJustTouched() {
assertTrue(DualScreenPanel.tookFocus(fresh = true, touchedAt = Long.MIN_VALUE, now = 5_000L))
assertTrue(DualScreenPanel.tookFocus(fresh = false, touchedAt = 4_700L, now = 5_000L))
assertTrue(DualScreenPanel.tookFocus(fresh = false, touchedAt = 5_000L, now = 5_000L))
assertFalse(DualScreenPanel.tookFocus(fresh = false, touchedAt = 3_500L, now = 5_000L))
assertFalse(DualScreenPanel.tookFocus(fresh = false, touchedAt = Long.MIN_VALUE, now = 5_000L))
assertFalse(DualScreenPanel.tookFocus(fresh = false, touchedAt = 6_000L, now = 5_000L))
}
}
@@ -774,18 +774,6 @@ def proton_has_dirt_fix(proton):
return False
WINE_DLL_DIRS = ("/lib/wine/i386-windows", "/lib/wine/x86_64-windows", "/lib/wine/aarch64-windows", "/lib/wine",
"/lib/wine/fakedlls", "/lib64/wine", "/lib64/wine/fakedlls", "/lib64/wine/x86_64-windows")
def is_wine_dll_link(path):
"""A link into a Wine DLL folder: the rule Proton uses to tell its own DLLs in a prefix (file_is_wine_builtin_dll)."""
try:
return os.path.islink(path) and os.path.dirname(os.readlink(path)).endswith(WINE_DLL_DIRS)
except OSError:
return False
def prefix_ws2(prefix):
return Path(prefix) / "pfx/drive_c/windows/syswow64/ws2_32.dll"
@@ -825,9 +813,8 @@ def swap_dirt_ws2(prefix):
def restore_dirt_ws2(prefix, proton):
"""Puts a Wine syswow64/ws2_32.dll back if the stand-in is still there; true when it changed something.
That is the prefix's own one, unless it was a link to a Wine DLL folder and the game ran on another Proton since
the swap: Proton then relinked the prefix's other DLLs to itself but left the stand-in, so a link to the running
Proton's ws2_32.dll goes back instead. Anything else (a native file, a link to a mod's DLL) goes back as it was."""
That is the prefix's own one, unless the game ran on another Proton since the swap: Proton then relinked the
prefix's other DLLs to itself but left the stand-in, so the running Proton's ws2_32.dll goes back instead."""
target = prefix_ws2(prefix)
saved = target.with_name(target.name + DIRT_SAVED)
own = proton_ws2(proton)
@@ -836,7 +823,7 @@ def restore_dirt_ws2(prefix, proton):
if os.path.lexists(target) and not is_dirt_stand_in(target):
os.unlink(saved)
return False
if not own.is_file() or not is_wine_dll_link(saved) or os.path.realpath(saved) == os.path.realpath(own):
if not own.is_file() or os.path.realpath(saved) == os.path.realpath(own):
os.replace(saved, target)
return True
os.unlink(saved)
@@ -857,12 +844,9 @@ def wait_forwarding_signals(process):
except OSError:
pass
previous = {signum: signal.signal(signum, forward) for signum in (signal.SIGTERM, signal.SIGINT, signal.SIGHUP)}
try:
code = process.wait()
finally:
for signum, handler in previous.items():
signal.signal(signum, handler)
for signum in (signal.SIGTERM, signal.SIGINT, signal.SIGHUP):
signal.signal(signum, forward)
code = process.wait()
return 128 - code if code < 0 else code
@@ -872,11 +856,7 @@ def start(launch, launch_env, digest, after=None):
try:
return wait_forwarding_signals(process)
finally:
try:
after()
except OSError as error:
print("droiddeck-game-env: DiRT telemetry fix: prefix ws2_32 not put back (%s); the next launch does it" % error,
file=sys.stderr)
after()
if digest:
code = subprocess.run(launch, env=launch_env, check=False).returncode
if code == 0:
@@ -974,21 +954,14 @@ def main():
if app_id and prefix and len(command) > 1 and command[1] == "waitforexitandrun":
try:
if dirt_prefix:
after = lambda: restore_dirt_ws2(dirt_prefix, command[0])
swap_dirt_ws2(dirt_prefix)
after = lambda: restore_dirt_ws2(dirt_prefix, command[0])
print("droiddeck-game-env: DiRT telemetry fix: ws2_32 stand-in in the prefix until the game exits",
file=sys.stderr)
elif restore_dirt_ws2(prefix, command[0]):
print("droiddeck-game-env: DiRT telemetry fix: put the prefix's own ws2_32 back", file=sys.stderr)
except OSError as error:
print("droiddeck-game-env: DiRT telemetry fix not applied (%s)" % error, file=sys.stderr)
if after:
after = None
try:
restore_dirt_ws2(dirt_prefix, command[0])
except OSError as undo:
print("droiddeck-game-env: DiRT telemetry fix: prefix ws2_32 not put back (%s); Wine uses its own copy "
"and the next launch puts the file back" % undo, file=sys.stderr)
sync = load_sync()
launch, launch_env = select_sync(command, env, sync)
if launch[0] != command[0]:
@@ -998,16 +971,7 @@ def main():
print("droiddeck-game-env: %s could not start (%s); stock launch" % (launch[0], error), file=sys.stderr)
launch, launch_env = command, without_pack(launch_env, env)
record_stock(sync, launch, launch_env)
try:
return start(launch, launch_env, digest, after)
except OSError:
if after:
try:
after()
except OSError as error:
print("droiddeck-game-env: DiRT telemetry fix: prefix ws2_32 not put back (%s); the next launch does it" % error,
file=sys.stderr)
raise
return start(launch, launch_env, digest, after)
if __name__ == "__main__":
+1 -2
View File
@@ -23,8 +23,7 @@ while IFS= read -r dir; do
done < <(ls -d "${sdk_dir}"/build-tools/* 2>/dev/null | sort -rV)
[[ -n "${build_tools}" ]] || { echo "No build-tools with aapt, zipalign and apksigner under ${sdk_dir}." >&2; exit 1; }
# Runtime assets from another branch are fine for a Kotlin/UI loop; CI and releases stay strict.
./gradlew -q -PallowStaleRuntime=true :app:assembleRelease
./gradlew -q :app:assembleRelease
(
cd "$(dirname "${signing_env}")"
set -a; . "${signing_env}"; set +a
+4 -26
View File
@@ -31,16 +31,6 @@ SOURCE_PATHS = ['app/build.gradle', 'app/src/main/cpp/fakeinput_steam.cpp', 'app
'app/src/main/cpp/waylandcomp/src/spatialpose_shm.h',
'app/src/main/cpp/adrenotools/src/hook/kgsl.h',
'app/src/main/assets/graphics_driver/adrenotools-turnip25.1.0.tzst']
# Gradle reads these pins directly, so prepared assets built from other pins cannot be reused.
STRICT_SOURCE_PREFIXES = ('tools/packs/tracking/',)
def staged_scripts(root):
"""Outputs Gradle's stageSessionScripts copies from source on every build."""
overlay = root / 'tools/linuxfs/overlay'
patterns = ['usr/local/bin/droiddeck-*', 'usr/local/bin/steam-compatibility', 'usr/bin/**/*']
return {'assets/linuxfs/' + path.relative_to(overlay).as_posix()
for pattern in patterns for path in overlay.glob(pattern) if path.is_file()}
def digest(path):
@@ -159,31 +149,19 @@ def record(root=ROOT):
(root / MANIFEST).write_text(json.dumps(data, sort_keys=True, indent=2) + '\n')
def verify(root=ROOT, stale_sources_ok=False):
def verify(root=ROOT):
try:
data = json.loads((root / MANIFEST).read_text())
except (OSError, ValueError):
raise ValueError('Runtime inputs have not been prepared. Run tools/build_local.sh.')
if data.get('version') != 1:
if data.get('version') != 1 or data.get('sources') != sources(root):
raise ValueError('Runtime sources changed since preparation. Run tools/build_local.sh.')
current = sources(root)
if data.get('sources') != current:
if not stale_sources_ok:
raise ValueError('Runtime sources changed since preparation. Run tools/build_local.sh.')
recorded = data.get('sources') or {}
changed = sorted(name for name in recorded.keys() | current.keys() if recorded.get(name) != current.get(name))
pinned = [name for name in changed if name.startswith(STRICT_SOURCE_PREFIXES)]
if pinned:
raise ValueError('Runtime pins changed since preparation (' + ', '.join(pinned) + '). Run tools/build_local.sh.')
print('Warning: reusing runtime assets prepared from other sources (run tools/build_local.sh if these matter):\n '
+ '\n '.join(changed[:20]) + ('\n ...' if len(changed) > 20 else ''), file=sys.stderr)
for name in required():
if name not in data['outputs']:
raise ValueError('Runtime manifest missing ' + name)
restaged = staged_scripts(root) if stale_sources_ok else set()
for name, output in data['outputs'].items():
path = root / output['path']
if not path.is_file() or (digest(path) != output['sha256'] and name not in restaged):
if not path.is_file() or digest(path) != output['sha256']:
raise ValueError('Missing or changed runtime input: ' + name + '. Run tools/build_local.sh.')
if outputs(root) != {name: output['path'] for name, output in data['outputs'].items()}:
raise ValueError('Runtime file set changed. Run tools/build_local.sh.')
@@ -246,7 +224,7 @@ if __name__ == '__main__':
if sys.argv[1] == 'record':
record()
elif sys.argv[1] == 'verify':
verify(stale_sources_ok='--allow-stale-sources' in sys.argv[2:])
verify()
elif sys.argv[1] == 'apk':
check_apk(sys.argv[2])
else:
-64
View File
@@ -159,22 +159,6 @@ class DirtTelemetryFixTest(unittest.TestCase):
self.assertEqual(os.readlink(self.target), str(self.own))
self.assertFalse(os.path.lexists(self.target.with_name("ws2_32.dll.droiddeck-original")))
def test_a_proton_that_cannot_start_leaves_the_prefix_as_it_was(self):
self.config("DiRT Showdown", self.SHOWDOWN_ON)
self.proton.write_text("not a program")
self.proton.chmod(0o644)
runner = Path(self.tmp.name) / "run.py"
runner.write_text("import runpy, sys\nmain = runpy.run_path(sys.argv[1])['main']\nmain.__globals__['DIRT_WS2'] = sys.argv[2]\n"
"sys.argv = [sys.argv[1]] + sys.argv[3:]\nsys.exit(main())\n")
home = Path(self.tmp.name) / "home"
home.mkdir()
result = subprocess.run([sys.executable, str(runner), str(BIN / "droiddeck-game-env"), str(self.stand_in), *self.command()],
env={**os.environ, "HOME": str(home), "STEAM_COMPAT_DATA_PATH": str(self.prefix)}, text=True, capture_output=True)
self.assertNotEqual(result.returncode, 0)
self.assertIn("DiRT telemetry fix: ws2_32 stand-in", result.stderr)
self.assertEqual(os.readlink(self.target), str(self.own))
self.assertFalse(os.path.lexists(self.target.with_name("ws2_32.dll.droiddeck-original")))
def test_launch_with_telemetry_off_leaves_the_prefix_alone(self):
self.config("DiRT Showdown", self.SHOWDOWN_DEFAULT)
self.proton.write_text("#!" + sys.executable + "\nimport os\nprint(os.environ.get('WINEDLLOVERRIDES', ''))\n")
@@ -187,54 +171,6 @@ class DirtTelemetryFixTest(unittest.TestCase):
self.assertNotIn("ws2_32=n,b", result.stdout)
self.assertEqual(os.readlink(self.target), str(self.own))
def test_a_failed_put_back_does_not_end_the_launch_with_an_error(self):
def fail():
raise OSError(28, "No space left on device")
stderr = io.StringIO()
with mock.patch("sys.stderr", stderr):
code = MODULE["start"]([sys.executable, "-c", "raise SystemExit(0)"], dict(os.environ), None, fail)
self.assertEqual(code, 0)
self.assertIn("not put back", stderr.getvalue())
def test_a_half_done_swap_is_put_back(self):
saved = self.target.with_name("ws2_32.dll.droiddeck-original")
os.replace(self.target, saved)
self.assertTrue(MODULE["restore_dirt_ws2"](self.prefix, self.proton))
self.assertEqual(os.readlink(self.target), str(self.own))
self.assertFalse(os.path.lexists(saved))
def test_a_native_ws2_32_goes_back_as_it_was_after_a_proton_switch(self):
self.target.unlink()
self.target.write_bytes(b"MZ a mod's own ws2_32")
MODULE["swap_dirt_ws2"](self.prefix)
other = Path(self.tmp.name) / "GE-Proton/proton"
(other.parent / "files/lib/wine/i386-windows").mkdir(parents=True)
(other.parent / "files/lib/wine/i386-windows/ws2_32.dll").write_bytes(b"MZ GE wine ws2_32")
other.write_text("")
self.assertTrue(MODULE["restore_dirt_ws2"](self.prefix, other))
self.assertFalse(self.target.is_symlink())
self.assertEqual(self.target.read_bytes(), b"MZ a mod's own ws2_32")
def test_a_link_to_a_mods_ws2_32_goes_back_as_it_was(self):
mod = Path(self.tmp.name) / "mods/ws2_32.dll"
mod.parent.mkdir()
mod.write_bytes(b"MZ a mod's ws2_32")
self.target.unlink()
self.target.symlink_to(mod)
MODULE["swap_dirt_ws2"](self.prefix)
other = Path(self.tmp.name) / "GE-Proton/proton"
(other.parent / "files/lib/wine/i386-windows").mkdir(parents=True)
(other.parent / "files/lib/wine/i386-windows/ws2_32.dll").write_bytes(b"MZ GE wine ws2_32")
other.write_text("")
self.assertTrue(MODULE["restore_dirt_ws2"](self.prefix, other))
self.assertEqual(os.readlink(self.target), str(mod))
def test_start_gives_the_signal_handlers_back(self):
import signal
before = {s: signal.getsignal(s) for s in (signal.SIGTERM, signal.SIGINT, signal.SIGHUP)}
MODULE["start"]([sys.executable, "-c", "pass"], dict(os.environ), None, lambda: None)
self.assertEqual(before, {s: signal.getsignal(s) for s in before})
def test_start_puts_the_file_back_after_the_game_exits(self):
calls = []
code = MODULE["start"]([sys.executable, "-c", "raise SystemExit(3)"], dict(os.environ), None, lambda: calls.append("restored"))
-36
View File
@@ -88,42 +88,6 @@ class RuntimeInputsTest(unittest.TestCase):
with self.assertRaisesRegex(ValueError, 'sources changed'):
runtime.verify(self.root)
def test_dev_loop_can_reuse_assets_from_other_sources(self):
runtime.record(self.root)
self.source.write_text('new implementation')
with mock.patch('sys.stderr', new_callable=io.StringIO) as stderr:
runtime.verify(self.root, stale_sources_ok=True)
self.assertIn('tools/linuxfs/preload/test.c', stderr.getvalue())
def test_dev_loop_still_rejects_changed_outputs(self):
runtime.record(self.root)
(self.root / 'app/src/main/jniLibs/arm64-v8a/libproot.so').write_bytes(b'old APK binary')
with self.assertRaisesRegex(ValueError, 'changed runtime input'):
runtime.verify(self.root, stale_sources_ok=True)
def test_dev_loop_accepts_restaged_session_scripts(self):
script = self.root / 'tools/linuxfs/overlay/usr/local/bin/droiddeck-test'
staged = self.root / 'app/src/main/assets/linuxfs/usr/local/bin/droiddeck-test'
for path in (script, staged):
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text('old script')
runtime.record(self.root)
script.write_text('new script')
staged.write_text('new script')
with mock.patch('sys.stderr', new_callable=io.StringIO):
runtime.verify(self.root, stale_sources_ok=True)
with self.assertRaisesRegex(ValueError, 'sources changed'):
runtime.verify(self.root)
def test_dev_loop_rejects_changed_tracking_pins(self):
pins = self.root / 'tools/packs/tracking/release.env'
pins.parent.mkdir(parents=True)
pins.write_text('OPENCV_VERSION=4.10.0')
runtime.record(self.root)
pins.write_text('OPENCV_VERSION=4.11.0')
with self.assertRaisesRegex(ValueError, 'pins changed'):
runtime.verify(self.root, stale_sources_ok=True)
def test_changed_quest_source_rejects_old_outputs(self):
source = self.root / 'tools/quest/kgsl_compat.c'
source.parent.mkdir(parents=True)