mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 04:55:44 +00:00
Compare commits
21
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1acbdec6c1 | ||
|
|
7c8f5c2707 | ||
|
|
14b130500f | ||
|
|
afe81ea69f | ||
|
|
5ca0575e67 | ||
|
|
9e405ec92c | ||
|
|
8f0e124b5d | ||
|
|
31c475d5e1 | ||
|
|
46206b3e16 | ||
|
|
4399db4716 | ||
|
|
ee6cf20ae4 | ||
|
|
2a51b044c5 | ||
|
|
ab023667a0 | ||
|
|
0a27c8bb98 | ||
|
|
bcd4e0d99f | ||
|
|
86ea861818 | ||
|
|
76e0460064 | ||
|
|
64647e0d99 | ||
|
|
8bb1895702 | ||
|
|
ae47876386 | ||
|
|
6e252ea3ad |
No files matched your search
@@ -91,7 +91,7 @@ DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. V
|
||||
<details>
|
||||
<summary><b>Stores</b></summary>
|
||||
|
||||
- Epic Games and GOG build on [Phobos](https://github.com/phobos665)'s adaptation of [Legendary](https://github.com/legendary-gl/legendary) and [gogdl](https://github.com/Heroic-Games-Launcher/heroic-gogdl). GOG install script registry entries are read the way [Heroic Games Launcher](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher) (GPL-3.0) reads them. GOG cloud storage requests send the Galaxy communication-service User-Agent that gogdl and [Lutris](https://github.com/lutris/lutris) (GPL-3.0) send.
|
||||
- Epic Games and GOG build on [Phobos](https://github.com/phobos665)'s adaptation of [Legendary](https://github.com/legendary-gl/legendary) and [gogdl](https://github.com/Heroic-Games-Launcher/heroic-gogdl). GOG install script registry entries are read the way [Heroic Games Launcher](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher) (GPL-3.0) reads them. GOG cloud storage requests send the Galaxy communication-service User-Agent that gogdl and [Lutris](https://github.com/lutris/lutris) (GPL-3.0) send. Deleted GOG cloud saves are recognised by the empty-gzip deletion hash gogdl and Lutris skip.
|
||||
- Epic's official Linux launcher preview runs through FEX. That setup is outside Epic's listed Linux support.
|
||||
- The launcher's .deb gets the WebKitGTK and GTK 3 libraries it needs from unmodified [Debian](https://www.debian.org) 13 packages, following [@zooluis](https://github.com/zooluis)'s research in [#2268](https://github.com/Droid-Deck/DroidDeck/pull/2268).
|
||||
- Battle.net is by [@kayakyakr](https://github.com/kayakyakr). It runs Blizzard's own client in Proton (downloaded from Blizzard, not included) and shows key art from the [Battle.net Shop](https://shop.battle.net). Without Steam, its games see the pad as an Xbox 360 controller via `PROTON_SPOOF_STEAMINPUT_VIDPID` in [Proton](https://github.com/ValveSoftware/wine)'s `dlls/winebus.sys`.
|
||||
|
||||
@@ -637,6 +637,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
}
|
||||
private var storageDiagnostics by mutableStateOf(false)
|
||||
private var storageOptions by mutableStateOf<List<GameStorage.Option>>(emptyList())
|
||||
private var storageFat32 by mutableStateOf(false)
|
||||
private val pickGameStorage = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { r ->
|
||||
if (r.resultCode == RESULT_OK) InAppFilePicker.pickedPath(r.data)?.let { path -> setGameStorage(path, GameStorage.labelFor(this, path)) }
|
||||
}
|
||||
@@ -652,6 +653,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
private fun addSteamLibrary(path: String) {
|
||||
Thread({
|
||||
val result = SteamLibraries.add(this, path)
|
||||
val fat32 = result is SteamLibraries.AddResult.Added && GameStorage.isFat32(result.entry.path)
|
||||
ui.post {
|
||||
steamLibraries = SteamLibraries.list(this)
|
||||
refreshFoundSteamLibraries()
|
||||
@@ -662,6 +664,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
result is SteamLibraries.AddResult.Added && result.entry.path != path ->
|
||||
android.widget.Toast.makeText(this, getString(R.string.libraries_used_inner, result.entry.label), android.widget.Toast.LENGTH_LONG).show()
|
||||
}
|
||||
if (fat32) android.widget.Toast.makeText(this, R.string.main_storage_fat32, android.widget.Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}, "steam-library-add").start()
|
||||
}
|
||||
@@ -920,12 +923,24 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
LauncherIcon.set(this, style)
|
||||
launcherIcon = LauncherIcon.current(this)
|
||||
if (launcherIcon == before) return false
|
||||
restartLauncher()
|
||||
return true
|
||||
}
|
||||
|
||||
// recreate() leaves this activity's window drawing nothing and ignoring input on some devices (#2668).
|
||||
private fun restartLauncher() {
|
||||
LauncherHandoff.put(Bundle().also(::saveLauncherState))
|
||||
switchPoll?.let { ui.removeCallbacks(it) }
|
||||
switchPoll = null
|
||||
switchingTo = null
|
||||
queuedLaunch.clear()
|
||||
cancelCompatLaunch()
|
||||
startActivity(Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER)
|
||||
.setComponent(LauncherIcon.activity(this))
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_MULTIPLE_TASK)
|
||||
.putExtra(com.droiddeck.launcher.stores.download.StoreDownloadService.EXTRA_NAV, "setup:launcher"))
|
||||
.putExtra(com.droiddeck.launcher.stores.download.StoreDownloadService.EXTRA_NAV, "setup:launcher")
|
||||
.putExtra(EXTRA_RESTARTED, true))
|
||||
finishAndRemoveTask()
|
||||
return true
|
||||
}
|
||||
|
||||
private fun readGameIntent(request: Intent) {
|
||||
@@ -1254,13 +1269,15 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
super.onCreate(savedInstanceState)
|
||||
drivers.restartBlocked = ::runtimeChangesBlocked
|
||||
drivers.loadTpUbwcMode()
|
||||
pendingSessionLogExport = savedInstanceState?.getString(KEY_PENDING_SESSION_LOG_EXPORT)?.let(::File)
|
||||
val handoff = if (savedInstanceState == null && intent.getBooleanExtra(EXTRA_RESTARTED, false)) LauncherHandoff.take() else null
|
||||
val saved = savedInstanceState ?: handoff
|
||||
pendingSessionLogExport = saved?.getString(KEY_PENDING_SESSION_LOG_EXPORT)?.let(::File)
|
||||
queuedLaunch.restore(
|
||||
savedInstanceState?.let { androidx.core.os.BundleCompat.getParcelable(it, STATE_PENDING_GATE_LAUNCH, Intent::class.java) },
|
||||
savedInstanceState?.getLong(STATE_PENDING_GATE_LAUNCH_AT, 0L) ?: 0L, System.currentTimeMillis(),
|
||||
saved?.let { androidx.core.os.BundleCompat.getParcelable(it, STATE_PENDING_GATE_LAUNCH, Intent::class.java) },
|
||||
saved?.getLong(STATE_PENDING_GATE_LAUNCH_AT, 0L) ?: 0L, System.currentTimeMillis(),
|
||||
)
|
||||
homeChoiceOpen = savedInstanceState?.getBoolean(STATE_HOME_CHOICE_OPEN) == true
|
||||
gameSpaceOffered = savedInstanceState?.getBoolean(STATE_GAME_SPACE_OFFERED) == true
|
||||
homeChoiceOpen = saved?.getBoolean(STATE_HOME_CHOICE_OPEN) == true
|
||||
gameSpaceOffered = saved?.getBoolean(STATE_GAME_SPACE_OFFERED) == true
|
||||
if (savedInstanceState == null) readIntegrationIntent(intent)
|
||||
val shortcutsFilter = android.content.IntentFilter(SteamIntegration.SHORTCUTS_STATUS)
|
||||
if (android.os.Build.VERSION.SDK_INT >= 33) registerReceiver(shortcutsInstallStatus, shortcutsFilter, RECEIVER_NOT_EXPORTED)
|
||||
@@ -1685,7 +1702,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
onLanguage = { tag ->
|
||||
if (tag != com.droiddeck.launcher.core.AppLanguage.chosen(this)) {
|
||||
com.droiddeck.launcher.core.AppLanguage.setChosen(this, tag)
|
||||
recreate()
|
||||
restartLauncher()
|
||||
}
|
||||
},
|
||||
onAppScale = { percent ->
|
||||
@@ -1901,10 +1918,11 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
!SessionPrefs.allFilesAsked(this)
|
||||
if (savedInstanceState == null) {
|
||||
if (!askAllFiles) ui.post { startSteamAtStartupIfEnabled(cold = true) }
|
||||
} else {
|
||||
restoreCompatLaunch(savedInstanceState)
|
||||
pendingSwitch = savedIntent(savedInstanceState, KEY_PENDING_SWITCH)
|
||||
savedIntent(savedInstanceState, KEY_SWITCHING_TO)?.let { awaitSessionEnd(it, savedInstanceState.getLong(KEY_SWITCH_DEADLINE)) }
|
||||
}
|
||||
saved?.let { state ->
|
||||
restoreCompatLaunch(state)
|
||||
pendingSwitch = savedIntent(state, KEY_PENDING_SWITCH)
|
||||
savedIntent(state, KEY_SWITCHING_TO)?.let { awaitSessionEnd(it, state.getLong(KEY_SWITCH_DEADLINE)) }
|
||||
}
|
||||
|
||||
val wanted = ArrayList<String>()
|
||||
@@ -1957,8 +1975,12 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
|
||||
private var soundtrackLaunch = false
|
||||
|
||||
// A restarted launcher starts before the old one stops, so each clears the hooks only if they are still its own.
|
||||
private val libraryHook: () -> Unit = { refreshAddedGames(); refresh() }
|
||||
private val battleNetHook: (List<String>) -> Unit = { args -> openBattleNet(args) }
|
||||
|
||||
private fun startSteamAtStartupIfEnabled(cold: Boolean = false) {
|
||||
if (soundtrackLaunch) return
|
||||
if (soundtrackLaunch || 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)) {
|
||||
@@ -2133,8 +2155,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
homePage = com.droiddeck.launcher.core.AppUiPrefs.homePage(this)
|
||||
refreshWifiDiscovery()
|
||||
com.droiddeck.launcher.stores.StoresState.refresh(this)
|
||||
com.droiddeck.launcher.stores.StoresState.libraryListener = { refreshAddedGames(); refresh() }
|
||||
com.droiddeck.launcher.stores.battlenet.BattleNetClient.opener = { args -> openBattleNet(args) }
|
||||
com.droiddeck.launcher.stores.StoresState.libraryListener = libraryHook
|
||||
com.droiddeck.launcher.stores.battlenet.BattleNetClient.opener = battleNetHook
|
||||
com.droiddeck.launcher.ui.Motion.refresh(this)
|
||||
com.droiddeck.launcher.ui.QuitFlood.take()?.let { c ->
|
||||
returning = ReturningFlood(c, com.droiddeck.launcher.ui.LaunchOrigin.takeReturn())
|
||||
@@ -2205,6 +2227,10 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(outState)
|
||||
saveLauncherState(outState)
|
||||
}
|
||||
|
||||
private fun saveLauncherState(outState: Bundle) {
|
||||
outState.putBoolean(STATE_HOME_CHOICE_OPEN, homeChoiceOpen)
|
||||
outState.putBoolean(STATE_GAME_SPACE_OFFERED, gameSpaceOffered)
|
||||
pendingSessionLogExport?.let { outState.putString(KEY_PENDING_SESSION_LOG_EXPORT, it.absolutePath) }
|
||||
@@ -2261,8 +2287,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
getSystemService(android.content.pm.LauncherApps::class.java).unregisterCallback(packageCallback)
|
||||
HomeWidgets.stopListening(this)
|
||||
ui.removeCallbacks(mediaRefresh)
|
||||
com.droiddeck.launcher.stores.StoresState.libraryListener = null
|
||||
com.droiddeck.launcher.stores.battlenet.BattleNetClient.opener = null
|
||||
if (com.droiddeck.launcher.stores.StoresState.libraryListener === libraryHook) com.droiddeck.launcher.stores.StoresState.libraryListener = null
|
||||
if (com.droiddeck.launcher.stores.battlenet.BattleNetClient.opener === battleNetHook) com.droiddeck.launcher.stores.battlenet.BattleNetClient.opener = null
|
||||
displayManager.unregisterDisplayListener(secondScreenDisplayListener)
|
||||
com.droiddeck.launcher.input.DualScreen.unwatchTaken(bottomScreenListener)
|
||||
getSystemService(android.hardware.input.InputManager::class.java)?.unregisterInputDeviceListener(secondScreenTouchListener)
|
||||
@@ -2668,6 +2694,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
mic = if (mode == SessionService.MODE_STEAM) mic else null,
|
||||
gameStorage = if (mode == SessionService.MODE_STEAM) gameStorage else null,
|
||||
storageOptions = storageOptions,
|
||||
storageFat32 = storageFat32,
|
||||
steamLibraries = steamLibraries,
|
||||
foundSteamLibraries = foundSteamLibraries,
|
||||
allFilesAccessMissing = allFilesAccessMissing,
|
||||
@@ -3090,10 +3117,12 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
Thread({
|
||||
drivers.refreshDrivers()
|
||||
val storage = GameStorage.options(this)
|
||||
val fat32 = GameStorage.effective(this)?.path?.let(GameStorage::isFat32) == true
|
||||
val deckyInstalled = if (mode == SessionService.MODE_STEAM) DeckyManager.installed(this) else null
|
||||
val deckySupervisor = mode == SessionService.MODE_STEAM && DeckyManager.supervisorEnabled(this)
|
||||
ui.post {
|
||||
storageOptions = storage
|
||||
storageFat32 = fat32
|
||||
if (mode == SessionService.MODE_STEAM) {
|
||||
decky.deckyInstalled = deckyInstalled
|
||||
decky.deckySupervisor = deckySupervisor
|
||||
@@ -3115,6 +3144,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
}
|
||||
SessionPrefs.setGameStorage(this, path, label)
|
||||
gameStorage = path
|
||||
storageFat32 = GameStorage.effective(this)?.path?.let(GameStorage::isFat32) == true
|
||||
if (storageFat32) android.widget.Toast.makeText(this, R.string.main_storage_fat32, android.widget.Toast.LENGTH_LONG).show()
|
||||
checkUsbLink()
|
||||
if (settingsMode == SessionService.MODE_STEAM) refreshFoundSteamLibraries()
|
||||
}
|
||||
@@ -3476,7 +3507,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
com.droiddeck.launcher.ui.Motion.refresh(this)
|
||||
com.droiddeck.launcher.ui.DeveloperTools.load(this)
|
||||
com.droiddeck.launcher.ui.NavTabs.load(this)
|
||||
if (!switchLauncherIcon(LauncherIcon.DARK)) recreate()
|
||||
if (!switchLauncherIcon(LauncherIcon.DARK)) restartLauncher()
|
||||
}
|
||||
}, "reset-settings").start()
|
||||
}
|
||||
@@ -3550,6 +3581,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
|
||||
companion object {
|
||||
private const val REQUEST_NOTIFICATIONS = 7103
|
||||
private const val EXTRA_RESTARTED = "com.droiddeck.launcher.extra.RESTARTED"
|
||||
private const val STATE_HOME_CHOICE_OPEN = "home_choice_open"
|
||||
private const val STATE_PENDING_GATE_LAUNCH = "pending_gate_launch"
|
||||
private const val STATE_PENDING_GATE_LAUNCH_AT = "pending_gate_launch_at"
|
||||
|
||||
@@ -118,12 +118,18 @@ object HomeWidgets {
|
||||
if (live.size != parsed.size) save(context)
|
||||
}
|
||||
|
||||
private val listeners: MutableSet<Any> = java.util.Collections.newSetFromMap(java.util.IdentityHashMap())
|
||||
|
||||
fun startListening(context: Context) {
|
||||
listeners.add(context)
|
||||
load(context)
|
||||
runCatching { host(context).startListening() }
|
||||
}
|
||||
|
||||
// A restarted launcher starts before the old one stops; the host keeps listening until the last owner stops.
|
||||
fun stopListening(context: Context) {
|
||||
listeners.remove(context)
|
||||
if (listeners.isNotEmpty()) return
|
||||
runCatching { host(context).stopListening() }
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.droiddeck.launcher
|
||||
|
||||
import android.os.Bundle
|
||||
import android.os.SystemClock
|
||||
|
||||
/**
|
||||
* State a restarting launcher passes to its replacement inside this process. Intent extras are not used
|
||||
* because FrontEndActivity is exported and any app could fill them.
|
||||
*/
|
||||
internal object LauncherHandoff {
|
||||
private const val LIFETIME_MS = 10_000L
|
||||
private var state: Bundle? = null
|
||||
private var at = 0L
|
||||
|
||||
@Synchronized
|
||||
fun put(carried: Bundle) {
|
||||
state = carried
|
||||
at = SystemClock.elapsedRealtime()
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun take(): Bundle? {
|
||||
val carried = state
|
||||
state = null
|
||||
return carried?.takeIf { SystemClock.elapsedRealtime() - at <= LIFETIME_MS }
|
||||
}
|
||||
}
|
||||
@@ -3552,6 +3552,15 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
|
||||
|
||||
override fun dispatchKeyEvent(event: KeyEvent): Boolean {
|
||||
val normalized = com.droiddeck.launcher.input.GuestKeys.normalizeKeyboardEscape(event)
|
||||
if (normalized === event) return dispatchSessionKeyEvent(event)
|
||||
if (event.action == KeyEvent.ACTION_DOWN && event.repeatCount == 0) {
|
||||
Log.i(TAG, "hardware Esc normalized from Back device=${event.deviceId} scan=${event.scanCode}")
|
||||
}
|
||||
return dispatchSessionKeyEvent(normalized)
|
||||
}
|
||||
|
||||
private fun dispatchSessionKeyEvent(event: KeyEvent): Boolean {
|
||||
if (com.droiddeck.launcher.ui.AgentPet.handleBack(this, event)) return true
|
||||
when (event.keyCode) {
|
||||
KeyEvent.KEYCODE_VOLUME_UP, KeyEvent.KEYCODE_VOLUME_DOWN, KeyEvent.KEYCODE_VOLUME_MUTE -> {
|
||||
|
||||
@@ -143,9 +143,9 @@ object AgentSetup {
|
||||
listOf("sh", "-c", "set -e; export DEBIAN_FRONTEND=noninteractive; " +
|
||||
"apt() { apt-get -o Acquire::Retries=5 -o Acquire::http::Timeout=30 \"\$@\"; }; " +
|
||||
"dpkg --configure -a || echo 'Some packages are not configured yet; repairing dependencies'; " +
|
||||
"for i in 1 2 3; do apt update -q && break; echo 'Some package sources could not be refreshed; retrying'; sleep 3; done; " +
|
||||
"for i in 1 2 3; do apt -o APT::Update::Error-Mode=any update -q && break; echo 'Some package sources could not be refreshed; retrying'; sleep 3; done; " +
|
||||
"apt -f install -y --fix-missing; " +
|
||||
"apt install -y --fix-missing --no-install-recommends git gh adb curl ca-certificates python3; ${harness.install}")
|
||||
"apt install -y --no-install-recommends git gh adb curl ca-certificates python3; ${harness.install}")
|
||||
}
|
||||
Step.SIGN_IN -> harness.signIn
|
||||
Step.GITHUB -> listOf("dd-gh-login")
|
||||
|
||||
@@ -20,6 +20,12 @@ object SteamRedists {
|
||||
val SCRIPTED = mapOf(
|
||||
72850 to listOf("xact" to "DirectX XACT audio"),
|
||||
489830 to listOf("xact_x64" to "DirectX XACT audio (64-bit)"),
|
||||
// Warband compiles its postFX .fx effects at launch through d3dx9_42; Wine's own d3dcompiler_42 stops with E5017/E5033 on fx_2_0.
|
||||
48700 to listOf("d3dx9" to "DirectX 9 (d3dx9)", "d3dcompiler_42" to "D3DCompiler 42"),
|
||||
// DST's bundled ANGLE compiles SM3 shaders through d3dcompiler_43; DXVK's SM3 parser asserts on what Wine's own one emits.
|
||||
322330 to listOf("d3dcompiler_43" to "D3DCompiler 43"),
|
||||
// EU4 builds its map effects through native d3dx9_43, which calls d3dcompiler_43; Wine's own one fails them with E5005, so the map draws black.
|
||||
236850 to listOf("d3dx9" to "DirectX 9 (d3dx9)", "d3dcompiler_43" to "D3DCompiler 43"),
|
||||
)
|
||||
private val BLOCK = Regex("\"SharedDepots\"\\s*\\{([^}]*)\\}", RegexOption.IGNORE_CASE)
|
||||
private val ENTRY = Regex("\"(\\d+)\"\\s+\"\\d+\"")
|
||||
|
||||
@@ -45,9 +45,8 @@ internal class XrealLink internal constructor(
|
||||
if (msgId == VitureProtocol.MSG_GET_IMU) return true
|
||||
val valid = when (msgId) {
|
||||
VitureProtocol.MSG_GET_DISPLAY -> true
|
||||
VitureProtocol.MSG_DISPLAY -> if (model.stereoOnlyControl) value == 5 || value == XrealModel.NATIVE_60HZ
|
||||
else value in 2..5 || value == XrealModel.NATIVE_60HZ
|
||||
VitureProtocol.MSG_BRIGHTNESS -> !model.stereoOnlyControl && value in 0..9
|
||||
VitureProtocol.MSG_DISPLAY -> model.supportsDisplayMode(value)
|
||||
VitureProtocol.MSG_BRIGHTNESS -> model.hardwareControls && value in 0..model.brightnessMax
|
||||
VitureProtocol.MSG_FILM -> !model.stereoOnlyControl && value in 0..1
|
||||
else -> false
|
||||
}
|
||||
@@ -64,12 +63,12 @@ internal class XrealLink internal constructor(
|
||||
channels = connector.connect()
|
||||
connection.set(channels)
|
||||
if (!running) break
|
||||
val control = XrealControl(channels, stereoOnly = model.stereoOnlyControl)
|
||||
val control = XrealControl(channels, model = model)
|
||||
listener.onValue(VitureProtocol.MSG_GET_DISPLAY, control.display())
|
||||
val current = channels
|
||||
reports = Thread({
|
||||
try {
|
||||
var filter = XrealOrientationFilter(model.flipsYz)
|
||||
var filter = XrealOrientationFilter(model)
|
||||
var wasTracking = false
|
||||
var lastSensor = System.nanoTime()
|
||||
while (running && connection.get() === current) {
|
||||
@@ -78,7 +77,7 @@ internal class XrealLink internal constructor(
|
||||
if (sample != null) {
|
||||
lastSensor = System.nanoTime()
|
||||
val enabled = tracking
|
||||
if (enabled && !wasTracking) filter = XrealOrientationFilter(model.flipsYz)
|
||||
if (enabled && !wasTracking) filter = XrealOrientationFilter(model)
|
||||
wasTracking = enabled
|
||||
if (enabled) filter.update(sample)?.let {
|
||||
if (running && ready && tracking && connection.get() === current)
|
||||
@@ -155,8 +154,9 @@ internal class XrealLink internal constructor(
|
||||
internal class XrealControl(
|
||||
private val channels: XrealChannels,
|
||||
private val settleDelayMs: Long = 150,
|
||||
private val stereoOnly: Boolean = false,
|
||||
private val model: XrealModel = XrealModel.ONE_S,
|
||||
) {
|
||||
private val stereoOnly get() = model.stereoOnlyControl
|
||||
private var transaction = 0
|
||||
private fun exchange(command: Int, value: Int? = null): ByteArray {
|
||||
transaction = if (transaction == Int.MAX_VALUE) 1 else transaction + 1
|
||||
@@ -172,7 +172,7 @@ internal class XrealControl(
|
||||
fun display(): Int {
|
||||
if (stereoOnly) return stereoDisplay()
|
||||
val reply = exchange(XrealProtocol.GET_DISPLAY)
|
||||
return XrealProtocol.numeric(reply)?.takeIf { it in 2..5 || it == XrealModel.NATIVE_60HZ }
|
||||
return XrealProtocol.numeric(reply)?.takeIf(model::supportsDisplayMode)
|
||||
?: throw IOException("Unsupported XREAL display response: ${reply.take(32).joinToString("") { "%02x".format(it) }}")
|
||||
}
|
||||
private fun stereoDisplay(): Int {
|
||||
@@ -187,6 +187,7 @@ internal class XrealControl(
|
||||
}
|
||||
}
|
||||
fun changeDisplay(mode: Int): Int {
|
||||
require(model.supportsDisplayMode(mode))
|
||||
val stereo = mode == 5
|
||||
set(XrealProtocol.SET_INPUT, if (stereo) 1 else 0)
|
||||
val current = awaitDisplay { (it == 5) == stereo }
|
||||
|
||||
@@ -4,6 +4,7 @@ internal class XrealModel private constructor(
|
||||
override val name: String,
|
||||
val family: Family,
|
||||
override val diagonalFovDeg: Float,
|
||||
private val native60Hz: Int = NATIVE_60HZ,
|
||||
) : GlassesModel {
|
||||
enum class Family {
|
||||
ONE_S,
|
||||
@@ -14,23 +15,25 @@ internal class XrealModel private constructor(
|
||||
override val controllable = true
|
||||
override val brightnessMax = 9
|
||||
override val volumeMax = 0
|
||||
override val hasSunblock get() = family == Family.ONE_S
|
||||
override val hardwareControls get() = family == Family.ONE_S
|
||||
override val hasSunblock get() = !stereoOnlyControl
|
||||
override val hardwareControls get() = !stereoOnlyControl
|
||||
override val sbs90 = false
|
||||
override val rates2d get() = if (family == Family.ONE_S) super.rates2d else listOf(60)
|
||||
override val rates2d get() = if (stereoOnlyControl) listOf(60) else super.rates2d
|
||||
|
||||
// Only the 1S has been exercised with SET_DISPLAY; the Aura is known to reboot on an unexpected index.
|
||||
val stereoOnlyControl get() = family != Family.ONE_S
|
||||
val stereoOnlyControl get() = family != Family.ONE_S && this !== ONE_PRO_PLUS
|
||||
|
||||
internal fun supportsDisplayMode(mode: Int) = if (stereoOnlyControl) mode == 5 || mode == native60Hz
|
||||
else mode in 3..5 || mode == native60Hz || (this === ONE_S && mode == 2)
|
||||
|
||||
// The Aura reports x right, y up, z back; the rest of the One family is a half turn about x from it.
|
||||
val flipsYz get() = family != Family.AURA
|
||||
|
||||
override fun mode(hz: Int, sbs: Boolean) = when {
|
||||
sbs -> 5
|
||||
stereoOnlyControl -> NATIVE_60HZ
|
||||
stereoOnlyControl -> native60Hz
|
||||
hz >= 120 -> 4
|
||||
hz >= 90 -> 3
|
||||
else -> NATIVE_60HZ
|
||||
else -> native60Hz
|
||||
}
|
||||
override fun modeForStep(step: Int): Int? = null
|
||||
|
||||
@@ -44,7 +47,7 @@ internal class XrealModel private constructor(
|
||||
val ONE_S = XrealModel("XREAL 1S", Family.ONE_S, 52f)
|
||||
val ONE = XrealModel("XREAL One", Family.ONE, 50f)
|
||||
val ONE_PRO = XrealModel("XREAL One Pro", Family.ONE, 57f)
|
||||
val ONE_PRO_PLUS = XrealModel("XREAL One Pro+", Family.ONE, 57f)
|
||||
val ONE_PRO_PLUS = XrealModel("XREAL One Pro+", Family.ONE, 57f, 9)
|
||||
val AURA = XrealModel("XREAL Aura", Family.AURA, 70f)
|
||||
|
||||
// The odd product ids one below these are the glasses' recovery mode.
|
||||
|
||||
@@ -2,13 +2,18 @@ package com.droiddeck.launcher.glasses
|
||||
|
||||
import kotlin.math.abs
|
||||
|
||||
internal class XrealOrientationFilter(private val flipYz: Boolean = true) {
|
||||
internal class XrealOrientationFilter(private val model: XrealModel = XrealModel.ONE_S) {
|
||||
private val fusion = ImuFusion()
|
||||
private val sensorToDisplay = if (model === XrealModel.ONE_PRO_PLUS)
|
||||
Quaternion.fromAxisAngle(Vec3(1f, 0f, 0f), Math.toRadians(35.0).toFloat()) else null
|
||||
|
||||
fun update(sample: XrealProtocol.Sample): FloatArray? = fusion.update(sample.timeNs,
|
||||
sample.accel.headAxes(), sample.gyro.headAxes())
|
||||
|
||||
private fun Vec3.headAxes() = if (flipYz) Vec3(x, -y, -z) else this
|
||||
private fun Vec3.headAxes(): Vec3 {
|
||||
val display = sensorToDisplay?.rotate(this) ?: this
|
||||
return if (model.flipsYz) Vec3(display.x, -display.y, -display.z) else display
|
||||
}
|
||||
}
|
||||
|
||||
internal class ImuFusion {
|
||||
|
||||
@@ -7,7 +7,8 @@ object SocNames {
|
||||
"SM8150" to "Snapdragon 855", "SM8250" to "Snapdragon 865", "SM8250-AC" to "Snapdragon 870",
|
||||
"SM8350" to "Snapdragon 888", "SM8450" to "Snapdragon 8 Gen 1", "SM8475" to "Snapdragon 8+ Gen 1",
|
||||
"SM8550" to "Snapdragon 8 Gen 2", "QCS8550" to "Snapdragon 8 Gen 2", "SM8650" to "Snapdragon 8 Gen 3",
|
||||
"SM8750" to "Snapdragon 8 Elite", "SM8850" to "Snapdragon 8 Elite Gen 5",
|
||||
"SM8750" to "Snapdragon 8 Elite", "SM8750P" to "Snapdragon 8 Elite",
|
||||
"SM8850" to "Snapdragon 8 Elite Gen 5",
|
||||
"SM8975" to "Snapdragon 8 Elite Extreme Gen 6",
|
||||
"SM7325" to "Snapdragon 778G", "SM7450" to "Snapdragon 7 Gen 1", "SM7550" to "Snapdragon 7 Gen 3",
|
||||
"SM6375" to "Snapdragon 695",
|
||||
@@ -23,7 +24,8 @@ object SocNames {
|
||||
val sdk = if (Build.VERSION.SDK_INT >= 31) Build.SOC_MODEL.takeIf { it != Build.UNKNOWN }.orEmpty() else ""
|
||||
return listOf(prop("ro.soc.model"), prop("ro.vendor.qti.soc_model"), sdk, prop("ro.fota.platform"))
|
||||
.map { it.trim() }
|
||||
.firstOrNull { it.isNotEmpty() && !Regex("(?i)^msm_\\d").containsMatchIn(it) }.orEmpty()
|
||||
.firstOrNull { it.isNotEmpty() && !it.equals(Build.UNKNOWN, ignoreCase = true) && !Regex("(?i)^msm_\\d").containsMatchIn(it) }
|
||||
.orEmpty()
|
||||
}
|
||||
|
||||
internal fun normalizedModel(model: String): String = model.trim().uppercase().removePrefix("QTI ").trim()
|
||||
|
||||
@@ -3,6 +3,12 @@ package com.droiddeck.launcher.input
|
||||
import android.view.KeyEvent
|
||||
|
||||
object GuestKeys {
|
||||
fun normalizeKeyboardEscape(event: KeyEvent): KeyEvent {
|
||||
if (!isKeyboardEscape(event.keyCode, event.scanCode)) return event
|
||||
return KeyEvent(event.downTime, event.eventTime, event.action, KeyEvent.KEYCODE_ESCAPE,
|
||||
event.repeatCount, event.metaState, event.deviceId, event.scanCode, event.flags, event.source)
|
||||
}
|
||||
|
||||
/** Sends [event] as evdev presses, with Shift around characters typed by a keyboard that has no Shift key; false when it has no evdev code. */
|
||||
fun send(event: KeyEvent, sendKey: (code: Int, down: Boolean) -> Unit): Boolean {
|
||||
val down = event.action == KeyEvent.ACTION_DOWN
|
||||
|
||||
@@ -32,6 +32,9 @@ object DesktopLanguage {
|
||||
|
||||
internal fun baseUrl(desktopUrl: String) = desktopUrl.substringBeforeLast('/') + "/"
|
||||
|
||||
/** The index carries every pack's sha256, so it never goes through a download mirror. */
|
||||
internal fun fetchIndex(base: String): Map<String, Pack>? = Downloader.downloadDirect(base + INDEX)?.let(::parseIndex)
|
||||
|
||||
private fun marker(root: File, tag: String, name: String) = File(root, ".droiddeck-i18n-$tag-$name")
|
||||
|
||||
/** Installs the desktop's translations for [locale]; false when a download failed and is worth retrying. */
|
||||
@@ -44,7 +47,7 @@ object DesktopLanguage {
|
||||
val pending = candidates(locale).filterNot { marker(root, tag, it).isFile }
|
||||
if (pending.isEmpty()) return true
|
||||
val base = baseUrl(BuildConfig.DESKTOP_KDE_URL)
|
||||
val index = parseIndex(Downloader.downloadString(base + INDEX) ?: return false)
|
||||
val index = fetchIndex(base) ?: return false
|
||||
var complete = true
|
||||
for (name in pending) {
|
||||
val pack = index[name]
|
||||
|
||||
@@ -43,6 +43,17 @@ object GameStorage {
|
||||
}
|
||||
}
|
||||
|
||||
fun isFat32(path: String): Boolean = runCatching { isFat32(path, File("/proc/mounts").readText()) }.getOrDefault(false)
|
||||
|
||||
/** Android mounts FAT32 as vfat and exFAT as exfat; /storage is a FUSE view, so the lookup uses the raw mount. */
|
||||
internal fun isFat32(path: String, mounts: String): Boolean {
|
||||
val raw = UsbLink.rawPath(path)
|
||||
return mounts.lineSequence().map { it.split(' ') }
|
||||
.filter { it.size >= 3 }
|
||||
.filter { val point = it[1].replace("\\040", " "); raw == point || raw.startsWith("${point.trimEnd('/')}/") }
|
||||
.maxByOrNull { it[1].length }?.get(2) == "vfat"
|
||||
}
|
||||
|
||||
fun effective(context: Context): Option? {
|
||||
val pref = SessionPrefs.gameStorage(context)
|
||||
return when {
|
||||
|
||||
@@ -27,14 +27,14 @@ object GameThreadHints {
|
||||
private const val PACE_TOLERANCE = 0.08
|
||||
|
||||
private val NOT_GAMES = setOf("steam", "steamwebhelper")
|
||||
private val SOCS = setOf("CQ8725S", "SM8750")
|
||||
private val SOCS = setOf("CQ8725S", "SM8750", "SM8750P")
|
||||
|
||||
private var worker: Thread? = null
|
||||
|
||||
@Synchronized
|
||||
fun start(context: Context): String {
|
||||
if (!SessionPrefs.gameThreadHints(context)) return "game thread hints: off"
|
||||
if (Build.VERSION.SDK_INT < 31 || !supported(Build.SOC_MODEL)) return "game thread hints: Snapdragon 8 Elite only"
|
||||
if (Build.VERSION.SDK_INT < 31 || !supported(SocNames.model())) return "game thread hints: Snapdragon 8 Elite only"
|
||||
val hm = context.getSystemService(PerformanceHintManager::class.java)
|
||||
?: return "game thread hints: no PerformanceHintManager"
|
||||
val pm = context.getSystemService(PowerManager::class.java)
|
||||
|
||||
@@ -67,6 +67,8 @@ class LoadingState(context: Context, private val steam: Boolean = true) {
|
||||
|
||||
private class Line(val line: String, val percent: Int, val topic: Topic, val readable: Boolean)
|
||||
|
||||
private var scriptStep: Line? = null
|
||||
|
||||
private fun read(context: Context, log: File?): Line? {
|
||||
if (log == null || !log.isFile) return null
|
||||
val text = try {
|
||||
@@ -89,6 +91,7 @@ class LoadingState(context: Context, private val steam: Boolean = true) {
|
||||
var clientDownloadAt = -1
|
||||
var clientDownload: String? = null
|
||||
var clientPercent = -1
|
||||
var unknownAt = -1
|
||||
var offset = 0
|
||||
for (line in text.split('\n')) {
|
||||
val at = offset
|
||||
@@ -103,16 +106,34 @@ class LoadingState(context: Context, private val steam: Boolean = true) {
|
||||
}
|
||||
} else {
|
||||
val m = UPDATE_PROGRESS.find(line)
|
||||
val p = if (m == null && steam) UPDATE_PERCENT.find(line) else null
|
||||
if (m != null) {
|
||||
downloadAt = at
|
||||
val done = m.groupValues[1].toLong()
|
||||
val total = maxOf(1L, m.groupValues[2].toLong())
|
||||
val done = m.groupValues[1].replace(",", "").toLong()
|
||||
val total = maxOf(1L, m.groupValues[2].replace(",", "").toLong())
|
||||
downloadPercent = (done * 100 / total).toInt()
|
||||
} else if (p != null) {
|
||||
val percent = p.groupValues[1].toIntOrNull() ?: continue
|
||||
if (percent < 0) {
|
||||
downloadAt = -1
|
||||
unknownAt = at
|
||||
} else if (percent > 0 && applyingAt <= stepAt) {
|
||||
downloadAt = at
|
||||
downloadPercent = percent.coerceAtMost(100)
|
||||
}
|
||||
} else if (steam && UPDATE_APPLYING.matches(line)) {
|
||||
applyingAt = at
|
||||
}
|
||||
}
|
||||
}
|
||||
val stepLine = when {
|
||||
clientDownloadAt == stepAt && clientDownload != null -> Line(
|
||||
context.getString(com.droiddeck.launcher.R.string.loadstate_steam_client, clientDownload), clientPercent,
|
||||
Topic.STEAM, readable = true,
|
||||
)
|
||||
stepText != null -> Line(stepText, -1, topicOf(stepText, steam), readableScriptStep(stepText))
|
||||
else -> null
|
||||
}?.also { scriptStep = it }
|
||||
return when {
|
||||
applyingAt > stepAt && applyingAt > downloadAt -> Line(
|
||||
context.getString(com.droiddeck.launcher.R.string.loadstate_steam_update_applying), -1,
|
||||
@@ -122,11 +143,10 @@ class LoadingState(context: Context, private val steam: Boolean = true) {
|
||||
context.getString(com.droiddeck.launcher.R.string.loadstate_steam_update, downloadPercent), downloadPercent,
|
||||
Topic.STEAM, readable = true,
|
||||
)
|
||||
clientDownloadAt == stepAt && clientDownload != null -> Line(
|
||||
context.getString(com.droiddeck.launcher.R.string.loadstate_steam_client, clientDownload), clientPercent,
|
||||
Topic.STEAM, readable = true,
|
||||
stepLine != null -> stepLine
|
||||
unknownAt >= 0 -> scriptStep ?: Line(
|
||||
context.getString(com.droiddeck.launcher.R.string.loadstate_starting), -1, Topic.SESSION, readable = false,
|
||||
)
|
||||
stepText != null -> Line(stepText, -1, topicOf(stepText, steam), readableScriptStep(stepText))
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
@@ -166,7 +186,8 @@ class LoadingState(context: Context, private val steam: Boolean = true) {
|
||||
}
|
||||
|
||||
private const val TAIL_BYTES = 48L * 1024
|
||||
private val UPDATE_PROGRESS = Regex("""Downloading update \((\d+) of (\d+) KB\)""")
|
||||
private val UPDATE_PROGRESS = Regex("""Downloading update \(([\d,]+) of ([\d,]+) KB\)""")
|
||||
private val UPDATE_PERCENT = Regex("""^\[[^\]]+\] Set percent complete: (-?\d+)\s*$""")
|
||||
private val UPDATE_APPLYING = Regex("""^\s*(?:\[[^\]]+\]\s*)*(?:Extracting package|Installing update)\.\.\.\s*$""")
|
||||
private val INSTALL_COUNT = Regex("""downloading Steam: (\S+) \((\d+)/(\d+)\)""")
|
||||
private val INSTALL_MEGABYTES = Regex("""^, (\d+) of (\d+) MB""")
|
||||
|
||||
@@ -36,13 +36,14 @@ object CloudPlan {
|
||||
return Plan(transfer, conflicts, same)
|
||||
}
|
||||
|
||||
fun up(local: Map<String, Local>, remote: Map<String, Remote>, baseline: Map<String, Entry>?): Plan {
|
||||
fun up(local: Map<String, Local>, remote: Map<String, Remote>, baseline: Map<String, Entry>?, deleted: Set<String> = emptySet()): Plan {
|
||||
if (baseline == null) return Plan(emptyList(), emptyList(), emptyList(), refused = "no-baseline")
|
||||
val transfer = ArrayList<String>(); val conflicts = ArrayList<String>(); val same = ArrayList<String>()
|
||||
for ((name, l) in local) {
|
||||
val r = remote[name]
|
||||
val b = baseline[name]
|
||||
when {
|
||||
r == null && name in deleted && !localChanged(l, b) -> Unit
|
||||
r == null -> transfer += name
|
||||
same(l, r) -> same += name
|
||||
localChanged(l, b) && cloudChanged(r, b) -> conflicts += name
|
||||
|
||||
@@ -430,17 +430,20 @@ object CloudSaves {
|
||||
|
||||
internal fun md5(data: ByteArray): String = MessageDigest.getInstance("MD5").digest(data).joinToString("") { "%02x".format(it) }
|
||||
|
||||
private fun remote(cloud: CloudTransport, wanted: (String) -> Boolean): Map<String, CloudFile> {
|
||||
private class Listing(val live: Map<String, CloudFile>, val deleted: Set<String>)
|
||||
|
||||
private fun remote(cloud: CloudTransport, wanted: (String) -> Boolean): Listing {
|
||||
val files = cloud.list()
|
||||
val pool = Executors.newFixedThreadPool(PARALLEL, com.droiddeck.launcher.stores.download.DownloadQueue.workerFactory("cloud"))
|
||||
for (f in files) if (wanted(f.name)) pool.execute { runCatching { cloud.details(f) } }
|
||||
pool.shutdown(); pool.awaitTermination(2, TimeUnit.MINUTES)
|
||||
return files.associateBy { it.name }
|
||||
val (gone, live) = files.partition(cloud::deleted)
|
||||
return Listing(live.associateBy { it.name }, gone.mapTo(HashSet()) { it.name })
|
||||
}
|
||||
|
||||
internal fun downWith(context: Context, store: Store, id: String, dir: File, cloud: CloudTransport, force: Boolean, claim: () -> Boolean = { true }): Result {
|
||||
val files = localFiles(dir).filterKeys(cloud::wants)
|
||||
val remote = remote(cloud) { it in files }
|
||||
val remote = remote(cloud) { it in files }.live
|
||||
val local = files.mapValues { CloudPlan.Local(md5(it.value)) }
|
||||
val key = scope(store, id, dir)
|
||||
val base = baseline(context, store, key)
|
||||
@@ -498,9 +501,10 @@ object CloudSaves {
|
||||
val base = baseline(context, store, key) ?: return Result("skipped", 0, 0, "no-baseline")
|
||||
val files = localFiles(dir).filterKeys(cloud::wants).let { all -> if (cloud is UbisoftCloudTransport) all.filterValues(::markUbisoftSave) else all }
|
||||
if (files.isEmpty()) return Result("skipped", 0, 0, "nothing-local")
|
||||
val remote = remote(cloud) { it in files }
|
||||
val listing = remote(cloud) { it in files }
|
||||
val remote = listing.live
|
||||
val local = files.mapValues { CloudPlan.Local(md5(it.value)) }
|
||||
val planned = CloudPlan.up(local, remote.mapValues { CloudPlan.Remote(it.value.md5, it.value.modifiedMs) }, base)
|
||||
val planned = CloudPlan.up(local, remote.mapValues { CloudPlan.Remote(it.value.md5, it.value.modifiedMs) }, base, listing.deleted)
|
||||
val alike = alike(cloud, planned.conflicts, local, remote)
|
||||
val plan = settled(planned, alike)
|
||||
val saved = savedConflicts(context, store, key).filter { it !in alike && it !in plan.same }
|
||||
@@ -547,7 +551,7 @@ object CloudSaves {
|
||||
send = send.filter { it in stamped }
|
||||
for ((name, t) in stamped) if (t > 0) files[name]?.setLastModified(t)
|
||||
}
|
||||
val after = if (send.all { cloud.committed(it) != null }) emptyMap() else remote(cloud) { it in send && cloud.committed(it) == null }
|
||||
val after = if (send.all { cloud.committed(it) != null }) emptyMap() else remote(cloud) { it in send && cloud.committed(it) == null }.live
|
||||
for (name in send) {
|
||||
val r = cloud.committed(name) ?: after[name]
|
||||
next[name] = CloudPlan.Entry(sentMd5.getValue(name), r?.md5, r?.modifiedMs ?: stamped[name] ?: -1L)
|
||||
|
||||
@@ -31,6 +31,7 @@ interface CloudTransport {
|
||||
val contentDigests: Boolean get() = true
|
||||
fun committed(name: String): CloudFile? = null
|
||||
fun wants(name: String): Boolean = true
|
||||
fun deleted(file: CloudFile): Boolean = false
|
||||
fun list(): List<CloudFile>
|
||||
fun details(file: CloudFile) {}
|
||||
fun get(file: CloudFile): Pair<ByteArray, Long>
|
||||
@@ -252,6 +253,8 @@ private fun gzipFile(src: File, dst: File): GzipFile {
|
||||
}
|
||||
}
|
||||
|
||||
internal const val GOG_DELETED_MD5 = "aadd86936a80ee8a369579c3926f1b3c"
|
||||
|
||||
internal const val GOG_CLOUD_UA = "GOGGalaxyCommunicationService/2.0.13.27 (Windows_32bit) dont_sync_marker/true installation_source/gog"
|
||||
|
||||
/** GOG Galaxy parses `X-Object-Meta-LocalLastModified`; objects without it fail as "invalid data". */
|
||||
@@ -276,8 +279,11 @@ class GogCloud(
|
||||
|
||||
private fun cloudKey(name: String) = key((prefix ?: "") + name)
|
||||
|
||||
override fun deleted(file: CloudFile): Boolean = file.md5.equals(GOG_DELETED_MD5, ignoreCase = true)
|
||||
|
||||
override fun list(): List<CloudFile> {
|
||||
val c = open(base, "GET", token, ua)
|
||||
c.setRequestProperty("Accept", "application/json")
|
||||
val code = c.responseCode
|
||||
if (code == 404) { c.disconnect(); return emptyList() }
|
||||
if (code !in 200..299) {
|
||||
@@ -300,7 +306,7 @@ class GogCloud(
|
||||
lm > 0 -> lm * 1000
|
||||
iso > 0 -> iso
|
||||
else -> -1L
|
||||
})
|
||||
}, o.optString("hash").trim().ifEmpty { null })
|
||||
}
|
||||
} else {
|
||||
text.lines().map { it.trim() }.filter { it.isNotEmpty() }.map { CloudFile(it, -1L) }
|
||||
|
||||
@@ -100,6 +100,7 @@ internal object GogContent {
|
||||
val manifest = metadata(build.link, token)
|
||||
onManifest(manifest)
|
||||
val files = JSONArray()
|
||||
val overlayPositions = HashMap<String, Int>()
|
||||
val depots = if (build.generation == 1) manifest.optJSONObject("product")?.optJSONArray("depots") ?: manifest.optJSONArray("depot") else manifest.optJSONArray("depots")
|
||||
check(depots != null) { "GOG build has no depot list" }
|
||||
val resolvedLanguage = StoreLanguage.pick(StoreLanguage.codesFromDepots(depots), old.language)
|
||||
@@ -132,10 +133,15 @@ internal object GogContent {
|
||||
val directory = type == "DepotDirectory" || entry.has("directory")
|
||||
val chunks = entry.optJSONArray("chunks") ?: JSONArray()
|
||||
val size = if (build.generation == 2) chunks.objects().sumOf { it.optLong("size") } else entry.optLong("size")
|
||||
files.put(JSONObject().put("path", path).put("size", size).put("directory", directory)
|
||||
val file = JSONObject().put("path", path).put("size", size).put("directory", directory)
|
||||
.put("md5", entry.optString("md5").ifBlank { entry.optString("hash") }.takeIf { it.matches(Regex("[a-fA-F0-9]{32}")) }.orEmpty())
|
||||
.put("sha256", entry.optString("sha256")).put("chunks", chunks).put("product", product)
|
||||
.put("offset", entry.optLong("offset")).put("remotePath", entry.optString("url").substringBefore('?')))
|
||||
.put("offset", entry.optLong("offset")).put("remotePath", entry.optString("url").substringBefore('?'))
|
||||
val position = if (build.generation == 2) overlayPositions.putIfAbsent(path, files.length()) else null
|
||||
if (position == null) files.put(file) else {
|
||||
require(files.getJSONObject(position).getBoolean("directory") == directory)
|
||||
files.put(position, file)
|
||||
}
|
||||
}
|
||||
}
|
||||
check(files.length() > 0) { "GOG build contains no matching files" }
|
||||
|
||||
@@ -78,6 +78,7 @@ class ModeSettings(
|
||||
val mic: Boolean?,
|
||||
val gameStorage: String? = null,
|
||||
val storageOptions: List<com.droiddeck.launcher.session.GameStorage.Option> = emptyList(),
|
||||
val storageFat32: Boolean = false,
|
||||
val steamLibraries: List<com.droiddeck.launcher.session.SteamLibraries.Entry> = emptyList(),
|
||||
val foundSteamLibraries: List<com.droiddeck.launcher.session.SteamLibraries.Found> = emptyList(),
|
||||
val allFilesAccessMissing: Boolean = false,
|
||||
@@ -455,7 +456,7 @@ fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras:
|
||||
ValueChip(options.firstOrNull { it.path == s.gameStorage }?.chip ?: "-", open) { host.open = if (open) null else "storage" }
|
||||
AnchoredMenu(
|
||||
open, onDismiss = { if (host.open == "storage") host.open = null }, title = stringResource(R.string.mode_second_library),
|
||||
note = stringResource(R.string.mode_storage_note),
|
||||
note = stringResource(R.string.mode_storage_note).let { if (s.storageFat32) stringResource(R.string.main_storage_fat32) + "\n" + it else it },
|
||||
) { firstItemFocus ->
|
||||
options.forEachIndexed { index, choice ->
|
||||
MenuItem(choice.label, checked = choice.path == s.gameStorage, focusRequester = if (index == 0) firstItemFocus else null) {
|
||||
|
||||
@@ -83,6 +83,7 @@ import androidx.compose.ui.unit.sp
|
||||
import coil.compose.AsyncImage
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.files.InAppFilePicker
|
||||
import com.droiddeck.launcher.session.GameStorage
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.storage.Bucket
|
||||
import com.droiddeck.launcher.storage.CleanItem
|
||||
@@ -179,6 +180,10 @@ private fun DefaultStorageGroup() {
|
||||
val customLabel = SessionPrefs.defaultStorageFolderLabel(ctx).ifBlank {
|
||||
customPath.takeIf { it.isNotBlank() }?.let { File(it).name }.orEmpty()
|
||||
}
|
||||
fun warnIfFat32() {
|
||||
val target = StoreInstallRoot.externalTarget(ctx) ?: return
|
||||
if (GameStorage.isFat32(target.root.path)) Toast.makeText(ctx, R.string.main_storage_fat32, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
val pickFolder = rememberLauncherForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
|
||||
if (result.resultCode != Activity.RESULT_OK) return@rememberLauncherForActivityResult
|
||||
val path = InAppFilePicker.pickedPath(result.data) ?: return@rememberLauncherForActivityResult
|
||||
@@ -192,6 +197,7 @@ private fun DefaultStorageGroup() {
|
||||
value = SessionPrefs.DEFAULT_STORAGE_EXTERNAL
|
||||
revision++
|
||||
open = false
|
||||
warnIfFat32()
|
||||
}
|
||||
fun chooseFolder() {
|
||||
open = false
|
||||
@@ -250,6 +256,7 @@ private fun DefaultStorageGroup() {
|
||||
SessionPrefs.clearDefaultStorageFolder(ctx)
|
||||
pick(SessionPrefs.DEFAULT_STORAGE_EXTERNAL)
|
||||
revision++
|
||||
warnIfFat32()
|
||||
}
|
||||
}
|
||||
if (customPath.isNotBlank()) {
|
||||
@@ -261,7 +268,12 @@ private fun DefaultStorageGroup() {
|
||||
if (free >= 0) stringResource(R.string.storage_default_folder_free, gb(free))
|
||||
else stringResource(R.string.storage_default_folder_missing)
|
||||
} ?: stringResource(R.string.storage_default_folder_missing),
|
||||
) { if (customTarget != null) pick(SessionPrefs.DEFAULT_STORAGE_EXTERNAL) else chooseFolder() }
|
||||
) {
|
||||
if (customTarget != null) {
|
||||
pick(SessionPrefs.DEFAULT_STORAGE_EXTERNAL)
|
||||
warnIfFat32()
|
||||
} else chooseFolder()
|
||||
}
|
||||
}
|
||||
MenuItem(
|
||||
stringResource(R.string.storage_default_choose_folder), checked = false,
|
||||
|
||||
@@ -3218,7 +3218,7 @@
|
||||
<string name="hand_camera_done">تم</string>
|
||||
<string name="glasses_xreal_network_missing">في انتظار اتصال USB Ethernet الخاص بالنظارة. قد لا يتيحه هذا الهاتف للتطبيقات.</string>
|
||||
<string name="glasses_xreal_connection_failed">انقطع اتصال XREAL أو أعاد استجابة غير مدعومة. جارٍ إعادة المحاولة…</string>
|
||||
<string name="glasses_xreal_experimental">دعم تجريبي لـ 1S. استخدم وضع Follow وعطّل تثبيت الصورة من قائمة النظارة. لا تزال اتجاهات التتبّع وأوضاع العرض بحاجة إلى اختبار على الجهاز.</string>
|
||||
<string name="glasses_xreal_experimental">دعم تجريبي لـ XREAL 1S وOne وOne Pro وOne Pro+ وAura. استخدم وضع Follow وأوقف تثبيت الصورة في قائمة النظارة؛ وعلى Aura، أوقف Spatial Anchor أيضًا. تم اختبار تتبع الرأس والتبديل بين 2D/3D على Aura وOne Pro+.</string>
|
||||
<string name="glasses_pro2_experimental">تتبّع تجريبي لحركة الرأس لنظارة Pro 2. لا يُدعم بعد ضبط السطوع ومستوى الصوت أو تبديل وضع العرض.</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">وضع Cardboard</string>
|
||||
|
||||
@@ -1387,7 +1387,7 @@
|
||||
<string name="hand_camera_done">Hecho</string>
|
||||
<string name="glasses_xreal_network_missing">Esperando la conexión Ethernet por USB de las gafas. Puede que este teléfono no la ofrezca a las apps.</string>
|
||||
<string name="glasses_xreal_connection_failed">La conexión con las XREAL se interrumpió o devolvió una respuesta no compatible. Reintentando…</string>
|
||||
<string name="glasses_xreal_experimental">Compatibilidad experimental con las 1S. Usa el modo Follow y desactiva la estabilización en el menú de las gafas. Aún falta probar en el dispositivo las direcciones del seguimiento y los modos de pantalla.</string>
|
||||
<string name="glasses_xreal_experimental">Compatibilidad experimental con XREAL 1S, One, One Pro, One Pro+ y Aura. Usa el modo Follow y desactiva la estabilización en el menú de las gafas; en Aura, desactiva también Spatial Anchor. El seguimiento de cabeza y el cambio entre 2D/3D se han probado en Aura y One Pro+.</string>
|
||||
<string name="glasses_pro2_experimental">Seguimiento de cabeza experimental para Pro 2. Los ajustes de brillo y volumen y el cambio de modo de pantalla aún no son compatibles.</string>
|
||||
<string name="setup_animations">Animaciones</string>
|
||||
<string name="setup_low_storage_warning">Avisar cuando queda poco almacenamiento</string>
|
||||
|
||||
@@ -3098,7 +3098,7 @@
|
||||
<string name="hand_camera_done">Готово</string>
|
||||
<string name="glasses_xreal_network_missing">Изчаква се USB Ethernet връзката на очилата. Този телефон може да не я предоставя на приложенията.</string>
|
||||
<string name="glasses_xreal_connection_failed">Връзката с XREAL беше прекъсната или върна неподдържан отговор. Нов опит…</string>
|
||||
<string name="glasses_xreal_experimental">Експериментална поддръжка на 1S. Използвайте режим Follow и изключете стабилизацията в менюто на очилата. Посоките на проследяване и режимите на показване все още трябва да се тестват на устройство.</string>
|
||||
<string name="glasses_xreal_experimental">Експериментална поддръжка на XREAL 1S, One, One Pro, One Pro+ и Aura. Използвайте режим Follow и изключете стабилизацията в менюто на очилата; при Aura изключете и Spatial Anchor. Проследяването на главата и превключването между 2D/3D са тествани на Aura и One Pro+.</string>
|
||||
<string name="glasses_pro2_experimental">Експериментално проследяване на движенията на главата за Pro 2. Регулирането на яркостта и силата на звука и превключването на режима на показване все още не се поддържат.</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">Режим Cardboard</string>
|
||||
|
||||
@@ -3158,7 +3158,7 @@
|
||||
<string name="hand_camera_done">Hotovo</string>
|
||||
<string name="glasses_xreal_network_missing">Čeká se na připojení USB Ethernet brýlí. Tento telefon ho možná aplikacím nezpřístupňuje.</string>
|
||||
<string name="glasses_xreal_connection_failed">Připojení XREAL bylo přerušeno nebo vrátilo nepodporovanou odpověď. Zkouší se to znovu…</string>
|
||||
<string name="glasses_xreal_experimental">Experimentální podpora 1S. V nabídce brýlí použijte režim Follow a vypněte stabilizaci. Směry sledování a režimy zobrazení je ještě třeba otestovat na zařízení.</string>
|
||||
<string name="glasses_xreal_experimental">Experimentální podpora XREAL 1S, One, One Pro, One Pro+ a Aura. V nabídce brýlí použijte režim Follow a vypněte stabilizaci; u modelu Aura vypněte také Spatial Anchor. Sledování hlavy a přepínání 2D/3D bylo otestováno na modelech Aura a One Pro+.</string>
|
||||
<string name="glasses_pro2_experimental">Experimentální sledování pohybu hlavy pro Pro 2. Nastavení jasu, hlasitosti a přepínání režimů zobrazení zatím nejsou podporovány.</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">Režim Cardboard</string>
|
||||
|
||||
@@ -3098,7 +3098,7 @@
|
||||
<string name="hand_camera_done">Udført</string>
|
||||
<string name="glasses_xreal_network_missing">Venter på brillens USB-Ethernet-forbindelse. Denne telefon gør den muligvis ikke tilgængelig for apps.</string>
|
||||
<string name="glasses_xreal_connection_failed">XREAL-forbindelsen blev afbrudt eller returnerede et svar, der ikke understøttes. Prøver igen…</string>
|
||||
<string name="glasses_xreal_experimental">Eksperimentel understøttelse af 1S. Brug Follow-tilstand, og slå stabilisering fra i brillens menu. Sporingsretninger og visningstilstande mangler stadig test på enheden.</string>
|
||||
<string name="glasses_xreal_experimental">Eksperimentel understøttelse af XREAL 1S, One, One Pro, One Pro+ og Aura. Brug Follow-tilstand, og slå stabilisering fra i brillernes menu; på Aura skal du også slå Spatial Anchor fra. Hovedsporing og skift mellem 2D/3D er testet på Aura og One Pro+.</string>
|
||||
<string name="glasses_pro2_experimental">Eksperimentel hovedsporing til Pro 2. Justering af lysstyrke og lydstyrke samt skift af visningstilstand understøttes endnu ikke.</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">Cardboard-tilstand</string>
|
||||
|
||||
@@ -3087,7 +3087,7 @@
|
||||
<string name="hand_camera_done">Fertig</string>
|
||||
<string name="glasses_xreal_network_missing">Warte auf die USB-Ethernet-Verbindung der Brille. Dieses Smartphone stellt sie Apps möglicherweise nicht bereit.</string>
|
||||
<string name="glasses_xreal_connection_failed">Die XREAL-Verbindung wurde unterbrochen oder hat eine nicht unterstützte Antwort geliefert. Neuer Versuch …</string>
|
||||
<string name="glasses_xreal_experimental">Experimentelle Unterstützung für die 1S. Nutze den Follow-Modus und deaktiviere die Stabilisierung im Menü der Brille. Tracking-Richtungen und Anzeigemodi müssen noch auf Geräten getestet werden.</string>
|
||||
<string name="glasses_xreal_experimental">Experimentelle Unterstützung für XREAL 1S, One, One Pro, One Pro+ und Aura. Nutze den Follow-Modus und deaktiviere die Stabilisierung im Menü der Brille; deaktiviere bei der Aura auch Spatial Anchor. Kopftracking und 2D/3D-Umschaltung wurden auf der Aura und der One Pro+ getestet.</string>
|
||||
<string name="glasses_pro2_experimental">Experimentelles Kopftracking für Pro 2. Das Einstellen von Helligkeit und Lautstärke sowie das Umschalten des Anzeigemodus werden noch nicht unterstützt.</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">Cardboard-Modus</string>
|
||||
|
||||
@@ -3098,7 +3098,7 @@
|
||||
<string name="hand_camera_done">Τέλος</string>
|
||||
<string name="glasses_xreal_network_missing">Αναμονή για τη σύνδεση USB Ethernet των γυαλιών. Αυτό το τηλέφωνο ίσως δεν τη διαθέτει στις εφαρμογές.</string>
|
||||
<string name="glasses_xreal_connection_failed">Η σύνδεση XREAL διακόπηκε ή επέστρεψε μη υποστηριζόμενη απόκριση. Νέα προσπάθεια…</string>
|
||||
<string name="glasses_xreal_experimental">Πειραματική υποστήριξη για 1S. Χρησιμοποιήστε τη λειτουργία Follow και απενεργοποιήστε τη σταθεροποίηση στο μενού των γυαλιών. Οι κατευθύνσεις παρακολούθησης και οι λειτουργίες οθόνης χρειάζονται ακόμα δοκιμή σε συσκευή.</string>
|
||||
<string name="glasses_xreal_experimental">Πειραματική υποστήριξη για XREAL 1S, One, One Pro, One Pro+ και Aura. Χρησιμοποιήστε τη λειτουργία Follow και απενεργοποιήστε τη σταθεροποίηση στο μενού των γυαλιών· στα Aura απενεργοποιήστε επίσης το Spatial Anchor. Η παρακολούθηση κεφαλής και η εναλλαγή 2D/3D έχουν δοκιμαστεί στα Aura και One Pro+.</string>
|
||||
<string name="glasses_pro2_experimental">Πειραματική παρακολούθηση κεφαλής για Pro 2. Η ρύθμιση της φωτεινότητας και της έντασης ήχου και η αλλαγή λειτουργίας οθόνης δεν υποστηρίζονται ακόμη.</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">Λειτουργία Cardboard</string>
|
||||
|
||||
@@ -3114,7 +3114,7 @@
|
||||
<string name="hand_camera_done">Hecho</string>
|
||||
<string name="glasses_xreal_network_missing">Esperando la conexión Ethernet por USB de las gafas. Puede que este teléfono no la ofrezca a las apps.</string>
|
||||
<string name="glasses_xreal_connection_failed">La conexión con las XREAL se interrumpió o devolvió una respuesta no compatible. Reintentando…</string>
|
||||
<string name="glasses_xreal_experimental">Compatibilidad experimental con las 1S. Usa el modo Follow y desactiva la estabilización en el menú de las gafas. Aún falta probar en el dispositivo las direcciones del seguimiento y los modos de pantalla.</string>
|
||||
<string name="glasses_xreal_experimental">Compatibilidad experimental con XREAL 1S, One, One Pro, One Pro+ y Aura. Usa el modo Follow y desactiva la estabilización en el menú de las gafas; en Aura, desactiva también Spatial Anchor. El seguimiento de cabeza y el cambio entre 2D/3D se han probado en Aura y One Pro+.</string>
|
||||
<string name="glasses_pro2_experimental">Seguimiento de cabeza experimental para Pro 2. Los ajustes de brillo y volumen y el cambio de modo de pantalla aún no son compatibles.</string>
|
||||
<string name="stores_fact_developer">Desarrollador</string>
|
||||
<string name="stores_fact_publisher">Distribuidor</string>
|
||||
|
||||
@@ -3098,7 +3098,7 @@
|
||||
<string name="hand_camera_done">Valmis</string>
|
||||
<string name="glasses_xreal_network_missing">Odotetaan lasien USB-Ethernet-yhteyttä. Tämä puhelin ei ehkä tarjoa sitä sovelluksille.</string>
|
||||
<string name="glasses_xreal_connection_failed">XREAL-yhteys katkesi tai palautti vastauksen, jota ei tueta. Yritetään uudelleen…</string>
|
||||
<string name="glasses_xreal_experimental">Kokeellinen 1S-tuki. Käytä Follow-tilaa ja poista vakautus käytöstä lasien valikosta. Seurannan suunnat ja näyttötilat vaativat vielä testausta laitteella.</string>
|
||||
<string name="glasses_xreal_experimental">Kokeellinen tuki XREAL 1S-, One-, One Pro-, One Pro+- ja Aura-laseille. Käytä Follow-tilaa ja poista vakautus käytöstä lasien valikosta. Poista Aura-laseissa myös Spatial Anchor käytöstä. Päänseuranta ja 2D/3D-vaihto on testattu Aura- ja One Pro+ -laseilla.</string>
|
||||
<string name="glasses_pro2_experimental">Kokeellinen päänliikkeiden seuranta Pro 2:lle. Kirkkauden ja äänenvoimakkuuden säätöä sekä näyttötilan vaihtamista ei vielä tueta.</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">Cardboard-tila</string>
|
||||
|
||||
@@ -3124,7 +3124,7 @@
|
||||
<string name="hand_camera_done">Terminé</string>
|
||||
<string name="glasses_xreal_network_missing">En attente de la connexion Ethernet USB des lunettes. Ce téléphone ne la rend peut-être pas accessible aux applications.</string>
|
||||
<string name="glasses_xreal_connection_failed">La connexion XREAL a été interrompue ou a renvoyé une réponse non prise en charge. Nouvelle tentative…</string>
|
||||
<string name="glasses_xreal_experimental">Prise en charge expérimentale des 1S. Utilisez le mode Follow et désactivez la stabilisation dans le menu des lunettes. Le sens du suivi et les modes d\'affichage restent à tester sur l\'appareil.</string>
|
||||
<string name="glasses_xreal_experimental">Prise en charge expérimentale des XREAL 1S, One, One Pro, One Pro+ et Aura. Utilisez le mode Follow et désactivez la stabilisation dans le menu des lunettes ; sur les Aura, désactivez aussi Spatial Anchor. Le suivi de la tête et le passage entre 2D/3D ont été testés sur les Aura et les One Pro+.</string>
|
||||
<string name="glasses_pro2_experimental">Suivi expérimental des mouvements de la tête pour Pro 2. Le réglage de la luminosité et du volume ainsi que le changement de mode d\'affichage ne sont pas encore pris en charge.</string>
|
||||
<string name="stores_fact_developer">Développeur</string>
|
||||
<string name="stores_fact_publisher">Éditeur</string>
|
||||
|
||||
@@ -3098,7 +3098,7 @@
|
||||
<string name="hand_camera_done">हो गया</string>
|
||||
<string name="glasses_xreal_network_missing">चश्मे के USB Ethernet कनेक्शन का इंतज़ार है। हो सकता है यह फ़ोन इसे ऐप्स को उपलब्ध न कराए।</string>
|
||||
<string name="glasses_xreal_connection_failed">XREAL कनेक्शन टूट गया या उसने ऐसा जवाब दिया जो समर्थित नहीं है। फिर से कोशिश हो रही है…</string>
|
||||
<string name="glasses_xreal_experimental">1S के लिए प्रायोगिक सपोर्ट। चश्मे के मेनू में Follow मोड चुनें और स्टेबिलाइज़ेशन बंद करें। ट्रैकिंग की दिशाएं और डिस्प्ले मोड अभी डिवाइस पर टेस्ट होने बाकी हैं।</string>
|
||||
<string name="glasses_xreal_experimental">XREAL 1S, One, One Pro, One Pro+ और Aura के लिए प्रायोगिक सपोर्ट। चश्मे के मेनू में Follow मोड चुनें और स्टेबिलाइज़ेशन बंद करें; Aura पर Spatial Anchor भी बंद करें। Aura और One Pro+ पर हेड ट्रैकिंग और 2D/3D स्विचिंग का परीक्षण किया गया है।</string>
|
||||
<string name="glasses_pro2_experimental">Pro 2 के लिए प्रायोगिक हेड ट्रैकिंग। चमक और वॉल्यूम बदलना और डिस्प्ले मोड स्विच करना अभी समर्थित नहीं है।</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">Cardboard मोड</string>
|
||||
|
||||
@@ -3098,7 +3098,7 @@
|
||||
<string name="hand_camera_done">Kész</string>
|
||||
<string name="glasses_xreal_network_missing">Várakozás a szemüveg USB-s Ethernet-kapcsolatára. Lehet, hogy ez a telefon nem teszi elérhetővé az alkalmazások számára.</string>
|
||||
<string name="glasses_xreal_connection_failed">Az XREAL-kapcsolat megszakadt, vagy nem támogatott választ adott. Újrapróbálkozás…</string>
|
||||
<string name="glasses_xreal_experimental">Kísérleti 1S-támogatás. Használja a Follow módot, és kapcsolja ki a stabilizálást a szemüveg menüjében. A követési irányokat és a megjelenítési módokat még tesztelni kell az eszközön.</string>
|
||||
<string name="glasses_xreal_experimental">Az XREAL 1S, One, One Pro, One Pro+ és Aura kísérleti támogatása. Használja a Follow módot, és kapcsolja ki a stabilizálást a szemüveg menüjében; az Aura esetén a Spatial Anchor funkciót is kapcsolja ki. A fejkövetést és a 2D/3D-váltást az Aura és a One Pro+ modelleken teszteltük.</string>
|
||||
<string name="glasses_pro2_experimental">Kísérleti fejkövetés a Pro 2-höz. A fényerő és a hangerő beállítása, valamint a megjelenítési mód váltása még nem támogatott.</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">Cardboard mód</string>
|
||||
|
||||
@@ -3069,7 +3069,7 @@
|
||||
<string name="hand_camera_done">Selesai</string>
|
||||
<string name="glasses_xreal_network_missing">Menunggu koneksi Ethernet USB dari kacamata. Ponsel ini mungkin tidak menyediakannya untuk aplikasi.</string>
|
||||
<string name="glasses_xreal_connection_failed">Koneksi XREAL terputus atau memberikan respons yang tidak didukung. Mencoba lagi…</string>
|
||||
<string name="glasses_xreal_experimental">Dukungan 1S eksperimental. Gunakan mode Follow dan nonaktifkan stabilisasi di menu kacamata. Arah pelacakan dan mode tampilan masih perlu diuji di perangkat.</string>
|
||||
<string name="glasses_xreal_experimental">Dukungan eksperimental untuk XREAL 1S, One, One Pro, One Pro+, dan Aura. Gunakan mode Follow dan nonaktifkan stabilisasi di menu kacamata; pada Aura, nonaktifkan juga Spatial Anchor. Pelacakan kepala dan peralihan 2D/3D telah diuji pada Aura dan One Pro+.</string>
|
||||
<string name="glasses_pro2_experimental">Pelacakan kepala Pro 2 eksperimental. Pengaturan kecerahan, volume, dan pergantian mode tampilan belum didukung.</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">Mode Cardboard</string>
|
||||
|
||||
@@ -3116,7 +3116,7 @@
|
||||
<string name="hand_camera_done">Fine</string>
|
||||
<string name="glasses_xreal_network_missing">In attesa della connessione USB Ethernet degli occhiali. Questo telefono potrebbe non renderla disponibile alle app.</string>
|
||||
<string name="glasses_xreal_connection_failed">La connessione XREAL si è interrotta o ha restituito una risposta non supportata. Nuovo tentativo…</string>
|
||||
<string name="glasses_xreal_experimental">Supporto sperimentale per 1S. Usa la modalità Follow e disattiva la stabilizzazione nel menu degli occhiali. Direzioni del tracciamento e modalità di visualizzazione devono ancora essere testate sul dispositivo.</string>
|
||||
<string name="glasses_xreal_experimental">Supporto sperimentale per XREAL 1S, One, One Pro, One Pro+ e Aura. Usa la modalità Follow e disattiva la stabilizzazione nel menu degli occhiali; su Aura, disattiva anche Spatial Anchor. Il tracciamento della testa e il passaggio tra 2D/3D sono stati testati su Aura e One Pro+.</string>
|
||||
<string name="glasses_pro2_experimental">Tracciamento sperimentale della testa per Pro 2. La regolazione di luminosità e volume e il cambio della modalità di visualizzazione non sono ancora supportati.</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">Modalità Cardboard</string>
|
||||
|
||||
@@ -3069,7 +3069,7 @@
|
||||
<string name="hand_camera_done">完了</string>
|
||||
<string name="glasses_xreal_network_missing">グラスの USB Ethernet 接続を待っています。このスマートフォンでは、アプリがこの接続を利用できない場合があります。</string>
|
||||
<string name="glasses_xreal_connection_failed">XREAL との接続が中断されたか、サポートされていない応答が返されました。再試行しています…</string>
|
||||
<string name="glasses_xreal_experimental">1S のサポートは試験運用中です。グラスのメニューで Follow モードを使い、安定化をオフにしてください。トラッキングの方向と表示モードは、まだ実機でのテストが必要です。</string>
|
||||
<string name="glasses_xreal_experimental">XREAL 1S、One、One Pro、One Pro+、Auraの試験的なサポートです。グラスのメニューでFollowモードを使用し、安定化をオフにしてください。AuraではSpatial Anchorもオフにしてください。ヘッドトラッキングと2D/3D切り替えは、AuraとOne Pro+でテスト済みです。</string>
|
||||
<string name="glasses_pro2_experimental">Pro 2 のヘッドトラッキングは試験運用中です。明るさと音量の調整、および表示モードの切り替えにはまだ対応していません。</string>
|
||||
<string name="stores_fact_developer">開発元</string>
|
||||
<string name="stores_fact_publisher">パブリッシャー</string>
|
||||
|
||||
@@ -3069,7 +3069,7 @@
|
||||
<string name="hand_camera_done">완료</string>
|
||||
<string name="glasses_xreal_network_missing">안경의 USB Ethernet 연결을 기다리는 중입니다. 이 휴대폰은 앱에 이 연결을 제공하지 않을 수 있습니다.</string>
|
||||
<string name="glasses_xreal_connection_failed">XREAL 연결이 중단되었거나 지원되지 않는 응답을 받았습니다. 다시 시도하는 중…</string>
|
||||
<string name="glasses_xreal_experimental">1S 지원은 실험 단계입니다. 안경 메뉴에서 Follow 모드를 사용하고 안정화를 끄세요. 트래킹 방향과 디스플레이 모드는 아직 기기에서 테스트가 필요합니다.</string>
|
||||
<string name="glasses_xreal_experimental">XREAL 1S, One, One Pro, One Pro+ 및 Aura의 실험적 지원입니다. 안경 메뉴에서 Follow 모드를 사용하고 안정화를 끄세요. Aura에서는 Spatial Anchor도 끄세요. 헤드 트래킹과 2D/3D 전환은 Aura와 One Pro+에서 테스트되었습니다.</string>
|
||||
<string name="glasses_pro2_experimental">Pro 2 헤드 트래킹은 실험 단계입니다. 밝기와 음량 조절 및 디스플레이 모드 전환은 아직 지원되지 않습니다.</string>
|
||||
<string name="stores_fact_developer">개발사</string>
|
||||
<string name="stores_fact_publisher">배급사</string>
|
||||
|
||||
@@ -3069,7 +3069,7 @@
|
||||
<string name="hand_camera_done">Selesai</string>
|
||||
<string name="glasses_xreal_network_missing">Menunggu sambungan USB Ethernet cermin mata. Telefon ini mungkin tidak mendedahkannya kepada apl.</string>
|
||||
<string name="glasses_xreal_connection_failed">Sambungan XREAL terganggu atau memberikan respons yang tidak disokong. Mencuba semula…</string>
|
||||
<string name="glasses_xreal_experimental">Sokongan eksperimen untuk 1S. Gunakan mod Follow dan matikan penstabilan dalam menu cermin mata. Arah penjejakan dan mod paparan masih perlu diuji pada peranti.</string>
|
||||
<string name="glasses_xreal_experimental">Sokongan eksperimen untuk XREAL 1S, One, One Pro, One Pro+ dan Aura. Gunakan mod Follow dan matikan penstabilan dalam menu cermin mata; pada Aura, matikan juga Spatial Anchor. Penjejakan kepala dan pertukaran 2D/3D telah diuji pada Aura dan One Pro+.</string>
|
||||
<string name="glasses_pro2_experimental">Penjejakan kepala Pro 2 secara eksperimen. Pelarasan kecerahan, kelantangan dan pertukaran mod paparan belum disokong.</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">Mod Cardboard</string>
|
||||
|
||||
@@ -3098,7 +3098,7 @@
|
||||
<string name="hand_camera_done">Ferdig</string>
|
||||
<string name="glasses_xreal_network_missing">Venter på USB Ethernet-tilkoblingen til brillene. Denne telefonen gjør den kanskje ikke tilgjengelig for apper.</string>
|
||||
<string name="glasses_xreal_connection_failed">XREAL-tilkoblingen ble avbrutt eller ga et svar som ikke støttes. Prøver igjen…</string>
|
||||
<string name="glasses_xreal_experimental">Eksperimentell støtte for 1S. Bruk Follow-modus og slå av stabilisering i brillemenyen. Sporingsretninger og visningsmoduser må fortsatt testes på enheten.</string>
|
||||
<string name="glasses_xreal_experimental">Eksperimentell støtte for XREAL 1S, One, One Pro, One Pro+ og Aura. Bruk Follow-modus og slå av stabilisering i brillemenyen; på Aura må du også slå av Spatial Anchor. Hodesporing og bytte mellom 2D/3D er testet på Aura og One Pro+.</string>
|
||||
<string name="glasses_pro2_experimental">Eksperimentell hodesporing for Pro 2. Justering av lysstyrke og volum samt bytte av visningsmodus støttes ikke ennå.</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">Cardboard-modus</string>
|
||||
|
||||
@@ -3098,7 +3098,7 @@
|
||||
<string name="hand_camera_done">Klaar</string>
|
||||
<string name="glasses_xreal_network_missing">Wachten op de USB Ethernet-verbinding van de bril. Deze telefoon maakt die mogelijk niet beschikbaar voor apps.</string>
|
||||
<string name="glasses_xreal_connection_failed">De XREAL-verbinding is onderbroken of gaf een niet-ondersteund antwoord. Opnieuw proberen…</string>
|
||||
<string name="glasses_xreal_experimental">Experimentele ondersteuning voor 1S. Gebruik de Follow-modus en schakel stabilisatie uit in het menu van de bril. Trackingrichtingen en weergavemodi moeten nog op een apparaat worden getest.</string>
|
||||
<string name="glasses_xreal_experimental">Experimentele ondersteuning voor XREAL 1S, One, One Pro, One Pro+ en Aura. Gebruik de Follow-modus en schakel stabilisatie uit in het menu van de bril; schakel op de Aura ook Spatial Anchor uit. Hoofdtracking en schakelen tussen 2D/3D zijn getest op de Aura en One Pro+.</string>
|
||||
<string name="glasses_pro2_experimental">Experimentele hoofdtracking voor Pro 2. Het aanpassen van helderheid en volume en het wisselen van weergavemodus worden nog niet ondersteund.</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">Cardboard-modus</string>
|
||||
|
||||
@@ -3158,7 +3158,7 @@
|
||||
<string name="hand_camera_done">Gotowe</string>
|
||||
<string name="glasses_xreal_network_missing">Oczekiwanie na połączenie USB Ethernet okularów. Ten telefon może nie udostępniać go aplikacjom.</string>
|
||||
<string name="glasses_xreal_connection_failed">Połączenie z XREAL zostało przerwane lub zwróciło nieobsługiwaną odpowiedź. Ponawianie…</string>
|
||||
<string name="glasses_xreal_experimental">Eksperymentalna obsługa 1S. Użyj trybu Follow i wyłącz stabilizację w menu okularów. Kierunki śledzenia i tryby wyświetlania wymagają jeszcze testów na urządzeniu.</string>
|
||||
<string name="glasses_xreal_experimental">Eksperymentalna obsługa XREAL 1S, One, One Pro, One Pro+ i Aura. Użyj trybu Follow i wyłącz stabilizację w menu okularów; na Aura wyłącz też Spatial Anchor. Śledzenie głowy i przełączanie między 2D/3D przetestowano na Aura i One Pro+.</string>
|
||||
<string name="glasses_pro2_experimental">Eksperymentalne śledzenie ruchów głowy dla Pro 2. Regulacja jasności i głośności oraz przełączanie trybu wyświetlania nie są jeszcze obsługiwane.</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">Tryb Cardboard</string>
|
||||
|
||||
@@ -3130,7 +3130,7 @@
|
||||
<string name="hand_camera_done">Concluído</string>
|
||||
<string name="glasses_xreal_network_missing">A aguardar a ligação Ethernet por USB dos óculos. Este telemóvel pode não a disponibilizar às apps.</string>
|
||||
<string name="glasses_xreal_connection_failed">A ligação aos óculos XREAL foi interrompida ou devolveu uma resposta não suportada. A tentar novamente…</string>
|
||||
<string name="glasses_xreal_experimental">Suporte experimental para os 1S. Utilize o modo Follow e desative a estabilização no menu dos óculos. As direções de seguimento e os modos de ecrã ainda têm de ser testados no dispositivo.</string>
|
||||
<string name="glasses_xreal_experimental">Suporte experimental para XREAL 1S, One, One Pro, One Pro+ e Aura. Utilize o modo Follow e desative a estabilização no menu dos óculos; no Aura, desative também Spatial Anchor. O seguimento da cabeça e a alternância entre 2D/3D foram testados nos modelos Aura e One Pro+.</string>
|
||||
<string name="glasses_pro2_experimental">Seguimento experimental dos movimentos da cabeça para Pro 2. O ajuste do brilho e do volume e a mudança do modo de ecrã ainda não são suportados.</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">Modo Cardboard</string>
|
||||
|
||||
@@ -3138,7 +3138,7 @@
|
||||
<string name="hand_camera_done">Concluído</string>
|
||||
<string name="glasses_xreal_network_missing">Aguardando a conexão Ethernet por USB dos óculos. Este celular pode não disponibilizá-la para os apps.</string>
|
||||
<string name="glasses_xreal_connection_failed">A conexão com os óculos XREAL foi interrompida ou retornou uma resposta incompatível. Tentando novamente…</string>
|
||||
<string name="glasses_xreal_experimental">Suporte experimental ao 1S. Use o modo Follow e desative a estabilização no menu dos óculos. As direções do rastreamento e os modos de exibição ainda precisam de testes no dispositivo.</string>
|
||||
<string name="glasses_xreal_experimental">Suporte experimental a XREAL 1S, One, One Pro, One Pro+ e Aura. Use o modo Follow e desative a estabilização no menu dos óculos; no Aura, desative também Spatial Anchor. O rastreamento de cabeça e a alternância entre 2D/3D foram testados nos modelos Aura e One Pro+.</string>
|
||||
<string name="glasses_pro2_experimental">Rastreamento experimental da cabeça para Pro 2. Os ajustes de brilho e volume e a troca do modo de exibição ainda não são compatíveis.</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">Modo Cardboard</string>
|
||||
|
||||
@@ -3128,7 +3128,7 @@
|
||||
<string name="hand_camera_done">Gata</string>
|
||||
<string name="glasses_xreal_network_missing">Se așteaptă conexiunea USB Ethernet a ochelarilor. Este posibil ca acest telefon să nu o expună aplicațiilor.</string>
|
||||
<string name="glasses_xreal_connection_failed">Conexiunea XREAL a fost întreruptă sau a returnat un răspuns neacceptat. Se reîncearcă…</string>
|
||||
<string name="glasses_xreal_experimental">Suport experimental pentru 1S. Folosește modul Follow și dezactivează stabilizarea din meniul ochelarilor. Direcțiile de urmărire și modurile de afișare trebuie încă testate pe dispozitiv.</string>
|
||||
<string name="glasses_xreal_experimental">Suport experimental pentru XREAL 1S, One, One Pro, One Pro+ și Aura. Folosește modul Follow și dezactivează stabilizarea din meniul ochelarilor; pe Aura, dezactivează și Spatial Anchor. Urmărirea capului și comutarea între 2D/3D au fost testate pe Aura și One Pro+.</string>
|
||||
<string name="glasses_pro2_experimental">Urmărire experimentală a mișcărilor capului pentru Pro 2. Reglarea luminozității și a volumului și schimbarea modului de afișare nu sunt încă acceptate.</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">Mod Cardboard</string>
|
||||
|
||||
@@ -1648,6 +1648,7 @@
|
||||
<string name="main_pick_game_storage">Выберите папку хранилища игр</string>
|
||||
<string name="main_pick_decky_zip">Выберите ZIP-файл плагина Decky</string>
|
||||
<string name="main_storage_not_usable">Нельзя использовать: %1$s</string>
|
||||
<string name="main_storage_fat32">FAT32 не поддерживает файлы больше 4 ГБ, поэтому часть игр не установится. Отформатируйте в exFAT.</string>
|
||||
<string name="main_running_program">Программа</string>
|
||||
<string name="main_removing_runtime">Удаление среды выполнения Linux</string>
|
||||
<string name="main_settings_main_screen">Не удалось открыть настройки на нижнем экране; они открыты на главном экране.</string>
|
||||
@@ -3155,7 +3156,7 @@
|
||||
<string name="hand_camera_done">Готово</string>
|
||||
<string name="glasses_xreal_network_missing">Ожидание подключения очков по USB Ethernet. Этот телефон может не предоставлять его приложениям.</string>
|
||||
<string name="glasses_xreal_connection_failed">Подключение к XREAL прервано или получен неподдерживаемый ответ. Повторная попытка…</string>
|
||||
<string name="glasses_xreal_experimental">Экспериментальная поддержка 1S. Включите режим Follow и отключите стабилизацию в меню очков. Направления отслеживания и режимы отображения ещё нужно проверить на устройстве.</string>
|
||||
<string name="glasses_xreal_experimental">Экспериментальная поддержка XREAL 1S, One, One Pro, One Pro+ и Aura. Используйте режим Follow и отключите стабилизацию в меню очков; на Aura также отключите Spatial Anchor. Отслеживание головы и переключение между 2D/3D проверены на Aura и One Pro+.</string>
|
||||
<string name="glasses_pro2_experimental">Экспериментальное отслеживание движений головы для Pro 2. Настройка яркости и громкости и переключение режимов отображения пока не поддерживаются.</string>
|
||||
<string name="stores_fact_developer">Разработчик</string>
|
||||
<string name="stores_fact_publisher">Издатель</string>
|
||||
|
||||
@@ -3098,7 +3098,7 @@
|
||||
<string name="hand_camera_done">Klar</string>
|
||||
<string name="glasses_xreal_network_missing">Väntar på glasögonens USB Ethernet-anslutning. Telefonen kanske inte gör den tillgänglig för appar.</string>
|
||||
<string name="glasses_xreal_connection_failed">XREAL-anslutningen avbröts eller gav ett svar som inte stöds. Försöker igen…</string>
|
||||
<string name="glasses_xreal_experimental">Experimentellt stöd för 1S. Använd Follow-läget och stäng av stabiliseringen i glasögonens meny. Spårningsriktningar och visningslägen behöver fortfarande testas på enheten.</string>
|
||||
<string name="glasses_xreal_experimental">Experimentellt stöd för XREAL 1S, One, One Pro, One Pro+ och Aura. Använd Follow-läget och stäng av stabiliseringen i glasögonens meny; på Aura ska du även stänga av Spatial Anchor. Huvudspårning och växling mellan 2D/3D har testats på Aura och One Pro+.</string>
|
||||
<string name="glasses_pro2_experimental">Experimentell huvudspårning för Pro 2. Justering av ljusstyrka och volym samt byte av visningsläge stöds inte ännu.</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">Cardboard-läge</string>
|
||||
|
||||
@@ -3069,7 +3069,7 @@
|
||||
<string name="hand_camera_done">เสร็จสิ้น</string>
|
||||
<string name="glasses_xreal_network_missing">กำลังรอการเชื่อมต่อ USB Ethernet ของแว่นตา โทรศัพท์นี้อาจไม่เปิดให้แอปเข้าถึงการเชื่อมต่อนี้</string>
|
||||
<string name="glasses_xreal_connection_failed">การเชื่อมต่อ XREAL ขาดหายหรือได้รับการตอบกลับที่ไม่รองรับ กำลังลองใหม่…</string>
|
||||
<string name="glasses_xreal_experimental">รองรับ 1S แบบทดลอง ใช้โหมด Follow และปิดการกันสั่นในเมนูของแว่นตา ทิศทางการติดตามและโหมดการแสดงผลยังต้องทดสอบกับอุปกรณ์จริง</string>
|
||||
<string name="glasses_xreal_experimental">รองรับ XREAL 1S, One, One Pro, One Pro+ และ Aura แบบทดลอง ใช้โหมด Follow และปิดการกันสั่นในเมนูของแว่นตา สำหรับ Aura ให้ปิด Spatial Anchor ด้วย การติดตามศีรษะและการสลับ 2D/3D ผ่านการทดสอบบน Aura และ One Pro+ แล้ว</string>
|
||||
<string name="glasses_pro2_experimental">การติดตามศีรษะแบบทดลองสำหรับ Pro 2 ยังไม่รองรับการปรับความสว่าง ระดับเสียง และการสลับโหมดการแสดงผล</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">โหมด Cardboard</string>
|
||||
|
||||
@@ -3087,7 +3087,7 @@
|
||||
<string name="hand_camera_done">Bitti</string>
|
||||
<string name="glasses_xreal_network_missing">Gözlüğün USB Ethernet bağlantısı bekleniyor. Bu telefon bu bağlantıyı uygulamalara açmıyor olabilir.</string>
|
||||
<string name="glasses_xreal_connection_failed">XREAL bağlantısı kesildi veya desteklenmeyen bir yanıt döndü. Yeniden deneniyor…</string>
|
||||
<string name="glasses_xreal_experimental">Deneysel 1S desteği. Gözlük menüsünde Follow modunu kullanın ve görüntü sabitlemeyi kapatın. Takip yönlerinin ve ekran modlarının hâlâ cihazda test edilmesi gerekiyor.</string>
|
||||
<string name="glasses_xreal_experimental">Deneysel XREAL 1S, One, One Pro, One Pro+ ve Aura desteği. Gözlük menüsünde Follow modunu kullanın ve görüntü sabitlemeyi kapatın; Aura üzerinde Spatial Anchor özelliğini de kapatın. Kafa takibi ve 2D/3D geçişi Aura ve One Pro+ üzerinde test edilmiştir.</string>
|
||||
<string name="glasses_pro2_experimental">Pro 2 için deneysel baş takibi. Parlaklık ve ses düzeyi ayarı ile ekran modu değiştirme henüz desteklenmiyor.</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">Cardboard modu</string>
|
||||
|
||||
@@ -3158,7 +3158,7 @@
|
||||
<string name="hand_camera_done">Готово</string>
|
||||
<string name="glasses_xreal_network_missing">Очікування з’єднання USB Ethernet від окулярів. Цей телефон може не надавати його додаткам.</string>
|
||||
<string name="glasses_xreal_connection_failed">З’єднання з XREAL перервалося або повернуло непідтримувану відповідь. Повторна спроба…</string>
|
||||
<string name="glasses_xreal_experimental">Експериментальна підтримка 1S. Увімкніть режим Follow і вимкніть стабілізацію в меню окулярів. Напрямки відстеження й режими відображення ще потрібно перевірити на пристрої.</string>
|
||||
<string name="glasses_xreal_experimental">Експериментальна підтримка XREAL 1S, One, One Pro, One Pro+ та Aura. Використовуйте режим Follow і вимкніть стабілізацію в меню окулярів; на Aura також вимкніть Spatial Anchor. Відстеження голови та перемикання між 2D/3D перевірено на Aura й One Pro+.</string>
|
||||
<string name="glasses_pro2_experimental">Експериментальне відстеження рухів голови для Pro 2. Налаштування яскравості й гучності та перемикання режимів відображення ще не підтримуються.</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">Режим Cardboard</string>
|
||||
|
||||
@@ -3069,7 +3069,7 @@
|
||||
<string name="hand_camera_done">Xong</string>
|
||||
<string name="glasses_xreal_network_missing">Đang chờ kết nối USB Ethernet của kính. Điện thoại này có thể không cho ứng dụng truy cập kết nối đó.</string>
|
||||
<string name="glasses_xreal_connection_failed">Kết nối XREAL bị gián đoạn hoặc trả về phản hồi không được hỗ trợ. Đang thử lại…</string>
|
||||
<string name="glasses_xreal_experimental">Hỗ trợ 1S thử nghiệm. Dùng chế độ Follow và tắt ổn định hình ảnh trong menu của kính. Hướng theo dõi và các chế độ hiển thị vẫn cần thử nghiệm trên thiết bị.</string>
|
||||
<string name="glasses_xreal_experimental">Hỗ trợ thử nghiệm cho XREAL 1S, One, One Pro, One Pro+ và Aura. Dùng chế độ Follow và tắt ổn định hình ảnh trong menu của kính; trên Aura, hãy tắt cả Spatial Anchor. Tính năng theo dõi đầu và chuyển đổi 2D/3D đã được thử nghiệm trên Aura và One Pro+.</string>
|
||||
<string name="glasses_pro2_experimental">Theo dõi chuyển động đầu thử nghiệm cho Pro 2. Chưa hỗ trợ điều chỉnh độ sáng, âm lượng và chuyển chế độ hiển thị.</string>
|
||||
<string name="cardboard_title">Cardboard VR</string>
|
||||
<string name="cardboard_mode">Chế độ Cardboard</string>
|
||||
|
||||
@@ -3069,7 +3069,7 @@
|
||||
<string name="hand_camera_done">完成</string>
|
||||
<string name="glasses_xreal_network_missing">正在等待眼镜的 USB Ethernet 连接。这部手机可能不向应用开放此连接。</string>
|
||||
<string name="glasses_xreal_connection_failed">XREAL 连接中断或返回了不受支持的响应。正在重试…</string>
|
||||
<string name="glasses_xreal_experimental">实验性 1S 支持。请在眼镜菜单中使用跟随模式并关闭防抖。追踪方向和显示模式仍需在设备上测试。</string>
|
||||
<string name="glasses_xreal_experimental">实验性支持 XREAL 1S、One、One Pro、One Pro+ 和 Aura。请在眼镜菜单中使用 Follow 模式并关闭防抖;在 Aura 上还需关闭 Spatial Anchor。头部追踪和 2D/3D 切换已在 Aura 和 One Pro+ 上测试。</string>
|
||||
<string name="glasses_pro2_experimental">Pro 2 实验性头部追踪。暂不支持亮度、音量调节和显示模式切换。</string>
|
||||
<string name="stores_fact_developer">开发商</string>
|
||||
<string name="stores_fact_publisher">发行商</string>
|
||||
|
||||
@@ -3066,7 +3066,7 @@
|
||||
<string name="hand_camera_done">完成</string>
|
||||
<string name="glasses_xreal_network_missing">正在等候眼鏡的 USB Ethernet 連線。這部手機可能不會向應用程式開放此連線。</string>
|
||||
<string name="glasses_xreal_connection_failed">XREAL 連線中斷或傳回不支援的回應。正在重試…</string>
|
||||
<string name="glasses_xreal_experimental">實驗性 1S 支援。請在眼鏡選單中使用跟隨模式並關閉畫面穩定。追蹤方向和顯示模式仍需在裝置上測試。</string>
|
||||
<string name="glasses_xreal_experimental">實驗性支援 XREAL 1S、One、One Pro、One Pro+ 和 Aura。請在眼鏡選單中使用 Follow 模式並關閉畫面穩定;在 Aura 上亦需關閉 Spatial Anchor。頭部追蹤和 2D/3D 切換已在 Aura 和 One Pro+ 上測試。</string>
|
||||
<string name="glasses_pro2_experimental">Pro 2 實驗性頭部追蹤。暫不支援亮度、音量調整及顯示模式切換。</string>
|
||||
<string name="stores_fact_developer">開發商</string>
|
||||
<string name="stores_fact_publisher">發行商</string>
|
||||
|
||||
@@ -3066,7 +3066,7 @@
|
||||
<string name="hand_camera_done">完成</string>
|
||||
<string name="glasses_xreal_network_missing">正在等待眼鏡的 USB Ethernet 連線。這支手機可能不會向應用程式開放此連線。</string>
|
||||
<string name="glasses_xreal_connection_failed">XREAL 連線中斷或傳回不支援的回應。正在重試…</string>
|
||||
<string name="glasses_xreal_experimental">實驗性 1S 支援。請在眼鏡選單中使用跟隨模式並關閉畫面穩定。追蹤方向和顯示模式仍需在實機上測試。</string>
|
||||
<string name="glasses_xreal_experimental">實驗性支援 XREAL 1S、One、One Pro、One Pro+ 和 Aura。請在眼鏡選單中使用 Follow 模式並關閉畫面穩定;在 Aura 上還需關閉 Spatial Anchor。頭部追蹤和 2D/3D 切換已在 Aura 和 One Pro+ 上測試。</string>
|
||||
<string name="glasses_pro2_experimental">Pro 2 實驗性頭部追蹤。尚不支援亮度、音量調整及顯示模式切換。</string>
|
||||
<string name="stores_fact_developer">開發商</string>
|
||||
<string name="stores_fact_publisher">發行商</string>
|
||||
|
||||
@@ -1841,6 +1841,7 @@
|
||||
<string name="main_pick_game_storage">Choose the game storage folder</string>
|
||||
<string name="main_pick_decky_zip">Choose a Decky plugin ZIP</string>
|
||||
<string name="main_storage_not_usable">Not usable: %1$s</string>
|
||||
<string name="main_storage_fat32">FAT32 cannot hold files over 4 GB, so some games will fail to install. Reformat as exFAT.</string>
|
||||
<string name="main_running_program">Program</string>
|
||||
<string name="main_removing_runtime">Removing Linux runtime</string>
|
||||
<string name="main_settings_main_screen">Could not open Settings on the bottom screen; opened it on the main screen.</string>
|
||||
@@ -3451,7 +3452,7 @@
|
||||
<string name="hand_camera_done">Done</string>
|
||||
<string name="glasses_xreal_network_missing">Waiting for the glasses’ USB Ethernet connection. This phone may not expose it to apps.</string>
|
||||
<string name="glasses_xreal_connection_failed">The XREAL connection was interrupted or returned an unsupported response. Retrying…</string>
|
||||
<string name="glasses_xreal_experimental">Experimental XREAL 1S, One, One Pro, One Pro+ and Aura support. Use Follow mode and turn off stabilization in the glasses menu; on the Aura, also turn off Spatial Anchor. Head tracking and 2D/3D switching are tested on the Aura.</string>
|
||||
<string name="glasses_xreal_experimental">Experimental XREAL 1S, One, One Pro, One Pro+ and Aura support. Use Follow mode and turn off stabilization in the glasses menu; on the Aura, also turn off Spatial Anchor. Head tracking and 2D/3D switching are tested on the Aura and One Pro+.</string>
|
||||
<string name="glasses_pro2_experimental">Experimental Pro 2 head tracking. Brightness, volume, and display switching are not supported yet.</string>
|
||||
<string name="display_picture_position">Picture position</string>
|
||||
<string name="display_position_top">Top</string>
|
||||
|
||||
@@ -54,6 +54,16 @@ class WinComponentDetectorsTest {
|
||||
assertEquals(emptyList<String?>(), WinCompSources.steamList(context, game, 409710, "Other", auto = true).map { it.component })
|
||||
}
|
||||
|
||||
@Test fun eu4GetsTheNativeShaderCompilerItsMapEffectsNeed() {
|
||||
val steamapps = tmp.newFolder("steamapps")
|
||||
val game = File(steamapps, "common/Europa Universalis IV").apply { mkdirs() }
|
||||
File(steamapps, "appmanifest_236850.acf").writeText("\"AppState\"\n{\n\t\"SharedDepots\"\n\t{\n\t\t\"228983\"\t\t\"228980\"\n\t\t\"228990\"\t\t\"228980\"\n\t}\n}\n")
|
||||
val context = androidx.test.core.app.ApplicationProvider.getApplicationContext<android.content.Context>()
|
||||
val found = WinCompSources.steamList(context, game, 236850, "Europa Universalis IV", auto = true)
|
||||
assertEquals(listOf("vcredist2010_dll", "d3dx9", "d3dcompiler_43"), found.map { it.component })
|
||||
assertTrue(found.all { it.auto && it.origin == WinCompSources.Origin.STEAM })
|
||||
}
|
||||
|
||||
@Test fun theGamesInstallScriptRedistsAreInstalledAsSteamWould() {
|
||||
val steamapps = tmp.newFolder("steamapps")
|
||||
val game = File(steamapps, "common/DiRT 3 Complete Edition").apply { mkdirs() }
|
||||
|
||||
@@ -265,6 +265,34 @@ class GlassesUsbTest {
|
||||
assertEquals(null, Glasses.deviceModel(device(0x043e, 0x1234, "XREAL 1S")))
|
||||
}
|
||||
|
||||
@Test fun xrealProPlusUsesEthernetPermissionAndItsOwnOptics() {
|
||||
val pro = device(0x0444, 0x3318, "XREAL 1 Pro+")
|
||||
manager.devices[pro.deviceName] = pro
|
||||
field("linkDevice").set(null, pro)
|
||||
field("link").set(null, object : GlassesLink {
|
||||
override val hasImu = true
|
||||
override fun send(msgId: Int, payload: ByteArray) = true
|
||||
override fun close() {}
|
||||
})
|
||||
try {
|
||||
refresh(ask = true)
|
||||
assertEquals("XREAL One Pro+", state.value.model)
|
||||
assertEquals(Glasses.Permission.GRANTED, state.value.permission)
|
||||
assertTrue(manager.requests.isEmpty())
|
||||
assertTrue(state.value.canControl)
|
||||
assertTrue(state.value.hardwareControls)
|
||||
assertTrue(state.value.supportsScreen3dof)
|
||||
assertFalse(state.value.supportsSpatial)
|
||||
assertEquals(57f, state.value.diagonalFovDeg, 0f)
|
||||
assertEquals(9, state.value.brightnessMax)
|
||||
assertEquals(0, state.value.volumeMax)
|
||||
} finally {
|
||||
field("link").set(null, null)
|
||||
field("linkDevice").set(null, null)
|
||||
(field("handler").get(null) as Handler).removeCallbacksAndMessages(null)
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun rokidMaxRoutesThroughItsOwnModelAndSharedVendorIdNeedsTheName() {
|
||||
val max = Glasses.deviceModel(device(0x162f, 0x04d2, "Rokid Max"))
|
||||
assertTrue(max is RokidModel)
|
||||
|
||||
@@ -38,7 +38,7 @@ class XrealLinkTest {
|
||||
override fun close() { closed = true; bytes.clear(); bytes.offer(-1) }
|
||||
}
|
||||
|
||||
private class Channels : XrealChannels {
|
||||
private class Channels(private val displayMode: Int = 2) : XrealChannels {
|
||||
override val controlInput = Input()
|
||||
override val reports = Input()
|
||||
val wrote = LinkedBlockingQueue<Int>()
|
||||
@@ -53,7 +53,7 @@ class XrealLinkTest {
|
||||
val id = ByteBuffer.wrap(request.body).int and Int.MAX_VALUE
|
||||
wrote.offer(request.command)
|
||||
if (acknowledge) controlInput.add(XrealProtocolTest.response(request.command, id,
|
||||
if (request.command == XrealProtocol.GET_DISPLAY) byteArrayOf(0x22, 2, 0x10, 2) else byteArrayOf(0x22, 0)))
|
||||
if (request.command == XrealProtocol.GET_DISPLAY) byteArrayOf(0x22, 2, 0x10, displayMode.toByte()) else byteArrayOf(0x22, 0)))
|
||||
}
|
||||
}
|
||||
override fun close() { controlInput.close(); reports.close(); closed.countDown() }
|
||||
@@ -113,6 +113,27 @@ class XrealLinkTest {
|
||||
} finally { link.close() }
|
||||
}
|
||||
|
||||
@Test fun proPlusRejects1sOnlyModesAndKeepsBrightnessWithinTheSupportedRange() {
|
||||
val channels = Channels(9)
|
||||
val listener = Listener()
|
||||
val link = XrealLink(object : XrealConnector {
|
||||
override fun connect() = channels
|
||||
override fun close() = channels.close()
|
||||
}, listener, XrealModel.ONE_PRO_PLUS)
|
||||
try {
|
||||
assertTrue(listener.ready.await(2, TimeUnit.SECONDS))
|
||||
assertEquals(VitureProtocol.MSG_GET_DISPLAY to 9, listener.values.poll(2, TimeUnit.SECONDS))
|
||||
assertEquals(XrealProtocol.GET_DISPLAY, channels.wrote.poll(2, TimeUnit.SECONDS))
|
||||
assertFalse(link.send(VitureProtocol.MSG_DISPLAY, byteArrayOf(29)))
|
||||
assertFalse(link.send(VitureProtocol.MSG_DISPLAY, byteArrayOf(2)))
|
||||
assertFalse(link.send(VitureProtocol.MSG_BRIGHTNESS, byteArrayOf(10)))
|
||||
assertTrue(channels.wrote.isEmpty())
|
||||
assertTrue(link.send(VitureProtocol.MSG_BRIGHTNESS, byteArrayOf(9)))
|
||||
assertEquals(VitureProtocol.MSG_BRIGHTNESS to 9, listener.values.poll(2, TimeUnit.SECONDS))
|
||||
assertEquals(XrealProtocol.SET_BRIGHTNESS, channels.wrote.poll(2, TimeUnit.SECONDS))
|
||||
} finally { link.close() }
|
||||
}
|
||||
|
||||
@Test fun missingNetworkIsReportedAndCloseCancelsRetry() {
|
||||
val listener = Listener()
|
||||
val closed = AtomicBoolean()
|
||||
|
||||
@@ -61,9 +61,9 @@ class XrealOrientationFilterTest {
|
||||
}
|
||||
|
||||
@Test fun auraAxesAreNotFlippedLikeTheRestOfTheOneFamily() {
|
||||
val aura = XrealOrientationFilter(flipYz = false).update(sample(1000000, accel = Vec3(0f, 9.81f, 0f)))!!
|
||||
val aura = XrealOrientationFilter(XrealModel.AURA).update(sample(1000000, accel = Vec3(0f, 9.81f, 0f)))!!
|
||||
assertTrue(matrix(aura)[7] > 0.99f)
|
||||
assertNull(XrealOrientationFilter(flipYz = false).update(sample(1000000, accel = Vec3(0f, 0f, 0f))))
|
||||
assertNull(XrealOrientationFilter(XrealModel.AURA).update(sample(1000000, accel = Vec3(0f, 0f, 0f))))
|
||||
}
|
||||
|
||||
@Test fun capturedNeutralGravityStartsUprightBeforeRecenter() {
|
||||
@@ -73,4 +73,93 @@ class XrealOrientationFilterTest {
|
||||
val screen = matrix(pose)
|
||||
assertTrue(screen[7] > 0.99f)
|
||||
}
|
||||
|
||||
@Test fun proPlusMountStartsUprightBeforeRecenter() {
|
||||
val neutral = sample(1000000)
|
||||
val expected = matrix(XrealOrientationFilter().update(neutral)!!)
|
||||
val actual = matrix(XrealOrientationFilter(XrealModel.ONE_PRO_PLUS).update(proPlusSample(neutral))!!)
|
||||
assertArrayEquals(expected, actual, 0.0001f)
|
||||
assertEquals(1f, actual[7], 0.0001f)
|
||||
}
|
||||
|
||||
@Test fun proPlusMountKeepsBothDirectionsOfEveryAxisCorrectThroughBothRecenterModes() {
|
||||
for (axis in listOf("pitch", "yaw", "roll")) for (direction in listOf(-1, 1)) {
|
||||
val ideal = XrealOrientationFilter()
|
||||
val mounted = XrealOrientationFilter(XrealModel.ONE_PRO_PLUS)
|
||||
val initial = sample(1000000)
|
||||
val firstIdeal = matrix(ideal.update(initial)!!)
|
||||
val firstMounted = matrix(mounted.update(proPlusSample(initial))!!)
|
||||
var middleIdeal = firstIdeal
|
||||
var middleMounted = firstMounted
|
||||
var lastIdeal = firstIdeal
|
||||
var lastMounted = firstMounted
|
||||
val rate = direction * (Math.PI / 6).toFloat()
|
||||
repeat(1000) {
|
||||
val angle = rate * (it + 1) / 1000f
|
||||
val accel = when (axis) {
|
||||
"pitch" -> Vec3(0f, -9.81f * cos(angle), 9.81f * sin(angle))
|
||||
"yaw" -> Vec3(0f, -9.81f, 0f)
|
||||
else -> Vec3(-9.81f * sin(angle), -9.81f * cos(angle), 0f)
|
||||
}
|
||||
val gyro = when (axis) {
|
||||
"pitch" -> Vec3(rate, 0f, 0f)
|
||||
"yaw" -> Vec3(0f, -rate, 0f)
|
||||
else -> Vec3(0f, 0f, rate)
|
||||
}
|
||||
val frame = sample((it + 2) * 1000000L, gyro, accel)
|
||||
lastIdeal = matrix(ideal.update(frame)!!)
|
||||
lastMounted = matrix(mounted.update(proPlusSample(frame))!!)
|
||||
if (it == 499) {
|
||||
middleIdeal = lastIdeal
|
||||
middleMounted = lastMounted
|
||||
}
|
||||
}
|
||||
for (centerView in listOf(false, true)) {
|
||||
val label = "$axis $direction centerView=$centerView"
|
||||
val idealView = HeadPose.relative(HeadPose.recenter(firstIdeal, centerView), lastIdeal)
|
||||
val mountedView = HeadPose.relative(HeadPose.recenter(firstMounted, centerView), lastMounted)
|
||||
assertArrayEquals(label, axisMatrix(axis, rate), mountedView, 0.002f)
|
||||
assertArrayEquals(label, idealView, mountedView, 0.0001f)
|
||||
|
||||
val idealRecentered = HeadPose.relative(HeadPose.recenter(middleIdeal, centerView), lastIdeal)
|
||||
val mountedRecentered = HeadPose.relative(HeadPose.recenter(middleMounted, centerView), lastMounted)
|
||||
val recenteredAngle = if (centerView || axis == "yaw") rate / 2 else rate
|
||||
assertArrayEquals("$label after mid-turn recenter", axisMatrix(axis, recenteredAngle), mountedRecentered, 0.002f)
|
||||
assertArrayEquals("$label after mid-turn recenter", idealRecentered, mountedRecentered, 0.0001f)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun recordedProPlusTurnAxesStayOnYawAndRoll() {
|
||||
val recordedAxes = mapOf("yaw" to Vec3(0.052f, 0.867f, -0.496f), "roll" to Vec3(0.033f, 0.625f, 0.780f))
|
||||
for ((label, gyro) in recordedAxes) {
|
||||
val filter = XrealOrientationFilter(XrealModel.ONE_PRO_PLUS)
|
||||
val first = matrix(filter.update(sample(1000000))!!)
|
||||
var last = first
|
||||
repeat(100) {
|
||||
last = matrix(filter.update(sample((it + 2) * 1000000L, gyro, Vec3(0f, 0f, 0f)))!!)
|
||||
}
|
||||
val view = HeadPose.relative(HeadPose.recenter(first, centerView = true), last)
|
||||
val axis = Vec3(view[7] - view[5], view[2] - view[6], view[3] - view[1]).normalized()
|
||||
val projection = if (label == "yaw") -axis.y else -axis.z
|
||||
assertTrue("Recorded $label axis should be within 10 degrees of the display axis",
|
||||
projection > cos(Math.toRadians(10.0).toFloat()))
|
||||
}
|
||||
}
|
||||
|
||||
private fun proPlusSample(sample: XrealProtocol.Sample): XrealProtocol.Sample {
|
||||
val angle = Math.toRadians(-35.0).toFloat()
|
||||
fun mounted(v: Vec3) = Vec3(v.x, cos(angle) * v.y - sin(angle) * v.z, sin(angle) * v.y + cos(angle) * v.z)
|
||||
return XrealProtocol.Sample(sample.timeNs, mounted(sample.gyro), mounted(sample.accel))
|
||||
}
|
||||
|
||||
private fun axisMatrix(axis: String, angle: Float): FloatArray {
|
||||
val c = cos(angle)
|
||||
val s = sin(angle)
|
||||
return when (axis) {
|
||||
"pitch" -> floatArrayOf(1f, 0f, 0f, 0f, c, -s, 0f, s, c)
|
||||
"yaw" -> floatArrayOf(c, 0f, s, 0f, 1f, 0f, -s, 0f, c)
|
||||
else -> floatArrayOf(c, s, 0f, -s, c, 0f, 0f, 0f, 1f)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,17 +70,24 @@ class XrealProtocolTest {
|
||||
}
|
||||
|
||||
@Test fun stereoOnlyControlSwitches3dWithoutDisplayModeCommands() {
|
||||
val output = ByteArrayOutputStream()
|
||||
val replies = response(XrealProtocol.GET_INPUT, 1, byteArrayOf(0x22, 0)) +
|
||||
response(XrealProtocol.SET_INPUT, 2, byteArrayOf(0x22, 0)) +
|
||||
response(XrealProtocol.GET_INPUT, 3, byteArrayOf(0x22, 2, 0x10, 1))
|
||||
val control = XrealControl(channels(replies.inputStream(), output), stereoOnly = true, settleDelayMs = 0)
|
||||
assertEquals(XrealModel.NATIVE_60HZ, control.display())
|
||||
assertEquals(5, control.changeDisplay(5))
|
||||
val written = output.toByteArray().inputStream()
|
||||
val commands = List(3) { XrealProtocol.read(written).command }
|
||||
assertEquals(listOf(XrealProtocol.GET_INPUT, XrealProtocol.SET_INPUT, XrealProtocol.GET_INPUT), commands)
|
||||
assertFalse(commands.any { it == XrealProtocol.GET_DISPLAY || it == XrealProtocol.SET_DISPLAY })
|
||||
for (model in listOf(XrealModel.ONE, XrealModel.ONE_PRO, XrealModel.AURA)) {
|
||||
assertFalse(model.hardwareControls)
|
||||
assertFalse(model.hasSunblock)
|
||||
assertEquals(listOf(60), model.rates2d)
|
||||
assertFalse(model.supportsDisplayMode(9))
|
||||
assertFalse(model.supportsDisplayMode(3))
|
||||
val output = ByteArrayOutputStream()
|
||||
val replies = response(XrealProtocol.GET_INPUT, 1, byteArrayOf(0x22, 0)) +
|
||||
response(XrealProtocol.SET_INPUT, 2, byteArrayOf(0x22, 0)) +
|
||||
response(XrealProtocol.GET_INPUT, 3, byteArrayOf(0x22, 2, 0x10, 1))
|
||||
val control = XrealControl(channels(replies.inputStream(), output), model = model, settleDelayMs = 0)
|
||||
assertEquals(XrealModel.NATIVE_60HZ, control.display())
|
||||
assertEquals(5, control.changeDisplay(5))
|
||||
val written = output.toByteArray().inputStream()
|
||||
val commands = List(3) { XrealProtocol.read(written).command }
|
||||
assertEquals(listOf(XrealProtocol.GET_INPUT, XrealProtocol.SET_INPUT, XrealProtocol.GET_INPUT), commands)
|
||||
assertFalse(commands.any { it == XrealProtocol.GET_DISPLAY || it == XrealProtocol.SET_DISPLAY })
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun unrelatedResponsesCannotKeepControlWaitingForever() {
|
||||
@@ -125,6 +132,44 @@ class XrealProtocolTest {
|
||||
assertThrows(IOException::class.java) { control.changeDisplay(5) }
|
||||
}
|
||||
|
||||
@Test fun proPlusKeeps1080pModesSeparateFrom1sNative1200p() {
|
||||
val pro = XrealModel.ONE_PRO_PLUS
|
||||
assertEquals(9, pro.mode(60, false))
|
||||
assertEquals(3, pro.mode(90, false))
|
||||
assertEquals(4, pro.mode(120, false))
|
||||
assertEquals(5, pro.mode(120, true))
|
||||
assertFalse(pro.sbs90)
|
||||
assertEquals(listOf(60, 90, 120), pro.rates2d)
|
||||
assertEquals(57f, pro.diagonalFovDeg, 0f)
|
||||
assertEquals(29, XrealModel.ONE_S.mode(60, false))
|
||||
assertEquals(52f, XrealModel.ONE_S.diagonalFovDeg, 0f)
|
||||
}
|
||||
|
||||
@Test fun proPlusRejects1sOnlyDisplayResponsesAndCommands() {
|
||||
for (mode in listOf(2, 29)) {
|
||||
val response = response(XrealProtocol.GET_DISPLAY, 1, byteArrayOf(0x22, 2, 0x10, mode.toByte()))
|
||||
val output = ByteArrayOutputStream()
|
||||
val control = XrealControl(channels(response.inputStream(), output), model = XrealModel.ONE_PRO_PLUS)
|
||||
assertThrows(IOException::class.java) { control.display() }
|
||||
output.reset()
|
||||
assertThrows(IllegalArgumentException::class.java) { control.changeDisplay(mode) }
|
||||
assertEquals(0, output.size())
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun proPlusCanReturnFromStereoToIts1080p60HzMode() {
|
||||
val output = ByteArrayOutputStream()
|
||||
val replies = response(XrealProtocol.SET_INPUT, 1, byteArrayOf(0x22, 0)) +
|
||||
response(XrealProtocol.GET_DISPLAY, 2, byteArrayOf(0x22, 0)) +
|
||||
response(XrealProtocol.GET_DISPLAY, 3, byteArrayOf(0x22, 2, 0x10, 9))
|
||||
val control = XrealControl(channels(replies.inputStream(), output), 0, XrealModel.ONE_PRO_PLUS)
|
||||
assertEquals(9, control.changeDisplay(XrealModel.ONE_PRO_PLUS.mode(60, false)))
|
||||
val requests = output.toByteArray().inputStream()
|
||||
assertEquals(XrealProtocol.SET_INPUT, XrealProtocol.read(requests).command)
|
||||
repeat(2) { assertEquals(XrealProtocol.GET_DISPLAY, XrealProtocol.read(requests).command) }
|
||||
assertEquals(0, requests.available())
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun sensor(time: Long = 123456789L): ByteArray = ByteBuffer.allocate(128).order(ByteOrder.LITTLE_ENDIAN)
|
||||
.putLong(8, time).putInt(24, 11).putFloat(32, 0.5f).putFloat(44, 9.81f).array()
|
||||
|
||||
@@ -11,6 +11,7 @@ class SocNamesTest {
|
||||
assertEquals("SG8350P", SocNames.model(props("ro.vendor.qti.soc_model" to "SG8350P", "ro.fota.platform" to "MSM_13.0")))
|
||||
assertEquals("QCS8550", SocNames.model(props("ro.soc.model" to "QCS8550", "ro.vendor.qti.soc_model" to "other")))
|
||||
assertEquals("", SocNames.model(props("ro.fota.platform" to "MSM_13.0")))
|
||||
assertEquals("QTI SM8750P", SocNames.model(props("ro.soc.model" to "unknown", "ro.vendor.qti.soc_model" to "QTI SM8750P")))
|
||||
}
|
||||
|
||||
@Test fun knownModelsAndPlatformsGetTheirNames() {
|
||||
@@ -26,6 +27,7 @@ class SocNamesTest {
|
||||
assertEquals("Snapdragon 8 Elite Extreme Gen 6", SocNames.name("QTI SM8975", ""))
|
||||
assertEquals("Snapdragon 8 Elite Extreme Gen 6", SocNames.name(" qti sm8975 ", ""))
|
||||
assertEquals("Snapdragon 8 Elite Extreme Gen 6 (QTI SM8975)", SocNames.label("QTI SM8975", ""))
|
||||
assertEquals("Snapdragon 8 Elite", SocNames.name("QTI SM8750P", ""))
|
||||
assertNull(SocNames.name("SM89750", ""))
|
||||
assertNull(SocNames.name("SM8975-PRO", ""))
|
||||
assertNull(SocNames.name("Qualcomm SM8975", ""))
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.droiddeck.launcher.input
|
||||
|
||||
import android.view.InputDevice
|
||||
import android.view.KeyEvent
|
||||
import org.junit.Assert.*
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [34], manifest = Config.NONE)
|
||||
class GuestKeysTest {
|
||||
@Test fun hardwareEscapeBypassesBackMenuAndReachesGuestWithMatchingRelease() {
|
||||
val taps = mutableListOf<Boolean>()
|
||||
val menu = BackQamInput({}, taps::add)
|
||||
val guest = mutableListOf<Pair<Int, Boolean>>()
|
||||
for (action in listOf(KeyEvent.ACTION_DOWN, KeyEvent.ACTION_UP)) {
|
||||
val event = KeyEvent(10, 20, action, KeyEvent.KEYCODE_BACK, 0,
|
||||
KeyEvent.META_SHIFT_ON, 43, 1, 0, InputDevice.SOURCE_KEYBOARD)
|
||||
val normalized = GuestKeys.normalizeKeyboardEscape(event)
|
||||
assertEquals(KeyEvent.KEYCODE_ESCAPE, normalized.keyCode)
|
||||
assertEquals(event.action, normalized.action)
|
||||
assertEquals(event.metaState, normalized.metaState)
|
||||
assertEquals(event.deviceId, normalized.deviceId)
|
||||
assertEquals(event.scanCode, normalized.scanCode)
|
||||
assertEquals(event.source, normalized.source)
|
||||
assertFalse(menu.onKeyEvent(normalized, true))
|
||||
assertTrue(GuestKeys.send(normalized) { code, down -> guest += code to down })
|
||||
}
|
||||
assertEquals(listOf(1 to true, 1 to false), guest)
|
||||
assertTrue(taps.isEmpty())
|
||||
}
|
||||
|
||||
@Test fun navigationBackAndOtherPhysicalBackKeysAreUnchanged() {
|
||||
for (scan in listOf(0, 158)) {
|
||||
val event = KeyEvent(10, 20, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK,
|
||||
0, 0, 43, scan, 0, InputDevice.SOURCE_KEYBOARD)
|
||||
assertSame(event, GuestKeys.normalizeKeyboardEscape(event))
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun normalizedEscapePreservesRepeatAndCancellation() {
|
||||
val event = KeyEvent(10, 20, KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BACK,
|
||||
3, 0, 43, 1, KeyEvent.FLAG_CANCELED, InputDevice.SOURCE_KEYBOARD)
|
||||
val normalized = GuestKeys.normalizeKeyboardEscape(event)
|
||||
assertEquals(event.repeatCount, normalized.repeatCount)
|
||||
assertEquals(event.flags, normalized.flags)
|
||||
assertEquals(event.downTime, normalized.downTime)
|
||||
assertEquals(event.eventTime, normalized.eventTime)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.droiddeck.launcher.runtime
|
||||
|
||||
import android.content.Context
|
||||
import androidx.test.core.app.ApplicationProvider
|
||||
import com.droiddeck.launcher.core.DownloadSource
|
||||
import com.droiddeck.launcher.core.Downloader
|
||||
import java.net.ServerSocket
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [33])
|
||||
class DesktopLanguageIndexSourceTest {
|
||||
private val base = "https://github.com/Droid-Deck/desktop/releases/download/t/"
|
||||
private val tunnels = CopyOnWriteArrayList<String>()
|
||||
private lateinit var context: Context
|
||||
private lateinit var proxy: ServerSocket
|
||||
|
||||
@Before fun setUp() {
|
||||
proxy = ServerSocket(0)
|
||||
Thread {
|
||||
try {
|
||||
while (!proxy.isClosed) {
|
||||
proxy.accept().use { socket ->
|
||||
val line = socket.getInputStream().bufferedReader().readLine() ?: return@use
|
||||
tunnels += line.removePrefix("CONNECT ").substringBefore(':')
|
||||
socket.getOutputStream().write("HTTP/1.1 403 Forbidden\r\nContent-Length: 0\r\n\r\n".toByteArray())
|
||||
}
|
||||
}
|
||||
} catch (_: Exception) {
|
||||
}
|
||||
}.apply { isDaemon = true }.start()
|
||||
context = ApplicationProvider.getApplicationContext()
|
||||
DownloadSource.init(context)
|
||||
DownloadSource.setMode(context, DownloadSource.MODE_MIRROR)
|
||||
DownloadSource.setProxy(context, "127.0.0.1:${proxy.localPort}")
|
||||
}
|
||||
|
||||
@After fun tearDown() {
|
||||
DownloadSource.setMode(context, DownloadSource.MODE_AUTO)
|
||||
DownloadSource.setProxy(context, "")
|
||||
proxy.close()
|
||||
}
|
||||
|
||||
@Test fun mirrorModeWouldOtherwiseSendTheIndexThroughAMirror() {
|
||||
Downloader.downloadString(base + "desktop-kde.i18n.txt")
|
||||
assertTrue(tunnels.toString(), tunnels.any { host -> DownloadSource.MIRRORS.any { it.host == host } })
|
||||
}
|
||||
|
||||
@Test fun indexIsFetchedOnlyFromGithubInMirrorMode() {
|
||||
assertNull(DesktopLanguage.fetchIndex(base))
|
||||
assertEquals(listOf("github.com"), tunnels.toList())
|
||||
}
|
||||
}
|
||||
@@ -113,4 +113,18 @@ class GameStorageTest {
|
||||
SessionPrefs.setGameStorage(app, tmp.newFolder("plugged").path, "USB drive")
|
||||
assertFalse(GameStorage.disconnected(app))
|
||||
}
|
||||
|
||||
@Test fun onlyAVfatMountCountsAsFat32() {
|
||||
val mounts = """
|
||||
/dev/fuse /storage/emulated fuse rw 0 0
|
||||
/dev/block/vold/public:179,65 /mnt/media_rw/8C5A-1F23 vfat rw 0 0
|
||||
/dev/block/vold/public:8,1 /mnt/media_rw/1111-2222 exfat rw 0 0
|
||||
/dev/fuse /storage/8C5A-1F23 fuse rw 0 0
|
||||
""".trimIndent()
|
||||
assertTrue(GameStorage.isFat32("/storage/8C5A-1F23/Android/data/com.droiddeck.launcher/files/steam", mounts))
|
||||
assertTrue(GameStorage.isFat32("/mnt/media_rw/8C5A-1F23/Games", mounts))
|
||||
assertFalse(GameStorage.isFat32("/storage/1111-2222/Android/data/com.droiddeck.launcher/files/steam", mounts))
|
||||
assertFalse(GameStorage.isFat32("/storage/emulated/0/Android/data/com.droiddeck.launcher/files/steam", mounts))
|
||||
assertFalse(GameStorage.isFat32("/storage/8C5A-1F230/Games", mounts))
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ class GameThreadHintsTest {
|
||||
assertTrue(GameThreadHints.supported("CQ8725S"))
|
||||
assertTrue(GameThreadHints.supported("SM8750"))
|
||||
assertTrue(GameThreadHints.supported("QTI SM8750"))
|
||||
assertTrue(GameThreadHints.supported("QTI SM8750P"))
|
||||
assertFalse(GameThreadHints.supported("SM8650"))
|
||||
assertFalse(GameThreadHints.supported("SM8850"))
|
||||
assertFalse(GameThreadHints.supported(""))
|
||||
|
||||
@@ -76,6 +76,80 @@ class LoadingStateUpdateTest {
|
||||
assertEquals(LoadingState.Topic.DESKTOP, state.topic)
|
||||
}
|
||||
|
||||
@Test fun bootstrapperProgressWithThousandsSeparatorsIsRead() {
|
||||
val state = read("[2026-11-15 11:58:51] Downloading update (184,557 of 573,070 KB)...")
|
||||
assertEquals(32, state.percent)
|
||||
assertEquals("Downloading the Steam client update · 32%", state.step)
|
||||
}
|
||||
|
||||
@Test fun translatedBootstrapperProgressUsesItsPercentLine() {
|
||||
val state = read(
|
||||
"[2026-11-15 11:58:51] 正在下载更新 (已下载 184,557,共 573,070 KB)...",
|
||||
"[2026-11-15 11:58:51] Set status message: 正在下载更新 (已下载 184,557,共 573,070 KB)...",
|
||||
"[2026-11-15 11:58:51] Set percent complete: 32",
|
||||
)
|
||||
assertEquals(32, state.percent)
|
||||
assertEquals(LoadingState.Topic.STEAM, state.topic)
|
||||
assertTrue(state.readable)
|
||||
}
|
||||
|
||||
@Test fun anUnknownPercentDoesNotLookLikeProgress() {
|
||||
val state = read("[2026-11-15 11:53:37] Set percent complete: -1")
|
||||
assertEquals(-1, state.percent)
|
||||
}
|
||||
|
||||
@Test fun aVerificationOnlyPassKeepsTheScriptStep() {
|
||||
val state = read(
|
||||
"[2026-11-15 11:53:36] Set percent complete: 0",
|
||||
"[2026-11-15 11:53:37] Set percent complete: -1",
|
||||
"[2026-11-15 11:53:37] Verifying installation...",
|
||||
)
|
||||
assertEquals("starting the Steam client", state.step)
|
||||
assertEquals(-1, state.percent)
|
||||
}
|
||||
|
||||
@Test fun aPercentLineDoesNotReplaceApplyingInTheSameStep() {
|
||||
assertApplying(read("Extracting package...", "[2026-11-15 11:58:52] Set percent complete: 100"))
|
||||
}
|
||||
|
||||
@Test fun anUnknownPercentEndsAnEarlierPercent() {
|
||||
val state = read(
|
||||
"[2026-11-15 11:58:51] Set percent complete: 40",
|
||||
"[2026-11-15 11:58:52] Set percent complete: -1",
|
||||
)
|
||||
assertEquals("starting the Steam client", state.step)
|
||||
assertEquals(-1, state.percent)
|
||||
}
|
||||
|
||||
@Test fun aPercentLineCountsAgainAfterANewStep() {
|
||||
val state = read(
|
||||
"Installing update...",
|
||||
"== STEP 12:00:03 starting the Steam client",
|
||||
"[2026-11-15 11:58:51] Set percent complete: 40",
|
||||
)
|
||||
assertEquals(40, state.percent)
|
||||
}
|
||||
|
||||
@Test fun aPercentOutsideTheIntRangeIsIgnored() {
|
||||
val state = read(
|
||||
"[2026-11-15 11:58:51] Set percent complete: 40",
|
||||
"[2026-11-15 11:58:52] Set percent complete: 2147483648",
|
||||
)
|
||||
assertEquals(40, state.percent)
|
||||
}
|
||||
|
||||
@Test fun anUnknownPercentClearsTheDisplayedPercentAfterTheStepLeavesTheTail() {
|
||||
val context = RuntimeEnvironment.getApplication()
|
||||
val log = log("[2026-11-15 11:58:51] Set percent complete: 40")
|
||||
val state = LoadingState(context)
|
||||
state.update(context, log)
|
||||
assertEquals(40, state.percent)
|
||||
log.appendText("\n" + "Loading cached metrics\n".repeat(4096) + "[2026-11-15 11:58:52] Set percent complete: -1")
|
||||
state.update(context, log)
|
||||
assertEquals(-1, state.percent)
|
||||
assertEquals("starting the Steam client", state.step)
|
||||
}
|
||||
|
||||
@Test fun anExistingLoadingStateFollowsUpdatesAcrossPolls() {
|
||||
val context = RuntimeEnvironment.getApplication()
|
||||
val log = log("Downloading update (100 of 100 KB)")
|
||||
|
||||
@@ -48,6 +48,15 @@ class CloudPlanTest {
|
||||
assertEquals(listOf("s"), CloudPlan.up(mapOf("s" to Local("c")), mapOf("s" to Remote("c", 9000)), base).same)
|
||||
}
|
||||
|
||||
@Test fun aSaveDeletedInTheCloudGoesUpOnlyOnceItChangesLocally() {
|
||||
val base = mapOf("s" to Entry("a", "a", 1000), "t" to Entry("x", "x", 1000))
|
||||
val gone = setOf("s")
|
||||
val idle = CloudPlan.up(mapOf("s" to Local("a"), "t" to Local("y"), "n" to Local("new")), mapOf("t" to Remote("x", 1000)), base, gone)
|
||||
assertEquals(setOf("t", "n"), idle.transfer.toSet())
|
||||
assertEquals(listOf("s"), CloudPlan.up(mapOf("s" to Local("b")), emptyMap(), base, gone).transfer)
|
||||
assertEquals(listOf("s"), CloudPlan.up(mapOf("s" to Local("a")), emptyMap(), base).transfer)
|
||||
}
|
||||
|
||||
@Test fun timesAloneDecideWhenTheServiceGivesNoHash() {
|
||||
val base = mapOf("s" to Entry("a", null, 1000))
|
||||
assertEquals(listOf("s"), CloudPlan.down(mapOf("s" to Local("a")), mapOf("s" to Remote(null, 60_000)), base).transfer)
|
||||
|
||||
@@ -25,7 +25,9 @@ class CloudSavesTest {
|
||||
val puts = ArrayList<String>()
|
||||
var onGet: (CloudFile) -> Unit = {}
|
||||
var raceAfter = Int.MAX_VALUE
|
||||
override fun list() = files.map { (k, v) -> CloudFile(k, v.second, CloudSaves.md5(v.first)) }
|
||||
val gone = HashSet<String>()
|
||||
override fun deleted(file: CloudFile) = file.md5 == GOG_DELETED_MD5
|
||||
override fun list() = files.map { (k, v) -> CloudFile(k, v.second, CloudSaves.md5(v.first)) } + gone.map { CloudFile(it, 5000L, GOG_DELETED_MD5) }
|
||||
override fun get(file: CloudFile) = files.getValue(file.name).also { onGet(file) }
|
||||
override fun put(files: Map<String, ByteArray>, modifiedMs: Map<String, Long>): Map<String, Long> {
|
||||
val sent = LinkedHashMap<String, Long>()
|
||||
@@ -40,6 +42,40 @@ class CloudSavesTest {
|
||||
private fun dir() = File(app.filesDir, "saves-${System.nanoTime()}").apply { mkdirs() }
|
||||
private val id get() = "g${System.nanoTime()}"
|
||||
|
||||
@Test fun savesTheCloudMarksDeletedAreNotDownloaded() {
|
||||
val dir = dir()
|
||||
val cloud = Memory().apply {
|
||||
files["save1.ess"] = "kept".toByteArray() to 1000L
|
||||
gone += listOf("save2.ess", "save3.ess", "save3.skse")
|
||||
}
|
||||
val r = CloudSaves.downWith(app, Store.GOG, id, dir, cloud, force = true)
|
||||
assertEquals("ok", r.result); assertEquals(1, r.files)
|
||||
assertEquals(listOf("save1.ess"), dir.list()!!.sorted())
|
||||
}
|
||||
|
||||
@Test fun aLocalSaveTheCloudMarksDeletedIsLeftAlone() {
|
||||
val dir = dir(); File(dir, "save2.ess").writeText("mine")
|
||||
val cloud = Memory().apply { files["save1.ess"] = "kept".toByteArray() to 1000L; gone += "save2.ess" }
|
||||
assertEquals("ok", CloudSaves.downWith(app, Store.GOG, id, dir, cloud, force = false).result)
|
||||
assertEquals("mine", File(dir, "save2.ess").readText())
|
||||
assertEquals("kept", File(dir, "save1.ess").readText())
|
||||
}
|
||||
|
||||
@Test fun anUnchangedSaveDeletedInTheCloudIsNotSentBackButANewerOneIs() {
|
||||
val game = id; val dir = dir()
|
||||
val cloud = Memory().apply { files["save1.ess"] = "a".toByteArray() to 1000L; files["save2.ess"] = "b".toByteArray() to 1000L }
|
||||
assertEquals("ok", CloudSaves.downWith(app, Store.GOG, game, dir, cloud, force = false).result)
|
||||
cloud.files.remove("save2.ess"); cloud.gone += "save2.ess"
|
||||
val idle = CloudSaves.upWith(app, Store.GOG, game, dir, cloud, force = false)
|
||||
assertEquals("up-to-date", idle.reason)
|
||||
assertTrue(cloud.puts.isEmpty())
|
||||
File(dir, "save2.ess").writeText("b played again")
|
||||
val r = CloudSaves.upWith(app, Store.GOG, game, dir, cloud, force = false)
|
||||
assertEquals(listOf("save2.ess"), cloud.puts)
|
||||
assertEquals("b played again", String(cloud.files.getValue("save2.ess").first))
|
||||
assertEquals(1, r.files)
|
||||
}
|
||||
|
||||
@Test fun anUploadBeforeAnyDownloadIsRefused() {
|
||||
val dir = dir(); File(dir, "slot0.sav").writeText("fresh profile")
|
||||
val cloud = Memory().apply { files["slot0.sav"] = "real save".toByteArray() to 1000L }
|
||||
|
||||
@@ -8,7 +8,12 @@ import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [33])
|
||||
class GogCloudKeysTest {
|
||||
@Test fun defaultLocationIsStrippedLikeAnyNamedLocation() {
|
||||
val files = listOf(CloudFile("__default/savegame0.sav", 1L), CloudFile("saves/slot0.sav", 2L))
|
||||
@@ -183,6 +188,24 @@ class GogCloudKeysTest {
|
||||
requests.forEach { assertEquals("Bearer token", it.headers["authorization"]) }
|
||||
}
|
||||
|
||||
@Test fun listAsksForJsonAndCarriesGalaxyDeletionMarks() {
|
||||
val body = "[{\"name\":\"saves/save1.ess\",\"hash\":\"0123456789abcdef0123456789abcdef\",\"last_modified\":\"2026-11-17T22:58:55.038000+00:00\"}," +
|
||||
"{\"name\":\"saves/save2.ess\",\"hash\":\"$GOG_DELETED_MD5\",\"last_modified\":\"2026-11-17T22:59:00+00:00\"}]"
|
||||
lateinit var files: List<CloudFile>
|
||||
lateinit var cloud: GogCloud
|
||||
val requests = serve(1, { "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\nContent-Length: ${body.length}\r\nConnection: close\r\n\r\n$body" }) { url ->
|
||||
cloud = GogCloud("user", "client", "token", "saves", url)
|
||||
files = cloud.list()
|
||||
}
|
||||
assertEquals("application/json", requests.single().headers["accept"])
|
||||
assertEquals(listOf("save1.ess", "save2.ess"), files.map { it.name })
|
||||
assertEquals("0123456789abcdef0123456789abcdef", files[0].md5)
|
||||
assertEquals(1_794_956_335_038L, files[0].modifiedMs)
|
||||
assertFalse(cloud.deleted(files[0]))
|
||||
assertTrue(cloud.deleted(files[1]))
|
||||
assertFalse(cloud.deleted(CloudFile("save3.ess", 1L)))
|
||||
}
|
||||
|
||||
@Test fun rejectedListKeepsTheServerErrorInTheDetail() {
|
||||
val body = "{\"error\":\"invalid_version\",\"error_description\":\"not supported with this version\"}"
|
||||
val failure = runCatching {
|
||||
|
||||
@@ -291,6 +291,58 @@ class GogMaintenanceTest {
|
||||
assertEquals("patch_(52404)+special.exe", GogContent.downloadFilename("https://example.invalid/patch_%2852404%29+special.exe?token=temporary"))
|
||||
}
|
||||
|
||||
private fun overlaySnapshot(base: JSONArray, dlc: JSONArray, owned: Set<String> = setOf("2")): GogInstallRecord {
|
||||
val manifest = JSONObject().put("depots", JSONArray().put(JSONObject().put("productId", "1")
|
||||
.put("languages", JSONArray().put("*")).put("files", base).put("items", base)).put(JSONObject().put("productId", "2")
|
||||
.put("languages", JSONArray().put("*")).put("files", dlc).put("items", dlc)))
|
||||
return GogContent.snapshot(GogInstallRecord("1", "depot"), GogBuild("build", "", 2, "", "https://example.invalid/manifest"),
|
||||
"unused", ownership = { owned }, metadata = { _, _ -> manifest })
|
||||
}
|
||||
|
||||
@Test fun generationTwoOwnedDepotOverlaysReplaceExactPathsBeforeValidation() {
|
||||
val fixture = JSONObject(javaClass.classLoader!!.getResource("gog/gen2-overlay-excerpt.json")!!.readText())
|
||||
val base = fixture.getJSONArray("base")
|
||||
val dlc = fixture.getJSONArray("dlc")
|
||||
base.put(JSONObject().put("path", "unique.bin").put("type", "DepotFile").put("chunks", JSONArray()))
|
||||
val snapshot = overlaySnapshot(base, dlc)
|
||||
assertEquals(3, snapshot.files.length())
|
||||
assertEquals(listOf("gog.dat", "gog.idx", "unique.bin"), snapshot.files.objects().map { it.getString("path") })
|
||||
for (i in 0..1) {
|
||||
val file = snapshot.files.getJSONObject(i)
|
||||
assertEquals("2", file.getString("product"))
|
||||
assertEquals(dlc.getJSONObject(i).getJSONArray("chunks").toString(), file.getJSONArray("chunks").toString())
|
||||
assertEquals(dlc.getJSONObject(i).getJSONArray("chunks").getJSONObject(0).getLong("size"), file.getLong("size"))
|
||||
}
|
||||
assertEquals("1", snapshot.files.getJSONObject(2).getString("product"))
|
||||
GogFiles.validate(snapshot.files, temporary.newFolder())
|
||||
val baseOnly = overlaySnapshot(base, dlc, emptySet())
|
||||
assertEquals(base.getJSONObject(0).getJSONArray("chunks").toString(), baseOnly.files.getJSONObject(0).getJSONArray("chunks").toString())
|
||||
assertTrue(baseOnly.files.objects().all { it.getString("product") == "1" })
|
||||
GogFiles.validate(baseOnly.files, temporary.newFolder())
|
||||
}
|
||||
|
||||
@Test fun overlaysDoNotHideCaseAliasesTraversalLinksOrPathTypeChanges() {
|
||||
fun entry(path: String, type: String = "DepotFile") = JSONObject().put("path", path).put("type", type)
|
||||
for (path in listOf("game.bin", "../Game.bin", "Data/../Game.bin", ".droiddeck-store.json")) {
|
||||
val snapshot = overlaySnapshot(JSONArray().put(entry("Game.bin")), JSONArray().put(entry(path)))
|
||||
assertThrows(IllegalArgumentException::class.java) { GogFiles.validate(snapshot.files, temporary.newFolder()) }
|
||||
}
|
||||
assertThrows(IllegalArgumentException::class.java) {
|
||||
overlaySnapshot(JSONArray().put(entry("Game.bin")), JSONArray().put(entry("Game.bin", "DepotDirectory")))
|
||||
}
|
||||
assertThrows(IllegalStateException::class.java) {
|
||||
overlaySnapshot(JSONArray().put(entry("Game.bin")), JSONArray().put(entry("Game.bin", "DepotLink")))
|
||||
}
|
||||
val identical = JSONArray().put(entry("Game.bin"))
|
||||
assertEquals(1, overlaySnapshot(identical, identical).files.length())
|
||||
val directories = JSONArray().put(entry("Data", "DepotDirectory"))
|
||||
val merged = overlaySnapshot(directories, JSONArray().put(entry("Data", "DepotDirectory")).put(entry("Data/game.bin")))
|
||||
assertEquals(2, merged.files.length())
|
||||
GogFiles.validate(merged.files, temporary.newFolder())
|
||||
val aliases = overlaySnapshot(JSONArray().put(entry("Data/a")), JSONArray().put(entry("data/b")))
|
||||
assertThrows(IllegalArgumentException::class.java) { GogFiles.validate(aliases.files, temporary.newFolder()) }
|
||||
}
|
||||
|
||||
@Test fun pathsRejectTraversalSymlinksCaseCollisionsAndMetadataOverlap() {
|
||||
val folder = temporary.newFolder()
|
||||
for (path in listOf("../escape", "/absolute", "C:/file", "a/./file", "a//file")) {
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"base": [
|
||||
{
|
||||
"path": "gog.dat",
|
||||
"chunks": [
|
||||
{
|
||||
"md5": "63b62221caca352670bec591f0e4ed7a",
|
||||
"size": 65664,
|
||||
"compressedMd5": "c5695c2838aa020b028334cda81c89e6",
|
||||
"compressedSize": 34046
|
||||
}
|
||||
],
|
||||
"type": "DepotFile"
|
||||
},
|
||||
{
|
||||
"path": "gog.idx",
|
||||
"chunks": [
|
||||
{
|
||||
"md5": "0a1f9d90b61039cb3f4f2952f47aeea7",
|
||||
"size": 28,
|
||||
"compressedMd5": "7a7f3c3d18c10a3890426ed3f11f6220",
|
||||
"compressedSize": 24
|
||||
}
|
||||
],
|
||||
"type": "DepotFile",
|
||||
"sfcRef": {
|
||||
"offset": 11,
|
||||
"size": 28
|
||||
}
|
||||
}
|
||||
],
|
||||
"dlc": [
|
||||
{
|
||||
"path": "gog.dat",
|
||||
"chunks": [
|
||||
{
|
||||
"md5": "dac36aea47f5de743d0e0ca10c79ad58",
|
||||
"size": 16777344,
|
||||
"compressedMd5": "a27cd9af6e5183a6392c25c973fc367c",
|
||||
"compressedSize": 3992002
|
||||
}
|
||||
],
|
||||
"type": "DepotFile"
|
||||
},
|
||||
{
|
||||
"path": "gog.idx",
|
||||
"chunks": [
|
||||
{
|
||||
"md5": "ae818b813bd3585c47846cf1e288b2e5",
|
||||
"size": 28,
|
||||
"compressedMd5": "869fd5dd8c9ad554ca8bccb0317a9757",
|
||||
"compressedSize": 26
|
||||
}
|
||||
],
|
||||
"type": "DepotFile"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -197,6 +197,13 @@ The appid Steam derives (CRC32 of the quoted exe plus the name, high bit set) is
|
||||
listing carries, so the live add and the writer never disagree. Uninstall removes the folder and the
|
||||
listing drops the entry; the live client is asked to remove it too.
|
||||
|
||||
`droiddeck-steam-shortcuts` merges each entry against the one Steam holds: a Target or Start In
|
||||
edited in Steam survives the client's restart. A target whose file is gone is not an edit to keep -
|
||||
it can only fail before the game starts - so the listing's exe replaces it, checked in the guest
|
||||
where the shortcut's paths live, as long as the folder holding it exists (a missing folder can be an
|
||||
unmounted card). #694 was a hand-typed Target that outlived the game update that removed its file,
|
||||
so every launch died with Wine's `Failed to create process ...: 2` before the game ran.
|
||||
|
||||
`Library.SteamGame.source` is `steam`, `gog`, `epic`, `amazon` or `added`; the Library shows it as
|
||||
a chip on every tile and in the hero, and filters by it.
|
||||
|
||||
|
||||
@@ -240,3 +240,65 @@ extended gameplay stability need hardware validation. One successful view/motion
|
||||
check does not establish long-session stability. Users must select Follow mode and disable the glasses' own
|
||||
stabilization. Factory calibration and XREAL Eye/6DoF are not implemented.
|
||||
One Pro is not enabled or claimed as tested.
|
||||
|
||||
## Native 1 Pro+ implementation and hardware validation — 2026-11-13
|
||||
|
||||
The attached device identifies as USB `3318:0444`, product `XREAL 1 Pro+`. This exact
|
||||
identity enables the experimental 1 Pro+ profile alongside the existing 1S profile.
|
||||
The [official specifications](https://tutorials.xreal.com/docs/glasses/pro-plus/specifications/)
|
||||
give 1920×1080 per eye and a 57° diagonal field of view. The direct Kotlin driver
|
||||
uses the USB-Ethernet control and IMU services; it requires no XREAL SDK or
|
||||
ControlGlasses installation and includes no vendor SDK binaries or headers.
|
||||
|
||||
Verified on the connected phone and glasses:
|
||||
|
||||
| Observation | Result |
|
||||
| --- | --- |
|
||||
| Control and IMU transport | Individually bound Android Ethernet sockets reach `169.254.2.1:52999` and `:52998` without replacing the default Internet network. |
|
||||
| Native display | `GET_DISPLAY` (`0x275e`) returns **9**, with Android reporting **1920×1080 at 60 Hz**. This profile preserves mode 9 for native 60 Hz instead of the 1S's mode 29. |
|
||||
| Legacy 60 Hz command | Setting mode **2** is rejected with status **10001**. A rejected command does not count as a successful display switch. |
|
||||
| Higher refresh commands | Setting modes **3** and **4** through DroidDeck selects physical **1920×1080 at 90/120 Hz**, confirmed through Android's active display mode. |
|
||||
| Full SBS | `SET_INPUT` (`0x2822`) with value **1** settles at display mode **5** and Android **3840×1080 at 60 Hz**. Value **0** restores native mode **9**; DroidDeck then restores the saved 90 Hz preference. Tracking resumed after both switches. |
|
||||
| IMU | Type **11** raw sensor reports arrive at approximately **1,000 Hz**, using the existing 128-byte body layout. |
|
||||
|
||||
Mode 9 is an observed native display configuration, not a general mapping from
|
||||
EDID number to the physical refresh rate selected by every host. The older
|
||||
[xr-tools enum](https://github.com/0xcaff/xr-tools/blob/main/packages/xreal_one_driver/src/proto/net/dp_get_current_edid_dsp.rs)
|
||||
contains only modes 2–5. The independent
|
||||
[one-xr investigation](https://github.com/Skarian/one-xr/blob/main/docs/UNRESOLVED.md)
|
||||
also records mode 9 and mode-2 rejection status 10001 on other firmware. This
|
||||
supports keeping display mappings per model and confirming output through Android.
|
||||
|
||||
The Pro+ profile applies a nominal **+35° rotation around X** to both gyro and
|
||||
acceleration before fusion, inverting the factory display-to-IMU mounting
|
||||
direction. Directed wearer captures separately establish the sign: horizontal
|
||||
turns primarily rotate around corrected Y, and shoulder tilts around corrected Z.
|
||||
The initial opposite-sign correction mixed these axes; a stationary capture alone
|
||||
could not distinguish sensor mounting from the physical angle of the glasses.
|
||||
This is a model mounting correction, not individually calibrated tracking. Device
|
||||
calibration data and serial numbers are not stored in the repository. After the
|
||||
corrected build was installed, the wearer confirmed all three rotation directions
|
||||
and the horizon were correct. The existing 1S mapping stays unchanged.
|
||||
|
||||
The initial APK build and 621 targeted glasses/UI tests completed with zero failures
|
||||
and one skipped test. After correcting the mounting direction, all 73 focused
|
||||
XREAL/routing tests passed, including a regression using the measured movement
|
||||
axes. Native dependency checks passed and the APK contains no vendor
|
||||
SDK libraries. On this phone, background network restrictions interrupted the
|
||||
glasses sockets while DroidDeck was away from the foreground; foreground operation
|
||||
recovered. Sustained background use needs separate validation.
|
||||
|
||||
Brightness remains limited to the known protocol values **0–9**. XREAL's
|
||||
[display guide](https://tutorials.xreal.com/docs/glasses/pro-plus/display-sound/)
|
||||
documents 14 physical levels in Follow mode with Stabilizer off and 10 in Anchor
|
||||
or Spatial Anchor. Those counts do not establish a 0–13 direct-protocol range.
|
||||
The wearer confirmed that DroidDeck's brightness and dimming controls work on the
|
||||
Pro+. The wider brightness API mapping remains unverified.
|
||||
|
||||
Use **Follow** with **Stabilizer off** in the glasses' own menu before using
|
||||
DroidDeck tracking, following the official
|
||||
[display-mode](https://tutorials.xreal.com/docs/glasses/pro-plus/spatial-screen/display-modes/)
|
||||
and [Stabilizer](https://tutorials.xreal.com/docs/glasses/pro-plus/spatial-screen/stabilizer-transparency/)
|
||||
descriptions. The built-in tracking must not be layered over host tracking.
|
||||
XREAL Eye, camera capture, and 6DoF are not implemented. Long-session stability
|
||||
remains an outstanding hardware check.
|
||||
@@ -22,7 +22,7 @@ This describes the integrations implemented in DroidDeck as of 2026-10-24. A rec
|
||||
| **VITURE Luma Ultra** | SDK-dependent Carina transport | Yes | **Experimental, opt-in** | **Experimental, opt-in** |
|
||||
| Recognized RayNeo / TCL Air-series devices | Integrated RayNeo USB transport | Yes, with orientation calibration controls | No | No |
|
||||
| RayNeo GT-series devices matching the supported USB identity, including GT Max identification | Integrated GT USB/IMU path | Yes, with orientation calibration controls | No | No |
|
||||
| **XREAL 1S, One, One Pro, One Pro+, Aura** | **Experimental**; exact USB identity plus the device's USB-Ethernet control/IMU connection. Head tracking and 2D/3D switching are tested on the Aura | Yes, when that connection is ready | No | No |
|
||||
| **XREAL 1S, One, One Pro, One Pro+, Aura** | **Experimental**; exact USB identity plus the device's USB-Ethernet control/IMU connection. Head tracking and 2D/3D switching are tested on the Aura and One Pro+ | Yes, when that connection is ready | No | No |
|
||||
| Rokid Max / Max 2; Rokid Air under the Max USB identity | Integrated Rokid USB transport (vendor control requests and HID IMU reports) | Yes | No | No |
|
||||
| Other XREAL models (Air family and others); unrecognized glasses; display adapters and docks | Display-only where Android exposes a usable display; automatic glasses routing also requires display recognition | No supported app tracking connection | No | No |
|
||||
|
||||
@@ -43,7 +43,8 @@ All display modes depend on the phone's video output, the cable/adapter, and And
|
||||
| VITURE Pro 2 | 1080p per eye; 2D and SBS | Brightness and volume; no electrochromic-film control |
|
||||
| RayNeo Air/GT | 2D/SBS switching; resolution and refresh follow available Android modes | Orientation calibration; no app brightness, volume, or dimming commands |
|
||||
| XREAL 1S | Supported 1S display-mode commands, including native 1200p/60 Hz and SBS | Brightness and dimming toggle; no app volume command |
|
||||
| XREAL One, One Pro, One Pro+, Aura | 2D and SBS only, switched with the glasses' 3D input command; the display-mode set command is never sent (an unexpected index reboots the Aura) | No app brightness, dimming or volume commands |
|
||||
| XREAL One Pro+ | Verified 1920×1080 at 60/90/120 Hz; 3840×1080 SBS at 60 Hz. Native 60 Hz uses mode 9; 1S-only modes 2/29 are rejected | Brightness 0–9 and dimming toggle verified; no app volume command |
|
||||
| XREAL One, One Pro, Aura | 2D and SBS only, switched with the glasses' 3D input command; the display-mode set command is never sent (an unexpected index reboots the Aura) | No app brightness, dimming or volume commands |
|
||||
| Rokid Max / Max 2 | 1080p at 60 or 120 Hz in 2D; SBS at 1080p/60, 1200p/60, or 1200p/90 | Brightness; volume follows Android's USB audio volume; no dimming film |
|
||||
| Rokid Air | 1080p/60 in 2D and SBS | Brightness; volume follows Android's USB audio volume |
|
||||
|
||||
@@ -55,6 +56,8 @@ With **game on glasses** the compositor draws the guest pointer into its own sce
|
||||
|
||||
The pointer is left out of the picture when it cannot be drawn where the game is: while a game holds the pointer lock (it draws its own), and for a game the compositor cannot import — an AHardwareBuffer-only surface, or HDR frames it has no texture for. Those games stay on their own display layer, because composing the scene would drop the game itself. An importable HDR game that would otherwise stay on its own layer is composed through the screen swapchain, so there the pointer does fit.
|
||||
|
||||
The One Pro+ uses a verified sensor mounting correction for both gyro and acceleration. The wearer confirmed all three tracking axes, a level horizon, brightness and dimming on a Fold7. Use Follow mode with Stabilizer off. These checks do not establish long-session stability; see the [hardware validation](development/xreal-investigation.md#native-1-pro-implementation-and-hardware-validation--2026-11-13).
|
||||
|
||||
## Setup and app-wide behavior
|
||||
|
||||
1. Connect the glasses through a compatible video/data connection. Accept USB access when requested. For XREAL 1S, One, One Pro, One Pro+ and Aura, Android must also expose the glasses' USB-Ethernet network; the app leaves Steam's Internet connection on its normal network.
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
diff --git a/Source/Tools/FEXInterpreter/FEXInterpreter.cpp b/Source/Tools/FEXInterpreter/FEXInterpreter.cpp
|
||||
index 2881ad9..abc84f3 100644
|
||||
--- a/Source/Tools/FEXInterpreter/FEXInterpreter.cpp
|
||||
+++ b/Source/Tools/FEXInterpreter/FEXInterpreter.cpp
|
||||
@@ -518,7 +518,7 @@ int main(int argc, char** argv, char** const envp) {
|
||||
FEXCore::Config::Set(FEXCore::Config::CONFIG_APP_CONFIG_NAME, Program.ProgramName);
|
||||
} else {
|
||||
// Anonymous program.
|
||||
- FEXCore::Config::Set(FEXCore::Config::CONFIG_APP_FILENAME, "<Anonymous>");
|
||||
+ FEXCore::Config::Set(FEXCore::Config::CONFIG_APP_FILENAME, Program.ProgramPath);
|
||||
FEXCore::Config::Set(FEXCore::Config::CONFIG_APP_CONFIG_NAME, "<Anonymous>");
|
||||
}
|
||||
} else {
|
||||
diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls.cpp
|
||||
index a7a432b..4a77d87 100644
|
||||
--- a/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls.cpp
|
||||
+++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls.cpp
|
||||
@@ -441,7 +441,7 @@ uint64_t ExecveHandler(FEXCore::Core::CpuStateFrame* Frame, const char* pathname
|
||||
if (*OldArgv) {
|
||||
// The direct fallback uses the executable path as argv[0]. An FD-backed load uses the
|
||||
// binfmt preserve-argv0 layout, so the caller-supplied argv[0] has to stay in the vector.
|
||||
- if (!NeedsLoaderFD) {
|
||||
+ if (!NeedsLoaderFD && !IsFDExec) {
|
||||
++OldArgv;
|
||||
}
|
||||
while (*OldArgv) {
|
||||
@@ -0,0 +1,18 @@
|
||||
diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls/Passthrough.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls/Passthrough.cpp
|
||||
index e287cd2..2181667 100644
|
||||
--- a/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls/Passthrough.cpp
|
||||
+++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls/Passthrough.cpp
|
||||
@@ -469,10 +469,10 @@ namespace x64 {
|
||||
REGISTER_SYSCALL_IMPL_X64(setitimer, SyscallPassthrough3<SYSCALL_DEF(setitimer)>);
|
||||
REGISTER_SYSCALL_IMPL_X64(sendfile, SyscallPassthrough4<SYSCALL_DEF(sendfile)>);
|
||||
REGISTER_SYSCALL_IMPL_X64(accept, SyscallPassthrough3<SYSCALL_DEF(accept)>);
|
||||
- REGISTER_SYSCALL_IMPL_X64(sendmsg, SyscallPassthrough3<SYSCALL_DEF(sendmsg)>);
|
||||
- REGISTER_SYSCALL_IMPL_X64(recvmsg, SyscallPassthrough3<SYSCALL_DEF(recvmsg)>);
|
||||
+ REGISTER_SYSCALL_IMPL_X64(sendmsg, SyscallPathPassthrough3<SYSCALL_DEF(sendmsg)>);
|
||||
+ REGISTER_SYSCALL_IMPL_X64(recvmsg, SyscallPathPassthrough3<SYSCALL_DEF(recvmsg)>);
|
||||
REGISTER_SYSCALL_IMPL_X64(setsockopt, SyscallPassthrough5<SYSCALL_DEF(setsockopt)>);
|
||||
- REGISTER_SYSCALL_IMPL_X64(getsockopt, SyscallPassthrough5<SYSCALL_DEF(getsockopt)>);
|
||||
+ REGISTER_SYSCALL_IMPL_X64(getsockopt, SyscallPathPassthrough5<SYSCALL_DEF(getsockopt)>);
|
||||
REGISTER_SYSCALL_IMPL_X64(wait4, SyscallPassthrough4<SYSCALL_DEF(wait4)>);
|
||||
REGISTER_SYSCALL_IMPL_X64(semop, SyscallPassthrough3<SYSCALL_DEF(semop)>);
|
||||
REGISTER_SYSCALL_IMPL_X64(getrlimit, SyscallPassthrough2<SYSCALL_DEF(getrlimit)>);
|
||||
@@ -115,6 +115,9 @@ fi
|
||||
if [ "$(cat /usr/share/droiddeck/kwin-compositor 2>/dev/null)" = opengl ]; then
|
||||
unset LIBGL_ALWAYS_SOFTWARE QT_QUICK_BACKEND
|
||||
export KWIN_COMPOSE=O2 MESA_LOADER_DRIVER_OVERRIDE=zink GALLIUM_DRIVER=zink LIBGL_KOPPER_DRI2=true
|
||||
# On the system PowerVR driver, Firefox's hardware WebRender on zink leaves stale, half-drawn
|
||||
# frames; its software renderer draws correctly.
|
||||
[ "${DD_STEAM_GL_PRESENT:-}" = 1 ] && export MOZ_ACCELERATED=0
|
||||
if [ -z "${KWIN_RENDER_NODES:-}" ]; then
|
||||
for node in /dev/dri/renderD0 /dev/dri/renderD307 /dev/dri/renderD*; do
|
||||
if [ -c "$node" ]; then export KWIN_RENDER_NODES="$node"; break; fi
|
||||
|
||||
@@ -164,6 +164,12 @@ def ff7_rebirth_feature_level(game):
|
||||
return {"VKD3D_FEATURE_LEVEL": "12_2"}, [], "Final Fantasy VII Rebirth: D3D12 feature level 12_2 (the device-reported level fails its DX12 check)"
|
||||
|
||||
|
||||
@fix
|
||||
def hades2_feature_level(game):
|
||||
if game.stem == "hades2":
|
||||
return {"VKD3D_FEATURE_LEVEL": "12_2"}, [], "Hades II: D3D12 feature level 12_2 (on Adreno 6xx/7xx it finds no D3D12 adapter at the detected level)"
|
||||
|
||||
|
||||
@fix
|
||||
def kcd2_feature_level(game):
|
||||
if game.app_id == "1771300":
|
||||
|
||||
@@ -61,6 +61,35 @@ def content_binds(name, meta, env):
|
||||
return out
|
||||
|
||||
|
||||
def outside(path, mounted):
|
||||
for source, target in sorted(mounted, key=lambda m: len(m[1]), reverse=True):
|
||||
if path == target or path.startswith(target + "/"):
|
||||
return source + path[len(target):]
|
||||
return path
|
||||
|
||||
|
||||
def layout_args(meta, env, mounted):
|
||||
out = []
|
||||
writable = tuple(env[k] + "/" for k in ("SNAP_DATA", "SNAP_COMMON"))
|
||||
layout = [(p, e) for p, e in (meta.get("layout") or {}).items() if isinstance(e, dict)]
|
||||
for path, entry in sorted(layout, key=lambda item: ("symlink" in item[1], item[0])):
|
||||
dest = os.path.normpath(expand(path, env))
|
||||
if "symlink" in entry:
|
||||
out += ["--symlink", os.path.normpath(expand(entry["symlink"], env)), dest]
|
||||
elif entry.get("type") == "tmpfs":
|
||||
out += ["--tmpfs", dest]
|
||||
elif "bind" in entry or "bind-file" in entry:
|
||||
source = os.path.normpath(expand(entry.get("bind") or entry.get("bind-file"), env))
|
||||
if source.startswith(writable) and not os.path.exists(source):
|
||||
if "bind" in entry:
|
||||
os.makedirs(source, exist_ok=True)
|
||||
else:
|
||||
os.makedirs(os.path.dirname(source), exist_ok=True)
|
||||
open(source, "a").close()
|
||||
out += ["--bind", outside(source, mounted), dest]
|
||||
return out
|
||||
|
||||
|
||||
def game_gpu(env, snap):
|
||||
try:
|
||||
game_env = runpy.run_path(os.path.join(BIN_DIR, "droiddeck-game-env"))
|
||||
@@ -133,9 +162,10 @@ def main(argv):
|
||||
bwrap += ["--bind", "/", "/var/lib/snapd/hostfs"]
|
||||
bwrap += ["--bind", "/dev/null", "/etc/ld.so.preload"]
|
||||
binds = content_binds(name, meta, env)
|
||||
for _, source, target in binds:
|
||||
if os.path.isdir(source):
|
||||
bwrap += ["--bind", source, target]
|
||||
mounted = [(source, target) for _, source, target in binds if os.path.isdir(source)]
|
||||
for source, target in mounted:
|
||||
bwrap += ["--bind", source, target]
|
||||
bwrap += layout_args(meta, env, mounted)
|
||||
content = {k for k, v in (meta.get("plugs") or {}).items() if isinstance(v, dict) and v.get("interface") == "content"}
|
||||
plugs = (set(meta.get("plugs") or {}) | set(spec.get("plugs") or [])) - content | {plug for plug, _, _ in binds}
|
||||
env["DROIDDECK_SNAP_PLUGS"] = " ".join(sorted(plugs))
|
||||
|
||||
@@ -125,6 +125,14 @@ RECORD = ".droiddeck-shortcuts.json"
|
||||
AWAY_LIMIT = 256
|
||||
FIELDS = ("AppName", "Exe", "StartDir", "icon", "LaunchOptions")
|
||||
FOLLOWED = ("StartDir", "LaunchOptions")
|
||||
# Guest mountpoints whose contents live on storage the user can unplug. The app creates
|
||||
# the mountpoint before binding it, so it outlives a removed card; libraries, store
|
||||
# volumes and added game folders get one mountpoint each under these families.
|
||||
REMOVABLE_ROOTS = ("/mnt/droiddeck-sd", "/mnt/bannerlator-sd")
|
||||
REMOVABLE_FAMILIES = ("/mnt/droiddeck-lib", "/mnt/droiddeck-stores", "/root/Games")
|
||||
# Guest trees the app always has, whatever storage is in the device. A target that is
|
||||
# missing from one of these is gone even when its whole folder was removed.
|
||||
INTERNAL_ROOTS = ("/root/Games/Stores", "/root/.local/share/Steam")
|
||||
|
||||
|
||||
def unquoted(value):
|
||||
@@ -146,6 +154,46 @@ def read_record(path):
|
||||
}
|
||||
|
||||
|
||||
def under(path, root):
|
||||
return path == root or path.startswith(root + "/")
|
||||
|
||||
|
||||
def internal_target(target):
|
||||
path = os.path.normpath(target)
|
||||
return any(under(path, root) for root in INTERNAL_ROOTS)
|
||||
|
||||
|
||||
def removable_mount(target):
|
||||
"""The guest mountpoint holding target, when it is storage the user can unplug."""
|
||||
path = os.path.normpath(target)
|
||||
for root in REMOVABLE_ROOTS:
|
||||
if under(path, root):
|
||||
return root
|
||||
for family in REMOVABLE_FAMILIES:
|
||||
prefix = family + "/"
|
||||
if path.startswith(prefix):
|
||||
return prefix + path[len(prefix):].split("/", 1)[0]
|
||||
return None
|
||||
|
||||
|
||||
def storage_mounted(target):
|
||||
"""Whether the storage holding target is there this session.
|
||||
|
||||
The app creates a guest mountpoint before binding storage to it, so a mountpoint that
|
||||
lists nothing is one a removed card or volume left behind. A target under it may work
|
||||
again when that storage returns, so its absence is not proof the file is gone.
|
||||
"""
|
||||
if internal_target(target):
|
||||
return True
|
||||
mount = removable_mount(target)
|
||||
if mount is None:
|
||||
return True
|
||||
try:
|
||||
return bool(os.listdir(mount))
|
||||
except OSError:
|
||||
return False
|
||||
|
||||
|
||||
def merge(fresh, current, state, seen):
|
||||
state = state if isinstance(state, dict) else {}
|
||||
rev = state.get("rev") if isinstance(state.get("rev"), int) else 0
|
||||
@@ -158,7 +206,16 @@ def merge(fresh, current, state, seen):
|
||||
entry = dict(current)
|
||||
entry["appid"] = fresh["appid"]
|
||||
exe = unquoted(fresh["Exe"])
|
||||
if exe != unquoted(current.get("Exe")) and (exe != unquoted(base.get("Exe")) or seen == rev):
|
||||
target = unquoted(current.get("Exe"))
|
||||
# A target Steam still points at after the file is gone starts nothing, so it is not
|
||||
# an edit to keep: the app's own exe replaces it (#694: a hand-typed Target outlived
|
||||
# the game update that removed the file, and every launch died before the game ran).
|
||||
# Only when its storage is mounted and it is missing from a tree the app always has or
|
||||
# from a folder that is still there. An absent folder under a mountpoint can equally be
|
||||
# unplugged storage, and that target may work again next session.
|
||||
gone = (bool(target) and not os.path.isfile(target) and storage_mounted(target) and
|
||||
(internal_target(target) or os.path.isdir(os.path.dirname(target))))
|
||||
if exe != target and (gone or exe != unquoted(base.get("Exe")) or seen == rev):
|
||||
entry["Exe"], entry["StartDir"] = fresh["Exe"], fresh["StartDir"]
|
||||
for field in ("AppName", "icon"):
|
||||
if current.get(field) == base.get(field):
|
||||
|
||||
@@ -9,17 +9,73 @@
|
||||
// Runs before every exec, mostly in a child a shell has just forked: the copies write only the
|
||||
// string (ddnatv_copy_cstr), not the whole PATH_MAX buffer, since each page written there is a
|
||||
// copy-on-write fault.
|
||||
static int follow_link(const char *path, char *target, size_t size) {
|
||||
ssize_t len = readlink(path, target, size - 1);
|
||||
if (len < 0) return 0;
|
||||
target[len] = '\0';
|
||||
// proot's link2symlink leaves hard links as ".l2s.*" files that programs must not see by name
|
||||
const char *base = strrchr(target, '/');
|
||||
return strncmp(base ? base + 1 : target, ".l2s.", 5) != 0;
|
||||
}
|
||||
|
||||
static void resolve_symlinks(const char *path, char *out, size_t out_size, int depth) {
|
||||
if (!path || !out || out_size == 0) return;
|
||||
ddnatv_copy_cstr(out, out_size, path);
|
||||
if (depth > 8) return;
|
||||
|
||||
char link_target[PATH_MAX];
|
||||
ssize_t len = readlink(path, link_target, sizeof(link_target) - 1);
|
||||
if (len < 0) return;
|
||||
link_target[len] = '\0';
|
||||
|
||||
char next_path[PATH_MAX];
|
||||
if (g_ddnatv_root_len > 0 && strncmp(path, g_ddnatv_root, g_ddnatv_root_len) == 0 && path[g_ddnatv_root_len] == '/') {
|
||||
char done[PATH_MAX];
|
||||
char todo[PATH_MAX];
|
||||
size_t used = ddnatv_append(done, sizeof(done), 0, g_ddnatv_root, g_ddnatv_root_len);
|
||||
ddnatv_copy_cstr(todo, sizeof(todo), path + g_ddnatv_root_len);
|
||||
int links = 0;
|
||||
char *rest = todo;
|
||||
while (*rest) {
|
||||
while (*rest == '/') rest++;
|
||||
if (!*rest) break;
|
||||
char *end = strchr(rest, '/');
|
||||
size_t n = end ? (size_t)(end - rest) : strlen(rest);
|
||||
if (n == 1 && rest[0] == '.') {
|
||||
rest += n;
|
||||
continue;
|
||||
}
|
||||
if (n == 2 && rest[0] == '.' && rest[1] == '.') {
|
||||
char *slash = strrchr(done + g_ddnatv_root_len, '/');
|
||||
if (slash) used = (size_t)(slash - done);
|
||||
done[used] = '\0';
|
||||
rest += n;
|
||||
continue;
|
||||
}
|
||||
size_t before = used;
|
||||
used = ddnatv_append(done, sizeof(done), used, "/", 1);
|
||||
used = ddnatv_append(done, sizeof(done), used, rest, n);
|
||||
rest += n;
|
||||
if (used >= sizeof(done) - 1) return;
|
||||
if (!follow_link(done, link_target, sizeof(link_target))) {
|
||||
struct stat st;
|
||||
if (rest[strspn(rest, "/")] && (syscall(SYS_newfstatat, AT_FDCWD, done, &st, 0) != 0 || !S_ISDIR(st.st_mode))) return;
|
||||
continue;
|
||||
}
|
||||
if (++links > 40) return;
|
||||
size_t m = ddnatv_append(next_path, sizeof(next_path), 0, link_target, strlen(link_target));
|
||||
m = ddnatv_append(next_path, sizeof(next_path), m, "/", 1);
|
||||
m = ddnatv_append(next_path, sizeof(next_path), m, rest, strlen(rest));
|
||||
if (m >= sizeof(next_path) - 1) return;
|
||||
if (link_target[0] == '/') {
|
||||
char rw_buf[PATH_MAX];
|
||||
resolve_symlinks(rewrite_path(next_path, rw_buf, sizeof(rw_buf)), out, out_size, depth + 1);
|
||||
return;
|
||||
}
|
||||
used = before;
|
||||
done[used] = '\0';
|
||||
ddnatv_copy_cstr(todo, sizeof(todo), next_path);
|
||||
rest = todo;
|
||||
}
|
||||
if (used > g_ddnatv_root_len) ddnatv_copy_cstr(out, out_size, done);
|
||||
return;
|
||||
}
|
||||
if (!follow_link(path, link_target, sizeof(link_target))) return;
|
||||
if (link_target[0] == '/') {
|
||||
char rw_buf[PATH_MAX];
|
||||
const char *rewritten = rewrite_path(link_target, rw_buf, sizeof(rw_buf));
|
||||
@@ -32,15 +88,11 @@ static void resolve_symlinks(const char *path, char *out, size_t out_size, int d
|
||||
memcpy(next_path, path, dir_len);
|
||||
next_path[dir_len] = '\0';
|
||||
size_t n = ddnatv_append(next_path, sizeof(next_path), dir_len, "/", 1);
|
||||
ddnatv_append(next_path, sizeof(next_path), n, link_target, (size_t)len);
|
||||
ddnatv_append(next_path, sizeof(next_path), n, link_target, strlen(link_target));
|
||||
} else {
|
||||
ddnatv_copy_cstr(next_path, sizeof(next_path), link_target);
|
||||
}
|
||||
}
|
||||
// proot's link2symlink leaves hard links as ".l2s.*" files that programs must not see by name
|
||||
const char *next_base = strrchr(next_path, '/');
|
||||
next_base = next_base ? next_base + 1 : next_path;
|
||||
if (strncmp(next_base, ".l2s.", 5) == 0) return;
|
||||
resolve_symlinks(next_path, out, out_size, depth + 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -418,6 +418,13 @@ int renameat2(int olddirfd, const char *oldpath, int newdirfd, const char *newpa
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t copy_readlink_result(char *buf, size_t bufsiz, const char *out, ssize_t ret) {
|
||||
if (ret <= 0 || out == buf) return ret;
|
||||
size_t n = (size_t)ret < bufsiz ? (size_t)ret : bufsiz;
|
||||
memcpy(buf, out, n);
|
||||
return (ssize_t)n;
|
||||
}
|
||||
|
||||
// Hook readlink
|
||||
ssize_t readlink(const char *pathname, char *buf, size_t bufsiz) {
|
||||
if (is_proc_self_exe(pathname)) {
|
||||
@@ -431,13 +438,16 @@ ssize_t readlink(const char *pathname, char *buf, size_t bufsiz) {
|
||||
if (!orig_readlink) orig_readlink = (ssize_t (*)(const char *, char *, size_t))dlsym(RTLD_NEXT, "readlink");
|
||||
char pbuf[PATH_MAX];
|
||||
const char *target = rewrite_path(pathname, pbuf, sizeof(pbuf));
|
||||
ssize_t ret = orig_readlink ? orig_readlink(target, buf, bufsiz) : -1;
|
||||
char whole[PATH_MAX];
|
||||
char *out = bufsiz && bufsiz < sizeof(whole) ? whole : buf;
|
||||
size_t outsiz = out == whole ? sizeof(whole) : bufsiz;
|
||||
ssize_t ret = orig_readlink ? orig_readlink(target, out, outsiz) : -1;
|
||||
if (ret < 0 && errno == ENOENT) {
|
||||
char alt[PATH_MAX];
|
||||
const char *retry = usrmerge_retry_path(target, alt, sizeof(alt));
|
||||
if (retry) ret = orig_readlink(retry, buf, bufsiz);
|
||||
if (retry) ret = orig_readlink(retry, out, outsiz);
|
||||
}
|
||||
return postprocess_readlink(pathname, buf, ret, bufsiz);
|
||||
return copy_readlink_result(buf, bufsiz, out, postprocess_readlink(pathname, out, ret, outsiz));
|
||||
}
|
||||
|
||||
// Hook readlinkat
|
||||
@@ -459,13 +469,16 @@ ssize_t readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz) {
|
||||
}
|
||||
char pbuf[PATH_MAX];
|
||||
const char *target = (pathname && pathname[0] == '/') ? rewrite_path(pathname, pbuf, sizeof(pbuf)) : pathname;
|
||||
ssize_t ret = orig_readlinkat ? orig_readlinkat(dirfd, target, buf, bufsiz) : -1;
|
||||
char whole[PATH_MAX];
|
||||
char *out = bufsiz && bufsiz < sizeof(whole) ? whole : buf;
|
||||
size_t outsiz = out == whole ? sizeof(whole) : bufsiz;
|
||||
ssize_t ret = orig_readlinkat ? orig_readlinkat(dirfd, target, out, outsiz) : -1;
|
||||
if (ret < 0 && errno == ENOENT && pathname && pathname[0] == '/') {
|
||||
char alt[PATH_MAX];
|
||||
const char *retry = usrmerge_retry_path(target, alt, sizeof(alt));
|
||||
if (retry) ret = orig_readlinkat(dirfd, retry, buf, bufsiz);
|
||||
if (retry) ret = orig_readlinkat(dirfd, retry, out, outsiz);
|
||||
}
|
||||
return postprocess_readlink(pathname, buf, ret, bufsiz);
|
||||
return copy_readlink_result(buf, bufsiz, out, postprocess_readlink(pathname, out, ret, outsiz));
|
||||
}
|
||||
|
||||
// Fortified readlink variants used by dpkg / update-alternatives
|
||||
|
||||
@@ -724,6 +724,21 @@ long syscall(long number, ...) {
|
||||
return (long)bind((int)arg1, (const struct sockaddr *)arg2, (socklen_t)arg3);
|
||||
}
|
||||
#endif
|
||||
#if defined(__NR_sendmsg)
|
||||
if (number == __NR_sendmsg) {
|
||||
return (long)sendmsg((int)arg1, (const struct msghdr *)arg2, (int)arg3);
|
||||
}
|
||||
#endif
|
||||
#if defined(__NR_recvmsg)
|
||||
if (number == __NR_recvmsg) {
|
||||
return (long)recvmsg((int)arg1, (struct msghdr *)arg2, (int)arg3);
|
||||
}
|
||||
#endif
|
||||
#if defined(__NR_getsockopt)
|
||||
if (number == __NR_getsockopt) {
|
||||
return (long)getsockopt((int)arg1, (int)arg2, (int)arg3, (void *)arg4, (socklen_t *)arg5);
|
||||
}
|
||||
#endif
|
||||
#if defined(__NR_truncate)
|
||||
if (number == __NR_truncate) {
|
||||
return (long)truncate((const char *)arg1, (off_t)arg2);
|
||||
|
||||
@@ -21,6 +21,8 @@ static VkPipelineColorBlendAttachmentState driver_attachments[4];
|
||||
static uint32_t driver_attachment_count;
|
||||
static VkColorBlendEquationEXT driver_equations[4];
|
||||
static uint32_t driver_equation_count;
|
||||
static VkCompareOp driver_depth_op, driver_pipeline_depth_op;
|
||||
static VkBool32 driver_depth_test;
|
||||
|
||||
#define MAIN 1
|
||||
#define VOID 2
|
||||
@@ -182,6 +184,25 @@ static void test_spirv(const char *directory)
|
||||
assert(!spirv_strip_dual_source(truncated, 5, &out));
|
||||
}
|
||||
|
||||
static void test_handle_map_null_key(void)
|
||||
{
|
||||
struct handle_map map = {0};
|
||||
int first, second;
|
||||
map_put(&map, 0x1000, &first);
|
||||
map_put(&map, 0x2000, &second);
|
||||
for (int i = 0; i < 1000; i++)
|
||||
assert(!map_remove(&map, 0));
|
||||
map_put(&map, 0, &first);
|
||||
assert(map.count == 2 && !map_get(&map, 0));
|
||||
for (uint64_t key = 1; key <= 30; key++) {
|
||||
map_put(&map, 0x100000 + key, &first);
|
||||
assert(map_remove(&map, 0x100000 + key) == &first);
|
||||
}
|
||||
assert(map.count == 2 && map.capacity == 64);
|
||||
assert(map_get(&map, 0x1000) == &first && map_get(&map, 0x2000) == &second);
|
||||
map_free(&map);
|
||||
}
|
||||
|
||||
static VkResult VKAPI_CALL mock_create_instance(const VkInstanceCreateInfo *info, const VkAllocationCallbacks *allocator,
|
||||
VkInstance *instance)
|
||||
{
|
||||
@@ -286,10 +307,27 @@ static VkResult VKAPI_CALL mock_create_graphics_pipelines(VkDevice device, VkPip
|
||||
const VkShaderModuleCreateInfo *module = infos[0].pStages[0].pNext;
|
||||
assert(module && module->sType == VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO);
|
||||
capture_code(module->pCode, module->codeSize);
|
||||
if (infos[0].pDepthStencilState)
|
||||
driver_pipeline_depth_op = infos[0].pDepthStencilState->depthCompareOp;
|
||||
pipelines[0] = (VkPipeline)0x2000;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VkResult VKAPI_CALL mock_begin_command_buffer(VkCommandBuffer cmd, const VkCommandBufferBeginInfo *info)
|
||||
{
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static void VKAPI_CALL mock_set_depth_test(VkCommandBuffer cmd, VkBool32 enable)
|
||||
{
|
||||
driver_depth_test = enable;
|
||||
}
|
||||
|
||||
static void VKAPI_CALL mock_set_depth_op(VkCommandBuffer cmd, VkCompareOp op)
|
||||
{
|
||||
driver_depth_op = op;
|
||||
}
|
||||
|
||||
static void VKAPI_CALL mock_set_blend_equation(VkCommandBuffer cmd, uint32_t first, uint32_t count,
|
||||
const VkColorBlendEquationEXT *equations)
|
||||
{
|
||||
@@ -323,6 +361,9 @@ static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL mock_gdpa(VkDevice device, const
|
||||
MOCK("vkDestroyShaderModule", mock_destroy_shader_module);
|
||||
MOCK("vkCreateGraphicsPipelines", mock_create_graphics_pipelines);
|
||||
MOCK("vkCmdSetColorBlendEquationEXT", mock_set_blend_equation);
|
||||
MOCK("vkBeginCommandBuffer", mock_begin_command_buffer);
|
||||
MOCK("vkCmdSetDepthTestEnable", mock_set_depth_test);
|
||||
MOCK("vkCmdSetDepthCompareOp", mock_set_depth_op);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -461,9 +502,75 @@ static void test_capable_device(void)
|
||||
destroy_device(device);
|
||||
}
|
||||
|
||||
static void create_depth_pipeline(VkDevice device, const VkPipelineDepthStencilStateCreateInfo *depth,
|
||||
const VkDynamicState *dynamic, uint32_t dynamic_count)
|
||||
{
|
||||
struct spirv plain;
|
||||
fragment_shader(&plain, 0x00010000, false);
|
||||
VkShaderModuleCreateInfo module = {VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO, NULL, 0,
|
||||
plain.n * sizeof(uint32_t), plain.w};
|
||||
VkPipelineShaderStageCreateInfo stage = {VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, &module, 0,
|
||||
VK_SHADER_STAGE_FRAGMENT_BIT, VK_NULL_HANDLE, "main", NULL};
|
||||
VkPipelineColorBlendStateCreateInfo blend = {VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, NULL, 0,
|
||||
VK_FALSE, VK_LOGIC_OP_COPY, 1, &plain_attachment, {0}};
|
||||
VkPipelineDynamicStateCreateInfo states = {VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, NULL, 0,
|
||||
dynamic_count, dynamic};
|
||||
VkGraphicsPipelineCreateInfo info = {.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, .stageCount = 1,
|
||||
.pStages = &stage, .pDepthStencilState = depth, .pColorBlendState = &blend,
|
||||
.pDynamicState = dynamic_count ? &states : NULL};
|
||||
VkPipeline pipeline;
|
||||
driver_pipeline_depth_op = VK_COMPARE_OP_MAX_ENUM;
|
||||
PFN_vkCreateGraphicsPipelines create =
|
||||
(PFN_vkCreateGraphicsPipelines)layer_gdpa(device, "vkCreateGraphicsPipelines");
|
||||
assert(create(device, VK_NULL_HANDLE, 1, &info, NULL, &pipeline) == VK_SUCCESS);
|
||||
}
|
||||
|
||||
static void test_depth_compare_op(void)
|
||||
{
|
||||
VkDevice device;
|
||||
VkPhysicalDeviceFeatures enabled = {.dualSrcBlend = VK_TRUE};
|
||||
assert(create_device((VkPhysicalDevice)&mock_lacking, NULL, &enabled, &device) == VK_SUCCESS);
|
||||
PFN_vkBeginCommandBuffer begin = (PFN_vkBeginCommandBuffer)layer_gdpa(device, "vkBeginCommandBuffer");
|
||||
PFN_vkCmdSetDepthTestEnable set_test =
|
||||
(PFN_vkCmdSetDepthTestEnable)layer_gdpa(device, "vkCmdSetDepthTestEnable");
|
||||
PFN_vkCmdSetDepthCompareOp set_op = (PFN_vkCmdSetDepthCompareOp)layer_gdpa(device, "vkCmdSetDepthCompareOp");
|
||||
assert((PFN_vkVoidFunction)set_test != (PFN_vkVoidFunction)mock_set_depth_test);
|
||||
assert((PFN_vkVoidFunction)set_op != (PFN_vkVoidFunction)mock_set_depth_op);
|
||||
|
||||
VkCommandBuffer cmd = (VkCommandBuffer)&mock_command_buffer;
|
||||
VkCommandBufferBeginInfo begin_info = {.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO};
|
||||
assert(begin(cmd, &begin_info) == VK_SUCCESS);
|
||||
set_op(cmd, VK_COMPARE_OP_LESS);
|
||||
assert(driver_depth_op == VK_COMPARE_OP_LESS);
|
||||
set_test(cmd, VK_FALSE);
|
||||
assert(!driver_depth_test && driver_depth_op == VK_COMPARE_OP_ALWAYS);
|
||||
set_op(cmd, VK_COMPARE_OP_NEVER);
|
||||
assert(driver_depth_op == VK_COMPARE_OP_ALWAYS);
|
||||
set_test(cmd, VK_TRUE);
|
||||
assert(driver_depth_test && driver_depth_op == VK_COMPARE_OP_NEVER);
|
||||
set_test(cmd, VK_FALSE);
|
||||
assert(begin(cmd, &begin_info) == VK_SUCCESS);
|
||||
set_op(cmd, VK_COMPARE_OP_GREATER);
|
||||
assert(driver_depth_op == VK_COMPARE_OP_GREATER);
|
||||
|
||||
VkPipelineDepthStencilStateCreateInfo depth = {.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
|
||||
.depthCompareOp = VK_COMPARE_OP_NEVER};
|
||||
create_depth_pipeline(device, &depth, NULL, 0);
|
||||
assert(driver_pipeline_depth_op == VK_COMPARE_OP_ALWAYS && depth.depthCompareOp == VK_COMPARE_OP_NEVER);
|
||||
const VkDynamicState dynamic[] = {VK_DYNAMIC_STATE_DEPTH_COMPARE_OP};
|
||||
create_depth_pipeline(device, &depth, dynamic, 1);
|
||||
assert(driver_pipeline_depth_op == VK_COMPARE_OP_NEVER);
|
||||
depth.depthTestEnable = VK_TRUE;
|
||||
depth.depthCompareOp = VK_COMPARE_OP_LESS;
|
||||
create_depth_pipeline(device, &depth, NULL, 0);
|
||||
assert(driver_pipeline_depth_op == VK_COMPARE_OP_LESS);
|
||||
destroy_device(device);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
test_spirv(argc > 1 ? argv[1] : NULL);
|
||||
test_handle_map_null_key();
|
||||
|
||||
setenv("WINEPREFIX", "/nonexistent", 1);
|
||||
unsetenv("DROIDDECK_MALI_COMPAT");
|
||||
@@ -482,6 +589,7 @@ int main(int argc, char **argv)
|
||||
|
||||
test_lacking_device();
|
||||
test_capable_device();
|
||||
test_depth_compare_op();
|
||||
|
||||
((PFN_vkDestroyInstance)layer_gipa(instance, "vkDestroyInstance"))(instance, NULL);
|
||||
free(driver_code);
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import unittest
|
||||
|
||||
|
||||
DESKTOP = (Path(__file__).resolve().parents[1] / 'linuxfs/desktop/droiddeck-desktop').read_text()
|
||||
START = 'if [ "$(cat /usr/share/droiddeck/kwin-compositor 2>/dev/null)" = opengl ]; then'
|
||||
LINE = '\n [ "${DD_STEAM_GL_PRESENT:-}" = 1 ] && export MOZ_ACCELERATED=0\n'
|
||||
|
||||
|
||||
class DesktopFirefoxSoftwareTest(unittest.TestCase):
|
||||
def firefox_environment(self, gl_present):
|
||||
head = DESKTOP[:DESKTOP.index('\n', DESKTOP.index('export MOZ_ENABLE_WAYLAND=1'))]
|
||||
head = head[head.rindex('\n') + 1:]
|
||||
block = DESKTOP[DESKTOP.index(START):]
|
||||
block = block[block.index('\n') + 1:block.index('\n if [ -z "${KWIN_RENDER_NODES:-}" ]')]
|
||||
environment = {key: value for key, value in os.environ.items()
|
||||
if key not in ('DD_STEAM_GL_PRESENT', 'MOZ_ENABLE_WAYLAND', 'MOZ_ACCELERATED')}
|
||||
if gl_present is not None:
|
||||
environment['DD_STEAM_GL_PRESENT'] = gl_present
|
||||
script = head + '\n' + block + '\nsh -c \'echo "wayland:${MOZ_ENABLE_WAYLAND:-unset} accelerated:${MOZ_ACCELERATED:-unset}"\''
|
||||
result = subprocess.run(['bash', '-c', script], env=environment, capture_output=True,
|
||||
text=True, timeout=5)
|
||||
self.assertEqual(0, result.returncode, result.stderr)
|
||||
return result.stdout.strip().splitlines()[-1]
|
||||
|
||||
def test_system_powervr_desktop_runs_firefox_on_wayland_with_software_rendering(self):
|
||||
self.assertEqual('wayland:1 accelerated:0', self.firefox_environment('1'))
|
||||
|
||||
def test_other_drivers_keep_firefox_hardware_rendering(self):
|
||||
self.assertEqual('wayland:1 accelerated:unset', self.firefox_environment(None))
|
||||
self.assertEqual('wayland:1 accelerated:unset', self.firefox_environment('0'))
|
||||
|
||||
def test_override_is_set_before_plasma(self):
|
||||
self.assertLess(DESKTOP.index(LINE), DESKTOP.index('dbus-run-session -- startplasma-wayland'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,35 @@
|
||||
import re
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
REPO = Path(__file__).resolve().parents[2]
|
||||
PATCH = REPO / "tools/fex/patches/0017-fd-exec-keeps-argv0-and-path.patch"
|
||||
SYSCALLS = "Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls.cpp"
|
||||
INTERPRETER = "Source/Tools/FEXInterpreter/FEXInterpreter.cpp"
|
||||
|
||||
|
||||
def lines(sign):
|
||||
return [line[1:].strip() for line in PATCH.read_text().splitlines() if line.startswith(sign) and not line.startswith(sign * 3)]
|
||||
|
||||
|
||||
class FexFdExecTest(unittest.TestCase):
|
||||
def test_only_the_execve_handler_and_the_interpreter_change(self):
|
||||
self.assertEqual([INTERPRETER, SYSCALLS], re.findall(r"^diff --git a/(\S+) ", PATCH.read_text(), re.M))
|
||||
|
||||
def test_a_descriptor_exec_keeps_the_callers_argv0(self):
|
||||
self.assertIn("if (!NeedsLoaderFD) {", lines("-"))
|
||||
self.assertIn("if (!NeedsLoaderFD && !IsFDExec) {", lines("+"))
|
||||
|
||||
def test_an_anonymous_program_reports_its_recovered_path(self):
|
||||
self.assertIn('FEXCore::Config::Set(FEXCore::Config::CONFIG_APP_FILENAME, "<Anonymous>");', lines("-"))
|
||||
self.assertIn("FEXCore::Config::Set(FEXCore::Config::CONFIG_APP_FILENAME, Program.ProgramPath);", lines("+"))
|
||||
|
||||
def test_the_config_name_stays_anonymous(self):
|
||||
self.assertNotIn('FEXCore::Config::Set(FEXCore::Config::CONFIG_APP_CONFIG_NAME, "<Anonymous>");', lines("-"))
|
||||
|
||||
def test_no_comments_are_added(self):
|
||||
self.assertFalse([line for line in lines("+") if line.startswith(("//", "/*"))])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,147 @@
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from tools.tests.test_usr2_preload import runner
|
||||
|
||||
REPO = Path(__file__).resolve().parents[2]
|
||||
PATCH = REPO / "tools/fex/patches/0018-socket-credentials-through-libc.patch"
|
||||
HOOK = REPO / "tools/nativeguest/hook/privileged.c"
|
||||
HOOK_BUILD = REPO / "tools/nativeguest/build.sh"
|
||||
PASSTHROUGH = "Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls/Passthrough.cpp"
|
||||
REGISTER = re.compile(r"REGISTER_SYSCALL_IMPL_X64\((\w+), (\w+?)(\d)<SYSCALL_DEF\((\w+)\)>\);")
|
||||
ROUTED = {"sendmsg", "recvmsg", "getsockopt"}
|
||||
|
||||
|
||||
def changed():
|
||||
removed, added = {}, {}
|
||||
for line in PATCH.read_text().splitlines():
|
||||
found = REGISTER.search(line)
|
||||
if found and line[:1] in "+-":
|
||||
(added if line[0] == "+" else removed)[found.group(1)] = found.groups()[1:]
|
||||
return removed, added
|
||||
|
||||
|
||||
class FexSocketCredentialsTest(unittest.TestCase):
|
||||
def test_only_the_passthrough_table_changes(self):
|
||||
self.assertEqual([PASSTHROUGH], re.findall(r"^diff --git a/(\S+) ", PATCH.read_text(), re.M))
|
||||
|
||||
def test_each_socket_call_keeps_its_arity_and_goes_through_libc(self):
|
||||
removed, added = changed()
|
||||
self.assertEqual(ROUTED, set(removed))
|
||||
self.assertEqual(ROUTED, set(added))
|
||||
for name, (template, arity, number) in added.items():
|
||||
with self.subTest(name=name):
|
||||
self.assertEqual(name, number)
|
||||
self.assertEqual(("SyscallPassthrough", arity, number), removed[name])
|
||||
self.assertEqual("SyscallPathPassthrough", template)
|
||||
|
||||
def test_every_routed_call_is_answered_by_the_hook(self):
|
||||
hook = HOOK.read_text()
|
||||
for number in ROUTED:
|
||||
with self.subTest(number=number):
|
||||
self.assertIn(f"number == __NR_{number})", hook)
|
||||
|
||||
|
||||
PROBE = r"""
|
||||
#define _GNU_SOURCE
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(void) {
|
||||
int sv[2], on = 1;
|
||||
if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv) != 0) return 2;
|
||||
setsockopt(sv[1], SOL_SOCKET, SO_PASSCRED, &on, sizeof(on));
|
||||
struct ucred sent = {getpid(), (uid_t)syscall(SYS_getuid), (gid_t)syscall(SYS_getgid)};
|
||||
char byte = 0, ctrl[CMSG_SPACE(sizeof(struct ucred))];
|
||||
struct iovec iov = {&byte, 1};
|
||||
struct msghdr msg = {0};
|
||||
msg.msg_iov = &iov;
|
||||
msg.msg_iovlen = 1;
|
||||
msg.msg_control = ctrl;
|
||||
msg.msg_controllen = sizeof(ctrl);
|
||||
struct cmsghdr *c = CMSG_FIRSTHDR(&msg);
|
||||
c->cmsg_level = SOL_SOCKET;
|
||||
c->cmsg_type = SCM_CREDENTIALS;
|
||||
c->cmsg_len = CMSG_LEN(sizeof(sent));
|
||||
memcpy(CMSG_DATA(c), &sent, sizeof(sent));
|
||||
errno = 0;
|
||||
long rc = syscall(SYS_sendmsg, sv[0], &msg, 0);
|
||||
printf("sendmsg %ld %d %u\n", rc, errno, sent.uid);
|
||||
char in_ctrl[CMSG_SPACE(sizeof(struct ucred))];
|
||||
struct msghdr in = {0};
|
||||
in.msg_iov = &iov;
|
||||
in.msg_iovlen = 1;
|
||||
in.msg_control = in_ctrl;
|
||||
in.msg_controllen = sizeof(in_ctrl);
|
||||
rc = syscall(SYS_recvmsg, sv[1], &in, MSG_DONTWAIT);
|
||||
struct ucred got = {0, 99, 99};
|
||||
for (c = CMSG_FIRSTHDR(&in); c; c = CMSG_NXTHDR(&in, c))
|
||||
if (c->cmsg_type == SCM_CREDENTIALS) memcpy(&got, CMSG_DATA(c), sizeof(got));
|
||||
printf("recvmsg %ld %u\n", rc, got.uid);
|
||||
struct ucred peer = {0, 99, 99};
|
||||
socklen_t len = sizeof(peer);
|
||||
rc = syscall(SYS_getsockopt, sv[1], SOL_SOCKET, SO_PEERCRED, &peer, &len);
|
||||
printf("peercred %ld %u\n", rc, peer.uid);
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
class NativeHookSocketCredentialsTest(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
if os.getuid() == 0:
|
||||
raise unittest.SkipTest("root may send any credentials")
|
||||
cls.cc, cls.prefix = runner()
|
||||
if cls.cc is None:
|
||||
raise unittest.SkipTest("no aarch64 compiler and runner")
|
||||
cls.tmp = tempfile.TemporaryDirectory()
|
||||
tmp = Path(cls.tmp.name)
|
||||
cls.hook = tmp / "hook.so"
|
||||
subprocess.run(["bash", str(HOOK_BUILD), str(cls.hook), cls.cc], check=True, capture_output=True)
|
||||
(tmp / "probe.c").write_text(PROBE)
|
||||
subprocess.run([cls.cc, "-O1", "-o", str(tmp / "probe"), str(tmp / "probe.c")], check=True)
|
||||
(tmp / "root").mkdir()
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
cls.tmp.cleanup()
|
||||
|
||||
def probe(self, hooked):
|
||||
hook_env = {"DDNATV_ROOT": str(Path(self.tmp.name) / "root")}
|
||||
if hooked:
|
||||
hook_env["LD_PRELOAD"] = str(self.hook)
|
||||
env = {k: v for k, v in os.environ.items() if k != "LD_PRELOAD"}
|
||||
if self.prefix:
|
||||
cmd = list(self.prefix) + [arg for key, value in hook_env.items() for arg in ("-E", f"{key}={value}")]
|
||||
else:
|
||||
cmd = []
|
||||
env.update(hook_env)
|
||||
out = subprocess.run(cmd + [str(Path(self.tmp.name) / "probe")], env=env, capture_output=True, text=True,
|
||||
timeout=120)
|
||||
self.assertEqual(0, out.returncode, out.stderr)
|
||||
return {line.split(" ", 1)[0]: line.split(" ", 1)[1] for line in out.stdout.splitlines()}
|
||||
|
||||
def test_root_credentials_sent_through_the_raw_call_reach_the_peer_as_root(self):
|
||||
result = self.probe(hooked=True)
|
||||
self.assertEqual("1 0 0", result["sendmsg"])
|
||||
self.assertEqual("1 0", result["recvmsg"])
|
||||
self.assertEqual("0 0", result["peercred"])
|
||||
|
||||
def test_without_the_hook_the_kernel_keeps_the_real_ids(self):
|
||||
result = self.probe(hooked=False)
|
||||
self.assertEqual(f"1 0 {os.getuid()}", result["sendmsg"])
|
||||
self.assertEqual(f"1 {os.getuid()}", result["recvmsg"])
|
||||
self.assertEqual(f"0 {os.getuid()}", result["peercred"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -1866,6 +1866,18 @@ class GameEnvironmentTest(unittest.TestCase):
|
||||
self.assertEqual(MODULE["apply_config"]({}, config, "1771300", env), {"VKD3D_FEATURE_LEVEL": "12_1", "VKD3D_SHADER_MODEL": "6_9"})
|
||||
self.assertEqual(MODULE["engine_fixes"](str(exe), [], "42")[0], {})
|
||||
|
||||
def test_hades_ii_runs_at_feature_level_12_2_from_steam_and_xbox_unless_the_game_overrides_it(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
for exe in (Path(tmp) / "Hades II/Ship/Hades2.exe", Path(tmp) / "Xbox/Hades II/Hades2.exe"):
|
||||
exe.parent.mkdir(parents=True)
|
||||
exe.touch()
|
||||
env, extra, notes = MODULE["engine_fixes"](str(exe), [])
|
||||
self.assertEqual(env, {"VKD3D_FEATURE_LEVEL": "12_2"}, str(exe))
|
||||
self.assertTrue(notes)
|
||||
config = {"version": 1, "shared": {}, "games": {"42": {"VKD3D_FEATURE_LEVEL": "12_1"}}}
|
||||
self.assertEqual(MODULE["apply_config"]({}, config, "42", env), {"VKD3D_FEATURE_LEVEL": "12_1"})
|
||||
self.assertEqual(MODULE["engine_fixes"]("/game/Hades/x64/Hades.exe", [])[0], {})
|
||||
|
||||
def test_unity_players_keep_tso_over_the_preset(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
def game(*names):
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
from tools.tests.test_usr2_preload import runner
|
||||
|
||||
HOOK_BUILD = Path(__file__).resolve().parents[1] / "nativeguest/build.sh"
|
||||
|
||||
RECORDER = r"""
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int execve(const char *path, char *const argv[], char *const envp[]) {
|
||||
const char *exe = "-";
|
||||
for (int i = 0; envp && envp[i]; i++)
|
||||
if (strncmp(envp[i], "DDNATV_REAL_EXE=", 16) == 0) exe = envp[i] + 16;
|
||||
printf("exe\t%s\n", exe);
|
||||
fflush(stdout);
|
||||
_exit(0);
|
||||
}
|
||||
"""
|
||||
|
||||
PROBE = r"""
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (argc < 2) return 0;
|
||||
char *args[] = {argv[1], NULL};
|
||||
execv(argv[1], args);
|
||||
perror("execv");
|
||||
return 1;
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
class NativeHookExecTargetTest(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.cc, cls.prefix = runner()
|
||||
if cls.cc is None:
|
||||
raise unittest.SkipTest("no aarch64 compiler and runner")
|
||||
cls.tmp = tempfile.TemporaryDirectory()
|
||||
tmp = Path(cls.tmp.name)
|
||||
cls.hook = tmp / "hook.so"
|
||||
subprocess.run(["bash", str(HOOK_BUILD), str(cls.hook), cls.cc], check=True, capture_output=True)
|
||||
(tmp / "recorder.c").write_text(RECORDER)
|
||||
cls.recorder = tmp / "recorder.so"
|
||||
subprocess.run([cls.cc, "-shared", "-fPIC", "-O1", "-o", str(cls.recorder), str(tmp / "recorder.c")], check=True)
|
||||
(tmp / "probe.c").write_text(PROBE)
|
||||
cls.probe = tmp / "probe"
|
||||
subprocess.run([cls.cc, "-O1", "-o", str(cls.probe), str(tmp / "probe.c")], check=True)
|
||||
cls.root = tmp / "root"
|
||||
opt = cls.root / "opt"
|
||||
(opt / "real").mkdir(parents=True)
|
||||
(opt / "nest").mkdir()
|
||||
(cls.root / "lib").mkdir()
|
||||
(cls.root / "lib/ld-linux-aarch64.so.1").write_bytes(b"")
|
||||
shutil.copy(cls.probe, opt / "real/prog")
|
||||
shutil.copy(cls.probe, opt / "real/.l2s.prog0001")
|
||||
os.symlink("./real", opt / "rel")
|
||||
os.symlink("/opt/real", opt / "abs")
|
||||
os.symlink("../rel", opt / "nest/sub")
|
||||
os.symlink("rel/prog", opt / "link")
|
||||
os.symlink(".l2s.prog0001", opt / "real/hard")
|
||||
cls.real = str(opt / "real/prog")
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
cls.tmp.cleanup()
|
||||
|
||||
def exe(self, program):
|
||||
hook_env = {"DDNATV_ROOT": str(self.root), "LD_PRELOAD": f"{self.hook}:{self.recorder}"}
|
||||
env = {k: v for k, v in os.environ.items() if k not in ("LD_PRELOAD", "DDNATV_ROOT", "DDNATV_REAL_EXE")}
|
||||
if self.prefix:
|
||||
cmd = list(self.prefix) + [arg for key, value in hook_env.items() for arg in ("-E", f"{key}={value}")]
|
||||
else:
|
||||
cmd = []
|
||||
env.update(hook_env)
|
||||
out = subprocess.run(cmd + [str(self.probe), program], env=env, capture_output=True, text=True, timeout=120)
|
||||
for line in out.stdout.splitlines():
|
||||
if line.startswith("exe\t"):
|
||||
return line.split("\t", 1)[1]
|
||||
self.fail(out.stdout + out.stderr)
|
||||
|
||||
def test_a_program_reached_through_a_relative_directory_link_is_named_by_its_real_path(self):
|
||||
self.assertEqual(self.real, self.exe("/opt/rel/prog"))
|
||||
|
||||
def test_a_program_reached_through_a_guest_absolute_directory_link_is_named_by_its_real_path(self):
|
||||
self.assertEqual(self.real, self.exe("/opt/abs/prog"))
|
||||
|
||||
def test_links_that_climb_with_dot_dot_resolve_like_the_kernel(self):
|
||||
self.assertEqual(self.real, self.exe("/opt/nest/sub/./prog"))
|
||||
|
||||
def test_a_link_to_the_program_itself_still_resolves(self):
|
||||
self.assertEqual(self.real, self.exe("/opt/link"))
|
||||
|
||||
def test_a_plain_path_is_unchanged(self):
|
||||
self.assertEqual(self.real, self.exe("/opt/real/prog"))
|
||||
|
||||
def test_a_missing_directory_is_not_skipped_by_dot_dot(self):
|
||||
self.assertNotEqual(self.real, self.exe("/opt/missing/../real/prog"))
|
||||
|
||||
def test_a_file_is_not_used_as_a_directory(self):
|
||||
self.assertNotEqual(self.real, self.exe("/opt/real/prog/../prog"))
|
||||
|
||||
def test_a_proot_hard_link_keeps_its_own_name(self):
|
||||
self.assertEqual(str(self.root / "opt/real/hard"), self.exe("/opt/real/hard"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,106 @@
|
||||
import errno
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
from tools.tests.test_usr2_preload import runner
|
||||
|
||||
HOOK_BUILD = Path(__file__).resolve().parents[1] / "nativeguest/build.sh"
|
||||
|
||||
PROBE = r"""
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void show(const char *name, ssize_t len, const char *buf) {
|
||||
printf("%s\t%zd\t%.*s\n", name, len, len > 0 ? (int)len : 0, buf);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
const char *link = argv[1];
|
||||
struct stat st;
|
||||
if (lstat(link, &st) != 0) return 2;
|
||||
char *exact = malloc((size_t)st.st_size + 1);
|
||||
show("sized", readlink(link, exact, (size_t)st.st_size), exact);
|
||||
char full[4096];
|
||||
show("full", readlink(link, full, sizeof(full)), full);
|
||||
char small[4];
|
||||
show("small", readlink(link, small, sizeof(small)), small);
|
||||
show("sized-at", readlinkat(AT_FDCWD, link, exact, (size_t)st.st_size), exact);
|
||||
errno = 0;
|
||||
ssize_t zero = readlink(link, full, 0);
|
||||
int zero_errno = errno;
|
||||
printf("zero\t%zd\t%d\n", zero, zero_errno);
|
||||
errno = 0;
|
||||
zero = readlinkat(AT_FDCWD, link, full, 0);
|
||||
zero_errno = errno;
|
||||
printf("zero-at\t%zd\t%d\n", zero, zero_errno);
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
class NativeHookReadlinkTest(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.cc, cls.prefix = runner()
|
||||
if cls.cc is None:
|
||||
raise unittest.SkipTest("no aarch64 compiler and runner")
|
||||
cls.tmp = tempfile.TemporaryDirectory(dir="/tmp")
|
||||
tmp = Path(cls.tmp.name)
|
||||
cls.hook = tmp / "hook.so"
|
||||
subprocess.run(["bash", str(HOOK_BUILD), str(cls.hook), cls.cc], check=True, capture_output=True)
|
||||
(tmp / "probe.c").write_text(PROBE)
|
||||
cls.probe = tmp / "probe"
|
||||
subprocess.run([cls.cc, "-O1", "-o", str(cls.probe), str(tmp / "probe.c")], check=True)
|
||||
cls.root = tmp / "root"
|
||||
(cls.root / "bin").mkdir(parents=True)
|
||||
(cls.root / "etc/alternatives").mkdir(parents=True)
|
||||
(cls.root / "bin/nano").write_text("")
|
||||
os.symlink(cls.root / "bin/nano", cls.root / "etc/alternatives/editor")
|
||||
os.symlink("/bin/nano", cls.root / "etc/alternatives/guest")
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
cls.tmp.cleanup()
|
||||
|
||||
def read(self, link):
|
||||
hook_env = {"DDNATV_ROOT": str(self.root), "LD_PRELOAD": str(self.hook)}
|
||||
env = {k: v for k, v in os.environ.items() if k not in ("LD_PRELOAD", "DDNATV_ROOT")}
|
||||
if self.prefix:
|
||||
cmd = list(self.prefix) + [arg for key, value in hook_env.items() for arg in ("-E", f"{key}={value}")]
|
||||
else:
|
||||
cmd = []
|
||||
env.update(hook_env)
|
||||
out = subprocess.run(cmd + [str(self.probe), link], env=env, capture_output=True, text=True, timeout=120)
|
||||
self.assertEqual(0, out.returncode, out.stdout + out.stderr)
|
||||
return {line.split("\t")[0]: line.split("\t")[1:] for line in out.stdout.splitlines()}
|
||||
|
||||
def test_a_buffer_sized_from_lstat_gets_the_guest_target(self):
|
||||
result = self.read("/etc/alternatives/editor")
|
||||
self.assertEqual(["9", "/bin/nano"], result["sized"])
|
||||
self.assertEqual(["9", "/bin/nano"], result["sized-at"])
|
||||
self.assertEqual(["9", "/bin/nano"], result["full"])
|
||||
|
||||
def test_a_short_buffer_gets_the_start_of_the_guest_target(self):
|
||||
self.assertEqual(["4", "/bin"], self.read("/etc/alternatives/editor")["small"])
|
||||
|
||||
def test_a_guest_target_is_unchanged(self):
|
||||
result = self.read("/etc/alternatives/guest")
|
||||
self.assertEqual(["9", "/bin/nano"], result["sized"])
|
||||
self.assertEqual(["4", "/bin"], result["small"])
|
||||
|
||||
def test_a_zero_sized_buffer_is_rejected(self):
|
||||
result = self.read("/etc/alternatives/editor")
|
||||
self.assertEqual(["-1", str(errno.EINVAL)], result["zero"])
|
||||
self.assertEqual(["-1", str(errno.EINVAL)], result["zero-at"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,73 @@
|
||||
import json
|
||||
import os
|
||||
import runpy
|
||||
import shutil
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
BIN = Path(__file__).resolve().parents[1] / "linuxfs/overlay/usr/local/bin"
|
||||
WEBKIT = "/usr/lib/aarch64-linux-gnu/webkit2gtk-4.1"
|
||||
|
||||
|
||||
class SnapLayoutTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
try:
|
||||
self.snap_run = runpy.run_path(str(BIN / "droiddeck-snap-run"))
|
||||
except ImportError:
|
||||
self.skipTest("PyYAML is not installed")
|
||||
self.tmp = Path(tempfile.mkdtemp())
|
||||
self.addCleanup(shutil.rmtree, self.tmp, True)
|
||||
self.snaps = self.tmp / "snap"
|
||||
self.snap_run["main"].__globals__["SNAP_DIR"] = str(self.snaps)
|
||||
provider = self.snaps / "gnome-core26/36"
|
||||
(provider / "meta").mkdir(parents=True)
|
||||
(provider / "meta/snap.yaml").write_text(json.dumps(
|
||||
{"slots": {"gnome-core26": {"interface": "content", "read": ["/"]}}}))
|
||||
os.symlink("36", self.snaps / "gnome-core26/current")
|
||||
self.snap = str(self.snaps / "app/12")
|
||||
self.env = {"SNAP": self.snap, "SNAP_DATA": str(self.tmp / "data/12"),
|
||||
"SNAP_COMMON": str(self.tmp / "data/common")}
|
||||
|
||||
def args(self, meta):
|
||||
binds = self.snap_run["content_binds"]("app", meta, self.env)
|
||||
mounted = [(source, target) for _, source, target in binds]
|
||||
return self.snap_run["layout_args"](meta, self.env, mounted)
|
||||
|
||||
def test_a_layout_into_a_content_snap_binds_the_provider_directory(self):
|
||||
meta = {
|
||||
"plugs": {"gnome-core26": {"interface": "content", "target": "$SNAP/gnome-platform",
|
||||
"default-provider": "gnome-core26"}},
|
||||
"layout": {WEBKIT: {"bind": "$SNAP/gnome-platform" + WEBKIT}},
|
||||
}
|
||||
self.assertEqual(["--bind", str(self.snaps / "gnome-core26/36") + WEBKIT, WEBKIT], self.args(meta))
|
||||
|
||||
def test_every_layout_kind_is_mounted_and_links_come_last(self):
|
||||
meta = {"layout": {
|
||||
"/etc/app.conf": {"bind-file": "$SNAP_DATA/etc/app.conf"},
|
||||
"/usr/share/app": {"symlink": "$SNAP/usr/share/app"},
|
||||
"/var/cache/app": {"type": "tmpfs"},
|
||||
"/var/lib/app": {"bind": "$SNAP_COMMON/lib"},
|
||||
}}
|
||||
data, common = self.env["SNAP_DATA"], self.env["SNAP_COMMON"]
|
||||
self.assertEqual([
|
||||
"--bind", data + "/etc/app.conf", "/etc/app.conf",
|
||||
"--tmpfs", "/var/cache/app",
|
||||
"--bind", common + "/lib", "/var/lib/app",
|
||||
"--symlink", self.snap + "/usr/share/app", "/usr/share/app",
|
||||
], self.args(meta))
|
||||
self.assertTrue(os.path.isfile(data + "/etc/app.conf"))
|
||||
self.assertTrue(os.path.isdir(common + "/lib"))
|
||||
|
||||
def test_a_snap_without_a_layout_gets_no_extra_mounts(self):
|
||||
self.assertEqual([], self.args({"plugs": {"home": None}}))
|
||||
self.assertEqual([], self.args({"layout": {"/opt/x": "not a mapping"}}))
|
||||
|
||||
def test_a_read_only_source_that_is_missing_is_not_created(self):
|
||||
self.assertEqual(["--bind", self.snap + "/opt/x", "/opt/x"],
|
||||
self.args({"layout": {"/opt/x": {"bind": "$SNAP/opt/x"}}}))
|
||||
self.assertFalse(os.path.exists(self.snap))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -1,6 +1,7 @@
|
||||
import importlib.machinery
|
||||
import importlib.util
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import tempfile
|
||||
@@ -20,7 +21,15 @@ def load(name):
|
||||
shortcuts = load('droiddeck-steam-shortcuts')
|
||||
|
||||
APPID = 0x87654321
|
||||
GUEST = '/root/Games/PC/Example'
|
||||
GUEST = os.path.join(tempfile.mkdtemp(prefix='droiddeck-shortcuts-'), 'Games/PC/Example')
|
||||
|
||||
|
||||
def installed(*paths):
|
||||
"""Creates the files the writer checks, so a Steam edit to one of them is kept."""
|
||||
for path in paths:
|
||||
Path(path).parent.mkdir(parents=True, exist_ok=True)
|
||||
Path(path).touch()
|
||||
return paths[0]
|
||||
|
||||
|
||||
class ShortcutsTest(unittest.TestCase):
|
||||
@@ -34,7 +43,7 @@ class ShortcutsTest(unittest.TestCase):
|
||||
self.listing = self.root / 'added-games.json'
|
||||
|
||||
def game(self, exe='Example.exe', seen=0, appid=APPID, name='Example'):
|
||||
path = GUEST + '/' + exe
|
||||
path = installed(GUEST + '/' + exe)
|
||||
return dict(name=name, exe=path, folder=GUEST, dir=path.rsplit('/', 1)[0], appid=appid, seen=seen)
|
||||
|
||||
def run_writer(self, *games):
|
||||
@@ -54,10 +63,32 @@ class ShortcutsTest(unittest.TestCase):
|
||||
if value['appid'] & 0xFFFFFFFF == appid:
|
||||
value.update(fields)
|
||||
path.write_bytes(shortcuts.write({'shortcuts': data}))
|
||||
if fields.get('Exe'):
|
||||
target = Path(shortcuts.unquoted(fields['Exe']))
|
||||
target.parent.mkdir(parents=True, exist_ok=True)
|
||||
target.touch()
|
||||
|
||||
def record(self):
|
||||
return json.loads((self.config / shortcuts.RECORD).read_text())
|
||||
|
||||
def patched(self, **constants):
|
||||
for name, value in constants.items():
|
||||
old = getattr(shortcuts, name)
|
||||
setattr(shortcuts, name, value)
|
||||
self.addCleanup(setattr, shortcuts, name, old)
|
||||
|
||||
def merge_target(self, exe, **edits):
|
||||
"""Runs merge against a Steam-edited target, with the app's exe recorded as the base."""
|
||||
fresh = shortcuts.shortcut(self.game())
|
||||
current = dict(fresh, Exe=exe, **edits)
|
||||
state = {
|
||||
'app': {field: fresh[field] for field in shortcuts.FIELDS},
|
||||
'steam': {field: current.get(field, '') for field in ('AppName', 'Exe', 'StartDir', 'LaunchOptions')},
|
||||
'rev': 1,
|
||||
}
|
||||
entry, _ = shortcuts.merge(fresh, current, state, 0)
|
||||
return entry
|
||||
|
||||
def test_settings_changed_in_steam_survive_its_restart(self):
|
||||
self.run_writer(self.game())
|
||||
edits = dict(Exe='"%s/bin/Other.exe"' % GUEST, StartDir='"%s"' % GUEST, LaunchOptions='DXVK_HUD=1 %command%',
|
||||
@@ -82,6 +113,68 @@ class ShortcutsTest(unittest.TestCase):
|
||||
self.run_writer(self.game())
|
||||
self.assertEqual(1, self.record()['games'][str(APPID)]['rev'])
|
||||
|
||||
def test_a_steam_target_whose_file_is_gone_goes_back_to_the_apps(self):
|
||||
self.run_writer(self.game())
|
||||
self.steam_edits(Exe='"%s/bin/Other.exe"' % GUEST, StartDir='"%s/data"' % GUEST)
|
||||
Path(shortcuts.unquoted('"%s/bin/Other.exe"' % GUEST)).unlink()
|
||||
entry = self.run_writer(self.game())[APPID]
|
||||
self.assertEqual('"%s/Example.exe"' % GUEST, entry['Exe'])
|
||||
self.assertEqual('"%s"' % GUEST, entry['StartDir'])
|
||||
self.assertEqual('"%s/Example.exe"' % GUEST, self.record()['games'][str(APPID)]['steam']['Exe'])
|
||||
|
||||
def test_a_steam_target_whose_internal_folder_is_gone_goes_back_to_the_apps(self):
|
||||
games = self.root / 'games'
|
||||
(games / 'Stores').mkdir(parents=True)
|
||||
self.patched(INTERNAL_ROOTS=(str(games / 'Stores'),))
|
||||
entry = self.merge_target('"%s/old-version/Other.exe"' % (games / 'Stores'), StartDir='"%s/data"' % GUEST)
|
||||
self.assertEqual('"%s/Example.exe"' % GUEST, entry['Exe'])
|
||||
self.assertEqual('"%s"' % GUEST, entry['StartDir'])
|
||||
|
||||
def test_a_steam_target_on_an_unmounted_card_is_kept(self):
|
||||
card = self.root / 'card'
|
||||
card.mkdir()
|
||||
self.patched(REMOVABLE_ROOTS=(str(card),))
|
||||
entry = self.merge_target('"%s/steamapps/common/Other.exe"' % card)
|
||||
self.assertEqual('"%s/steamapps/common/Other.exe"' % card, entry['Exe'])
|
||||
self.assertEqual('"%s"' % GUEST, entry['StartDir'])
|
||||
|
||||
def test_a_steam_target_under_a_bare_card_mountpoint_is_kept(self):
|
||||
card = self.root / 'card'
|
||||
card.mkdir()
|
||||
self.patched(REMOVABLE_ROOTS=(str(card),))
|
||||
entry = self.merge_target('"%s/Other.exe"' % card, StartDir='"%s/data"' % GUEST)
|
||||
self.assertEqual('"%s/Other.exe"' % card, entry['Exe'])
|
||||
self.assertEqual('"%s/data"' % GUEST, entry['StartDir'])
|
||||
|
||||
def test_a_steam_target_is_classified_by_its_resolved_path(self):
|
||||
games = self.root / 'games'
|
||||
stores = games / 'Stores'
|
||||
stores.mkdir(parents=True)
|
||||
card = self.root / 'card'
|
||||
card.mkdir()
|
||||
self.patched(INTERNAL_ROOTS=(str(stores),), REMOVABLE_ROOTS=(str(card),))
|
||||
target = '"%s/../../card/Other.exe"' % stores
|
||||
entry = self.merge_target(target, StartDir='"%s/data"' % GUEST)
|
||||
self.assertEqual(target, entry['Exe'])
|
||||
self.assertEqual('"%s/data"' % GUEST, entry['StartDir'])
|
||||
|
||||
def test_a_steam_target_under_a_bare_store_mountpoint_is_kept(self):
|
||||
stores = self.root / 'stores'
|
||||
mount = stores / 'abcd1234'
|
||||
mount.mkdir(parents=True)
|
||||
self.patched(REMOVABLE_FAMILIES=(str(stores),))
|
||||
entry = self.merge_target('"%s/Other.exe"' % mount, StartDir='"%s/data"' % GUEST)
|
||||
self.assertEqual('"%s/Other.exe"' % mount, entry['Exe'])
|
||||
self.assertEqual('"%s/data"' % GUEST, entry['StartDir'])
|
||||
|
||||
def test_a_steam_target_under_a_mounted_card_goes_back_to_the_apps(self):
|
||||
card = self.root / 'card'
|
||||
(card / 'steamapps').mkdir(parents=True)
|
||||
self.patched(REMOVABLE_ROOTS=(str(card),))
|
||||
entry = self.merge_target('"%s/Other.exe"' % card, StartDir='"%s/data"' % GUEST)
|
||||
self.assertEqual('"%s/Example.exe"' % GUEST, entry['Exe'])
|
||||
self.assertEqual('"%s"' % GUEST, entry['StartDir'])
|
||||
|
||||
def test_the_app_taking_steams_target_keeps_steams_start_in(self):
|
||||
self.run_writer(self.game())
|
||||
self.steam_edits(Exe='"%s/bin/Other.exe"' % GUEST, StartDir='"%s/data"' % GUEST)
|
||||
|
||||
@@ -799,7 +799,11 @@ static void recycle_command_buffer(struct device *dev, VkCommandBuffer cmd)
|
||||
VKAPI_ATTR VkResult VKAPI_CALL BeginCommandBuffer(VkCommandBuffer cmd, const VkCommandBufferBeginInfo *info)
|
||||
{
|
||||
struct device *dev = device_from_handle(cmd);
|
||||
recycle_command_buffer(dev, cmd);
|
||||
if (dev->emulated & GAP_BC)
|
||||
recycle_command_buffer(dev, cmd);
|
||||
/* Dynamic state does not carry over from one recording to the next. */
|
||||
if (dev->emulated & GAP_DEPTH_OP)
|
||||
depth_state_forget(dev, cmd);
|
||||
return dev->BeginCommandBuffer(cmd, info);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
* stand-ins the layer owns. robustBufferAccess2 itself maps to robustBufferAccess (layer.c).
|
||||
* A null texel-buffer view gets an RGBA8 (uniform) or R32_UINT (storage) view of the stand-in
|
||||
* buffer: its format is not known here, but Zink leaves them unbound and never reads them.
|
||||
* - depthCompareOp with the depth test off (GAP_DEPTH_OP): the driver is given ALWAYS while a
|
||||
* command buffer has the test off, and the application's op again once it turns the test on.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -450,3 +452,49 @@ VKAPI_ATTR void VKAPI_CALL CmdBindVertexBuffers2(VkCommandBuffer cmd, uint32_t f
|
||||
}
|
||||
dev->CmdBindVertexBuffers2(cmd, first, count, fixed, fixed_offsets, sizes ? fixed_sizes : NULL, strides);
|
||||
}
|
||||
|
||||
/* --- depthCompareOp while the depth test is off --- */
|
||||
|
||||
/* Per command buffer, packed into the map's value pointer so it is never NULL: bit 0 always set,
|
||||
* bit 1 the test enable is known, bit 2 the test is on, bit 3 an op was set, bits 4 and up that op. */
|
||||
enum { DEPTH_VALID = 1, DEPTH_KNOWN = 2, DEPTH_ON = 4, DEPTH_OP = 8 };
|
||||
|
||||
static uintptr_t depth_state(struct device *dev, VkCommandBuffer cmd)
|
||||
{
|
||||
uintptr_t state = (uintptr_t)map_get(&dev->depth_states, (uint64_t)(uintptr_t)cmd);
|
||||
return state ? state : DEPTH_VALID;
|
||||
}
|
||||
|
||||
void depth_state_forget(struct device *dev, VkCommandBuffer cmd)
|
||||
{
|
||||
pthread_mutex_lock(&dev->lock);
|
||||
map_remove(&dev->depth_states, (uint64_t)(uintptr_t)cmd);
|
||||
pthread_mutex_unlock(&dev->lock);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL CmdSetDepthTestEnable(VkCommandBuffer cmd, VkBool32 enable)
|
||||
{
|
||||
struct device *dev = device_from_handle(cmd);
|
||||
dev->CmdSetDepthTestEnable(cmd, enable);
|
||||
pthread_mutex_lock(&dev->lock);
|
||||
uintptr_t state = depth_state(dev, cmd);
|
||||
uintptr_t next = (state & ~(uintptr_t)DEPTH_ON) | DEPTH_KNOWN | (enable ? DEPTH_ON : 0);
|
||||
map_put(&dev->depth_states, (uint64_t)(uintptr_t)cmd, (void *)next);
|
||||
pthread_mutex_unlock(&dev->lock);
|
||||
if (!enable)
|
||||
dev->CmdSetDepthCompareOp(cmd, VK_COMPARE_OP_ALWAYS);
|
||||
else if (state & DEPTH_OP)
|
||||
dev->CmdSetDepthCompareOp(cmd, (VkCompareOp)(state >> 4));
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL CmdSetDepthCompareOp(VkCommandBuffer cmd, VkCompareOp op)
|
||||
{
|
||||
struct device *dev = device_from_handle(cmd);
|
||||
pthread_mutex_lock(&dev->lock);
|
||||
uintptr_t state = depth_state(dev, cmd);
|
||||
uintptr_t next = (state & (uintptr_t)(DEPTH_VALID | DEPTH_KNOWN | DEPTH_ON)) | DEPTH_OP | ((uintptr_t)op << 4);
|
||||
map_put(&dev->depth_states, (uint64_t)(uintptr_t)cmd, (void *)next);
|
||||
pthread_mutex_unlock(&dev->lock);
|
||||
bool off = (state & DEPTH_KNOWN) && !(state & DEPTH_ON);
|
||||
dev->CmdSetDepthCompareOp(cmd, off ? VK_COMPARE_OP_ALWAYS : op);
|
||||
}
|
||||
@@ -60,9 +60,11 @@ static uint64_t hash(uint64_t key)
|
||||
return key;
|
||||
}
|
||||
|
||||
/* Key 0 marks an empty slot, so VK_NULL_HANDLE is never looked up, stored or removed. Destroying a
|
||||
* null handle is valid Vulkan, and map_remove(0) would otherwise match an empty slot and drop count. */
|
||||
void *map_get(const struct handle_map *map, uint64_t key)
|
||||
{
|
||||
if (!map->capacity)
|
||||
if (!map->capacity || !key)
|
||||
return NULL;
|
||||
for (uint32_t i = hash(key) & (map->capacity - 1);; i = (i + 1) & (map->capacity - 1)) {
|
||||
if (map->keys[i] == key)
|
||||
@@ -90,6 +92,8 @@ static void map_grow(struct handle_map *map)
|
||||
|
||||
void map_put(struct handle_map *map, uint64_t key, void *value)
|
||||
{
|
||||
if (!key)
|
||||
return;
|
||||
if ((map->count + 1) * 4 > map->capacity * 3)
|
||||
map_grow(map);
|
||||
uint32_t i = hash(key) & (map->capacity - 1);
|
||||
@@ -103,7 +107,7 @@ void map_put(struct handle_map *map, uint64_t key, void *value)
|
||||
|
||||
void *map_remove(struct handle_map *map, uint64_t key)
|
||||
{
|
||||
if (!map->capacity)
|
||||
if (!map->capacity || !key)
|
||||
return NULL;
|
||||
uint32_t mask = map->capacity - 1;
|
||||
uint32_t i = hash(key) & mask;
|
||||
@@ -602,7 +606,7 @@ static VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice physical_dev
|
||||
dev->key = dispatch_key(*device);
|
||||
dev->handle = *device;
|
||||
dev->gdpa = gdpa;
|
||||
dev->emulated = requested;
|
||||
dev->emulated = requested | (gaps ? GAP_DEPTH_OP : 0);
|
||||
pthread_mutex_init(&dev->lock, NULL);
|
||||
#define LOAD(name) \
|
||||
dev->name = (PFN_vk##name)gdpa(*device, "vk" #name); \
|
||||
@@ -638,6 +642,8 @@ static VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice physical_dev
|
||||
(requested & GAP_NULL_DESCRIPTOR) ? " nullDescriptor" : "",
|
||||
(requested & GAP_DUAL_SRC_BLEND) ? " dualSrcBlend" : "", properties.deviceName);
|
||||
}
|
||||
if (dev->emulated & GAP_DEPTH_OP)
|
||||
layer_log("depthCompareOp becomes ALWAYS while the depth test is off");
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -665,6 +671,7 @@ static VKAPI_ATTR void VKAPI_CALL DestroyDevice(VkDevice device, const VkAllocat
|
||||
}
|
||||
}
|
||||
map_free(&dev->shader_modules);
|
||||
map_free(&dev->depth_states);
|
||||
pthread_mutex_destroy(&dev->lock);
|
||||
free(dev);
|
||||
}
|
||||
@@ -692,6 +699,10 @@ static const struct hook device_hooks[] = {
|
||||
HOOK(CmdSetScissorWithCount, GAP_MULTI_VIEWPORT),
|
||||
HOOK_ALIAS(CmdSetScissorWithCount, CmdSetScissorWithCountEXT, GAP_MULTI_VIEWPORT),
|
||||
HOOK(CmdSetColorBlendEquationEXT, GAP_DUAL_SRC_BLEND),
|
||||
HOOK(CmdSetDepthTestEnable, GAP_DEPTH_OP),
|
||||
HOOK_ALIAS(CmdSetDepthTestEnable, CmdSetDepthTestEnableEXT, GAP_DEPTH_OP),
|
||||
HOOK(CmdSetDepthCompareOp, GAP_DEPTH_OP),
|
||||
HOOK_ALIAS(CmdSetDepthCompareOp, CmdSetDepthCompareOpEXT, GAP_DEPTH_OP),
|
||||
HOOK(CreateImage, GAP_BC),
|
||||
HOOK(DestroyImage, GAP_BC),
|
||||
HOOK(CreateImageView, GAP_BC),
|
||||
@@ -723,7 +734,7 @@ static const struct hook device_hooks[] = {
|
||||
HOOK_ALIAS(UnmapMemory2, UnmapMemory2KHR, GAP_BC),
|
||||
HOOK(AllocateCommandBuffers, GAP_BC),
|
||||
HOOK(FreeCommandBuffers, GAP_BC),
|
||||
HOOK(BeginCommandBuffer, GAP_BC),
|
||||
HOOK(BeginCommandBuffer, GAP_BC | GAP_DEPTH_OP),
|
||||
HOOK(ResetCommandBuffer, GAP_BC),
|
||||
HOOK(ResetCommandPool, GAP_BC),
|
||||
HOOK(DestroyCommandPool, GAP_BC),
|
||||
|
||||
@@ -30,6 +30,10 @@ enum gap {
|
||||
GAP_DEPTH_CLIP = 1u << 7, /* VK_EXT_depth_clip_enable: depthClipEnable off becomes depth clamp */
|
||||
GAP_NULL_DESCRIPTOR = 1u << 8, /* VK_EXT_robustness2 missing entirely: nullDescriptor stand-ins */
|
||||
GAP_DUAL_SRC_BLEND = 1u << 9,
|
||||
/* A driver bug, not a missing feature: the Mali-G610 driver behind Venus applies depthCompareOp
|
||||
* with the depth test off, so Zink's NEVER discards every fragment. On for every device with
|
||||
* gaps; ALWAYS for a disabled test changes nothing on a driver that follows the spec. */
|
||||
GAP_DEPTH_OP = 1u << 10,
|
||||
};
|
||||
|
||||
#define GAPS_SHADER (GAP_CLIP_DISTANCE | GAP_CULL_DISTANCE)
|
||||
@@ -138,7 +142,9 @@ struct instance {
|
||||
X(CmdPushDescriptorSetWithTemplate) \
|
||||
X(CmdBindVertexBuffers) \
|
||||
X(CmdBindVertexBuffers2) \
|
||||
X(CmdSetColorBlendEquationEXT)
|
||||
X(CmdSetColorBlendEquationEXT) \
|
||||
X(CmdSetDepthTestEnable) \
|
||||
X(CmdSetDepthCompareOp)
|
||||
|
||||
struct staging_block;
|
||||
|
||||
@@ -163,6 +169,7 @@ struct device {
|
||||
struct handle_map command_buffers; /* VkCommandBuffer -> struct command_buffer */
|
||||
struct staging_block *free_staging;
|
||||
struct handle_map templates; /* VkDescriptorUpdateTemplate -> struct template_info (draw.c) */
|
||||
struct handle_map depth_states; /* VkCommandBuffer -> packed depth test state (draw.c) */
|
||||
/* nullDescriptor stand-ins (draw.c): 0 not made yet, 1 ready, -1 failed. */
|
||||
int null_ready;
|
||||
VkBuffer null_buffer;
|
||||
@@ -311,4 +318,7 @@ VKAPI_ATTR void VKAPI_CALL CmdPushDescriptorSetWithTemplate(VkCommandBuffer cmd,
|
||||
VKAPI_ATTR void VKAPI_CALL CmdBindVertexBuffers(VkCommandBuffer cmd, uint32_t first, uint32_t count, const VkBuffer *buffers, const VkDeviceSize *offsets);
|
||||
VKAPI_ATTR void VKAPI_CALL CmdBindVertexBuffers2(VkCommandBuffer cmd, uint32_t first, uint32_t count, const VkBuffer *buffers, const VkDeviceSize *offsets, const VkDeviceSize *sizes, const VkDeviceSize *strides);
|
||||
void null_resources_destroy(struct device *dev);
|
||||
VKAPI_ATTR void VKAPI_CALL CmdSetDepthTestEnable(VkCommandBuffer cmd, VkBool32 enable);
|
||||
VKAPI_ATTR void VKAPI_CALL CmdSetDepthCompareOp(VkCommandBuffer cmd, VkCompareOp op);
|
||||
void depth_state_forget(struct device *dev, VkCommandBuffer cmd);
|
||||
#endif
|
||||
@@ -143,6 +143,7 @@ struct pipeline_rewrite {
|
||||
/* VK_EXT_depth_clip_enable's state, taken out of the application's chain for the call. */
|
||||
VkBaseOutStructure *clip_prev, *clip_node;
|
||||
VkPipelineViewportStateCreateInfo viewport;
|
||||
VkPipelineDepthStencilStateCreateInfo depth_stencil;
|
||||
VkPipelineShaderStageCreateInfo stages[MAX_STAGES];
|
||||
VkShaderModuleCreateInfo modules[MAX_STAGES];
|
||||
struct spirv_code code[MAX_STAGES];
|
||||
@@ -401,6 +402,19 @@ static void rewrite_pipeline(struct device *dev, VkGraphicsPipelineCreateInfo *i
|
||||
rw->viewport.scissorCount = 1;
|
||||
info->pViewportState = &rw->viewport;
|
||||
}
|
||||
if ((dev->emulated & GAP_DEPTH_OP) && info->pDepthStencilState && !info->pDepthStencilState->depthTestEnable &&
|
||||
info->pDepthStencilState->depthCompareOp != VK_COMPARE_OP_ALWAYS) {
|
||||
bool dynamic = false;
|
||||
for (uint32_t i = 0; info->pDynamicState && i < info->pDynamicState->dynamicStateCount; i++) {
|
||||
VkDynamicState state = info->pDynamicState->pDynamicStates[i];
|
||||
dynamic |= state == VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE || state == VK_DYNAMIC_STATE_DEPTH_COMPARE_OP;
|
||||
}
|
||||
if (!dynamic) {
|
||||
rw->depth_stencil = *info->pDepthStencilState;
|
||||
rw->depth_stencil.depthCompareOp = VK_COMPARE_OP_ALWAYS;
|
||||
info->pDepthStencilState = &rw->depth_stencil;
|
||||
}
|
||||
}
|
||||
if (dev->emulated & GAP_DUAL_SRC_BLEND) {
|
||||
rewrite_blend(info, rw);
|
||||
if (rw->attachments)
|
||||
|
||||
@@ -154,7 +154,7 @@ new file mode 100755
|
||||
index 0000000..d43c5fc
|
||||
--- /dev/null
|
||||
+++ b/crates/xodus-cli/src/commands/legacy_install.rs
|
||||
@@ -0,0 +1,1198 @@
|
||||
@@ -0,0 +1,1285 @@
|
||||
+//! Installs a legacy Store title: resolve, license, download, extract.
|
||||
+//!
|
||||
+//! `streaming` only understands MSIXVC, where the container *is* the game and
|
||||
@@ -1119,15 +1119,30 @@ index 0000000..d43c5fc
|
||||
+ .map_err(|error| format!("Could not list the package folder: {error}"))?
|
||||
+ .filter_map(Result::ok)
|
||||
+ {
|
||||
+ let target = destination.join(entry.file_name());
|
||||
+ if target.exists() {
|
||||
+ if !updating {
|
||||
+ return Err(format!("Extraction would overwrite {}", target.display()));
|
||||
+ }
|
||||
+ let replaced = if target.is_dir() {
|
||||
+ std::fs::remove_dir_all(&target)
|
||||
+ let name = entry.file_name();
|
||||
+ let target = destination.join(&name);
|
||||
+ let metadata = is_package_metadata(&name);
|
||||
+ // The bundle may have written its copy of a packaging file in other letter casing.
|
||||
+ let existing: Vec<PathBuf> = if metadata {
|
||||
+ std::fs::read_dir(destination)
|
||||
+ .map_err(|error| format!("Could not list the game folder: {error}"))?
|
||||
+ .filter_map(Result::ok)
|
||||
+ .filter(|other| other.file_name().eq_ignore_ascii_case(&name))
|
||||
+ .map(|other| other.path())
|
||||
+ .collect()
|
||||
+ } else if target.exists() {
|
||||
+ vec![target.clone()]
|
||||
+ } else {
|
||||
+ Vec::new()
|
||||
+ };
|
||||
+ if !existing.is_empty() && !updating && !metadata {
|
||||
+ return Err(format!("Extraction would overwrite {}", target.display()));
|
||||
+ }
|
||||
+ for old in existing {
|
||||
+ let replaced = if old.is_dir() {
|
||||
+ std::fs::remove_dir_all(&old)
|
||||
+ } else {
|
||||
+ std::fs::remove_file(&target)
|
||||
+ std::fs::remove_file(&old)
|
||||
+ };
|
||||
+ replaced.map_err(|error| format!("Could not replace an installed file: {error}"))?;
|
||||
+ }
|
||||
@@ -1138,6 +1153,14 @@ index 0000000..d43c5fc
|
||||
+ Ok(())
|
||||
+}
|
||||
+
|
||||
+/// Files a package container carries about itself. A bundle leaves its own copies at
|
||||
+/// the top of the game folder, so the lifted package's copies replace them.
|
||||
+fn is_package_metadata(name: &std::ffi::OsStr) -> bool {
|
||||
+ ["AppxBlockMap.xml", "AppxSignature.p7x", "[Content_Types].xml", "AppxMetadata"]
|
||||
+ .iter()
|
||||
+ .any(|known| name.eq_ignore_ascii_case(known))
|
||||
+}
|
||||
+
|
||||
+/// Folders below [root] that carry a manifest, at the depth a nested bundle can
|
||||
+/// write one. A bundle of a bundle is the deepest the extractor produces.
|
||||
+fn nested_packages(root: &Path) -> Vec<PathBuf> {
|
||||
@@ -1261,6 +1284,70 @@ index 0000000..d43c5fc
|
||||
+ }
|
||||
+
|
||||
+ #[test]
|
||||
+ fn hoist_replaces_the_bundles_own_packaging_files() {
|
||||
+ // Halo Wars: Definitive Edition: the bundle leaves AppxBlockmap.xml at the top and
|
||||
+ // its one package folder has its own.
|
||||
+ let root = scratch("bundle-metadata");
|
||||
+ std::fs::write(root.join("AppxBlockmap.xml"), b"bundle").unwrap();
|
||||
+ std::fs::write(root.join("AppxSignature.p7x"), b"bundle").unwrap();
|
||||
+ std::fs::create_dir_all(root.join("AppxMetadata")).unwrap();
|
||||
+ std::fs::write(root.join("AppxMetadata").join("AppxBundleManifest.xml"), b"bundle").unwrap();
|
||||
+ let inner = root.join("Bulldog");
|
||||
+ std::fs::create_dir_all(&inner).unwrap();
|
||||
+ std::fs::write(inner.join("AppxBlockmap.xml"), b"package").unwrap();
|
||||
+ std::fs::write(inner.join("AppxSignature.p7x"), b"package").unwrap();
|
||||
+ std::fs::create_dir_all(inner.join("AppxMetadata")).unwrap();
|
||||
+ std::fs::write(inner.join("AppxMetadata").join("CodeIntegrity.cat"), b"package").unwrap();
|
||||
+ std::fs::write(inner.join(LEGACY_MANIFEST), "<Package/>").unwrap();
|
||||
+ std::fs::write(inner.join("xgameFinal.exe"), b"MZ").unwrap();
|
||||
+
|
||||
+ hoist(&root).unwrap();
|
||||
+
|
||||
+ assert!(root.join(LEGACY_MANIFEST).is_file());
|
||||
+ assert!(root.join("xgameFinal.exe").is_file());
|
||||
+ assert_eq!(std::fs::read(root.join("AppxBlockmap.xml")).unwrap(), b"package");
|
||||
+ assert_eq!(std::fs::read(root.join("AppxSignature.p7x")).unwrap(), b"package");
|
||||
+ // The package's AppxMetadata replaces the bundle's whole; nothing of the bundle's is merged in.
|
||||
+ assert_eq!(std::fs::read(root.join("AppxMetadata").join("CodeIntegrity.cat")).unwrap(), b"package");
|
||||
+ assert!(!root.join("AppxMetadata").join("AppxBundleManifest.xml").exists());
|
||||
+ assert!(!inner.exists());
|
||||
+ std::fs::remove_dir_all(&root).ok();
|
||||
+ }
|
||||
+
|
||||
+ #[test]
|
||||
+ fn hoist_replaces_a_packaging_file_the_bundle_wrote_in_other_casing() {
|
||||
+ let root = scratch("metadata-casing");
|
||||
+ std::fs::write(root.join("AppxBlockmap.xml"), b"bundle").unwrap();
|
||||
+ let inner = root.join("Game");
|
||||
+ std::fs::create_dir_all(&inner).unwrap();
|
||||
+ std::fs::write(inner.join("AppxBlockMap.xml"), b"package").unwrap();
|
||||
+ std::fs::write(inner.join(LEGACY_MANIFEST), "<Package/>").unwrap();
|
||||
+
|
||||
+ hoist(&root).unwrap();
|
||||
+
|
||||
+ let maps: Vec<_> = std::fs::read_dir(&root).unwrap().filter_map(Result::ok)
|
||||
+ .filter(|entry| entry.file_name().eq_ignore_ascii_case("AppxBlockMap.xml"))
|
||||
+ .collect();
|
||||
+ assert_eq!(maps.len(), 1, "the bundle's copy is gone on a case-sensitive filesystem too");
|
||||
+ assert_eq!(std::fs::read(maps[0].path()).unwrap(), b"package");
|
||||
+ std::fs::remove_dir_all(&root).ok();
|
||||
+ }
|
||||
+
|
||||
+ #[test]
|
||||
+ fn hoist_still_refuses_to_overwrite_a_game_file_on_a_fresh_install() {
|
||||
+ let root = scratch("fresh-collision");
|
||||
+ std::fs::write(root.join("Game.exe"), b"other").unwrap();
|
||||
+ let inner = root.join("Game");
|
||||
+ std::fs::create_dir_all(&inner).unwrap();
|
||||
+ std::fs::write(inner.join(LEGACY_MANIFEST), "<Package/>").unwrap();
|
||||
+ std::fs::write(inner.join("Game.exe"), b"MZ").unwrap();
|
||||
+
|
||||
+ assert!(hoist(&root).unwrap_err().contains("would overwrite"));
|
||||
+ assert_eq!(std::fs::read(root.join("Game.exe")).unwrap(), b"other");
|
||||
+ std::fs::remove_dir_all(&root).ok();
|
||||
+ }
|
||||
+
|
||||
+ #[test]
|
||||
+ fn hoist_finds_a_manifest_inside_a_nested_bundle() {
|
||||
+ let root = scratch("deep");
|
||||
+ let inner = root.join("bundle").join("Microsoft.SunriseBaseGame");
|
||||
|
||||
Reference in new issue
Block a user