mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 13:05:47 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c8f0f2ff2f |
No files matched your search
@@ -23,11 +23,6 @@ jobs:
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq --no-install-recommends libwayland-bin libwayland-dev libx11-dev libx11-xcb-dev \
|
||||
libxcb1-dev libxcb-composite0-dev libglm-dev zstd
|
||||
- name: llvm-mingw for dd-directcontroller
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/llvm-mingw-bylaws-20250920
|
||||
key: llvm-mingw-bylaws-20250920-x86_64
|
||||
- name: Build
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
@@ -34,26 +34,8 @@ jobs:
|
||||
retention-days: 7
|
||||
compression-level: 0
|
||||
path: out/debs/
|
||||
scrcpy-server:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '17'
|
||||
- run: |
|
||||
sdkmanager 'platforms;android-36' 'build-tools;35.0.0'
|
||||
tools/ubuntu/build-scrcpy-server.sh out/scrcpy-server.jar
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: droiddeck-scrcpy-server
|
||||
path: out/scrcpy-server.jar
|
||||
rootfs:
|
||||
needs: [debs, scrcpy-server]
|
||||
needs: debs
|
||||
runs-on: ubuntu-24.04-arm
|
||||
timeout-minutes: 120
|
||||
steps:
|
||||
@@ -64,10 +46,6 @@ jobs:
|
||||
with:
|
||||
name: ubuntu-runtime-debs
|
||||
path: out/debs
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: droiddeck-scrcpy-server
|
||||
path: out/server
|
||||
- uses: actions/create-github-app-token@v2
|
||||
id: components-token
|
||||
if: github.event_name == 'workflow_dispatch' && inputs.tag != ''
|
||||
@@ -90,7 +68,7 @@ jobs:
|
||||
set -euo pipefail
|
||||
sudo apt-get update -qq && sudo apt-get install -y -qq zstd gpgv ubuntu-keyring >/dev/null
|
||||
tag='${{ inputs.tag }}'
|
||||
tools/ubuntu/build.sh out/debs out "${tag:-ubuntu-dev}" out/server/scrcpy-server.jar
|
||||
tools/ubuntu/build.sh out/debs out "${tag:-ubuntu-dev}"
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ubuntu-runtime
|
||||
|
||||
@@ -955,7 +955,6 @@ jobs:
|
||||
with:
|
||||
artifact: droiddeck-signed
|
||||
variant: standard
|
||||
fail_on_detection: true
|
||||
secrets: inherit
|
||||
|
||||
packs:
|
||||
|
||||
@@ -1328,9 +1328,22 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
finish()
|
||||
}
|
||||
|
||||
private fun ownsTask(): Boolean = runCatching {
|
||||
getSystemService(android.app.ActivityManager::class.java)?.appTasks.orEmpty().any { task ->
|
||||
val info = task.taskInfo
|
||||
@Suppress("DEPRECATION")
|
||||
val id = if (Build.VERSION.SDK_INT >= 29) info.taskId else info.persistentId
|
||||
id == taskId
|
||||
}
|
||||
}.getOrDefault(false)
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
setTheme(R.style.AppTheme)
|
||||
super.onCreate(savedInstanceState)
|
||||
if (com.droiddeck.launcher.frontend.LauncherReopen.revealsTask(intent.action, intent.categories, isTaskRoot,
|
||||
savedInstanceState != null, SessionState.pipActive, ::ownsTask)) {
|
||||
finish()
|
||||
return
|
||||
}
|
||||
drivers.restartBlocked = ::runtimeChangesBlocked
|
||||
drivers.loadTpUbwcMode()
|
||||
val handoff = if (savedInstanceState == null && intent.getBooleanExtra(EXTRA_RESTARTED, false)) LauncherHandoff.take() else null
|
||||
|
||||
@@ -185,7 +185,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private var unfoldedControls by mutableStateOf(false)
|
||||
private var unfoldedControlsWithController by mutableStateOf(false)
|
||||
private var adaptiveSticks by mutableStateOf<Boolean?>(null)
|
||||
private var directController by mutableStateOf<Boolean?>(null)
|
||||
private var quickButtons by mutableStateOf<Map<InputCommand, Boolean>>(emptyMap())
|
||||
private var picturePosition by mutableStateOf("center")
|
||||
|
||||
@@ -587,7 +586,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
drawerLayerOpen = false
|
||||
drawerPinned = false
|
||||
if (value) {
|
||||
directController = com.droiddeck.launcher.session.DirectControllerSwitch.state(this)
|
||||
releaseHeldKeys()
|
||||
drawerXr = com.droiddeck.launcher.session.xr.XrPanels.showMenu()
|
||||
drawerDocked = !drawerXr && dockDrawer() && openDockedMenu()
|
||||
@@ -879,7 +877,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private var runtimeRemovalBlocked = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
setTheme(R.style.SessionTheme)
|
||||
super.onCreate(savedInstanceState)
|
||||
com.droiddeck.launcher.session.xr.XrPanels.setMenuHost(this)
|
||||
AgentGuest.readyListener = agentReadyListener
|
||||
@@ -2143,11 +2140,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
primaryInputLayout?.let { com.droiddeck.launcher.input.InputLibraries.setAdaptiveSticks(this@SessionActivity, it.id, on) }
|
||||
refreshInputProfile()
|
||||
},
|
||||
directController = directController,
|
||||
onDirectController = { on ->
|
||||
com.droiddeck.launcher.session.DirectControllerSwitch.set(this@SessionActivity, on)
|
||||
directController = on
|
||||
},
|
||||
showFloatingSteamControls = SessionState.mode == SessionService.MODE_STEAM && SessionState.deckPad && unfoldedPanel == null &&
|
||||
oscMode != SessionPrefs.OSC_NEVER && oscMode != SessionPrefs.OSC_STEAM_QAM &&
|
||||
!steamTouchInUse && OnScreenLayout.supportsFloatingSteamControls(padType, primaryInputLayout),
|
||||
|
||||
@@ -50,17 +50,6 @@ object GameEnvironment {
|
||||
return withScopeValue(config, scope, NO_STEAM, if (on) "1" else null)
|
||||
}
|
||||
|
||||
/** dd-directcontroller on DroidDeck-Bionic: "0" starts the game in pass-through (Wine's own xinput); unset = the pad state. */
|
||||
const val DIRECT_CONTROLLER = "DD_DIRECTCONTROLLER"
|
||||
|
||||
fun gameDirectController(config: Config, scope: String): Boolean =
|
||||
scope.isEmpty() || config.games[scope]?.get(DIRECT_CONTROLLER) != "0"
|
||||
|
||||
fun withGameDirectController(config: Config, scope: String, on: Boolean): Config {
|
||||
require(scope.isNotEmpty() && validScope(scope))
|
||||
return withScopeValue(config, scope, DIRECT_CONTROLLER, if (on) null else "0")
|
||||
}
|
||||
|
||||
const val GAME_RESOLUTION = "DROIDDECK_GAME_RESOLUTION"
|
||||
|
||||
fun gameResolution(config: Config, scope: String): GameResolution.Choice? =
|
||||
|
||||
@@ -1,176 +0,0 @@
|
||||
package com.droiddeck.launcher.frontend
|
||||
|
||||
import android.content.Context
|
||||
import android.content.pm.ActivityInfo
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.graphics.LinearGradient
|
||||
import android.graphics.Paint
|
||||
import android.graphics.RadialGradient
|
||||
import android.graphics.RectF
|
||||
import android.graphics.Shader
|
||||
import android.graphics.Typeface
|
||||
import android.os.Build
|
||||
import android.text.TextPaint
|
||||
import android.text.TextUtils
|
||||
import android.util.AtomicFile
|
||||
import android.util.Log
|
||||
import androidx.core.graphics.drawable.toBitmap
|
||||
import com.droiddeck.launcher.agent.AgentAdb
|
||||
import com.droiddeck.launcher.core.WirelessAdbFix
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import java.io.File
|
||||
import java.util.zip.CRC32
|
||||
|
||||
internal object AndroidSteamApps {
|
||||
const val MIN_ANDROID = 35
|
||||
private const val TAG = "AndroidSteamApps"
|
||||
private const val LAUNCHER = "/usr/local/bin/droiddeck-android-app"
|
||||
private val packagePattern = Regex("[a-zA-Z][a-zA-Z0-9_]*(\\.[a-zA-Z][a-zA-Z0-9_]*)+")
|
||||
|
||||
private fun prefs(context: Context) =
|
||||
context.getSharedPreferences("android-steam-apps", Context.MODE_PRIVATE)
|
||||
|
||||
fun contains(context: Context, pkg: String): Boolean = prefs(context).contains(pkg)
|
||||
|
||||
fun set(context: Context, pkg: String, enabled: Boolean) {
|
||||
require(packagePattern.matches(pkg))
|
||||
val editor = prefs(context).edit()
|
||||
if (enabled) editor.putBoolean(pkg, true) else editor.remove(pkg)
|
||||
editor.apply()
|
||||
}
|
||||
|
||||
fun supports(pkg: String): Boolean = Build.VERSION.SDK_INT >= MIN_ANDROID && packagePattern.matches(pkg)
|
||||
|
||||
private data class Artwork(val slot: String, val width: Int, val height: Int, val iconSize: Float = 0f)
|
||||
|
||||
private val artwork = listOf(
|
||||
Artwork("p", 600, 900, 236f),
|
||||
Artwork("header", 460, 215, 104f),
|
||||
Artwork("hero", 1920, 620),
|
||||
)
|
||||
|
||||
private fun iconHue(icon: Bitmap): Float {
|
||||
val bins = FloatArray(12)
|
||||
val hsv = FloatArray(3)
|
||||
for (y in 8 until icon.height step 16) for (x in 8 until icon.width step 16) {
|
||||
val pixel = icon.getPixel(x, y)
|
||||
if (Color.alpha(pixel) < 128) continue
|
||||
Color.colorToHSV(pixel, hsv)
|
||||
if (hsv[1] >= 0.25f && hsv[2] >= 0.3f) {
|
||||
bins[(hsv[0] / 30f).toInt()] += hsv[1] * hsv[1] * hsv[2]
|
||||
}
|
||||
}
|
||||
val strongest = bins.indices.maxByOrNull { bins[it] } ?: return 210f
|
||||
return if (bins[strongest] == 0f) 210f else strongest * 30f + 15f
|
||||
}
|
||||
|
||||
private fun renderArtwork(canvas: Canvas, slot: Artwork, icon: Bitmap, hue: Float, label: String) {
|
||||
val w = slot.width.toFloat()
|
||||
val h = slot.height.toFloat()
|
||||
val paint = Paint(Paint.ANTI_ALIAS_FLAG or Paint.FILTER_BITMAP_FLAG)
|
||||
paint.shader = LinearGradient(0f, h, w, 0f, 0xff111721.toInt(),
|
||||
Color.HSVToColor(floatArrayOf((hue + 335f) % 360f, 0.45f, 0.26f)), Shader.TileMode.CLAMP)
|
||||
canvas.drawPaint(paint)
|
||||
val glow = Color.HSVToColor(floatArrayOf(hue, 0.65f, 0.53f))
|
||||
val wide = w > h
|
||||
paint.shader = RadialGradient(if (wide) w * 0.83f else w * 0.49f, h * 0.36f,
|
||||
if (wide) w * 0.58f else h * 0.62f, glow, glow and 0x00ffffff, Shader.TileMode.CLAMP)
|
||||
canvas.drawPaint(paint)
|
||||
if (slot.iconSize == 0f) return
|
||||
|
||||
paint.shader = null
|
||||
val cx = if (wide) w * 0.19f else w * 0.5f
|
||||
val cy = if (wide) h * 0.5f else h * 0.42f
|
||||
val radius = slot.iconSize * 0.5f
|
||||
canvas.drawBitmap(icon, null, RectF(cx - radius, cy - radius, cx + radius, cy + radius), paint)
|
||||
|
||||
val title = TextPaint(Paint.ANTI_ALIAS_FLAG).apply {
|
||||
color = Color.WHITE
|
||||
typeface = Typeface.DEFAULT_BOLD
|
||||
textSize = if (wide) 30f else 46f
|
||||
textAlign = if (wide) Paint.Align.LEFT else Paint.Align.CENTER
|
||||
}
|
||||
val titleWidth = w * if (wide) 0.60f else 0.82f
|
||||
val text = TextUtils.ellipsize(label, title, titleWidth, TextUtils.TruncateAt.END).toString()
|
||||
val baseline = if (wide) cy - (title.ascent() + title.descent()) / 2f else h * 0.66f
|
||||
canvas.drawText(text, if (wide) w * 0.35f else w * 0.5f, baseline, title)
|
||||
}
|
||||
|
||||
private fun savePng(file: File, bitmap: Bitmap) {
|
||||
val atomic = AtomicFile(file)
|
||||
val out = atomic.startWrite()
|
||||
try {
|
||||
check(bitmap.compress(Bitmap.CompressFormat.PNG, 100, out))
|
||||
atomic.finishWrite(out)
|
||||
} catch (e: Exception) {
|
||||
atomic.failWrite(out)
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
private fun exportArtwork(context: Context, id: Long, activity: ActivityInfo, label: String): JSONObject {
|
||||
val pm = context.packageManager
|
||||
val dir = File(context.filesDir, "session/android-steam-art/$id").apply { mkdirs() }
|
||||
val iconFile = File(dir, "icon.png")
|
||||
val covers = artwork.associateWith { File(dir, "${it.slot}.png") }
|
||||
val art = JSONObject().put("icon", iconFile.absolutePath)
|
||||
covers.forEach { (slot, file) -> art.put(slot.slot, file.absolutePath) }
|
||||
val stamp = File(dir, "version")
|
||||
val version = "2:${pm.getPackageInfo(activity.packageName, 0).lastUpdateTime}:$label"
|
||||
if (stamp.isFile && stamp.readText() == version && iconFile.isFile && covers.values.all(File::isFile)) return art
|
||||
|
||||
val icon = activity.loadIcon(pm).toBitmap(384, 384, Bitmap.Config.ARGB_8888)
|
||||
savePng(iconFile, icon)
|
||||
val hue = iconHue(icon)
|
||||
for ((slot, file) in covers) {
|
||||
val bitmap = Bitmap.createBitmap(slot.width, slot.height, Bitmap.Config.ARGB_8888)
|
||||
try {
|
||||
renderArtwork(Canvas(bitmap), slot, icon, hue, label)
|
||||
savePng(file, bitmap)
|
||||
} finally {
|
||||
bitmap.recycle()
|
||||
}
|
||||
}
|
||||
stamp.writeText(version)
|
||||
return art
|
||||
}
|
||||
|
||||
fun sessionEnvironment(context: Context, sessionDir: File): List<String> {
|
||||
if (Build.VERSION.SDK_INT < MIN_ANDROID) return emptyList()
|
||||
val packages = prefs(context).all.keys.sorted()
|
||||
val apps = JSONArray()
|
||||
val appIds = mutableListOf<Long>()
|
||||
for (pkg in packages) {
|
||||
if (!supports(pkg)) continue
|
||||
val pm = context.packageManager
|
||||
val launch = pm.getLaunchIntentForPackage(pkg) ?: continue
|
||||
val component = launch.component ?: continue
|
||||
val activity = runCatching { pm.getActivityInfo(component, 0) }.getOrNull()
|
||||
val label = runCatching { activity?.loadLabel(pm)?.toString() }.getOrNull().orEmpty().ifBlank { pkg }
|
||||
val id = CRC32().apply { update("droiddeck-android-app:$pkg".toByteArray()) }.value or 0x80000000L
|
||||
appIds.add(id)
|
||||
val entry = JSONObject().put("name", label).put("appid", id)
|
||||
.put("exe", LAUNCHER).put("dir", "/usr/local/bin").put("launch", pkg).put("native", true)
|
||||
if (activity != null) runCatching {
|
||||
entry.put("art", exportArtwork(context, id, activity, label))
|
||||
}.onFailure { Log.w(TAG, "Steam artwork for $pkg", it) }
|
||||
apps.put(entry)
|
||||
}
|
||||
if (apps.length() == 0) return emptyList()
|
||||
val listing = File(sessionDir, "android-apps.json").apply { writeText(apps.toString()) }
|
||||
val env = mutableListOf("DD_ANDROID_APPS=${listing.absolutePath}",
|
||||
"DD_ANDROID_APP_IDS=${appIds.joinToString(" ")}")
|
||||
if (WirelessAdbFix.hasSavedPairing(context)) {
|
||||
val link = AgentAdb.prepare(context)
|
||||
if (link.paired) {
|
||||
env.add("DD_ANDROID_ADB_SERIAL=${link.serial}")
|
||||
env.add("DD_ANDROID_ADB_KEY=${link.vendorKeys}")
|
||||
}
|
||||
}
|
||||
return env
|
||||
}
|
||||
}
|
||||
@@ -28,8 +28,7 @@ object AutoComponents {
|
||||
else -> game.appId.takeIf { it > 0 }?.toString()
|
||||
}
|
||||
|
||||
fun autoPicks(findings: List<WinCompSources.Finding>, catalog: Map<String, WinComponents.Component>,
|
||||
user: Map<String, Boolean> = emptyMap()): Map<String, WinComponents.AutoReason> {
|
||||
fun autoPicks(findings: List<WinCompSources.Finding>, catalog: Map<String, WinComponents.Component>): Map<String, WinComponents.AutoReason> {
|
||||
val out = LinkedHashMap<String, WinComponents.AutoReason>()
|
||||
for (f in findings) {
|
||||
if (!f.auto || f.component == null) continue
|
||||
@@ -38,13 +37,6 @@ object AutoComponents {
|
||||
if (WinComponents.support(c, catalog) != WinComponents.Support.READY) continue
|
||||
if (id !in out) out[id] = WinComponents.AutoReason(f.origin.name, listOf(f.original) + f.args)
|
||||
}
|
||||
if (user["d3dx9"] != false && (user["d3dx9"] == true || "d3dx9" in out)) {
|
||||
val reason = out["d3dx9"] ?: WinComponents.AutoReason(WinCompSources.Origin.FOLDER.name, listOf("d3dx9"))
|
||||
for (id in listOf("d3dcompiler_42", "d3dcompiler_43")) {
|
||||
val c = catalog[id] ?: continue
|
||||
if (WinComponents.support(c, catalog) == WinComponents.Support.READY) out.putIfAbsent(id, reason)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
@@ -236,8 +228,8 @@ object AutoComponents {
|
||||
val findings = findings(context, game)
|
||||
val refreshed = if (knownCatalog == null && asked && online(context)) catalogOf(context, true) else null
|
||||
val catalog = knownCatalog ?: (refreshed ?: catalogOf(context, false) ?: catalogOf(context, true))?.associateBy { it.name } ?: return
|
||||
val wanted = autoPicks(findings, catalog)
|
||||
val user = WinComponents.selection(context, key).user
|
||||
val wanted = autoPicks(findings, catalog, user)
|
||||
val before = WinComponents.selection(context, key).auto
|
||||
val installed = installedOf(context)
|
||||
val kept = LinkedHashMap<String, WinComponents.AutoReason>()
|
||||
@@ -381,7 +373,7 @@ object AutoComponents {
|
||||
|
||||
|
||||
private const val FINDINGS = "wincomp-findings.json"
|
||||
private const val DETECTORS = "d4"
|
||||
private const val DETECTORS = "d3"
|
||||
|
||||
internal fun signature(context: Context, game: Library.SteamGame): String {
|
||||
val folder = game.gameFiles
|
||||
@@ -460,9 +452,9 @@ object AutoComponents {
|
||||
}
|
||||
return pendingSaved && pending.isEmpty()
|
||||
}
|
||||
val wanted = autoPicks(findings, catalog)
|
||||
val selection = WinComponents.selection(context, key)
|
||||
val user = selection.user
|
||||
val wanted = autoPicks(findings, catalog, user)
|
||||
val installed = installedOf(context)
|
||||
val roots = selection.effective + wanted.keys.filter { user[it] != false }
|
||||
val required = withParts(roots.filter { WinComponents.validId(it) }, catalog)
|
||||
|
||||
@@ -42,7 +42,6 @@ object DependencyDetector {
|
||||
"dotnet45" to ".NET Framework 4.5", "dotnet452" to ".NET Framework 4.5.2",
|
||||
"dotnet46" to ".NET Framework 4.6", "dotnet472" to ".NET Framework 4.7.2",
|
||||
"dotnet48" to ".NET Framework 4.8", "dotnet35" to ".NET Framework 3.5",
|
||||
"dotnetcoredesktop3" to ".NET Desktop 3", "dotnet50" to ".NET 5",
|
||||
"dotnetcoredesktop6" to ".NET Desktop 6", "dotnetcoredesktop7" to ".NET Desktop 7",
|
||||
"dotnetcoredesktop8" to ".NET Desktop 8",
|
||||
)
|
||||
@@ -51,7 +50,7 @@ object DependencyDetector {
|
||||
"vcredist2005", "vcredist2008", "vcredist2010", "vcredist2012", "vcredist2013",
|
||||
"vcredist2015", "vcredist2019", "vcredist2022",
|
||||
"dotnet35", "dotnet40", "dotnet45", "dotnet452", "dotnet46", "dotnet472", "dotnet48",
|
||||
"dotnetcoredesktop3", "dotnet50", "dotnetcoredesktop6", "dotnetcoredesktop7", "dotnetcoredesktop8",
|
||||
"dotnetcoredesktop6", "dotnetcoredesktop7", "dotnetcoredesktop8",
|
||||
"d3dx9", "d3dx11", "xact", "xact_x64", "xna31", "xna40", "physx", "oalinst", "XLiveRedist",
|
||||
)
|
||||
|
||||
@@ -149,7 +148,7 @@ object DependencyDetector {
|
||||
val comp = dotnetComponent("$path $name")
|
||||
return when {
|
||||
comp != null -> listOf(comp)
|
||||
isDir || CORE_RUNTIME.containsMatchIn(path) -> emptyList()
|
||||
isDir -> emptyList()
|
||||
else -> listOf("dotnet48")
|
||||
}
|
||||
}
|
||||
@@ -173,20 +172,10 @@ object DependencyDetector {
|
||||
private val D3DX11_RE = Regex("""d3dx11_\d+\.dll""")
|
||||
private val D3DCOMPILER_RE = Regex("""d3dcompiler_\d+\.dll""")
|
||||
|
||||
private val CORE_RUNTIME = Regex("""(?:windowsdesktop|dotnet)-runtime-(\d+)\.""")
|
||||
private val CORE_RUNTIMES = mapOf(
|
||||
"3" to "dotnetcoredesktop3", "5" to "dotnet50", "6" to "dotnetcoredesktop6", "7" to "dotnetcoredesktop7", "8" to "dotnetcoredesktop8",
|
||||
)
|
||||
|
||||
private fun dotnetComponent(s: String): String? {
|
||||
CORE_RUNTIME.find(s)?.let { return CORE_RUNTIMES[it.groupValues[1]] }
|
||||
return byVersion(s)
|
||||
}
|
||||
|
||||
private fun byVersion(s: String): String? = when {
|
||||
s.contains("desktop-runtime-8") || Regex("""(?<![\d.])8\.\d""").containsMatchIn(s) -> "dotnetcoredesktop8"
|
||||
s.contains("desktop-runtime-7") || Regex("""(?<![\d.])7\.\d""").containsMatchIn(s) -> "dotnetcoredesktop7"
|
||||
s.contains("desktop-runtime-6") || Regex("""(?<![\d.])6\.\d""").containsMatchIn(s) -> "dotnetcoredesktop6"
|
||||
private fun dotnetComponent(s: String): String? = when {
|
||||
s.contains("desktop-runtime-8") || Regex("""\b8\.\d""").containsMatchIn(s) -> "dotnetcoredesktop8"
|
||||
s.contains("desktop-runtime-7") || Regex("""\b7\.\d""").containsMatchIn(s) -> "dotnetcoredesktop7"
|
||||
s.contains("desktop-runtime-6") || Regex("""\b6\.\d""").containsMatchIn(s) -> "dotnetcoredesktop6"
|
||||
s.contains("ndp48") || s.contains("fx48") || s.contains("4.8") -> "dotnet48"
|
||||
s.contains("ndp472") || s.contains("4.7.2") -> "dotnet472"
|
||||
s.contains("ndp46") || s.contains("4.6") -> "dotnet46"
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.droiddeck.launcher.frontend
|
||||
|
||||
import android.content.Intent
|
||||
|
||||
object LauncherReopen {
|
||||
fun revealsTask(
|
||||
action: String?,
|
||||
categories: Set<String>?,
|
||||
taskRoot: Boolean,
|
||||
restored: Boolean,
|
||||
pipActive: Boolean,
|
||||
ownTask: () -> Boolean,
|
||||
): Boolean = action == Intent.ACTION_MAIN && categories?.contains(Intent.CATEGORY_LAUNCHER) == true &&
|
||||
!taskRoot && !restored && !pipActive && ownTask()
|
||||
}
|
||||
@@ -40,8 +40,7 @@ enum class DroidDeckHudSize(val token: String, val label: String) {
|
||||
PILL("pill", "Pill"),
|
||||
MINIMAL("minimal", "Minimal"),
|
||||
MEGA("mega", "Mega"),
|
||||
STRIP("strip", "Strip"),
|
||||
SIDE_STRIP("side_strip", "Side strip");
|
||||
STRIP("strip", "Strip");
|
||||
|
||||
fun next(): DroidDeckHudSize {
|
||||
val all = values()
|
||||
@@ -97,11 +96,6 @@ enum class DroidDeckHudSize(val token: String, val label: String) {
|
||||
"showCPUUsage", "showTemp", "showVram", "showRAM", "showBattery", "showBatteryTemp", "showBatteryTime",
|
||||
"showPower", "showDisplay", "showHdr", "showGpuModel",
|
||||
),
|
||||
SIDE_STRIP to listOf(
|
||||
"showFPS", "showFPSGraph", "showAvg", "showLow1",
|
||||
"showGPULoad", "showGpuTemp", "showCPUUsage", "showTemp", "showRAM", "showVram",
|
||||
"showPower", "showBattery", "showBatteryTemp", "showBatteryTime",
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -116,7 +110,6 @@ enum class DroidDeckHudSize(val token: String, val label: String) {
|
||||
MEGA to DroidDeckHudStyle(row = 11.5f, unit = 11.5f * 0.62f, pad = 10f, lineGap = 3.5f, labelGap = 7f,
|
||||
band = 9.5f, gutter = 16f),
|
||||
STRIP to DroidDeckHudStyle(row = 11.5f, unit = 11.5f * 0.8f, pad = 10f, lineGap = 0f, labelGap = 13f),
|
||||
SIDE_STRIP to DroidDeckHudStyle(row = 11.5f, unit = 9f, pad = 8f, lineGap = 4f, labelGap = 4f, key = 9f),
|
||||
)
|
||||
|
||||
fun rowsFor(size: DroidDeckHudSize, values: Map<String, String>): List<String> =
|
||||
|
||||
@@ -573,7 +573,6 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
if (s == null) { contentW = 0f; contentH = 0f; return }
|
||||
if (dock != DroidDeckHudDock.NONE) { buildDockTab(); return }
|
||||
if (size == DroidDeckHudSize.STRIP) { buildStrip(s); return }
|
||||
if (size == DroidDeckHudSize.SIDE_STRIP) { buildSideStrip(s); return }
|
||||
buildRows(s)
|
||||
if (contentW <= 0f || contentH <= 0f) return
|
||||
if (size == DroidDeckHudSize.PILL) addSubtleClock(sp(10f), leftAligned = true)
|
||||
@@ -685,8 +684,8 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
finishPanel(panel, halfRound = halfRound)
|
||||
}
|
||||
|
||||
private fun finishPanel(panel: RectF, halfRound: Boolean, maxRadius: Float = sp(56f), inset: Float = panelInset()) {
|
||||
val r = if (halfRound) panel.height() / 2f else min(panel.height() / 2f, maxRadius)
|
||||
private fun finishPanel(panel: RectF, halfRound: Boolean) {
|
||||
val r = if (halfRound) panel.height() / 2f else min(panel.height() / 2f, sp(56f))
|
||||
val margin = outlineWidth() + sp(4f)
|
||||
fun curveIn(top: Float, bottom: Float): Float {
|
||||
val d = max(max(panel.top + r - top, bottom - (panel.bottom - r)), 0f)
|
||||
@@ -704,8 +703,8 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
for (t in tileRects) right = max(right, t.right + curveIn(t.top, t.bottom) + margin)
|
||||
panel.right = max(right, panel.left + sp(6f) + r)
|
||||
dPanel = panel; dRadius = r
|
||||
contentW = panel.right + inset
|
||||
contentH = panel.bottom + inset
|
||||
contentW = panel.right + panelInset()
|
||||
contentH = panel.bottom + panelInset()
|
||||
}
|
||||
|
||||
private fun clockTimeString(): String = DateFormat.getTimeFormat(context).format(Date())
|
||||
@@ -937,58 +936,6 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun buildSideStrip(s: HudMetrics.Snapshot) {
|
||||
val style = size.style
|
||||
val inset = sp(5f)
|
||||
val panelWidth = sp(86f)
|
||||
val pad = sp(style.pad)
|
||||
val left = inset + pad
|
||||
val right = inset + panelWidth - pad
|
||||
val markHeight = sp(12f)
|
||||
val markTop = inset + sp(6f)
|
||||
val markLeft = left - DroidDeckMark.inkLeftFor(markHeight)
|
||||
headerMark = RectF(markLeft, markTop, markLeft + DroidDeckMark.widthFor(markHeight), markTop + markHeight)
|
||||
dDividerTop = markTop + markHeight + sp(6f)
|
||||
|
||||
if (showClockTime) {
|
||||
val clock = clockTimeString()
|
||||
val clockPx = sp(8.5f)
|
||||
val clockWidth = measure(clock, clockPx)
|
||||
if (right - clockWidth >= markLeft + DroidDeckMark.inkRightFor(markHeight) + sp(4f)) {
|
||||
val baseline = markTop + (markHeight + capHeight(clockPx)) / 2f
|
||||
glyphs.add(Glyph(right - clockWidth, baseline, clock, blend(colDim), clockPx))
|
||||
}
|
||||
}
|
||||
|
||||
val labelPx = sp(style.key)
|
||||
val rowPx = sp(style.row)
|
||||
val unitPx = sp(style.unit)
|
||||
val lineGap = sp(style.lineGap)
|
||||
var y = dDividerTop + sp(6f)
|
||||
for (key in size.rowsIn(storedOrder)) {
|
||||
if (!switchOn(key)) continue
|
||||
if (key == "showFPSGraph") {
|
||||
val height = sp(15f)
|
||||
graphRect = RectF(left, y, right, y + height)
|
||||
y += height + lineGap
|
||||
continue
|
||||
}
|
||||
|
||||
val valuePx = if (key == "showFPS") sp(16f) else rowPx
|
||||
val row = reading(key, s, labelPx, valuePx, unitPx)
|
||||
val available = right - left - measure(row.label.text, labelPx) - sp(style.labelGap)
|
||||
val fit = (available / runWidth(row.vals)).coerceIn(0f, 1f)
|
||||
val values = row.vals.map { Span(it.text, it.color, it.sizePx * fit, it.glow) }
|
||||
val baseline = y - ascent(valuePx)
|
||||
placeRun(left, baseline, listOf(row.label))
|
||||
placeRun(right - runWidth(values), baseline, values)
|
||||
y += lineH(valuePx) + lineGap
|
||||
}
|
||||
|
||||
val panel = RectF(inset, inset, inset + panelWidth, y + sp(7f))
|
||||
finishPanel(panel, halfRound = false, maxRadius = sp(11f), inset = inset)
|
||||
}
|
||||
|
||||
private fun buildStrip(s: HudMetrics.Snapshot) {
|
||||
val rowPx = sp(11.5f); val unitPx = rowPx * 0.8f; val fpsPx = sp(15f)
|
||||
val padX = sp(10f); val groupGap = sp(13f)
|
||||
|
||||
@@ -156,13 +156,7 @@ object InputLibraries {
|
||||
update(context) { library ->
|
||||
library.copy(layouts = library.layouts.map { layout ->
|
||||
if (layout.id != layoutId || !layout.editable) layout
|
||||
else {
|
||||
fun updateSticks(elements: List<InputSurfaceElement>) = elements.map {
|
||||
if (it.kind == InputElementKind.STICK) it.copy(floating = on, hideWhenIdle = it.hideStickAtRest, adaptiveCapture = on)
|
||||
else it
|
||||
}
|
||||
layout.copy(elements = updateSticks(layout.elements), rotated = updateSticks(layout.rotated))
|
||||
}
|
||||
else layout.copy(elements = layout.elements.map { if (it.kind == InputElementKind.STICK) it.copy(floating = on, hideWhenIdle = on) else it })
|
||||
})
|
||||
}
|
||||
}.onSuccess { ControllerPrefs.setAdaptiveSticks(context, on) }.isSuccess
|
||||
@@ -334,8 +328,7 @@ object InputLibraries {
|
||||
for (e in list) elements.put(JSONObject().put("id", e.id).put("kind", e.kind.name)
|
||||
.put("control", e.control.id).put("name", e.name).put("x", e.x.toDouble()).put("y", e.y.toDouble())
|
||||
.put("width", e.width.toDouble()).put("height", e.height.toDouble()).put("floating", e.floating).put("hideWhenIdle", e.hideWhenIdle).put("mouseGestures", e.mouseGestures).put("toggle", e.toggle).put("icon", e.icon).put("image", e.image)
|
||||
.put("elementOpacity", e.opacity.toDouble()).put("buttonShape", e.buttonShape.name).put("showLabel", e.showLabel).put("alwaysShown", e.alwaysShown)
|
||||
.put("adaptiveCapture", e.adaptiveCapture))
|
||||
.put("elementOpacity", e.opacity.toDouble()).put("buttonShape", e.buttonShape.name).put("showLabel", e.showLabel).put("alwaysShown", e.alwaysShown))
|
||||
}
|
||||
|
||||
private fun decodeElements(array: JSONArray) = array.objects(64).map { e ->
|
||||
@@ -343,8 +336,7 @@ object InputLibraries {
|
||||
e.getDouble("y").toFloat(), e.getDouble("width").toFloat(), e.getDouble("height").toFloat(),
|
||||
e.getString("id"), InputElementKind.valueOf(e.getString("kind")), e.getString("name"),
|
||||
e.optBoolean("floating", true), e.optBoolean("hideWhenIdle", false), e.optBoolean("mouseGestures", false), e.optBoolean("toggle", false), e.optInt("icon", 0), e.optString("image", ""),
|
||||
e.optDouble("elementOpacity", 1.0).toFloat(), InputButtonShape.valueOf(e.optString("buttonShape", InputButtonShape.ROUNDED.name)), e.optBoolean("showLabel", true), e.optBoolean("alwaysShown", false),
|
||||
if (e.isNull("adaptiveCapture")) null else e.optBoolean("adaptiveCapture", false))
|
||||
e.optDouble("elementOpacity", 1.0).toFloat(), InputButtonShape.valueOf(e.optString("buttonShape", InputButtonShape.ROUNDED.name)), e.optBoolean("showLabel", true), e.optBoolean("alwaysShown", false))
|
||||
}
|
||||
|
||||
internal fun encode(library: InputLibrary): String {
|
||||
|
||||
@@ -32,7 +32,7 @@ data class SavedInputLayout(
|
||||
fun withQuickButton(button: InputCommand, shown: Boolean) =
|
||||
copy(style = style.copy(hidden = if (shown) style.hidden - button else style.hidden + button))
|
||||
fun derived(id: String, name: String) = copy(id = id, name = name, origin = origin ?: this.id)
|
||||
val adaptiveSticks get() = elements.filter { it.kind == InputElementKind.STICK }.takeIf { editable && it.isNotEmpty() }?.all { it.adaptiveStick }
|
||||
val adaptiveSticks get() = elements.filter { it.kind == InputElementKind.STICK }.takeIf { editable && it.isNotEmpty() }?.all { it.floating && it.hideWhenIdle }
|
||||
fun supports(role: InputRole) = screen.supports(role) && when (template) {
|
||||
InputLayoutTemplate.OVERLAY -> role == InputRole.PRIMARY
|
||||
InputLayoutTemplate.DECK, InputLayoutTemplate.TRACKPAD -> role == InputRole.SECONDARY
|
||||
|
||||
@@ -37,12 +37,7 @@ data class InputSurfaceElement(
|
||||
val buttonShape: InputButtonShape = InputButtonShape.ROUNDED,
|
||||
val showLabel: Boolean = true,
|
||||
val alwaysShown: Boolean = false,
|
||||
val adaptiveCapture: Boolean? = null,
|
||||
) {
|
||||
// Old layouts encoded Adaptive sticks as Floating + Hide when idle.
|
||||
val adaptiveStick get() = kind == InputElementKind.STICK && floating && (adaptiveCapture ?: hideWhenIdle)
|
||||
val hideStickAtRest get() = hideWhenIdle && (adaptiveCapture != null || !adaptiveStick)
|
||||
|
||||
val hasClick get() = kind == InputElementKind.STICK || kind == InputElementKind.TRACKPAD
|
||||
|
||||
fun bounded() = copy(x = x.coerceIn(0f, 0.97f), y = y.coerceIn(0f, 0.97f),
|
||||
|
||||
@@ -188,7 +188,7 @@ internal class LegacyGamepadLayout(private val context: Context, private val wid
|
||||
settings.mapping[it.id] != ControllerPrefs.OFF && (it.id != "guide" || settings.steamButton) && (it.id != "qam" || settings.qamButton)
|
||||
}.map { c ->
|
||||
InputSurfaceElement(requireNotNull(InputControl.fromId(c.id)), (c.cx - c.halfW) / width, (c.cy - c.halfH) / height,
|
||||
2 * c.halfW / width, 2 * c.halfH / height, floating = settings.adaptiveSticks, adaptiveCapture = if (c.stick >= 0) settings.adaptiveSticks else null,
|
||||
2 * c.halfW / width, 2 * c.halfH / height, floating = settings.adaptiveSticks, hideWhenIdle = c.stick >= 0 && settings.adaptiveSticks,
|
||||
buttonShape = if (c.id in shoulderIds) InputButtonShape.PILL else InputButtonShape.CIRCLE).let { if (previousStickGeometry) widenStickPreviously(it) else widenStick(it) }.bounded()
|
||||
}.toMutableList()
|
||||
if (settings.keyboardButton) result += keyboard()
|
||||
|
||||
@@ -37,10 +37,8 @@ object OnScreenLayout {
|
||||
buttonsOnly: Boolean = false, dock: Dock? = null, rearButtons: Boolean? = null,
|
||||
trackpads: Boolean? = null): List<InputSurfaceElement> {
|
||||
val placed = placeElements(context, saved, width, height, safe, buttonsOnly, dock, rearButtons, trackpads)
|
||||
// Docked sticks stay visible and only pick up touches inside their own bounds.
|
||||
return if (dock == null) placed else placed.map {
|
||||
if (it.kind == InputElementKind.STICK) it.copy(hideWhenIdle = false, adaptiveCapture = false) else it
|
||||
}
|
||||
// Below the game a stick covers nothing, so it keeps its base in view instead of appearing only under the thumb.
|
||||
return if (dock == null) placed else placed.map { if (it.kind == InputElementKind.STICK) it.copy(hideWhenIdle = false) else it }
|
||||
}
|
||||
|
||||
private fun placeElements(context: Context, saved: SavedInputLayout?, width: Int, height: Int, safe: Rect,
|
||||
|
||||
@@ -277,16 +277,9 @@ public final class PadBridge {
|
||||
return lower.startsWith("uinput-") || lower.startsWith("uinput_") || lower.equals("ui-input-xiaomi");
|
||||
}
|
||||
|
||||
private static boolean isVirtualInput(InputDevice device) {
|
||||
// scrcpy's UHID pad is internal and reports the wired Xbox 360 USB identity.
|
||||
return device.isVirtual() || isSystemVirtualInputName(device.getName())
|
||||
|| (!device.isExternal() && device.getVendorId() == 0x045e
|
||||
&& device.getProductId() == 0x028e && "Microsoft X-Box 360 Pad".equals(device.getName()));
|
||||
}
|
||||
|
||||
public static boolean isFromController(InputDevice device) {
|
||||
if (device == null) return false;
|
||||
if (isVirtualInput(device)) return false;
|
||||
if (device.isVirtual() || isSystemVirtualInputName(device.getName())) return false;
|
||||
int sources = device.getSources();
|
||||
if ((sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) return true;
|
||||
if ((sources & InputDevice.SOURCE_JOYSTICK) != InputDevice.SOURCE_JOYSTICK) return false;
|
||||
@@ -306,7 +299,7 @@ public final class PadBridge {
|
||||
}
|
||||
|
||||
static boolean isControllerKeyEvent(KeyEvent event, InputDevice device) {
|
||||
if (device == null || isVirtualInput(device)) return false;
|
||||
if (device == null || device.isVirtual() || isSystemVirtualInputName(device.getName())) return false;
|
||||
if (KeyEvent.isGamepadButton(event.getKeyCode())) {
|
||||
return device.supportsSource(InputDevice.SOURCE_GAMEPAD)
|
||||
|| device.supportsSource(InputDevice.SOURCE_JOYSTICK);
|
||||
@@ -334,7 +327,8 @@ public final class PadBridge {
|
||||
}
|
||||
|
||||
static boolean isControllerMotionEvent(MotionEvent event, InputDevice device) {
|
||||
return event.isFromSource(InputDevice.SOURCE_JOYSTICK) && device != null && !isVirtualInput(device)
|
||||
return event.isFromSource(InputDevice.SOURCE_JOYSTICK) && device != null && !device.isVirtual()
|
||||
&& !isSystemVirtualInputName(device.getName())
|
||||
&& (device.supportsSource(InputDevice.SOURCE_GAMEPAD)
|
||||
|| device.supportsSource(InputDevice.SOURCE_JOYSTICK));
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.content.Context
|
||||
import com.droiddeck.launcher.core.GameEnvironment
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
* dd-directcontroller's mode file. DroidDeck-Bionic's launch.sh writes it beside the controller folder when a game set to start
|
||||
* without Steam reads XInput through dd-directcontroller; the game's DLLs read it while it runs ('1' the pad state, '0' Wine's own
|
||||
* xinput). No file = the session's game does not use dd-directcontroller.
|
||||
*/
|
||||
object DirectControllerSwitch {
|
||||
const val FILE = "dd-directcontroller.mode"
|
||||
|
||||
fun file(context: Context): File = File(LinuxRuntime.sessionRoot(context), "dev/$FILE")
|
||||
|
||||
/** The running game's mode, or null when it does not use dd-directcontroller. */
|
||||
fun state(context: Context): Boolean? = runCatching {
|
||||
when (file(context).takeIf { it.isFile }?.readText()?.trim()) {
|
||||
"1" -> true
|
||||
"0" -> false
|
||||
else -> null
|
||||
}
|
||||
}.getOrNull()
|
||||
|
||||
/** One request after another, in call order: the last switch sets both the live mode and the saved choice. */
|
||||
private val queue = java.util.concurrent.Executors.newSingleThreadExecutor { Thread(it, "dd-directcontroller") }
|
||||
|
||||
/** Switches the running game now and remembers the choice for its next start. */
|
||||
fun set(context: Context, on: Boolean) {
|
||||
val app = context.applicationContext
|
||||
queue.execute {
|
||||
runCatching { file(app).takeIf { it.isFile }?.writeText(if (on) "1\n" else "0\n") }
|
||||
val scope = NoSteamLaunch.scopeOf(SessionState.program, SessionState.programArgs) { NoSteamLaunch.battleNetTitleScope(app, it) }
|
||||
if (!scope.isNullOrEmpty() && GameEnvironment.validScope(scope)) runCatching {
|
||||
GameEnvironmentStore.setGameDirectController(app, scope, on)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** A session starts without the file: only a launch that uses dd-directcontroller writes it again. */
|
||||
fun clear(context: Context) {
|
||||
file(context).delete()
|
||||
}
|
||||
}
|
||||
@@ -91,13 +91,6 @@ object GameEnvironmentStore {
|
||||
return config
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun setGameDirectController(context: Context, scope: String, on: Boolean): GameEnvironment.Config {
|
||||
val config = GameEnvironment.withGameDirectController(read(context), scope, on)
|
||||
save(context, config)
|
||||
return config
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun setGameResolution(context: Context, scope: String, choice: com.droiddeck.launcher.core.GameResolution.Choice?): GameEnvironment.Config {
|
||||
val config = GameEnvironment.withGameResolution(read(context), scope, choice)
|
||||
|
||||
@@ -2,16 +2,10 @@ package com.droiddeck.launcher.session
|
||||
|
||||
import android.util.Log
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.nio.file.FileVisitResult
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.SimpleFileVisitor
|
||||
import java.nio.file.attribute.BasicFileAttributes
|
||||
|
||||
internal object PageCacheTrim {
|
||||
private const val TAG = "PageCacheTrim"
|
||||
internal const val MIN_FILE_BYTES = 8L shl 20
|
||||
private const val MIN_FILE_BYTES = 8L shl 20
|
||||
private const val POLL_MS = 3000L
|
||||
private const val RESCAN_MS = 120_000L
|
||||
|
||||
@@ -43,7 +37,7 @@ internal object PageCacheTrim {
|
||||
if (mem != null && shouldTrim(mem, baseline)) {
|
||||
val now = System.currentTimeMillis()
|
||||
if (now - scanned > RESCAN_MS) {
|
||||
files = roots().flatMap { root -> bigFiles(root) }
|
||||
files = roots().flatMap { root -> root.walkTopDown().onEnter { !java.nio.file.Files.isSymbolicLink(it.toPath()) }.filter { it.isFile && it.length() >= MIN_FILE_BYTES }.toList() }
|
||||
scanned = now
|
||||
}
|
||||
val began = System.nanoTime()
|
||||
@@ -62,34 +56,6 @@ internal object PageCacheTrim {
|
||||
}, "page-cache-trim").apply { isDaemon = true }.start()
|
||||
}
|
||||
|
||||
// java.io's directory listing hands raw entry names to JNI NewStringUTF, which aborts the
|
||||
// process on names that are not valid UTF-8; NIO decodes them with replacement instead.
|
||||
// Without FOLLOW_LINKS, symlinked directories are never descended into, like the old onEnter,
|
||||
// except that a starting directory that is itself a link has to be resolved first; a link
|
||||
// whose target has vanished yields an empty result instead of an error.
|
||||
internal fun bigFiles(root: File): List<File> {
|
||||
val out = ArrayList<File>()
|
||||
val start = root.toPath()
|
||||
val real = if (Files.isSymbolicLink(start)) {
|
||||
try {
|
||||
start.toRealPath()
|
||||
} catch (_: IOException) {
|
||||
return out
|
||||
}
|
||||
} else start
|
||||
Files.walkFileTree(real, object : SimpleFileVisitor<Path>() {
|
||||
override fun visitFile(file: Path, attrs: BasicFileAttributes): FileVisitResult {
|
||||
if (attrs.isRegularFile && attrs.size() >= MIN_FILE_BYTES) out.add(file.toFile())
|
||||
return FileVisitResult.CONTINUE
|
||||
}
|
||||
|
||||
override fun visitFileFailed(file: Path, error: IOException): FileVisitResult = FileVisitResult.CONTINUE
|
||||
|
||||
override fun postVisitDirectory(dir: Path, error: IOException?): FileVisitResult = FileVisitResult.CONTINUE
|
||||
})
|
||||
return out
|
||||
}
|
||||
|
||||
private fun drop(file: File) {
|
||||
PageCacheNative.fadviseDontNeed(file.path)
|
||||
}
|
||||
|
||||
@@ -191,7 +191,6 @@ object SessionFiles {
|
||||
"usr/local/bin/droiddeck-snap-cli" to "usr/local/bin/snap",
|
||||
"usr/local/bin/droiddeck-steam-shim" to "usr/local/bin/droiddeck-steam-shim",
|
||||
"usr/local/bin/droiddeck-steam-shortcuts" to "usr/local/bin/droiddeck-steam-shortcuts",
|
||||
"usr/local/bin/droiddeck-android-app" to "usr/local/bin/droiddeck-android-app",
|
||||
"usr/local/bin/droiddeck-xbox" to "usr/local/bin/droiddeck-xbox",
|
||||
"usr/local/bin/droiddeck-store-launch" to "usr/local/bin/droiddeck-store-launch",
|
||||
"usr/local/bin/droiddeck-gog-maintenance" to "usr/local/bin/droiddeck-gog-maintenance",
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.droiddeck.launcher.gpu.Cardboard
|
||||
import com.droiddeck.launcher.gpu.ScreenEffects
|
||||
import com.droiddeck.launcher.gpu.SystemVulkanDriver
|
||||
import com.droiddeck.launcher.gpu.TurnipDriver
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import java.io.File
|
||||
|
||||
@@ -318,14 +317,6 @@ object SessionPrefs {
|
||||
prefs(context).edit().putBoolean("telemetryAuto", on).apply()
|
||||
}
|
||||
|
||||
fun settingsSearches(context: Context): List<String> = runCatching {
|
||||
JSONArray(prefs(context).getString("settingsSearches", null) ?: "[]").let { a -> List(a.length()) { a.getString(it) } }
|
||||
}.getOrDefault(emptyList())
|
||||
|
||||
fun setSettingsSearches(context: Context, searches: List<String>) {
|
||||
prefs(context).edit().putString("settingsSearches", JSONArray(searches).toString()).apply()
|
||||
}
|
||||
|
||||
fun telemetryOff(context: Context): Set<String> = prefs(context).getStringSet("telemetryOff", null)?.toSet().orEmpty()
|
||||
|
||||
fun setTelemetryOff(context: Context, keys: Set<String>) {
|
||||
|
||||
@@ -714,9 +714,6 @@ class SessionService : Service() {
|
||||
SessionEvents.step("added-games-listing") { com.droiddeck.launcher.frontend.AddedGames.writeListing(this, added) }
|
||||
}
|
||||
guest.add("DD_ADDED_GAMES=" + listing.path)
|
||||
if (steamHere) runCatching {
|
||||
guest.addAll(com.droiddeck.launcher.frontend.AndroidSteamApps.sessionEnvironment(this, sessionDir))
|
||||
}.onFailure { Log.w(TAG, "Android Steam shortcuts", it) }
|
||||
if (OfflineMode.active(this)) guest.add("DD_STEAM_OFFLINE=1")
|
||||
if (com.droiddeck.launcher.gpu.Lossless.owned(this)) guest.add("DD_LOSSLESS_OWNED=1")
|
||||
}
|
||||
@@ -1252,7 +1249,6 @@ class SessionService : Service() {
|
||||
}
|
||||
|
||||
private fun addControllerEnvironment(guest: MutableList<String>, fakeInputDir: File, sessionDir: File) {
|
||||
DirectControllerSwitch.clear(this)
|
||||
FakeInputWriter.prepareRingSlots(fakeInputDir, 5)
|
||||
val builtinPad = SessionPrefs.builtinPad(this)
|
||||
val hiddenPad = SessionState.mode == MODE_STEAM && !builtinPad &&
|
||||
|
||||
@@ -189,7 +189,7 @@ object StoreLaunchRequests {
|
||||
///
|
||||
/// The message is the only thing that separates a stale sign-in from a title
|
||||
/// that is not installed, so it is kept, minus anything that could carry a
|
||||
/// device path or a token: segments looking like a path are dropped and the
|
||||
/// device path or a token: segments lookng like a path are dropped and the
|
||||
/// rest is folded to plain text.
|
||||
internal fun reasonFor(error: Throwable): String {
|
||||
val text = error.message.orEmpty()
|
||||
|
||||
@@ -798,17 +798,6 @@ private fun AppMenu(
|
||||
onDismiss()
|
||||
HomeIcons.clear(ctx, app.key)
|
||||
}
|
||||
val steamApps = com.droiddeck.launcher.frontend.AndroidSteamApps
|
||||
if (!app.work && steamApps.supports(app.packageName)) {
|
||||
val added = steamApps.contains(ctx, app.packageName)
|
||||
MenuItem(stringResource(if (added) R.string.apps_remove_from_steam else R.string.apps_add_to_steam), checked = false) {
|
||||
onDismiss()
|
||||
steamApps.set(ctx, app.packageName, !added)
|
||||
val message = if (!added && !com.droiddeck.launcher.core.WirelessAdbFix.hasSavedPairing(ctx))
|
||||
R.string.apps_steam_pairing_required else R.string.apps_steam_restart
|
||||
android.widget.Toast.makeText(ctx, message, android.widget.Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
MenuItem(stringResource(R.string.apps_app_info), checked = false) {
|
||||
onDismiss()
|
||||
runCatching { HomeApp.openAppInfo(ctx, app) }
|
||||
|
||||
@@ -39,8 +39,7 @@ internal fun DroidDeckHudSettings(host: MenuHost, a: DrawerActions, track: (Stri
|
||||
}
|
||||
if (!a.hudOn) return@SettingsGroup
|
||||
val size = DroidDeckHudSize.from(cfg["hudSize"])
|
||||
ChoiceRow(host, "hud-size", stringResource(R.string.hud_size),
|
||||
stringResource(if (size == DroidDeckHudSize.SIDE_STRIP) R.string.hud_size_side_strip_hint else R.string.hud_size_hint),
|
||||
ChoiceRow(host, "hud-size", stringResource(R.string.hud_size), stringResource(R.string.hud_size_hint),
|
||||
listOf(
|
||||
DroidDeckHudSize.FULL to stringResource(R.string.hud_size_full),
|
||||
DroidDeckHudSize.TILES to stringResource(R.string.hud_size_tiles),
|
||||
@@ -48,7 +47,6 @@ internal fun DroidDeckHudSettings(host: MenuHost, a: DrawerActions, track: (Stri
|
||||
DroidDeckHudSize.MINIMAL to stringResource(R.string.hud_size_minimal),
|
||||
DroidDeckHudSize.MEGA to stringResource(R.string.hud_size_mega),
|
||||
DroidDeckHudSize.STRIP to stringResource(R.string.hud_size_strip),
|
||||
DroidDeckHudSize.SIDE_STRIP to stringResource(R.string.hud_size_side_strip),
|
||||
),
|
||||
size, chipModifier = track("hud-size")) { a.onHudSetting("hudSize", it.token) }
|
||||
ChoiceRow(host, "hud-hold", stringResource(R.string.hud_hold), null,
|
||||
|
||||
@@ -231,10 +231,7 @@ internal fun SetupPanel(
|
||||
}
|
||||
val chipFocus = remember { List(tabs.size) { FocusRequester() } }
|
||||
var tabTurned by remember { mutableStateOf(false) }
|
||||
remember { SettingsSearchHistory.load(ctx) }
|
||||
var fromHistory by remember { mutableStateOf(false) }
|
||||
val keepSearch = { if (searching && SettingsIndex.search(ctx, query, frostRow).isNotEmpty()) SettingsSearchHistory.add(ctx, query) }
|
||||
val pick: (Int) -> Unit = { i -> keepSearch(); tab = i; tabTurned = true; searching = false; query = ""; if (i == DEVELOPER_TAB) logsRefresh++ }
|
||||
val pick: (Int) -> Unit = { i -> tab = i; tabTurned = true; searching = false; query = ""; if (i == DEVELOPER_TAB) logsRefresh++ }
|
||||
val inputModeManager = LocalInputModeManager.current
|
||||
LaunchedEffect(Unit) {
|
||||
while (true) {
|
||||
@@ -261,9 +258,8 @@ internal fun SetupPanel(
|
||||
) {
|
||||
val sectionBar: @Composable (Modifier) -> Unit = { m ->
|
||||
SettingsPillSearch(
|
||||
m, searching, query, { query = it; fromHistory = false },
|
||||
onOpen = { searching = true }, onClose = { keepSearch(); searching = false; query = "" },
|
||||
keepOpen = SettingsSearchHistory.items.isNotEmpty(), onSearch = keepSearch,
|
||||
m, searching, query, { query = it },
|
||||
onOpen = { searching = true }, onClose = { searching = false; query = "" },
|
||||
) { SheetChips(tabs, tab, chipFocus, onPick = pick) }
|
||||
}
|
||||
val portrait = androidx.compose.ui.platform.LocalConfiguration.current.orientation == android.content.res.Configuration.ORIENTATION_PORTRAIT
|
||||
@@ -272,11 +268,9 @@ internal fun SetupPanel(
|
||||
Row(Modifier.fillMaxWidth().padding(bottom = 10.dp)) { sectionBar(Modifier.weight(1f)) }
|
||||
} else PageHeader(stringResource(R.string.setup_title)) { sectionBar(Modifier.weight(1f)) }
|
||||
val listing = searching && query.isNotBlank()
|
||||
val history = searching && query.isBlank() && SettingsSearchHistory.items.isNotEmpty()
|
||||
val fixed = tab == CONTROLLER_TAB && !listing && !history
|
||||
val fixed = tab == CONTROLLER_TAB && !listing
|
||||
Column(modifier = Modifier.weight(1f).fillMaxWidth().then(if (fixed) Modifier else Modifier.verticalScroll(rememberScrollState())).padding(bottom = if (fixed) 0.dp else 24.dp)) {
|
||||
if (listing) SettingsSearchResults(query, frostRow, focusFirst = fromHistory, onSearched = keepSearch) { section -> pick(section.ordinal) }
|
||||
else if (history) SettingsSearchHistoryList(onPick = { fromHistory = true; query = it }) { SettingsSearchHistory.clear(ctx) }
|
||||
if (listing) SettingsSearchResults(query, frostRow) { section -> pick(section.ordinal) }
|
||||
else when (tab) {
|
||||
OVERVIEW_TAB -> {
|
||||
OnboardingCard(limitBlocks, a.onShowPhantomGate)
|
||||
|
||||
@@ -67,18 +67,8 @@ internal fun InputElementProperties(element: InputSurfaceElement, action: InputA
|
||||
}
|
||||
if (element.kind == InputElementKind.STICK) {
|
||||
val host = rememberMenuHost()
|
||||
val adaptive = element.adaptiveCapture ?: element.adaptiveStick
|
||||
ToggleRow(host, "element-floating", stringResource(R.string.input_floating_stick), null, element.floating) {
|
||||
onChange(element.copy(floating = it, hideWhenIdle = element.hideStickAtRest, adaptiveCapture = adaptive))
|
||||
}
|
||||
if (element.floating) {
|
||||
ToggleRow(host, "element-adaptive-capture", stringResource(R.string.input_adaptive_capture), null, element.adaptiveStick) {
|
||||
onChange(element.copy(hideWhenIdle = element.hideStickAtRest, adaptiveCapture = it))
|
||||
}
|
||||
}
|
||||
ToggleRow(host, "element-hide-idle", stringResource(R.string.input_hide_idle), null, element.hideStickAtRest) {
|
||||
onChange(element.copy(hideWhenIdle = it, adaptiveCapture = adaptive))
|
||||
}
|
||||
ToggleRow(host, "element-floating", stringResource(R.string.input_floating_stick), null, element.floating) { onChange(element.copy(floating = it)) }
|
||||
ToggleRow(host, "element-hide-idle", stringResource(R.string.input_hide_idle), null, element.hideWhenIdle) { onChange(element.copy(hideWhenIdle = it)) }
|
||||
}
|
||||
val host = rememberMenuHost()
|
||||
if ((element.kind == InputElementKind.BUTTON || element.kind == InputElementKind.TRIGGER) && element.icon == 0 && element.image.isEmpty() ||
|
||||
|
||||
@@ -236,11 +236,11 @@ class InputSurfaceView(
|
||||
super.dispatchDraw(canvas)
|
||||
}
|
||||
}
|
||||
canvas.clipChildren = customLayout.none { it.kind == InputElementKind.STICK && (classic(it) || it.adaptiveStick) }
|
||||
canvas.clipChildren = customLayout.none { it.kind == InputElementKind.STICK && (classic(it) || adaptive(it)) }
|
||||
for (element in customLayout) {
|
||||
val source = pad?.let { InputSurfaceSource(it, inputRole, element).also { s -> elementSources += s } }
|
||||
canvas.addView(when (element.kind) {
|
||||
InputElementKind.STICK -> StickView(context, element, source, element.floating, element.hideStickAtRest && pad != null)
|
||||
InputElementKind.STICK -> StickView(context, element, source, element.floating, element.hideWhenIdle && pad != null)
|
||||
InputElementKind.TRACKPAD -> TrackpadView(context, element.control == InputControl.RIGHT_PAD, captioned = element.showLabel,
|
||||
stock = element.id == "legacy:${element.control.id}", source = source)
|
||||
InputElementKind.DPAD -> DirectionPad(context, element, source)
|
||||
@@ -641,7 +641,7 @@ class InputSurfaceView(
|
||||
private val ring = Paint(Paint.ANTI_ALIAS_FLAG).apply { style = Paint.Style.STROKE }
|
||||
private val knob = Paint(Paint.ANTI_ALIAS_FLAG)
|
||||
|
||||
val adaptive get() = element.adaptiveStick
|
||||
val adaptive get() = adaptive(element)
|
||||
|
||||
fun reach() = min(width, height) * if (classic(element)) CLASSIC_REACH else PANEL_REACH
|
||||
|
||||
@@ -859,6 +859,8 @@ class InputSurfaceView(
|
||||
private val TEXT_DIM = Color.rgb(0x7A, 0x80, 0x8A)
|
||||
private val KNOB = Color.rgb(0x2A, 0x2D, 0x33)
|
||||
|
||||
private fun adaptive(element: InputSurfaceElement) = element.kind == InputElementKind.STICK && element.floating && element.hideWhenIdle
|
||||
|
||||
private fun classic(element: InputSurfaceElement) = (element.id == "legacy:${element.control.id}" || element.id == "builtin:keyboard") &&
|
||||
(element.buttonShape == InputButtonShape.CIRCLE || element.buttonShape == InputButtonShape.PILL)
|
||||
|
||||
|
||||
@@ -414,9 +414,6 @@ class DrawerActions(
|
||||
val unfoldedControls: Boolean? = null,
|
||||
val adaptiveSticks: Boolean? = null,
|
||||
val onAdaptiveSticks: (Boolean) -> Unit = {},
|
||||
/** dd-directcontroller's mode for the running game; null = the game does not use it. */
|
||||
val directController: Boolean? = null,
|
||||
val onDirectController: (Boolean) -> Unit = {},
|
||||
val showFloatingSteamControls: Boolean = false,
|
||||
val oscRearButtons: Boolean = false,
|
||||
val oscTrackpads: Boolean = false,
|
||||
@@ -795,12 +792,10 @@ private fun DrawerControllerPage(host: MenuHost, a: DrawerActions, padConnected:
|
||||
val rumbleLabel = stringResource(R.string.ctrl_rumble)
|
||||
val airTriggers = a.airTriggers
|
||||
val airTriggersLabel = stringResource(R.string.air_triggers_title)
|
||||
val directControllerLabel = stringResource(R.string.ctrl_direct_controller)
|
||||
if (a.padType != null || c != null || airTriggers != null || a.directController != null) SettingsGroup(
|
||||
if (a.padType != null || c != null || airTriggers != null) SettingsGroup(
|
||||
stringResource(R.string.input_device_settings), key = "controller-pad", tag = padTag,
|
||||
detail = summary(a.padType?.let { padTypes.labelOf(it) }, c?.let { "$rumbleLabel ${if (it.rumble) on else off}" },
|
||||
airTriggers?.let { "$airTriggersLabel ${if (it.enabled) on else off}" },
|
||||
a.directController?.let { "$directControllerLabel ${if (it) on else off}" }),
|
||||
airTriggers?.let { "$airTriggersLabel ${if (it.enabled) on else off}" }),
|
||||
) {
|
||||
a.padType?.let { type ->
|
||||
ChoiceRow(host, "pad-type", stringResource(R.string.input_virtual_controller), stringResource(R.string.input_virtual_controller_hint),
|
||||
@@ -809,9 +804,6 @@ private fun DrawerControllerPage(host: MenuHost, a: DrawerActions, padConnected:
|
||||
c?.let {
|
||||
ToggleRow(host, "rumble", rumbleLabel, null, it.rumble, chipModifier = track("rumble"), onChange = a.onRumble)
|
||||
}
|
||||
a.directController?.let {
|
||||
ToggleRow(host, "direct-controller", directControllerLabel, null, it, chipModifier = track("direct-controller"), onChange = a.onDirectController)
|
||||
}
|
||||
airTriggers?.let {
|
||||
ActionRow(airTriggersLabel, if (it.enabled) on else off, stringResource(R.string.air_triggers_open), onAirTriggers,
|
||||
modifier = track("air-triggers"))
|
||||
|
||||
@@ -16,10 +16,6 @@ import androidx.compose.runtime.setValue
|
||||
import androidx.compose.runtime.withFrameNanos
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.drawBehind
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.geometry.Rect
|
||||
import androidx.compose.ui.layout.LayoutCoordinates
|
||||
import androidx.compose.ui.layout.onPlaced
|
||||
|
||||
/** The row a settings search result opens, so the page it lands on can scroll to it and flash it. */
|
||||
internal object SettingsJump {
|
||||
@@ -35,32 +31,12 @@ private const val JUMP_WINDOW_MS = 5_000L
|
||||
/** False in the search results, whose rows carry the same labels as the rows they open. */
|
||||
internal val LocalSearchTargets = staticCompositionLocalOf { true }
|
||||
|
||||
/** How far a page has to be scrolled to show a row in its middle, or as near to it as the page's ends allow. */
|
||||
internal fun centeredScroll(rowTop: Float, rowHeight: Float, page: Float, content: Float): Float =
|
||||
(rowTop + rowHeight / 2f - page / 2f).coerceIn(0f, (content - page).coerceAtLeast(0f))
|
||||
|
||||
/** The part of the page to show around a row to have it in the middle, relative to the row. Null when nothing around it scrolls. */
|
||||
private fun pageAround(row: LayoutCoordinates): Rect? {
|
||||
var content = row
|
||||
while (true) {
|
||||
val page = content.parentCoordinates ?: return null
|
||||
if (content.size.height > page.size.height) {
|
||||
val top = content.localPositionOf(row, Offset.Zero).y
|
||||
val height = page.size.height.toFloat()
|
||||
val from = centeredScroll(top, row.size.height.toFloat(), height, content.size.height.toFloat()) - top
|
||||
return Rect(0f, from, row.size.width.toFloat(), from + height)
|
||||
}
|
||||
content = page
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(androidx.compose.foundation.ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
internal fun Modifier.searchTarget(label: String): Modifier {
|
||||
val pal = LocalPalette.current
|
||||
val flash = remember { Animatable(0f) }
|
||||
val reveal = remember { BringIntoViewRequester() }
|
||||
val row = remember { arrayOfNulls<LayoutCoordinates>(1) }
|
||||
var claimed by remember { mutableStateOf<SettingsJump.Target?>(null) }
|
||||
val target = SettingsJump.target.takeIf { LocalSearchTargets.current }
|
||||
if (target != null && target.label == label) SideEffect {
|
||||
@@ -72,7 +48,7 @@ internal fun Modifier.searchTarget(label: String): Modifier {
|
||||
claimed?.let { mine ->
|
||||
LaunchedEffect(mine) {
|
||||
withFrameNanos { }
|
||||
reveal.bringIntoView(row[0]?.takeIf { it.isAttached }?.let(::pageAround))
|
||||
reveal.bringIntoView()
|
||||
repeat(2) {
|
||||
flash.animateTo(1f, tween(220))
|
||||
flash.animateTo(0f, tween(420))
|
||||
@@ -80,7 +56,7 @@ internal fun Modifier.searchTarget(label: String): Modifier {
|
||||
claimed = null
|
||||
}
|
||||
}
|
||||
return bringIntoViewRequester(reveal).onPlaced { row[0] = it }.drawBehind {
|
||||
return bringIntoViewRequester(reveal).drawBehind {
|
||||
if (flash.value > 0f) drawRect(pal.signal.copy(alpha = 0.28f * flash.value))
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@ import androidx.compose.ui.semantics.clearAndSetSemantics
|
||||
@Composable
|
||||
internal fun SettingsPillSearch(
|
||||
modifier: Modifier, searching: Boolean, query: String, onQuery: (String) -> Unit,
|
||||
onOpen: () -> Unit, onClose: () -> Unit, keepOpen: Boolean = false, onSearch: () -> Unit = {}, pills: @Composable () -> Unit,
|
||||
onOpen: () -> Unit, onClose: () -> Unit, pills: @Composable () -> Unit,
|
||||
) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val open by animateFloatAsState(if (searching) 1f else 0f, Motion.sp(0.75f, 420f), label = "settingsSearch")
|
||||
@@ -53,11 +53,10 @@ internal fun SettingsPillSearch(
|
||||
var fieldFocused by remember { mutableStateOf(false) }
|
||||
CancelPendingFocus(focusOnOpen, focusTap, fieldFocused) {
|
||||
focusOnOpen = false
|
||||
if (query.isEmpty() && !keepOpen) onClose()
|
||||
if (query.isEmpty()) onClose()
|
||||
}
|
||||
val close = { toIcon = true; focusOnOpen = false; onClose() }
|
||||
BackHandler(enabled = searching) { close() }
|
||||
LaunchedEffect(keepOpen) { if (!keepOpen && searching && !fieldFocused && !focusOnOpen && query.isEmpty()) close() }
|
||||
LaunchedEffect(toIcon, searching, open <= 0.01f) {
|
||||
if (searching) toIcon = false
|
||||
else if (toIcon && open <= 0.01f) { focusSoon { icon }; toIcon = false }
|
||||
@@ -81,13 +80,10 @@ internal fun SettingsPillSearch(
|
||||
AdbTextField(
|
||||
value = query, onValueChange = onQuery, label = "", keyboardType = KeyboardType.Text, imeAction = ImeAction.Search,
|
||||
placeholder = stringResource(R.string.settings_search), compact = true, showLabel = false, focusOnShow = focusOnOpen, focusAtTap = focusTap,
|
||||
clearFocus = !searching, onDone = onSearch,
|
||||
clearFocus = !searching,
|
||||
onFocusChange = { focused ->
|
||||
fieldFocused = focused
|
||||
if (!focused && query.isEmpty() && searching) {
|
||||
focusOnOpen = false
|
||||
if (!keepOpen) onClose()
|
||||
}
|
||||
if (!focused && query.isEmpty() && searching) { focusOnOpen = false; onClose() }
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -100,19 +96,13 @@ internal fun SettingsPillSearch(
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun SettingsSearchResults(query: String, frost: Boolean, focusFirst: Boolean = false, onSearched: () -> Unit = {}, onOpen: (SettingsSection) -> Unit) {
|
||||
internal fun SettingsSearchResults(query: String, frost: Boolean, onOpen: (SettingsSection) -> Unit) {
|
||||
val ctx = LocalContext.current
|
||||
val found = remember(query, frost) { SettingsIndex.search(ctx, query, frost) }
|
||||
if (found.isEmpty()) {
|
||||
Note(stringResource(R.string.settings_search_none, query.trim()))
|
||||
return
|
||||
}
|
||||
val first = remember { FocusRequester() }
|
||||
val firstToOpen = found.groupBy { it.place }.values.flatten().firstOrNull { it.section != null || it.tab != null }
|
||||
val inputMode = androidx.compose.ui.platform.LocalInputModeManager.current
|
||||
LaunchedEffect(Unit) {
|
||||
if (focusFirst && firstToOpen != null && inputMode.inputMode == androidx.compose.ui.input.InputMode.Keyboard) focusSoon { first }
|
||||
}
|
||||
androidx.compose.runtime.CompositionLocalProvider(LocalSearchTargets provides false) { Column {
|
||||
found.groupBy { it.place }.forEach { (place, entries) ->
|
||||
SettingsGroup(stringResource(place.title)) {
|
||||
@@ -121,12 +111,10 @@ internal fun SettingsSearchResults(query: String, frost: Boolean, focusFirst: Bo
|
||||
val title = stringResource(entry.title)
|
||||
val section = entry.section
|
||||
val tab = entry.tab
|
||||
val button = if (entry === firstToOpen) Modifier.focusRequester(first) else Modifier
|
||||
if (section != null) {
|
||||
ActionRow(title, within, stringResource(R.string.store_open), modifier = button, onClick = { onSearched(); SettingsJump.to(title); onOpen(section) })
|
||||
ActionRow(title, within, stringResource(R.string.store_open), onClick = { SettingsJump.to(title); onOpen(section) })
|
||||
} else if (tab != null) {
|
||||
ActionRow(title, within, stringResource(R.string.store_open), modifier = button, onClick = {
|
||||
onSearched()
|
||||
ActionRow(title, within, stringResource(R.string.store_open), onClick = {
|
||||
SettingsJump.to(title)
|
||||
if (tab == NavTabs.MORE) MoreTabs.editing = true
|
||||
if (tab == "downloads") DownloadsNav.showSettings = true
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import android.content.Context
|
||||
import androidx.compose.foundation.LocalIndication
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.hoverable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
||||
import androidx.compose.foundation.layout.FlowRow
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.widthIn
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.Delete
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.Role
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
|
||||
/** What was searched for in Settings, newest first. */
|
||||
internal object SettingsSearchHistory {
|
||||
const val MAX = 8
|
||||
|
||||
var items by mutableStateOf<List<String>>(emptyList())
|
||||
private set
|
||||
|
||||
fun load(context: Context) { items = SessionPrefs.settingsSearches(context) }
|
||||
|
||||
fun add(context: Context, query: String) {
|
||||
val next = withSearch(items, query)
|
||||
if (next == items) return
|
||||
items = next
|
||||
SessionPrefs.setSettingsSearches(context, next)
|
||||
}
|
||||
|
||||
fun clear(context: Context) {
|
||||
items = emptyList()
|
||||
SessionPrefs.setSettingsSearches(context, emptyList())
|
||||
}
|
||||
|
||||
fun withSearch(items: List<String>, query: String): List<String> {
|
||||
val text = query.trim().replace(Regex("\\s+"), " ")
|
||||
if (text.isEmpty()) return items
|
||||
return (listOf(text) + items.filterNot { it.equals(text, ignoreCase = true) }).take(MAX)
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalLayoutApi::class)
|
||||
@Composable
|
||||
internal fun SettingsSearchHistoryList(onPick: (String) -> Unit, onClear: () -> Unit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
Column(Modifier.fillMaxWidth()) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(top = 12.dp, bottom = 8.dp)) {
|
||||
Text(
|
||||
stringResource(R.string.settings_search_history), fontSize = 16.sp, fontWeight = FontWeight.SemiBold, color = colors.onSurfaceVariant,
|
||||
modifier = Modifier.weight(1f).padding(start = 4.dp),
|
||||
)
|
||||
SmallIconButton(Icons.Outlined.Delete, stringResource(R.string.settings_search_history_clear), tint = colors.onSurfaceVariant, onClick = onClear)
|
||||
}
|
||||
FlowRow(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
SettingsSearchHistory.items.forEach { HistoryChip(it) { onPick(it) } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun HistoryChip(text: String, onClick: () -> Unit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
val src = remember { MutableInteractionSource() }
|
||||
val hot = rememberHot(src)
|
||||
Box(
|
||||
contentAlignment = Alignment.Center,
|
||||
modifier = Modifier.heightIn(min = 40.dp).widthIn(min = 56.dp, max = 260.dp).clip(CircleShape)
|
||||
.background(colors.surface).glideBorder(hot, CircleShape, pal.signal, pal.line)
|
||||
.hoverable(src).clickable(interactionSource = src, indication = LocalIndication.current, role = Role.Button, onClick = onClick)
|
||||
.controllerConfirm(onClick = onClick)
|
||||
.padding(horizontal = 16.dp, vertical = 8.dp),
|
||||
) { Text(text, fontSize = 14.sp, color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis) }
|
||||
}
|
||||
@@ -14,7 +14,6 @@ import androidx.compose.animation.core.infiniteRepeatable
|
||||
import androidx.compose.animation.core.rememberInfiniteTransition
|
||||
import androidx.compose.animation.core.tween
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.derivedStateOf
|
||||
import androidx.compose.runtime.key
|
||||
import androidx.compose.runtime.SideEffect
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
@@ -89,7 +88,7 @@ object Themes {
|
||||
var rgbSpeed by mutableStateOf(DEFAULT_RGB_SPEED)
|
||||
private set
|
||||
|
||||
@Volatile var rgbHue = 0f
|
||||
var rgbHue by mutableStateOf(0f)
|
||||
private set
|
||||
|
||||
fun moveRgbHue(hue: Float) {
|
||||
@@ -238,36 +237,8 @@ fun DroidDeckTheme(theme: String? = null, appScale: Int = AppUiPrefs.DEFAULT_SCA
|
||||
val context = LocalContext.current
|
||||
remember(context) { Themes.loadGradient(context) }
|
||||
val id = theme ?: SessionPrefs.theme(context)
|
||||
val solid = if (id == Themes.INNER_GAMER) {
|
||||
rememberInnerGamerPalette(Themes.rgbSpeed)
|
||||
} else {
|
||||
Themes.byId(id)
|
||||
}
|
||||
DroidDeckThemePalette(solid, appScale, frost, content)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun rememberInnerGamerPalette(speed: Int): Palette = key(speed) {
|
||||
val start = remember { Themes.rgbHue }
|
||||
val animatedHue by rememberInfiniteTransition(label = "innerGamer").animateFloat(
|
||||
start, start + 360f,
|
||||
infiniteRepeatable(
|
||||
tween(Themes.rgbCycleMillis(speed).coerceAtLeast(1), easing = LinearEasing),
|
||||
RepeatMode.Restart,
|
||||
),
|
||||
label = "hue",
|
||||
)
|
||||
val steppedHue by remember {
|
||||
derivedStateOf {
|
||||
((animatedHue % 360f) / Themes.RGB_HUE_STEP).toInt() * Themes.RGB_HUE_STEP
|
||||
}
|
||||
}
|
||||
SideEffect { Themes.moveRgbHue(steppedHue) }
|
||||
Themes.innerGamer(steppedHue)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun DroidDeckThemePalette(solid: Palette, appScale: Int, frost: FrostChoice?, content: @Composable () -> Unit) {
|
||||
if (id == Themes.INNER_GAMER) InnerGamerHue(Themes.rgbSpeed)
|
||||
val solid = Themes.byId(id)
|
||||
val look = frost?.let { frostLook(solid, it) }
|
||||
val p = if (look == null) solid else solid.frosted(look)
|
||||
val baseDensity = LocalDensity.current
|
||||
@@ -315,3 +286,17 @@ private val ContentDirected = Typography().run {
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun InnerGamerHue(speed: Int) {
|
||||
key(speed) { InnerGamerCycle(speed) }
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun InnerGamerCycle(speed: Int) {
|
||||
val start = remember { Themes.rgbHue }
|
||||
val hue by rememberInfiniteTransition(label = "innerGamer").animateFloat(
|
||||
start, start + 360f, infiniteRepeatable(tween(Themes.rgbCycleMillis(speed).coerceAtLeast(1), easing = LinearEasing), RepeatMode.Restart), label = "hue",
|
||||
)
|
||||
val stepped = ((hue % 360f) / Themes.RGB_HUE_STEP).toInt() * Themes.RGB_HUE_STEP
|
||||
SideEffect { Themes.moveRgbHue(stepped) }
|
||||
}
|
||||
@@ -1336,7 +1336,6 @@
|
||||
<string name="ctrl_size">حجم الأزرار</string>
|
||||
<string name="ctrl_adaptive">عصي تكيّفية</string>
|
||||
<string name="ctrl_rumble">اهتزاز اللعبة</string>
|
||||
<string name="ctrl_direct_controller">وحدة تحكم مباشرة</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">فتح</string>
|
||||
<string name="air_triggers_use">استخدام Air Triggers</string>
|
||||
@@ -4357,6 +4356,4 @@
|
||||
<string name="glasses_show_shortcut_hint">إظهار زر النظارات الذكية العائم فوق اللعبة.</string>
|
||||
<string name="display_filter_game_profile">استخدام ملف تعريف %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">استخدام الملف التعريفي الافتراضي: %1$s</string>
|
||||
<string name="settings_search_history">سجل البحث</string>
|
||||
<string name="settings_search_history_clear">مسح سجل البحث</string>
|
||||
</resources>
|
||||
@@ -1342,7 +1342,6 @@
|
||||
<string name="ctrl_size">Tamaño de botones</string>
|
||||
<string name="ctrl_adaptive">Sticks adaptables</string>
|
||||
<string name="ctrl_rumble">Vibración en juegos</string>
|
||||
<string name="ctrl_direct_controller">Control directo</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Abrir</string>
|
||||
<string name="air_triggers_use">Usar los Air Triggers</string>
|
||||
@@ -4235,6 +4234,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Mostrar el botón flotante de Smart Glasses sobre el juego.</string>
|
||||
<string name="display_filter_game_profile">Usando el perfil %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">Usando el perfil predeterminado: %1$s</string>
|
||||
<string name="settings_search_history">Historial de búsqueda</string>
|
||||
<string name="settings_search_history_clear">Borrar historial de búsqueda</string>
|
||||
</resources>
|
||||
@@ -1308,7 +1308,6 @@
|
||||
<string name="ctrl_size">Размер на бутоните</string>
|
||||
<string name="ctrl_adaptive">Адаптивни стикове</string>
|
||||
<string name="ctrl_rumble">Вибрация от играта</string>
|
||||
<string name="ctrl_direct_controller">Директен контролер</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Отвори</string>
|
||||
<string name="air_triggers_use">Използвай Air Triggers</string>
|
||||
@@ -4197,6 +4196,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Показва плаващия бутон за Smart Glasses върху играта.</string>
|
||||
<string name="display_filter_game_profile">Използва се профил %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">Използва се профилът по подразбиране: %1$s</string>
|
||||
<string name="settings_search_history">История на търсенето</string>
|
||||
<string name="settings_search_history_clear">Изчистване на историята на търсенето</string>
|
||||
</resources>
|
||||
@@ -1322,7 +1322,6 @@
|
||||
<string name="ctrl_size">Velikost tlačítek</string>
|
||||
<string name="ctrl_adaptive">Adaptivní páčky</string>
|
||||
<string name="ctrl_rumble">Vibrace ve hře</string>
|
||||
<string name="ctrl_direct_controller">Přímý ovladač</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Otevřít</string>
|
||||
<string name="air_triggers_use">Používat Air Triggers</string>
|
||||
@@ -4277,6 +4276,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Zobrazit plovoucí tlačítko Smart Glasses nad hrou.</string>
|
||||
<string name="display_filter_game_profile">Používá se profil %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">Používá se výchozí profil: %1$s</string>
|
||||
<string name="settings_search_history">Historie hledání</string>
|
||||
<string name="settings_search_history_clear">Vymazat historii hledání</string>
|
||||
</resources>
|
||||
@@ -1308,7 +1308,6 @@
|
||||
<string name="ctrl_size">Knapstørrelse</string>
|
||||
<string name="ctrl_adaptive">Adaptive styrepinde</string>
|
||||
<string name="ctrl_rumble">Spilvibration</string>
|
||||
<string name="ctrl_direct_controller">Direkte controller</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Åbn</string>
|
||||
<string name="air_triggers_use">Brug Air Triggers</string>
|
||||
@@ -4197,6 +4196,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Vis den flydende Smart Glasses-knap oven på spillet.</string>
|
||||
<string name="display_filter_game_profile">Bruger profilen %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">Bruger standardprofilen: %1$s</string>
|
||||
<string name="settings_search_history">Søgehistorik</string>
|
||||
<string name="settings_search_history_clear">Ryd søgehistorik</string>
|
||||
</resources>
|
||||
@@ -1300,7 +1300,6 @@
|
||||
<string name="ctrl_size">Tastengröße</string>
|
||||
<string name="ctrl_adaptive">Adaptive Sticks</string>
|
||||
<string name="ctrl_rumble">Spielvibration</string>
|
||||
<string name="ctrl_direct_controller">Direkter Controller</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Öffnen</string>
|
||||
<string name="air_triggers_use">Air Triggers verwenden</string>
|
||||
@@ -4197,6 +4196,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Die schwebende Smart-Glasses-Schaltfläche über dem Spiel anzeigen.</string>
|
||||
<string name="display_filter_game_profile">Profil %1$s wird verwendet: %2$s</string>
|
||||
<string name="display_filter_default_profile">Standardprofil wird verwendet: %1$s</string>
|
||||
<string name="settings_search_history">Suchverlauf</string>
|
||||
<string name="settings_search_history_clear">Suchverlauf löschen</string>
|
||||
</resources>
|
||||
@@ -1308,7 +1308,6 @@
|
||||
<string name="ctrl_size">Μέγεθος κουμπιών</string>
|
||||
<string name="ctrl_adaptive">Προσαρμοστικοί μοχλοί</string>
|
||||
<string name="ctrl_rumble">Κραδασμός παιχνιδιού</string>
|
||||
<string name="ctrl_direct_controller">Άμεσο χειριστήριο</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Άνοιγμα</string>
|
||||
<string name="air_triggers_use">Χρήση Air Triggers</string>
|
||||
@@ -4197,6 +4196,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Εμφάνιση του αιωρούμενου κουμπιού Smart Glasses πάνω από το παιχνίδι.</string>
|
||||
<string name="display_filter_game_profile">Χρήση προφίλ %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">Χρήση προεπιλεγμένου προφίλ: %1$s</string>
|
||||
<string name="settings_search_history">Ιστορικό αναζήτησης</string>
|
||||
<string name="settings_search_history_clear">Εκκαθάριση ιστορικού αναζήτησης</string>
|
||||
</resources>
|
||||
@@ -1315,7 +1315,6 @@
|
||||
<string name="ctrl_size">Tamaño de botones</string>
|
||||
<string name="ctrl_adaptive">Sticks adaptables</string>
|
||||
<string name="ctrl_rumble">Vibración en juegos</string>
|
||||
<string name="ctrl_direct_controller">Mando directo</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Abrir</string>
|
||||
<string name="air_triggers_use">Usar los Air Triggers</string>
|
||||
@@ -4237,6 +4236,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Mostrar el botón flotante de Smart Glasses sobre el juego.</string>
|
||||
<string name="display_filter_game_profile">Usando el perfil %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">Usando el perfil predeterminado: %1$s</string>
|
||||
<string name="settings_search_history">Historial de búsqueda</string>
|
||||
<string name="settings_search_history_clear">Borrar historial de búsqueda</string>
|
||||
</resources>
|
||||
@@ -1308,7 +1308,6 @@
|
||||
<string name="ctrl_size">Painikkeiden koko</string>
|
||||
<string name="ctrl_adaptive">Mukautuvat sauvat</string>
|
||||
<string name="ctrl_rumble">Pelin tärinä</string>
|
||||
<string name="ctrl_direct_controller">Suora ohjain</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Avaa</string>
|
||||
<string name="air_triggers_use">Käytä Air Triggereitä</string>
|
||||
@@ -4197,6 +4196,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Näytä pelin päällä kelluva Smart Glasses -painike.</string>
|
||||
<string name="display_filter_game_profile">Käytössä profiili %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">Käytössä oletusprofiili: %1$s</string>
|
||||
<string name="settings_search_history">Hakuhistoria</string>
|
||||
<string name="settings_search_history_clear">Tyhjennä hakuhistoria</string>
|
||||
</resources>
|
||||
@@ -1314,7 +1314,6 @@
|
||||
<string name="ctrl_size">Taille des boutons</string>
|
||||
<string name="ctrl_adaptive">Joystick adaptatif</string>
|
||||
<string name="ctrl_rumble">Vibration du jeu</string>
|
||||
<string name="ctrl_direct_controller">Manette directe</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Ouvrir</string>
|
||||
<string name="air_triggers_use">Utiliser les Air Triggers</string>
|
||||
@@ -4236,6 +4235,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Afficher le bouton flottant Smart Glasses par-dessus le jeu.</string>
|
||||
<string name="display_filter_game_profile">Profil %1$s utilisé : %2$s</string>
|
||||
<string name="display_filter_default_profile">Profil par défaut utilisé : %1$s</string>
|
||||
<string name="settings_search_history">Historique de recherche</string>
|
||||
<string name="settings_search_history_clear">Effacer l\'historique de recherche</string>
|
||||
</resources>
|
||||
@@ -1308,7 +1308,6 @@
|
||||
<string name="ctrl_size">बटन का आकार</string>
|
||||
<string name="ctrl_adaptive">एडैप्टिव स्टिक</string>
|
||||
<string name="ctrl_rumble">गेम वाइब्रेशन</string>
|
||||
<string name="ctrl_direct_controller">डायरेक्ट कंट्रोलर</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">खोलें</string>
|
||||
<string name="air_triggers_use">Air Triggers इस्तेमाल करें</string>
|
||||
@@ -4197,6 +4196,4 @@
|
||||
<string name="glasses_show_shortcut_hint">गेम के ऊपर तैरता हुआ Smart Glasses बटन दिखाएँ।</string>
|
||||
<string name="display_filter_game_profile">%1$s प्रोफ़ाइल का उपयोग: %2$s</string>
|
||||
<string name="display_filter_default_profile">डिफ़ॉल्ट प्रोफ़ाइल का उपयोग: %1$s</string>
|
||||
<string name="settings_search_history">खोज इतिहास</string>
|
||||
<string name="settings_search_history_clear">खोज इतिहास मिटाएं</string>
|
||||
</resources>
|
||||
@@ -1308,7 +1308,6 @@
|
||||
<string name="ctrl_size">Gombméret</string>
|
||||
<string name="ctrl_adaptive">Adaptív karok</string>
|
||||
<string name="ctrl_rumble">Játékvibráció</string>
|
||||
<string name="ctrl_direct_controller">Közvetlen kontroller</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Megnyitás</string>
|
||||
<string name="air_triggers_use">Air Triggers használata</string>
|
||||
@@ -4197,6 +4196,4 @@
|
||||
<string name="glasses_show_shortcut_hint">A játék fölött lebegő Smart Glasses gomb megjelenítése.</string>
|
||||
<string name="display_filter_game_profile">Használt profil: %1$s – %2$s</string>
|
||||
<string name="display_filter_default_profile">Alapértelmezett profil használata: %1$s</string>
|
||||
<string name="settings_search_history">Keresési előzmények</string>
|
||||
<string name="settings_search_history_clear">Keresési előzmények törlése</string>
|
||||
</resources>
|
||||
@@ -1302,7 +1302,6 @@
|
||||
<string name="ctrl_size">Ukuran tombol</string>
|
||||
<string name="ctrl_adaptive">Stik adaptif</string>
|
||||
<string name="ctrl_rumble">Getaran gim</string>
|
||||
<string name="ctrl_direct_controller">Pengontrol langsung</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Buka</string>
|
||||
<string name="air_triggers_use">Gunakan Air Triggers</string>
|
||||
@@ -4167,6 +4166,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Tampilkan tombol Smart Glasses mengambang di atas game.</string>
|
||||
<string name="display_filter_game_profile">Menggunakan profil %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">Menggunakan profil default: %1$s</string>
|
||||
<string name="settings_search_history">Riwayat pencarian</string>
|
||||
<string name="settings_search_history_clear">Hapus riwayat pencarian</string>
|
||||
</resources>
|
||||
@@ -1306,7 +1306,6 @@
|
||||
<string name="ctrl_size">Dimensione dei tasti</string>
|
||||
<string name="ctrl_adaptive">Levette adattive</string>
|
||||
<string name="ctrl_rumble">Vibrazione di gioco</string>
|
||||
<string name="ctrl_direct_controller">Controller diretto</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Apri</string>
|
||||
<string name="air_triggers_use">Usa gli Air Triggers</string>
|
||||
@@ -4236,6 +4235,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Mostra il pulsante mobile Smart Glasses sopra il gioco.</string>
|
||||
<string name="display_filter_game_profile">Profilo %1$s in uso: %2$s</string>
|
||||
<string name="display_filter_default_profile">Profilo predefinito in uso: %1$s</string>
|
||||
<string name="settings_search_history">Cronologia ricerche</string>
|
||||
<string name="settings_search_history_clear">Cancella cronologia ricerche</string>
|
||||
</resources>
|
||||
@@ -1302,7 +1302,6 @@
|
||||
<string name="ctrl_size">ボタンのサイズ</string>
|
||||
<string name="ctrl_adaptive">アダプティブスティック</string>
|
||||
<string name="ctrl_rumble">ゲームの振動</string>
|
||||
<string name="ctrl_direct_controller">ダイレクトコントローラー</string>
|
||||
<string name="air_triggers_title">Redmagic エアトリガー</string>
|
||||
<string name="air_triggers_open">開く</string>
|
||||
<string name="air_triggers_use">エアトリガーを使う</string>
|
||||
@@ -4167,6 +4166,4 @@
|
||||
<string name="glasses_show_shortcut_hint">ゲーム画面上に Smart Glasses のフローティングボタンを表示します。</string>
|
||||
<string name="display_filter_game_profile">%1$s プロファイルを使用中: %2$s</string>
|
||||
<string name="display_filter_default_profile">デフォルトプロファイルを使用中: %1$s</string>
|
||||
<string name="settings_search_history">検索履歴</string>
|
||||
<string name="settings_search_history_clear">検索履歴を消去</string>
|
||||
</resources>
|
||||
@@ -1302,7 +1302,6 @@
|
||||
<string name="ctrl_size">버튼 크기</string>
|
||||
<string name="ctrl_adaptive">적응형 스틱</string>
|
||||
<string name="ctrl_rumble">게임 진동</string>
|
||||
<string name="ctrl_direct_controller">다이렉트 컨트롤러</string>
|
||||
<string name="air_triggers_title">Redmagic 에어 트리거</string>
|
||||
<string name="air_triggers_open">열기</string>
|
||||
<string name="air_triggers_use">에어 트리거 사용</string>
|
||||
@@ -4167,6 +4166,4 @@
|
||||
<string name="glasses_show_shortcut_hint">게임 위에 떠 있는 Smart Glasses 버튼을 표시합니다.</string>
|
||||
<string name="display_filter_game_profile">%1$s 프로필 사용 중: %2$s</string>
|
||||
<string name="display_filter_default_profile">기본 프로필 사용 중: %1$s</string>
|
||||
<string name="settings_search_history">검색 기록</string>
|
||||
<string name="settings_search_history_clear">검색 기록 지우기</string>
|
||||
</resources>
|
||||
@@ -1302,7 +1302,6 @@
|
||||
<string name="ctrl_size">Saiz butang</string>
|
||||
<string name="ctrl_adaptive">Stik adaptif</string>
|
||||
<string name="ctrl_rumble">Getaran permainan</string>
|
||||
<string name="ctrl_direct_controller">Pengawal terus</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Buka</string>
|
||||
<string name="air_triggers_use">Guna Air Triggers</string>
|
||||
@@ -4167,6 +4166,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Tunjukkan butang Smart Glasses terapung di atas permainan.</string>
|
||||
<string name="display_filter_game_profile">Menggunakan profil %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">Menggunakan profil lalai: %1$s</string>
|
||||
<string name="settings_search_history">Sejarah carian</string>
|
||||
<string name="settings_search_history_clear">Kosongkan sejarah carian</string>
|
||||
</resources>
|
||||
@@ -1308,7 +1308,6 @@
|
||||
<string name="ctrl_size">Knappestørrelse</string>
|
||||
<string name="ctrl_adaptive">Adaptive stikker</string>
|
||||
<string name="ctrl_rumble">Spillvibrasjon</string>
|
||||
<string name="ctrl_direct_controller">Direkte kontroller</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Åpne</string>
|
||||
<string name="air_triggers_use">Bruk Air Triggers</string>
|
||||
@@ -4197,6 +4196,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Vis den flytende Smart Glasses-knappen over spillet.</string>
|
||||
<string name="display_filter_game_profile">Bruker profilen %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">Bruker standardprofilen: %1$s</string>
|
||||
<string name="settings_search_history">Søkelogg</string>
|
||||
<string name="settings_search_history_clear">Tøm søkeloggen</string>
|
||||
</resources>
|
||||
@@ -1308,7 +1308,6 @@
|
||||
<string name="ctrl_size">Knopgrootte</string>
|
||||
<string name="ctrl_adaptive">Adaptieve sticks</string>
|
||||
<string name="ctrl_rumble">Trillen in games</string>
|
||||
<string name="ctrl_direct_controller">Directe controller</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Openen</string>
|
||||
<string name="air_triggers_use">Air Triggers gebruiken</string>
|
||||
@@ -4197,6 +4196,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Toon de zwevende Smart Glasses-knop boven het spel.</string>
|
||||
<string name="display_filter_game_profile">Profiel %1$s in gebruik: %2$s</string>
|
||||
<string name="display_filter_default_profile">Standaardprofiel in gebruik: %1$s</string>
|
||||
<string name="settings_search_history">Zoekgeschiedenis</string>
|
||||
<string name="settings_search_history_clear">Zoekgeschiedenis wissen</string>
|
||||
</resources>
|
||||
@@ -1322,7 +1322,6 @@
|
||||
<string name="ctrl_size">Rozmiar przycisków</string>
|
||||
<string name="ctrl_adaptive">Adaptacyjne gałki</string>
|
||||
<string name="ctrl_rumble">Wibracje gry</string>
|
||||
<string name="ctrl_direct_controller">Bezpośredni kontroler</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Otwórz</string>
|
||||
<string name="air_triggers_use">Używaj Air Triggers</string>
|
||||
@@ -4277,6 +4276,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Pokaż pływający przycisk Smart Glasses nad grą.</string>
|
||||
<string name="display_filter_game_profile">Używany profil %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">Używany profil domyślny: %1$s</string>
|
||||
<string name="settings_search_history">Historia wyszukiwania</string>
|
||||
<string name="settings_search_history_clear">Wyczyść historię wyszukiwania</string>
|
||||
</resources>
|
||||
@@ -1306,7 +1306,6 @@
|
||||
<string name="ctrl_size">Tamanho dos botões</string>
|
||||
<string name="ctrl_adaptive">Analógicos adaptáveis</string>
|
||||
<string name="ctrl_rumble">Vibração do jogo</string>
|
||||
<string name="ctrl_direct_controller">Comando direto</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Abrir</string>
|
||||
<string name="air_triggers_use">Utilizar os Air Triggers</string>
|
||||
@@ -4236,6 +4235,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Mostrar o botão flutuante do Smart Glasses sobre o jogo.</string>
|
||||
<string name="display_filter_game_profile">Perfil %1$s em utilização: %2$s</string>
|
||||
<string name="display_filter_default_profile">Perfil predefinido em utilização: %1$s</string>
|
||||
<string name="settings_search_history">Histórico de pesquisa</string>
|
||||
<string name="settings_search_history_clear">Limpar histórico de pesquisa</string>
|
||||
</resources>
|
||||
@@ -1314,7 +1314,6 @@
|
||||
<string name="ctrl_size">Tamanho dos botões</string>
|
||||
<string name="ctrl_adaptive">Analógicos adaptáveis</string>
|
||||
<string name="ctrl_rumble">Vibração do jogo</string>
|
||||
<string name="ctrl_direct_controller">Controle direto</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Abrir</string>
|
||||
<string name="air_triggers_use">Usar os Air Triggers</string>
|
||||
@@ -4244,6 +4243,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Mostrar o botão flutuante do Smart Glasses sobre o jogo.</string>
|
||||
<string name="display_filter_game_profile">Perfil %1$s em uso: %2$s</string>
|
||||
<string name="display_filter_default_profile">Perfil predefinido em uso: %1$s</string>
|
||||
<string name="settings_search_history">Histórico de pesquisa</string>
|
||||
<string name="settings_search_history_clear">Limpar histórico de pesquisa</string>
|
||||
</resources>
|
||||
@@ -1315,7 +1315,6 @@
|
||||
<string name="ctrl_size">Dimensiunea butoanelor</string>
|
||||
<string name="ctrl_adaptive">Manșe adaptive</string>
|
||||
<string name="ctrl_rumble">Vibrații de joc</string>
|
||||
<string name="ctrl_direct_controller">Controller direct</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Deschide</string>
|
||||
<string name="air_triggers_use">Folosește Air Triggers</string>
|
||||
@@ -4237,6 +4236,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Afișează butonul plutitor Smart Glasses peste joc.</string>
|
||||
<string name="display_filter_game_profile">Se folosește profilul %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">Se folosește profilul implicit: %1$s</string>
|
||||
<string name="settings_search_history">Istoricul căutărilor</string>
|
||||
<string name="settings_search_history_clear">Șterge istoricul căutărilor</string>
|
||||
</resources>
|
||||
@@ -1322,7 +1322,6 @@
|
||||
<string name="ctrl_size">Размер кнопок</string>
|
||||
<string name="ctrl_adaptive">Адаптивные стики</string>
|
||||
<string name="ctrl_rumble">Вибрация в играх</string>
|
||||
<string name="ctrl_direct_controller">Прямой контроллер</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Открыть</string>
|
||||
<string name="air_triggers_use">Использовать Air Triggers</string>
|
||||
@@ -4278,6 +4277,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Показывать плавающую кнопку Smart Glasses поверх игры.</string>
|
||||
<string name="display_filter_game_profile">Используется профиль %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">Используется профиль по умолчанию: %1$s</string>
|
||||
<string name="settings_search_history">История поиска</string>
|
||||
<string name="settings_search_history_clear">Очистить историю поиска</string>
|
||||
</resources>
|
||||
@@ -1308,7 +1308,6 @@
|
||||
<string name="ctrl_size">Knappstorlek</string>
|
||||
<string name="ctrl_adaptive">Adaptiva spakar</string>
|
||||
<string name="ctrl_rumble">Spelvibration</string>
|
||||
<string name="ctrl_direct_controller">Direkt handkontroll</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Öppna</string>
|
||||
<string name="air_triggers_use">Använd Air Triggers</string>
|
||||
@@ -4197,6 +4196,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Visa den flytande Smart Glasses-knappen ovanpå spelet.</string>
|
||||
<string name="display_filter_game_profile">Använder profilen %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">Använder standardprofilen: %1$s</string>
|
||||
<string name="settings_search_history">Sökhistorik</string>
|
||||
<string name="settings_search_history_clear">Rensa sökhistorik</string>
|
||||
</resources>
|
||||
@@ -1302,7 +1302,6 @@
|
||||
<string name="ctrl_size">ขนาดปุ่ม</string>
|
||||
<string name="ctrl_adaptive">สติ๊กแบบปรับอัตโนมัติ</string>
|
||||
<string name="ctrl_rumble">การสั่นของเกม</string>
|
||||
<string name="ctrl_direct_controller">คอนโทรลเลอร์โดยตรง</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">เปิด</string>
|
||||
<string name="air_triggers_use">ใช้ Air Triggers</string>
|
||||
@@ -4167,6 +4166,4 @@
|
||||
<string name="glasses_show_shortcut_hint">แสดงปุ่ม Smart Glasses แบบลอยทับบนเกม</string>
|
||||
<string name="display_filter_game_profile">ใช้โปรไฟล์ %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">ใช้โปรไฟล์เริ่มต้น: %1$s</string>
|
||||
<string name="settings_search_history">ประวัติการค้นหา</string>
|
||||
<string name="settings_search_history_clear">ล้างประวัติการค้นหา</string>
|
||||
</resources>
|
||||
@@ -1300,7 +1300,6 @@
|
||||
<string name="ctrl_size">Düğme boyutu</string>
|
||||
<string name="ctrl_adaptive">Uyarlanabilir çubuklar</string>
|
||||
<string name="ctrl_rumble">Oyun titreşimi</string>
|
||||
<string name="ctrl_direct_controller">Doğrudan kumanda</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Aç</string>
|
||||
<string name="air_triggers_use">Air Triggers kullan</string>
|
||||
@@ -4197,6 +4196,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Oyun üzerinde yüzen Smart Glasses düğmesini göster.</string>
|
||||
<string name="display_filter_game_profile">%1$s profili kullanılıyor: %2$s</string>
|
||||
<string name="display_filter_default_profile">Varsayılan profil kullanılıyor: %1$s</string>
|
||||
<string name="settings_search_history">Arama geçmişi</string>
|
||||
<string name="settings_search_history_clear">Arama geçmişini temizle</string>
|
||||
</resources>
|
||||
@@ -1322,7 +1322,6 @@
|
||||
<string name="ctrl_size">Розмір кнопок</string>
|
||||
<string name="ctrl_adaptive">Адаптивні стики</string>
|
||||
<string name="ctrl_rumble">Вібрація гри</string>
|
||||
<string name="ctrl_direct_controller">Прямий контролер</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Відкрити</string>
|
||||
<string name="air_triggers_use">Використовувати Air Triggers</string>
|
||||
@@ -4277,6 +4276,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Показувати плаваючу кнопку Smart Glasses поверх гри.</string>
|
||||
<string name="display_filter_game_profile">Використовується профіль %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">Використовується профіль за замовчуванням: %1$s</string>
|
||||
<string name="settings_search_history">Історія пошуку</string>
|
||||
<string name="settings_search_history_clear">Очистити історію пошуку</string>
|
||||
</resources>
|
||||
@@ -1302,7 +1302,6 @@
|
||||
<string name="ctrl_size">Kích thước nút</string>
|
||||
<string name="ctrl_adaptive">Cần thích ứng</string>
|
||||
<string name="ctrl_rumble">Rung khi chơi game</string>
|
||||
<string name="ctrl_direct_controller">Tay cầm trực tiếp</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Mở</string>
|
||||
<string name="air_triggers_use">Dùng Air Triggers</string>
|
||||
@@ -4167,6 +4166,4 @@
|
||||
<string name="glasses_show_shortcut_hint">Hiển thị nút Smart Glasses nổi phía trên trò chơi.</string>
|
||||
<string name="display_filter_game_profile">Đang dùng hồ sơ %1$s: %2$s</string>
|
||||
<string name="display_filter_default_profile">Đang dùng hồ sơ mặc định: %1$s</string>
|
||||
<string name="settings_search_history">Lịch sử tìm kiếm</string>
|
||||
<string name="settings_search_history_clear">Xóa lịch sử tìm kiếm</string>
|
||||
</resources>
|
||||
@@ -1385,7 +1385,6 @@
|
||||
<string name="ctrl_size">按钮大小</string>
|
||||
<string name="ctrl_adaptive">自适应摇杆</string>
|
||||
<string name="ctrl_rumble">游戏震动</string>
|
||||
<string name="ctrl_direct_controller">直连手柄</string>
|
||||
<string name="air_triggers_title">红魔肩键</string>
|
||||
<string name="air_triggers_open">打开</string>
|
||||
<string name="air_triggers_use">使用肩键</string>
|
||||
@@ -4165,6 +4164,4 @@
|
||||
<string name="glasses_show_shortcut_hint">在游戏画面上显示悬浮的 Smart Glasses 按钮。</string>
|
||||
<string name="display_filter_game_profile">正在使用 %1$s 配置:%2$s</string>
|
||||
<string name="display_filter_default_profile">正在使用默认配置:%1$s</string>
|
||||
<string name="settings_search_history">搜索历史</string>
|
||||
<string name="settings_search_history_clear">清除搜索历史</string>
|
||||
</resources>
|
||||
@@ -1301,7 +1301,6 @@
|
||||
<string name="ctrl_size">按鍵大小</string>
|
||||
<string name="ctrl_adaptive">自動調整搖桿</string>
|
||||
<string name="ctrl_rumble">遊戲震動</string>
|
||||
<string name="ctrl_direct_controller">直連控制器</string>
|
||||
<string name="air_triggers_title">紅魔肩鍵</string>
|
||||
<string name="air_triggers_open">開啟</string>
|
||||
<string name="air_triggers_use">使用肩鍵</string>
|
||||
@@ -4165,6 +4164,4 @@
|
||||
<string name="glasses_show_shortcut_hint">在遊戲畫面上顯示浮動的 Smart Glasses 按鈕。</string>
|
||||
<string name="display_filter_game_profile">正在使用 %1$s 設定檔:%2$s</string>
|
||||
<string name="display_filter_default_profile">正在使用預設設定檔:%1$s</string>
|
||||
<string name="settings_search_history">搜尋記錄</string>
|
||||
<string name="settings_search_history_clear">清除搜尋記錄</string>
|
||||
</resources>
|
||||
@@ -1301,7 +1301,6 @@
|
||||
<string name="ctrl_size">按鍵大小</string>
|
||||
<string name="ctrl_adaptive">自適應搖桿</string>
|
||||
<string name="ctrl_rumble">遊戲震動</string>
|
||||
<string name="ctrl_direct_controller">直連控制器</string>
|
||||
<string name="air_triggers_title">紅魔肩鍵</string>
|
||||
<string name="air_triggers_open">開啟</string>
|
||||
<string name="air_triggers_use">使用肩鍵</string>
|
||||
@@ -4165,6 +4164,4 @@
|
||||
<string name="glasses_show_shortcut_hint">在遊戲畫面上顯示浮動的 Smart Glasses 按鈕。</string>
|
||||
<string name="display_filter_game_profile">正在使用 %1$s 設定檔:%2$s</string>
|
||||
<string name="display_filter_default_profile">正在使用預設設定檔:%1$s</string>
|
||||
<string name="settings_search_history">搜尋記錄</string>
|
||||
<string name="settings_search_history_clear">清除搜尋記錄</string>
|
||||
</resources>
|
||||
@@ -74,7 +74,6 @@
|
||||
<string name="input_keep_shared">Keep shared</string>
|
||||
<string name="input_independent_copy">Independent copy</string>
|
||||
<string name="input_floating_stick">Start stick at touch position</string>
|
||||
<string name="input_adaptive_capture">Adaptive touch area</string>
|
||||
<string name="input_hide_idle">Hide stick when not in use</string>
|
||||
<string name="input_tools">Tools</string>
|
||||
<string name="input_quick_auto">Auto (%1$s)</string>
|
||||
|
||||
@@ -737,8 +737,6 @@
|
||||
<string name="hud_size_minimal">Minimal</string>
|
||||
<string name="hud_size_mega">Mega</string>
|
||||
<string name="hud_size_strip">Strip</string>
|
||||
<string name="hud_size_side_strip">Side strip</string>
|
||||
<string name="hud_size_side_strip_hint">Drag the column to either side of the game. Tap the HUD to cycle sizes.</string>
|
||||
<string name="hud_locked">Lock in place</string>
|
||||
<string name="hud_locked_hint">Drag the HUD to move it. While it is locked, on-screen controls under it still work.</string>
|
||||
<string name="hud_hold">Long press</string>
|
||||
@@ -1505,7 +1503,6 @@
|
||||
<string name="ctrl_size">Button size</string>
|
||||
<string name="ctrl_adaptive">Adaptive sticks</string>
|
||||
<string name="ctrl_rumble">Game vibration</string>
|
||||
<string name="ctrl_direct_controller">Direct controller</string>
|
||||
<string name="air_triggers_title">Redmagic Air Triggers</string>
|
||||
<string name="air_triggers_open">Open</string>
|
||||
<string name="air_triggers_use">Use Air Triggers</string>
|
||||
@@ -1591,10 +1588,6 @@
|
||||
<string name="apps_add_to_folder">Add to folder</string>
|
||||
<string name="apps_new_folder">New folder</string>
|
||||
<string name="apps_remove_from_folder">Remove from folder</string>
|
||||
<string name="apps_add_to_steam">Add to Steam</string>
|
||||
<string name="apps_remove_from_steam">Remove from Steam</string>
|
||||
<string name="apps_steam_restart">Restart Steam in DroidDeck to apply this change.</string>
|
||||
<string name="apps_steam_pairing_required">Pair Wireless debugging in DroidDeck Settings → Diagnostics, then restart Steam.</string>
|
||||
<string name="apps_app_info">App info</string>
|
||||
<string name="apps_uninstall">Uninstall</string>
|
||||
<string name="apps_folder_rename">Rename</string>
|
||||
@@ -4464,8 +4457,6 @@
|
||||
<string name="settings_search">Search settings</string>
|
||||
<string name="settings_search_none">No setting matches \"%1$s\"</string>
|
||||
<string name="settings_search_clear">Clear search</string>
|
||||
<string name="settings_search_history">Search history</string>
|
||||
<string name="settings_search_history_clear">Clear search history</string>
|
||||
<string name="settings_place_settings">Settings</string>
|
||||
<string name="settings_place_drawer">In-game menu</string>
|
||||
<string name="settings_place_sheet">Steam or Desktop options (swipe up)</string>
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
<style name="AppTheme" parent="@android:style/Theme.Material.NoActionBar">
|
||||
<item name="android:colorBackground">#FF101418</item>
|
||||
<item name="android:navigationBarColor">@android:color/black</item>
|
||||
<item name="android:statusBarColor">@android:color/black</item>
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
</style>
|
||||
<style name="SessionTheme" parent="@android:style/Theme.Material.NoActionBar.Fullscreen">
|
||||
<item name="android:windowBackground">@android:color/black</item>
|
||||
|
||||
@@ -15,29 +15,4 @@ class DependencyDetectorTest {
|
||||
File(folder, "_CommonRedist/vcredist/2013/vcredist_x64.exe").writeText("x")
|
||||
assertEquals(listOf("vcredist2013"), DependencyDetector.detect(folder).map { it.componentName })
|
||||
}
|
||||
|
||||
@Test fun dotNetRuntimeInstallersMapToTheirOwnRuntime() {
|
||||
assertEquals(listOf("dotnetcoredesktop3"), DependencyDetector.componentsFor("%INSTALLDIR%\\DotNetCore\\windowsdesktop-runtime-3.1.8-win-x64.exe"))
|
||||
assertEquals(listOf("dotnetcoredesktop3"), DependencyDetector.componentsFor("_CommonRedist/DotNet/dotnet-runtime-3.1.32-win-x64.exe"))
|
||||
assertEquals(listOf("dotnet50"), DependencyDetector.componentsFor("_CommonRedist/windowsdesktop-runtime-5.0.17-win-x64.exe"))
|
||||
assertEquals(listOf("dotnetcoredesktop6"), DependencyDetector.componentsFor("_CommonRedist/windowsdesktop-runtime-6.0.16-win-x64.exe"))
|
||||
assertEquals(listOf("dotnetcoredesktop8"), DependencyDetector.componentsFor("_CommonRedist/windowsdesktop-runtime-8.0.4-win-x64.exe"))
|
||||
assertEquals(emptyList<String>(), DependencyDetector.componentsFor("_CommonRedist/windowsdesktop-runtime-9.0.0-win-x64.exe"))
|
||||
}
|
||||
|
||||
@Test fun dotNetFrameworkInstallersKeepTheirMapping() {
|
||||
assertEquals(listOf("dotnet48"), DependencyDetector.componentsFor("_CommonRedist/DotNet/4.8/ndp48-x86-x64-allos-enu.exe"))
|
||||
assertEquals(listOf("dotnet472"), DependencyDetector.componentsFor("_CommonRedist/DotNet/4.7.2/NDP472-KB4054530-x86-x64-AllOS-ENU.exe"))
|
||||
assertEquals(listOf("dotnet46"), DependencyDetector.componentsFor("_CommonRedist/DotNet/4.6.2/NDP462-KB3151800-x86-x64-AllOS-ENU.exe"))
|
||||
assertEquals(listOf("dotnet40"), DependencyDetector.componentsFor("_CommonRedist/DotNet/dotNetFx40_Full_x86_x64.exe"))
|
||||
assertEquals(listOf("dotnetcoredesktop6"), DependencyDetector.componentsFor("_CommonRedist/DotNet/6.0/setup_dotnet.exe"))
|
||||
assertEquals(listOf("dotnet48"), DependencyDetector.componentsFor("_CommonRedist/DotNet/setup_dotnet.exe"))
|
||||
}
|
||||
|
||||
@Test fun aBundledDesktopRuntimeFolderIsNotTakenForTheFramework() {
|
||||
val folder = tmp.newFolder("Game")
|
||||
File(folder, "DotNetCore").mkdirs()
|
||||
File(folder, "DotNetCore/windowsdesktop-runtime-3.1.8-win-x64.exe").writeText("x")
|
||||
assertEquals(listOf("dotnetcoredesktop3"), DependencyDetector.detect(folder).map { it.componentName })
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.droiddeck.launcher.frontend
|
||||
|
||||
import android.content.Intent
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class LauncherReopenTest {
|
||||
private val launcher = setOf(Intent.CATEGORY_LAUNCHER)
|
||||
|
||||
private fun reveals(
|
||||
action: String? = Intent.ACTION_MAIN,
|
||||
categories: Set<String>? = launcher,
|
||||
taskRoot: Boolean = false,
|
||||
restored: Boolean = false,
|
||||
pipActive: Boolean = false,
|
||||
ownTask: Boolean = true,
|
||||
) = LauncherReopen.revealsTask(action, categories, taskRoot, restored, pipActive) { ownTask }
|
||||
|
||||
@Test fun launcherIconStackedOnAShortcutTaskShowsThatTask() {
|
||||
assertTrue(reveals())
|
||||
}
|
||||
|
||||
@Test fun launcherIconStartingTheTaskOpensTheMenu() {
|
||||
assertFalse(reveals(taskRoot = true))
|
||||
}
|
||||
|
||||
@Test fun shortcutsLinksAndInternalOpensStillOpenTheMenu() {
|
||||
assertFalse(reveals(action = Intent.ACTION_VIEW, categories = null))
|
||||
assertFalse(reveals(action = GameLaunchIntent.ACTION, categories = null))
|
||||
assertFalse(reveals(categories = null))
|
||||
assertFalse(reveals(categories = setOf(Intent.CATEGORY_HOME, Intent.CATEGORY_DEFAULT)))
|
||||
}
|
||||
|
||||
@Test fun anotherAppsTaskRestoredMenuAndPictureInPictureKeepTheMenu() {
|
||||
assertFalse(reveals(ownTask = false))
|
||||
assertFalse(reveals(restored = true))
|
||||
assertFalse(reveals(pipActive = true))
|
||||
}
|
||||
|
||||
@Test fun taskOwnershipIsOnlyQueriedForAStackedLauncherOpen() {
|
||||
var asked = false
|
||||
LauncherReopen.revealsTask(Intent.ACTION_MAIN, launcher, true, false, false) { asked = true; true }
|
||||
assertFalse(asked)
|
||||
}
|
||||
}
|
||||
@@ -205,36 +205,6 @@ class WinCompSourcesTest {
|
||||
assertEquals("GOG", picks.getValue("vcredist2015_dll").kind)
|
||||
}
|
||||
|
||||
@Test fun nativeD3dxSelectsItsEffectCompilersForEveryAutomaticSource() {
|
||||
val catalog = listOf(ready("d3dx9"), ready("d3dcompiler_42"), ready("d3dcompiler_43")).associateBy { it.name }
|
||||
for (origin in WinCompSources.Origin.values()) {
|
||||
val finding = WinCompSources.Finding("d3dx9", "DirectX", origin, true)
|
||||
val picks = AutoComponents.autoPicks(listOf(finding), catalog)
|
||||
assertEquals(setOf("d3dx9", "d3dcompiler_42", "d3dcompiler_43"), picks.keys)
|
||||
assertEquals(origin.name, picks.getValue("d3dcompiler_43").kind)
|
||||
assertEquals(picks.getValue("d3dx9").args, picks.getValue("d3dcompiler_43").args)
|
||||
assertEquals(setOf("d3dx9"), AutoComponents.autoPicks(listOf(finding), catalog, mapOf("d3dx9" to false)).keys)
|
||||
assertTrue(AutoComponents.autoPicks(listOf(finding.copy(auto = false)), catalog).isEmpty())
|
||||
}
|
||||
assertEquals(setOf("d3dcompiler_42", "d3dcompiler_43"),
|
||||
AutoComponents.autoPicks(emptyList(), catalog, mapOf("d3dx9" to true)).keys)
|
||||
assertTrue(AutoComponents.autoPicks(emptyList(), catalog, mapOf("xact" to true)).isEmpty())
|
||||
}
|
||||
|
||||
@Test fun effectCompilerSelectionKeepsIndependentFindingsAndSkipsUnavailableComponents() {
|
||||
val catalog = listOf(ready("d3dx9"), ready("d3dcompiler_43"),
|
||||
WinComponents.Component("d3dcompiler_42", "", "", "broken", emptyList(), emptyList())).associateBy { it.name }
|
||||
val findings = listOf(
|
||||
WinCompSources.Finding("d3dx9", "DirectX", WinCompSources.Origin.GOG, true),
|
||||
WinCompSources.Finding("d3dcompiler_43", "Compiler", WinCompSources.Origin.STEAM, true),
|
||||
)
|
||||
val picks = AutoComponents.autoPicks(findings, catalog)
|
||||
assertEquals(setOf("d3dx9", "d3dcompiler_43"), picks.keys)
|
||||
assertEquals("STEAM", picks.getValue("d3dcompiler_43").kind)
|
||||
assertEquals(picks.keys, AutoComponents.autoPicks(findings, catalog, mapOf("d3dx9" to false)).keys)
|
||||
assertEquals(setOf("d3dx9"), AutoComponents.autoPicks(findings.take(1), catalog - "d3dcompiler_43").keys)
|
||||
}
|
||||
|
||||
@Test fun theUsersSwitchWinsOverAnAutoPickEitherWay() {
|
||||
val key = "12345"
|
||||
WinComponents.setAuto(app, key, mapOf("d3dx9" to WinComponents.AutoReason("GOG", listOf("DirectX")), "xact" to WinComponents.AutoReason("GOG", listOf("XACT"))))
|
||||
@@ -309,42 +279,6 @@ class WinCompSourcesTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun installedD3dxGainsCompilersWithoutReplacingUserChoices() = withFakeWorker {
|
||||
AutoComponents.catalogOf = { _, _ -> catalog3 + ready("d3dcompiler_42") + ready("d3dcompiler_43") }
|
||||
installedNow.addAll(catalog3.map { it.name })
|
||||
val game = payback()
|
||||
WinComponents.setUser(app, "1262580", "d3dcompiler_42", false)
|
||||
AutoComponents.queueGame(app, game, asked = true)
|
||||
assertEquals(listOf("d3dcompiler_43"), downloaded)
|
||||
assertEquals(setOf("d3dx9", "vcredist2013_dll", "vcredist2019_dll", "d3dcompiler_43"), WinComponents.picks(app, "1262580").toSet())
|
||||
assertEquals(mapOf("d3dcompiler_42" to false), WinComponents.selection(app, "1262580").user)
|
||||
assertTrue(AutoComponents.Pending.ids(app, "1262580").isEmpty())
|
||||
AutoComponents.queueGame(app, game, asked = true)
|
||||
assertEquals(listOf("d3dcompiler_43"), downloaded)
|
||||
WinComponents.setUser(app, "1262580", "d3dx9", false)
|
||||
AutoComponents.queueGame(app, game, asked = true)
|
||||
assertEquals(setOf("vcredist2013_dll", "vcredist2019_dll"), WinComponents.picks(app, "1262580").toSet())
|
||||
}
|
||||
|
||||
@Test fun manuallySelectedD3dxQueuesCompilersBeforeLaunch() = withFakeWorker {
|
||||
AutoComponents.catalogOf = { _, _ -> catalog3 + ready("d3dcompiler_42") + ready("d3dcompiler_43") }
|
||||
installedNow.add("d3dx9")
|
||||
val game = game(tmp.newFolder("ManualEffects"), Library.ADDED)
|
||||
val key = AutoComponents.appKey(game)!!
|
||||
WinComponents.setUser(app, key, "d3dx9", true)
|
||||
WinComponents.setUser(app, key, "d3dcompiler_42", false)
|
||||
session = true
|
||||
gameUp = true
|
||||
assertTrue(AutoComponents.prepareLaunch(app, game))
|
||||
assertEquals(listOf("d3dcompiler_43"), AutoComponents.Pending.ids(app, key))
|
||||
assertTrue(downloaded.isEmpty())
|
||||
gameUp = false
|
||||
AutoComponents.drain(app)
|
||||
assertEquals(listOf("d3dcompiler_43"), downloaded)
|
||||
assertEquals(setOf("d3dx9", "d3dcompiler_43"), WinComponents.picks(app, key).toSet())
|
||||
assertTrue(AutoComponents.Pending.ids(app, key).isEmpty())
|
||||
}
|
||||
|
||||
@Test fun anExplicitCheckRefreshesTheCatalogAndAnOfflineCheckUsesTheCache() = withFakeWorker {
|
||||
installedNow.addAll(catalog3.map { it.name })
|
||||
val requests = ArrayList<Boolean>()
|
||||
|
||||
@@ -97,32 +97,6 @@ class WinComponentDetectorsTest {
|
||||
assertEquals(emptyList<Pair<String, String>>(), SteamRedists.installScript(File(steamapps, "missing")))
|
||||
}
|
||||
|
||||
@Test fun aDesktopRuntimeTheInstallScriptRunsIsInstalledInsteadOfTheFramework() {
|
||||
val steamapps = tmp.newFolder("steamapps")
|
||||
val game = File(steamapps, "common/Launcher Game").apply { mkdirs() }
|
||||
File(steamapps, "appmanifest_435150.acf").writeText("\"AppState\"\n{\n\t\"SharedDepots\"\n\t{\n\t\t\"228988\"\t\t\"228980\"\n\t\t\"228990\"\t\t\"228980\"\n\t}\n}\n")
|
||||
File(game, "installscript.vdf").writeText(
|
||||
"""
|
||||
"InstallScript"
|
||||
{
|
||||
"Run Process"
|
||||
{
|
||||
"DotNetCore"
|
||||
{
|
||||
"HasRunKey" "HKEY_LOCAL_MACHINE\\Software\\Valve\\Steam\\Apps\\435150"
|
||||
"process 1" "%INSTALLDIR%\\DotNetCore\\windowsdesktop-runtime-3.1.8-win-x64.exe"
|
||||
"command 1" "/install /quiet /norestart"
|
||||
}
|
||||
}
|
||||
}
|
||||
""".trimIndent(),
|
||||
)
|
||||
val context = androidx.test.core.app.ApplicationProvider.getApplicationContext<android.content.Context>()
|
||||
val found = WinCompSources.steamList(context, game, 435150, "Launcher Game", auto = true)
|
||||
assertEquals(listOf("vcredist2019_dll", "d3dx9", "dotnetcoredesktop3"), found.map { it.component })
|
||||
assertTrue(found.all { it.auto && it.origin == WinCompSources.Origin.STEAM })
|
||||
}
|
||||
|
||||
@Test fun thePrefixCountsOnlyWhatDroidDeckDidNotPutThere() {
|
||||
val compat = tmp.newFolder("compatdata", "409710")
|
||||
val pfx = File(compat, "pfx")
|
||||
|
||||
@@ -133,38 +133,6 @@ class DroidDeckHudPanelTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun sideStripOffersOnlyTheOnePercentLow() {
|
||||
val readings = DroidDeckHudSize.SIDE_STRIP.rows
|
||||
assertEquals(listOf("showLow1"), readings.filter { it.startsWith("showLow") })
|
||||
}
|
||||
|
||||
@Test fun sideStripFitsOneSideOfAWideScreenAndUsesItsOwnReadingOrder() {
|
||||
val app = RuntimeEnvironment.getApplication()
|
||||
val view = DroidDeckHudView(app)
|
||||
val config = DroidDeckHudConfig.DEFAULTS + mapOf(
|
||||
"hudSize" to "side_strip",
|
||||
"hudOrder" to "strip:showCPUUsage|showRAM;side_strip:showRAM|showFPS|showFPSGraph",
|
||||
"showClock" to "0",
|
||||
)
|
||||
view.applyConfig(DroidDeckHudConfig.encode(config))
|
||||
view.showForTest(SNAPSHOT, "DXVK", 0L)
|
||||
|
||||
val density = app.resources.displayMetrics.density
|
||||
val height = (360 * density).toInt()
|
||||
val width = height * 21 / 9
|
||||
val sideMargin = (width - height * 16 / 9) / 2
|
||||
view.measure(
|
||||
View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.AT_MOST),
|
||||
View.MeasureSpec.makeMeasureSpec(height, View.MeasureSpec.AT_MOST),
|
||||
)
|
||||
|
||||
assertTrue("HUD fits in one side margin", view.measuredWidth <= sideMargin)
|
||||
assertTrue("HUD is taller than it is wide", view.measuredHeight > view.measuredWidth)
|
||||
assertTrue("RAM is first", view.linesForTest().first().startsWith("RAM"))
|
||||
assertTrue("FPS is second", view.linesForTest()[1].startsWith("FPS"))
|
||||
assertTrue("The graph is inside the column", view.graphForTest()!!.right < view.measuredWidth)
|
||||
}
|
||||
|
||||
@Test fun everySizeDrawsTheDPanelWithEverythingInsideIt() {
|
||||
val stats = FrameStats()
|
||||
var now = 1_000_000_000L
|
||||
|
||||
@@ -467,7 +467,6 @@ class InputLibraryTest {
|
||||
val enabled = InputLibraries.read(context)
|
||||
val changed = enabled.layouts.single { it.id == overlay.id }
|
||||
assertEquals(true, changed.adaptiveSticks)
|
||||
assertTrue(changed.elements.filter { it.kind == InputElementKind.STICK }.all { !it.hideStickAtRest && it.adaptiveCapture == true })
|
||||
assertTrue(ControllerPrefs.read(context).adaptiveSticks)
|
||||
assertEquals(overlay.elements.filter { it.kind != InputElementKind.STICK }, changed.elements.filter { it.kind != InputElementKind.STICK })
|
||||
assertEquals(library.layouts.filter { it.id != overlay.id }, enabled.layouts.filter { it.id != overlay.id })
|
||||
|
||||
@@ -336,20 +336,6 @@ class OnScreenLayoutTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun dockedSticksStayVisibleWithoutExpandingTheirTouchArea() {
|
||||
val custom = InputSurfaceElement(InputControl.LS, .2f, .2f, .2f, .3f,
|
||||
id = "custom-stick", hideWhenIdle = true, adaptiveCapture = true)
|
||||
val layout = SavedInputLayout("custom", "Custom", listOf(custom), aspect = 1.5f)
|
||||
val overlay = OnScreenLayout.elements(context, layout, 1200, 800, Rect()).single()
|
||||
assertTrue(overlay.adaptiveStick)
|
||||
assertTrue(overlay.hideStickAtRest)
|
||||
val docked = OnScreenLayout.elements(context, layout, 1200, 800, Rect(),
|
||||
dock = OnScreenLayout.Dock(false, false)).single()
|
||||
assertFalse(docked.adaptiveStick)
|
||||
assertFalse(docked.hideStickAtRest)
|
||||
assertTrue(docked.floating)
|
||||
}
|
||||
|
||||
@Test fun dockedControlsStayInsideTheSafeAreaAtTheDefaultSizeWithoutAControllerKit() {
|
||||
SessionPrefs.setSteamController(context, SessionPrefs.CONTROLLER_NONE)
|
||||
ControllerPrefs.setSize(context, 100)
|
||||
|
||||
@@ -84,18 +84,6 @@ class PadBridgeRoutingTest {
|
||||
assertFalse(PadBridge.anyControllerConnected())
|
||||
}
|
||||
|
||||
@Test fun scrcpyGamepadDoesNotHideControlsOrLoopBackIntoSteam() {
|
||||
fun xbox(external: Boolean) = device(
|
||||
InputDevice.SOURCE_GAMEPAD or InputDevice.SOURCE_JOYSTICK, InputDevice.KEYBOARD_TYPE_NONE,
|
||||
name = "Microsoft X-Box 360 Pad", external = external, vendor = 0x045e, product = 0x028e,
|
||||
)
|
||||
val mirrored = xbox(external = false)
|
||||
assertFalse(PadBridge.anyControllerConnected())
|
||||
assertFalse(PadBridge.isControllerKeyEvent(key(mirrored, KeyEvent.KEYCODE_BUTTON_A, KeyEvent.ACTION_DOWN)))
|
||||
assertTrue(PadBridge.isFromController(xbox(external = true)))
|
||||
assertTrue(PadBridge.anyControllerConnected())
|
||||
}
|
||||
|
||||
@Test fun homeShortcutsIgnoreHomeFromSystemKeys() {
|
||||
val gpio = device(InputDevice.SOURCE_KEYBOARD, InputDevice.KEYBOARD_TYPE_NON_ALPHABETIC, name = "gpio-keys")
|
||||
val pad = device(InputDevice.SOURCE_GAMEPAD or InputDevice.SOURCE_KEYBOARD, InputDevice.KEYBOARD_TYPE_NON_ALPHABETIC)
|
||||
@@ -183,11 +171,9 @@ class PadBridgeRoutingTest {
|
||||
private var nextId = 10
|
||||
|
||||
private fun device(sources: Int, type: Int, keys: IntArray = intArrayOf(KeyEvent.KEYCODE_A, KeyEvent.KEYCODE_DPAD_UP),
|
||||
rangeSource: Int? = null, axis: Int = MotionEvent.AXIS_X, id: Int = nextId++, name: String = "routing fixture $id",
|
||||
external: Boolean = true, vendor: Int = 0, product: Int = 0): InputDevice {
|
||||
rangeSource: Int? = null, axis: Int = MotionEvent.AXIS_X, id: Int = nextId++, name: String = "routing fixture $id"): InputDevice {
|
||||
val builder = InputDeviceBuilder.newBuilder().setId(id).setName(name)
|
||||
.setDescriptor("routing-$id").setExternal(external).setVendorId(vendor).setProductId(product)
|
||||
.setSources(sources).setKeyboardType(type)
|
||||
.setDescriptor("routing-$id").setExternal(true).setSources(sources).setKeyboardType(type)
|
||||
.setKeyCharacterMap(KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD))
|
||||
if (rangeSource != null) builder.addMotionRange(axis, rangeSource, -1f, 1f, 0f, 0f, 0f)
|
||||
val device = builder.build()
|
||||
|
||||
@@ -5,8 +5,6 @@ import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
|
||||
class PageCacheTrimTest {
|
||||
private val meminfo = "MemFree: 1048576 kB\nActive(file): 2097152 kB\nInactive(file): 1048576 kB\n"
|
||||
@@ -17,31 +15,4 @@ class PageCacheTrimTest {
|
||||
@Test fun skipsSmallBuildUp() = assertFalse(PageCacheTrim.shouldTrim(PageCacheTrim.Mem(2000 * 1024, 1200 * 1024), 1000 * 1024))
|
||||
@Test fun skipsWhenPlentyFree() = assertFalse(PageCacheTrim.shouldTrim(PageCacheTrim.Mem(6000 * 1024, 5000 * 1024), 1000 * 1024))
|
||||
@Test fun lowFreeAcceptsSmallerBuildUp() = assertTrue(PageCacheTrim.shouldTrim(PageCacheTrim.Mem(500 * 1024, 1200 * 1024), 1000 * 1024))
|
||||
|
||||
@Test fun bigFilesSkipLinksButEnterALinkedRoot() {
|
||||
fun big(dir: Path, name: String): Path = Files.createFile(dir.resolve(name)).also {
|
||||
java.io.RandomAccessFile(it.toFile(), "rw").use { it.setLength(PageCacheTrim.MIN_FILE_BYTES + 1) }
|
||||
}
|
||||
val base = Files.createTempDirectory("dd-trim")
|
||||
try {
|
||||
val root = Files.createDirectories(base.resolve("root"))
|
||||
val outside = Files.createDirectories(base.resolve("outside"))
|
||||
val big = big(root, "big.bin")
|
||||
big(Files.createDirectories(root.resolve("sub")), "nested.bin")
|
||||
Files.createFile(root.resolve("small.bin"))
|
||||
big(outside, "outside.bin")
|
||||
Files.createSymbolicLink(root.resolve("linked-dir"), outside)
|
||||
Files.createSymbolicLink(root.resolve("linked-file"), big)
|
||||
val rootLink = Files.createSymbolicLink(base.resolve("root-link"), root)
|
||||
|
||||
val expected = listOf("big.bin", "nested.bin")
|
||||
assertEquals(expected, PageCacheTrim.bigFiles(root.toFile()).map { it.name }.sorted())
|
||||
assertEquals(expected, PageCacheTrim.bigFiles(rootLink.toFile()).map { it.name }.sorted())
|
||||
|
||||
val dangling = Files.createSymbolicLink(base.resolve("dangling"), base.resolve("gone"))
|
||||
assertTrue(PageCacheTrim.bigFiles(dangling.toFile()).isEmpty())
|
||||
} finally {
|
||||
base.toFile().deleteRecursively()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import android.graphics.Color
|
||||
import android.view.ContextThemeWrapper
|
||||
import com.droiddeck.launcher.R
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
@@ -23,17 +22,4 @@ class AppThemeTest {
|
||||
assertEquals(0xFF, Color.alpha(color))
|
||||
assertTrue(Color.luminance(color) < 0.1f)
|
||||
}
|
||||
|
||||
@Test fun theStatusBarIsOpaqueAndDarkSoNothingLightShowsThroughIt() {
|
||||
val themed = ContextThemeWrapper(RuntimeEnvironment.getApplication(), R.style.AppTheme)
|
||||
val attrs = themed.obtainStyledAttributes(
|
||||
intArrayOf(android.R.attr.statusBarColor, android.R.attr.windowLightStatusBar),
|
||||
)
|
||||
val color = attrs.getColor(0, Color.TRANSPARENT)
|
||||
val lightIcons = attrs.getBoolean(1, true)
|
||||
attrs.recycle()
|
||||
assertEquals(0xFF, Color.alpha(color))
|
||||
assertTrue(Color.luminance(color) < 0.1f)
|
||||
assertFalse(lightIcons)
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.view.HapticFeedbackConstants
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
@@ -21,7 +18,6 @@ import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
import org.robolectric.Shadows.shadowOf
|
||||
import org.robolectric.annotation.Config
|
||||
import org.robolectric.annotation.GraphicsMode
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [34], manifest = Config.NONE, shadows = [JoyConPadTest.RecordingWriter::class])
|
||||
@@ -359,28 +355,6 @@ class InputSurfaceTouchTest {
|
||||
touch(MotionEvent.ACTION_UP, 1 to (490f to 170f))
|
||||
}
|
||||
|
||||
@Test @GraphicsMode(GraphicsMode.Mode.NATIVE)
|
||||
fun adaptiveSticksDrawAtRestUnlessExplicitlyHidden() {
|
||||
val legacy = InputSurfaceElement(InputControl.LS, .3f, .3f, .2f, .4f, hideWhenIdle = true)
|
||||
fun idlePixel(e: InputSurfaceElement): Int {
|
||||
show(e)
|
||||
val target = element(view, e.id)
|
||||
val bitmap = Bitmap.createBitmap(target.width, target.height, Bitmap.Config.ARGB_8888)
|
||||
return try {
|
||||
target.draw(Canvas(bitmap))
|
||||
bitmap.getPixel(target.width / 2, target.height / 2)
|
||||
} finally {
|
||||
bitmap.recycle()
|
||||
}
|
||||
}
|
||||
assertTrue(Color.alpha(idlePixel(legacy)) > 0)
|
||||
val visible = legacy.copy(adaptiveCapture = true, hideWhenIdle = false)
|
||||
assertTrue(Color.alpha(idlePixel(visible)) > 0)
|
||||
assertTrue(view.takesTouchAt(10f, 300f))
|
||||
assertEquals(0, Color.alpha(idlePixel(visible.copy(hideWhenIdle = true))))
|
||||
assertTrue(view.takesTouchAt(10f, 300f))
|
||||
}
|
||||
|
||||
@Test fun adaptiveSticksCaptureAroundThemAndTheLeftOneToTheEdge() {
|
||||
val left = InputSurfaceElement(InputControl.LS, .3f, .3f, .2f, .4f, hideWhenIdle = true)
|
||||
val right = InputSurfaceElement(InputControl.RS, .6f, .3f, .2f, .4f, hideWhenIdle = true)
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
class SettingsJumpTest {
|
||||
@Test fun rowInTheMiddleOfThePageIsCentered() = assertEquals(1050f, centeredScroll(1500f, 100f, 1000f, 4000f), 0f)
|
||||
|
||||
@Test fun rowsNearTheEndsStopAtTheEnds() {
|
||||
assertEquals(0f, centeredScroll(200f, 100f, 1000f, 4000f), 0f)
|
||||
assertEquals(3000f, centeredScroll(3800f, 100f, 1000f, 4000f), 0f)
|
||||
}
|
||||
|
||||
@Test fun pageThatFitsDoesNotScroll() = assertEquals(0f, centeredScroll(700f, 100f, 1000f, 800f), 0f)
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import android.content.Context
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [28], manifest = Config.NONE)
|
||||
class SettingsSearchHistoryTest {
|
||||
private val context: Context get() = RuntimeEnvironment.getApplication()
|
||||
|
||||
@Before fun reset() = SettingsSearchHistory.clear(context)
|
||||
|
||||
@Test fun newestComesFirstAndARepeatMovesUp() {
|
||||
listOf("font", "cpu", "Font ").forEach { SettingsSearchHistory.add(context, it) }
|
||||
assertEquals(listOf("Font", "cpu"), SettingsSearchHistory.items)
|
||||
}
|
||||
|
||||
@Test fun blankSearchesAreNotKept() {
|
||||
SettingsSearchHistory.add(context, " ")
|
||||
assertEquals(emptyList<String>(), SettingsSearchHistory.items)
|
||||
}
|
||||
|
||||
@Test fun onlyTheLatestAreKept() {
|
||||
(1..SettingsSearchHistory.MAX + 2).forEach { SettingsSearchHistory.add(context, "search $it") }
|
||||
assertEquals(SettingsSearchHistory.MAX, SettingsSearchHistory.items.size)
|
||||
assertEquals("search ${SettingsSearchHistory.MAX + 2}", SettingsSearchHistory.items.first())
|
||||
}
|
||||
|
||||
@Test fun savedSearchesLoadInOrderUntilCleared() {
|
||||
listOf("one", "two, \"three\"").forEach { SettingsSearchHistory.add(context, it) }
|
||||
SettingsSearchHistory.load(context)
|
||||
assertEquals(listOf("two, \"three\"", "one"), SettingsSearchHistory.items)
|
||||
SettingsSearchHistory.clear(context)
|
||||
SettingsSearchHistory.load(context)
|
||||
assertEquals(emptyList<String>(), SettingsSearchHistory.items)
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
# Android apps in Steam
|
||||
|
||||
On Android 15 or newer, open DroidDeck’s **Apps** tab. If it’s hidden, show it using **Arrange tabs**. Then open an app’s menu and select **Add to Steam**. Pair Wireless debugging in DroidDeck's **Settings → Diagnostics** and keep Wireless debugging enabled. Restart Steam from DroidDeck. The app appears as a non-Steam shortcut in your library. To remove it, select **Remove from Steam** in the same app menu and restart Steam.
|
||||
|
||||
The app runs on a separate Android display. Steam shows that display and forwards touch gestures and gamepad input. Android’s system Back stays with the handheld display, so it can open DroidDeck’s menu. Apps with controller support see an Xbox 360 pad. The app plays sound through Android, so use the handheld's media volume.
|
||||
|
||||
- Exiting the Android app returns you to Steam. You can also use **Exit Game** in Steam to close the shortcut.
|
||||
- To go back inside the Android app with a keyboard, press **Alt+B**. DroidDeck's Back and the session menu are separate controls.
|
||||
- You can run one Android shortcut at a time. Work profile apps and apps that block screen capture or refuse secondary displays may be unavailable.
|
||||
- If the shortcut reports a disconnected device after Wireless debugging has restarted, restart Steam in DroidDeck to refresh the connection. If it asks for an updated Linux runtime, install the runtime update before trying again.
|
||||
@@ -204,7 +204,7 @@ FEX preset or value chosen for the game itself still applies.
|
||||
An Inno Setup installer added as a game runs with the Stability preset's FEX
|
||||
settings (full TSO, full x87 precision, no multiblock). Under the default
|
||||
Performance + TSO preset the 32-bit setup stub corrupts its own paths and stops
|
||||
with Wine's "Path not found." dialog (#1277, #3067). The stub is found by the
|
||||
with Wine's "Path not fpund." dialog (#1277, #3067). The stub is found by the
|
||||
setup loader's offset-table ID in its resources, or by the `Inno` marker that
|
||||
loaders older than 5.1.5 keep at offset 0x30. GOG installs avoid the stub by
|
||||
extracting natively. A FEX preset chosen for the installer's own entry still
|
||||
|
||||
@@ -240,11 +240,6 @@ cp "$WORK/FEX/system32/"*.dll "$T/files/runtime/fex/aarch64-windows/"
|
||||
install -m 755 "$HERE/tool/proton" "$T/proton"
|
||||
install -m 755 "$HERE/tool/launch.sh" "$T/bionic/launch.sh"
|
||||
cp "$HERE/tool/desktop.reg" "$HERE/tool/Xdefaults" "$T/bionic/"
|
||||
# dd-directcontroller: the XInput DLLs launch.sh puts in the prefix of a game set to start without Steam, and the
|
||||
# host test of their ring reader
|
||||
"$HERE/dd-directcontroller/build.sh" host "$WORK/dd-directcontroller-host"
|
||||
"$WORK/dd-directcontroller-host/host_test"
|
||||
"$HERE/dd-directcontroller/build.sh" dlls "$T/bionic/dd-directcontroller"
|
||||
cp "$HERE/tool/toolmanifest.vdf" "$T/"
|
||||
# The name Steam registers the tool under ends in -Proton: Steam maps Windows save folders (WinAppDataLocal, WinMyDocuments
|
||||
# ...) into compatdata/<app>/pfx only for tools whose name contains "proton" (a case-insensitive search in
|
||||
|
||||
@@ -1,272 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# dd-directcontroller: build the XInput DLLs DroidDeck-Bionic puts in a prefix for games set to start without Steam
|
||||
# (launch.sh). Used by tools/bionic-runtime/build.sh.
|
||||
#
|
||||
# build.sh toolchain fetch the pinned llvm-mingw into $LLVM_MINGW (default ~/.cache/...)
|
||||
# build.sh dlls <outdir> <outdir>/{arm64x,i386}/<dll>.dll for every XInput DLL name, each export table
|
||||
# (both views of an ARM64X image), import list and machine type checked
|
||||
# build.sh host <outdir> <outdir>/host_test (native, cc): the ring snapshot reader against a writer
|
||||
#
|
||||
# The PE side uses bylaws/llvm-mingw (its arm64ec target does not predefine __x86_64__, unlike upstream's).
|
||||
# One C source (src/dd_directcontroller.c) is linked once per DLL name with that name's .def file (def/), so each
|
||||
# DLL has exactly the exports and ordinals of the Windows DLL it stands in for. i386 .def files get stdcall
|
||||
# decorations here and the link strips them (--kill-at).
|
||||
#
|
||||
# arm64x (system32 of the arm64ec layer): the source is compiled for ARM64EC and for native ARM64 and both
|
||||
# objects are linked into one ARM64X image (lld: -m arm64xpe, the .def for the EC view, -defarm64native for
|
||||
# the native view; each view gets its own CRT, the native one taken from the toolchain's own aarch64 link
|
||||
# line). An x64 game loads the EC view, a native ARM64 process (Wine's own control.exe, ...) the ARM64 view;
|
||||
# an ARM64EC-only image fails there with c000007b. i386 goes to syswow64 for 32-bit games.
|
||||
#
|
||||
# Every DLL carries a VERSIONINFO resource with the file version of the Wine builtin DLL it replaces, so a
|
||||
# program reading it sees the same number as before.
|
||||
set -euo pipefail
|
||||
|
||||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||
LLVM_MINGW_VER=20250920
|
||||
case "$(uname -m)" in
|
||||
aarch64|arm64)
|
||||
LLVM_MINGW_HOST=aarch64; HOST_SUFFIX=-aarch64
|
||||
LLVM_MINGW_SHA256=bce5cc755c613515fd44e1ee9523123d854103abae147571adb645450036274d ;;
|
||||
*)
|
||||
LLVM_MINGW_HOST=x86_64; HOST_SUFFIX=
|
||||
LLVM_MINGW_SHA256=8dd8c34fc051a50c2fae86015f35057f8aae93fe1e19b34537ef1269a8b4c772 ;;
|
||||
esac
|
||||
LLVM_MINGW_TAR="llvm-mingw-${LLVM_MINGW_VER}-ucrt-ubuntu-22.04-${LLVM_MINGW_HOST}.tar.xz"
|
||||
LLVM_MINGW_URL="https://github.com/bylaws/llvm-mingw/releases/download/${LLVM_MINGW_VER}/${LLVM_MINGW_TAR}"
|
||||
LLVM_MINGW="${LLVM_MINGW:-$HOME/.cache/llvm-mingw-bylaws-${LLVM_MINGW_VER}${HOST_SUFFIX}}"
|
||||
|
||||
DLLS="xinput1_1 xinput1_2 xinput1_3 xinput1_4 xinput9_1_0 xinputuap"
|
||||
ARCHES="arm64x i386"
|
||||
MARKER="dd-directcontroller: "
|
||||
|
||||
say() { printf '== dd-directcontroller: %s\n' "$*"; }
|
||||
die() { printf '::error::dd-directcontroller: %s\n' "$*" >&2; exit 1; }
|
||||
|
||||
toolchain() {
|
||||
if [ ! -x "$LLVM_MINGW/bin/arm64ec-w64-mingw32-clang" ]; then
|
||||
say "fetching $LLVM_MINGW_TAR"
|
||||
local tmp; tmp="$(mktemp -d)"
|
||||
curl -fsSL --retry 5 --retry-delay 5 -o "$tmp/t.tar.xz" "$LLVM_MINGW_URL"
|
||||
echo "$LLVM_MINGW_SHA256 $tmp/t.tar.xz" | sha256sum -c -
|
||||
mkdir -p "$LLVM_MINGW"
|
||||
tar -xJf "$tmp/t.tar.xz" -C "$LLVM_MINGW" --strip-components=1
|
||||
rm -rf "$tmp"
|
||||
fi
|
||||
export PATH="$LLVM_MINGW/bin:$PATH"
|
||||
for t in i686 arm64ec aarch64; do
|
||||
command -v "$t-w64-mingw32-clang" >/dev/null || die "llvm-mingw has no $t-w64-mingw32-clang"
|
||||
done
|
||||
for t in i686 aarch64; do
|
||||
command -v "$t-w64-mingw32-windres" >/dev/null || die "llvm-mingw has no $t-w64-mingw32-windres"
|
||||
done
|
||||
say "llvm-mingw $LLVM_MINGW_VER: $(arm64ec-w64-mingw32-clang --version | head -1)"
|
||||
}
|
||||
|
||||
windres_for() {
|
||||
case "$1" in
|
||||
i386) echo i686-w64-mingw32-windres ;;
|
||||
arm64x) echo aarch64-w64-mingw32-windres ;;
|
||||
*) die "unknown arch $1" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# File version of the Wine builtin each DLL replaces (dlls/<name>/version.rc).
|
||||
DLL_VERSIONS='xinput1_1:9,12,589,0 xinput1_2:9,14,701,0 xinput1_3:9,15,779,0 xinput1_4:6,3,9600,16384 xinput9_1_0:9,10,455,0 xinputuap:10,0,19041,746'
|
||||
|
||||
version_res() { # version_res <arch> <dll> <tmpdir> -> path of a COFF object with the DLL's VERSIONINFO
|
||||
local ver="" kv rc="$3/$2.rc" obj="$3/$2-ver-$1.o"
|
||||
for kv in $DLL_VERSIONS; do [ "${kv%%:*}" = "$2" ] && ver="${kv#*:}"; done
|
||||
[ -n "$ver" ] || die "no version for $2 in DLL_VERSIONS"
|
||||
cat >"$rc" <<EOF
|
||||
1 VERSIONINFO
|
||||
FILEVERSION $ver
|
||||
PRODUCTVERSION $ver
|
||||
FILEFLAGSMASK 0x3f
|
||||
FILEFLAGS 0x0
|
||||
FILEOS 0x40004
|
||||
FILETYPE 0x2
|
||||
FILESUBTYPE 0x0
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "DroidDeck"
|
||||
VALUE "FileDescription", "dd-directcontroller controller API (DroidDeck)"
|
||||
VALUE "FileVersion", "${ver//,/.}"
|
||||
VALUE "InternalName", "$2"
|
||||
VALUE "LegalCopyright", "GPL-3.0"
|
||||
VALUE "OriginalFilename", "$2.dll"
|
||||
VALUE "ProductName", "DroidDeck"
|
||||
VALUE "ProductVersion", "${ver//,/.}"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
EOF
|
||||
"$(windres_for "$1")" "$rc" -O coff -o "$obj"
|
||||
echo "$obj"
|
||||
}
|
||||
|
||||
# stdcall argument bytes of every export (i386 decoration).
|
||||
I386_DECOR='DllMain:12 XInputGetState:8 XInputSetState:8 XInputGetStateEx:8 XInputGetCapabilities:12 XInputGetDSoundAudioDeviceGuids:12 XInputGetBatteryInformation:12 XInputGetKeystroke:12 XInputWaitForGuideButton:12 XInputEnable:4 XInputCancelGuideButtonWait:4 XInputPowerOffController:4 XInputGetAudioDeviceIds:20 XInputGetCapabilitiesEx:16'
|
||||
|
||||
def_for() { # def_for <arch> <dll> <tmpdir> -> path of the .def to link with
|
||||
local src="$HERE/def/$2.def"
|
||||
if [ "$1" != i386 ]; then echo "$src"; return; fi
|
||||
awk -v table="$I386_DECOR" 'BEGIN { n = split(table, a, " "); for (i = 1; i <= n; i++) { split(a[i], kv, ":"); m[kv[1]] = kv[2] } }
|
||||
($1 in m) { sub($1, $1 "@" m[$1]) } { print }' "$src" > "$3/$2.def"
|
||||
echo "$3/$2.def"
|
||||
}
|
||||
|
||||
# expected "<ordinal> <name|->" lines of a .def (NONAME exports have no name)
|
||||
def_exports() {
|
||||
awk 'f && NF { ord = ""; for (i = 2; i <= NF; i++) if ($i ~ /^@[0-9]+$/) ord = substr($i, 2);
|
||||
name = $1; for (i = 2; i <= NF; i++) if ($i == "NONAME") name = "-";
|
||||
print (ord == "" ? "?" : ord), name }
|
||||
/^EXPORTS/ { f = 1 }' "$1" | sort
|
||||
}
|
||||
|
||||
# actual "<ordinal> <name|->" lines of a DLL (unused ordinals between the numbered ones have RVA 0 and are
|
||||
# skipped). dll_exports <file> [main|hybrid]: llvm-readobj prints an ARM64X image's native view first, then
|
||||
# its EC view inside "HybridObject {".
|
||||
dll_exports() {
|
||||
llvm-readobj --coff-exports "$1" | awk -v view="${2:-main}" '
|
||||
/HybridObject \{/ { h = 1; next }
|
||||
(view == "main" && h) || (view == "hybrid" && !h) { next }
|
||||
/^ *Export \{/ { o = ""; n = "-"; r = "" }
|
||||
/^ *Ordinal:/ { o = $2 }
|
||||
/^ *Name:/ { if (NF >= 2) n = $2 }
|
||||
/^ *RVA:/ { r = $2 }
|
||||
/^ *\}/ { if (o != "" && r != "" && r != "0x0") print o, n; o = "" }' | sort
|
||||
}
|
||||
|
||||
compare_exports() { # compare_exports <label> <file> <def> <view>
|
||||
local want got
|
||||
want="$(def_exports "$HERE/def/$3.def")"
|
||||
got="$(dll_exports "$2" "$4")"
|
||||
if [ "$want" != "$got" ]; then
|
||||
printf 'want:\n%s\ngot:\n%s\n' "$want" "$got"
|
||||
die "$1 exports differ from def/$3.def"
|
||||
fi
|
||||
}
|
||||
|
||||
check_dll() { # check_dll <arch> <dll name> <file>
|
||||
local arch="$1" name="$2" f="$3" fmts fmt hyb machine lc imports bad res
|
||||
fmts="$(llvm-readobj --file-headers "$f" | sed -n 's/^ *Format: //p')"
|
||||
fmt="$(sed -n 1p <<<"$fmts")"
|
||||
hyb="$(sed -n 2p <<<"$fmts")"
|
||||
case "$arch" in
|
||||
i386) [ "$fmt" = "COFF-i386" ] && [ -z "$hyb" ] || die "$f is $fmt${hyb:+ + $hyb}, want COFF-i386" ;;
|
||||
arm64x)
|
||||
# Native view: an ARM64 PE (what an ARM64 process maps). EC view: ARM64EC (what an x64 process sees
|
||||
# through the ARM64X dynamic relocations). Both need the CHPE metadata.
|
||||
machine="$(python3 -c 'import struct,sys; d=open(sys.argv[1],"rb").read(4096); o=struct.unpack_from("<I",d,0x3c)[0]; print(hex(struct.unpack_from("<H",d,o+4)[0]) if d[o:o+4]==b"PE\0\0" else "?")' "$f")"
|
||||
[ "$machine" = 0xaa64 ] || die "$f PE header machine is $machine, want 0xaa64 (ARM64)"
|
||||
[ "$hyb" = "COFF-ARM64EC" ] || die "$f has no ARM64EC hybrid view (formats: $(echo $fmts))"
|
||||
lc="$(llvm-readobj --coff-load-config "$f")"
|
||||
grep -q 'CHPEMetadata' <<<"$lc" || die "$f has no CHPE metadata"
|
||||
grep -q 'Arm64X' <<<"$lc" || die "$f has no ARM64X dynamic relocations"
|
||||
# One TLS directory serves both views and would list native ARM64 callbacks (see src/notls.c).
|
||||
llvm-readobj --file-headers "$f" | grep -q 'TLSTableRVA: 0x[1-9a-fA-F]' && die "$f has a TLS directory"
|
||||
fmt="$fmt/$hyb/$machine"
|
||||
;;
|
||||
esac
|
||||
compare_exports "$arch/$name.dll" "$f" "$name" main
|
||||
[ "$arch" != arm64x ] || compare_exports "$arch/$name.dll (EC view)" "$f" "$name" hybrid
|
||||
imports="$(llvm-readobj --coff-imports "$f" | sed -n 's/^ *Name: //p' | tr 'A-Z' 'a-z' | sort -u)"
|
||||
bad="$(grep -vxE 'kernel32\.dll|ucrtbase\.dll|msvcrt\.dll|api-ms-win-crt-[a-z0-9-]+\.dll' <<<"$imports" || true)"
|
||||
[ -z "$bad" ] || die "$arch/$name.dll imports $(echo $bad) (only kernel32 and the C runtime are allowed)"
|
||||
grep -aqF "$MARKER" "$f" || die "$arch/$name.dll lacks its '$MARKER' marker (launch.sh and the rumble path look for it)"
|
||||
res="$(llvm-readobj --coff-resources "$f")"
|
||||
grep -q 'Type: VERSIONINFO (ID 16)' <<<"$res" || die "$arch/$name.dll has no VERSIONINFO resource"
|
||||
printf ' %-7s %-15s %6d bytes %-24s imports: %s\n' "$arch" "$name.dll" "$(stat -c %s "$f")" "$fmt" "$(echo $imports)"
|
||||
}
|
||||
|
||||
# The objects and archives the toolchain links into an aarch64 DLL (CRT start-up, mingw/ucrt/kernel32 import
|
||||
# libraries, compiler-rt), as absolute paths: the native view of an ARM64X image needs its own.
|
||||
native_link_inputs() { # native_link_inputs <tmpdir>
|
||||
printf 'int x;\n' > "$1/empty.c"
|
||||
aarch64-w64-mingw32-clang -shared -o "$1/empty.dll" "$1/empty.c" -### 2>&1 | python3 -c '
|
||||
import os, shlex, sys
|
||||
line = [l for l in sys.stdin.read().splitlines() if "ld.lld" in l or "lld-link" in l]
|
||||
if not line:
|
||||
sys.exit("no link line in the -### output")
|
||||
toks = shlex.split(line[-1])
|
||||
dirs = [t[2:] for t in toks if t.startswith("-L")]
|
||||
out = []
|
||||
for t in toks[1:]:
|
||||
if t.startswith("-l"):
|
||||
name = t[2:]
|
||||
hit = next((os.path.join(d, c) for d in dirs for c in ("lib%s.a" % name, "lib%s.dll.a" % name, "%s.lib" % name)
|
||||
if os.path.isfile(os.path.join(d, c))), None)
|
||||
if not hit:
|
||||
sys.exit("cannot resolve -l%s in %s" % (name, dirs))
|
||||
out.append(hit)
|
||||
elif t.endswith((".o", ".a", ".obj", ".lib")) and os.path.isabs(t) and os.path.isfile(t):
|
||||
out.append(t)
|
||||
seen = set()
|
||||
print("\n".join(p for p in out if not (p in seen or seen.add(p))))
|
||||
'
|
||||
}
|
||||
|
||||
# notls-*.o (src/notls.c) come before the CRT so the image gets no TLS directory.
|
||||
link_arm64x() { # link_arm64x <out> <def> <ec obj> <native obj> <native inputs file> <ec notls obj> <native notls obj> <version res obj>
|
||||
local nat=()
|
||||
mapfile -t nat <"$5"
|
||||
arm64ec-w64-mingw32-clang -shared -s -Wl,--no-insert-timestamp -Wl,-marm64xpe "-Wl,--Xlink=-defarm64native:$2" \
|
||||
-o "$1" "$3" "$6" "$4" "$7" "$8" "$2" "${nat[@]}" -lkernel32
|
||||
}
|
||||
|
||||
CFLAGS_COMMON="-std=gnu11 -O2 -Wall -Wextra -Werror -fno-strict-aliasing -I$HERE/src"
|
||||
|
||||
dlls() {
|
||||
local out="${1:?usage: build.sh dlls <outdir>}" tmp arch name def
|
||||
toolchain
|
||||
mkdir -p "$out"; out="$(cd "$out" && pwd)"
|
||||
tmp="$(mktemp -d)"
|
||||
for arch in $ARCHES; do
|
||||
mkdir -p "$out/$arch"
|
||||
if [ "$arch" = arm64x ]; then
|
||||
arm64ec-w64-mingw32-clang $CFLAGS_COMMON -DDDC_HYBRID=1 -c "$HERE/src/dd_directcontroller.c" -o "$tmp/ddc-arm64ec.o"
|
||||
aarch64-w64-mingw32-clang $CFLAGS_COMMON -DDDC_HYBRID=1 -c "$HERE/src/dd_directcontroller.c" -o "$tmp/ddc-aarch64.o"
|
||||
arm64ec-w64-mingw32-clang $CFLAGS_COMMON -c "$HERE/src/notls.c" -o "$tmp/notls-arm64ec.o"
|
||||
aarch64-w64-mingw32-clang $CFLAGS_COMMON -c "$HERE/src/notls.c" -o "$tmp/notls-aarch64.o"
|
||||
native_link_inputs "$tmp" >"$tmp/native-inputs"
|
||||
for name in $DLLS; do
|
||||
link_arm64x "$out/$arch/$name.dll" "$HERE/def/$name.def" "$tmp/ddc-arm64ec.o" "$tmp/ddc-aarch64.o" "$tmp/native-inputs" \
|
||||
"$tmp/notls-arm64ec.o" "$tmp/notls-aarch64.o" "$(version_res "$arch" "$name" "$tmp")"
|
||||
check_dll "$arch" "$name" "$out/$arch/$name.dll"
|
||||
done
|
||||
continue
|
||||
fi
|
||||
# i386: SSE2 so a full fence is mfence
|
||||
i686-w64-mingw32-clang $CFLAGS_COMMON -msse2 -mfpmath=sse -c "$HERE/src/dd_directcontroller.c" -o "$tmp/ddc-i386.o"
|
||||
for name in $DLLS; do
|
||||
def="$(def_for "$arch" "$name" "$tmp")"
|
||||
i686-w64-mingw32-clang -shared -s -Wl,--no-insert-timestamp -Wl,--kill-at -o "$out/$arch/$name.dll" "$tmp/ddc-i386.o" \
|
||||
"$(version_res "$arch" "$name" "$tmp")" "$def" -lkernel32
|
||||
check_dll "$arch" "$name" "$out/$arch/$name.dll"
|
||||
done
|
||||
done
|
||||
rm -rf "$tmp"
|
||||
say "$(ls "$out"/*/*.dll | wc -l) DLLs in $out"
|
||||
}
|
||||
|
||||
host() {
|
||||
local out="${1:?usage: build.sh host <outdir>}"
|
||||
mkdir -p "$out"
|
||||
"${CC:-cc}" -std=gnu11 -O2 -Wall -Wextra -Werror -pthread -I"$HERE/src" -o "$out/host_test" "$HERE/test/host_test.c"
|
||||
say "host_test built for $(uname -m)"
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
toolchain) toolchain ;;
|
||||
dlls) dlls "${2:-}" ;;
|
||||
host) host "${2:-}" ;;
|
||||
*) die "usage: $0 toolchain | dlls <outdir> | host <outdir>" ;;
|
||||
esac
|
||||
@@ -1,11 +0,0 @@
|
||||
LIBRARY xinput1_1.dll
|
||||
EXPORTS
|
||||
XInputEnable @1
|
||||
XInputGetCapabilities @2
|
||||
XInputGetDSoundAudioDeviceGuids @3
|
||||
XInputSetState @4
|
||||
XInputGetState @5
|
||||
XInputGetStateEx @100
|
||||
XInputWaitForGuideButton @101
|
||||
XInputCancelGuideButtonWait @102
|
||||
XInputPowerOffController @103
|
||||
@@ -1,11 +0,0 @@
|
||||
LIBRARY xinput1_2.dll
|
||||
EXPORTS
|
||||
XInputEnable @1
|
||||
XInputGetCapabilities @2
|
||||
XInputGetDSoundAudioDeviceGuids @3
|
||||
XInputSetState @4
|
||||
XInputGetState @5
|
||||
XInputGetStateEx @100
|
||||
XInputWaitForGuideButton @101
|
||||
XInputCancelGuideButtonWait @102
|
||||
XInputPowerOffController @103
|
||||
@@ -1,14 +0,0 @@
|
||||
LIBRARY xinput1_3.dll
|
||||
EXPORTS
|
||||
DllMain @1
|
||||
XInputGetState @2
|
||||
XInputSetState @3
|
||||
XInputGetCapabilities @4
|
||||
XInputEnable @5
|
||||
XInputGetDSoundAudioDeviceGuids @6
|
||||
XInputGetBatteryInformation @7
|
||||
XInputGetKeystroke @8
|
||||
XInputGetStateEx @100
|
||||
XInputWaitForGuideButton @101
|
||||
XInputCancelGuideButtonWait @102
|
||||
XInputPowerOffController @103
|
||||
@@ -1,15 +0,0 @@
|
||||
LIBRARY xinput1_4.dll
|
||||
EXPORTS
|
||||
DllMain @1
|
||||
XInputGetState @2
|
||||
XInputSetState @3
|
||||
XInputGetCapabilities @4
|
||||
XInputEnable @5
|
||||
XInputGetBatteryInformation @7
|
||||
XInputGetKeystroke @8
|
||||
XInputGetAudioDeviceIds @10
|
||||
XInputGetStateEx @100
|
||||
XInputWaitForGuideButton @101
|
||||
XInputCancelGuideButtonWait @102
|
||||
XInputPowerOffController @103
|
||||
XInputGetCapabilitiesEx @108
|
||||
@@ -1,10 +0,0 @@
|
||||
LIBRARY xinput9_1_0.dll
|
||||
EXPORTS
|
||||
XInputGetCapabilities @1
|
||||
XInputGetDSoundAudioDeviceGuids @2
|
||||
XInputSetState @3
|
||||
XInputGetState @4
|
||||
XInputGetStateEx @100
|
||||
XInputWaitForGuideButton @101
|
||||
XInputCancelGuideButtonWait @102
|
||||
XInputPowerOffController @103
|
||||
@@ -1,14 +0,0 @@
|
||||
LIBRARY xinputuap.dll
|
||||
EXPORTS
|
||||
DllMain @1
|
||||
XInputEnable @2
|
||||
XInputGetAudioDeviceIds @3
|
||||
XInputGetBatteryInformation @4
|
||||
XInputGetCapabilities @5
|
||||
XInputGetKeystroke @6
|
||||
XInputGetState @7
|
||||
XInputSetState @8
|
||||
XInputGetStateEx @100
|
||||
XInputWaitForGuideButton @101
|
||||
XInputCancelGuideButtonWait @102
|
||||
XInputPowerOffController @103
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,163 +0,0 @@
|
||||
/*
|
||||
* dd-directcontroller: the read side of DroidDeck's controller ring file (one per pad slot), shared by the
|
||||
* XInput DLL and its host test.
|
||||
*
|
||||
* The app (input/FakeInputWriter.java) writes each slot's ring file; fakeinput_steam.cpp reads its events
|
||||
* for Wine's evdev path. The 64-byte header (FakeInputRingHeader, ABI-stable) also carries a snapshot of
|
||||
* the whole pad that the writer updates on every publish, under a sequence counter:
|
||||
*
|
||||
* 0 u32 magic 0x46494252 16 u64 write_seq 40 u32 snapshot buttons (bit = BUTTON_MAP index)
|
||||
* 4 u32 version 2 24 u64 generation 44 i16 snapshot axes[8]
|
||||
* 8 u32 event size 24 32 u64 snapshot_seq 60 u32 resync_seq
|
||||
* 12 u32 capacity 4096
|
||||
*
|
||||
* Snapshot protocol (FakeInputWriter.writeSnapshotLocked): seq + 1 (odd), store fence, buttons and axes,
|
||||
* store fence, seq + 2 (even). A reader takes the state when it saw the same even seq before and after.
|
||||
* Only 32-bit loads are used: on i386 a 64-bit atomic load is a cmpxchg8b, which writes and so faults on a
|
||||
* read-only view; the low halves of seq and generation are enough to see a change.
|
||||
*
|
||||
* Axes: [0] left X, [1] left Y, [2] right X, [3] right Y (evdev sense, -32767..32767, Y positive = down),
|
||||
* [4] right trigger, [5] left trigger (0..255), [6] hat X, [7] hat Y (-1, 0, 1; Y -1 = up).
|
||||
*/
|
||||
#ifndef DD_DIRECTCONTROLLER_RING_H
|
||||
#define DD_DIRECTCONTROLLER_RING_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define DDC_RING_MAGIC 0x46494252u
|
||||
#define DDC_RING_VERSION 2u
|
||||
#define DDC_RING_EVENT_SIZE 24u
|
||||
#define DDC_RING_CAPACITY 4096u
|
||||
#define DDC_RING_HEADER_SIZE 64u
|
||||
|
||||
#define DDC_OFF_MAGIC 0u
|
||||
#define DDC_OFF_VERSION 4u
|
||||
#define DDC_OFF_EVENT_SIZE 8u
|
||||
#define DDC_OFF_CAPACITY 12u
|
||||
#define DDC_OFF_GENERATION 24u /* low half */
|
||||
#define DDC_OFF_SNAP_SEQ 32u /* low half */
|
||||
#define DDC_OFF_SNAP_BUTTONS 40u
|
||||
#define DDC_OFF_SNAP_AXES 44u
|
||||
|
||||
/* Snapshot button bits: FakeInputWriter.BUTTON_MAP index (QAM = DroidDeck's quick-access button). */
|
||||
enum {
|
||||
DDC_B_A, DDC_B_B, DDC_B_X, DDC_B_Y, DDC_B_TL, DDC_B_TR, DDC_B_SELECT, DDC_B_START,
|
||||
DDC_B_THUMBL, DDC_B_THUMBR, DDC_B_MODE, DDC_B_QAM,
|
||||
};
|
||||
|
||||
enum { DDC_A_LX, DDC_A_LY, DDC_A_RX, DDC_A_RY, DDC_A_RT, DDC_A_LT, DDC_A_HATX, DDC_A_HATY };
|
||||
|
||||
/* XInput button bits */
|
||||
#define DDC_XI_DPAD_UP 0x0001u
|
||||
#define DDC_XI_DPAD_DOWN 0x0002u
|
||||
#define DDC_XI_DPAD_LEFT 0x0004u
|
||||
#define DDC_XI_DPAD_RIGHT 0x0008u
|
||||
#define DDC_XI_START 0x0010u
|
||||
#define DDC_XI_BACK 0x0020u
|
||||
#define DDC_XI_LEFT_THUMB 0x0040u
|
||||
#define DDC_XI_RIGHT_THUMB 0x0080u
|
||||
#define DDC_XI_LEFT_SHOULDER 0x0100u
|
||||
#define DDC_XI_RIGHT_SHOULDER 0x0200u
|
||||
#define DDC_XI_GUIDE 0x0400u
|
||||
#define DDC_XI_A 0x1000u
|
||||
#define DDC_XI_B 0x2000u
|
||||
#define DDC_XI_X 0x4000u
|
||||
#define DDC_XI_Y 0x8000u
|
||||
|
||||
typedef struct {
|
||||
uint32_t seq; /* low half of snapshot_seq (even) */
|
||||
uint32_t generation; /* low half */
|
||||
uint32_t buttons;
|
||||
int16_t axes[8];
|
||||
} ddc_snap;
|
||||
|
||||
typedef struct {
|
||||
uint16_t buttons;
|
||||
uint8_t lt, rt;
|
||||
int16_t lx, ly, rx, ry;
|
||||
} ddc_pad;
|
||||
|
||||
static inline uint32_t ddc_ld32(const uint8_t *v, uint32_t off, int order) {
|
||||
return __atomic_load_n((const uint32_t *)(const void *)(v + off), order);
|
||||
}
|
||||
|
||||
/* 1 if the view starts with a version-2 ring header of the size this file reads. */
|
||||
static inline int ddc_valid(const uint8_t *v) {
|
||||
return ddc_ld32(v, DDC_OFF_MAGIC, __ATOMIC_RELAXED) == DDC_RING_MAGIC &&
|
||||
ddc_ld32(v, DDC_OFF_VERSION, __ATOMIC_RELAXED) == DDC_RING_VERSION &&
|
||||
ddc_ld32(v, DDC_OFF_EVENT_SIZE, __ATOMIC_RELAXED) == DDC_RING_EVENT_SIZE &&
|
||||
ddc_ld32(v, DDC_OFF_CAPACITY, __ATOMIC_RELAXED) == DDC_RING_CAPACITY;
|
||||
}
|
||||
|
||||
/* A consistent copy of the snapshot, in at most `attempts` tries; 0 if the writer kept lapping it. */
|
||||
static inline int ddc_snapshot(const uint8_t *v, ddc_snap *out, unsigned attempts) {
|
||||
for (unsigned i = 0; i < attempts; i++) {
|
||||
uint32_t s1 = ddc_ld32(v, DDC_OFF_SNAP_SEQ, __ATOMIC_ACQUIRE);
|
||||
if (s1 & 1u) continue;
|
||||
uint32_t gen = ddc_ld32(v, DDC_OFF_GENERATION, __ATOMIC_RELAXED);
|
||||
uint32_t buttons = ddc_ld32(v, DDC_OFF_SNAP_BUTTONS, __ATOMIC_RELAXED);
|
||||
uint32_t w[4];
|
||||
for (unsigned k = 0; k < 4; k++) w[k] = ddc_ld32(v, DDC_OFF_SNAP_AXES + 4u * k, __ATOMIC_RELAXED);
|
||||
__atomic_thread_fence(__ATOMIC_ACQUIRE);
|
||||
if (ddc_ld32(v, DDC_OFF_SNAP_SEQ, __ATOMIC_RELAXED) != s1) continue;
|
||||
out->seq = s1;
|
||||
out->generation = gen;
|
||||
out->buttons = buttons;
|
||||
for (unsigned k = 0; k < 4; k++) { /* little endian: axis 2k in the low half */
|
||||
out->axes[2 * k] = (int16_t)(uint16_t)(w[k] & 0xffffu);
|
||||
out->axes[2 * k + 1] = (int16_t)(uint16_t)(w[k] >> 16);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int16_t ddc_flip(int16_t v) { /* evdev Y (down = +) to XInput Y (up = +) */
|
||||
return v == INT16_MIN ? INT16_MAX : (int16_t)-v;
|
||||
}
|
||||
|
||||
static inline uint8_t ddc_trigger(int16_t v) {
|
||||
return v <= 0 ? 0 : v >= 255 ? 255 : (uint8_t)v;
|
||||
}
|
||||
|
||||
/* The snapshot as an XInput pad; Guide only when `guide` (XInputGetStateEx). */
|
||||
static inline void ddc_map(const ddc_snap *s, int guide, ddc_pad *p) {
|
||||
static const uint16_t bit[11] = {
|
||||
DDC_XI_A, DDC_XI_B, DDC_XI_X, DDC_XI_Y, DDC_XI_LEFT_SHOULDER, DDC_XI_RIGHT_SHOULDER,
|
||||
DDC_XI_BACK, DDC_XI_START, DDC_XI_LEFT_THUMB, DDC_XI_RIGHT_THUMB, DDC_XI_GUIDE,
|
||||
};
|
||||
uint16_t b = 0;
|
||||
for (unsigned i = 0; i < 11; i++)
|
||||
if (s->buttons & (1u << i)) b |= bit[i];
|
||||
if (!guide) b &= (uint16_t)~DDC_XI_GUIDE;
|
||||
if (s->axes[DDC_A_HATX] < 0) b |= DDC_XI_DPAD_LEFT;
|
||||
if (s->axes[DDC_A_HATX] > 0) b |= DDC_XI_DPAD_RIGHT;
|
||||
if (s->axes[DDC_A_HATY] < 0) b |= DDC_XI_DPAD_UP;
|
||||
if (s->axes[DDC_A_HATY] > 0) b |= DDC_XI_DPAD_DOWN;
|
||||
p->buttons = b;
|
||||
p->lx = s->axes[DDC_A_LX];
|
||||
p->ly = ddc_flip(s->axes[DDC_A_LY]);
|
||||
p->rx = s->axes[DDC_A_RX];
|
||||
p->ry = ddc_flip(s->axes[DDC_A_RY]);
|
||||
p->lt = ddc_trigger(s->axes[DDC_A_LT]);
|
||||
p->rt = ddc_trigger(s->axes[DDC_A_RT]);
|
||||
}
|
||||
|
||||
/* FAKE_EVDEV_MEMFD_PATHS: "<slot>=<unix path>;..." -> take(ctx, slot, path, len) for slots 0..max-1. */
|
||||
#define DDC_DEFINE_PARSE_PATHS(fname, CH) \
|
||||
static void fname(const CH *s, void (*take)(void *, uint32_t, const CH *, size_t), void *ctx, \
|
||||
uint32_t max) { \
|
||||
while (s && *s) { \
|
||||
const CH *e = s; \
|
||||
while (*e && *e != ';') e++; \
|
||||
const CH *q = s; \
|
||||
uint32_t slot = 0; \
|
||||
int digits = 0; \
|
||||
while (q < e && *q >= '0' && *q <= '9' && digits < 3) slot = slot * 10u + (uint32_t)(*q++ - '0'), digits++; \
|
||||
if (digits && q < e && *q == '=' && q + 1 < e && slot < max) take(ctx, slot, q + 1, (size_t)(e - q - 1)); \
|
||||
s = *e ? e + 1 : e; \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Linked into both views of the ARM64X image only (build.sh link_arm64x), ahead of the mingw CRT.
|
||||
*
|
||||
* The CRT's DLL start-up (dllcrt2.o) references __dyn_tls_init_callback, which pulls tlssup.o and
|
||||
* with it _tls_used, the TLS directory. An ARM64X image has one TLS directory for both views (the
|
||||
* linker takes the native view's and emits no ARM64X relocation for it), so its callbacks are the
|
||||
* native ARM64 ones. In an x64 process (the EC view) Wine treats non-EC code as x64 and the emulator
|
||||
* runs those ARM64 bytes as x86 on every thread start: a stray write to the image header (base+0x42)
|
||||
* that the loader catches, but a game's own first-chance exception handler sees first (Cyberpunk
|
||||
* 2077's crash reporter exits on it).
|
||||
*
|
||||
* Defining the symbol here keeps tlssup.o out, so the image has no TLS directory. The CRT checks the
|
||||
* pointer for NULL before calling it; this DLL has no thread-local variables.
|
||||
*/
|
||||
#include <windows.h>
|
||||
|
||||
const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback = NULL;
|
||||
@@ -1,142 +0,0 @@
|
||||
/*
|
||||
* dd-directcontroller host test: the ring snapshot reader (dd_directcontroller_ring.h) against a writer that follows
|
||||
* FakeInputWriter.writeSnapshotLocked, on a shared file mapping (the app and the guest map the same file),
|
||||
* plus the XInput mapping and the FAKE_EVDEV_MEMFD_PATHS parser.
|
||||
*/
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "dd_directcontroller_ring.h"
|
||||
|
||||
static int failures;
|
||||
#define CHECK(c, ...) do { if (!(c)) { failures++; printf("FAIL %s:%d: ", __FILE__, __LINE__); printf(__VA_ARGS__); printf("\n"); } } while (0)
|
||||
|
||||
static uint8_t *wmap;
|
||||
static volatile int stop;
|
||||
|
||||
static void put32(uint32_t off, uint32_t v) { __atomic_store_n((uint32_t *)(void *)(wmap + off), v, __ATOMIC_RELAXED); }
|
||||
static void put64(uint32_t off, uint64_t v) { __atomic_store_n((uint64_t *)(void *)(wmap + off), v, __ATOMIC_RELAXED); }
|
||||
|
||||
static void header(void) {
|
||||
put32(DDC_OFF_MAGIC, DDC_RING_MAGIC);
|
||||
put32(DDC_OFF_VERSION, DDC_RING_VERSION);
|
||||
put32(DDC_OFF_EVENT_SIZE, DDC_RING_EVENT_SIZE);
|
||||
put32(DDC_OFF_CAPACITY, DDC_RING_CAPACITY);
|
||||
}
|
||||
|
||||
/* FakeInputWriter.writeSnapshotLocked: seq + 1, fence, fields, fence, seq + 2 */
|
||||
static void publish(uint64_t *seq, uint32_t buttons, const int16_t axes[8]) {
|
||||
put64(DDC_OFF_SNAP_SEQ, *seq + 1);
|
||||
__atomic_thread_fence(__ATOMIC_RELEASE);
|
||||
put32(DDC_OFF_SNAP_BUTTONS, buttons);
|
||||
for (int k = 0; k < 8; k++)
|
||||
__atomic_store_n((int16_t *)(void *)(wmap + DDC_OFF_SNAP_AXES + 2 * k), axes[k], __ATOMIC_RELAXED);
|
||||
__atomic_thread_fence(__ATOMIC_RELEASE);
|
||||
put64(DDC_OFF_SNAP_SEQ, *seq + 2);
|
||||
*seq += 2;
|
||||
}
|
||||
|
||||
/* Every field carries the same counter, so a torn read shows up as fields that differ. */
|
||||
static uint64_t writer_seq;
|
||||
|
||||
static void *writer(void *arg) {
|
||||
(void)arg;
|
||||
uint64_t seq = writer_seq; /* the sequence continues: a reused value would let a stale read pass (ABA) */
|
||||
uint32_t n = 1;
|
||||
while (!stop) {
|
||||
int16_t v = (int16_t)(n & 0x3fff);
|
||||
int16_t axes[8] = {v, v, v, v, v, v, v, v};
|
||||
publish(&seq, (uint32_t)v, axes);
|
||||
n++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void take(void *ctx, uint32_t slot, const char *p, size_t len) {
|
||||
char *out = ctx;
|
||||
char buf[64];
|
||||
snprintf(buf, sizeof buf, "%u:%.*s|", slot, (int)len, p);
|
||||
strcat(out, buf);
|
||||
}
|
||||
DDC_DEFINE_PARSE_PATHS(parse_paths, char)
|
||||
|
||||
int main(void) {
|
||||
char path[] = "/tmp/ddc-ring-XXXXXX";
|
||||
int fd = mkstemp(path);
|
||||
CHECK(fd >= 0, "mkstemp");
|
||||
size_t size = DDC_RING_HEADER_SIZE + DDC_RING_CAPACITY * DDC_RING_EVENT_SIZE;
|
||||
CHECK(ftruncate(fd, (off_t)size) == 0, "ftruncate");
|
||||
wmap = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
const uint8_t *rmap = mmap(NULL, DDC_RING_HEADER_SIZE, PROT_READ, MAP_SHARED, fd, 0);
|
||||
CHECK(wmap != MAP_FAILED && rmap != MAP_FAILED, "mmap");
|
||||
unlink(path);
|
||||
|
||||
CHECK(!ddc_valid(rmap), "an empty file is not a ring");
|
||||
header();
|
||||
CHECK(ddc_valid(rmap), "a version-2 header is a ring");
|
||||
put32(DDC_OFF_VERSION, 1);
|
||||
CHECK(!ddc_valid(rmap), "version 1 is refused");
|
||||
put32(DDC_OFF_VERSION, DDC_RING_VERSION);
|
||||
|
||||
/* mapping */
|
||||
uint64_t seq = 0;
|
||||
int16_t axes[8] = {1000, 2000, -3000, -32767, 255, 128, -1, 1};
|
||||
uint32_t buttons = (1u << DDC_B_A) | (1u << DDC_B_TR) | (1u << DDC_B_START) | (1u << DDC_B_MODE) | (1u << DDC_B_QAM);
|
||||
publish(&seq, buttons, axes);
|
||||
ddc_snap s;
|
||||
CHECK(ddc_snapshot(rmap, &s, 64), "snapshot of a settled ring");
|
||||
CHECK(s.seq == 2, "seq %u", s.seq);
|
||||
ddc_pad p;
|
||||
ddc_map(&s, 0, &p);
|
||||
CHECK(p.buttons == (DDC_XI_A | DDC_XI_RIGHT_SHOULDER | DDC_XI_START | DDC_XI_DPAD_LEFT | DDC_XI_DPAD_DOWN),
|
||||
"buttons 0x%04x (no Guide, no QAM, hat left + down)", p.buttons);
|
||||
CHECK(p.lx == 1000 && p.ly == -2000 && p.rx == -3000 && p.ry == 32767, "sticks %d %d %d %d (Y flipped)", p.lx, p.ly,
|
||||
p.rx, p.ry);
|
||||
CHECK(p.rt == 255 && p.lt == 128, "triggers lt %u rt %u", p.lt, p.rt);
|
||||
ddc_map(&s, 1, &p);
|
||||
CHECK(p.buttons & DDC_XI_GUIDE, "Guide in GetStateEx");
|
||||
int16_t edge[8] = {INT16_MIN, INT16_MIN, 0, 0, -5, 300, 0, -1};
|
||||
publish(&seq, 0, edge);
|
||||
CHECK(ddc_snapshot(rmap, &s, 64), "snapshot");
|
||||
ddc_map(&s, 0, &p);
|
||||
CHECK(p.ly == INT16_MAX && p.lt == 255 && p.rt == 0 && p.buttons == DDC_XI_DPAD_UP, "edges: ly %d lt %u rt %u b 0x%x",
|
||||
p.ly, p.lt, p.rt, p.buttons);
|
||||
|
||||
/* an odd seq (a write in progress) is never taken */
|
||||
put64(DDC_OFF_SNAP_SEQ, seq + 1);
|
||||
CHECK(!ddc_snapshot(rmap, &s, 64), "a snapshot mid-write is refused");
|
||||
put64(DDC_OFF_SNAP_SEQ, seq);
|
||||
|
||||
/* no torn reads against a running writer; the state before its first publish is consistent too */
|
||||
int16_t zero[8] = {0};
|
||||
publish(&seq, 0, zero);
|
||||
writer_seq = seq;
|
||||
pthread_t t;
|
||||
pthread_create(&t, NULL, writer, NULL);
|
||||
unsigned ok = 0, lapped = 0, torn = 0;
|
||||
for (unsigned i = 0; i < 2000000u; i++) {
|
||||
if (!ddc_snapshot(rmap, &s, 64)) { lapped++; continue; }
|
||||
ok++;
|
||||
for (int k = 1; k < 8; k++)
|
||||
if (s.axes[k] != s.axes[0]) { torn++; break; }
|
||||
if ((int16_t)s.buttons != s.axes[0]) torn++;
|
||||
}
|
||||
stop = 1;
|
||||
pthread_join(t, NULL);
|
||||
CHECK(torn == 0, "%u torn snapshots", torn);
|
||||
CHECK(ok > 0, "no snapshot taken");
|
||||
printf("concurrent: %u snapshots, %u lapped, %u torn\n", ok, lapped, torn);
|
||||
|
||||
/* FAKE_EVDEV_MEMFD_PATHS */
|
||||
char got[256] = "";
|
||||
parse_paths("0=/a/r0;1=/a/r1;4=/a/mouse;x=bad;2=;3=/a/r3", take, got, 4);
|
||||
CHECK(!strcmp(got, "0:/a/r0|1:/a/r1|3:/a/r3|"), "parsed '%s' (slot 4 = mouse and malformed entries skipped)", got);
|
||||
|
||||
printf(failures ? "host_test: %d failure(s)\n" : "host_test: OK\n", failures);
|
||||
return failures ? 1 : 0;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ for v in $(env | sed -n 's/^\([A-Za-z_][A-Za-z0-9_]*\)=.*/\1/p'); do
|
||||
ANDROID_*|BOOTCLASSPATH|DEX2OATBOOTCLASSPATH|SYSTEMSERVERCLASSPATH|EXTERNAL_STORAGE|ASEC_MOUNTPOINT) ;;
|
||||
FAKE_*|SDL_*|DD_WIDTH|DD_HEIGHT|DD_VK_DRIVER|WINEDLLOVERRIDES) ;;
|
||||
DISPLAY|GAMESCOPE_WAYLAND_DISPLAY|FEX_*) ;;
|
||||
TU_DEBUG|MESA_NO_ERROR|DXVK_CONFIG|DXVK_HUD|DROIDDECK_FORCE_SSBS|DROIDDECK_NO_STEAM|BANNER_AUDIO_DIRECT_*) ;;
|
||||
TU_DEBUG|MESA_NO_ERROR|DXVK_CONFIG|DXVK_HUD|DROIDDECK_FORCE_SSBS|BANNER_AUDIO_DIRECT_*) ;;
|
||||
mesa_glthread|vblank_mode|ZINK_*|GALLIUM_HUD|GALLIUM_THREAD) ;;
|
||||
DD_SYNC|DD_FSYNC_FIRST|DD_SYNC_FALLBACK|PROTON_NO_ESYNC|PROTON_NO_FSYNC|PROTON_NO_NTSYNC|WINEESYNC) ;;
|
||||
PROTON_USE_D7VK) ;;
|
||||
@@ -138,13 +138,6 @@ echo "sync ntsync=$WINENTSYNC esync=$WINEESYNC ssbs=${WINE_FORCE_SSBS:-0} tu_deb
|
||||
export WINESTEAMCLIENTPATH64=$ROOTFS/root/.local/share/Steam/androidarm64/libsteamclient.so
|
||||
# The layer sends a game's steamclient(64).dll to lsteamclient (and so to DroidDeck's Steam through the library
|
||||
# above) only with WINE_LSTEAMCLIENT set; without it Valve's Windows steamclient runs alone and SteamAPI_Init fails.
|
||||
# A game set to start without Steam has no Steam client behind lsteamclient, and a steamclient64.dll it brings itself
|
||||
# (a Steam emulator such as gbe_fork's ColdClient loader) would be replaced by it, so the game quit after its splash
|
||||
# screen. Such a game keeps its own; a WINE_LSTEAMCLIENT the player set wins.
|
||||
if [ -z "${WINE_LSTEAMCLIENT:-}" ] && on "${DROIDDECK_NO_STEAM:-}"; then
|
||||
echo "lsteamclient off: started without Steam"
|
||||
export WINE_LSTEAMCLIENT=0
|
||||
fi
|
||||
export WINE_LSTEAMCLIENT=${WINE_LSTEAMCLIENT:-1}
|
||||
# Steam Input data (Valve's Steam Deck layouts with game actions) lives in DroidDeck's /dev/shm; libsteamshm.so
|
||||
# points the Android library's shared memory there (it keeps its own in-process otherwise) and gives it the
|
||||
@@ -426,59 +419,6 @@ elif [ -L "$S/ddraw_.dll" ] || [ -e "$S/ddraw_.dll" ]; then
|
||||
ln -s "$F/lib/wine/i386-windows/ddraw.dll" "$S/ddraw.dll"
|
||||
echo "$(date +%H:%M:%S) D7VK off: Wine's ddraw again"
|
||||
fi
|
||||
|
||||
# dd-directcontroller: a game set to start without Steam reads the controller through dd-directcontroller's XInput DLLs
|
||||
# (bionic/dd-directcontroller), which answer from the pad state DroidDeck keeps in each ring file instead of the queue
|
||||
# of HID reports Wine's xinput reads (a game that reads slower than the pad reports kept moving after the stick
|
||||
# was let go). They go into the prefix as copies, never through the links to this tool's builtins, with Wine's
|
||||
# xinput1_4 beside them as dd-directcontroller-wine-xinput.dll for rumble and pass-through. The mode file next to the
|
||||
# controller folder (DD_DIRECTCONTROLLER_CONTROL, '1' direct / '0' pass-through to Wine's xinput) is read by the DLLs
|
||||
# while the game runs, so DroidDeck can switch it live; it starts as DD_DIRECTCONTROLLER says (0 = pass-through). A game
|
||||
# no longer set to start without Steam gets Wine's links back.
|
||||
DDC=$TOOL/bionic/dd-directcontroller
|
||||
ddc_names="xinput1_1 xinput1_2 xinput1_3 xinput1_4 xinput9_1_0 xinputuap"
|
||||
ddc_put() { # src dst: dst becomes a copy of src; a link there is removed first, so the file it names stays as it was
|
||||
[ ! -L "$2" ] && cmp -s "$1" "$2" && return 0
|
||||
rm -f "$2" && cp "$1" "$2"
|
||||
}
|
||||
ddc_ours() { [ -f "$1" ] && [ ! -L "$1" ] && grep -qF "dd-directcontroller: " "$1"; }
|
||||
DDCW=$COMPAT/pfx/drive_c/windows
|
||||
if on "${DROIDDECK_NO_STEAM:-}" && [ -d "$DDC/arm64x" ] && [ -d "$DDC/i386" ]; then
|
||||
for a in arm64x:system32:aarch64-windows i386:syswow64:i386-windows; do
|
||||
src=$DDC/${a%%:*}; rest=${a#*:}; dir=$DDCW/${rest%%:*}; wine=$F/lib/wine/${rest#*:}
|
||||
[ -d "$dir" ] || continue
|
||||
for n in $ddc_names; do
|
||||
t=$dir/$n.dll
|
||||
# a native DLL that is neither Wine's nor ours (a game's own or a tool's) stays, as link_dir keeps it
|
||||
if [ -f "$t" ] && [ ! -L "$t" ] && ! is_builtin "$t" && ! ddc_ours "$t"; then
|
||||
echo "$(date +%H:%M:%S) dd-directcontroller: kept ${dir##*/}/$n.dll (not Wine's)"
|
||||
continue
|
||||
fi
|
||||
ddc_put "$src/$n.dll" "$t"
|
||||
done
|
||||
ddc_put "$wine/xinput1_4.dll" "$dir/dd-directcontroller-wine-xinput.dll"
|
||||
done
|
||||
export WINEDLLOVERRIDES="$WINEDLLOVERRIDES;xinput1_1,xinput1_2,xinput1_3,xinput1_4,xinput9_1_0,xinputuap=n,b"
|
||||
ddc_mode=1 ddc_name=direct
|
||||
[ "${DD_DIRECTCONTROLLER:-1}" = 0 ] && ddc_mode=0 ddc_name=pass-through
|
||||
if [ -n "${FAKE_EVDEV_DIR:-}" ] && echo "$ddc_mode" > "${FAKE_EVDEV_DIR%/*}/dd-directcontroller.mode"; then
|
||||
export DD_DIRECTCONTROLLER_CONTROL="${FAKE_EVDEV_DIR%/*}/dd-directcontroller.mode"
|
||||
else
|
||||
ddc_name="direct (no mode file)"
|
||||
fi
|
||||
echo "$(date +%H:%M:%S) dd-directcontroller on (starts $ddc_name)"
|
||||
else
|
||||
back=0
|
||||
for a in system32:aarch64-windows syswow64:i386-windows; do
|
||||
dir=$DDCW/${a%%:*}; wine=$F/lib/wine/${a#*:}
|
||||
for n in $ddc_names; do
|
||||
ddc_ours "$dir/$n.dll" || continue
|
||||
rm -f "$dir/$n.dll" && ln -s "$wine/$n.dll" "$dir/$n.dll" && back=$((back + 1))
|
||||
done
|
||||
rm -f "$dir/dd-directcontroller-wine-xinput.dll"
|
||||
done
|
||||
[ $back -gt 0 ] && echo "$(date +%H:%M:%S) dd-directcontroller off: Wine's xinput again"
|
||||
fi
|
||||
# A Windows path (an Xbox game on its own drive letter) starts in the folder Steam gave.
|
||||
case "$EXE" in [A-Za-z]:[\\/]*) ;; *) cd "$(dirname "$EXE")" || exit 1 ;; esac
|
||||
|
||||
|
||||
@@ -573,11 +573,11 @@ def inspector_url(url):
|
||||
|
||||
|
||||
def cdp_eval(agent_dir, expression, target=None, await_promise=True, timeout=15, inspector=None,
|
||||
command_line_api=False, connect_timeout=5):
|
||||
command_line_api=False):
|
||||
if inspector is not None:
|
||||
url, name = inspector_url(inspector), "inspector"
|
||||
else:
|
||||
targets = [t for t in cdp_targets(agent_dir, timeout=connect_timeout) if t.get("webSocketDebuggerUrl")]
|
||||
targets = [t for t in cdp_targets(agent_dir) if t.get("webSocketDebuggerUrl")]
|
||||
want = target or "SharedJSContext"
|
||||
match = [t for t in targets if want in (t.get("title") or "") or want in (t.get("url") or "")]
|
||||
if not match:
|
||||
@@ -841,75 +841,6 @@ class KeyboardWatcher(threading.Thread):
|
||||
self.report(params.get("payload") == "true")
|
||||
|
||||
|
||||
NATIVE_SUSPEND_JS = r"""/* Template arguments are inserted by Python after validation. */
|
||||
async (operation, token, value, order) => {
|
||||
const root = globalThis;
|
||||
const leases = root.__droiddeckNativeSleep ??= { current: null, order: 0n, canceled: false };
|
||||
const sequence = BigInt(order);
|
||||
if (sequence < leases.order) return operation === "wake" ? "miss" : "expired";
|
||||
if (sequence > leases.order) {
|
||||
// An older renderer evaluation can arrive after a newer one. Only
|
||||
// the newest Android request may own a still-in-flight preparation,
|
||||
// including when its own preparation cannot start before deadline.
|
||||
leases.order = sequence;
|
||||
leases.canceled = false;
|
||||
if (leases.current && !leases.current.result) {
|
||||
leases.current.owner = token;
|
||||
leases.current.wake = false;
|
||||
} else {
|
||||
leases.current = null;
|
||||
}
|
||||
}
|
||||
const busy = () => root.SuspendResumeStore?.m_bSuspending === true;
|
||||
const user = root.SteamClient?.User;
|
||||
async function recover(lease) {
|
||||
if (leases.current !== lease || lease.recovered || !lease.wake || busy()) return;
|
||||
if (typeof user?.ResumeSuspendedGames !== "function") return;
|
||||
lease.recovered = true;
|
||||
try { await user.ResumeSuspendedGames(false); } catch { /* no session kick or retry */ }
|
||||
}
|
||||
|
||||
if (operation === "wake") {
|
||||
leases.canceled = true;
|
||||
const lease = leases.current;
|
||||
if (lease?.owner !== token) return "miss";
|
||||
lease.wake = true;
|
||||
// If login1 already signaled sleep and preparation had settled before
|
||||
// wake, its normal resume notification owns recovery. A late success
|
||||
// must recover again only because that notification could precede it.
|
||||
if (lease.result === "prepared" && value !== "signaled") void recover(lease);
|
||||
return "ack";
|
||||
}
|
||||
|
||||
if (leases.canceled) return "expired";
|
||||
const active = leases.current;
|
||||
// A reused in-flight call still requires wake recovery, even when
|
||||
// this request is too late to issue its own call.
|
||||
if (active && !active.result) return "coalesced";
|
||||
if (Date.now() >= value) return "expired";
|
||||
if (typeof user?.PrepareForSystemSuspend !== "function") return "unavailable";
|
||||
if (busy()) return "steam-busy";
|
||||
if (active) return active.result;
|
||||
const lease = { owner: token, result: null, wake: false, recovered: false };
|
||||
leases.current = lease;
|
||||
try {
|
||||
const reply = await user.PrepareForSystemSuspend();
|
||||
lease.result = reply?.result === 1 ? "prepared" : "rejected";
|
||||
} catch {
|
||||
lease.result = "uncertain";
|
||||
}
|
||||
if (lease.result === "prepared" && lease.wake) void recover(lease);
|
||||
return lease.result;
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
def native_suspend_lease(agent_dir, command, token, value, order):
|
||||
expression = "(" + NATIVE_SUSPEND_JS + ")(" + ", ".join(map(json.dumps, (command, token, value, order))) + ")"
|
||||
return cdp_eval(agent_dir, expression, timeout=1.45 if command == "prepare" else 0.75,
|
||||
connect_timeout=0.35).get("value")
|
||||
|
||||
|
||||
def steam_idle_inhibit(agent_dir, inhibit):
|
||||
expression = """(async want => {
|
||||
const toggle = () => new Promise(done => {
|
||||
@@ -1387,23 +1318,6 @@ def main(argv):
|
||||
time.sleep(0.5)
|
||||
print({True: "yes", False: "no"}.get(value, "unknown"))
|
||||
return {True: 0, False: 5}.get(value, 1)
|
||||
if argv and argv[0] in ("--steam-prepare-native-suspend", "--steam-wake-native-suspend"):
|
||||
if (len(argv) != 4 or re.fullmatch(r"[0-9a-f]{32}", argv[1]) is None or
|
||||
re.fullmatch(r"[1-9][0-9]{0,19}", argv[3]) is None):
|
||||
return 2
|
||||
prepare = argv[0] == "--steam-prepare-native-suspend"
|
||||
if prepare and (not argv[2].isascii() or not argv[2].isdigit() or len(argv[2]) > 14):
|
||||
return 2
|
||||
if not prepare and argv[2] not in ("signaled", "unsignaled", "uncertain"):
|
||||
return 2
|
||||
kind = "prepare" if prepare else "wake"
|
||||
value = int(argv[2]) if prepare else argv[2]
|
||||
try:
|
||||
result = native_suspend_lease(Path(base) / "agent", kind, argv[1], value, argv[3])
|
||||
except (AgentError, OSError, ValueError):
|
||||
result = "uncertain"
|
||||
print(result or "uncertain")
|
||||
return 0 if result in ("prepared", "ack", "miss") else 1
|
||||
if argv and argv[0] == "--steam-asleep":
|
||||
expression = """(() => {
|
||||
const store = globalThis.SuspendResumeStore;
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
fail() {
|
||||
printf 'droiddeck-android-app: %s\n' "$1" >&2
|
||||
if [ -n "${DISPLAY:-}" ] && command -v xmessage >/dev/null; then
|
||||
xmessage -center -buttons 'OK:0' -default OK "$1" || true
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
''|*[!a-zA-Z0-9_.]*) fail "This shortcut has no valid Android app." ;;
|
||||
esac
|
||||
package=$1
|
||||
export SCRCPY_SERVER_PATH=/usr/share/droiddeck/scrcpy-server.jar
|
||||
command -v scrcpy >/dev/null && command -v adb >/dev/null && [ -r "$SCRCPY_SERVER_PATH" ] ||
|
||||
fail "Update the DroidDeck Linux runtime to launch Android apps."
|
||||
|
||||
serial=${DD_ANDROID_ADB_SERIAL:-}
|
||||
key=${DD_ANDROID_ADB_KEY:-}
|
||||
case "$serial" in
|
||||
127.0.0.1:*) ;;
|
||||
*) fail "Pair Wireless debugging in DroidDeck Settings → Diagnostics, then restart Steam." ;;
|
||||
esac
|
||||
[ -r "$key" ] || fail "Pair Wireless debugging in DroidDeck Settings → Diagnostics, then restart Steam."
|
||||
|
||||
# Keep the pairing and server lifetime independent of DroidDeck's Agent ADB connection.
|
||||
unset ADB_SERVER_SOCKET ANDROID_ADB_SERVER_ADDRESS ANDROID_ADB_SERVER_PORT
|
||||
export ADB_VENDOR_KEYS="$key" ADB_SERVER_SOCKET=tcp:5039
|
||||
exec 9>"${XDG_RUNTIME_DIR:-/tmp}/droiddeck-android-app.lock"
|
||||
flock -n 9 || fail "Close the running Android app shortcut first."
|
||||
# The ADB server must not inherit the lock.
|
||||
adb start-server 9>&- || fail "Could not start the Android connection."
|
||||
output=
|
||||
cleanup() {
|
||||
adb kill-server 9>&- >/dev/null 2>&1 || true
|
||||
[ -z "$output" ] || rm -f "$output"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
trap 'exit 0' INT TERM HUP
|
||||
connected() {
|
||||
timeout 8 adb connect "$serial" 9>&- >/dev/null 2>&1 || true
|
||||
[ "$(timeout 3 adb -s "$serial" get-state 9>&- 2>/dev/null || true)" = device ]
|
||||
}
|
||||
connected || connected ||
|
||||
fail "Android is disconnected. Turn on Wireless debugging, then restart Steam."
|
||||
|
||||
output=$(mktemp)
|
||||
export SDL_VIDEODRIVER=x11
|
||||
# Android plays audio on the handheld. Capturing it here would feed it back into Android again.
|
||||
scrcpy --serial "$serial" --new-display=1280x720/240 --start-app="$package" \
|
||||
--window-title="Android app" --no-vd-system-decorations --no-clipboard-autosync --no-mouse-hover \
|
||||
--mouse-bind=----:---- --gamepad=uhid --no-audio --max-fps=60 9>&- 2>&1 | tee "$output" ||
|
||||
grep -Fq '[server] INFO: DroidDeck Android shortcut ended' "$output" ||
|
||||
fail "The Android app window closed unexpectedly. Try launching it again."
|
||||
Loaded 100 of 116 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user