mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 13:26:02 +00:00
feat(dual-screen): bottom-screen HUD, Line strip, strip under every bottom tab, Bottom screen HUD settings (#1982)
- In-game stats shows a bottom-screen HUD while no game sends dashboard data: 11 styles, tap to change; it reads the game's frames and the device itself, so it works with the top-screen HUD off. - Line strip: one line like the top HUD's Strip (API + FPS, frame-time graph, 1 / 0.1 / 0.01 % lows, GPU, CPU with temperature, VRAM, RAM, clock); default strip above a game's dashboard; numbers that do not fit are left out by importance. - The same strip under the tabs on every other bottom page during a session. - Bottom screen HUD settings, shown even with the top HUD off: one switch for the whole bottom HUD, strip on every tab, and which numbers the Line strip shows. - The bottom HUD redraws about 10 times a second (was about 3) and reads device stats twice a second. - GPU load, clock and VRAM readers also run while the bottom HUD shows them (BottomHudPresence). - Night style stays dim instead of flickering with the FPS. - Review fixes: slow-frame ring 2048, tab strip redraw without gamescope frames, Proton name per game, Graphs' duration from the kept readings, Fahrenheit in Tiles, Rings and Cores.
This commit is contained in:
1 parent
6a30a9bb4b
commit
e1d241d723
22 files changed
+1393
-92
No files matched your search
@@ -21,7 +21,8 @@ class GpuMemComponent(private val file: File, private val root: File) : SessionP
|
||||
thread = Thread({
|
||||
while (running) {
|
||||
try { Thread.sleep(PERIOD_MS) } catch (e: InterruptedException) { break }
|
||||
if (running && (OverlayShown.check(root) || com.droiddeck.launcher.hud.DroidDeckHudHost.showing)) sample()?.let { write(it) }
|
||||
if (running && (OverlayShown.check(root) || com.droiddeck.launcher.hud.DroidDeckHudHost.showing ||
|
||||
com.droiddeck.launcher.hud.BottomHudPresence.showing)) sample()?.let { write(it) }
|
||||
}
|
||||
}, "gpu-mem").apply { isDaemon = true; start() }
|
||||
}
|
||||
|
||||
@@ -133,7 +133,8 @@ class GpuStatsComponent(val dir: File, private val root: File) : SessionPart() {
|
||||
sources = ""
|
||||
}
|
||||
|
||||
private fun hudShown(): Boolean = OverlayShown.check(root) || com.droiddeck.launcher.hud.DroidDeckHudHost.showing
|
||||
private fun hudShown(): Boolean = OverlayShown.check(root) || com.droiddeck.launcher.hud.DroidDeckHudHost.showing ||
|
||||
com.droiddeck.launcher.hud.BottomHudPresence.showing
|
||||
|
||||
// Android hides the load (kgsl sysfs blocked): the kgsl memstore gives the whole GPU's busy share. The in-game
|
||||
// Vulkan layer and the compositor time their own GPU work until the memstore timestamps are seen moving, and
|
||||
|
||||
@@ -108,5 +108,9 @@ class HwmonComponent(val dir: File, private val root: File) : SessionPart() {
|
||||
|
||||
private fun readNumber(path: String): Long? =
|
||||
runCatching { File(path).readText().trim().toLong() }.getOrNull()?.takeIf { it >= 0 }
|
||||
|
||||
fun fanSource(): String? = FAN_SOURCES().firstOrNull { readNumber(it) != null }
|
||||
|
||||
fun readRpm(path: String): Long? = readNumber(path)
|
||||
}
|
||||
}
|
||||
@@ -113,6 +113,31 @@ object SessionPrefs {
|
||||
prefs(context).edit().putString("statsStrip", id).apply()
|
||||
}
|
||||
|
||||
fun bottomStripMetrics(context: Context): Set<StripMetric> = StripMetric.parse(prefs(context).getString("bottomStripMetrics", null))
|
||||
|
||||
fun setBottomStripMetric(context: Context, metric: StripMetric, on: Boolean) {
|
||||
val now = bottomStripMetrics(context).let { if (on) it + metric else it - metric }
|
||||
prefs(context).edit().putString("bottomStripMetrics", StripMetric.encode(now)).apply()
|
||||
}
|
||||
|
||||
fun bottomHud(context: Context): Boolean = prefs(context).getBoolean("bottomHud", true)
|
||||
|
||||
fun setBottomHud(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("bottomHud", on).apply()
|
||||
}
|
||||
|
||||
fun bottomStripOnTabs(context: Context): Boolean = prefs(context).getBoolean("bottomStripTabs", true)
|
||||
|
||||
fun setBottomStripOnTabs(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("bottomStripTabs", on).apply()
|
||||
}
|
||||
|
||||
fun statsHud(context: Context): String? = prefs(context).getString("statsHud", null)
|
||||
|
||||
fun setStatsHud(context: Context, id: String) {
|
||||
prefs(context).edit().putString("statsHud", id).apply()
|
||||
}
|
||||
|
||||
fun statsSpeedUnit(context: Context): String? = prefs(context).getString("statsSpeedUnit", null)
|
||||
|
||||
fun setStatsSpeedUnit(context: Context, id: String) {
|
||||
|
||||
@@ -26,7 +26,7 @@ object SettingsReset {
|
||||
"upscaler", "upscaleSharpness", "screenEffects", "textureAnisotropy", "textureLodBias",
|
||||
"steamDownloadsInBackground", "steam_offline", "bootMovie", "bootMovieSound", "bootMovieVolume", "bootMovieSeconds",
|
||||
"bootMovieApplyNext", "bootMovieSteamSeen",
|
||||
"questDefaultsV1", "telemetryAuto", "telemetryOff", "statsStrip", "statsDash", "statsSpeedUnit",
|
||||
"questDefaultsV1", "telemetryAuto", "telemetryOff", "statsStrip", "statsHud", "bottomHud", "bottomStripMetrics", "bottomStripTabs", "statsDash", "statsSpeedUnit",
|
||||
)
|
||||
|
||||
internal val SESSION_PREFIXES = listOf(
|
||||
|
||||
@@ -1,12 +1,38 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
enum class StatsStrip(val id: String) {
|
||||
PANEL("panel"), TILES("tiles"), RINGS("rings");
|
||||
LINE("line"), PANEL("panel"), TILES("tiles"), RINGS("rings");
|
||||
|
||||
fun next(): StatsStrip = entries[(ordinal + 1) % entries.size]
|
||||
|
||||
companion object {
|
||||
fun from(id: String?): StatsStrip = entries.firstOrNull { it.id == id } ?: PANEL
|
||||
fun from(id: String?): StatsStrip = entries.firstOrNull { it.id == id } ?: LINE
|
||||
}
|
||||
}
|
||||
|
||||
enum class StripMetric(val id: String, val defaultOn: Boolean = true) {
|
||||
ENGINE("engine"), GRAPH("graph"), LOWS("lows"), LOW001("low001"), GPU("gpu"), GPU_TEMP("gputemp", false),
|
||||
CPU("cpu"), CPU_TEMP("cputemp"), VRAM("vram"), RAM("ram"), CLOCK("clock");
|
||||
|
||||
companion object {
|
||||
val defaults: Set<StripMetric> = entries.filter { it.defaultOn }.toSet()
|
||||
|
||||
fun parse(saved: String?): Set<StripMetric> =
|
||||
if (saved == null) defaults
|
||||
else saved.split(',').mapNotNull { id -> entries.firstOrNull { it.id == id.trim() } }.toSet()
|
||||
|
||||
fun encode(on: Set<StripMetric>): String = entries.filter { it in on }.joinToString(",") { it.id }
|
||||
}
|
||||
}
|
||||
|
||||
enum class StatsHud(val id: String) {
|
||||
BIG_FPS("bigfps"), FULL("full"), TILES("tiles"), RINGS("rings"), GRAPHS("graphs"), CORES("cores"),
|
||||
HEAT("heat"), GAME("game"), PACING("pacing"), NIGHT("night"), MEGA("mega");
|
||||
|
||||
fun next(): StatsHud = entries[(ordinal + 1) % entries.size]
|
||||
|
||||
companion object {
|
||||
fun from(id: String?): StatsHud = entries.firstOrNull { it.id == id } ?: BIG_FPS
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user