mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 12:35:42 +00:00
Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aaffaefaeb | ||
|
|
c23d4ea35c | ||
|
|
d7fcea74b4 | ||
|
|
44b429ca20 | ||
|
|
c91b100bc1 | ||
|
|
90df30f4d7 | ||
|
|
2b6ded9fd4 | ||
|
|
38c2c00c86 | ||
|
|
678057d727 | ||
|
|
ae94009382 | ||
|
|
fd93a35b72 | ||
|
|
12fa3ac343 | ||
|
|
bf960e4a0a | ||
|
|
7f07415223 | ||
|
|
c7c5eeb0fc |
No files matched your search
@@ -232,6 +232,16 @@ static VkResult timed_wait(VkFence fence, uint64_t timeout) {
|
||||
return g_dev_state == -2 ? VK_ERROR_DEVICE_LOST : VK_ERROR_UNKNOWN;
|
||||
int64_t t0 = perf_now();
|
||||
VkResult r = g_vk.WaitForFences(g_dev, 1, &fence, VK_TRUE, timeout);
|
||||
if (r == VK_TIMEOUT) {
|
||||
droiddeck_log("gpu", "GPU fence delayed: retaining frame resources until completion");
|
||||
/* A scheduling delay does not invalidate the device. Keep this submission's
|
||||
* resources and call stack alive, as the main render path already does. */
|
||||
do {
|
||||
r = g_vk.WaitForFences(g_dev, 1, &fence, VK_TRUE, UINT64_MAX);
|
||||
} while (r == VK_TIMEOUT);
|
||||
if (r == VK_SUCCESS)
|
||||
droiddeck_log("gpu", "GPU fence completed: continuing presentation");
|
||||
}
|
||||
perf_add(&g_perf.wait_ns, &g_perf.wait_max_ns, &g_perf.waits, perf_now() - t0);
|
||||
if (r != VK_SUCCESS && r != VK_ERROR_DEVICE_LOST)
|
||||
quarantine_pending_work(r, "fence wait");
|
||||
|
||||
@@ -430,21 +430,28 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
||||
*/
|
||||
private fun useMaliFallback(missing: String?): String {
|
||||
val oldVulkan = com.droiddeck.launcher.session.VenusComponent.hostVulkanTooOld(activity)
|
||||
val venus = oldVulkan == null && com.droiddeck.launcher.session.VenusComponent.available(activity)
|
||||
val venusByUser = venusExplicit()
|
||||
val venus = MaliAutoRoute.venusStandsIn(
|
||||
com.droiddeck.launcher.session.VenusComponent.available(activity), oldVulkan == null,
|
||||
SessionPrefs.venus(activity), venusByUser, gpu.name,
|
||||
)
|
||||
if (oldVulkan != null) Log.i(TAG, "auto: Mali driver reports Vulkan $oldVulkan; Venus needs 1.2, the bridge stands in")
|
||||
val ownership = MaliAutoRoute.fallbackOwnership(
|
||||
venus,
|
||||
SessionPrefs.vkBridge(activity), bridgeExplicit(),
|
||||
SessionPrefs.venus(activity), venusExplicit(),
|
||||
SessionPrefs.venus(activity), venusByUser,
|
||||
)
|
||||
if (venus && !SessionPrefs.venus(activity)) {
|
||||
SessionPrefs.setVenus(activity, true)
|
||||
if (SessionPrefs.vkBridge(activity) && !bridgeExplicit())
|
||||
SessionPrefs.setVkBridge(activity, false)
|
||||
SessionPrefs.setMaliFallbackByAuto(activity, ownership)
|
||||
} else if (!venus && !SessionPrefs.vkBridge(activity)) {
|
||||
SessionPrefs.setVkBridge(activity, true)
|
||||
SessionPrefs.setMaliFallbackByAuto(activity, ownership)
|
||||
} else if (!venus) {
|
||||
val venusOff = SessionPrefs.venus(activity) && !venusByUser
|
||||
val bridgeOn = !SessionPrefs.vkBridge(activity)
|
||||
if (venusOff) SessionPrefs.clearVenus(activity)
|
||||
if (bridgeOn) SessionPrefs.setVkBridge(activity, true)
|
||||
if (venusOff || bridgeOn || ownership != MaliAutoRoute.NONE) SessionPrefs.setMaliFallbackByAuto(activity, ownership)
|
||||
} else if (ownership != MaliAutoRoute.NONE) {
|
||||
SessionPrefs.setMaliFallbackByAuto(activity, ownership)
|
||||
}
|
||||
@@ -467,7 +474,7 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
||||
/** A pair is installed for this Mali: the route Auto switched on in its place goes off again. */
|
||||
private fun endMaliFallback() {
|
||||
when (SessionPrefs.maliFallbackByAuto(activity)) {
|
||||
"venus" -> SessionPrefs.setVenus(activity, false)
|
||||
"venus" -> SessionPrefs.clearVenus(activity)
|
||||
"bridge" -> SessionPrefs.setVkBridge(activity, false)
|
||||
else -> return
|
||||
}
|
||||
|
||||
@@ -947,6 +947,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
}
|
||||
|
||||
private fun readGameIntent(request: Intent) {
|
||||
com.droiddeck.launcher.session.DesktopLock.handoff(request)?.let(::askHandoff)
|
||||
request.getStringExtra(com.droiddeck.launcher.stores.download.StoreDownloadService.EXTRA_NAV)?.let { navRequest = it; request.removeExtra(com.droiddeck.launcher.stores.download.StoreDownloadService.EXTRA_NAV) }
|
||||
request.data?.takeIf { it.scheme == "droiddeck" && it.host == "settings" }?.let { uri ->
|
||||
val section = uri.pathSegments.firstOrNull()
|
||||
@@ -1267,13 +1268,18 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
awaitSessionEnd(next, android.os.SystemClock.uptimeMillis() + SESSION_SWITCH_WAIT_MS)
|
||||
}
|
||||
|
||||
private fun awaitSessionEnd(next: Intent, deadline: Long) {
|
||||
private fun awaitSessionEnd(next: Intent, deadline: Long, source: String? = next.getStringExtra(com.droiddeck.launcher.session.DesktopLock.EXTRA_UNLOCK_SOURCE)) {
|
||||
switchingTo = next
|
||||
switchDeadline = deadline
|
||||
switchPoll?.let { ui.removeCallbacks(it) }
|
||||
val poll = object : Runnable {
|
||||
override fun run() {
|
||||
if (isDestroyed) return
|
||||
if (source != null && SessionState.sessionId != source) {
|
||||
switchPoll = null
|
||||
switchingTo = null
|
||||
return
|
||||
}
|
||||
if (SessionState.running || SessionState.phase !in SESSION_ENDED) {
|
||||
if (android.os.SystemClock.uptimeMillis() < deadline) ui.postDelayed(this, SESSION_SWITCH_POLL_MS)
|
||||
else {
|
||||
@@ -1505,9 +1511,11 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
)
|
||||
},
|
||||
onPlayDesktopUi = {
|
||||
startSession(Intent(this, SessionActivity::class.java)
|
||||
.putExtra(SessionService.EXTRA_MODE, SessionService.MODE_STEAM)
|
||||
.putExtra(SessionService.EXTRA_STEAM_UI, "desktop"), steamSession = true)
|
||||
whenUnlocked {
|
||||
startSession(Intent(this, SessionActivity::class.java)
|
||||
.putExtra(SessionService.EXTRA_MODE, SessionService.MODE_STEAM)
|
||||
.putExtra(SessionService.EXTRA_STEAM_UI, "desktop"), steamSession = true)
|
||||
}
|
||||
},
|
||||
onSteamGame = { g ->
|
||||
if (shortcutPicker) chooseGameShortcut(g)
|
||||
@@ -1572,26 +1580,11 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
(getSystemService(CLIPBOARD_SERVICE) as ClipboardManager).setPrimaryClip(ClipData.newPlainText(g.name, link))
|
||||
android.widget.Toast.makeText(this, R.string.game_link_copied, android.widget.Toast.LENGTH_SHORT).show()
|
||||
},
|
||||
onDesktop = {
|
||||
startSession(Intent(this, SessionActivity::class.java)
|
||||
.putExtra(SessionService.EXTRA_MODE, SessionService.MODE_DESKTOP))
|
||||
},
|
||||
onDesktop = { startDesktopSession() },
|
||||
onEmulator = { e -> launchProgram(e.program) },
|
||||
onUserApp = { app ->
|
||||
app.args.firstOrNull()?.let { Library.flatpakNames[it] = app.name }
|
||||
startActivity(Intent(this, SessionActivity::class.java)
|
||||
.putExtra(SessionService.EXTRA_MODE, SessionService.MODE_RUN)
|
||||
.putExtra(SessionService.EXTRA_PROGRAM, app.program)
|
||||
.putExtra(SessionService.EXTRA_PROGRAM_ARGS, app.args.toTypedArray()))
|
||||
},
|
||||
onUserApp = { app -> whenUnlocked { openUserApp(app) } },
|
||||
onBattleNet = { openBattleNet() },
|
||||
onFlatpakApp = { id, name ->
|
||||
Library.flatpakNames[id] = name
|
||||
startActivity(Intent(this, SessionActivity::class.java)
|
||||
.putExtra(SessionService.EXTRA_MODE, SessionService.MODE_RUN)
|
||||
.putExtra(SessionService.EXTRA_PROGRAM, com.droiddeck.launcher.runtime.FlatpakManager.LAUNCHER)
|
||||
.putExtra(SessionService.EXTRA_PROGRAM_ARGS, arrayOf(id)))
|
||||
},
|
||||
onFlatpakApp = { id, name -> whenUnlocked { openFlatpakApp(id, name) } },
|
||||
onRom = { g ->
|
||||
val e = emulatorList.first { it.id == g.emulatorId }
|
||||
if (!SessionPrefs.soundtracksIngame(this)) com.droiddeck.launcher.playback.SoundtrackController.pause(this)
|
||||
@@ -1951,6 +1944,15 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
onConfirm = { showRemove = false; removeRuntime() },
|
||||
onDismiss = { showRemove = false },
|
||||
)
|
||||
pinAsk?.let { ask ->
|
||||
androidx.compose.runtime.key(ask) {
|
||||
com.droiddeck.launcher.ui.TextEntryDialog(
|
||||
title = androidx.compose.ui.res.stringResource(ask.title), initial = "", number = true, secret = true,
|
||||
confirm = androidx.compose.ui.res.stringResource(R.string.common_ok),
|
||||
onSubmit = { pin -> if (pinAsk === ask) { pinAsk = null; ask.onPin(pin) } }, onDismiss = { if (pinAsk === ask) { pinAsk = null; ask.onCancel() } }, id = "desktop-lock",
|
||||
)
|
||||
}
|
||||
}
|
||||
lowSpace?.let { free ->
|
||||
com.droiddeck.launcher.ui.LowSpaceDialog(
|
||||
free,
|
||||
@@ -1993,25 +1995,17 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
}
|
||||
}
|
||||
|
||||
val askAllFiles = Build.VERSION.SDK_INT >= 30 && com.droiddeck.launcher.files.AllFilesAccess.missing() &&
|
||||
!SessionPrefs.allFilesAsked(this)
|
||||
if (savedInstanceState == null) {
|
||||
if (!askAllFiles) ui.post { startSteamAtStartupIfEnabled(cold = true) }
|
||||
}
|
||||
if (savedInstanceState == null) ui.post { startSteamAtStartupIfEnabled(cold = true) }
|
||||
saved?.let { state ->
|
||||
restoreCompatLaunch(state)
|
||||
pendingSwitch = savedIntent(state, KEY_PENDING_SWITCH)
|
||||
restorePendingUnlock(state)
|
||||
savedIntent(state, KEY_SWITCHING_TO)?.let { awaitSessionEnd(it, state.getLong(KEY_SWITCH_DEADLINE)) }
|
||||
}
|
||||
|
||||
val wanted = ArrayList<String>()
|
||||
if (Build.VERSION.SDK_INT >= 30) {
|
||||
// From targetSdk 30, shared storage outside the app's own folders is all-files access or nothing.
|
||||
if (askAllFiles) {
|
||||
SessionPrefs.setAllFilesAsked(this)
|
||||
com.droiddeck.launcher.files.AllFilesAccess.open(this)
|
||||
}
|
||||
} else if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||
// From Android 11, shared storage outside the app's own folders is all-files access, which the file picker asks for when a shared drive is opened.
|
||||
if (Build.VERSION.SDK_INT < 30 && checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||
wanted.add(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
}
|
||||
if (SessionPrefs.micEnabled(this) && !SessionPrefs.micAsked(this)
|
||||
@@ -2020,6 +2014,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
SessionPrefs.setMicAsked(this)
|
||||
}
|
||||
if (wanted.isNotEmpty()) requestPermissions(wanted.toTypedArray(), 1)
|
||||
com.droiddeck.launcher.session.Onboarding.onFirstRunReady = firstRunReady
|
||||
Thread({ com.droiddeck.launcher.stores.StoreAccounts.encryptAll(this) }, "store-credentials").start()
|
||||
if (!SessionState.running) Thread({
|
||||
com.droiddeck.launcher.session.LogMigration.run(this)
|
||||
@@ -2054,6 +2049,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
/** A replacement activity intent supersedes anything this activity has not dispatched yet. */
|
||||
private fun supersedeUncommittedLaunch() {
|
||||
launchCoordinator.cancelAll()
|
||||
pinAsk = null
|
||||
pendingUnlock = null
|
||||
}
|
||||
|
||||
private var soundtrackLaunch = false
|
||||
@@ -2063,16 +2060,108 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
private val battleNetHook: (List<String>) -> Unit = { args -> openBattleNet(args) }
|
||||
|
||||
private fun startSteamAtStartupIfEnabled(cold: Boolean = false) {
|
||||
if (soundtrackLaunch || intent.getBooleanExtra(EXTRA_RESTARTED, false)) return
|
||||
if (soundtrackLaunch || pendingUnlock != null || intent.getBooleanExtra(EXTRA_RESTARTED, false)) return
|
||||
if (intent.action != Intent.ACTION_MAIN && !(cold && intent.action == null)) return
|
||||
if (isFinishing || isDestroyed) return
|
||||
when (SessionPrefs.startupSession(this)) {
|
||||
SessionPrefs.STARTUP_STEAM -> startSteamSession()
|
||||
SessionPrefs.STARTUP_DESKTOP -> startSession(Intent(this, SessionActivity::class.java)
|
||||
.putExtra(SessionService.EXTRA_MODE, SessionService.MODE_DESKTOP))
|
||||
SessionPrefs.STARTUP_DESKTOP -> startDesktopSession()
|
||||
}
|
||||
}
|
||||
|
||||
private class PinAsk(@androidx.annotation.StringRes val title: Int, val onCancel: () -> Unit = {}, val onPin: (String) -> Unit)
|
||||
|
||||
private var activePinAsk by mutableStateOf<PinAsk?>(null)
|
||||
private var pinGeneration = 0
|
||||
private var pinAsk: PinAsk?
|
||||
get() = activePinAsk
|
||||
set(value) { pinGeneration++; activePinAsk = value }
|
||||
|
||||
private fun pinWork(work: () -> Boolean, onFailure: () -> Unit = {}, done: (Boolean) -> Unit) {
|
||||
val generation = pinGeneration
|
||||
Thread({
|
||||
val result = runCatching(work)
|
||||
ui.post {
|
||||
if (!isDestroyed && !isFinishing && generation == pinGeneration) {
|
||||
result.fold(done) { onFailure(); pinToast(R.string.game_env_error) }
|
||||
}
|
||||
}
|
||||
}, "desktop-pin").start()
|
||||
}
|
||||
private var desktopLock by mutableStateOf(false)
|
||||
private var pendingUnlock: com.droiddeck.launcher.session.DesktopLock.Handoff? = null
|
||||
|
||||
private fun pinToast(@androidx.annotation.StringRes text: Int) =
|
||||
android.widget.Toast.makeText(this, text, android.widget.Toast.LENGTH_SHORT).show()
|
||||
|
||||
private fun whenUnlocked(action: () -> Unit) {
|
||||
if (!com.droiddeck.launcher.session.DesktopLock.enabled(this)) return action()
|
||||
pinAsk = PinAsk(R.string.desktop_lock_enter) { pin ->
|
||||
pinWork({ com.droiddeck.launcher.session.DesktopLock.matches(this, pin) }) { matched ->
|
||||
if (matched) action() else pinToast(R.string.desktop_lock_wrong)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun askHandoff(request: com.droiddeck.launcher.session.DesktopLock.Handoff) {
|
||||
if (!com.droiddeck.launcher.session.DesktopLock.enabled(this)) {
|
||||
pendingUnlock = null
|
||||
return
|
||||
}
|
||||
pendingUnlock = request
|
||||
pinAsk = PinAsk(R.string.desktop_lock_enter, onCancel = { if (pendingUnlock === request) pendingUnlock = null }) { pin ->
|
||||
pinWork({ com.droiddeck.launcher.session.DesktopLock.matches(this, pin) },
|
||||
onFailure = { if (pendingUnlock === request) pendingUnlock = null }) { matched ->
|
||||
if (pendingUnlock !== request) return@pinWork
|
||||
pendingUnlock = null
|
||||
if (!matched) pinToast(R.string.desktop_lock_wrong)
|
||||
else if (com.droiddeck.launcher.session.DesktopLock.currentSession(request.source, SessionState.sessionId, SessionState.running)) {
|
||||
SessionService.stop(this, request.source)
|
||||
awaitSessionEnd(request.session(this), android.os.SystemClock.uptimeMillis() + SESSION_SWITCH_WAIT_MS, request.source)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun toggleDesktopLock(on: Boolean) {
|
||||
val lock = com.droiddeck.launcher.session.DesktopLock
|
||||
desktopLock = lock.enabled(this)
|
||||
if (on == desktopLock) return
|
||||
pinAsk = if (on) PinAsk(R.string.desktop_lock_new) { pin ->
|
||||
if (!lock.validPin(pin)) pinToast(R.string.desktop_lock_invalid)
|
||||
else pinAsk = PinAsk(R.string.desktop_lock_confirm) { again ->
|
||||
if (again != pin) pinToast(R.string.desktop_lock_mismatch)
|
||||
else pinWork({ lock.set(this, pin) }) { desktopLock = lock.enabled(this) }
|
||||
}
|
||||
} else PinAsk(R.string.desktop_lock_enter) { pin ->
|
||||
pinWork({ lock.clear(this, pin) }) { cleared ->
|
||||
desktopLock = lock.enabled(this)
|
||||
if (!cleared) pinToast(R.string.desktop_lock_wrong)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun startDesktopSession() = whenUnlocked {
|
||||
startSession(Intent(this, SessionActivity::class.java)
|
||||
.putExtra(SessionService.EXTRA_MODE, SessionService.MODE_DESKTOP))
|
||||
}
|
||||
|
||||
private fun openUserApp(app: com.droiddeck.launcher.runtime.UserApps.App) {
|
||||
app.args.firstOrNull()?.let { Library.flatpakNames[it] = app.name }
|
||||
startActivity(Intent(this, SessionActivity::class.java)
|
||||
.putExtra(SessionService.EXTRA_MODE, SessionService.MODE_RUN)
|
||||
.putExtra(SessionService.EXTRA_PROGRAM, app.program)
|
||||
.putExtra(SessionService.EXTRA_PROGRAM_ARGS, app.args.toTypedArray()))
|
||||
}
|
||||
|
||||
private fun openFlatpakApp(id: String, name: String) {
|
||||
Library.flatpakNames[id] = name
|
||||
startActivity(Intent(this, SessionActivity::class.java)
|
||||
.putExtra(SessionService.EXTRA_MODE, SessionService.MODE_RUN)
|
||||
.putExtra(SessionService.EXTRA_PROGRAM, com.droiddeck.launcher.runtime.FlatpakManager.LAUNCHER)
|
||||
.putExtra(SessionService.EXTRA_PROGRAM_ARGS, arrayOf(id)))
|
||||
}
|
||||
|
||||
private fun playSteam() {
|
||||
val storage = com.droiddeck.launcher.storage.StorageState
|
||||
val free = storage.freeBytes(this)
|
||||
@@ -2299,7 +2388,22 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
return super.dispatchGenericMotionEvent(event)
|
||||
}
|
||||
|
||||
@Volatile private var inFront = false
|
||||
private var autoSteamPending = false
|
||||
|
||||
/** Runs on the worker thread that finishes setup, so the foreground state is read as setup completes, not when the UI thread gets to it. */
|
||||
private val firstRunReady: () -> Unit = {
|
||||
val front = inFront
|
||||
runOnUiThread { if (front) autoStartSteam() }
|
||||
}
|
||||
|
||||
private fun autoStartSteam() {
|
||||
if (isFinishing || isDestroyed || SessionState.running || !inFront) return
|
||||
if (busy) autoSteamPending = true else playSteam()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
inFront = false
|
||||
stopRightStickScroll()
|
||||
compatLaunchVisible = false
|
||||
if (android.os.Build.VERSION.SDK_INT >= 29) com.droiddeck.launcher.ui.DualScreenPanel.ownerPaused(taskId, true)
|
||||
@@ -2308,6 +2412,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
inFront = true
|
||||
if (!homeChoiceOpen) {
|
||||
HomeApp.releaseUnusedHomeEntry(this)
|
||||
refreshHomeAppState()
|
||||
@@ -2384,6 +2489,20 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
refreshSecondScreenDisplays()
|
||||
getSystemService(android.content.pm.LauncherApps::class.java).registerCallback(packageCallback, ui)
|
||||
HomeWidgets.startListening(this)
|
||||
resumePinPrompt()
|
||||
}
|
||||
|
||||
private fun restorePendingUnlock(state: Bundle) {
|
||||
com.droiddeck.launcher.session.DesktopLock.handoff(state.getString(KEY_UNLOCK_MODE),
|
||||
state.getString(KEY_UNLOCK_UI), state.getString(KEY_UNLOCK_URL))?.copy(source = state.getString(KEY_UNLOCK_SOURCE))?.let(::askHandoff)
|
||||
}
|
||||
|
||||
private fun resumePinPrompt() {
|
||||
pendingUnlock?.let(::askHandoff)
|
||||
}
|
||||
|
||||
private fun stopPinPrompt() {
|
||||
pinAsk = null
|
||||
}
|
||||
|
||||
@Suppress("OVERRIDE_DEPRECATION")
|
||||
@@ -2410,6 +2529,12 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
if (slowUsbNever) SessionPrefs.setSlowUsbWarningOff(this)
|
||||
saveCompatLaunch(outState)
|
||||
pendingSwitch?.let { outState.putParcelable(KEY_PENDING_SWITCH, it) }
|
||||
pendingUnlock?.let {
|
||||
outState.putString(KEY_UNLOCK_MODE, it.mode)
|
||||
outState.putString(KEY_UNLOCK_UI, it.ui)
|
||||
outState.putString(KEY_UNLOCK_URL, it.url)
|
||||
outState.putString(KEY_UNLOCK_SOURCE, it.source)
|
||||
}
|
||||
switchingTo?.let {
|
||||
outState.putParcelable(KEY_SWITCHING_TO, it)
|
||||
outState.putLong(KEY_SWITCH_DEADLINE, switchDeadline)
|
||||
@@ -2443,6 +2568,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
|
||||
override fun onDestroy() {
|
||||
// The queued launch was saved before this; a restored activity keeps its copy, and this one must not start it too.
|
||||
if (com.droiddeck.launcher.session.Onboarding.onFirstRunReady === firstRunReady) com.droiddeck.launcher.session.Onboarding.onFirstRunReady = null
|
||||
queuedLaunchRunner.destroy()
|
||||
triggerKeys.cancel()
|
||||
launchCoordinator.cancelAll()
|
||||
@@ -2458,6 +2584,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
stopPinPrompt()
|
||||
if (!homeChoiceOpen) HomeApp.releaseUnusedHomeEntry(this)
|
||||
unregisterReceiver(wifiLocationReceiver)
|
||||
unregisterReceiver(dateReceiver)
|
||||
@@ -2889,6 +3016,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
mangoapp = mangoapp,
|
||||
steamController = if (mode == SessionService.MODE_STEAM) steamController else null,
|
||||
startupSession = startupSession,
|
||||
desktopLock = desktopLock,
|
||||
bootMovie = if (mode == SessionService.MODE_STEAM) bootMovie else null,
|
||||
bootMovieSound = bootMovieSound,
|
||||
bootMovieCustomName = bootMovieCustomName,
|
||||
@@ -2994,6 +3122,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
onShaderPrecache = { on -> SessionPrefs.setShaderPrecache(this, on); shaderPrecache = on },
|
||||
onValveProtonOnDemand = { on -> SessionPrefs.setValveProtonOnDemand(this, on); valveProtonOnDemand = on },
|
||||
onSteamController = { id -> SessionPrefs.setSteamController(this, id); steamController = id },
|
||||
onDesktopLock = { on -> toggleDesktopLock(on) },
|
||||
onStartupSession = { id ->
|
||||
SessionPrefs.setStartupSession(this, id)
|
||||
startupSession = id
|
||||
@@ -3273,6 +3402,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
loadShaderPrecache(mode)
|
||||
steamController = SessionPrefs.steamController(this)
|
||||
startupSession = SessionPrefs.startupSession(this)
|
||||
desktopLock = com.droiddeck.launcher.session.DesktopLock.enabled(this)
|
||||
loadBootMovie()
|
||||
hdrOn = SessionPrefs.hdr(this, mode)
|
||||
zeroCopyOn = SessionPrefs.zeroCopy(this, mode)
|
||||
@@ -3742,6 +3872,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
refresh()
|
||||
com.droiddeck.launcher.agent.AgentHost.refresh(this)
|
||||
if (ok == true && LinuxRuntime.isInstalled(this)) { protons.checkUpdates(); protons.ensureSteamClient() }
|
||||
if (autoSteamPending) { autoSteamPending = false; autoStartSteam() }
|
||||
}
|
||||
}, "runtime-operation").start()
|
||||
}
|
||||
@@ -3795,6 +3926,10 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
private const val KEY_COMPAT_PROBLEM = "compat_problem"
|
||||
private const val KEY_SWITCHING_TO = "switching_to"
|
||||
private const val KEY_SWITCH_DEADLINE = "switch_deadline"
|
||||
private const val KEY_UNLOCK_MODE = "desktop_unlock_mode"
|
||||
private const val KEY_UNLOCK_UI = "desktop_unlock_ui"
|
||||
private const val KEY_UNLOCK_SOURCE = "desktop_unlock_source"
|
||||
private const val KEY_UNLOCK_URL = "desktop_unlock_url"
|
||||
private val SESSION_ENDED = setOf(SessionPhase.IDLE, SessionPhase.FAILED)
|
||||
private val ZIP_EXT = listOf("zip")
|
||||
private val EXPERIMENTAL_PROTON_EXT = listOf("zip", "7z", "tar", "gz", "xz", "zst", "bz2", "tgz", "txz", "tbz2", "tzst")
|
||||
|
||||
@@ -26,6 +26,12 @@ internal object MaliAutoRoute {
|
||||
|
||||
fun userChoice(keyStored: Boolean, owner: String, route: String): Boolean = keyStored && owner != route
|
||||
|
||||
fun venusStandsIn(available: Boolean, hostVulkanOk: Boolean, venusOn: Boolean, venusExplicit: Boolean, gpuName: String): Boolean =
|
||||
available && hostVulkanOk && if (venusExplicit) venusOn else !venusStallsOn(gpuName)
|
||||
|
||||
// Steam's web helper dies on its first window through Venus on these (#2879), so the bridge stands in.
|
||||
fun venusStallsOn(gpuName: String): Boolean = gpuName.contains("G2-Ultra", ignoreCase = true)
|
||||
|
||||
fun shouldEnd(ownsRoute: String, mali: Boolean, installedPair: Boolean): Boolean =
|
||||
mali && installedPair && ownsRoute != NONE
|
||||
}
|
||||
@@ -1598,7 +1598,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
?.let(com.droiddeck.launcher.input.DualScreen::builtIn) ?: true,
|
||||
onGameOnBottom = { on -> drawerOpen = false; putGameOnBottom(on) },
|
||||
dashboardAvailable = bottomPages().isNotEmpty(),
|
||||
desktopAvailable = com.droiddeck.launcher.session.BottomDesktop.available(),
|
||||
desktopAvailable = com.droiddeck.launcher.session.BottomDesktop.available(this@SessionActivity),
|
||||
secondScreenDisplays = secondScreenDisplays,
|
||||
selectedSecondScreenDisplay = selectedSecondScreenDisplay,
|
||||
onHud = { on -> SessionPrefs.setHudEnabled(this@SessionActivity, on); hudOn = on; hud.refresh() },
|
||||
@@ -3888,7 +3888,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
else -> return super.dispatchGenericMotionEvent(event)
|
||||
}
|
||||
if (com.droiddeck.launcher.input.PointerCapture.isMouse(event) && !drawerOpen) {
|
||||
if ((event.isFromSource(android.view.InputDevice.SOURCE_MOUSE) ||
|
||||
event.isFromSource(android.view.InputDevice.SOURCE_TOUCHPAD)) && !drawerOpen) {
|
||||
if (appUiOwnsPointer()) {
|
||||
if (super.dispatchGenericMotionEvent(event)) return true
|
||||
if (touchEditorOpen) return false
|
||||
@@ -4508,7 +4509,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
// A game's own panel counts as applied, so the next game without one returns to the global choice.
|
||||
if (saved != null) gamePanelApplied = true
|
||||
return SecondScreenMode.opening(saved ?: SessionPrefs.secondScreenPanel(this, desktopSession), SessionState.deckPad,
|
||||
bottomPages().isNotEmpty(), com.droiddeck.launcher.session.BottomDesktop.available(), SessionState.mode == SessionService.MODE_STEAM)
|
||||
bottomPages().isNotEmpty(), com.droiddeck.launcher.session.BottomDesktop.available(this@SessionActivity), SessionState.mode == SessionService.MODE_STEAM)
|
||||
}
|
||||
|
||||
private fun openingSurface() = openingPanel().takeIf { it != SecondScreenMode.MENU } ?: SecondScreenMode.KEYBOARD_TRACKPAD
|
||||
@@ -4619,12 +4620,12 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
|
||||
private fun showSecondScreen(requested: SecondScreenMode) {
|
||||
if (pipUi || !started) return
|
||||
val mode = when {
|
||||
val mode = availablePanel(when {
|
||||
requested == SecondScreenMode.MENU ->
|
||||
secondScreenMode.takeIf { it != SecondScreenMode.NONE && it != SecondScreenMode.MENU } ?: SecondScreenMode.KEYBOARD_TRACKPAD
|
||||
requested == SecondScreenMode.DECK_CONTROLS && !SessionState.deckPad -> openingSurface()
|
||||
else -> requested
|
||||
}
|
||||
})
|
||||
val target = displayManager.getDisplay(selectedSecondScreenDisplay)
|
||||
if (target == null || !target.isValid || (target.flags and Display.FLAG_PRESENTATION) == 0) {
|
||||
closeSecondScreen(reset = false)
|
||||
@@ -4684,7 +4685,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
val remembered = game?.let { bottomGameKey() }?.let { SessionPrefs.gameSecondScreenPanel(this, it) }
|
||||
val wanted = when {
|
||||
remembered != null -> SecondScreenMode.opening(remembered, SessionState.deckPad, bottomPages().isNotEmpty(),
|
||||
com.droiddeck.launcher.session.BottomDesktop.available(), SessionState.mode == SessionService.MODE_STEAM)
|
||||
com.droiddeck.launcher.session.BottomDesktop.available(this@SessionActivity), SessionState.mode == SessionService.MODE_STEAM)
|
||||
gamePanelApplied -> openingPanel()
|
||||
else -> return
|
||||
}
|
||||
@@ -4694,7 +4695,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
|
||||
private fun bottomScreenPicker(mode: SecondScreenMode) = com.droiddeck.launcher.ui.ScreenPicker(
|
||||
com.droiddeck.launcher.ui.secondScreenModes(false, SessionState.deckPad, bottomPages().isNotEmpty(),
|
||||
com.droiddeck.launcher.session.BottomDesktop.available()),
|
||||
com.droiddeck.launcher.session.BottomDesktop.available(this@SessionActivity)),
|
||||
mode, ::pickSecondScreenMode, onMenu = ::pickMenuMode,
|
||||
)
|
||||
|
||||
@@ -5202,7 +5203,18 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
}
|
||||
|
||||
private fun panelMode(mode: SecondScreenMode) {
|
||||
private fun availablePanel(mode: SecondScreenMode): SecondScreenMode =
|
||||
if (mode == SecondScreenMode.DESKTOP && !com.droiddeck.launcher.session.BottomDesktop.available(this)) openingSurface() else mode
|
||||
|
||||
private fun refreshAvailablePanel() {
|
||||
val mode = availablePanel(secondScreenMode)
|
||||
if (mode == secondScreenMode) return
|
||||
panelMode(mode)
|
||||
secondScreenPresentation?.showMode(mode)
|
||||
}
|
||||
|
||||
private fun panelMode(requested: SecondScreenMode) {
|
||||
val mode = availablePanel(requested)
|
||||
val rebind = secondScreenMode.panel(this) != mode.panel(this)
|
||||
secondScreenMode = mode
|
||||
SessionState.secondScreenMode = mode
|
||||
@@ -5400,7 +5412,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private fun handleTouch(event: MotionEvent): Boolean {
|
||||
val pen = PenStream.penIndex(event)
|
||||
val penRouted = if (pen >= 0) routePen(event, pen).takeIf { it != PenRouter.Route.TOUCH } else null
|
||||
if (penRouted == null && com.droiddeck.launcher.input.PointerCapture.isMouse(event)) return onMouse(event)
|
||||
if (penRouted == null && (event.isFromSource(android.view.InputDevice.SOURCE_MOUSE) ||
|
||||
event.isFromSource(android.view.InputDevice.SOURCE_TOUCHPAD))) return onMouse(event)
|
||||
when (event.actionMasked) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
sessionTouchDown = true
|
||||
@@ -6297,6 +6310,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
for (name in arrayOf("peak_refresh_rate", "min_refresh_rate")) {
|
||||
contentResolver.registerContentObserver(android.provider.Settings.System.getUriFor(name), false, refreshSettingObserver)
|
||||
}
|
||||
refreshAvailablePanel()
|
||||
reconcileDock(shownOnDisplayId)
|
||||
settleDualScreenControls()
|
||||
refreshSecondScreenDisplays()
|
||||
@@ -6832,8 +6846,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
|
||||
private fun onBottomGameHover(event: MotionEvent): Boolean {
|
||||
val pen = PenStream.penIndex(event)
|
||||
if (pipUi) return false
|
||||
if (pen < 0) return onBottomGameMouse(event)
|
||||
if (pipUi || pen < 0) return false
|
||||
return when (routePen(event, pen)) {
|
||||
PenRouter.Route.TOUCH -> false
|
||||
PenRouter.Route.PEN -> {
|
||||
@@ -6845,16 +6858,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
}
|
||||
|
||||
private fun onBottomGameMouse(event: MotionEvent): Boolean {
|
||||
if (PenStream.penIndex(event) >= 0 || !com.droiddeck.launcher.input.PointerCapture.isMouse(event)) return false
|
||||
notePress(event)
|
||||
onMouse(event)
|
||||
return true
|
||||
}
|
||||
|
||||
private fun onBottomGameTouch(event: MotionEvent): Boolean {
|
||||
if (pipUi) return true
|
||||
if (onBottomGameMouse(event)) return true
|
||||
if (!event.isFromSource(InputDevice.SOURCE_TOUCHSCREEN) && PenStream.penIndex(event) < 0) return false
|
||||
notePress(event)
|
||||
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
|
||||
@@ -6886,7 +6891,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
.pointerInput(Unit) { awaitPointerEventScope { while (true) awaitPointerEvent() } },
|
||||
) {
|
||||
when {
|
||||
secondScreenMode == SecondScreenMode.DESKTOP && com.droiddeck.launcher.session.BottomDesktop.available() ->
|
||||
secondScreenMode == SecondScreenMode.DESKTOP && com.droiddeck.launcher.session.BottomDesktop.available(this@SessionActivity) ->
|
||||
androidx.compose.ui.viewinterop.AndroidView(
|
||||
factory = { context ->
|
||||
com.droiddeck.launcher.ui.BottomDesktopPanel(context, openMenu, openMenu,
|
||||
|
||||
@@ -8,9 +8,18 @@ import android.os.Environment
|
||||
import android.provider.Settings
|
||||
|
||||
object AllFilesAccess {
|
||||
private val VOLUME = Regex("^(/storage/emulated/\\d+|/storage/[^/]+|/sdcard)(/.*)?$")
|
||||
private val APP_FOLDERS = listOf("/Android/data", "/Android/obb")
|
||||
|
||||
fun missing(sdk: Int = Build.VERSION.SDK_INT, granted: () -> Boolean = { Environment.isExternalStorageManager() }): Boolean =
|
||||
sdk >= Build.VERSION_CODES.R && !granted()
|
||||
|
||||
/** Whether reading [path] takes all-files access: shared storage, outside the per-app folders directly under a volume's root, which Android always lets the app use. */
|
||||
fun covers(path: String): Boolean {
|
||||
val inside = VOLUME.matchEntire(path)?.groupValues?.get(2) ?: return false
|
||||
return APP_FOLDERS.none { inside == it || inside.startsWith("$it/") }
|
||||
}
|
||||
|
||||
fun open(context: Context) {
|
||||
val app = Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION, Uri.parse("package:" + context.packageName))
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
|
||||
@@ -504,13 +504,15 @@ fun FileManagerScreen(
|
||||
}
|
||||
val drives = remember(storageTick) { StorageRoots.list(context) }
|
||||
var accessDrive by remember { mutableStateOf<String?>(null) }
|
||||
var accessWasMissing by remember { mutableStateOf(AllFilesAccess.missing()) }
|
||||
var accessDeclined by remember { mutableStateOf(false) }
|
||||
fun unreadable(drive: StorageRoot) {
|
||||
if (AllFilesAccess.missing()) accessDrive = drive.label
|
||||
else Toast.makeText(context, context.getString(R.string.fm_drive_not_readable, drive.label), Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
accessDrive?.let { label ->
|
||||
OutlinedAlertDialog(
|
||||
onDismissRequest = { accessDrive = null },
|
||||
onDismissRequest = { accessDrive = null; accessDeclined = true },
|
||||
title = { Text(stringResource(R.string.fm_drive_access_title, label)) },
|
||||
text = { Text(stringResource(R.string.fm_drive_access_text)) },
|
||||
confirmButton = {
|
||||
@@ -519,9 +521,17 @@ fun FileManagerScreen(
|
||||
AllFilesAccess.open(context)
|
||||
}, modifier = Modifier.focusGlide(CircleShape)) { Text(stringResource(R.string.upd_open_settings)) }
|
||||
},
|
||||
dismissButton = { TextButton(onClick = { accessDrive = null }, modifier = Modifier.focusGlide(CircleShape)) { Text(stringResource(R.string.common_cancel)) } },
|
||||
dismissButton = { TextButton(onClick = { accessDrive = null; accessDeclined = true }, modifier = Modifier.focusGlide(CircleShape)) { Text(stringResource(R.string.common_cancel)) } },
|
||||
)
|
||||
}
|
||||
LaunchedEffect(currentDir, storageTick) {
|
||||
if (!AllFilesAccess.missing()) {
|
||||
if (accessWasMissing) { accessWasMissing = false; loadDirectory(currentDir, resetScroll = false, record = false) }
|
||||
} else {
|
||||
accessWasMissing = true
|
||||
if (!accessDeclined && accessDrive == null && AllFilesAccess.covers(currentDir.path)) accessDrive = drives.firstOrNull { currentDir.path.startsWith(it.dir.path) }?.label ?: context.getString(R.string.fm_drive_internal)
|
||||
}
|
||||
}
|
||||
val linuxRoot = remember(storageTick) {
|
||||
com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(context).takeIf { File(it, "usr").isDirectory }
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public final class PadBridge {
|
||||
private final PadState[] playerStates = new PadState[SLOTS];
|
||||
private final float[][] rawSticks = new float[SLOTS][4];
|
||||
private final Map<Integer, Boolean> rightStickLayouts = new HashMap<>();
|
||||
private final boolean[][] keyTriggers = new boolean[SLOTS][2];
|
||||
private final TriggerKey[][] keyTriggers = TriggerKey.slots(SLOTS);
|
||||
private final int[] retainedSticks = new int[SLOTS];
|
||||
private final PadState effectiveState = new PadState();
|
||||
private final PadState homeGuideReport = new PadState();
|
||||
@@ -484,7 +484,7 @@ public final class PadBridge {
|
||||
stateFor(slot).clear();
|
||||
retainedSticks[slot] = 0;
|
||||
Arrays.fill(rawSticks[slot], 0f);
|
||||
Arrays.fill(keyTriggers[slot], false);
|
||||
for (TriggerKey key : keyTriggers[slot]) key.reset();
|
||||
}
|
||||
|
||||
private void mutateState(java.util.function.Consumer<PadState> mutation) {
|
||||
@@ -570,26 +570,76 @@ public final class PadBridge {
|
||||
return true;
|
||||
}
|
||||
|
||||
static float keyTrigger(float current, boolean pressed, int repeatCount, boolean analog, boolean[] held, int side) {
|
||||
static final class TriggerKey {
|
||||
static final float RELEASE_FROM_PEAK = 0.05f;
|
||||
boolean held;
|
||||
boolean handoff;
|
||||
boolean axisLive;
|
||||
boolean axisMovedWhilePressed;
|
||||
float peak;
|
||||
float axis;
|
||||
|
||||
static TriggerKey[][] slots(int count) {
|
||||
TriggerKey[][] keys = new TriggerKey[count][2];
|
||||
for (TriggerKey[] pair : keys) {
|
||||
pair[0] = new TriggerKey();
|
||||
pair[1] = new TriggerKey();
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
|
||||
void reset() {
|
||||
held = false;
|
||||
handoff = false;
|
||||
axisLive = false;
|
||||
axisMovedWhilePressed = false;
|
||||
peak = 0f;
|
||||
axis = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
static float keyTrigger(float current, boolean pressed, int repeatCount, boolean analog, TriggerKey[] keys, int side) {
|
||||
TriggerKey key = keys[side];
|
||||
if (repeatCount > 0) return current;
|
||||
if (!analog) {
|
||||
held[side] = pressed;
|
||||
key.held = pressed;
|
||||
return pressed ? 1f : 0f;
|
||||
}
|
||||
if (pressed) {
|
||||
if (current != 0f) return current;
|
||||
held[side] = true;
|
||||
key.axisMovedWhilePressed = false;
|
||||
if (key.axisLive || current != 0f) return current;
|
||||
key.held = true;
|
||||
return 1f;
|
||||
}
|
||||
if (!held[side]) return current;
|
||||
held[side] = false;
|
||||
if (!key.axisMovedWhilePressed) key.axisLive = false;
|
||||
if (key.handoff) {
|
||||
key.handoff = false;
|
||||
return key.axis;
|
||||
}
|
||||
if (!key.held) return current;
|
||||
key.held = false;
|
||||
return 0f;
|
||||
}
|
||||
|
||||
static float axisTrigger(float value, boolean[] held, int side) {
|
||||
if (!held[side]) return value;
|
||||
if (value == 0f) return 1f;
|
||||
held[side] = false;
|
||||
static float axisTrigger(float value, TriggerKey[] keys, int side) {
|
||||
TriggerKey key = keys[side];
|
||||
key.axis = value;
|
||||
if (value != 0f) {
|
||||
key.axisLive = true;
|
||||
key.axisMovedWhilePressed = true;
|
||||
}
|
||||
if (key.held) {
|
||||
if (value == 0f) return 1f;
|
||||
key.held = false;
|
||||
key.handoff = true;
|
||||
key.peak = value;
|
||||
return 1f;
|
||||
}
|
||||
if (key.handoff) {
|
||||
key.peak = Math.max(key.peak, value);
|
||||
if (value > key.peak - TriggerKey.RELEASE_FROM_PEAK) return 1f;
|
||||
key.handoff = false;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,9 +10,6 @@ object PointerCapture {
|
||||
|
||||
fun isTouchpad(event: MotionEvent): Boolean = event.isFromSource(InputDevice.SOURCE_TOUCHPAD)
|
||||
|
||||
fun isMouse(event: MotionEvent): Boolean =
|
||||
event.isFromSource(InputDevice.SOURCE_MOUSE) || event.isFromSource(InputDevice.SOURCE_TOUCHPAD)
|
||||
|
||||
fun delta(event: MotionEvent): FloatArray {
|
||||
var dx = event.x
|
||||
var dy = event.y
|
||||
|
||||
@@ -100,8 +100,9 @@ object BottomDesktop {
|
||||
synchronized(launchLock) { if (stillCurrent()) launch = prepared }
|
||||
}
|
||||
|
||||
fun available(): Boolean =
|
||||
launch?.installed == true && SessionState.running && SessionState.mode != SessionService.MODE_DESKTOP
|
||||
fun available(context: android.content.Context): Boolean =
|
||||
launch?.installed == true && SessionState.running && SessionState.mode != SessionService.MODE_DESKTOP &&
|
||||
!DesktopLock.enabled(context)
|
||||
|
||||
fun outputSizeFor(width: Int, height: Int, fullResolution: Boolean = false): Pair<Int, Int> =
|
||||
desktopOutputSize(width, height, fullResolution, TARGET_SHORT_SIDE)
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import java.security.MessageDigest
|
||||
import java.security.SecureRandom
|
||||
import java.util.Base64
|
||||
import javax.crypto.SecretKeyFactory
|
||||
import javax.crypto.spec.PBEKeySpec
|
||||
|
||||
object DesktopLock {
|
||||
const val EXTRA_UNLOCK_MODE = "com.droiddeck.launcher.extra.DESKTOP_UNLOCK_MODE"
|
||||
const val EXTRA_UNLOCK_UI = "com.droiddeck.launcher.extra.DESKTOP_UNLOCK_UI"
|
||||
const val EXTRA_UNLOCK_URL = "com.droiddeck.launcher.extra.DESKTOP_UNLOCK_URL"
|
||||
const val EXTRA_UNLOCK_SOURCE = "com.droiddeck.launcher.extra.DESKTOP_UNLOCK_SOURCE"
|
||||
private const val PREFS = "desktop_lock"
|
||||
private const val SALT = "salt"
|
||||
private const val HASH = "hash"
|
||||
private const val ROUNDS = 20_000
|
||||
private val PIN = Regex("[0-9]{4,8}")
|
||||
private val UI = Regex("[a-z]{1,32}")
|
||||
|
||||
data class Handoff(val mode: String, val ui: String, val url: String, val source: String? = null) {
|
||||
fun put(intent: Intent): Intent = intent
|
||||
.putExtra(EXTRA_UNLOCK_MODE, mode)
|
||||
.putExtra(EXTRA_UNLOCK_UI, ui)
|
||||
.putExtra(EXTRA_UNLOCK_URL, url)
|
||||
.putExtra(EXTRA_UNLOCK_SOURCE, source)
|
||||
|
||||
fun session(context: Context): Intent {
|
||||
val next = Intent(context, com.droiddeck.launcher.SessionActivity::class.java)
|
||||
.putExtra(SessionService.EXTRA_MODE, mode)
|
||||
.putExtra(SessionService.EXTRA_STEAM_UI, ui)
|
||||
.putExtra(EXTRA_UNLOCK_SOURCE, source)
|
||||
if (url.isNotEmpty()) next.putExtra(SessionService.EXTRA_STEAM_URL, url)
|
||||
return next
|
||||
}
|
||||
}
|
||||
|
||||
fun handoff(mode: String?, ui: String?, url: String?): Handoff? {
|
||||
if (mode != SessionService.MODE_STEAM && mode != SessionService.MODE_DESKTOP) return null
|
||||
if (ui == null || !UI.matches(ui) || !entersDesktop(mode, ui)) return null
|
||||
val link = url.orEmpty()
|
||||
if (link.isNotEmpty() && !link.startsWith("steam://")) return null
|
||||
return Handoff(mode, ui, link)
|
||||
}
|
||||
|
||||
fun handoff(intent: Intent): Handoff? {
|
||||
if (!intent.hasExtra(EXTRA_UNLOCK_MODE)) return null
|
||||
val found = handoff(intent.getStringExtra(EXTRA_UNLOCK_MODE), intent.getStringExtra(EXTRA_UNLOCK_UI), intent.getStringExtra(EXTRA_UNLOCK_URL))
|
||||
val source = intent.getStringExtra(EXTRA_UNLOCK_SOURCE)
|
||||
intent.removeExtra(EXTRA_UNLOCK_SOURCE)
|
||||
intent.removeExtra(EXTRA_UNLOCK_MODE)
|
||||
intent.removeExtra(EXTRA_UNLOCK_UI)
|
||||
intent.removeExtra(EXTRA_UNLOCK_URL)
|
||||
return found?.copy(source = source)
|
||||
}
|
||||
|
||||
private fun prefs(context: Context): SharedPreferences = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
|
||||
|
||||
private data class Credentials(val salt: String?, val hash: String?)
|
||||
private val saved = java.util.concurrent.ConcurrentHashMap<SharedPreferences, Credentials>()
|
||||
|
||||
private fun credentials(p: SharedPreferences): Credentials = saved.computeIfAbsent(p) {
|
||||
Credentials(it.getString(SALT, null), it.getString(HASH, null))
|
||||
}
|
||||
|
||||
private fun write(p: SharedPreferences, next: Credentials): Boolean {
|
||||
val previous = credentials(p)
|
||||
if (!p.edit().putString(SALT, next.salt).putString(HASH, next.hash).commit()) {
|
||||
p.edit().putString(SALT, previous.salt).putString(HASH, previous.hash).commit()
|
||||
throw java.io.IOException()
|
||||
}
|
||||
saved[p] = next
|
||||
return true
|
||||
}
|
||||
|
||||
fun enabled(context: Context): Boolean = credentials(prefs(context)).hash != null
|
||||
|
||||
fun validPin(pin: String): Boolean = PIN.matches(pin)
|
||||
|
||||
fun requiresUnlock(enabled: Boolean, mode: String?, ui: String?): Boolean = enabled && entersDesktop(mode, ui)
|
||||
|
||||
fun currentSession(source: String?, current: String?, running: Boolean): Boolean =
|
||||
source != null && source == current && running
|
||||
|
||||
fun entersDesktop(mode: String?, steamUi: String?): Boolean =
|
||||
mode == SessionService.MODE_DESKTOP || steamUi == "desktop"
|
||||
|
||||
fun entersDesktop(intent: Intent): Boolean =
|
||||
entersDesktop(intent.getStringExtra(SessionService.EXTRA_MODE), intent.getStringExtra(SessionService.EXTRA_STEAM_UI))
|
||||
|
||||
@Synchronized
|
||||
fun set(context: Context, pin: String): Boolean {
|
||||
if (!validPin(pin)) return false
|
||||
val salt = ByteArray(16).also { SecureRandom().nextBytes(it) }
|
||||
return write(prefs(context), Credentials(Base64.getEncoder().encodeToString(salt),
|
||||
Base64.getEncoder().encodeToString(hash(pin, salt))))
|
||||
}
|
||||
|
||||
fun matches(context: Context, pin: String): Boolean {
|
||||
val storedCredentials = credentials(prefs(context))
|
||||
val salt = storedCredentials.salt?.let { runCatching { Base64.getDecoder().decode(it) }.getOrNull() } ?: return false
|
||||
val stored = storedCredentials.hash?.let { runCatching { Base64.getDecoder().decode(it) }.getOrNull() } ?: return false
|
||||
return validPin(pin) && MessageDigest.isEqual(stored, hash(pin, salt))
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun clear(context: Context, pin: String): Boolean =
|
||||
matches(context, pin) && write(prefs(context), Credentials(null, null))
|
||||
|
||||
internal fun hash(pin: String, salt: ByteArray): ByteArray {
|
||||
val spec = PBEKeySpec(pin.toCharArray(), salt, ROUNDS, 256)
|
||||
try {
|
||||
return SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256").generateSecret(spec).encoded
|
||||
} finally {
|
||||
spec.clearPassword()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,10 @@ object Onboarding {
|
||||
/** The setup screens belong to the first run; later runtime, Proton and Steam client updates keep the usual Play button. */
|
||||
val firstRun = MutableStateFlow(true)
|
||||
|
||||
/** Called once, when this process finishes the first-run downloads itself; not when everything was already in place. */
|
||||
@Volatile var onFirstRunReady: (() -> Unit)? = null
|
||||
@Volatile private var worked = false
|
||||
|
||||
fun attach(context: Context) {
|
||||
appContext = context.applicationContext
|
||||
val prefs = context.applicationContext.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
|
||||
@@ -52,8 +56,10 @@ object Onboarding {
|
||||
|
||||
private fun markFirstRunDone() {
|
||||
val context = appContext ?: return
|
||||
val live = firstRun.value && worked
|
||||
context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit().putBoolean(KEY_FIRST_RUN_DONE, true).apply()
|
||||
firstRun.value = false
|
||||
if (live) onFirstRunReady?.invoke()
|
||||
}
|
||||
|
||||
/** Keeps the process in the foreground, with one notification, while a step downloads and the runtime installer is not already doing so. */
|
||||
@@ -90,6 +96,7 @@ object Onboarding {
|
||||
}
|
||||
|
||||
fun report(step: Step, label: String, percent: Int) {
|
||||
worked = true
|
||||
failed.value = failed.value - step
|
||||
active.value = active.value + (step to Progress(label, percent))
|
||||
keepAlive()
|
||||
|
||||
@@ -960,12 +960,6 @@ object SessionPrefs {
|
||||
|
||||
fun micAsked(context: Context): Boolean = prefs(context).getBoolean("micAsked", false)
|
||||
|
||||
fun allFilesAsked(context: Context): Boolean = prefs(context).getBoolean("allFilesAsked", false)
|
||||
|
||||
fun setAllFilesAsked(context: Context) {
|
||||
prefs(context).edit().putBoolean("allFilesAsked", true).apply()
|
||||
}
|
||||
|
||||
fun bluetoothAsked(context: Context): Boolean = prefs(context).getBoolean("bluetoothAsked", false)
|
||||
|
||||
fun setBluetoothAsked(context: Context) {
|
||||
@@ -1235,6 +1229,11 @@ object SessionPrefs {
|
||||
prefs(context).edit().putBoolean("venus", on).apply()
|
||||
}
|
||||
|
||||
/** Venus off with no choice stored, so that Auto turning it off does not read as the user's own choice. */
|
||||
fun clearVenus(context: Context) {
|
||||
prefs(context).edit().remove("venus").apply()
|
||||
}
|
||||
|
||||
fun setVkBridge(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("vkBridge", on).putBoolean("bridgeFellBack", false).apply()
|
||||
}
|
||||
|
||||
@@ -233,6 +233,8 @@ class SessionService : Service() {
|
||||
return START_NOT_STICKY
|
||||
}
|
||||
ACTION_STOP -> {
|
||||
if (intent.hasExtra(DesktopLock.EXTRA_UNLOCK_SOURCE) &&
|
||||
!DesktopLock.currentSession(intent.getStringExtra(DesktopLock.EXTRA_UNLOCK_SOURCE), SessionState.sessionId, SessionState.running)) return START_NOT_STICKY
|
||||
Log.i(TAG, "stop requested from the notification")
|
||||
stopSession(0)
|
||||
return START_NOT_STICKY
|
||||
@@ -2003,6 +2005,16 @@ class SessionService : Service() {
|
||||
.putExtra(EXTRA_STEAM_UI, ui)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
if (url.isNotEmpty()) next.putExtra(EXTRA_STEAM_URL, url)
|
||||
if (DesktopLock.requiresUnlock(DesktopLock.enabled(this@SessionService), session, ui)) {
|
||||
val unlock = DesktopLock.handoff(session, ui, url)?.copy(source = SessionState.sessionId) ?: return
|
||||
val home = unlock.put(Intent(this@SessionService, com.droiddeck.launcher.FrontEndActivity::class.java))
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
||||
android.os.Handler(android.os.Looper.getMainLooper()).post {
|
||||
if (gen != sessionGen || !SessionState.running) return@post
|
||||
startActivity(home)
|
||||
}
|
||||
return
|
||||
}
|
||||
SessionState.queueRelaunch(next)
|
||||
android.os.Handler(android.os.Looper.getMainLooper()).post { stopSession(0, relaunch = true) }
|
||||
}
|
||||
@@ -2740,7 +2752,14 @@ class SessionService : Service() {
|
||||
else context.startService(intent)
|
||||
}
|
||||
|
||||
fun stop(context: Context) {
|
||||
fun stop(context: Context, source: String? = null) {
|
||||
if (source != null) {
|
||||
if (DesktopLock.currentSession(source, SessionState.sessionId, SessionState.running)) {
|
||||
context.startService(Intent(context, SessionService::class.java).setAction(ACTION_STOP)
|
||||
.putExtra(DesktopLock.EXTRA_UNLOCK_SOURCE, source))
|
||||
}
|
||||
return
|
||||
}
|
||||
if (!SessionState.running) {
|
||||
SessionState.stopRequested = true
|
||||
SessionState.installCancellation?.cancel()
|
||||
|
||||
@@ -126,7 +126,9 @@ internal fun AdbTextField(
|
||||
setTextColor(colors.onBackground.toArgb())
|
||||
setHintTextColor(colors.onSurfaceVariant.toArgb())
|
||||
contentDescription = label
|
||||
inputType = if (keyboardType == KeyboardType.Number) {
|
||||
inputType = if (keyboardType == KeyboardType.NumberPassword) {
|
||||
InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_VARIATION_PASSWORD
|
||||
} else if (keyboardType == KeyboardType.Number) {
|
||||
InputType.TYPE_CLASS_NUMBER
|
||||
} else {
|
||||
InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_URI or InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
|
||||
|
||||
@@ -683,16 +683,20 @@ private fun MoviePreview(url: String, modifier: Modifier = Modifier) {
|
||||
@Composable
|
||||
internal fun TextEntryDialog(
|
||||
title: String, initial: String, number: Boolean, confirm: String, onSubmit: (String) -> Unit, onDismiss: () -> Unit,
|
||||
id: String = "boot-movie-entry",
|
||||
id: String = "boot-movie-entry", secret: Boolean = false,
|
||||
) {
|
||||
val shown = rememberShown(onDismiss)
|
||||
val close = { shown.targetState = false }
|
||||
var text by remember { mutableStateOf(initial) }
|
||||
val submit = { onSubmit(text.trim()); close() }
|
||||
val submit = { if (shown.targetState) { close(); onSubmit(text.trim()) } }
|
||||
AppDialog(shown, close, id, wide = false, maxWidth = 460.dp) {
|
||||
DialogTitleRow(title, close)
|
||||
AdbTextField(
|
||||
value = text, onValueChange = { text = it }, label = "", keyboardType = if (number) KeyboardType.Number else KeyboardType.Text,
|
||||
value = text, onValueChange = { text = it }, label = "", keyboardType = when {
|
||||
number && secret -> KeyboardType.NumberPassword
|
||||
number -> KeyboardType.Number
|
||||
else -> KeyboardType.Text
|
||||
},
|
||||
imeAction = ImeAction.Done, placeholder = title, focusOnShow = true, onDone = { submit() },
|
||||
)
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.fillMaxWidth()) {
|
||||
|
||||
@@ -7,7 +7,6 @@ import android.os.Bundle
|
||||
import android.view.Display
|
||||
import android.view.KeyEvent
|
||||
import android.view.MotionEvent
|
||||
import android.view.PointerIcon
|
||||
import android.view.SurfaceHolder
|
||||
import android.view.SurfaceView
|
||||
import android.view.View
|
||||
@@ -45,7 +44,6 @@ class BottomGameScreen(
|
||||
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION)
|
||||
surfaceView.pointerIcon = PointerIcon.getSystemIcon(context, PointerIcon.TYPE_NULL)
|
||||
surfaceView.setOnTouchListener { _, event -> onTouch(event) }
|
||||
surfaceView.holder.addCallback(callback)
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ class ModeSettings(
|
||||
val unfoldedControls: Boolean? = null,
|
||||
val unfoldedControlsWithController: Boolean = false,
|
||||
val startupSession: String = SessionPrefs.STARTUP_OFF,
|
||||
val desktopLock: Boolean = false,
|
||||
val bootMovie: String? = null,
|
||||
val bootMovieSound: Boolean = true,
|
||||
val bootMovieCustomName: String? = null,
|
||||
@@ -164,6 +165,7 @@ class ModeSettingsActions(
|
||||
val onUnfoldedControls: (Boolean) -> Unit = {},
|
||||
val onUnfoldedControlsWithController: (Boolean) -> Unit = {},
|
||||
val onStartupSession: (String) -> Unit = {},
|
||||
val onDesktopLock: (Boolean) -> Unit = {},
|
||||
val onBootMovie: (String) -> Unit = {},
|
||||
val onBootMovieSound: (Boolean) -> Unit = {},
|
||||
val onImportBootMovie: () -> Unit = {},
|
||||
@@ -431,6 +433,7 @@ fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras:
|
||||
SessionPrefs.STARTUP_DESKTOP to stringResource(R.string.rail_desktop),
|
||||
), s.startupSession, onPick = a.onStartupSession,
|
||||
)
|
||||
ToggleRow(host, "desktop-lock", stringResource(R.string.desktop_lock), null, s.desktopLock, onChange = a.onDesktopLock)
|
||||
}
|
||||
extras.performance()
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ class SecondScreenPresentation(
|
||||
requested == SecondScreenMode.DECK_CONTROLS && !SessionState.deckPad -> SecondScreenMode.NONE
|
||||
requested == SecondScreenMode.DASHBOARD && dashboard == null -> SecondScreenMode.NONE
|
||||
requested.sessionPanel && panel(requested) == null -> SecondScreenMode.NONE
|
||||
requested == SecondScreenMode.DESKTOP && !BottomDesktop.available() -> SecondScreenMode.NONE
|
||||
requested == SecondScreenMode.DESKTOP && !BottomDesktop.available(context) -> SecondScreenMode.NONE
|
||||
else -> requested
|
||||
}
|
||||
if (mode == SecondScreenMode.NONE) return
|
||||
|
||||
@@ -4310,4 +4310,11 @@
|
||||
<string name="steam_store_linux_build">تثبّت هذه اللعبة إصدار Linux الخاص بها. ثبّتها من Steam.</string>
|
||||
<string name="game_zoom_title">تكبير اللعبة</string>
|
||||
<string name="game_zoom_hint">اضبط تكبير اللعبة من 100% إلى 300%</string>
|
||||
<string name="desktop_lock">قفل سطح المكتب برمز PIN</string>
|
||||
<string name="desktop_lock_new">رمز PIN جديد (4–8 أرقام)</string>
|
||||
<string name="desktop_lock_confirm">تأكيد رمز PIN</string>
|
||||
<string name="desktop_lock_enter">أدخل رمز PIN</string>
|
||||
<string name="desktop_lock_wrong">رمز PIN خاطئ</string>
|
||||
<string name="desktop_lock_invalid">استخدم من 4 إلى 8 أرقام</string>
|
||||
<string name="desktop_lock_mismatch">رمزا PIN غير متطابقين</string>
|
||||
</resources>
|
||||
@@ -4188,4 +4188,11 @@
|
||||
<string name="steam_store_close_steam">Cierra Steam primero</string>
|
||||
<string name="steam_store_session_wait">Pausa primero la descarga de Steam</string>
|
||||
<string name="steam_store_linux_build">Este juego instala su versión para Linux. Instálalo desde Steam.</string>
|
||||
<string name="desktop_lock">Bloqueo con PIN del escritorio</string>
|
||||
<string name="desktop_lock_new">PIN nuevo (4–8 dígitos)</string>
|
||||
<string name="desktop_lock_confirm">Confirmar PIN</string>
|
||||
<string name="desktop_lock_enter">Ingresa el PIN</string>
|
||||
<string name="desktop_lock_wrong">PIN incorrecto</string>
|
||||
<string name="desktop_lock_invalid">Usa de 4 a 8 dígitos</string>
|
||||
<string name="desktop_lock_mismatch">Los PIN no coinciden</string>
|
||||
</resources>
|
||||
@@ -4150,4 +4150,11 @@
|
||||
<string name="steam_store_linux_build">Тази игра инсталира версията си за Linux. Инсталирайте я от Steam.</string>
|
||||
<string name="game_zoom_title">Мащабиране на играта</string>
|
||||
<string name="game_zoom_hint">Регулирайте увеличението на играта от 100% до 300%</string>
|
||||
<string name="desktop_lock">ПИН заключване на работния плот</string>
|
||||
<string name="desktop_lock_new">Нов ПИН (4–8 цифри)</string>
|
||||
<string name="desktop_lock_confirm">Потвърдете ПИН</string>
|
||||
<string name="desktop_lock_enter">Въведете ПИН</string>
|
||||
<string name="desktop_lock_wrong">Грешен ПИН</string>
|
||||
<string name="desktop_lock_invalid">Използвайте от 4 до 8 цифри</string>
|
||||
<string name="desktop_lock_mismatch">ПИН кодовете не съвпадат</string>
|
||||
</resources>
|
||||
@@ -4230,4 +4230,11 @@
|
||||
<string name="steam_store_linux_build">Tato hra instaluje svou verzi pro Linux. Nainstalujte ji ze Steamu.</string>
|
||||
<string name="game_zoom_title">Přiblížení hry</string>
|
||||
<string name="game_zoom_hint">Nastavte zvětšení hry od 100 % do 300 %</string>
|
||||
<string name="desktop_lock">Zámek plochy pomocí PIN</string>
|
||||
<string name="desktop_lock_new">Nový PIN (4–8 číslic)</string>
|
||||
<string name="desktop_lock_confirm">Potvrďte PIN</string>
|
||||
<string name="desktop_lock_enter">Zadejte PIN</string>
|
||||
<string name="desktop_lock_wrong">Nesprávný PIN</string>
|
||||
<string name="desktop_lock_invalid">Použijte 4 až 8 číslic</string>
|
||||
<string name="desktop_lock_mismatch">PIN kódy se neshodují</string>
|
||||
</resources>
|
||||
@@ -4150,4 +4150,11 @@
|
||||
<string name="steam_store_linux_build">Dette spil installerer sin Linux-version. Installer det fra Steam.</string>
|
||||
<string name="game_zoom_title">Spilzoom</string>
|
||||
<string name="game_zoom_hint">Juster spillets forstørrelse fra 100 % til 300 %</string>
|
||||
<string name="desktop_lock">PIN-lås til skrivebordet</string>
|
||||
<string name="desktop_lock_new">Ny PIN (4–8 cifre)</string>
|
||||
<string name="desktop_lock_confirm">Bekræft PIN</string>
|
||||
<string name="desktop_lock_enter">Indtast PIN</string>
|
||||
<string name="desktop_lock_wrong">Forkert PIN</string>
|
||||
<string name="desktop_lock_invalid">Brug 4 til 8 cifre</string>
|
||||
<string name="desktop_lock_mismatch">PIN-koderne er ikke ens</string>
|
||||
</resources>
|
||||
@@ -4150,4 +4150,11 @@
|
||||
<string name="steam_store_linux_build">Dieses Spiel installiert seine Linux-Version. Installiere es über Steam.</string>
|
||||
<string name="game_zoom_title">Spielzoom</string>
|
||||
<string name="game_zoom_hint">Spielvergrößerung von 100 % bis 300 % anpassen</string>
|
||||
<string name="desktop_lock">Desktop-PIN-Sperre</string>
|
||||
<string name="desktop_lock_new">Neue PIN (4–8 Ziffern)</string>
|
||||
<string name="desktop_lock_confirm">PIN bestätigen</string>
|
||||
<string name="desktop_lock_enter">PIN eingeben</string>
|
||||
<string name="desktop_lock_wrong">Falsche PIN</string>
|
||||
<string name="desktop_lock_invalid">4 bis 8 Ziffern verwenden</string>
|
||||
<string name="desktop_lock_mismatch">PINs stimmen nicht überein</string>
|
||||
</resources>
|
||||
@@ -4150,4 +4150,11 @@
|
||||
<string name="steam_store_linux_build">Αυτό το παιχνίδι εγκαθιστά την έκδοσή του για Linux. Εγκαταστήστε το από το Steam.</string>
|
||||
<string name="game_zoom_title">Ζουμ παιχνιδιού</string>
|
||||
<string name="game_zoom_hint">Ρυθμίστε τη μεγέθυνση του παιχνιδιού από 100% έως 300%</string>
|
||||
<string name="desktop_lock">Κλείδωμα επιφάνειας εργασίας με PIN</string>
|
||||
<string name="desktop_lock_new">Νέο PIN (4–8 ψηφία)</string>
|
||||
<string name="desktop_lock_confirm">Επιβεβαίωση PIN</string>
|
||||
<string name="desktop_lock_enter">Εισαγάγετε PIN</string>
|
||||
<string name="desktop_lock_wrong">Λάθος PIN</string>
|
||||
<string name="desktop_lock_invalid">Χρησιμοποιήστε 4 έως 8 ψηφία</string>
|
||||
<string name="desktop_lock_mismatch">Τα PIN δεν ταιριάζουν</string>
|
||||
</resources>
|
||||
@@ -4190,4 +4190,11 @@
|
||||
<string name="steam_store_linux_build">Este juego instala su versión para Linux. Instálalo desde Steam.</string>
|
||||
<string name="game_zoom_title">Zoom del juego</string>
|
||||
<string name="game_zoom_hint">Ajusta la ampliación del juego del 100 % al 300 %</string>
|
||||
<string name="desktop_lock">Bloqueo con PIN del escritorio</string>
|
||||
<string name="desktop_lock_new">PIN nuevo (4–8 dígitos)</string>
|
||||
<string name="desktop_lock_confirm">Confirmar PIN</string>
|
||||
<string name="desktop_lock_enter">Introduce el PIN</string>
|
||||
<string name="desktop_lock_wrong">PIN incorrecto</string>
|
||||
<string name="desktop_lock_invalid">Usa de 4 a 8 dígitos</string>
|
||||
<string name="desktop_lock_mismatch">Los PIN no coinciden</string>
|
||||
</resources>
|
||||
@@ -4150,4 +4150,11 @@
|
||||
<string name="steam_store_linux_build">Tämä peli asentaa Linux-versionsa. Asenna se Steamista.</string>
|
||||
<string name="game_zoom_title">Pelin zoomaus</string>
|
||||
<string name="game_zoom_hint">Säädä pelin suurennusta välillä 100–300 %</string>
|
||||
<string name="desktop_lock">Työpöydän PIN-lukko</string>
|
||||
<string name="desktop_lock_new">Uusi PIN (4–8 numeroa)</string>
|
||||
<string name="desktop_lock_confirm">Vahvista PIN</string>
|
||||
<string name="desktop_lock_enter">Anna PIN</string>
|
||||
<string name="desktop_lock_wrong">Väärä PIN</string>
|
||||
<string name="desktop_lock_invalid">Käytä 4–8 numeroa</string>
|
||||
<string name="desktop_lock_mismatch">PIN-koodit eivät täsmää</string>
|
||||
</resources>
|
||||
@@ -4189,4 +4189,11 @@
|
||||
<string name="steam_store_linux_build">Ce jeu installe sa version Linux. Installez-le depuis Steam.</string>
|
||||
<string name="game_zoom_title">Zoom du jeu</string>
|
||||
<string name="game_zoom_hint">Réglez le grossissement du jeu de 100 % à 300 %</string>
|
||||
<string name="desktop_lock">Verrouillage du bureau par code PIN</string>
|
||||
<string name="desktop_lock_new">Nouveau code PIN (4 à 8 chiffres)</string>
|
||||
<string name="desktop_lock_confirm">Confirmer le code PIN</string>
|
||||
<string name="desktop_lock_enter">Saisir le code PIN</string>
|
||||
<string name="desktop_lock_wrong">Code PIN incorrect</string>
|
||||
<string name="desktop_lock_invalid">Utilisez 4 à 8 chiffres</string>
|
||||
<string name="desktop_lock_mismatch">Les codes PIN ne correspondent pas</string>
|
||||
</resources>
|
||||
@@ -4150,4 +4150,11 @@
|
||||
<string name="steam_store_linux_build">यह गेम अपना Linux संस्करण इंस्टॉल करता है। इसे Steam से इंस्टॉल करें।</string>
|
||||
<string name="game_zoom_title">गेम ज़ूम</string>
|
||||
<string name="game_zoom_hint">गेम का ज़ूम 100% से 300% तक समायोजित करें</string>
|
||||
<string name="desktop_lock">डेस्कटॉप PIN लॉक</string>
|
||||
<string name="desktop_lock_new">नया PIN (4–8 अंक)</string>
|
||||
<string name="desktop_lock_confirm">PIN की पुष्टि करें</string>
|
||||
<string name="desktop_lock_enter">PIN दर्ज करें</string>
|
||||
<string name="desktop_lock_wrong">गलत PIN</string>
|
||||
<string name="desktop_lock_invalid">4 से 8 अंक इस्तेमाल करें</string>
|
||||
<string name="desktop_lock_mismatch">PIN मेल नहीं खाते</string>
|
||||
</resources>
|
||||
@@ -4150,4 +4150,11 @@
|
||||
<string name="steam_store_linux_build">Ez a játék a Linux-verzióját telepíti. Telepítsd a Steamből.</string>
|
||||
<string name="game_zoom_title">Játék nagyítása</string>
|
||||
<string name="game_zoom_hint">A játék nagyításának beállítása 100% és 300% között</string>
|
||||
<string name="desktop_lock">Asztal PIN-zár</string>
|
||||
<string name="desktop_lock_new">Új PIN (4–8 számjegy)</string>
|
||||
<string name="desktop_lock_confirm">PIN megerősítése</string>
|
||||
<string name="desktop_lock_enter">Adja meg a PIN-t</string>
|
||||
<string name="desktop_lock_wrong">Hibás PIN</string>
|
||||
<string name="desktop_lock_invalid">4–8 számjegyet használjon</string>
|
||||
<string name="desktop_lock_mismatch">A PIN-kódok nem egyeznek</string>
|
||||
</resources>
|
||||
@@ -4120,4 +4120,11 @@
|
||||
<string name="steam_store_linux_build">Game ini memasang versi Linux-nya. Pasang dari Steam.</string>
|
||||
<string name="game_zoom_title">Zoom game</string>
|
||||
<string name="game_zoom_hint">Sesuaikan pembesaran game dari 100% hingga 300%</string>
|
||||
<string name="desktop_lock">Kunci PIN desktop</string>
|
||||
<string name="desktop_lock_new">PIN baru (4–8 digit)</string>
|
||||
<string name="desktop_lock_confirm">Konfirmasi PIN</string>
|
||||
<string name="desktop_lock_enter">Masukkan PIN</string>
|
||||
<string name="desktop_lock_wrong">PIN salah</string>
|
||||
<string name="desktop_lock_invalid">Gunakan 4 sampai 8 digit</string>
|
||||
<string name="desktop_lock_mismatch">PIN tidak cocok</string>
|
||||
</resources>
|
||||
@@ -4189,4 +4189,11 @@
|
||||
<string name="steam_store_linux_build">Questo gioco installa la sua versione Linux. Installalo da Steam.</string>
|
||||
<string name="game_zoom_title">Zoom del gioco</string>
|
||||
<string name="game_zoom_hint">Regola l\'ingrandimento del gioco dal 100% al 300%</string>
|
||||
<string name="desktop_lock">Blocco desktop con PIN</string>
|
||||
<string name="desktop_lock_new">Nuovo PIN (4–8 cifre)</string>
|
||||
<string name="desktop_lock_confirm">Conferma PIN</string>
|
||||
<string name="desktop_lock_enter">Inserisci il PIN</string>
|
||||
<string name="desktop_lock_wrong">PIN errato</string>
|
||||
<string name="desktop_lock_invalid">Usa da 4 a 8 cifre</string>
|
||||
<string name="desktop_lock_mismatch">I PIN non corrispondono</string>
|
||||
</resources>
|
||||
@@ -4120,4 +4120,11 @@
|
||||
<string name="steam_store_linux_build">このゲームは Linux 版をインストールします。Steam からインストールしてください。</string>
|
||||
<string name="game_zoom_title">ゲームズーム</string>
|
||||
<string name="game_zoom_hint">ゲームの拡大率を100%から300%の間で調整します</string>
|
||||
<string name="desktop_lock">デスクトップの PIN ロック</string>
|
||||
<string name="desktop_lock_new">新しい PIN(4~8 桁)</string>
|
||||
<string name="desktop_lock_confirm">PIN を確認</string>
|
||||
<string name="desktop_lock_enter">PIN を入力</string>
|
||||
<string name="desktop_lock_wrong">PIN が違います</string>
|
||||
<string name="desktop_lock_invalid">4~8 桁の数字を使用してください</string>
|
||||
<string name="desktop_lock_mismatch">PIN が一致しません</string>
|
||||
</resources>
|
||||
@@ -4120,4 +4120,11 @@
|
||||
<string name="steam_store_linux_build">이 게임은 Linux 버전을 설치합니다. Steam에서 설치하세요.</string>
|
||||
<string name="game_zoom_title">게임 확대</string>
|
||||
<string name="game_zoom_hint">게임 확대율을 100%에서 300%까지 조정합니다</string>
|
||||
<string name="desktop_lock">데스크톱 PIN 잠금</string>
|
||||
<string name="desktop_lock_new">새 PIN(4~8자리)</string>
|
||||
<string name="desktop_lock_confirm">PIN 확인</string>
|
||||
<string name="desktop_lock_enter">PIN 입력</string>
|
||||
<string name="desktop_lock_wrong">잘못된 PIN</string>
|
||||
<string name="desktop_lock_invalid">4~8자리 숫자를 사용하세요</string>
|
||||
<string name="desktop_lock_mismatch">PIN이 일치하지 않습니다</string>
|
||||
</resources>
|
||||
@@ -4120,4 +4120,11 @@
|
||||
<string name="steam_store_linux_build">Permainan ini memasang versi Linuxnya. Pasang daripada Steam.</string>
|
||||
<string name="game_zoom_title">Zum permainan</string>
|
||||
<string name="game_zoom_hint">Laraskan pembesaran permainan daripada 100% hingga 300%</string>
|
||||
<string name="desktop_lock">Kunci PIN desktop</string>
|
||||
<string name="desktop_lock_new">PIN baharu (4–8 digit)</string>
|
||||
<string name="desktop_lock_confirm">Sahkan PIN</string>
|
||||
<string name="desktop_lock_enter">Masukkan PIN</string>
|
||||
<string name="desktop_lock_wrong">PIN salah</string>
|
||||
<string name="desktop_lock_invalid">Gunakan 4 hingga 8 digit</string>
|
||||
<string name="desktop_lock_mismatch">PIN tidak sepadan</string>
|
||||
</resources>
|
||||
@@ -4150,4 +4150,11 @@
|
||||
<string name="steam_store_linux_build">Dette spillet installerer Linux-versjonen sin. Installer det fra Steam.</string>
|
||||
<string name="game_zoom_title">Spillzoom</string>
|
||||
<string name="game_zoom_hint">Juster spillforstørrelsen fra 100 % til 300 %</string>
|
||||
<string name="desktop_lock">PIN-lås for skrivebordet</string>
|
||||
<string name="desktop_lock_new">Ny PIN (4–8 sifre)</string>
|
||||
<string name="desktop_lock_confirm">Bekreft PIN</string>
|
||||
<string name="desktop_lock_enter">Skriv inn PIN</string>
|
||||
<string name="desktop_lock_wrong">Feil PIN</string>
|
||||
<string name="desktop_lock_invalid">Bruk 4 til 8 sifre</string>
|
||||
<string name="desktop_lock_mismatch">PIN-kodene samsvarer ikke</string>
|
||||
</resources>
|
||||
@@ -4150,4 +4150,11 @@
|
||||
<string name="steam_store_linux_build">Deze game installeert zijn Linux-versie. Installeer hem via Steam.</string>
|
||||
<string name="game_zoom_title">Gamezoom</string>
|
||||
<string name="game_zoom_hint">Pas de spelvergroting aan van 100% tot 300%</string>
|
||||
<string name="desktop_lock">Pincodevergrendeling bureaublad</string>
|
||||
<string name="desktop_lock_new">Nieuwe pincode (4–8 cijfers)</string>
|
||||
<string name="desktop_lock_confirm">Pincode bevestigen</string>
|
||||
<string name="desktop_lock_enter">Pincode invoeren</string>
|
||||
<string name="desktop_lock_wrong">Onjuiste pincode</string>
|
||||
<string name="desktop_lock_invalid">Gebruik 4 tot 8 cijfers</string>
|
||||
<string name="desktop_lock_mismatch">Pincodes komen niet overeen</string>
|
||||
</resources>
|
||||
@@ -4230,4 +4230,11 @@
|
||||
<string name="steam_store_linux_build">Ta gra instaluje swoją wersję dla Linuksa. Zainstaluj ją ze Steama.</string>
|
||||
<string name="game_zoom_title">Powiększenie gry</string>
|
||||
<string name="game_zoom_hint">Dostosuj powiększenie gry w zakresie od 100% do 300%</string>
|
||||
<string name="desktop_lock">Blokada pulpitu kodem PIN</string>
|
||||
<string name="desktop_lock_new">Nowy PIN (4–8 cyfr)</string>
|
||||
<string name="desktop_lock_confirm">Potwierdź PIN</string>
|
||||
<string name="desktop_lock_enter">Wpisz PIN</string>
|
||||
<string name="desktop_lock_wrong">Nieprawidłowy PIN</string>
|
||||
<string name="desktop_lock_invalid">Użyj od 4 do 8 cyfr</string>
|
||||
<string name="desktop_lock_mismatch">Kody PIN nie są zgodne</string>
|
||||
</resources>
|
||||
@@ -4189,4 +4189,11 @@
|
||||
<string name="steam_store_linux_build">Este jogo instala a sua versão para Linux. Instale-o a partir do Steam.</string>
|
||||
<string name="game_zoom_title">Zoom do jogo</string>
|
||||
<string name="game_zoom_hint">Ajuste a ampliação do jogo de 100% a 300%</string>
|
||||
<string name="desktop_lock">Bloqueio do ambiente de trabalho por PIN</string>
|
||||
<string name="desktop_lock_new">Novo PIN (4–8 dígitos)</string>
|
||||
<string name="desktop_lock_confirm">Confirmar PIN</string>
|
||||
<string name="desktop_lock_enter">Introduza o PIN</string>
|
||||
<string name="desktop_lock_wrong">PIN incorreto</string>
|
||||
<string name="desktop_lock_invalid">Utilize 4 a 8 dígitos</string>
|
||||
<string name="desktop_lock_mismatch">Os PIN não coincidem</string>
|
||||
</resources>
|
||||
@@ -4197,4 +4197,11 @@
|
||||
<string name="steam_store_close_steam">Feche o Steam primeiro</string>
|
||||
<string name="steam_store_session_wait">Pause o download do Steam primeiro</string>
|
||||
<string name="steam_store_linux_build">Este jogo instala sua versão para Linux. Instale-o pelo Steam.</string>
|
||||
<string name="desktop_lock">Bloqueio do desktop por PIN</string>
|
||||
<string name="desktop_lock_new">Novo PIN (4–8 dígitos)</string>
|
||||
<string name="desktop_lock_confirm">Confirmar PIN</string>
|
||||
<string name="desktop_lock_enter">Digite o PIN</string>
|
||||
<string name="desktop_lock_wrong">PIN incorreto</string>
|
||||
<string name="desktop_lock_invalid">Use de 4 a 8 dígitos</string>
|
||||
<string name="desktop_lock_mismatch">Os PINs não coincidem</string>
|
||||
</resources>
|
||||
@@ -4190,4 +4190,11 @@
|
||||
<string name="steam_store_linux_build">Acest joc își instalează versiunea pentru Linux. Instalează-l din Steam.</string>
|
||||
<string name="game_zoom_title">Zoom joc</string>
|
||||
<string name="game_zoom_hint">Reglați mărirea jocului între 100% și 300%</string>
|
||||
<string name="desktop_lock">Blocare desktop cu PIN</string>
|
||||
<string name="desktop_lock_new">PIN nou (4–8 cifre)</string>
|
||||
<string name="desktop_lock_confirm">Confirmați PIN-ul</string>
|
||||
<string name="desktop_lock_enter">Introduceți PIN-ul</string>
|
||||
<string name="desktop_lock_wrong">PIN greșit</string>
|
||||
<string name="desktop_lock_invalid">Folosiți între 4 și 8 cifre</string>
|
||||
<string name="desktop_lock_mismatch">PIN-urile nu se potrivesc</string>
|
||||
</resources>
|
||||
@@ -4231,4 +4231,11 @@
|
||||
<string name="steam_store_linux_build">Эта игра устанавливает свою версию для Linux. Установите её из Steam.</string>
|
||||
<string name="game_zoom_title">Масштаб игры</string>
|
||||
<string name="game_zoom_hint">Настройте увеличение игры от 100% до 300%</string>
|
||||
<string name="desktop_lock">Блокировка рабочего стола PIN-кодом</string>
|
||||
<string name="desktop_lock_new">Новый PIN-код (4–8 цифр)</string>
|
||||
<string name="desktop_lock_confirm">Подтвердите PIN-код</string>
|
||||
<string name="desktop_lock_enter">Введите PIN-код</string>
|
||||
<string name="desktop_lock_wrong">Неверный PIN-код</string>
|
||||
<string name="desktop_lock_invalid">Используйте от 4 до 8 цифр</string>
|
||||
<string name="desktop_lock_mismatch">PIN-коды не совпадают</string>
|
||||
</resources>
|
||||
@@ -4150,4 +4150,11 @@
|
||||
<string name="steam_store_linux_build">Det här spelet installerar sin Linux-version. Installera det från Steam.</string>
|
||||
<string name="game_zoom_title">Spelzoom</string>
|
||||
<string name="game_zoom_hint">Justera spelförstoringen från 100 % till 300 %</string>
|
||||
<string name="desktop_lock">PIN-lås för skrivbordet</string>
|
||||
<string name="desktop_lock_new">Ny PIN (4–8 siffror)</string>
|
||||
<string name="desktop_lock_confirm">Bekräfta PIN</string>
|
||||
<string name="desktop_lock_enter">Ange PIN</string>
|
||||
<string name="desktop_lock_wrong">Fel PIN</string>
|
||||
<string name="desktop_lock_invalid">Använd 4 till 8 siffror</string>
|
||||
<string name="desktop_lock_mismatch">PIN-koderna matchar inte</string>
|
||||
</resources>
|
||||
@@ -4120,4 +4120,11 @@
|
||||
<string name="steam_store_linux_build">เกมนี้ติดตั้งเวอร์ชัน Linux ของตัวเอง ให้ติดตั้งจาก Steam</string>
|
||||
<string name="game_zoom_title">ซูมเกม</string>
|
||||
<string name="game_zoom_hint">ปรับการขยายเกมตั้งแต่ 100% ถึง 300%</string>
|
||||
<string name="desktop_lock">ล็อกเดสก์ท็อปด้วย PIN</string>
|
||||
<string name="desktop_lock_new">PIN ใหม่ (4–8 หลัก)</string>
|
||||
<string name="desktop_lock_confirm">ยืนยัน PIN</string>
|
||||
<string name="desktop_lock_enter">ป้อน PIN</string>
|
||||
<string name="desktop_lock_wrong">PIN ไม่ถูกต้อง</string>
|
||||
<string name="desktop_lock_invalid">ใช้ตัวเลข 4 ถึง 8 หลัก</string>
|
||||
<string name="desktop_lock_mismatch">PIN ไม่ตรงกัน</string>
|
||||
</resources>
|
||||
@@ -4150,4 +4150,11 @@
|
||||
<string name="steam_store_linux_build">Bu oyun Linux sürümünü yükler. Steam\'den yükleyin.</string>
|
||||
<string name="game_zoom_title">Oyun yakınlaştırma</string>
|
||||
<string name="game_zoom_hint">Oyun yakınlaştırmasını %100 ile %300 arasında ayarlayın</string>
|
||||
<string name="desktop_lock">Masaüstü PIN kilidi</string>
|
||||
<string name="desktop_lock_new">Yeni PIN (4–8 hane)</string>
|
||||
<string name="desktop_lock_confirm">PIN\'i onayla</string>
|
||||
<string name="desktop_lock_enter">PIN\'i girin</string>
|
||||
<string name="desktop_lock_wrong">Yanlış PIN</string>
|
||||
<string name="desktop_lock_invalid">4 ila 8 hane kullanın</string>
|
||||
<string name="desktop_lock_mismatch">PIN\'ler eşleşmiyor</string>
|
||||
</resources>
|
||||
@@ -4230,4 +4230,11 @@
|
||||
<string name="steam_store_linux_build">Ця гра встановлює свою версію для Linux. Установіть її зі Steam.</string>
|
||||
<string name="game_zoom_title">Масштаб гри</string>
|
||||
<string name="game_zoom_hint">Налаштуйте збільшення гри від 100% до 300%</string>
|
||||
<string name="desktop_lock">Блокування робочого столу PIN-кодом</string>
|
||||
<string name="desktop_lock_new">Новий PIN-код (4–8 цифр)</string>
|
||||
<string name="desktop_lock_confirm">Підтвердьте PIN-код</string>
|
||||
<string name="desktop_lock_enter">Введіть PIN-код</string>
|
||||
<string name="desktop_lock_wrong">Неправильний PIN-код</string>
|
||||
<string name="desktop_lock_invalid">Використовуйте від 4 до 8 цифр</string>
|
||||
<string name="desktop_lock_mismatch">PIN-коди не збігаються</string>
|
||||
</resources>
|
||||
@@ -4120,4 +4120,11 @@
|
||||
<string name="steam_store_linux_build">Trò chơi này cài bản dành cho Linux. Hãy cài từ Steam.</string>
|
||||
<string name="game_zoom_title">Thu phóng trò chơi</string>
|
||||
<string name="game_zoom_hint">Điều chỉnh độ phóng đại trò chơi từ 100% đến 300%</string>
|
||||
<string name="desktop_lock">Khóa màn hình nền bằng mã PIN</string>
|
||||
<string name="desktop_lock_new">Mã PIN mới (4–8 chữ số)</string>
|
||||
<string name="desktop_lock_confirm">Xác nhận mã PIN</string>
|
||||
<string name="desktop_lock_enter">Nhập mã PIN</string>
|
||||
<string name="desktop_lock_wrong">Mã PIN sai</string>
|
||||
<string name="desktop_lock_invalid">Dùng 4 đến 8 chữ số</string>
|
||||
<string name="desktop_lock_mismatch">Mã PIN không khớp</string>
|
||||
</resources>
|
||||
@@ -4118,4 +4118,11 @@
|
||||
<string name="steam_store_close_steam">请先关闭 Steam</string>
|
||||
<string name="steam_store_session_wait">请先暂停 Steam 下载</string>
|
||||
<string name="steam_store_linux_build">此游戏会安装其 Linux 版本。请通过 Steam 安装。</string>
|
||||
<string name="desktop_lock">桌面 PIN 锁</string>
|
||||
<string name="desktop_lock_new">新 PIN(4–8 位数字)</string>
|
||||
<string name="desktop_lock_confirm">确认 PIN</string>
|
||||
<string name="desktop_lock_enter">输入 PIN</string>
|
||||
<string name="desktop_lock_wrong">PIN 错误</string>
|
||||
<string name="desktop_lock_invalid">请使用 4 到 8 位数字</string>
|
||||
<string name="desktop_lock_mismatch">两次输入的 PIN 不一致</string>
|
||||
</resources>
|
||||
@@ -4118,4 +4118,11 @@
|
||||
<string name="steam_store_close_steam">請先關閉 Steam</string>
|
||||
<string name="steam_store_session_wait">請先暫停 Steam 下載</string>
|
||||
<string name="steam_store_linux_build">此遊戲會安裝其 Linux 版本。請透過 Steam 安裝。</string>
|
||||
<string name="desktop_lock">桌面 PIN 鎖</string>
|
||||
<string name="desktop_lock_new">新 PIN(4–8 位數字)</string>
|
||||
<string name="desktop_lock_confirm">確認 PIN</string>
|
||||
<string name="desktop_lock_enter">輸入 PIN</string>
|
||||
<string name="desktop_lock_wrong">PIN 錯誤</string>
|
||||
<string name="desktop_lock_invalid">請使用 4 至 8 位數字</string>
|
||||
<string name="desktop_lock_mismatch">兩次輸入的 PIN 不一致</string>
|
||||
</resources>
|
||||
@@ -4118,4 +4118,11 @@
|
||||
<string name="steam_store_close_steam">請先關閉 Steam</string>
|
||||
<string name="steam_store_session_wait">請先暫停 Steam 下載</string>
|
||||
<string name="steam_store_linux_build">此遊戲會安裝其 Linux 版本。請透過 Steam 安裝。</string>
|
||||
<string name="desktop_lock">桌面 PIN 鎖</string>
|
||||
<string name="desktop_lock_new">新 PIN(4–8 位數字)</string>
|
||||
<string name="desktop_lock_confirm">確認 PIN</string>
|
||||
<string name="desktop_lock_enter">輸入 PIN</string>
|
||||
<string name="desktop_lock_wrong">PIN 錯誤</string>
|
||||
<string name="desktop_lock_invalid">請使用 4 到 8 位數字</string>
|
||||
<string name="desktop_lock_mismatch">兩次輸入的 PIN 不一致</string>
|
||||
</resources>
|
||||
@@ -4475,4 +4475,11 @@
|
||||
<string name="steam_store_close_steam">Close Steam first</string>
|
||||
<string name="steam_store_session_wait">Pause the Steam download first</string>
|
||||
<string name="steam_store_linux_build">This game installs its Linux build. Install it from Steam.</string>
|
||||
<string name="desktop_lock">Desktop PIN lock</string>
|
||||
<string name="desktop_lock_new">New PIN (4–8 digits)</string>
|
||||
<string name="desktop_lock_confirm">Confirm PIN</string>
|
||||
<string name="desktop_lock_enter">Enter PIN</string>
|
||||
<string name="desktop_lock_wrong">Wrong PIN</string>
|
||||
<string name="desktop_lock_invalid">Use 4 to 8 digits</string>
|
||||
<string name="desktop_lock_mismatch">PINs do not match</string>
|
||||
</resources>
|
||||
@@ -50,4 +50,28 @@ class MaliAutoRouteTest {
|
||||
assertTrue(MaliAutoRoute.userChoice(true, MaliAutoRoute.VENUS, MaliAutoRoute.BRIDGE))
|
||||
assertFalse(MaliAutoRoute.userChoice(false, MaliAutoRoute.NONE, MaliAutoRoute.BRIDGE))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun venusTheUserSwitchedOffIsNotSwitchedBackOn() {
|
||||
assertFalse(MaliAutoRoute.venusStandsIn(true, true, false, true, "Mali-G715"))
|
||||
assertTrue(MaliAutoRoute.venusStandsIn(true, true, true, true, "Mali-G2-Ultra-NX MC12"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun venusIsAutosStandInOnlyWhereSteamStartsThroughIt() {
|
||||
assertTrue(MaliAutoRoute.venusStandsIn(true, true, false, false, "Mali-G715"))
|
||||
assertFalse(MaliAutoRoute.venusStandsIn(true, true, false, false, "Mali-G2-Ultra-NX MC12"))
|
||||
assertFalse(MaliAutoRoute.venusStandsIn(true, true, true, false, "Mali-G2-Ultra-NX MC16"))
|
||||
assertFalse(MaliAutoRoute.venusStandsIn(false, true, true, true, "Mali-G715"))
|
||||
assertFalse(MaliAutoRoute.venusStandsIn(true, false, true, true, "Mali-G715"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun venusThatAutoTurnedOffIsStillAutosToTurnOn() {
|
||||
// Auto clears the stored key when it moves to the bridge: a stored "off" would read as the user's own choice.
|
||||
val cleared = MaliAutoRoute.userChoice(keyStored = false, owner = MaliAutoRoute.BRIDGE, route = MaliAutoRoute.VENUS)
|
||||
val writtenOff = MaliAutoRoute.userChoice(keyStored = true, owner = MaliAutoRoute.BRIDGE, route = MaliAutoRoute.VENUS)
|
||||
assertTrue(MaliAutoRoute.venusStandsIn(true, true, false, cleared, "Mali-G715"))
|
||||
assertFalse(MaliAutoRoute.venusStandsIn(true, true, false, writtenOff, "Mali-G715"))
|
||||
}
|
||||
}
|
||||
@@ -21,4 +21,20 @@ class AllFilesAccessTest {
|
||||
assertTrue(AllFilesAccess.missing(sdk = 35) { false })
|
||||
assertFalse(AllFilesAccess.missing(sdk = 35) { true })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun onlySharedStorageNeedsIt() {
|
||||
assertTrue(AllFilesAccess.covers("/storage/emulated/0"))
|
||||
assertTrue(AllFilesAccess.covers("/storage/1A2B-3C4D/Games"))
|
||||
assertTrue(AllFilesAccess.covers("/sdcard/Download"))
|
||||
assertFalse(AllFilesAccess.covers("/storage/emulated/0/Android/data"))
|
||||
assertFalse(AllFilesAccess.covers("/storage/1A2B-3C4D/Android/obb"))
|
||||
assertTrue(AllFilesAccess.covers("/storage/emulated/0/Android"))
|
||||
assertTrue(AllFilesAccess.covers("/storage/emulated/0/Android/database"))
|
||||
assertTrue(AllFilesAccess.covers("/storage/emulated/0/Download/Android/data"))
|
||||
assertTrue(AllFilesAccess.covers("/storage/1A2B-3C4D/Games/Android/obb/x"))
|
||||
assertFalse(AllFilesAccess.covers("/storage/emulated/0/Android/data/com.droiddeck.launcher/files"))
|
||||
assertFalse(AllFilesAccess.covers("/storage/1A2B-3C4D/Android/obb/com.droiddeck.launcher"))
|
||||
assertFalse(AllFilesAccess.covers("/data/user/0/com.droiddeck.launcher/files"))
|
||||
}
|
||||
}
|
||||
@@ -259,7 +259,7 @@ class PadPartialAxesTest {
|
||||
}
|
||||
|
||||
@Test fun keyTriggerDecision() {
|
||||
val held = BooleanArray(2)
|
||||
val held = PadBridge.TriggerKey.slots(1)[0]
|
||||
assertEquals(1f, PadBridge.keyTrigger(0f, true, 0, false, held, 0))
|
||||
assertEquals(0f, PadBridge.keyTrigger(1f, false, 0, false, held, 0))
|
||||
assertEquals(0.25f, PadBridge.keyTrigger(0.25f, true, 1, false, held, 0))
|
||||
@@ -271,6 +271,64 @@ class PadPartialAxesTest {
|
||||
assertEquals(0f, PadBridge.axisTrigger(0f, held, 1))
|
||||
}
|
||||
|
||||
@Test fun keyBeforeAxisOnAFullPullIsOnePress() {
|
||||
val device = device(MotionEvent.AXIS_GAS)
|
||||
motion(device)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_R2)
|
||||
assertEquals(1f, pad().rightTrigger)
|
||||
for (value in listOf(0.1f, 0.3f, 0.6f, 1f, 0.98f)) {
|
||||
motion(device, MotionEvent.AXIS_GAS to value)
|
||||
assertEquals(1f, pad().rightTrigger)
|
||||
}
|
||||
motion(device, MotionEvent.AXIS_GAS to 0.7f)
|
||||
assertEquals(0.7f, pad().rightTrigger)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_R2, KeyEvent.ACTION_UP)
|
||||
assertEquals(0.7f, pad().rightTrigger)
|
||||
motion(device, MotionEvent.AXIS_GAS to 0f)
|
||||
assertEquals(0f, pad().rightTrigger)
|
||||
}
|
||||
|
||||
@Test fun releasingDuringTheHandoffFollowsTheAxis() {
|
||||
val device = device(MotionEvent.AXIS_GAS)
|
||||
motion(device)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_R2)
|
||||
motion(device, MotionEvent.AXIS_GAS to 0.4f)
|
||||
assertEquals(1f, pad().rightTrigger)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_R2, KeyEvent.ACTION_UP)
|
||||
assertEquals(0.4f, pad().rightTrigger)
|
||||
}
|
||||
|
||||
@Test fun movingTriggerAxisStaysAnalogWhenItsKeyFiresFirst() {
|
||||
val device = device(MotionEvent.AXIS_GAS)
|
||||
motion(device, MotionEvent.AXIS_GAS to 0.5f)
|
||||
motion(device, MotionEvent.AXIS_GAS to 0f)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_R2)
|
||||
assertEquals(0f, pad().rightTrigger)
|
||||
motion(device, MotionEvent.AXIS_GAS to 0.1f)
|
||||
assertEquals(0.1f, pad().rightTrigger)
|
||||
motion(device, MotionEvent.AXIS_GAS to 0.35f)
|
||||
assertEquals(0.35f, pad().rightTrigger)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_R2, KeyEvent.ACTION_UP)
|
||||
motion(device, MotionEvent.AXIS_GAS to 0f)
|
||||
assertEquals(0f, pad().rightTrigger)
|
||||
}
|
||||
|
||||
@Test fun triggerSwitchedToDigitalPressesAgainAfterOneSilentPress() {
|
||||
val device = device(MotionEvent.AXIS_GAS)
|
||||
motion(device, MotionEvent.AXIS_GAS to 0.5f)
|
||||
motion(device, MotionEvent.AXIS_GAS to 0f)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_R2)
|
||||
motion(device)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_R2, KeyEvent.ACTION_UP)
|
||||
assertEquals(0f, pad().rightTrigger)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_R2)
|
||||
assertEquals(1f, pad().rightTrigger)
|
||||
motion(device)
|
||||
assertEquals(1f, pad().rightTrigger)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_R2, KeyEvent.ACTION_UP)
|
||||
assertEquals(0f, pad().rightTrigger)
|
||||
}
|
||||
|
||||
@Test fun silentTriggerAxesLetTheirKeysPress() {
|
||||
val device = device(MotionEvent.AXIS_LTRIGGER, MotionEvent.AXIS_RTRIGGER)
|
||||
motion(device)
|
||||
@@ -294,11 +352,15 @@ class PadPartialAxesTest {
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_L2)
|
||||
assertEquals(1f, pad().leftTrigger)
|
||||
motion(device, MotionEvent.AXIS_LTRIGGER to 0.4f)
|
||||
assertEquals(0.4f, pad().leftTrigger)
|
||||
assertEquals(1f, pad().leftTrigger)
|
||||
motion(device, MotionEvent.AXIS_LTRIGGER to 0f)
|
||||
assertEquals(0f, pad().leftTrigger)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_L2, KeyEvent.ACTION_UP)
|
||||
assertEquals(0f, pad().leftTrigger)
|
||||
key(device, KeyEvent.KEYCODE_BUTTON_L2)
|
||||
assertEquals(0f, pad().leftTrigger)
|
||||
motion(device, MotionEvent.AXIS_LTRIGGER to 0.4f)
|
||||
assertEquals(0.4f, pad().leftTrigger)
|
||||
}
|
||||
|
||||
private fun pad(): PadState = requireNotNull(JoyConPadTest.RecordingWriter.pads[0])
|
||||
|
||||
@@ -54,37 +54,6 @@ class PointerCaptureTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun aHoveringMouseOrTouchpadDrivesThePointer() {
|
||||
listOf(
|
||||
event(MotionEvent.ACTION_HOVER_MOVE, InputDevice.SOURCE_MOUSE, x = 640f, y = 360f),
|
||||
event(MotionEvent.ACTION_BUTTON_PRESS, InputDevice.SOURCE_MOUSE, x = 640f, y = 360f),
|
||||
event(MotionEvent.ACTION_SCROLL, InputDevice.SOURCE_MOUSE, x = 640f, y = 360f),
|
||||
event(MotionEvent.ACTION_HOVER_MOVE, InputDevice.SOURCE_TOUCHPAD, x = 640f, y = 360f),
|
||||
).forEach { event ->
|
||||
try {
|
||||
assertTrue(PointerCapture.isMouse(event))
|
||||
} finally {
|
||||
event.recycle()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun touchesPensControllersAndCapturedMiceAreNotAHoveringMouse() {
|
||||
listOf(
|
||||
InputDevice.SOURCE_TOUCHSCREEN,
|
||||
InputDevice.SOURCE_STYLUS,
|
||||
InputDevice.SOURCE_JOYSTICK,
|
||||
InputDevice.SOURCE_MOUSE_RELATIVE,
|
||||
).forEach { source ->
|
||||
val event = event(MotionEvent.ACTION_MOVE, source, x = 640f, y = 360f)
|
||||
try {
|
||||
assertFalse(PointerCapture.isMouse(event))
|
||||
} finally {
|
||||
event.recycle()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun touchpadTravelMatchesTheSameDistanceOnScreen() {
|
||||
assertEquals(0.5f, PointerCapture.touchpadScale(unitsPerMm = 20f, padWidth = 2000f, pixelsPerMm = 10f, screenWidth = 1920), 0.001f)
|
||||
}
|
||||
|
||||
@@ -157,42 +157,10 @@ class SessionPenRoutingTest {
|
||||
SessionPrefs.setPenSetting(activity, "pen", SessionPrefs.PEN_TOUCH)
|
||||
invoke("readPrefs")
|
||||
assertFalse(hover(event(MotionEvent.ACTION_HOVER_MOVE, 30, pen to 500f)))
|
||||
assertTrue(hover(event(MotionEvent.ACTION_HOVER_MOVE, 40, finger to 500f, source = InputDevice.SOURCE_MOUSE)))
|
||||
assertFalse(hover(event(MotionEvent.ACTION_HOVER_MOVE, 40, finger to 500f, source = InputDevice.SOURCE_MOUSE)))
|
||||
assertEquals(listOf(PEN_IN, PEN_IN or PEN_TIP, 0), CompositorShadow.pens.map { it.flags })
|
||||
}
|
||||
|
||||
@Test fun aMouseOnTheOtherScreensGameMovesTheSessionPointer() {
|
||||
fun hover(event: MotionEvent) = ReflectionHelpers.callInstanceMethod<Boolean>(activity, "onBottomGameHover",
|
||||
ReflectionHelpers.ClassParameter.from(MotionEvent::class.java, event))
|
||||
fun touch(event: MotionEvent) = ReflectionHelpers.callInstanceMethod<Boolean>(activity, "onBottomGameTouch",
|
||||
ReflectionHelpers.ClassParameter.from(MotionEvent::class.java, event))
|
||||
val mouse = MotionEvent.TOOL_TYPE_MOUSE
|
||||
assertTrue(hover(event(MotionEvent.ACTION_HOVER_MOVE, 10, mouse to 250f, source = InputDevice.SOURCE_MOUSE)))
|
||||
assertTrue(hover(event(MotionEvent.ACTION_BUTTON_PRESS, 20, mouse to 250f, source = InputDevice.SOURCE_MOUSE,
|
||||
buttons = MotionEvent.BUTTON_PRIMARY)))
|
||||
assertTrue(touch(event(MotionEvent.ACTION_DOWN, 20, mouse to 250f, source = InputDevice.SOURCE_MOUSE,
|
||||
buttons = MotionEvent.BUTTON_PRIMARY)))
|
||||
assertTrue(touch(event(MotionEvent.ACTION_MOVE, 30, mouse to 750f, source = InputDevice.SOURCE_MOUSE,
|
||||
buttons = MotionEvent.BUTTON_PRIMARY)))
|
||||
assertTrue(touch(event(MotionEvent.ACTION_UP, 40, mouse to 750f, source = InputDevice.SOURCE_MOUSE)))
|
||||
assertTrue(hover(event(MotionEvent.ACTION_HOVER_MOVE, 50, finger to 600f, source = InputDevice.SOURCE_TOUCHPAD)))
|
||||
assertEquals(
|
||||
listOf(InputSpace.x(250f, 1000), InputSpace.x(250f, 1000), InputSpace.x(750f, 1000), InputSpace.x(600f, 1000)),
|
||||
CompositorShadow.pointers.map { it.second },
|
||||
)
|
||||
assertTrue(CompositorShadow.pointers.all { it.first == 1 && it.third == InputSpace.y(300f, 600) })
|
||||
assertTrue(CompositorShadow.pens.isEmpty())
|
||||
assertTrue(CompositorShadow.touches.isEmpty())
|
||||
}
|
||||
|
||||
@Test fun aControllerOnTheOtherScreensGameIsNotTakenAsAMouse() {
|
||||
fun hover(event: MotionEvent) = ReflectionHelpers.callInstanceMethod<Boolean>(activity, "onBottomGameHover",
|
||||
ReflectionHelpers.ClassParameter.from(MotionEvent::class.java, event))
|
||||
assertFalse(hover(event(MotionEvent.ACTION_MOVE, 10, finger to 500f, source = InputDevice.SOURCE_JOYSTICK)))
|
||||
assertTrue(CompositorShadow.pointers.isEmpty())
|
||||
assertTrue(CompositorShadow.pens.isEmpty())
|
||||
}
|
||||
|
||||
@Test fun glassesAProgramPointerLockAndAppUiDropPenHover() {
|
||||
state<Boolean>("glassesOutputActive").value = true
|
||||
activity.dispatchGenericMotionEvent(event(MotionEvent.ACTION_HOVER_MOVE, 10, pen to 500f))
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.content.Context
|
||||
import android.content.ContextWrapper
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import com.droiddeck.launcher.input.SecondScreenMode
|
||||
import org.junit.Assert.*
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
class DesktopLockLifecycleTest {
|
||||
@Test fun invalidDesktopMetadataStillRequiresApproval() {
|
||||
for ((ui, url) in listOf("desktop" to "https://example.org", "bad-ui" to "", "" to "")) {
|
||||
assertTrue(DesktopLock.requiresUnlock(true, SessionService.MODE_DESKTOP, ui))
|
||||
assertNull(DesktopLock.handoff(SessionService.MODE_DESKTOP, ui, url))
|
||||
}
|
||||
assertFalse(DesktopLock.requiresUnlock(false, SessionService.MODE_DESKTOP, "desktop"))
|
||||
assertFalse(DesktopLock.requiresUnlock(true, SessionService.MODE_STEAM, "bigpicture"))
|
||||
assertNotNull(DesktopLock.handoff(SessionService.MODE_STEAM, "desktop", "steam://open/main"))
|
||||
}
|
||||
|
||||
@Test fun handoffRetainsSourceAndIsConsumed() {
|
||||
val request = DesktopLock.Handoff(SessionService.MODE_DESKTOP, "desktop", "", "original")
|
||||
val intent = request.put(Intent())
|
||||
assertEquals(request, DesktopLock.handoff(intent))
|
||||
assertNull(DesktopLock.handoff(intent))
|
||||
assertTrue(DesktopLock.currentSession("original", "original", true))
|
||||
assertFalse(DesktopLock.currentSession("original", "replacement", true))
|
||||
assertFalse(DesktopLock.currentSession("original", "original", false))
|
||||
assertFalse(DesktopLock.currentSession(null, null, true))
|
||||
}
|
||||
|
||||
@Test fun unavailableDesktopFallsBackWithoutChangingSavedChoice() {
|
||||
val remembered = SecondScreenMode.DESKTOP.id
|
||||
assertEquals(SecondScreenMode.MENU, SecondScreenMode.opening(remembered, true, bottomDesktop = false))
|
||||
assertEquals(SecondScreenMode.MENU, SecondScreenMode.opening(remembered, false, bottomDesktop = false))
|
||||
assertEquals(SecondScreenMode.DESKTOP, SecondScreenMode.opening(remembered, true, bottomDesktop = true))
|
||||
assertEquals(SecondScreenMode.TERMINAL, SecondScreenMode.opening("terminal", true, bottomDesktop = false))
|
||||
}
|
||||
|
||||
@Test fun failedWritesKeepLastSavedCredentialsAndSuccessfulClearDisablesLock() {
|
||||
val base = RuntimeEnvironment.getApplication() as Context
|
||||
val real = base.getSharedPreferences("desktop-lock-test-${System.nanoTime()}", Context.MODE_PRIVATE)
|
||||
var fail = false
|
||||
val preferences = object : SharedPreferences by real {
|
||||
override fun edit(): SharedPreferences.Editor {
|
||||
val editor = real.edit()
|
||||
return object : SharedPreferences.Editor by editor {
|
||||
override fun putString(key: String?, value: String?): SharedPreferences.Editor {
|
||||
editor.putString(key, value)
|
||||
return this
|
||||
}
|
||||
override fun commit(): Boolean {
|
||||
val written = editor.commit()
|
||||
return written && !fail
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
val context = object : ContextWrapper(base) {
|
||||
override fun getSharedPreferences(name: String, mode: Int) = preferences
|
||||
}
|
||||
assertFalse(DesktopLock.enabled(context))
|
||||
assertTrue(DesktopLock.set(context, "2468"))
|
||||
assertFalse(DesktopLock.clear(context, "1234"))
|
||||
fail = true
|
||||
assertThrows(java.io.IOException::class.java) { DesktopLock.clear(context, "2468") }
|
||||
assertTrue(DesktopLock.enabled(context))
|
||||
assertTrue(DesktopLock.matches(context, "2468"))
|
||||
assertThrows(java.io.IOException::class.java) { DesktopLock.set(context, "1357") }
|
||||
assertTrue(DesktopLock.matches(context, "2468"))
|
||||
assertFalse(DesktopLock.matches(context, "1357"))
|
||||
fail = false
|
||||
assertTrue(DesktopLock.clear(context, "2468"))
|
||||
assertFalse(DesktopLock.enabled(context))
|
||||
assertFalse(DesktopLock.matches(context, "2468"))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.os.Bundle
|
||||
import android.os.Looper
|
||||
import com.droiddeck.launcher.FrontEndActivity
|
||||
import com.droiddeck.launcher.SessionActivity
|
||||
import com.droiddeck.launcher.input.SecondScreenMode
|
||||
import org.junit.Assert.*
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.Robolectric
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.Shadows.shadowOf
|
||||
import org.robolectric.annotation.Config
|
||||
import org.robolectric.annotation.LooperMode
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [28])
|
||||
@LooperMode(LooperMode.Mode.PAUSED)
|
||||
class DesktopLockPromptTest {
|
||||
private val request = DesktopLock.Handoff(SessionService.MODE_STEAM, "desktop", "steam://open/main", "source")
|
||||
|
||||
@Test fun submittedHandoffSurvivesStopAndRecreationWithoutSavingPin() {
|
||||
val activity = launcher()
|
||||
call(activity, "askHandoff", request)
|
||||
submit(activity, "2468")
|
||||
assertEquals(request, pending(activity))
|
||||
val state = Bundle()
|
||||
call(activity, "saveLauncherState", state)
|
||||
assertFalse(state.keySet().any { state.get(it)?.toString()?.contains("2468") == true })
|
||||
call(activity, "stopPinPrompt")
|
||||
awaitWork()
|
||||
assertNull(prompt(activity))
|
||||
assertEquals(request, pending(activity))
|
||||
val restored = launcher()
|
||||
call(restored, "restorePendingUnlock", state)
|
||||
assertEquals(request, pending(restored))
|
||||
assertNotNull(prompt(restored))
|
||||
submit(restored, "0000")
|
||||
awaitWork()
|
||||
assertNull(pending(restored))
|
||||
}
|
||||
|
||||
@Test fun stoppedPromptIsRearmedAndCancellationClearsHandoff() {
|
||||
val activity = launcher()
|
||||
call(activity, "askHandoff", request)
|
||||
val original = prompt(activity)
|
||||
call(activity, "stopPinPrompt")
|
||||
assertNull(prompt(activity))
|
||||
call(activity, "resumePinPrompt")
|
||||
assertNotNull(prompt(activity))
|
||||
assertNotSame(original, prompt(activity))
|
||||
val ask = prompt(activity)!!
|
||||
call(activity, "setPinAsk", null)
|
||||
(call(ask, "getOnCancel") as Function0<*>).invoke()
|
||||
assertNull(pending(activity))
|
||||
call(activity, "resumePinPrompt")
|
||||
assertNull(prompt(activity))
|
||||
}
|
||||
|
||||
@Test fun replacementDiscardsQueuedApprovalAndAcceptsNewHandoff() {
|
||||
val activity = launcher()
|
||||
call(activity, "askHandoff", request)
|
||||
submit(activity, "2468")
|
||||
call(activity, "supersedeUncommittedLaunch")
|
||||
assertNull(prompt(activity))
|
||||
assertNull(pending(activity))
|
||||
val replacement = request.copy(source = "replacement")
|
||||
call(activity, "askHandoff", replacement)
|
||||
val ask = prompt(activity)
|
||||
awaitWork()
|
||||
assertSame(ask, prompt(activity))
|
||||
assertEquals(replacement, pending(activity))
|
||||
assertTrue(DesktopLock.matches(activity, "2468"))
|
||||
}
|
||||
|
||||
@Test fun ordinaryApprovalCannotRunAfterStopOrReplacement() {
|
||||
for (event in listOf("stopPinPrompt", "supersedeUncommittedLaunch")) {
|
||||
val activity = launcher()
|
||||
var launches = 0
|
||||
call(activity, "whenUnlocked", { launches++ })
|
||||
submit(activity, "2468")
|
||||
call(activity, event)
|
||||
awaitWork()
|
||||
assertEquals(0, launches)
|
||||
assertNull(prompt(activity))
|
||||
assertNull(pending(activity))
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun ordinaryApprovalStillRunsAndSettingsAreUnchanged() {
|
||||
val activity = launcher()
|
||||
var launches = 0
|
||||
call(activity, "whenUnlocked", { launches++ })
|
||||
submit(activity, "2468")
|
||||
awaitWork()
|
||||
assertEquals(1, launches)
|
||||
assertTrue(DesktopLock.enabled(activity))
|
||||
assertTrue(DesktopLock.matches(activity, "2468"))
|
||||
call(activity, "supersedeUncommittedLaunch")
|
||||
assertEquals(1, launches)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(shadows = [com.droiddeck.launcher.input.SessionInputPointerTest.WriterShadow::class])
|
||||
fun lockedDesktopResolvesBeforeStorageWithoutChangingSavedPanel() {
|
||||
val previousMode = SessionState.secondScreenMode
|
||||
SessionState.secondScreenMode = SecondScreenMode.DESKTOP
|
||||
val activity = Robolectric.buildActivity(SessionActivity::class.java).get()
|
||||
DesktopLock.set(activity, "2468")
|
||||
SessionPrefs.setSecondScreenPanel(activity, false, SecondScreenMode.DESKTOP.id)
|
||||
try {
|
||||
call(activity, "refreshAvailablePanel")
|
||||
assertEquals(SecondScreenMode.KEYBOARD_TRACKPAD, SessionState.secondScreenMode)
|
||||
assertEquals(SecondScreenMode.KEYBOARD_TRACKPAD, call(activity, "getSecondScreenMode"))
|
||||
call(activity, "panelMode", SecondScreenMode.DESKTOP)
|
||||
assertEquals(SecondScreenMode.KEYBOARD_TRACKPAD, SessionState.secondScreenMode)
|
||||
} finally {
|
||||
SessionState.secondScreenMode = previousMode
|
||||
}
|
||||
assertEquals(SecondScreenMode.KEYBOARD_TRACKPAD, call(activity, "availablePanel", SecondScreenMode.DESKTOP))
|
||||
for (mode in SecondScreenMode.entries.filter { it != SecondScreenMode.DESKTOP }) {
|
||||
assertEquals(mode, call(activity, "availablePanel", mode))
|
||||
}
|
||||
assertEquals(SecondScreenMode.DESKTOP.id, SessionPrefs.secondScreenPanel(activity, false))
|
||||
assertTrue(DesktopLock.clear(activity, "2468"))
|
||||
assertEquals(SecondScreenMode.DESKTOP.id, SessionPrefs.secondScreenPanel(activity, false))
|
||||
}
|
||||
|
||||
private fun launcher(): FrontEndActivity = Robolectric.buildActivity(FrontEndActivity::class.java).get().also {
|
||||
DesktopLock.set(it, "2468")
|
||||
}
|
||||
|
||||
private fun pending(activity: FrontEndActivity): Any? =
|
||||
FrontEndActivity::class.java.getDeclaredField("pendingUnlock").apply { isAccessible = true }.get(activity)
|
||||
|
||||
private fun prompt(activity: FrontEndActivity) = call(activity, "getPinAsk")
|
||||
|
||||
private fun submit(activity: FrontEndActivity, pin: String) {
|
||||
val ask = prompt(activity)!!
|
||||
call(activity, "setPinAsk", null)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
(call(ask, "getOnPin") as (String) -> Unit)(pin)
|
||||
}
|
||||
|
||||
private fun call(target: Any, name: String, vararg args: Any?): Any? =
|
||||
target.javaClass.declaredMethods.single { it.name == name && it.parameterCount == args.size }
|
||||
.apply { isAccessible = true }.invoke(target, *args)
|
||||
|
||||
private fun awaitWork() {
|
||||
Thread.getAllStackTraces().keys.filter { it.name == "desktop-pin" }.forEach {
|
||||
it.join(5_000)
|
||||
assertFalse("PIN verification did not finish", it.isAlive)
|
||||
}
|
||||
shadowOf(Looper.getMainLooper()).idle()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import org.junit.Assert.assertArrayEquals
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class DesktopLockTest {
|
||||
@Test
|
||||
fun pinMustBeFourToEightDigits() {
|
||||
assertTrue(DesktopLock.validPin("1234"))
|
||||
assertTrue(DesktopLock.validPin("12345678"))
|
||||
assertFalse(DesktopLock.validPin("123"))
|
||||
assertFalse(DesktopLock.validPin("123456789"))
|
||||
assertFalse(DesktopLock.validPin("12a4"))
|
||||
assertFalse(DesktopLock.validPin(""))
|
||||
assertFalse(DesktopLock.validPin("١٢٣٤"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun desktopModeAndSteamDesktopUiAreGated() {
|
||||
assertTrue(DesktopLock.entersDesktop(SessionService.MODE_DESKTOP, null))
|
||||
assertTrue(DesktopLock.entersDesktop(SessionService.MODE_DESKTOP, "bigpicture"))
|
||||
assertTrue(DesktopLock.entersDesktop(SessionService.MODE_STEAM, "desktop"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bigPictureAndGamesAreNotGated() {
|
||||
assertFalse(DesktopLock.entersDesktop(SessionService.MODE_STEAM, null))
|
||||
assertFalse(DesktopLock.entersDesktop(SessionService.MODE_STEAM, "bigpicture"))
|
||||
assertFalse(DesktopLock.entersDesktop(SessionService.MODE_RUN, null))
|
||||
assertFalse(DesktopLock.entersDesktop(null, null))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hashIsSaltedAndDeterministic() {
|
||||
val salt = ByteArray(16) { it.toByte() }
|
||||
val other = ByteArray(16) { (it + 1).toByte() }
|
||||
val a = DesktopLock.hash("2468", salt)
|
||||
assertEquals(32, a.size)
|
||||
assertArrayEquals(a, DesktopLock.hash("2468", salt))
|
||||
assertFalse(a.contentEquals(DesktopLock.hash("2469", salt)))
|
||||
assertFalse(a.contentEquals(DesktopLock.hash("2468", other)))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.ui.semantics.SemanticsActions
|
||||
import androidx.compose.ui.test.onNodeWithText
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [28])
|
||||
class TextEntrySubmissionTest {
|
||||
@get:Rule val compose = createRobolectricComposeRule()
|
||||
|
||||
@Test fun duplicateSubmitDuringClosingIsIgnored() {
|
||||
var submissions = 0
|
||||
compose.setContent {
|
||||
DroidDeckTheme {
|
||||
TextEntryDialog("PIN", "2468", true, "Submit", { submissions++ }, {}, secret = true)
|
||||
}
|
||||
}
|
||||
val submit = compose.onNodeWithText("Submit").fetchSemanticsNode().config[SemanticsActions.OnClick].action!!
|
||||
compose.runOnIdle { submit(); submit() }
|
||||
assertEquals(1, submissions)
|
||||
}
|
||||
|
||||
@Test fun submitAfterCancelStartsIsIgnored() {
|
||||
var submissions = 0
|
||||
compose.setContent {
|
||||
DroidDeckTheme {
|
||||
TextEntryDialog("PIN", "2468", true, "Submit", { submissions++ }, {}, secret = true)
|
||||
}
|
||||
}
|
||||
val submit = compose.onNodeWithText("Submit").fetchSemanticsNode().config[SemanticsActions.OnClick].action!!
|
||||
val cancel = compose.onNodeWithText("Cancel").fetchSemanticsNode().config[SemanticsActions.OnClick].action!!
|
||||
compose.runOnIdle { cancel(); submit() }
|
||||
assertEquals(0, submissions)
|
||||
}
|
||||
}
|
||||
@@ -193,6 +193,15 @@ A Unity game under FEX (`UnityPlayer.dll` for Windows builds under Proton,
|
||||
turns it off: without TSO such games can deadlock or crash (seen with Megabonk
|
||||
and Crab Game). A FEX preset 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 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
|
||||
applies.
|
||||
|
||||
Games launched through Proton get `vblank_mode=0`, so OpenGL does not wait for
|
||||
each screen refresh. Wine asks for a swap interval of 1 on every OpenGL window, and WineD3D's front-buffer
|
||||
drawing (DirectDraw, Direct3D 1–7) never lowers it, so those games ran at the
|
||||
|
||||
@@ -150,6 +150,19 @@ The SPIR-V version the driver gets:
|
||||
- This is what Dawn ("Disable SPIR-V 1.4 on Android ARM"), ANGLE (`supportsSPIRV14`) and naga
|
||||
(`AVOID_SPIRV_COPY_LOGICAL`) do for a proprietary compiler they cannot trust.
|
||||
|
||||
Geometry shaders:
|
||||
- The Mali-G610's driver (r38p1) crashes compiling Zink's geometry shaders, always at the same
|
||||
place (SIGSEGV at 0x40 in `cmpbe_v2_compile_multiple_shaders`): its shader for `GL_QUADS`, and
|
||||
a GLSL geometry shader that only passes triangles on.
|
||||
- A geometry shader that only passes triangles on, from a plain Vulkan program, does not crash it
|
||||
but draws nothing, in SPIR-V 1.0, 1.3 and 1.6, with and without the layer.
|
||||
- Zink writes them in SPIR-V 1.6 with the Vulkan memory model, which the version cap leaves alone.
|
||||
Lowering them would not help, since the plain shader draws nothing at 1.0 and 1.3 either.
|
||||
- On ARM GPUs the layer reports no `geometryShader` to Zink (engine name `mesa zink`). Mesa then
|
||||
splits quads into triangles itself, and Zink still offers OpenGL 3.2. DXVK keeps the feature: it
|
||||
needs it for D3D10 and 11.
|
||||
- `DROIDDECK_MALI_COMPAT_NO_GS=0` keeps the feature for Zink, `=1` hides it from every application.
|
||||
|
||||
Files:
|
||||
- `layer.c`: loader plumbing, feature and limit reporting, device creation, the hook table.
|
||||
- `pipeline.c`: pipelines, shader modules, viewports.
|
||||
|
||||
@@ -66,6 +66,69 @@ DOTNET_FEX = {
|
||||
"FEX_HALFBARRIERTSOENABLED": "1",
|
||||
"FEX_X87REDUCEDPRECISION": "0",
|
||||
}
|
||||
STABILITY_FEX = dict(DOTNET_FEX, FEX_MULTIBLOCK="0")
|
||||
# Setup loader offset-table IDs, as innoextract's known_setup_loader_versions lists them. Loaders
|
||||
# from 5.1.5 keep the table in a resource; older ones also put "Inno" at file offset 0x30.
|
||||
INNO_LOADER_IDS = (b"rDlPtS", b"nS5W7dT\x83\xaa\x1b\x0fj")
|
||||
INNO_RESOURCE_LIMIT = 4 << 20
|
||||
|
||||
|
||||
def is_inno_setup(path):
|
||||
try:
|
||||
with open(path, "rb") as exe:
|
||||
head = exe.read(4096)
|
||||
if head[:2] != b"MZ":
|
||||
return False
|
||||
if head[0x30:0x34] == b"Inno":
|
||||
return True
|
||||
pe = int.from_bytes(head[0x3C:0x40], "little")
|
||||
if head[pe:pe + 4] != b"PE\0\0" or int.from_bytes(head[pe + 4:pe + 6], "little") != 0x14C:
|
||||
return False
|
||||
count = int.from_bytes(head[pe + 6:pe + 8], "little")
|
||||
table = pe + 24 + int.from_bytes(head[pe + 20:pe + 22], "little")
|
||||
for entry in range(table, table + 40 * count, 40):
|
||||
if head[entry:entry + 8].rstrip(b"\0") == b".rsrc":
|
||||
exe.seek(int.from_bytes(head[entry + 20:entry + 24], "little"))
|
||||
size = int.from_bytes(head[entry + 16:entry + 20], "little")
|
||||
resources = exe.read(min(size, INNO_RESOURCE_LIMIT))
|
||||
return any(marker in resources for marker in INNO_LOADER_IDS)
|
||||
except OSError:
|
||||
pass
|
||||
return False
|
||||
|
||||
|
||||
STORE_LAUNCHER = ".droiddeck-launch.bat"
|
||||
STORE_SIDECAR = ".droiddeck-store.json"
|
||||
|
||||
|
||||
def store_game_exe(exe):
|
||||
if os.path.basename(exe).lower() != STORE_LAUNCHER:
|
||||
return exe
|
||||
folder = os.path.dirname(exe)
|
||||
try:
|
||||
with open(os.path.join(folder, STORE_SIDECAR), encoding="utf-8") as source:
|
||||
sidecar = json.load(source)
|
||||
except (OSError, ValueError):
|
||||
return exe
|
||||
target = sidecar.get("exe") if isinstance(sidecar, dict) else None
|
||||
if not isinstance(target, str) or not target.strip() or "\0" in target:
|
||||
return exe
|
||||
normalized = target.replace("\\", "/")
|
||||
if ":" in normalized or normalized.startswith("/") or ".." in normalized.split("/"):
|
||||
return exe
|
||||
relative = os.path.normpath(normalized)
|
||||
if os.path.isabs(relative) or relative in (".", "..") or relative.startswith(".." + os.sep):
|
||||
return exe
|
||||
candidate = os.path.join(folder, relative)
|
||||
if not os.path.isfile(candidate):
|
||||
return exe
|
||||
root = os.path.realpath(folder)
|
||||
try:
|
||||
if os.path.commonpath((root, os.path.realpath(candidate))) != root:
|
||||
return exe
|
||||
except ValueError:
|
||||
return exe
|
||||
return candidate
|
||||
|
||||
|
||||
def game_files(exe):
|
||||
@@ -89,6 +152,7 @@ def game_files(exe):
|
||||
class Game:
|
||||
|
||||
def __init__(self, exe, args, app_id=""):
|
||||
exe = store_game_exe(exe)
|
||||
self.exe = exe
|
||||
self.args = args
|
||||
self.app_id = app_id
|
||||
@@ -191,6 +255,12 @@ def split_second_x87_fip(game):
|
||||
return {"FEX_JITFEATURES": "enablex87fip"}, [], "Split/Second: FEX x87 FIP emulation on (its SecuROM stops with error 8016 without it)"
|
||||
|
||||
|
||||
@fix
|
||||
def inno_setup_stability(game):
|
||||
if is_inno_setup(game.exe):
|
||||
return STABILITY_FEX, [], "Inno Setup installer: FEX Stability settings (under Performance + TSO the 32-bit setup stub corrupts its own paths)"
|
||||
|
||||
|
||||
@fix
|
||||
def doom_2016_swapchain_images(game):
|
||||
if "doomx64vk.exe" in game.files and game.stem in ("doomx64", "doomx64vk"):
|
||||
@@ -273,7 +343,7 @@ def with_system_settings(text, settings):
|
||||
|
||||
# The game ignores -ini: overrides and deletes a writable Engine.ini after reading it, so this runs at every launch.
|
||||
def dragon_quest_monsters_4_mesh_detail(exe, env):
|
||||
project = Path(exe).stem.split("-", 1)[0]
|
||||
project = Path(store_game_exe(exe)).stem.split("-", 1)[0]
|
||||
if not project.lower().startswith("dragonquestmonsters4"):
|
||||
return
|
||||
prefix = Path(env.get("STEAM_COMPAT_DATA_PATH", "/nonexistent")) / "pfx"
|
||||
@@ -398,7 +468,7 @@ def zomboid_rewrite(node):
|
||||
def project_zomboid_jvm(command):
|
||||
if len(command) <= 2:
|
||||
return
|
||||
exe = Path(command[2])
|
||||
exe = Path(store_game_exe(command[2]))
|
||||
if not exe.stem.lower().startswith("projectzomboid"):
|
||||
return
|
||||
settings = exe.with_suffix(".json")
|
||||
@@ -721,12 +791,15 @@ def apply_config(env, config, app_id, fixes=None):
|
||||
|
||||
|
||||
def render_path_defaults(command, env):
|
||||
if len(command) < 3 or command[1] != "waitforexitandrun" or Path(command[2]).name.lower() != "spintires.exe":
|
||||
if len(command) < 3 or command[1] != "waitforexitandrun":
|
||||
return None
|
||||
exe = Path(store_game_exe(command[2]))
|
||||
if exe.name.lower() != "spintires.exe":
|
||||
return None
|
||||
own = env.get("DXVK_CONFIG", "")
|
||||
if re.search(r"(?:^|;)\s*dxvk\.tilerMode\s*=", own) or env.get("DXVK_CONFIG_FILE"):
|
||||
return None
|
||||
if Path("dxvk.conf").is_file() or Path(command[2]).with_name("dxvk.conf").is_file():
|
||||
if Path("dxvk.conf").is_file() or exe.with_name("dxvk.conf").is_file():
|
||||
return None
|
||||
driver = env.get("VK_DRIVER_FILES", env.get("VK_ICD_FILENAMES", ""))
|
||||
if Path(driver).parent.name != "DD-Turnip_v0.4.0":
|
||||
@@ -1290,7 +1363,7 @@ def dirt_ws2_wanted(command, env):
|
||||
prefix = env.get("STEAM_COMPAT_DATA_PATH", "").rstrip("/")
|
||||
if len(command) < 3 or not prefix or not os.path.isfile(DIRT_WS2):
|
||||
return None
|
||||
game = DIRT_GAMES.get(os.path.splitext(os.path.basename(command[2]))[0].lower())
|
||||
game = DIRT_GAMES.get(os.path.splitext(os.path.basename(store_game_exe(command[2])))[0].lower())
|
||||
if not game or not dirt_telemetry_on(prefix, game) or proton_has_dirt_fix(command[0]):
|
||||
return None
|
||||
return prefix if os.path.lexists(prefix_ws2(prefix)) else None
|
||||
@@ -1347,7 +1420,7 @@ def ego_core_plan(command, env):
|
||||
count = windows_core_count(env)
|
||||
if not count or len(command) < 3:
|
||||
return None
|
||||
folder = Path(command[2]).parent
|
||||
folder = Path(store_game_exe(command[2])).parent
|
||||
path = folder / EGO_RESTRICTIONS
|
||||
try:
|
||||
raw = path.read_bytes()
|
||||
@@ -1676,14 +1749,26 @@ def main():
|
||||
if note:
|
||||
print("droiddeck-game-env: " + note, file=sys.stderr)
|
||||
else:
|
||||
# An installer started with the run verb gets the same Stability settings as one started with
|
||||
# waitforexitandrun; explicit game settings still win over them in apply_config.
|
||||
installer = {}
|
||||
if len(command) > 2 and command[1] == "run" and is_inno_setup(command[2]):
|
||||
installer = dict(STABILITY_FEX)
|
||||
print("droiddeck-game-env: Inno Setup installer: FEX Stability settings", file=sys.stderr)
|
||||
path = Path.home() / ".config/droiddeck/game-environment.json"
|
||||
try:
|
||||
with path.open(encoding="utf-8") as source:
|
||||
config = json.load(source)
|
||||
env = apply_config(env, sync_config(config, app_id), app_id)
|
||||
synced = sync_config(config, app_id)
|
||||
if installer:
|
||||
# A FEX preset chosen for the game itself still wins, as on every other launch path.
|
||||
game = config.get("games", {}).get(app_id, {})
|
||||
synced["games"][app_id].update({k: v for k, v in game.items() if k in STABILITY_FEX})
|
||||
env = apply_config(env, synced, app_id, installer)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
env = dict(env, **installer)
|
||||
except (OSError, ValueError, TypeError, AttributeError):
|
||||
env = dict(env, **installer)
|
||||
print("droiddeck-game-env: invalid configuration; using inherited environment", file=sys.stderr)
|
||||
if waiting:
|
||||
before_debug = env
|
||||
|
||||
@@ -224,15 +224,23 @@ if [ -n "${DD_VK_DRIVER:-}" ]; then
|
||||
unset dd_icd_lib
|
||||
fi
|
||||
dd_webhelper_layout() {
|
||||
local layout
|
||||
if [ -n "${DD_VKBRIDGE_WEBHELPER_ARGS:-}" ]; then
|
||||
printf '%s\n' "$DD_VKBRIDGE_WEBHELPER_ARGS"
|
||||
elif [ -z "${DD_VKBRIDGE_CEF_ANGLE:-}" ]; then
|
||||
echo stock
|
||||
elif [ "$DD_VKBRIDGE_CEF_ANGLE" = vulkan ] && [ "${DD_VKBRIDGE_CEF_VULKAN:-1}" != 0 ]; then
|
||||
echo "--use-gl=angle --use-angle=vulkan +Vulkan +VulkanFromANGLE +DefaultANGLEVulkan"
|
||||
else
|
||||
echo "--use-gl=angle --use-angle=$DD_VKBRIDGE_CEF_ANGLE"
|
||||
return
|
||||
fi
|
||||
if [ -z "${DD_VKBRIDGE_CEF_ANGLE:-}" ]; then
|
||||
echo stock
|
||||
return
|
||||
fi
|
||||
# ANGLE switches must not replace the helper's stable single-process layout.
|
||||
layout="--no-zygote --in-process-gpu -AudioServiceOutOfProcess"
|
||||
if [ "$DD_VKBRIDGE_CEF_ANGLE" = vulkan ] && [ "${DD_VKBRIDGE_CEF_VULKAN:-1}" != 0 ]; then
|
||||
layout="$layout --use-gl=angle --use-angle=vulkan +Vulkan +VulkanFromANGLE +DefaultANGLEVulkan"
|
||||
else
|
||||
layout="$layout --use-gl=angle --use-angle=$DD_VKBRIDGE_CEF_ANGLE"
|
||||
fi
|
||||
printf '%s\n' "$layout"
|
||||
}
|
||||
dd_now_ms() {
|
||||
if [ -n "${EPOCHREALTIME:-}" ]; then
|
||||
|
||||
@@ -203,10 +203,17 @@ static void test_handle_map_null_key(void)
|
||||
map_free(&map);
|
||||
}
|
||||
|
||||
static int zink_instance_table;
|
||||
static struct object mock_zink_instance = {&zink_instance_table};
|
||||
static struct object mock_arm = {&instance_table};
|
||||
static struct object mock_zink_arm = {&zink_instance_table}, mock_zink_other = {&zink_instance_table};
|
||||
|
||||
static VkResult VKAPI_CALL mock_create_instance(const VkInstanceCreateInfo *info, const VkAllocationCallbacks *allocator,
|
||||
VkInstance *instance)
|
||||
{
|
||||
*instance = (VkInstance)&mock_instance;
|
||||
const VkApplicationInfo *app = info->pApplicationInfo;
|
||||
bool zink = app && app->pEngineName && !strcmp(app->pEngineName, "mesa zink");
|
||||
*instance = (VkInstance)(zink ? &mock_zink_instance : &mock_instance);
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -223,6 +230,7 @@ static void VKAPI_CALL mock_features(VkPhysicalDevice physical, VkPhysicalDevice
|
||||
{
|
||||
memset(features, 0, sizeof(*features));
|
||||
features->dualSrcBlend = physical == (VkPhysicalDevice)&mock_capable;
|
||||
features->geometryShader = VK_TRUE;
|
||||
}
|
||||
|
||||
static void VKAPI_CALL mock_features2(VkPhysicalDevice physical, VkPhysicalDeviceFeatures2 *features)
|
||||
@@ -234,6 +242,8 @@ static void VKAPI_CALL mock_properties(VkPhysicalDevice physical, VkPhysicalDevi
|
||||
{
|
||||
memset(properties, 0, sizeof(*properties));
|
||||
strcpy(properties->deviceName, "mock");
|
||||
bool arm = physical == (VkPhysicalDevice)&mock_arm || physical == (VkPhysicalDevice)&mock_zink_arm;
|
||||
properties->vendorID = arm ? 0x13b5 : 0;
|
||||
properties->limits.maxFragmentDualSrcAttachments = physical == (VkPhysicalDevice)&mock_capable;
|
||||
}
|
||||
|
||||
@@ -385,6 +395,50 @@ static void destroy_device(VkDevice device)
|
||||
((PFN_vkDestroyDevice)layer_gdpa(device, "vkDestroyDevice"))(device, NULL);
|
||||
}
|
||||
|
||||
static void test_geometry_shader_hidden_from_zink(void)
|
||||
{
|
||||
VkPhysicalDeviceFeatures features;
|
||||
PFN_vkGetPhysicalDeviceFeatures plain_features =
|
||||
(PFN_vkGetPhysicalDeviceFeatures)layer_gipa((VkInstance)&mock_instance, "vkGetPhysicalDeviceFeatures");
|
||||
PFN_vkGetPhysicalDeviceFeatures2 plain_features2 =
|
||||
(PFN_vkGetPhysicalDeviceFeatures2)layer_gipa((VkInstance)&mock_instance, "vkGetPhysicalDeviceFeatures2");
|
||||
VkPhysicalDeviceFeatures2 queried = {.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2};
|
||||
plain_features((VkPhysicalDevice)&mock_lacking, &features);
|
||||
assert(features.geometryShader);
|
||||
plain_features((VkPhysicalDevice)&mock_arm, &features);
|
||||
assert(features.geometryShader);
|
||||
plain_features2((VkPhysicalDevice)&mock_arm, &queried);
|
||||
assert(queried.features.geometryShader);
|
||||
|
||||
VkApplicationInfo app = {.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, .pEngineName = "mesa zink"};
|
||||
VkLayerInstanceLink link = {NULL, mock_gipa, NULL};
|
||||
VkLayerInstanceCreateInfo loader = {VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO, NULL, VK_LAYER_LINK_INFO, {&link}};
|
||||
VkInstanceCreateInfo info = {.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, .pNext = &loader,
|
||||
.pApplicationInfo = &app};
|
||||
VkInstance zink;
|
||||
assert(((PFN_vkCreateInstance)layer_gipa(NULL, "vkCreateInstance"))(&info, NULL, &zink) == VK_SUCCESS);
|
||||
assert(zink == (VkInstance)&mock_zink_instance);
|
||||
PFN_vkGetPhysicalDeviceFeatures zink_features =
|
||||
(PFN_vkGetPhysicalDeviceFeatures)layer_gipa(zink, "vkGetPhysicalDeviceFeatures");
|
||||
PFN_vkGetPhysicalDeviceFeatures2 zink_features2 =
|
||||
(PFN_vkGetPhysicalDeviceFeatures2)layer_gipa(zink, "vkGetPhysicalDeviceFeatures2");
|
||||
zink_features((VkPhysicalDevice)&mock_zink_arm, &features);
|
||||
assert(!features.geometryShader && features.dualSrcBlend);
|
||||
zink_features2((VkPhysicalDevice)&mock_zink_arm, &queried);
|
||||
assert(!queried.features.geometryShader && queried.features.dualSrcBlend);
|
||||
zink_features((VkPhysicalDevice)&mock_zink_other, &features);
|
||||
assert(features.geometryShader);
|
||||
|
||||
setenv("DROIDDECK_MALI_COMPAT_NO_GS", "0", 1);
|
||||
zink_features((VkPhysicalDevice)&mock_zink_arm, &features);
|
||||
assert(features.geometryShader);
|
||||
setenv("DROIDDECK_MALI_COMPAT_NO_GS", "1", 1);
|
||||
plain_features((VkPhysicalDevice)&mock_lacking, &features);
|
||||
assert(!features.geometryShader);
|
||||
unsetenv("DROIDDECK_MALI_COMPAT_NO_GS");
|
||||
((PFN_vkDestroyInstance)layer_gipa(zink, "vkDestroyInstance"))(zink, NULL);
|
||||
}
|
||||
|
||||
static const VkPipelineColorBlendAttachmentState dual_attachment = {
|
||||
VK_TRUE, VK_BLEND_FACTOR_ONE, VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR, VK_BLEND_OP_ADD,
|
||||
VK_BLEND_FACTOR_SRC1_ALPHA, VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA, VK_BLEND_OP_ADD, 0xf,
|
||||
@@ -575,6 +629,7 @@ int main(int argc, char **argv)
|
||||
setenv("WINEPREFIX", "/nonexistent", 1);
|
||||
unsetenv("DROIDDECK_MALI_COMPAT");
|
||||
unsetenv("DROIDDECK_MALI_COMPAT_TRACE");
|
||||
unsetenv("DROIDDECK_MALI_COMPAT_NO_GS");
|
||||
VkNegotiateLayerInterface negotiate = {LAYER_NEGOTIATE_INTERFACE_STRUCT, NULL, 2, NULL, NULL, NULL};
|
||||
assert(vkNegotiateLoaderLayerInterfaceVersion(&negotiate) == VK_SUCCESS);
|
||||
layer_gipa = negotiate.pfnGetInstanceProcAddr;
|
||||
@@ -587,6 +642,7 @@ int main(int argc, char **argv)
|
||||
PFN_vkCreateInstance create_instance = (PFN_vkCreateInstance)layer_gipa(NULL, "vkCreateInstance");
|
||||
assert(create_instance(&info, NULL, &instance) == VK_SUCCESS);
|
||||
|
||||
test_geometry_shader_hidden_from_zink();
|
||||
test_lacking_device();
|
||||
test_capable_device();
|
||||
test_depth_compare_op();
|
||||
|
||||
@@ -1741,6 +1741,94 @@ class GameEnvironmentTest(unittest.TestCase):
|
||||
(asylum / name).touch()
|
||||
self.assertEqual(MODULE["engine_fixes"](str(asylum / "BmLauncher.exe"), []), ({}, [], []))
|
||||
|
||||
def test_store_launcher_resolves_the_game_executable_from_the_sidecar(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp) / "BatmanArkhamCity"
|
||||
bin_dir = root / "Binaries/Win32"
|
||||
bin_dir.mkdir(parents=True)
|
||||
for name in ("Batman2.exe", "BatmanAC.exe"):
|
||||
(bin_dir / name).touch()
|
||||
launcher = root / ".droiddeck-launch.bat"
|
||||
launcher.touch()
|
||||
(root / ".droiddeck-store.json").write_text(json.dumps({
|
||||
"store": "epic", "id": "Egret", "title": "Batman Arkham City",
|
||||
"exe": "Binaries/Win32/Batman2.exe", "launcher": ".droiddeck-launch.bat",
|
||||
}))
|
||||
env, extra, notes = MODULE["engine_fixes"](str(launcher), [])
|
||||
self.assertEqual((env, extra), ({"FEX_X87REDUCEDPRECISION": "0"}, []))
|
||||
self.assertTrue(notes)
|
||||
|
||||
home = Path(tmp) / "home"
|
||||
config = home / ".config/droiddeck/game-environment.json"
|
||||
config.parent.mkdir(parents=True)
|
||||
config.write_text(json.dumps({"version": 1, "shared": {"FEX_X87REDUCEDPRECISION": "1"}}))
|
||||
probe = home / "proton"
|
||||
probe.write_text("#!" + sys.executable + "\nimport os, sys\n"
|
||||
"print(os.environ.get('FEX_X87REDUCEDPRECISION', ''))\n"
|
||||
"print(sys.argv[2])\n")
|
||||
probe.chmod(0o755)
|
||||
base = {k: v for k, v in os.environ.items() if not k.startswith(("FEX_", "WINE", "PROTON", "DROIDDECK", "DD_", "STEAM"))}
|
||||
base.update(HOME=str(home), STEAM_COMPAT_DATA_PATH=str(home / "compatdata/3648205350"))
|
||||
result = subprocess.run([sys.executable, str(BIN / "droiddeck-game-env"), str(probe), "waitforexitandrun", str(launcher)],
|
||||
env=base, text=True, capture_output=True, check=True)
|
||||
self.assertEqual(result.stdout.splitlines(), ["0", str(launcher)])
|
||||
self.assertIn("Batman: Arkham City: FEX with full x87 precision", result.stderr)
|
||||
|
||||
rebirth = Path(tmp) / "FF7Rebirth"
|
||||
rebirth_exe = rebirth / "End/Binaries/Win64/ff7rebirth_.exe"
|
||||
rebirth_exe.parent.mkdir(parents=True)
|
||||
rebirth_exe.touch()
|
||||
rebirth_launcher = rebirth / ".droiddeck-launch.bat"
|
||||
rebirth_launcher.touch()
|
||||
(rebirth / ".droiddeck-store.json").write_text(json.dumps({
|
||||
"store": "epic", "id": "ff7", "title": "FF7 Rebirth",
|
||||
"exe": r"End\Binaries\Win64\ff7rebirth_.exe", "launcher": ".droiddeck-launch.bat",
|
||||
}))
|
||||
self.assertEqual(MODULE["engine_fixes"](str(rebirth_launcher), [])[0], {"VKD3D_FEATURE_LEVEL": "12_2"})
|
||||
|
||||
def test_store_launcher_ignores_missing_invalid_or_escaping_sidecar_paths(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
outside = Path(tmp) / "Outside"
|
||||
outside.mkdir()
|
||||
outside_exe = outside / "BatmanAC.exe"
|
||||
outside_exe.touch()
|
||||
|
||||
root = Path(tmp) / "Game"
|
||||
sub = root / "sub"
|
||||
sub.mkdir(parents=True)
|
||||
(root / "real.exe").touch()
|
||||
(sub / "nested.exe").touch()
|
||||
(root / "escape.exe").symlink_to(outside_exe)
|
||||
(root / "linkdir").symlink_to(outside)
|
||||
launcher = root / ".droiddeck-launch.bat"
|
||||
launcher.touch()
|
||||
sidecar = root / ".droiddeck-store.json"
|
||||
|
||||
resolve = MODULE["store_game_exe"]
|
||||
self.assertEqual(resolve(str(launcher)), str(launcher))
|
||||
|
||||
for payload in ("not-json", "[]", json.dumps({"exe": ""}), json.dumps({"exe": 123}),
|
||||
json.dumps({"exe": "missing.exe"}), json.dumps({"exe": "sub"}),
|
||||
json.dumps({"exe": "../Outside/BatmanAC.exe"}),
|
||||
json.dumps({"exe": "sub/../real.exe"}),
|
||||
json.dumps({"exe": r"sub\..\real.exe"}),
|
||||
json.dumps({"exe": "linkdir/../real.exe"}),
|
||||
json.dumps({"exe": "sub/../../Outside/BatmanAC.exe"}),
|
||||
json.dumps({"exe": str(outside_exe)}),
|
||||
json.dumps({"exe": r"C:\Windows\notepad.exe"}),
|
||||
json.dumps({"exe": "escape.exe"})):
|
||||
with self.subTest(payload=payload):
|
||||
sidecar.write_text(payload)
|
||||
self.assertEqual(resolve(str(launcher)), str(launcher))
|
||||
|
||||
sidecar.write_text(json.dumps({"exe": "real.exe"}))
|
||||
self.assertEqual(resolve(str(launcher)), str(root / "real.exe"))
|
||||
sidecar.write_text(json.dumps({"exe": "sub/nested.exe"}))
|
||||
self.assertEqual(resolve(str(launcher)), str(sub / "nested.exe"))
|
||||
other_bat = root / "custom.bat"
|
||||
other_bat.touch()
|
||||
self.assertEqual(resolve(str(other_bat)), str(other_bat))
|
||||
|
||||
def test_split_second_gets_x87_fip_unless_the_game_sets_jit_features(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
game = Path(tmp) / "SplitSecond"
|
||||
@@ -1762,6 +1850,76 @@ class GameEnvironmentTest(unittest.TestCase):
|
||||
config["games"] = {"297860": {"FEX_JITFEATURES": "off"}}
|
||||
self.assertEqual(MODULE["apply_config"]({}, config, "297860", env)["FEX_JITFEATURES"], "off")
|
||||
|
||||
def test_inno_setup_installers_get_the_stability_preset_over_the_default(self):
|
||||
stability = {"FEX_TSOENABLED": "1", "FEX_VECTORTSOENABLED": "1", "FEX_MEMCPYSETTSOENABLED": "1",
|
||||
"FEX_HALFBARRIERTSOENABLED": "1", "FEX_X87REDUCEDPRECISION": "0", "FEX_MULTIBLOCK": "0"}
|
||||
performance_tso = {"FEX_TSOENABLED": "1", "FEX_VECTORTSOENABLED": "0", "FEX_MEMCPYSETTSOENABLED": "0",
|
||||
"FEX_HALFBARRIERTSOENABLED": "0", "FEX_X87REDUCEDPRECISION": "1", "FEX_MULTIBLOCK": "1"}
|
||||
|
||||
def loader(path, resources=b"", machine=0x14C, section=b".rsrc", legacy=False):
|
||||
dos = bytearray(0x80)
|
||||
dos[:2] = b"MZ"
|
||||
dos[0x3C:0x40] = (0x80).to_bytes(4, "little")
|
||||
if legacy:
|
||||
dos[0x30:0x34] = b"Inno"
|
||||
header = b"PE\0\0" + machine.to_bytes(2, "little") + (1).to_bytes(2, "little") + bytes(12) \
|
||||
+ (0xE0).to_bytes(2, "little") + bytes(2)
|
||||
entry = section.ljust(8, b"\0") + bytes(8) + len(resources).to_bytes(4, "little") \
|
||||
+ (0x400).to_bytes(4, "little") + bytes(16)
|
||||
path.write_bytes((bytes(dos) + header + bytes(0xE0) + entry).ljust(0x400, b"\0") + resources)
|
||||
return str(path)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
folder = Path(tmp)
|
||||
table = bytes(64) + b"rDlPtS\xcd\xe6\xd7{\x0b*" + bytes(64)
|
||||
installers = [
|
||||
loader(folder / "setup.exe", table),
|
||||
loader(folder / "setup_game_1.0.exe", bytes(64) + b"nS5W7dT\x83\xaa\x1b\x0fj"),
|
||||
loader(folder / "old_setup.exe", legacy=True),
|
||||
]
|
||||
for installer in installers:
|
||||
env, extra, notes = MODULE["engine_fixes"](installer, [])
|
||||
self.assertEqual((env, extra), (stability, []), installer)
|
||||
self.assertTrue(notes)
|
||||
config = {"version": 1, "shared": performance_tso}
|
||||
self.assertEqual({k: v for k, v in MODULE["apply_config"]({}, config, "42", env).items() if k in stability},
|
||||
stability)
|
||||
config["games"] = {"42": {"FEX_MULTIBLOCK": "1"}}
|
||||
self.assertEqual(MODULE["apply_config"]({}, config, "42", env)["FEX_MULTIBLOCK"], "1")
|
||||
|
||||
not_installers = [
|
||||
loader(folder / "Game.exe", bytes(256)),
|
||||
loader(folder / "Game64.exe", table, machine=0x8664),
|
||||
loader(folder / "Data.exe", table, section=b".data"),
|
||||
folder / "missing.exe",
|
||||
]
|
||||
(folder / "notes.exe").write_bytes(b"rDlPtS\xcd\xe6\xd7{\x0b*")
|
||||
not_installers.append(folder / "notes.exe")
|
||||
for other in not_installers:
|
||||
self.assertEqual(MODULE["engine_fixes"](str(other), []), ({}, [], []), other)
|
||||
|
||||
# The run verb skips engine_fixes; an installer started that way still gets Stability.
|
||||
probe = folder / "proton"
|
||||
probe.write_text("#!" + sys.executable + "\nimport json, os\nprint(json.dumps(dict(os.environ)))\n")
|
||||
probe.chmod(0o755)
|
||||
base = {**os.environ, **performance_tso, "HOME": tmp, "STEAM_COMPAT_DATA_PATH": str(folder / "compatdata/42")}
|
||||
|
||||
def run_verb(program):
|
||||
out = subprocess.run([sys.executable, str(BIN / "droiddeck-game-env"), str(probe), "run", program],
|
||||
env=base, text=True, capture_output=True, check=True).stdout
|
||||
return {name: value for name, value in json.loads(out).items() if name in stability}
|
||||
|
||||
self.assertEqual(run_verb(installers[0]), stability)
|
||||
self.assertEqual(run_verb(str(folder / "Game.exe")), performance_tso)
|
||||
config_path = folder / ".config/droiddeck/game-environment.json"
|
||||
config_path.parent.mkdir(parents=True)
|
||||
config_path.write_text(json.dumps({"version": 1, "shared": {"WINEESYNC": "1"}}))
|
||||
self.assertEqual(run_verb(installers[0]), stability)
|
||||
config_path.write_text(json.dumps({"version": 1, "games": {"42": {"FEX_MULTIBLOCK": "1"}}}))
|
||||
self.assertEqual(run_verb(installers[0]), {**stability, "FEX_MULTIBLOCK": "1"})
|
||||
config_path.write_text(json.dumps({"version": 1, "games": {"42": {"FEX_MULTIBLOCK": None}}}))
|
||||
self.assertNotIn("FEX_MULTIBLOCK", run_verb(installers[0]))
|
||||
|
||||
def test_d3dgear_capture_hook_beside_the_game_is_turned_off(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
game = Path(tmp) / "The Crew 2"
|
||||
|
||||
@@ -6,6 +6,7 @@ from pathlib import Path
|
||||
|
||||
SESSION = Path(__file__).resolve().parents[1] / "linuxfs/overlay/usr/local/bin/droiddeck-session"
|
||||
KEYS = ("DD_VKBRIDGE_WEBHELPER_ARGS", "DD_VKBRIDGE_CEF_ANGLE", "DD_VKBRIDGE_CEF_VULKAN")
|
||||
BASE = "--no-zygote --in-process-gpu -AudioServiceOutOfProcess"
|
||||
|
||||
|
||||
def layout_function():
|
||||
@@ -27,14 +28,14 @@ class WebhelperLayoutTest(unittest.TestCase):
|
||||
|
||||
def test_angle_on_vulkan_brings_chromiums_vulkan_compositing(self):
|
||||
self.assertEqual(self.layout(DD_VKBRIDGE_CEF_ANGLE="vulkan"),
|
||||
"--use-gl=angle --use-angle=vulkan +Vulkan +VulkanFromANGLE +DefaultANGLEVulkan")
|
||||
BASE + " --use-gl=angle --use-angle=vulkan +Vulkan +VulkanFromANGLE +DefaultANGLEVulkan")
|
||||
|
||||
def test_vulkan_compositing_can_be_left_off(self):
|
||||
def test_vulkan_compositing_can_be_left_off_without_zygotes(self):
|
||||
self.assertEqual(self.layout(DD_VKBRIDGE_CEF_ANGLE="vulkan", DD_VKBRIDGE_CEF_VULKAN="0"),
|
||||
"--use-gl=angle --use-angle=vulkan")
|
||||
BASE + " --use-gl=angle --use-angle=vulkan")
|
||||
|
||||
def test_other_angle_backends_get_only_the_angle_switches(self):
|
||||
self.assertEqual(self.layout(DD_VKBRIDGE_CEF_ANGLE="gl"), "--use-gl=angle --use-angle=gl")
|
||||
self.assertEqual(self.layout(DD_VKBRIDGE_CEF_ANGLE="gl"), BASE + " --use-gl=angle --use-angle=gl")
|
||||
|
||||
def test_explicit_layout_wins(self):
|
||||
self.assertEqual(self.layout(DD_VKBRIDGE_CEF_ANGLE="vulkan", DD_VKBRIDGE_WEBHELPER_ARGS="--x +Y"),
|
||||
@@ -57,10 +58,10 @@ class WebhelperLayoutTest(unittest.TestCase):
|
||||
env = {k: v for k, v in os.environ.items() if k not in KEYS}
|
||||
run = lambda **s: subprocess.run(["bash", "-c", "set -u\n" + script], env={**env, **s},
|
||||
capture_output=True, text=True, check=True).stdout.strip()
|
||||
self.assertEqual(run(), "--use-gl=angle --use-angle=vulkan")
|
||||
self.assertEqual(run(), BASE + " --use-gl=angle --use-angle=vulkan")
|
||||
self.assertEqual(run(DD_VKBRIDGE_CEF_VULKAN="1"),
|
||||
"--use-gl=angle --use-angle=vulkan +Vulkan +VulkanFromANGLE +DefaultANGLEVulkan")
|
||||
self.assertEqual(run(DD_VKBRIDGE_CEF_ANGLE="gl"), "--use-gl=angle --use-angle=gl")
|
||||
BASE + " --use-gl=angle --use-angle=vulkan +Vulkan +VulkanFromANGLE +DefaultANGLEVulkan")
|
||||
self.assertEqual(run(DD_VKBRIDGE_CEF_ANGLE="gl"), BASE + " --use-gl=angle --use-angle=gl")
|
||||
|
||||
def test_empty_settings_are_kept_as_set(self):
|
||||
script = ': "${DD_VKBRIDGE_CEF_ANGLE=vulkan}" "${DD_VKBRIDGE_CEF_VULKAN=0}"\n' + layout_function() + "dd_webhelper_layout\n"
|
||||
@@ -69,7 +70,7 @@ class WebhelperLayoutTest(unittest.TestCase):
|
||||
capture_output=True, text=True, check=True).stdout.strip()
|
||||
self.assertEqual(run(DD_VKBRIDGE_CEF_ANGLE=""), "stock")
|
||||
self.assertEqual(run(DD_VKBRIDGE_CEF_VULKAN=""),
|
||||
"--use-gl=angle --use-angle=vulkan +Vulkan +VulkanFromANGLE +DefaultANGLEVulkan")
|
||||
BASE + " --use-gl=angle --use-angle=vulkan +Vulkan +VulkanFromANGLE +DefaultANGLEVulkan")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -47,13 +47,18 @@ static int g_dev_state, g_base_black;
|
||||
static uintptr_t g_dev = 1;
|
||||
static struct { int64_t wait_ns, wait_max_ns; unsigned waits; } g_perf;
|
||||
static VkResult answer;
|
||||
static unsigned timeouts, wait_calls;
|
||||
static unsigned destroyed, unmapped, freed_memory, forgotten, errors;
|
||||
static int64_t perf_now(void) { return 10; }
|
||||
static void perf_add(int64_t *s, int64_t *m, unsigned *c, int64_t d) { *s+=d; *m=d; ++*c; }
|
||||
static void __attribute__((unused)) droiddeck_log(const char *tag, const char *fmt, ...) { (void)tag; (void)fmt; ++errors; }
|
||||
#define LOGE(...) droiddeck_log("error", __VA_ARGS__)
|
||||
static VkResult wait_fn(uintptr_t dev, unsigned n, const VkFence *f, int all, uint64_t timeout) {
|
||||
(void)dev; (void)n; (void)f; (void)all; (void)timeout; return answer;
|
||||
(void)dev; (void)n; (void)f; (void)all;
|
||||
++wait_calls;
|
||||
if (wait_calls > 1) assert(timeout == UINT64_MAX);
|
||||
if (timeouts) { --timeouts; return VK_TIMEOUT; }
|
||||
return answer;
|
||||
}
|
||||
static void unmap_fn(uintptr_t dev, uintptr_t mem) { (void)dev; (void)mem; ++unmapped; }
|
||||
static void destroy_fn(uintptr_t dev, uintptr_t img, void *allocator) { (void)dev; (void)img; (void)allocator; ++destroyed; }
|
||||
@@ -104,8 +109,15 @@ int main(void) {
|
||||
vkp_image_destroy(image());
|
||||
assert(destroyed==1 && unmapped==1 && freed_memory==1 && forgotten==1);
|
||||
|
||||
g_dev_state=1; g_base_black=1; answer=VK_TIMEOUT;
|
||||
assert(timed_wait(1, 1000)==VK_TIMEOUT);
|
||||
for (unsigned delays=1; delays<=3; ++delays) {
|
||||
g_dev_state=1; g_base_black=1; answer=VK_SUCCESS;
|
||||
timeouts=delays; wait_calls=0;
|
||||
assert(timed_wait(1, 1000)==VK_SUCCESS);
|
||||
assert(g_dev_state==1 && g_base_black==1 && wait_calls==delays+1);
|
||||
}
|
||||
|
||||
g_dev_state=1; g_base_black=1; answer=VK_ERROR_UNKNOWN; wait_calls=0;
|
||||
assert(timed_wait(1, 1000)==VK_ERROR_UNKNOWN);
|
||||
assert(g_dev_state!=1 && g_dev_state!=-2); /* pending work is not DEVICE_LOST */
|
||||
struct vkp_image *pending=image();
|
||||
vkp_image_destroy(pending);
|
||||
@@ -116,14 +128,14 @@ int main(void) {
|
||||
assert(errors==first_errors); /* one terminal diagnostic, no repeated recovery */
|
||||
free(pending); /* fake GPU exists only in this test */
|
||||
|
||||
g_dev_state=1; answer=VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
g_dev_state=1; answer=VK_ERROR_OUT_OF_HOST_MEMORY; wait_calls=0; timeouts=1;
|
||||
assert(timed_wait(1, 1000)==VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
assert(g_dev_state!=1 && g_dev_state!=-2);
|
||||
pending=image(); vkp_image_destroy(pending);
|
||||
assert(destroyed==1 && unmapped==1 && freed_memory==1 && forgotten==1);
|
||||
free(pending);
|
||||
|
||||
g_dev_state=1; answer=VK_ERROR_DEVICE_LOST;
|
||||
g_dev_state=1; answer=VK_ERROR_DEVICE_LOST; wait_calls=0; timeouts=2;
|
||||
assert(timed_wait(1, 1000)==VK_ERROR_DEVICE_LOST);
|
||||
assert(g_dev_state==1); /* existing caller performs genuine device-loss cleanup */
|
||||
return 0;
|
||||
|
||||
@@ -111,15 +111,18 @@ int __android_log_print(int, const char *, const char *, ...);
|
||||
def test_later_framegen_surface_lost_idle_failure(self):
|
||||
self.run_scenario('later-surface-lost')
|
||||
|
||||
def test_finite_blit_timeout_same_size_shm_upload(self):
|
||||
self.run_scenario('shm-timeout')
|
||||
def test_blit_wait_error_same_size_shm_upload(self):
|
||||
self.run_scenario('shm-wait-error')
|
||||
|
||||
def test_finite_blit_timeout_same_size_pixel_upload(self):
|
||||
self.run_scenario('pixel-timeout')
|
||||
def test_blit_wait_error_same_size_pixel_upload(self):
|
||||
self.run_scenario('pixel-wait-error')
|
||||
|
||||
def test_lost_device_shm_upload_keeps_cpu_snapshot(self):
|
||||
self.run_scenario('lost-shm-upload')
|
||||
|
||||
def test_delayed_blit_completes_and_next_frame_renders(self):
|
||||
self.run_scenario('blit-delayed')
|
||||
|
||||
def test_normal_present(self):
|
||||
self.run_scenario('normal')
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ struct vk_api g_vk;
|
||||
static unsigned operations, acquires, submits, markers, waits, idle_calls, resets;
|
||||
static unsigned destroys, releases, lost_notifications, presented_notifications;
|
||||
static VkResult idle_answer, fence_answer, acquire_answer, present_answer;
|
||||
static unsigned fail_acquire_at;
|
||||
static unsigned fail_acquire_at, fence_timeouts;
|
||||
static int generated;
|
||||
|
||||
/* Every work-issuing callback is an oracle: no GPU operation after a terminal
|
||||
@@ -19,7 +19,9 @@ static VkResult acquire(VkDevice d, VkSwapchainKHR s, uint64_t t, VkSemaphore a,
|
||||
}
|
||||
static VkResult idle(VkDevice d) { live(); ++idle_calls; return idle_answer; }
|
||||
static VkResult wait_fences(VkDevice d, uint32_t n, const VkFence *f, VkBool32 all, uint64_t t) {
|
||||
live(); ++waits; return fence_answer;
|
||||
live(); ++waits;
|
||||
if (fence_timeouts) { --fence_timeouts; return VK_TIMEOUT; }
|
||||
return fence_answer;
|
||||
}
|
||||
static VkResult submit(VkQueue q, uint32_t n, const VkSubmitInfo *s, VkFence f) {
|
||||
live(); ++submits; if (!s->commandBufferCount) ++markers; return VK_SUCCESS;
|
||||
@@ -235,7 +237,7 @@ static void acquire_failure(int later, VkResult result) {
|
||||
free(g_images); /* test-owned fake resources only */
|
||||
}
|
||||
|
||||
static void upload_timeout(int single_pixel) {
|
||||
static void upload_wait_error(int single_pixel) {
|
||||
setup(0);
|
||||
uint8_t bytes[48], saved[48], data[16];
|
||||
memset(bytes, 0xa5, sizeof(bytes)); memset(data, 0x3c, sizeof(data));
|
||||
@@ -251,7 +253,7 @@ static void upload_timeout(int single_pixel) {
|
||||
assert(bytes[3] == 0x3c && bytes[0] == 0xa5 && releases == 1);
|
||||
memcpy(saved, bytes, sizeof(saved));
|
||||
struct vkp_image dst = {.image = (VkImage)(uintptr_t)9, .blit_dst = 1, .w = img->w, .h = img->h};
|
||||
fence_answer = VK_TIMEOUT;
|
||||
fence_answer = VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
assert(vkp_blit_image(img, &dst, -1) == -1);
|
||||
assert(g_dev_state == -3 && submits == 1 && waits == 1);
|
||||
memset(data, 0x7e, sizeof(data));
|
||||
@@ -279,8 +281,8 @@ int main(int argc, char **argv) {
|
||||
else if (!strcmp(name, "first-surface-lost")) acquire_failure(0, VK_ERROR_SURFACE_LOST_KHR);
|
||||
else if (!strcmp(name, "later-out-of-date")) acquire_failure(1, VK_ERROR_OUT_OF_DATE_KHR);
|
||||
else if (!strcmp(name, "later-surface-lost")) acquire_failure(1, VK_ERROR_SURFACE_LOST_KHR);
|
||||
else if (!strcmp(name, "shm-timeout")) upload_timeout(0);
|
||||
else if (!strcmp(name, "pixel-timeout")) upload_timeout(1);
|
||||
else if (!strcmp(name, "shm-wait-error")) upload_wait_error(0);
|
||||
else if (!strcmp(name, "pixel-wait-error")) upload_wait_error(1);
|
||||
else if (!strcmp(name, "lost-shm-upload")) {
|
||||
setup(0);
|
||||
uint8_t bytes[64], data[16];
|
||||
@@ -295,6 +297,17 @@ int main(int argc, char **argv) {
|
||||
free(img.recovery_pixels);
|
||||
free(g_images);
|
||||
} else if (!strcmp(name, "pass-terminal")) { setup(0); g_dev_state = -3; assert_stopped(); free(g_images); }
|
||||
else if (!strcmp(name, "blit-delayed")) {
|
||||
setup(0);
|
||||
struct vkp_image src = {.image = (VkImage)(uintptr_t)7, .w = 1, .h = 1};
|
||||
struct vkp_image dst = {.image = (VkImage)(uintptr_t)8, .w = 1, .h = 1, .blit_dst = 1};
|
||||
fence_timeouts = 3;
|
||||
assert(vkp_blit_image(&src, &dst, -1) == 0);
|
||||
assert(g_dev_state == 1 && submits == 1 && waits == 4 && destroys == 0);
|
||||
assert(vkp_blit_image(&src, &dst, -1) == 0);
|
||||
assert(g_dev_state == 1 && submits == 2 && waits == 5 && destroys == 0);
|
||||
free(g_images);
|
||||
}
|
||||
else if (!strcmp(name, "normal") || !strcmp(name, "framegen")) {
|
||||
int extra = !strcmp(name, "framegen"); setup(extra);
|
||||
assert(vkp_render(64, 64, NULL, 0) == 0 && g_dev_state == 1);
|
||||
|
||||
@@ -344,12 +344,31 @@ static void report_limits(VkPhysicalDeviceLimits *limits, uint32_t gaps)
|
||||
}
|
||||
}
|
||||
|
||||
/* Mali's driver crashes compiling Zink's geometry shaders (SIGSEGV at 0x40 in
|
||||
* cmpbe_v2_compile_multiple_shaders) and takes the render server and the application with it; a plain
|
||||
* one draws nothing. Zink draws GL_QUADS through one; without the feature Mesa splits quads into
|
||||
* triangles itself. DXVK needs the feature for D3D10 and 11, so only Zink loses it.
|
||||
* DROIDDECK_MALI_COMPAT_NO_GS=0 keeps it for Zink, =1 hides it from every application. */
|
||||
static bool hide_geometry_shader(struct instance *inst, VkPhysicalDevice physical_device)
|
||||
{
|
||||
const char *setting = getenv("DROIDDECK_MALI_COMPAT_NO_GS");
|
||||
if (setting && *setting)
|
||||
return strcmp(setting, "1") == 0;
|
||||
if (!inst->zink)
|
||||
return false;
|
||||
VkPhysicalDeviceProperties properties;
|
||||
inst->GetPhysicalDeviceProperties(physical_device, &properties);
|
||||
return properties.vendorID == 0x13b5; /* ARM */
|
||||
}
|
||||
|
||||
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFeatures(VkPhysicalDevice physical_device,
|
||||
VkPhysicalDeviceFeatures *features)
|
||||
{
|
||||
struct instance *inst = instance_from_handle(physical_device);
|
||||
inst->GetPhysicalDeviceFeatures(physical_device, features);
|
||||
report_features(features, physical_device_gaps(inst, physical_device));
|
||||
if (hide_geometry_shader(inst, physical_device))
|
||||
features->geometryShader = VK_FALSE;
|
||||
}
|
||||
|
||||
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFeatures2(VkPhysicalDevice physical_device,
|
||||
@@ -363,6 +382,8 @@ static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFeatures2(VkPhysicalDevice ph
|
||||
inst->GetPhysicalDeviceFeatures2(physical_device, features);
|
||||
relink(dropped, dropped_count);
|
||||
report_features(&features->features, gaps);
|
||||
if (hide_geometry_shader(inst, physical_device))
|
||||
features->features.geometryShader = VK_FALSE;
|
||||
if (tracing()) {
|
||||
char chain[512] = "";
|
||||
size_t used = 0;
|
||||
@@ -463,6 +484,8 @@ static VKAPI_ATTR VkResult VKAPI_CALL CreateInstance(const VkInstanceCreateInfo
|
||||
inst->key = dispatch_key(*instance);
|
||||
inst->handle = *instance;
|
||||
inst->active = wanted();
|
||||
const char *engine = info->pApplicationInfo ? info->pApplicationInfo->pEngineName : NULL;
|
||||
inst->zink = engine && strcmp(engine, "mesa zink") == 0;
|
||||
inst->gipa = gipa;
|
||||
pthread_mutex_init(&inst->lock, NULL);
|
||||
#define LOAD(name) inst->name = (PFN_vk##name)gipa(*instance, "vk" #name);
|
||||
@@ -624,6 +647,9 @@ static VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice physical_dev
|
||||
if (properties.limits.maxFragmentInputComponents < components)
|
||||
components = properties.limits.maxFragmentInputComponents;
|
||||
dev->max_varying_locations = components / 4;
|
||||
if (inst->active && hide_geometry_shader(inst, physical_device))
|
||||
layer_log("geometryShader is hidden from %s: the driver crashes compiling geometry shaders",
|
||||
inst->zink ? "Zink" : "every application");
|
||||
|
||||
pthread_mutex_lock(&global_lock);
|
||||
dev->next = devices;
|
||||
|
||||
@@ -63,6 +63,7 @@ struct instance {
|
||||
void *key;
|
||||
VkInstance handle;
|
||||
bool active;
|
||||
bool zink; /* the engine is Mesa's Zink */
|
||||
PFN_vkGetInstanceProcAddr gipa;
|
||||
PFN_vkDestroyInstance DestroyInstance;
|
||||
PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
|
||||
|
||||
Reference in new issue
Block a user