feat: Battle.net on the desktop with its games and store, plus memory options (#979)

This commit is contained in:
Charles DuBose authored and GitHub committed 2026-10-25 12:49:27 -04:00
1 parent 6918fd9308
commit c4df7e9b3d
82 files changed
+4750 -53

No files matched your search

+1 -1
View File
@@ -61,7 +61,7 @@ Compatibility and performance vary by device; hardware validation is limited. De
## Credits and licence
GPL-3.0. Runtime, shim, input, and controller work build on WinNative and Bannerlator (maxjivi05). Epic Games and GOG support build on [Phobos’s](https://github.com/phobos665) adaptation of [Legendary](https://github.com/legendary-gl/legendary) and [gogdl](https://github.com/Heroic-Games-Launcher/heroic-gogdl), respectively. The registry entries a GOG game's install script (`goggame-<id>.script`) sets are read the way [Heroic Games Launcher](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher)'s GOG setup (GPL-3.0) reads them. LSFG frame generation is from the work of Camille LaVey and the [Eden](https://eden-emu.dev) emulator project, following [lsfg-vk](https://github.com/PancakeTAS/lsfg-vk), ported to WinNative and DroidDeck by [@maxjivi05](https://github.com/maxjivi05); it needs your own copy of [Lossless Scaling](https://store.steampowered.com/app/993090/) and ships none of its shaders. x86 AppImages, and any whose own runtime cannot unpack them, are unpacked with [uruntime](https://github.com/VHSgunzo/uruntime) by VHSgunzo (MIT), shipped unmodified with its licence, which also starts the arm64 emulator AppImages whose own runtime cannot run its extractor on Android. The Steam client's audio goes through [@The412Banner](https://github.com/The412Banner)'s [DirectAudio](https://github.com/The412Banner/directaudio) PulseAudio sink (LGPL-2.1-or-later), built from `tools/directaudio/sink` with its request size kept to its ring so clients are not asked to queue 100 ms ahead. mmap ring-buffer controller input was developed by ribbit384 ([WinNative #345](https://github.com/WinNative-Emu/WinNative/pull/345)). Why the x86-64 Steam client refused the arm64 client's sign-in was checked by reading Steam's saved token with the `ConnectCache` format from [deadlock-api-ingest](https://github.com/deadlock-api/deadlock-api-ingest). x86 programs that link OpenSSL 3 under FEX use the copy in the [Steam Linux Runtime 4.0](https://gitlab.steamos.cloud/steamrt/steamrt) platform. Hooks written with `WriteProcessMemory` into code [FEX](https://github.com/FEX-Emu/FEX) has translated go through `/proc/<pid>/mem` again when the kernel refuses `process_vm_writev`, as [Wine](https://gitlab.winehq.org/wine/wine)'s `server/ptrace.c` wrote them before Wine 11. x86 Linux games under FEX get the same `/etc/asound.conf` that [pressure-vessel](https://gitlab.steamos.cloud/steamrt/steam-runtime-tools) writes into the Steam Linux Runtime, so ALSA plays through PulseAudio. Games render with [Mesa](https://gitlab.freedesktop.org/mesa/mesa) Turnip's own per-render-pass choice between tile memory and system memory, while the Steam client keeps `TU_DEBUG=sysmem`; [FEX](https://github.com/FEX-Emu/FEX)'s code disk cache was checked in its source and is already on through Proton. The proot fast path picks the guest name of a host file bound under several names in the order [PRoot](https://github.com/proot-me/proot)'s `path/binding.c` (GPL-2.0-or-later) sorts its bindings, so links and `/proc/self/fd` read back as they do through proot. The session's [PipeWire](https://gitlab.freedesktop.org/pipewire/pipewire) (MIT) opens its sockets with the per-socket access settings documented in its `module-access.c`, and [WirePlumber](https://gitlab.freedesktop.org/pipewire/wireplumber) (MIT) keeps those clients at full permissions through its `access.rules`. Wine write watches use the userfaultfd support in [Proton](https://github.com/ValveSoftware/wine)'s `dlls/ntdll/unix/virtual.c` (LGPL-2.1-or-later): libblsession gives it the arm64 syscall number and answers its `PAGEMAP_SCAN` from `/proc/self/pagemap` where Android refuses the ioctl. Wine on arm64 sets a thread's full context by raising `SIGUSR2` from `syscall_dispatcher_return_slowpath` in [Wine](https://gitlab.winehq.org/wine/wine)'s `dlls/ntdll/unix/signal_arm64.c` (LGPL-2.1-or-later); libblsession runs that handler in place on a frame laid out as the [Linux](https://github.com/torvalds/linux) kernel's `arch/arm64/kernel/signal.c` builds it and returns through `rt_sigreturn`, so proot does not stop the thread for it. Wine's process list reads each process's memory counters from `/proc/<pid>/status` in `fill_vm_counters` ([Wine](https://gitlab.winehq.org/wine/wine) `dlls/ntdll/unix/process.c`, LGPL-2.1-or-later), so libblsession gives those reads the kernel's file instead of a copy with `TracerPid` cleared. droiddeck-ntsync is checked against the object, wait and error semantics documented for the [Linux](https://github.com/torvalds/linux) ntsync driver in `Documentation/userspace-api/ntsync.rst` (GPL-2.0). Xbox games load the Windows modules of [@domsvoboda](https://github.com/domsvoboda)'s [xodus-nexus](https://github.com/domsvoboda/xodus-nexus) runtime (LGPL-2.1-or-later), including its `wintypes.dll`, whose `ApiInformation` answer Minecraft for Windows needs to start; how Minecraft installs GameInput under Wine was checked against [@Wyze3306](https://github.com/Wyze3306)'s [BedrockOnLinuLine truncated
GPL-3.0. Runtime, shim, input, and controller work build on WinNative and Bannerlator (maxjivi05). Epic Games and GOG support build on [Phobos’s](https://github.com/phobos665) adaptation of [Legendary](https://github.com/legendary-gl/legendary) and [gogdl](https://github.com/Heroic-Games-Launcher/heroic-gogdl), respectively. Battle.net support is [@kayakyakr](https://github.com/kayakyakr)'s: it runs Blizzard's own Battle.net client, downloaded from Blizzard and not included, in Proton, and shows the key art from each game's [Battle.net Shop](https://shop.battle.net) page; without the Steam client its games see DroidDeck's pad as an Xbox 360 controller through `PROTON_SPOOF_STEAMINPUT_VIDPID` in [Proton](https://github.com/ValveSoftware/wine)'s `dlls/winebus.sys`. The registry entries a GOG game's install script (`goggame-<id>.script`) sets are read the way [Heroic Games Launcher](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher)'s GOG setup (GPL-3.0) reads them. LSFG frame generation is from the work of Camille LaVey and the [Eden](https://eden-emu.dev) emulator project, following [lsfg-vk](https://github.com/PancakeTAS/lsfg-vk), ported to WinNative and DroidDeck by [@maxjivi05](https://github.com/maxjivi05); it needs your own copy of [Lossless Scaling](https://store.steampowered.com/app/993090/) and ships none of its shaders. x86 AppImages, and any whose own runtime cannot unpack them, are unpacked with [uruntime](https://github.com/VHSgunzo/uruntime) by VHSgunzo (MIT), shipped unmodified with its licence, which also starts the arm64 emulator AppImages whose own runtime cannot run its extractor on Android. The Steam client's audio goes through [@The412Banner](https://github.com/The412Banner)'s [DirectAudio](https://github.com/The412Banner/directaudio) PulseAudio sink (LGPL-2.1-or-later), built from `tools/directaudio/sink` with its request size kept to its ring so clients are not asked to queue 100 ms ahead. mmap ring-buffer controller input was developed by ribbit384 ([WinNative #345](https://github.com/WinNative-Emu/WinNative/pull/345)). Why the x86-64 Steam client refused the arm64 client's sign-in was checked by reading Steam's saved token with the `ConnectCache` format from [deadlock-api-ingest](https://github.com/deadlock-api/deadlock-api-ingest). x86 programs that link OpenSSL 3 under FEX use the copy in the [Steam Linux Runtime 4.0](https://gitlab.steamos.cloud/steamrt/steamrt) platform. Hooks written with `WriteProcessMemory` into code [FEX](https://github.com/FEX-Emu/FEX) has translated go through `/proc/<pid>/mem` again when the kernel refuses `process_vm_writev`, as [Wine](https://gitlab.winehq.org/wine/wine)'s `server/ptrace.c` wrote them before Wine 11. x86 Linux games under FEX get the same `/etc/asound.conf` that [pressure-vessel](https://gitlab.steamos.cloud/steamrt/steam-runtime-tools) writes into the Steam Linux Runtime, so ALSA plays through PulseAudio. Games render with [Mesa](https://gitlab.freedesktop.org/mesa/mesa) Turnip's own per-render-pass choice between tile memory and system memory, while the Steam client keeps `TU_DEBUG=sysmem`; [FEX](https://github.com/FEX-Emu/FEX)'s code disk cache was checked in its source and is already on through Proton. The proot fast path picks the guest name of a host file bound under several names in the order [PRoot](https://github.com/proot-me/proot)'s `path/binding.c` (GPL-2.0-or-later) sorts its bindings, so links and `/proc/self/fd` read back as they do through proot. The session's [PipeWire](https://gitlab.freedesktop.org/pipewire/pipewire) (MIT) opens its sockets with the per-socket access settings documented in its `module-access.c`, and [WirePlumber](https://gitlab.freedesktop.org/pipewire/wireplumber) (MIT) keeps those clients at full permissions through its `access.rules`. Wine write watches use the userfaultfd support in [Proton](https://github.com/ValveSoftware/wine)'s `dlls/ntdll/unix/virtual.c` (LGPL-2.1-or-later): libblsession gives it the arm64 syscall number and answers its `PAGEMAP_SCAN` from `/proc/self/pagemap` where Android refuses the ioctl. Wine on arm64 sets a thread's full context by raising `SIGUSR2` from `syscall_dispatcher_return_slowpath` in [Wine](https://gitlab.winehq.org/wine/wine)'s `dlls/ntdll/unix/signal_arm64.c` (LGPL-2.1-or-later); libblsession runs that handler in place on a frame laid out as the [Linux](https://github.com/torvalds/linux) kernel's `arch/arm64/kernel/signal.c` builds it and returns through `rt_sigreturn`, so proot does not stop the thread for it. Wine's process list reads each process's memory counters from `/proc/<pid>/status` in `fill_vm_counters` ([Wine](https://gitlab.winehq.org/wine/wine) `dlls/ntdll/unix/process.c`, LGPL-2.1-or-later), so libblsession gives those reads the kernel's file instead of a copy with `TracerPid` cleared. droiddeck-ntsync is checked against the object, wait and error semantics documented for the [Linux](https://github.com/torvalds/linux) ntsync driverLine truncated
XR glasses support builds on WinNative's VITURE glasses work. VITURE protocol details were checked against [XRLinuxDriver](https://github.com/wheaney/XRLinuxDriver) by [@wheaney](https://github.com/wheaney), including the VITURE protocol header it ships, [ar-drivers-rs](https://github.com/badicsalex/ar-drivers-rs) by [@badicsalex](https://github.com/badicsalex) and the [go-macos/iokit VITURE package](https://pkg.go.dev/github.com/go-macos/iokit/viture); the optional VITURE SDK belongs to VITURE and is not included. RayNeo support adapts [@informalTechCode](https://github.com/informalTechCode)'s [RayNeo-Air-Series-3DoF-Scaffold](https://github.com/informalTechCode/RayNeo-Air-Series-3DoF-Scaffold) (Apache-2.0) and references [@verncat](https://github.com/verncat)'s [RayNeo-Air-3S-Pro-OpenVR](https://github.com/verncat/RayNeo-Air-3S-Pro-OpenVR) (MIT) and [Monado](https://gitlab.freedesktop.org/monado/monado) (BSL-1.0); see [docs/third-party/rayneo](docs/third-party/rayneo/README.md). XREAL 1S support references [XRLinuxDriver](https://github.com/wheaney/XRLinuxDriver) and [xrealOneDeviceKit](https://github.com/wheaney/xrealOneDeviceKit) by @wheaney, [xreal_one_driver](https://github.com/rohitsangwan01/xreal_one_driver) by [@rohitsangwan01](https://github.com/rohitsangwan01) (MIT) and [xr-tools](https://github.com/0xcaff/xr-tools) by [@0xcaff](https://github.com/0xcaff). Rokid support follows the Rokid protocol notes in [ar-drivers-rs](https://github.com/badicsalex/ar-drivers-rs) and @badicsalex's [Void Computing write-ups](https://voidcomputing.hu/blog/worse-better-prettier/), and [Monado](https://gitlab.freedesktop.org/monado/monado)'s Rokid driver. The REDMAGIC glasses-display findings draw on [@mekhontsev](https://github.com/mekhontsev)'s [MagicDesk investigation](https://github.com/mekhontsev/magicdesk/blob/main/docs/xr-resolution-fix.md) and [@Coding-BR](https://github.com/Coding-BR)'s [decompiled Nubia kernel](https://github.com/Coding-BR/android_kernel_nubia_sm8850_qwjujube). VITURE, RayNeo, XREAL, Rokid and REDMAGIC are trademarks of their owners; this project is not affiliated with them.
@@ -53,6 +53,7 @@ class App : Application() {
com.droiddeck.launcher.stores.StoresState.register(com.droiddeck.launcher.stores.amazon.AmazonBackend)
com.droiddeck.launcher.stores.StoresState.register(com.droiddeck.launcher.stores.itch.ItchBackend)
com.droiddeck.launcher.stores.StoresState.register(com.droiddeck.launcher.stores.xbox.XboxBackend)
com.droiddeck.launcher.stores.StoresState.register(com.droiddeck.launcher.stores.battlenet.BattleNetBackend)
}
/** Fetches the packs an existing setup already relies on, so the first use after an update does not wait. */
@@ -139,6 +139,7 @@ class FrontEndActivity : ComponentActivity() {
private var pkgPercent by mutableIntStateOf(-1)
private var desktopInstalled by mutableStateOf(false)
private var desktopPresent by mutableStateOf(false)
private var battleNetInstalled by mutableStateOf(false)
private var offlineAccount by mutableStateOf<String?>(null)
private var offline by mutableStateOf(false)
private var showPerformance by mutableStateOf(false)
@@ -414,6 +415,10 @@ class FrontEndActivity : ComponentActivity() {
private var logsEnabled by mutableStateOf(true)
private var vacDiagnostics by mutableStateOf(false)
private var agentCommands by mutableStateOf(false)
private var clearCachedApps by mutableStateOf(false)
private var adbPaired by mutableStateOf(false)
private var memoryHud by mutableStateOf(SessionPrefs.MEMORY_HUD_OFF)
private var backgroundAppLimit by mutableStateOf(com.droiddeck.launcher.core.BackgroundAppLimit.OFF)
private var showRoms by mutableStateOf(false)
private var homeAppSelected by mutableStateOf(false)
private var homeScreenEnabled by mutableStateOf(false)
@@ -594,6 +599,7 @@ class FrontEndActivity : ComponentActivity() {
when {
!SessionState.running -> startSessionOrWait(next)
SessionState.stopRequested -> android.widget.Toast.makeText(this, R.string.game_link_session_busy, android.widget.Toast.LENGTH_LONG).show()
command.program == com.droiddeck.launcher.session.NoSteamLaunch.BATTLENET && handToBattleNet(command.args, returnHome) { pendingSwitch = next } -> {}
SessionState.mode == SessionService.MODE_RUN && SessionState.program == command.program && SessionState.programArgs == command.args ->
startActivity(Intent(this, SessionActivity::class.java).setAction(SessionService.ACTION_RESUME)
.returnTo(returnHome)
@@ -691,7 +697,8 @@ class FrontEndActivity : ComponentActivity() {
}
private fun startSessionOrWait(next: Intent): Boolean {
val started = startSession(next, steamSession = next.hasExtra(SessionService.EXTRA_STEAM_URL))
val started = startSession(next, steamSession = next.hasExtra(SessionService.EXTRA_STEAM_URL) ||
next.getStringExtra(SessionService.EXTRA_PROGRAM) in setOf(com.droiddeck.launcher.session.NoSteamLaunch.PROTON_RUN, com.droiddeck.launcher.session.NoSteamLaunch.BATTLENET))
if (!started && (busy || LinuxRuntimeInstaller.isBusy())) android.widget.Toast.makeText(this, R.string.main_wait_install_game, android.widget.Toast.LENGTH_SHORT).show()
return started
}
@@ -756,6 +763,7 @@ class FrontEndActivity : ComponentActivity() {
gameSyncFolder = GameFileSync.folder(this)
displayManager = getSystemService(DISPLAY_SERVICE) as DisplayManager
refreshPhantomStatus()
if (!SessionState.running) com.droiddeck.launcher.core.BackgroundAppLimit.restoreAsync(this)
theme = SessionPrefs.theme(this)
frameGenLabel = getString(R.string.frame_gen_off)
appScale = com.droiddeck.launcher.core.AppUiPrefs.scale(this)
@@ -805,6 +813,7 @@ class FrontEndActivity : ComponentActivity() {
offlineAccount = offlineAccount, offline = offline,
frameGenLabel = frameGenLabel, romsDir = romsDir, logsEnabled = logsEnabled,
vacDiagnostics = vacDiagnostics, agentCommands = agentCommands,
clearCachedApps = clearCachedApps, adbPaired = adbPaired, memoryHud = memoryHud, backgroundAppLimit = backgroundAppLimit,
steamGames = steamGames, steamGamesX64 = steamGamesX64, emulators = emulatorList, running = runningLabel,
frameGen = FrameGen.mode(this),
lossless = lossless,
@@ -823,6 +832,7 @@ class FrontEndActivity : ComponentActivity() {
packageStage = pkgStage,
packagePercent = pkgPercent,
sessionRunning = SessionState.running,
battleNetInstalled = battleNetInstalled,
backActionsInverted = backActionsInverted,
buildLabel = BuildConfig.BUILD_LABEL,
oscMode = oscMode,
@@ -911,6 +921,7 @@ class FrontEndActivity : ComponentActivity() {
.putExtra(SessionService.EXTRA_PROGRAM, app.program)
.putExtra(SessionService.EXTRA_PROGRAM_ARGS, app.args.toTypedArray()))
},
onBattleNet = { openBattleNet() },
onFlatpakApp = { id, name ->
Library.flatpakNames[id] = name
startActivity(Intent(this, SessionActivity::class.java)
@@ -965,6 +976,12 @@ class FrontEndActivity : ComponentActivity() {
com.droiddeck.launcher.agent.AgentAccess.setCommandsEnabled(this, !com.droiddeck.launcher.agent.AgentAccess.commandsEnabled(this))
agentCommands = com.droiddeck.launcher.agent.AgentAccess.commandsEnabled(this)
},
onClearCachedApps = { on -> SessionPrefs.setClearCachedApps(this, on); clearCachedApps = on },
onMemoryHud = { value -> SessionPrefs.setMemoryHud(this, value); memoryHud = value },
onBackgroundAppLimit = { limit ->
SessionPrefs.setBackgroundAppLimit(this, limit); backgroundAppLimit = limit
if (limit == com.droiddeck.launcher.core.BackgroundAppLimit.OFF) com.droiddeck.launcher.core.BackgroundAppLimit.restoreAsync(this)
},
onShareLogs = {
SessionLogShare.prepare(this, { SessionLogShare.latest(this) }) { zip ->
if (zip == null) android.widget.Toast.makeText(this, R.string.main_no_logs_yet, android.widget.Toast.LENGTH_LONG).show()
@@ -1322,6 +1339,7 @@ class FrontEndActivity : ComponentActivity() {
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.ui.Motion.refresh(this)
com.droiddeck.launcher.ui.Ambient.poke()
com.droiddeck.launcher.ui.QuitFlood.take()?.let { c ->
@@ -1389,6 +1407,7 @@ class FrontEndActivity : ComponentActivity() {
unregisterReceiver(mediaReceiver)
ui.removeCallbacks(mediaRefresh)
com.droiddeck.launcher.stores.StoresState.libraryListener = null
com.droiddeck.launcher.stores.battlenet.BattleNetClient.opener = null
displayManager.unregisterDisplayListener(secondScreenDisplayListener)
flood = null
returning = null
@@ -1582,6 +1601,50 @@ class FrontEndActivity : ComponentActivity() {
desktopPresent = DesktopCatalog.desktopPresent(this)
}
private fun openBattleNet(args: List<String> = emptyList()) {
if (protons.protonBusyId != null || ProtonExtras.installInProgress || pkgStage != null) {
android.widget.Toast.makeText(this, R.string.main_wait_install_game, android.widget.Toast.LENGTH_SHORT).show()
return
}
val app = applicationContext
Thread({
val full = if (args.firstOrNull() == "--library") args else com.droiddeck.launcher.stores.battlenet.BattleNetClient.library(app) + args
ui.post {
if (isDestroyed) return@post
val next = Intent(this, SessionActivity::class.java)
.putExtra(SessionService.EXTRA_MODE, SessionService.MODE_RUN)
.putExtra(SessionService.EXTRA_PROGRAM, com.droiddeck.launcher.session.NoSteamLaunch.BATTLENET)
.putExtra(SessionService.EXTRA_PROGRAM_ARGS, full.toTypedArray())
when {
!SessionState.running -> startSessionOrWait(next)
SessionState.stopRequested -> android.widget.Toast.makeText(this, R.string.game_link_session_busy, android.widget.Toast.LENGTH_LONG).show()
handToBattleNet(full) { pendingSwitch = next } -> {}
else -> pendingSwitch = next
}
}
}, "battlenet-open").start()
}
private fun handToBattleNet(args: List<String>, returnHome: Boolean = false, otherwise: () -> Unit): Boolean {
if (SessionState.mode != SessionService.MODE_RUN || SessionState.program != com.droiddeck.launcher.session.NoSteamLaunch.BATTLENET) return false
val library = args.takeIf { it.firstOrNull() == "--library" }?.getOrNull(1)
val sessionLibrary = SessionState.programArgs.takeIf { it.firstOrNull() == "--library" }?.getOrNull(1)
if (library != null && sessionLibrary != null && library != sessionLibrary) return false
val request = if (library != null) args.drop(2) else args
val app = applicationContext
Thread({
val handed = request.isEmpty() || com.droiddeck.launcher.stores.battlenet.BattleNetClient.request(LinuxRuntime.sessionRoot(app), request)
ui.post {
if (isDestroyed) return@post
if (!handed) otherwise()
else startActivity(Intent(this, SessionActivity::class.java).setAction(SessionService.ACTION_RESUME)
.returnTo(returnHome)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP))
}
}, "battlenet-request").start()
return true
}
private fun launchProgram(path: String) {
startActivity(Intent(this, SessionActivity::class.java)
.putExtra(SessionService.EXTRA_MODE, SessionService.MODE_RUN)
@@ -2044,6 +2107,7 @@ class FrontEndActivity : ComponentActivity() {
addedGamesArt = SessionPrefs.addedGamesArt(this)
desktopInstalled = DesktopCatalog.desktopInstalled(this)
desktopPresent = DesktopCatalog.desktopPresent(this)
battleNetInstalled = com.droiddeck.launcher.runtime.BattleNet.installed(this)
offlineAccount = OfflineMode.account(this)
offline = OfflineMode.enabled(this)
installed = LinuxRuntimeInstaller.installedVersion(this)
@@ -2054,6 +2118,10 @@ class FrontEndActivity : ComponentActivity() {
logsEnabled = SessionPrefs.logsEnabled(this)
vacDiagnostics = SessionPrefs.vacDiagnostics(this)
agentCommands = com.droiddeck.launcher.agent.AgentAccess.commandsEnabled(this)
clearCachedApps = SessionPrefs.clearCachedApps(this)
adbPaired = WirelessAdbFix.hasSavedPairing(this)
memoryHud = SessionPrefs.memoryHud(this)
backgroundAppLimit = SessionPrefs.backgroundAppLimit(this)
runningLabel = if (SessionState.running) when (SessionState.mode) {
SessionService.MODE_DESKTOP -> getString(R.string.rail_desktop)
SessionService.MODE_RUN -> Library.nameForProgram(SessionState.program)
@@ -2151,6 +2219,7 @@ class FrontEndActivity : ComponentActivity() {
private fun refreshPhantomStatus() {
phantomProcessStatus = PhantomProcessLimit.read(this)
adbPaired = WirelessAdbFix.hasSavedPairing(this)
phantomWarning = if (PhantomProcessLimit.blocksSteam(phantomProcessStatus)) {
getString(
R.string.phantom_warning, PhantomProcessLimit.title(this, phantomProcessStatus),
@@ -155,6 +155,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
private lateinit var sessionOverlay: ComposeView
private lateinit var loading: LoadingState
private lateinit var hud: PerfHud
private lateinit var memoryHud: com.droiddeck.launcher.session.MemoryHud
private var padBridge: PadBridge? = null
private var joyConVr: com.droiddeck.launcher.input.JoyConVr? = null
private var handCamera: com.droiddeck.launcher.handtracking.HandCamera? = null
@@ -572,17 +573,21 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
val needResume = !needRuntime && com.droiddeck.launcher.runtime.DesktopCatalog.interrupted(this).isNotEmpty()
val needDesktop = intent.getStringExtra(SessionService.EXTRA_MODE) == SessionService.MODE_DESKTOP &&
(repair || !com.droiddeck.launcher.runtime.DesktopCatalog.desktopInstalled(this))
val needProton = (intent.getStringExtra(SessionService.EXTRA_MODE) ?: SessionService.MODE_STEAM) == SessionService.MODE_STEAM &&
com.droiddeck.launcher.runtime.DesktopCatalog.protonSeedNeeded(this)
val program = intent.getStringExtra(SessionService.EXTRA_PROGRAM)
val protonUser = (intent.getStringExtra(SessionService.EXTRA_MODE) ?: SessionService.MODE_STEAM) == SessionService.MODE_STEAM ||
program == com.droiddeck.launcher.runtime.BattleNet.PROGRAM || program == com.droiddeck.launcher.session.NoSteamLaunch.PROTON_RUN
val needProton = protonUser && com.droiddeck.launcher.runtime.DesktopCatalog.protonSeedNeeded(this)
if (needRuntime || needResume || needDesktop || needProton) installThenStart(needRuntime, needDesktop, needProton, needResume)
}
hud = PerfHud(this)
memoryHud = com.droiddeck.launcher.session.MemoryHud(this)
hud.onPresentingWindowChanged = {
if (FrameGen.engine(this) != FrameGen.ENGINE_OFF) CompositorHost.rearmFrameGen { applyFrameGen() }
}
if (SessionState.running && SessionState.firstFrameSeen) {
loading.visible = false
hud.start()
memoryHud.start()
}
readPrefs()
@@ -677,7 +682,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
com.droiddeck.launcher.ui.FocusGlideHost(androidx.compose.ui.Modifier.fillMaxSize()) {
CursorOverlay({ cursorPos }, cursorVisible, resources.displayMetrics.density,
cursorImage, cursorHotX, cursorHotY, cursorImageScale)
if (hud.text.isNotEmpty() || hud.graph.size >= 2) HudText(hud.text, hud.graph, hudColor, hudOpacity)
val hudLines = listOf(hud.text, memoryHud.text).filter { it.isNotEmpty() }
if (hudLines.isNotEmpty() || hud.graph.size >= 2)
HudText(hudLines.joinToString("\n"), hud.graph, hudColor, hudOpacity)
val phonePanel = glassesOutputActive && !loading.visible && !drawerOpen && !pcKeyboardOpen
if (phonePanel) GlassesPhonePanel(glasses, steamVrStatus == SteamVr.Status.RUNNING, headTracking)
if (trackingRecovery != null && !drawerOpen && !pcKeyboardOpen && !loading.visible) {
@@ -3056,6 +3063,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
if (!SessionState.suspended) pausedFrame = null
com.droiddeck.launcher.ui.Motion.refresh(this)
refreshHomeApp()
if (::memoryHud.isInitialized && SessionState.running && SessionState.firstFrameSeen) memoryHud.refresh()
if (intent?.action == SessionService.ACTION_RESUME) {
intent.action = null
SessionService.resume(this)
@@ -3501,8 +3509,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
SessionEvents.firstFrame()
if (SessionState.mode == SessionService.MODE_STEAM) SteamRepair.clientShown(this)
runOnUiThread {
if (isFinishing || isDestroyed) return@runOnUiThread
loading.visible = false
hud.start()
memoryHud.start()
}
}
@@ -3520,6 +3530,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
glassesScreen?.let { screen -> glassesScreen = null; runCatching { screen.dismiss() } }
headTracker?.stop()
if (::hud.isInitialized) hud.stop()
if (::memoryHud.isInitialized) memoryHud.stop()
joyConVr?.close()
joyConVr = null
handCamera?.stop()
@@ -0,0 +1,59 @@
package com.droiddeck.launcher.core
import android.content.Context
import android.util.Log
import java.util.concurrent.Executors
object BackgroundAppLimit {
private const val TAG = "BackgroundAppLimit"
const val OFF = -1
val CHOICES = listOf(OFF, 4, 1, 0)
private const val KEY = "max_cached_processes"
private const val STATE = "background-app-limit"
private const val APPLIED = "applied"
private const val PREVIOUS = "previous"
private val worker = Executors.newSingleThreadExecutor { Thread(it, "background-app-limit").apply { isDaemon = true } }
internal fun readCommand() = "device_config get activity_manager $KEY"
internal fun setCommand(limit: Int): String {
require(limit in 0..1024)
return "device_config put activity_manager $KEY $limit"
}
internal fun restoreCommand(previous: String?) =
if (previous == null) "device_config delete activity_manager $KEY" else "device_config put activity_manager $KEY $previous"
internal fun parse(output: String): String? = output.trim().takeIf { it.toIntOrNull() != null }
private fun state(context: Context) = context.applicationContext.getSharedPreferences(STATE, Context.MODE_PRIVATE)
fun applied(context: Context): Boolean = state(context).getBoolean(APPLIED, false)
fun applyAsync(context: Context, limit: Int) {
val app = context.applicationContext
worker.execute {
runCatching {
if (!applied(app)) {
val previous = parse(WirelessAdbFix.shell(app, readCommand()))
check(state(app).edit().putBoolean(APPLIED, true).putString(PREVIOUS, previous).commit()) { "previous value not saved" }
}
WirelessAdbFix.shell(app, setCommand(limit))
}.onSuccess { Log.i(TAG, "at most $limit cached app(s) while the session runs") }
.onFailure { Log.w(TAG, "limit not set: ${it.message}") }
}
}
fun restoreAsync(context: Context) {
val app = context.applicationContext
worker.execute {
if (!applied(app)) return@execute
val previous = state(app).getString(PREVIOUS, null)
runCatching { WirelessAdbFix.shell(app, restoreCommand(previous)) }
.onSuccess {
state(app).edit().putBoolean(APPLIED, false).remove(PREVIOUS).commit()
Log.i(TAG, "cached-app limit put back (${previous ?: "Android's own"})")
}
.onFailure { Log.w(TAG, "limit not put back yet: ${it.message}") }
}
}
}
@@ -182,25 +182,47 @@ object WirelessAdbFix {
}
fun setUsingSavedPairing(context: Context, enabled: Boolean) {
withSavedPairing(context) { appContext, host, port -> setChildProcessLimit(appContext, host, port, enabled) }
}
fun hasSavedPairing(context: Context): Boolean = savedConnection(context.applicationContext) != null
fun clearCachedApps(context: Context) {
shell(context, "am kill-all")
}
fun shell(context: Context, command: String): String {
var output = ""
withSavedPairing(context) { appContext, host, port ->
loadOrCreateIdentity(appContext)
Kadb.create(host, port).use { adb ->
val result = adb.shell(command)
check(result.exitCode == 0) { result.allOutput.ifBlank { appContext.getString(R.string.adbfix_command_failed, result.exitCode) } }
output = result.output
}
saveConnection(appContext, host, port)
}
return output
}
private fun withSavedPairing(context: Context, action: (Context, String, Int) -> Unit) {
val appContext = context.applicationContext
val saved = savedConnection(appContext)
?: error(appContext.getString(R.string.adbfix_no_pairing))
val cachedPort = saved.port
if (cachedPort != null) {
val cachedResult = runCatching {
setChildProcessLimit(appContext, saved.host, cachedPort, enabled)
}
val cachedResult = runCatching { action(appContext, saved.host, cachedPort) }
if (cachedResult.isSuccess) return
val discoveredPort = findConnectPort(appContext, saved.host)
if (discoveredPort != null && discoveredPort != cachedPort) {
setChildProcessLimit(appContext, saved.host, discoveredPort, enabled)
action(appContext, saved.host, discoveredPort)
} else {
cachedResult.getOrThrow()
}
} else {
val discoveredPort = findConnectPort(appContext, saved.host)
?: error(appContext.getString(R.string.adbfix_enter_address))
setChildProcessLimit(appContext, saved.host, discoveredPort, enabled)
action(appContext, saved.host, discoveredPort)
}
}
}
@@ -4,7 +4,9 @@ import android.content.Context
import android.graphics.Bitmap
import android.util.Log
import com.droiddeck.launcher.files.PeIconExtractor
import com.droiddeck.launcher.runtime.BattleNet
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.stores.Store
import com.droiddeck.launcher.stores.StoreArt
import com.droiddeck.launcher.stores.StoreGameSidecar
import org.json.JSONObject
@@ -75,14 +77,18 @@ object AddedGameArt {
)
}
private fun storeArt(context: Context, game: AddedGames.Game): BattleNet.Art? =
if (game.source != Store.BATTLENET.id) null else game.storeId?.let(BattleNet::title)?.let { BattleNet.art(context, it) }
fun resolve(context: Context, game: AddedGames.Game): Art {
val own = local(game)
val cache = cacheDir(context, game)
val store = storeArt(context, game)
fun cached(name: String) = File(cache, name).takeIf { it.isFile }
return Art(
portrait = chosen(cache, Slot.COVER) ?: own.portrait ?: cached("p.jpg") ?: exeArt(context, game, cover = true),
header = chosen(cache, Slot.WIDE) ?: own.header ?: cached("header.jpg") ?: exeArt(context, game, cover = false),
hero = chosen(cache, Slot.BACKGROUND) ?: own.hero ?: cached("hero.jpg"),
portrait = chosen(cache, Slot.COVER) ?: own.portrait ?: store?.cover ?: cached("p.jpg") ?: exeArt(context, game, cover = true),
header = chosen(cache, Slot.WIDE) ?: own.header ?: store?.header ?: cached("header.jpg") ?: exeArt(context, game, cover = false),
hero = chosen(cache, Slot.BACKGROUND) ?: own.hero ?: store?.header ?: cached("hero.jpg"),
logo = chosen(cache, Slot.LOGO) ?: own.logo ?: cached("logo.png"),
icon = chosen(cache, Slot.ICON) ?: own.icon ?: cached("icon-sgdb.png") ?: exeIcon(context, game),
)
@@ -91,15 +97,16 @@ object AddedGameArt {
fun describe(context: Context, game: AddedGames.Game): List<SlotState> {
val own = local(game)
val cache = cacheDir(context, game)
val store = storeArt(context, game)
fun cached(name: String): Pair<File, String>? = File(cache, name).takeIf { it.isFile }?.let { f ->
f to (File(cache, "$name.src").takeIf { it.isFile }?.readText()?.trim()?.takeIf { it.isNotEmpty() } ?: STEAM)
}
return Slot.values().map { slot ->
chosen(cache, slot)?.let { return@map SlotState(slot, it, chosenSource(context, game, slot).first.ifEmpty { FILE }, true) }
val auto: Pair<File, String>? = when (slot) {
Slot.COVER -> own.portrait?.let { it to FOLDER } ?: cached("p.jpg") ?: exeArt(context, game, cover = true)?.let { it to EXE }
Slot.WIDE -> own.header?.let { it to FOLDER } ?: cached("header.jpg") ?: exeArt(context, game, cover = false)?.let { it to EXE }
Slot.BACKGROUND -> own.hero?.let { it to FOLDER } ?: cached("hero.jpg")
Slot.COVER -> own.portrait?.let { it to FOLDER } ?: store?.cover?.let { it to AUTO } ?: cached("p.jpg") ?: exeArt(context, game, cover = true)?.let { it to EXE }
Slot.WIDE -> own.header?.let { it to FOLDER } ?: store?.header?.let { it to AUTO } ?: cached("header.jpg") ?: exeArt(context, game, cover = false)?.let { it to EXE }
Slot.BACKGROUND -> own.hero?.let { it to FOLDER } ?: store?.header?.let { it to AUTO } ?: cached("hero.jpg")
Slot.LOGO -> own.logo?.let { it to FOLDER } ?: cached("logo.png")
Slot.ICON -> own.icon?.let { it to FOLDER } ?: File(cache, "icon-sgdb.png").takeIf { it.isFile }?.let { it to SGDB }
?: exeIcon(context, game)?.let { it to EXE }
@@ -253,12 +260,13 @@ object AddedGameArt {
internal fun missing(context: Context, game: AddedGames.Game): Set<Slot> {
val own = local(game)
val cache = cacheDir(context, game)
val store = storeArt(context, game)
fun has(slot: Slot, mine: File?, cached: String) = chosen(cache, slot) != null || mine != null || File(cache, cached).isFile
return Slot.values().filterNot { slot ->
when (slot) {
Slot.COVER -> has(slot, own.portrait, "p.jpg")
Slot.WIDE -> has(slot, own.header, "header.jpg")
Slot.BACKGROUND -> has(slot, own.hero, "hero.jpg")
Slot.COVER -> has(slot, own.portrait ?: store?.cover, "p.jpg")
Slot.WIDE -> has(slot, own.header ?: store?.header, "header.jpg")
Slot.BACKGROUND -> has(slot, own.hero ?: store?.header, "hero.jpg")
Slot.LOGO -> has(slot, own.logo, "logo.png")
Slot.ICON -> has(slot, own.icon, "icon-sgdb.png")
}
@@ -322,6 +330,10 @@ object AddedGameArt {
}
internal fun steamMatch(context: Context, game: AddedGames.Game, search: (String) -> Int?): SteamMatch.Match {
if (game.source == Store.BATTLENET.id) {
val id = game.storeId?.let(BattleNet::title)?.steam
return SteamMatch.Match(id, if (id == null) SteamMatch.Certainty.NONE else SteamMatch.Certainty.FILES, Store.BATTLENET.id, System.currentTimeMillis())
}
val match = SteamMatch.resolve(context, game.folder.path, game.exe, game.name, legacy = File(cacheDir(context, game), "steam-appid"), search = search)
match.appId?.let { Log.i(TAG, "${game.name}: Steam app $it (${match.certainty.name.lowercase()})") }
return match
@@ -361,14 +373,14 @@ object AddedGameArt {
.filter { it.second > 0 && it.first.isNotEmpty() }
.maxByOrNull { it.second }?.first
private fun search(name: String): String? {
internal fun search(name: String): String? {
val term = name.replace(EDITION, " ").trim().ifEmpty { name }
val json = get(STORE_SEARCH + URLEncoder.encode(term, "UTF-8"))?.toString(Charsets.UTF_8) ?: return null
val items = JSONObject(json).optJSONArray("items") ?: return null
return pickStoreResult(name, (0 until items.length()).map { items.getJSONObject(it) }.map { it.optString("id") to it.optString("name") })
}
private fun download(id: String, cache: File, slots: Set<Slot>): Boolean {
internal fun download(id: String, cache: File, slots: Set<Slot> = Slot.entries.toSet()): Boolean {
var got = false
for ((slot, remote, localName) in listOf(
Triple(Slot.COVER, "library_600x900.jpg", "p.jpg"), Triple(Slot.WIDE, "header.jpg", "header.jpg"),
@@ -79,6 +79,18 @@ object AddedGames {
return null
}
fun hostPath(context: Context, guest: String): File? {
if (!guest.startsWith("/") || guest.split('/').any { it == ".." }) return null
val mapped = roots(context).map { it.host to it.guest } + StoreInstallRoot.externalRoots(context) +
listOfNotNull(GameStorage.effective(context)?.let { File(it.path) to LIBRARY }) +
(android.os.Environment.getExternalStorageDirectory() to "/root/Storage")
for ((host, root) in mapped.sortedByDescending { it.second.length }) {
if (guest == root) return host
if (guest.startsWith("$root/")) return File(host, guest.removePrefix("$root/"))
}
return File(LinuxRuntime.rootDir(context), guest.removePrefix("/"))
}
fun candidates(folder: File): List<File> = rank(folder).exes
fun rank(folder: File): GameExePicker.Ranking {
@@ -177,6 +189,9 @@ object AddedGames {
scanGame(context, folder, out, single = entry)
}
for (folder in StoreInstallRoot.gameFolders(context)) if (StoreInstallRoot.isFinished(folder)) scanGame(context, folder, out)
for (game in com.droiddeck.launcher.runtime.BattleNet.games(context)) {
if (game.folder.path !in removed) com.droiddeck.launcher.runtime.BattleNet.shortcut(context, game)?.let(out::add)
}
return out.distinctBy { it.folder.canonicalPath }
}
@@ -11,7 +11,7 @@ object GameRemoval {
enum class Kind { STORE, SHORTCUT, LAUNCHER }
fun kind(game: Library.SteamGame): Kind = when {
game.library == Library.EPIC_LAUNCHER -> Kind.LAUNCHER
game.library == Library.EPIC_LAUNCHER || game.library == Library.BATTLENET_LAUNCHER -> Kind.LAUNCHER
game.library == Library.ADDED && game.source == Library.ADDED -> Kind.SHORTCUT
else -> Kind.STORE
}
@@ -22,11 +22,16 @@ object Library {
SteamGame(appId, name, art, library, gameId, hero, lastPlayed, gameFiles, protonPrefix, icon, source, storeId, logo)
val gameIdString: String get() = java.lang.Long.toUnsignedString(gameId)
val profileKey: String get() = if (library == ADDED) java.lang.Integer.toUnsignedString(appId) else appId.toString()
val profileKey: String get() = when {
source == com.droiddeck.launcher.stores.Store.BATTLENET.id -> com.droiddeck.launcher.runtime.BattleNet.APP_ID.toString()
library == ADDED -> java.lang.Integer.toUnsignedString(appId)
else -> appId.toString()
}
}
const val ADDED = "added"
const val EPIC_LAUNCHER = "epic-launcher"
const val EPIC_LAUNCHER_NAME = "Epic Games Launcher"
const val BATTLENET_LAUNCHER = "battlenet-launcher"
const val XBOX_CLOUD = "xbox-cloud"
const val SOURCE_STEAM = "steam"
@@ -238,7 +243,8 @@ object Library {
SteamGame(
g.steamAppId ?: g.appId.toInt(), g.name, art.portrait ?: art.header, ADDED, g.gameId,
hero = art.hero ?: art.header, lastPlayed = lastPlayed, gameFiles = g.folder,
protonPrefix = protonPrefix(context, g.steamAppId?.toLong() ?: g.appId, libraries = roots),
protonPrefix = if (g.source == com.droiddeck.launcher.stores.Store.BATTLENET.id) File(com.droiddeck.launcher.runtime.BattleNet.prefix(context), "pfx").takeIf { it.isDirectory }
else protonPrefix(context, g.steamAppId?.toLong() ?: g.appId, libraries = roots),
icon = art.icon?.takeIf { it.extension.lowercase() != "ico" },
source = g.source, storeId = g.storeId,
logo = art.logo,
@@ -0,0 +1,410 @@
package com.droiddeck.launcher.runtime
import android.app.ActivityManager
import android.content.Context
import android.util.Log
import com.droiddeck.launcher.session.ComponentsManager
import com.droiddeck.launcher.session.GameEnvironmentStore
import java.io.File
object BattleNet {
private const val TAG = "BattleNet"
const val APP_ID = 2596113170L
const val FEX_REQUEST = "battlenet-fex.request"
const val FEX_RESULT = "battlenet-fex.result"
const val PROGRAM = "/usr/local/bin/droiddeck-battlenet"
class Title(val uid: String, val name: String, val code: String, val steam: Int? = null, val shop: String? = null)
internal val TITLES = listOf(
Title("wow", "World of Warcraft", "WoW", shop = "world-of-warcraft-midnight"),
Title("wow_classic", "World of Warcraft Classic", "WoWC", shop = "world-of-warcraft-burning-crusade-classic-anniversary-edition-upgrades"),
Title("wow_classic_era", "World of Warcraft Classic", "WoWC"),
Title("wow_classic_anniversary", "World of Warcraft Classic", "WoWC"),
Title("diablo3", "Diablo III", "D3", shop = "diablo-iii"),
Title("d3cn", "Diablo III", "D3CN", shop = "diablo-iii"),
Title("s2", "StarCraft II", "S2", shop = "starcraft-ii"),
Title("s1", "StarCraft", "S1", shop = "starcraft-remastered"),
Title("hs_beta", "Hearthstone", "WTCG", shop = "hearthstone"),
Title("heroes", "Heroes of the Storm", "Hero", shop = "heroes-of-the-storm"),
Title("prometheus", "Overwatch 2", "Pro", 2357570, shop = "overwatch"),
Title("w3", "Warcraft III: Reforged", "W3", shop = "warcraft-3-reforged"),
Title("viper", "Call of Duty: Black Ops 4", "VIPR", shop = "call-of-duty-black-ops-4"),
Title("odin", "Call of Duty: Modern Warfare", "ODIN", 2000950, shop = "call-of-duty-modern-warfare"),
Title("lazarus", "Call of Duty: Modern Warfare 2 Campaign Remastered", "LAZR", shop = "call-of-duty-modern-warfare-2-campaign-remastered"),
Title("zeus", "Call of Duty: Black Ops Cold War", "ZEUS", shop = "call-of-duty-black-ops-cold-war"),
Title("fore", "Call of Duty: Vanguard", "FORE", shop = "call-of-duty-vanguard"),
Title("auks", "Call of Duty: Modern Warfare II", "AUKS", shop = "call-of-duty-modern-warfare-ii"),
Title("pinta", "Call of Duty: Modern Warfare III", "PNTA", 2519060, shop = "call-of-duty-modern-warfare-iii"),
Title("wlby", "Crash Bandicoot 4: It's About Time", "WLBY", 1378990, shop = "crash-bandicoot-4"),
Title("osi", "Diablo II: Resurrected", "OSI"),
Title("rtro", "Blizzard Arcade Collection", "RTRO", shop = "blizzard-arcade-collection"),
Title("anbs", "Diablo Immortal", "ANBS", shop = "diablo-immortal"),
Title("fenris", "Diablo IV", "Fen", 2344520, shop = "diablo-iv"),
Title("fen", "Diablo IV", "Fen", 2344520, shop = "diablo-iv"),
Title("d1", "Diablo", "D1", shop = "diablo"),
Title("w1", "Warcraft: Orcs & Humans", "W1", shop = "warcraft-orcs-and-humans"),
Title("w2", "Warcraft II: Battle.net Edition", "W2", shop = "warcraft-2-battle-net-edition"),
Title("w1r", "Warcraft: Remastered", "W1R", shop = "warcraft-1-remastered"),
Title("w2r", "Warcraft II: Remastered", "W2R", shop = "warcraft-2-remastered"),
Title("gryphon", "Warcraft Rumble", "GRY", shop = "warcraft-rumble"),
Title("aris", "Doom: The Dark Ages", "ARIS", 3017860, shop = "doom-the-dark-ages"),
Title("scorpio", "Sea of Thieves", "SCOR", 1172620, shop = "sea-of-thieves"),
Title("arkansas", "The Outer Worlds 2", "ARK", 1449110, shop = "the-outer-worlds-2"),
Title("libra", "Tony Hawk's Pro Skater 3 + 4", "LBRA", 2545710),
Title("aqua", "Avowed", "AQUA", 2457220, shop = "avowed"),
)
val STORE: List<Title> get() = TITLES.distinctBy { it.code }.filter { it.uid != "d3cn" && it.code != "WoWC" }
fun notInstalled(title: Title, installedIds: Collection<String?>) =
installedIds.mapNotNull { id -> id?.let(::title)?.code }.none { it == title.code }
private const val COVER_RETRY_MS = 24 * 3600_000L
private fun coverDir(context: Context, title: Title) =
File(context.filesDir, "battlenet-art/${(TITLES.firstOrNull { it.code == title.code } ?: title).uid}")
fun cover(context: Context, title: Title): File? = art(context, title).cover
private val coverLock = Any()
fun fetchCovers(context: Context, titles: List<Title> = TITLES.distinctBy { it.code }.filter { it.uid != "d3cn" }): Boolean = synchronized(coverLock) {
val art = com.droiddeck.launcher.frontend.AddedGameArt
val key = com.droiddeck.launcher.frontend.SteamGridDb.key(context)
var got = false
for (title in titles) {
val dir = coverDir(context, title)
val tried = File(dir, ".tried")
val wide = File(dir, BLIZZARD)
val done = File(dir, "p.jpg").isFile && (title.shop == null || wide.isFile)
if (done || System.currentTimeMillis() - tried.lastModified() < COVER_RETRY_MS) continue
dir.mkdirs()
if (title.steam != null && runCatching { art.download(title.steam.toString(), dir) }.getOrDefault(false)) got = true
if (title.shop != null && !wide.isFile) {
val cover = File(dir, BLIZZARD_COVER).takeUnless { File(dir, "p.jpg").isFile }
if (runCatching { com.droiddeck.launcher.stores.battlenet.BlizzardArt.fetch(title.shop, wide, cover) }
.onFailure { Log.w(TAG, "Blizzard art for ${title.uid}: ${it.javaClass.simpleName}") }.getOrDefault(false)) got = true
}
if (!File(dir, "p.jpg").isFile && !File(dir, BLIZZARD_COVER).isFile && key.isNotEmpty()) {
val id = runCatching { com.droiddeck.launcher.frontend.SteamGridDb.gameId(key, title.steam, title.name) }.getOrNull()
if (id != null && runCatching { com.droiddeck.launcher.frontend.SteamGridDb.download(key, id, dir) }.getOrDefault(false)) got = true
}
runCatching { tried.writeText("") ; tried.setLastModified(System.currentTimeMillis()) }
}
got
}
private val LOCALES = setOf(
"enus", "engb", "dede", "eses", "esmx", "frfr", "itit", "kokr", "plpl", "ptbr", "ptpt", "ruru", "zhcn", "zhtw", "jajp", "thth", "trtr", "arsa",
)
private val NOT_GAMES = setOf("agent", "bna", "battle.net")
class Game(val uid: String, val name: String, val code: String, val folder: File) {
val title: Title get() = title(uid) ?: Title(uid, name, code)
}
class Art(val cover: File?, val header: File?)
private const val BLIZZARD = "blizzard.jpg"
private const val BLIZZARD_COVER = "p-blizzard.jpg"
fun art(context: Context, title: Title): Art {
val dir = coverDir(context, title)
fun first(vararg names: String) = names.map { File(dir, it) }.firstOrNull { it.isFile }
return Art(first("p.jpg", BLIZZARD_COVER), first(BLIZZARD, "header.jpg"))
}
fun prefix(context: Context) = File(LinuxRuntime.rootDir(context), "root/.local/share/Steam/steamapps/compatdata/$APP_ID")
fun client(context: Context) = File(prefix(context), "pfx/drive_c/Program Files (x86)/Battle.net/Battle.net.exe")
fun installed(context: Context) = File(prefix(context), "pfx/drive_c/Program Files (x86)/Battle.net/Battle.net Launcher.exe").isFile
fun profile(context: Context): Pair<String, String>? =
(APP_ID.toString() to context.getString(com.droiddeck.launcher.R.string.bnet_name)).takeIf { installed(context) }
fun icon(context: Context): File? {
val out = File(context.filesDir, "battlenet-art/launcher/icon.png")
if (out.isFile) return out
val exe = client(context).takeIf { it.isFile } ?: return null
val bitmap = runCatching { com.droiddeck.launcher.files.PeIconExtractor.extract(exe) }.getOrNull() ?: return null
return runCatching {
out.parentFile?.mkdirs()
val tmp = File(out.path + ".tmp")
tmp.outputStream().use { check(bitmap.compress(android.graphics.Bitmap.CompressFormat.PNG, 100, it)) }
check(tmp.renameTo(out))
out
}.getOrNull()
}
fun launcherEntry(installed: Boolean, art: File? = null): com.droiddeck.launcher.frontend.Library.SteamGame? =
if (!installed) null
else com.droiddeck.launcher.frontend.Library.SteamGame(
appId = APP_ID.toInt(), name = com.droiddeck.launcher.stores.Store.BATTLENET.label, art = art,
library = com.droiddeck.launcher.frontend.Library.BATTLENET_LAUNCHER, gameId = APP_ID,
source = com.droiddeck.launcher.stores.Store.BATTLENET.id,
)
fun fexInUse(context: Context): String? = ComponentsManager.gameComponents(context, APP_ID.toString())["fex"]
internal fun title(uid: String): Title? {
val id = uid.lowercase()
TITLES.firstOrNull { it.uid == id }?.let { return it }
val base = id.substringBeforeLast('_', "")
return if (base.isNotEmpty() && id.substringAfterLast('_') in LOCALES) TITLES.firstOrNull { it.uid == base } else null
}
fun games(context: Context): List<Game> {
val pfx = File(prefix(context), "pfx")
val entries = runCatching { File(pfx, "system.reg").useLines { uninstallEntries(it) } }.getOrDefault(emptyList()) +
runCatching { productDbEntries(File(pfx, "drive_c/ProgramData/Battle.net/Agent/product.db").readBytes()) }.getOrDefault(emptyList())
val found = LinkedHashMap<String, Game>()
for ((uid, path) in entries) {
val title = title(uid)
if (title == null) {
if (uid.lowercase() !in NOT_GAMES) Log.i(TAG, "not listed: $uid (no launch code known)")
continue
}
if (title.code in found) continue
val folder = hostFolder(context, path)?.takeIf { it.isDirectory } ?: continue
found[title.code] = Game(title.uid, title.name, title.code, folder)
}
return found.values.toList()
}
internal fun hostFolder(context: Context, path: String): File? {
val drive = Regex("""^([CcZz]):[\\/](.*)$""").matchEntire(path.trim()) ?: return null
val relative = drive.groupValues[2].replace('\\', '/').trim('/')
if (relative.isEmpty() || relative.split('/').any { it == ".." }) return null
return if (drive.groupValues[1].equals("c", ignoreCase = true)) File(prefix(context), "pfx/drive_c/$relative")
else com.droiddeck.launcher.frontend.AddedGames.hostPath(context, "/$relative")
}
private val KEY = Regex("""^\[(.+)\](?:\s+\d+)?\s*$""")
private val UNINSTALL = Regex("""(?i)\\CurrentVersion\\Uninstall\\[^\\]+$""")
private val VALUE = Regex("""^"((?:[^"\\]|\\.)*)"=(?:str\(\d+\):)?"((?:[^"\\]|\\.)*)"\s*$""")
private val UID = Regex("""--uid=([A-Za-z0-9_.-]+)""")
internal fun uninstallEntries(lines: Sequence<String>): List<Pair<String, String>> {
val out = ArrayList<Pair<String, String>>()
var inside = false
var uid: String? = null
var location: String? = null
fun flush() {
val u = uid
val l = location
if (u != null && l != null) out.add(u to l)
uid = null
location = null
}
for (line in lines) {
if (line.startsWith("[")) {
flush()
inside = KEY.matchEntire(line)?.groupValues?.get(1)?.let { UNINSTALL.containsMatchIn(unescape(it)) } == true
continue
}
if (!inside) continue
val value = VALUE.matchEntire(line) ?: continue
val text = unescape(value.groupValues[2])
when (unescape(value.groupValues[1]).lowercase()) {
"uninstallstring" -> if (text.contains("battle.net", ignoreCase = true)) uid = UID.find(text)?.groupValues?.get(1)
"installlocation" -> location = text
}
}
flush()
return out
}
private fun unescape(s: String): String {
val out = StringBuilder(s.length)
var i = 0
while (i < s.length) {
val c = s[i++]
if (c != '\\' || i >= s.length) { out.append(c); continue }
when (val e = s[i++]) {
'n' -> out.append('\n')
'r' -> out.append('\r')
't' -> out.append('\t')
'0' -> out.append('\u0000')
'x' -> {
var end = i
while (end < s.length && end - i < 4 && s[end].lowercaseChar() in "0123456789abcdef") end++
if (end > i) { out.append(s.substring(i, end).toInt(16).toChar()); i = end } else out.append('x')
}
else -> out.append(e)
}
}
return out.toString()
}
internal fun productDbEntries(bytes: ByteArray): List<Pair<String, String>> {
val installs = runCatching { fields(bytes, 0, bytes.size) }.getOrDefault(emptyList()).filter { it.first == 1 }
return installs.mapNotNull { (_, start, end) ->
runCatching {
val install = fields(bytes, start, end)
val uid = install.firstOrNull { it.first == 1 }?.let { String(bytes, it.second, it.third - it.second) }
val path = install.firstOrNull { it.first == 3 }?.let { s -> fields(bytes, s.second, s.third).firstOrNull { it.first == 1 } }
?.let { String(bytes, it.second, it.third - it.second) }
val installed = install.firstOrNull { it.first == 4 }?.let { s -> fields(bytes, s.second, s.third).firstOrNull { it.first == 1 } }
?.let { s -> varints(bytes, s.second, s.third)[1] }
if (uid.isNullOrEmpty() || path.isNullOrEmpty() || installed == 0L) null else uid to path
}.getOrNull()
}
}
private fun fields(bytes: ByteArray, from: Int, to: Int): List<Triple<Int, Int, Int>> = walk(bytes, from, to) { _, _ -> }
private fun varints(bytes: ByteArray, from: Int, to: Int): Map<Int, Long> =
HashMap<Int, Long>().also { found -> walk(bytes, from, to) { field, value -> found.putIfAbsent(field, value) } }
private fun walk(bytes: ByteArray, from: Int, to: Int, varint: (Int, Long) -> Unit): List<Triple<Int, Int, Int>> {
val out = ArrayList<Triple<Int, Int, Int>>()
var i = from
fun next(): Long {
var value = 0L
var shift = 0
while (true) {
require(i < to && shift < 64) { "truncated" }
val b = bytes[i++].toInt() and 0xff
value = value or ((b and 0x7f).toLong() shl shift)
if (b < 0x80) return value
shift += 7
}
}
while (i < to) {
val key = next()
when ((key and 7).toInt()) {
0 -> varint((key ushr 3).toInt(), next())
1 -> { require(to - i >= 8) { "truncated" }; i += 8 }
2 -> {
val n = next()
require(n in 0..(to - i).toLong()) { "truncated" }
out.add(Triple((key ushr 3).toInt(), i, i + n.toInt()))
i += n.toInt()
}
5 -> { require(to - i >= 4) { "truncated" }; i += 4 }
else -> error("wire type ${key and 7}")
}
}
return out
}
fun shortcut(context: Context, game: Game): com.droiddeck.launcher.frontend.AddedGames.Game? {
val added = com.droiddeck.launcher.frontend.AddedGames
val client = client(context)
val guestExe = added.guestPath(context, client) ?: return null
val guestDir = added.guestPath(context, client.parentFile ?: return null) ?: return null
val guestPrefix = added.guestPath(context, prefix(context)) ?: return null
val crc = java.util.zip.CRC32().apply { update("\"$guestExe\"${game.name}".toByteArray()) }.value
val appId = com.droiddeck.launcher.session.SessionPrefs.addedGameAppId(context, game.folder.path, crc or 0x80000000L)
val exe = added.candidates(game.folder).firstOrNull() ?: client
return com.droiddeck.launcher.frontend.AddedGames.Game(
game.folder, game.name, exe, guestExe, guestDir, appId, (appId shl 32) or 0x02000000L, listOf(exe),
source = com.droiddeck.launcher.stores.Store.BATTLENET.id, storeId = game.uid,
launchOptions = "STEAM_COMPAT_DATA_PATH=$guestPrefix %command% --exec=\"launch ${game.code}\"",
)
}
fun remove(context: Context) {
val root = LinuxRuntime.rootDir(context)
com.droiddeck.launcher.core.FileUtils.delete(prefix(context))
File(root, "usr/local/share/applications/droiddeck-battlenet.desktop").delete()
com.droiddeck.launcher.core.FileUtils.delete(File(root, "root/.cache/droiddeck/battlenet"))
ComponentsManager.clearGameComponents(context, APP_ID.toString())
Log.i(TAG, "removed")
}
private val D2RFIX = Regex("""(?i)FEXCore-(\d+(?:\.\d+)*)-d2rfix(\d+)-linux\.wcp""")
private const val LISTING_MAX_AGE = 6 * 3600L
private val NEWEST = Comparator<Pair<List<Long>, Long>> { a, b ->
for (i in 0 until minOf(a.first.size, b.first.size)) if (a.first[i] != b.first[i]) return@Comparator a.first[i].compareTo(b.first[i])
if (a.first.size != b.first.size) a.first.size.compareTo(b.first.size) else a.second.compareTo(b.second)
}
internal fun d2rfix(file: String): Pair<List<Long>, Long>? {
val m = D2RFIX.matchEntire(file) ?: return null
val version = m.groupValues[1].split('.').map { it.toLongOrNull() ?: return null }
return version to (m.groupValues[2].toLongOrNull() ?: return null)
}
internal fun newestD2rFix(items: List<ComponentsManager.CatalogItem>): ComponentsManager.CatalogItem? =
items.filter { it.comp == "fex" }.mapNotNull { item -> d2rfix(item.file)?.let { item to it } }
.maxWithOrNull { a, b -> NEWEST.compare(a.second, b.second) }?.first
fun ensureFex(context: Context): String = ensureFex(context) { ComponentsManager.catalog(it, true).items }
@Synchronized
internal fun ensureFex(context: Context, refresh: (Context) -> List<ComponentsManager.CatalogItem>): String {
val item = newestD2rFix(listing(context, refresh)) ?: error("no d2rfix FEXCore build in the Nightlies listing")
val file = ComponentsManager.safeName(item.file)
if (ComponentsManager.packages(context).none { it.file == file }) {
Log.i(TAG, "downloading ${item.file}")
ComponentsManager.download(context, item) {}
}
val scope = APP_ID.toString()
if (ComponentsManager.gameComponents(context, scope)["fex"] != file) {
ComponentsManager.setGameComponent(context, scope, "fex", file)
Log.i(TAG, "FEX for the Battle.net prefix: $file")
}
return file
}
private fun listing(context: Context, refresh: (Context) -> List<ComponentsManager.CatalogItem>): List<ComponentsManager.CatalogItem> {
val cached = ComponentsManager.catalog(context, false)
val age = System.currentTimeMillis() / 1000 - cached.fetchedAt
if (age in 0 until LISTING_MAX_AGE && newestD2rFix(cached.items) != null) return cached.items
val fetched = runCatching { refresh(context) }
.onFailure { Log.w(TAG, "Nightlies listing: ${it.message}") }.getOrNull().orEmpty()
return if (newestD2rFix(fetched) != null) fetched else cached.items
}
internal fun videoMemory(totalMb: Long): Int = (totalMb / 5 / 512 * 512).coerceIn(1536, 3584).toInt()
internal fun videoMemoryOptions(megabytes: Int): String =
"dxgi.maxDeviceMemory = $megabytes; dxgi.maxSharedMemory = $megabytes; d3d9.maxAvailableMemory = $megabytes"
fun ensureVideoMemory(context: Context): Boolean {
val memory = ActivityManager.MemoryInfo()
context.getSystemService(ActivityManager::class.java)?.getMemoryInfo(memory) ?: return false
if (memory.totalMem <= 0) return false
val options = videoMemoryOptions(videoMemory(memory.totalMem / (1024 * 1024)))
val set = GameEnvironmentStore.setDefault(context, APP_ID.toString(), DXVK_CONFIG, options)
if (set) Log.i(TAG, "DXVK_CONFIG for the Battle.net profile: $options")
return set
}
private const val DXVK_CONFIG = "DXVK_CONFIG"
fun ensureNoSteam(context: Context): Boolean {
if (com.droiddeck.launcher.session.SessionPrefs.battleNetNoSteamSet(context)) return false
GameEnvironmentStore.setGameNoSteam(context, APP_ID.toString(), true)
com.droiddeck.launcher.session.SessionPrefs.setBattleNetNoSteamSet(context)
Log.i(TAG, "Start without Steam for the Battle.net profile")
return true
}
fun answerFexRequest(context: Context, dir: File) {
val app = context.applicationContext
Thread({
runCatching { ensureVideoMemory(app) }.onFailure { Log.w(TAG, "video memory cap for the Battle.net profile", it) }
runCatching { ensureNoSteam(app) }.onFailure { Log.w(TAG, "Start without Steam for the Battle.net profile", it) }
val answer = try {
"ok " + ensureFex(app)
} catch (e: Exception) {
Log.w(TAG, "FEX for the Battle.net prefix", e)
"error " + (e.message ?: e.javaClass.simpleName)
}
Log.i(TAG, "FEX request: $answer")
val result = File(dir, FEX_RESULT)
val partial = File(dir, "$FEX_RESULT.tmp")
runCatching { partial.writeText(answer.replace('\n', ' ') + "\n"); partial.renameTo(result) }
}, "battlenet-fex").start()
}
}
@@ -900,6 +900,7 @@ object ComponentsManager {
.put("url", a.optString("browser_download_url")).put("size", a.optLong("size")).put("digest", a.optString("digest")))
}
}
if (items.length() == 0 && cache.isFile) runCatching { return parseCatalog(JSONObject(cache.readText())) }
val out = JSONObject().put("items", items).put("fetchedAt", System.currentTimeMillis() / 1000)
val tmp = File(cache.parentFile, cache.name + ".tmp")
tmp.writeText(out.toString()); tmp.renameTo(cache)
@@ -78,6 +78,14 @@ object GameEnvironmentStore {
return config
}
@Synchronized
fun setDefault(context: Context, scope: String, name: String, value: String): Boolean {
val config = read(context)
if (GameEnvironment.hasOverride(config, scope, name)) return false
save(context, GameEnvironment.withScopeValue(config, scope, name, value))
return true
}
@Synchronized
fun publish(context: Context, config: GameEnvironment.Config = read(context)) {
val resolved = config.copy(shared = GameEnvironment.defaults(SessionPrefs.fexPreset(context), SessionPrefs.forceSsbs(context)) + config.shared)
@@ -0,0 +1,175 @@
package com.droiddeck.launcher.session
import android.content.Context
import android.os.Handler
import android.os.Looper
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import com.droiddeck.launcher.R
import java.io.File
import java.util.Locale
internal object MemoryReadout {
data class Device(val totalKb: Long, val availableKb: Long, val swapTotalKb: Long, val swapFreeKb: Long) {
val usedKb get() = (totalKb - availableKb).coerceAtLeast(0)
val swapUsedKb get() = (swapTotalKb - swapFreeKb).coerceAtLeast(0)
}
data class Split(val gameKb: Long, val droiddeckKb: Long, val gpuKb: Long?)
fun parseMeminfo(text: String): Device? {
fun field(name: String) = Regex("""(?m)^$name:\s+(\d+) kB""").find(text)?.groupValues?.get(1)?.toLongOrNull()
val total = field("MemTotal") ?: return null
val available = field("MemAvailable") ?: return null
return Device(total, available, field("SwapTotal") ?: 0, field("SwapFree") ?: 0)
}
fun residentKb(status: String): Long {
fun field(name: String) = Regex("""(?m)^$name:\s+(\d+) kB""").find(status)?.groupValues?.get(1)?.toLongOrNull() ?: 0
return field("RssAnon") + field("RssShmem")
}
fun inWinePrefix(environ: ByteArray): Boolean {
var start = 0
val key = "WINEPREFIX=".toByteArray()
for (i in 0..environ.size) {
if (i == environ.size || environ[i] == 0.toByte()) {
if (i - start >= key.size && (key.indices).all { environ[start + it] == key[it] }) return true
start = i + 1
}
}
return false
}
fun androidKb(device: Device, split: Split): Long =
(device.usedKb - split.gameKb - split.droiddeckKb - (split.gpuKb ?: 0)).coerceAtLeast(0)
fun gb(kb: Long): String = String.format(Locale.US, "%.1f", kb / (1024.0 * 1024.0))
fun availableMb(): Long? = runCatching { parseMeminfo(File("/proc/meminfo").readText())?.availableKb?.div(1024) }.getOrNull()
fun device(): Device? = runCatching { parseMeminfo(File("/proc/meminfo").readText()) }.getOrNull()
fun split(root: Int = android.os.Process.myPid()): Split {
val parents = HashMap<Int, Int>()
File("/proc").listFiles()?.forEach { entry ->
val pid = entry.name.toIntOrNull() ?: return@forEach
parentOf(pid)?.let { parents[pid] = it }
}
val children = parents.entries.groupBy({ it.value }, { it.key })
var game = 0L
var droiddeck = 0L
val queue = ArrayDeque<Int>().apply { add(root) }
val seen = HashSet<Int>()
while (queue.isNotEmpty()) {
val pid = queue.removeFirst()
if (!seen.add(pid)) continue
val status = runCatching { File("/proc/$pid/status").readText() }.getOrNull()
if (status != null) {
val kb = residentKb(status)
val windows = pid != root && runCatching { inWinePrefix(File("/proc/$pid/environ").readBytes()) }.getOrDefault(false)
if (windows) game += kb else droiddeck += kb
}
children[pid]?.let(queue::addAll)
}
return Split(game, droiddeck, gpuKb())
}
private fun parentOf(pid: Int): Int? {
val stat = runCatching { File("/proc/$pid/stat").readText() }.getOrNull() ?: return null
val close = stat.lastIndexOf(')')
if (close < 0 || close + 2 >= stat.length) return null
return stat.substring(close + 2).split(' ').getOrNull(1)?.toIntOrNull()
}
private fun gpuKb(): Long? = runCatching {
File("/sys/class/kgsl/kgsl/page_alloc").readText().trim().split(Regex("\\s+"))[0].toLong() / 1024
}.getOrNull()
}
object MemoryLog {
private const val TAG = "Memory"
private const val PERIOD_MS = 10_000L
@Volatile private var thread: Thread? = null
internal fun line(device: MemoryReadout.Device, split: MemoryReadout.Split): String =
"used ${device.usedKb / 1024}/${device.totalKb / 1024} MB, available ${device.availableKb / 1024} MB, " +
"swap ${device.swapUsedKb / 1024}/${device.swapTotalKb / 1024} MB | game ${split.gameKb / 1024}, " +
"droiddeck ${split.droiddeckKb / 1024}, android ${MemoryReadout.androidKb(device, split) / 1024}, " +
"gpu ${split.gpuKb?.div(1024) ?: "?"} MB"
@Synchronized
fun start() {
if (thread != null) return
thread = Thread({
while (!Thread.currentThread().isInterrupted) {
runCatching { MemoryReadout.device()?.let { android.util.Log.i(TAG, line(it, MemoryReadout.split())) } }
try { Thread.sleep(PERIOD_MS) } catch (e: InterruptedException) { break }
}
}, "memory-log").apply { isDaemon = true; start() }
}
@Synchronized
fun stop() {
thread?.interrupt()
thread = null
}
}
class MemoryHud(context: Context) {
var text by mutableStateOf("")
private set
private val context = context.applicationContext
private val handler = Handler(Looper.getMainLooper())
@Volatile private var running = false
@Volatile private var generation = 0
private var thread: Thread? = null
fun refresh() {
if (SessionPrefs.memoryHud(context) == SessionPrefs.MEMORY_HUD_OFF) stop() else start()
}
fun start() {
if (running || SessionPrefs.memoryHud(context) == SessionPrefs.MEMORY_HUD_OFF) return
running = true
val token = ++generation
thread = Thread({
while (running && generation == token) {
val line = runCatching { sample() }.getOrDefault("")
handler.post { if (running && generation == token) text = line }
try { Thread.sleep(PERIOD_MS) } catch (e: InterruptedException) { break }
}
}, "memory-hud").apply { isDaemon = true; start() }
}
fun stop() {
running = false
generation++
thread?.interrupt()
thread = null
text = ""
}
private fun sample(): String {
val device = MemoryReadout.device() ?: return ""
val memory = context.getString(
R.string.memory_hud_simple,
MemoryReadout.gb(device.usedKb), MemoryReadout.gb(device.totalKb),
MemoryReadout.gb(device.swapUsedKb), MemoryReadout.gb(device.swapTotalKb),
)
if (SessionPrefs.memoryHud(context) != SessionPrefs.MEMORY_HUD_ADVANCED) return memory
val split = MemoryReadout.split()
val parts = context.getString(
R.string.memory_hud_split,
MemoryReadout.gb(split.gameKb), MemoryReadout.gb(split.droiddeckKb), MemoryReadout.gb(MemoryReadout.androidKb(device, split)),
)
val gpu = split.gpuKb?.let { context.getString(R.string.memory_hud_gpu, MemoryReadout.gb(it)) }
return listOfNotNull(memory, parts, gpu).joinToString("\n")
}
private companion object {
const val PERIOD_MS = 2000L
}
}
@@ -9,11 +9,13 @@ import com.droiddeck.launcher.stores.epic.EpicClient
object NoSteamLaunch {
const val PROTON_RUN = "/usr/local/bin/droiddeck-proton-run"
const val EPIC = "/usr/local/bin/droiddeck-epic"
const val BATTLENET = com.droiddeck.launcher.runtime.BattleNet.PROGRAM
class Command(val program: String, val args: List<String>, val name: String)
fun scope(game: Library.SteamGame): String? = when {
game.library == Library.EPIC_LAUNCHER -> EpicClient.shortcutAppId.toString()
game.library == Library.BATTLENET_LAUNCHER -> com.droiddeck.launcher.runtime.BattleNet.APP_ID.toString()
game.library == Library.ADDED || game.appId > 0 -> game.profileKey
else -> null
}?.takeIf { it.isNotEmpty() && GameEnvironment.validScope(it) }
@@ -30,6 +32,8 @@ object NoSteamLaunch {
fun command(game: Library.SteamGame, added: AddedGames.Game?): Command? = when {
game.library == Library.EPIC_LAUNCHER -> Command(EPIC, listOf("run"), game.name)
game.library == Library.ADDED && game.source == com.droiddeck.launcher.stores.Store.BATTLENET.id ->
game.storeId?.let(com.droiddeck.launcher.runtime.BattleNet::title)?.let { Command(BATTLENET, listOf("launch", it.code), game.name) }
game.library == Library.ADDED -> added?.let { a -> a.steamAppId?.let { Command(PROTON_RUN, listOf("--app", it.toString()), a.name) } ?: addedCommand(a) }
game.appId > 0 -> Command(PROTON_RUN, listOf("--app", game.appId.toString()), game.name)
else -> null
@@ -52,6 +56,7 @@ object NoSteamLaunch {
fun nameFor(program: String?, args: List<String>): String? = when (program) {
EPIC -> Library.EPIC_LAUNCHER_NAME
BATTLENET -> args.getOrNull(args.indexOf("launch") + 1)?.takeIf { args.contains("launch") }?.let { names[it] } ?: com.droiddeck.launcher.stores.Store.BATTLENET.label
PROTON_RUN -> args.getOrNull(args.indexOf("--app") + 1)?.takeIf { args.contains("--app") }?.let { names[it] }
else -> null
}
@@ -60,5 +65,6 @@ object NoSteamLaunch {
fun remember(command: Command) {
if (command.program == PROTON_RUN) command.args.getOrNull(command.args.indexOf("--app") + 1)?.let { names[it] = command.name }
if (command.program == BATTLENET) command.args.getOrNull(command.args.indexOf("launch") + 1)?.takeIf { command.args.contains("launch") }?.let { names[it] = command.name }
}
}
@@ -74,6 +74,7 @@ object SessionFiles {
"usr/local/bin/droiddeck-steam-shortcuts" to "usr/local/bin/droiddeck-steam-shortcuts",
"usr/local/bin/droiddeck-xbox" to "usr/local/bin/droiddeck-xbox",
"usr/local/bin/droiddeck-store-launch" to "usr/local/bin/droiddeck-store-launch",
"usr/local/bin/droiddeck-battlenet" to "usr/local/bin/droiddeck-battlenet",
"usr/local/bin/droiddeck-epic" to "usr/local/bin/droiddeck-epic",
"usr/local/bin/droiddeck-epic-steam" to "usr/local/bin/droiddeck-epic-steam",
"usr/local/bin/droiddeck-open-url" to "usr/local/bin/droiddeck-open-url",
@@ -566,6 +566,32 @@ object SessionPrefs {
prefs(context).edit().putBoolean("logs", on).apply()
}
fun battleNetNoSteamSet(context: Context): Boolean = prefs(context).getBoolean("battleNetNoSteamSet", false)
fun setBattleNetNoSteamSet(context: Context) { prefs(context).edit().putBoolean("battleNetNoSteamSet", true).apply() }
fun clearCachedApps(context: Context): Boolean = prefs(context).getBoolean("clearCachedApps", false)
fun setClearCachedApps(context: Context, on: Boolean) { prefs(context).edit().putBoolean("clearCachedApps", on).apply() }
fun backgroundAppLimit(context: Context): Int =
prefs(context).getInt("backgroundAppLimit", com.droiddeck.launcher.core.BackgroundAppLimit.OFF)
.takeIf { it in com.droiddeck.launcher.core.BackgroundAppLimit.CHOICES } ?: com.droiddeck.launcher.core.BackgroundAppLimit.OFF
fun setBackgroundAppLimit(context: Context, limit: Int) {
require(limit in com.droiddeck.launcher.core.BackgroundAppLimit.CHOICES)
prefs(context).edit().putInt("backgroundAppLimit", limit).apply()
}
const val MEMORY_HUD_OFF = "off"
const val MEMORY_HUD_SIMPLE = "simple"
const val MEMORY_HUD_ADVANCED = "advanced"
fun memoryHud(context: Context): String =
prefs(context).getString("memoryHud", MEMORY_HUD_OFF)
?.takeIf { it == MEMORY_HUD_SIMPLE || it == MEMORY_HUD_ADVANCED } ?: MEMORY_HUD_OFF
fun setMemoryHud(context: Context, value: String) {
require(value == MEMORY_HUD_OFF || value == MEMORY_HUD_SIMPLE || value == MEMORY_HUD_ADVANCED)
prefs(context).edit().putString("memoryHud", value).apply()
}
fun storageDiagnosticsEnabled(context: Context): Boolean =
prefs(context).getBoolean("storageDiagnostics", false)
@@ -351,6 +351,7 @@ class SessionService : Service() {
SessionState.programArgs = intent?.getStringArrayExtra(EXTRA_PROGRAM_ARGS)?.toList().orEmpty()
SessionState.steamUi = intent?.getStringExtra(EXTRA_STEAM_UI)
SessionState.steamUrl = intent?.getStringExtra(EXTRA_STEAM_URL)
com.droiddeck.launcher.stores.battlenet.BattleNetClient.clearRequests(LinuxRuntime.sessionRoot(this))
synchronized(stopLock) {
SessionState.steamClientArch = null
SessionState.running = true
@@ -365,6 +366,9 @@ class SessionService : Service() {
SessionEvents.transition(SessionPhase.STARTING_GUEST, "service.started", mapOf("mode" to SessionState.mode))
com.droiddeck.launcher.wayland.CompositorHost.newSession()
val gen = ++sessionGen
SessionPrefs.backgroundAppLimit(this).takeIf { it != com.droiddeck.launcher.core.BackgroundAppLimit.OFF }
?.let { com.droiddeck.launcher.core.BackgroundAppLimit.applyAsync(this, it) }
if (SessionPrefs.clearCachedApps(this)) clearCachedApps()
cancelQueuedSteamGame(clearMailbox = false)
clearSteamGameMailbox()
if (SessionState.mode == MODE_STEAM) SessionState.steamUrl
@@ -671,6 +675,7 @@ class SessionService : Service() {
DeviceReport.write(this, File(sessionDir, "device.txt"), SessionState.mode)
NetworkReport.write(this, File(sessionDir, "network.txt"))
SessionLogCapture.start(File(sessionDir, "app.log"))
MemoryLog.start()
return sessionDir
}
@@ -757,7 +762,7 @@ class SessionService : Service() {
}
private fun noSteamGame(): Boolean =
SessionState.mode == MODE_RUN && SessionState.program in setOf(NoSteamLaunch.PROTON_RUN, NoSteamLaunch.EPIC)
SessionState.mode == MODE_RUN && SessionState.program in setOf(NoSteamLaunch.PROTON_RUN, NoSteamLaunch.EPIC, NoSteamLaunch.BATTLENET)
private fun startAudio(guest: MutableList<String>, sessionDir: File): PulseAudioComponent {
val wantsDirectAudio = (SessionState.mode == MODE_STEAM || SessionState.mode == MODE_DESKTOP || noSteamGame()) &&
@@ -1057,6 +1062,7 @@ class SessionService : Service() {
if (!stillSameProcess()) return
val tree = descendants(prootPid)
if (!stillSameProcess()) return
saveWineRegistries(tree)
android.os.Process.sendSignal(prootPid, 15)
if (!waitForExit(prootPid, GRACE_MS)) {
if (!stillSameProcess()) return
@@ -1073,6 +1079,31 @@ class SessionService : Service() {
if (killed > 0) Log.i(TAG, "swept $killed process(es) proot left behind")
}
private fun clearCachedApps() {
val app = applicationContext
Thread({
val before = MemoryReadout.availableMb()
val result = runCatching { com.droiddeck.launcher.core.WirelessAdbFix.clearCachedApps(app) }
val after = MemoryReadout.availableMb()
result.onSuccess { Log.i(TAG, "cached apps closed: available memory $before -> $after MB") }
.onFailure { Log.w(TAG, "cached apps not closed: ${it.message}") }
}, "clear-cached-apps").start()
}
private fun saveWineRegistries(tree: List<Pair<Int, Long>>) {
val servers = tree.filter { (pid, started) ->
readStat(pid)?.second == started && WineProcesses.isWineserver(
runCatching { File("/proc/$pid/cmdline").readBytes() }.getOrNull(),
runCatching { File("/proc/$pid/comm").readText() }.getOrNull(),
)
}
if (servers.isEmpty()) return
servers.forEach { (pid, _) -> android.os.Process.sendSignal(pid, 15) }
val deadline = System.currentTimeMillis() + WINE_SAVE_MS
val saved = servers.count { (pid, _) -> waitForExit(pid, (deadline - System.currentTimeMillis()).coerceAtLeast(0)) }
Log.i(TAG, "wineserver registry save: $saved of ${servers.size} exited after SIGTERM")
}
private fun descendants(root: Int): List<Pair<Int, Long>> {
val started = HashMap<Int, Long>()
val children = HashMap<Int, MutableList<Int>>()
@@ -1352,6 +1383,11 @@ class SessionService : Service() {
}
return
}
if (path == com.droiddeck.launcher.runtime.BattleNet.FEX_REQUEST) {
File(dir, path).delete()
com.droiddeck.launcher.runtime.BattleNet.answerFexRequest(this@SessionService, dir)
return
}
if (path != null && path.startsWith("desktop-import-") && path.endsWith(".request")) {
val request = File(dir, path)
val text = runCatching { request.readText() }.getOrNull() ?: return
@@ -1635,6 +1671,8 @@ class SessionService : Service() {
runCatching { com.droiddeck.launcher.agent.AgentEnv.endSession(this) }
.onFailure { Log.w(TAG, "clearing the agent's session environment", it) }
releaseLocks()
MemoryLog.stop()
com.droiddeck.launcher.core.BackgroundAppLimit.restoreAsync(applicationContext)
if (status == 0) {
SessionEvents.transition(SessionPhase.IDLE, "session.stopped", mapOf("status" to status))
} else {
@@ -1688,7 +1726,8 @@ class SessionService : Service() {
updateDownloadMonitoring()
val stoppedGen = sessionGen
val stoppedSession = SessionState.sessionId
val launcherEnded = SessionState.mode == MODE_STEAM || SessionState.mode == MODE_DESKTOP || SessionState.program == NoSteamLaunch.EPIC
val launcherEnded = SessionState.mode == MODE_STEAM || SessionState.mode == MODE_DESKTOP || SessionState.program == NoSteamLaunch.EPIC ||
SessionState.program == NoSteamLaunch.BATTLENET
SessionState.stopRequested = false
GpuClockPin.stop(this)
GameThreadHints.stop()
@@ -1748,6 +1787,9 @@ class SessionService : Service() {
private fun importLauncherGames() {
runCatching { com.droiddeck.launcher.stores.epic.EpicClientLibrary.importClientGames(this) }
.onFailure { Log.w(TAG, "client library scan failed: ${it.javaClass.simpleName}") }
runCatching { com.droiddeck.launcher.stores.battlenet.BattleNetClient.syncAccount(this) }
.onFailure { Log.w(TAG, "Battle.net sign-in check failed: ${it.javaClass.simpleName}") }
com.droiddeck.launcher.stores.StoresState.notifyLibraryChanged(this)
}
override fun onTaskRemoved(rootIntent: Intent?) {
@@ -1995,6 +2037,7 @@ class SessionService : Service() {
private val STRAGGLERS = listOf("droiddeck-session", "gamescope", "Xwayland", "steamrtarm64",
"steamwebhelper", "linuxfs/opt/android-host/proot", "/libproot.so", "pulseaudio/libpulseaudio.so")
private const val GRACE_MS = 1200L
private const val WINE_SAVE_MS = 3000L
private const val STEAM_PICKUP_MS = 1500L
private const val STEAM_EXIT_MS = 10_000L
private const val GAME_LAUNCH_RETRY_MS = 250L
@@ -0,0 +1,13 @@
package com.droiddeck.launcher.session
internal object WineProcesses {
private const val WINESERVER = "wineserver"
fun isWineserver(cmdline: ByteArray?, comm: String?): Boolean {
val program = cmdline?.let { bytes ->
val end = bytes.indexOf(0.toByte()).let { if (it < 0) bytes.size else it }
String(bytes, 0, end, Charsets.UTF_8).substringAfterLast('/')
}
return program == WINESERVER || comm?.trim() == WINESERVER
}
}
@@ -58,7 +58,7 @@ object CloudSaves {
val item = sidecar.extra["catalogItemId"].orEmpty()
if (ns.isEmpty() || item.isEmpty()) "" else EpicApiClient.getCustomAttribute(token, ns, item, "CloudSaveFolder")
}
Store.AMAZON, Store.ITCH, Store.XBOX -> ""
Store.AMAZON, Store.ITCH, Store.XBOX, Store.BATTLENET -> ""
} ?: return null
p.edit().putString("cloud_template_$id", fetched).apply()
Log.i(TAG, "cloud ${store.id} $id template ${if (fetched.isEmpty()) "none" else "found"}")
@@ -96,7 +96,7 @@ object CloudSaves {
val dir = when (store) {
Store.GOG -> CloudSavePaths.gog(template, pfx, folder)
Store.EPIC -> CloudSavePaths.epic(template, pfx, folder, EpicCredentialStore.load(context)?.accountId.orEmpty(), id)
Store.AMAZON, Store.ITCH, Store.XBOX -> null
Store.AMAZON, Store.ITCH, Store.XBOX, Store.BATTLENET -> null
}
return dir to (if (dir == null) "unresolved" else "ok")
}
@@ -121,7 +121,7 @@ object CloudSaves {
val account = EpicCredentialStore.load(context)?.accountId.orEmpty()
if (token == null || account.isEmpty()) null else EpicCloud(account, id, token)
}
Store.AMAZON, Store.ITCH, Store.XBOX -> null
Store.AMAZON, Store.ITCH, Store.XBOX, Store.BATTLENET -> null
}
private fun gogScopedToken(context: Context, id: String, clientId: String): String? {
@@ -12,7 +12,7 @@ internal object LoginFlows {
Store.GOG -> GogFlow(state, browserUserAgent)
Store.EPIC -> epicFlow()
Store.AMAZON -> amazonFlow()
Store.ITCH, Store.XBOX -> null
Store.ITCH, Store.XBOX, Store.BATTLENET -> null
}
@Volatile var epicFlow: () -> StoreLoginActivity.Flow? = { null }
@@ -23,14 +23,14 @@ object SteamLiveShortcuts {
val wanted = games.filter(include)
if (wanted.isEmpty() || !clientRunning()) return
val list = JSONArray()
for (g in wanted) list.put(JSONObject().put("name", g.name).put("exe", g.guestExe).put("dir", g.guestDir).put("appid", g.appId and 0xFFFFFFFFL))
for (g in wanted) list.put(JSONObject().put("name", g.name).put("exe", g.guestExe).put("dir", g.guestDir).put("appid", g.appId and 0xFFFFFFFFL).put("launch", g.launchOptions))
val js = """
(async () => {
const want = ${list};
let added = 0;
for (const w of want) {
if (await ${KNOWN}(w.appid, w.name, w.exe)) continue;
if (await ${ADD}(w.name, w.exe, w.dir, true, ${JSONObject.quote(compatTool(context))})) added++;
if (await ${ADD}(w.name, w.exe, w.dir, true, ${JSONObject.quote(compatTool(context))}, w.launch)) added++;
}
return added;
})()
@@ -164,8 +164,8 @@ object SteamLiveShortcuts {
private fun compatTool(context: Context): String =
com.droiddeck.launcher.session.ProtonDefault.state(context).default ?: COMPAT_TOOL
private val ADD = """(async (name, exe, dir, compat, tool) => {
const id = await SteamClient.Apps.AddShortcut(name, exe, dir, "");
private val ADD = """(async (name, exe, dir, compat, tool, launch) => {
const id = await SteamClient.Apps.AddShortcut(name, exe, dir, launch || "");
if (!id) return 0;
try { SteamClient.Apps.SetShortcutName(id, name); } catch (e) {}
try { SteamClient.Apps.AddUserTagToApps([id], ${JSONObject.quote(TAG_NAME)}); } catch (e) {}
@@ -5,7 +5,8 @@ enum class Store(val id: String, val label: String, val shortLabel: String) {
EPIC("epic", "Epic Games", "Epic"),
AMAZON("amazon", "Amazon Games", "Amazon"),
XBOX("xbox", "Xbox", "Xbox"),
ITCH("itch", "itch.io", "itch");
ITCH("itch", "itch.io", "itch"),
BATTLENET("battlenet", "Battle.net", "Battle.net");
companion object {
fun byId(id: String?): Store? = entries.firstOrNull { it.id == id }
@@ -90,6 +90,7 @@ object StoreAccounts {
fun signedInAs(context: Context, store: Store): String? {
val json = read(context, store) ?: return if (isUnavailable(store)) store.label else null
if (store == Store.XBOX) return json.optString("username").takeIf { it.isNotBlank() }
if (store == Store.BATTLENET) return json.optString("display_name").takeIf { it.isNotBlank() }
if (json.optString("access_token", "").isEmpty()) return null
return json.optString("display_name", "").ifEmpty { json.optString("username", "") }.ifEmpty { store.label }
}
@@ -91,6 +91,8 @@ object StoreInstallRoot {
fun installRoot(context: Context): File = internalRoot(context)
fun libraryRoot(context: Context): File? = GameStorage.effective(context)?.let { File(it.path, ON_VOLUME) }
fun roots(context: Context): List<File> {
val cards = GameStorage.options(context).map { File(it.path, ON_VOLUME) }
val library = GameStorage.effective(context)?.let { File(it.path, ON_VOLUME) }
@@ -187,7 +189,7 @@ object StoreInstallRoot {
fun isFinished(folder: File): Boolean = StoreGameSidecar.read(folder)?.isInstalled == true
fun unfinished(context: Context): List<Unfinished> = roots(context).flatMap { root ->
Store.entries.flatMap { store ->
Store.entries.filter { it != Store.BATTLENET }.flatMap { store ->
storeDir(root, store).listFiles { f -> f.isDirectory }.orEmpty().mapNotNull { folder ->
val sidecar = StoreGameSidecar.read(folder)
when {
@@ -55,7 +55,7 @@ object StoreSizes {
Store.EPIC -> EpicPrefs.get(app).edit().putLong("size_${item.id}", it).apply()
Store.AMAZON -> AmazonPrefs.get(app).edit().putLong("size_${item.id}", it).apply()
Store.ITCH -> {}
Store.GOG, Store.XBOX -> {}
Store.GOG, Store.XBOX, Store.BATTLENET -> {}
}
}
}, pool).exceptionally { error ->
@@ -111,7 +111,7 @@ object StoreSizes {
val bytes = AmazonApiClient.getBytes(AmazonApiClient.appendPath(spec.downloadUrl, "manifest.proto"), token) ?: return 0L
AmazonManifest.parse(bytes).totalInstallSize
}
Store.GOG, Store.XBOX -> 0L
Store.GOG, Store.XBOX, Store.BATTLENET -> 0L
Store.ITCH -> com.droiddeck.launcher.stores.itch.ItchLibrary.size(context, item)
} }
}
@@ -77,10 +77,11 @@ object StoresState {
val app = context.applicationContext
com.droiddeck.launcher.stores.download.SavedQueue.restore(app)
background("stores-refresh") {
runCatching { com.droiddeck.launcher.stores.battlenet.BattleNetClient.syncAccount(app) }
val found = Store.entries.mapNotNull { store -> StoreAccounts.displayName(app, store)?.let { store to it } }
val onDisk = StoreInstallRoot.gameFolders(app).mapNotNull { folder ->
StoreGameSidecar.read(folder)?.takeIf { it.isInstalled }?.let { InstalledStoreGame(it, folder) }
}
} + runCatching { com.droiddeck.launcher.stores.battlenet.BattleNetBackend.installedGames(app) }.getOrDefault(emptyList())
val partial = StoreInstallRoot.unfinished(app)
val version = if (StoresNative.available) StoresNative.version ?: "" else ""
main.post {
@@ -225,6 +226,10 @@ object StoresState {
fun install(context: Context, item: CatalogItem, root: java.io.File? = null, language: String? = null) {
val app = context.applicationContext
if (item.store == Store.BATTLENET) {
backends[item.store]?.install(app, item, root ?: StoreInstallRoot.installRoot(app))
return
}
val folder = StoreInstallRoot.folderFor(app, item.store, item.id, item.title, root ?: StoreInstallRoot.installRoot(app))
val target = folder.parentFile!!.parentFile!!
val code = language?.takeIf { it.isNotBlank() } ?: StoreLanguage.preferredCode(app)
@@ -258,6 +263,10 @@ object StoresState {
uninstalling[key] = 0f
background("stores-uninstall", onFailure = { main.post { uninstalling.remove(key); onDone() } }) {
runCatching { backends[game.sidecar.store]?.uninstall(app, game) }
if (game.sidecar.store == Store.BATTLENET) {
main.post { uninstalling.remove(key); onDone() }
return@background
}
StoreInstalls.uninstall(app, game, progress = { f -> main.post { if (key in uninstalling) uninstalling[key] = f } }, removed = {
main.post {
installed = installed.filterNot { it.folder.absolutePath == game.folder.absolutePath }
@@ -0,0 +1,294 @@
package com.droiddeck.launcher.stores.battlenet
import android.content.Context
import android.net.Uri
import android.util.Log
import com.droiddeck.launcher.R
import com.droiddeck.launcher.frontend.AddedGames
import com.droiddeck.launcher.runtime.BattleNet
import com.droiddeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.stores.CatalogItem
import com.droiddeck.launcher.stores.InstalledStoreGame
import com.droiddeck.launcher.stores.Store
import com.droiddeck.launcher.stores.StoreAccounts
import com.droiddeck.launcher.stores.StoreBackend
import com.droiddeck.launcher.stores.StoreGameSidecar
import com.droiddeck.launcher.stores.StoreInstallRoot
import com.droiddeck.launcher.stores.StoreShelves
import com.droiddeck.launcher.stores.StoresState
import com.droiddeck.launcher.stores.download.DownloadEntry
import com.droiddeck.launcher.stores.download.DownloadQueue
import com.droiddeck.launcher.stores.download.DownloadStage
import org.json.JSONObject
import java.io.File
import java.io.FileOutputStream
import java.io.IOException
import java.net.HttpURLConnection
import java.net.URL
import java.util.concurrent.Executors
import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicLong
object BattleNetClient {
private const val TAG = "BattleNetClient"
const val DOWNLOAD_ID = "battlenet-client"
const val DOWNLOAD_KEY = "battlenet:$DOWNLOAD_ID"
const val REQUEST = "battlenet-request"
internal const val INSTALLER_URL = "https://downloader.battle.net/download/getInstallerForGame?os=win&gameProgram=BATTLENET_APP&version=Live"
private const val SETUP = "root/.cache/droiddeck/battlenet/Battle.net-Setup.exe"
private const val CONFIG = "pfx/drive_c/users/steamuser/AppData/Roaming/Battle.net/Battle.net.config"
internal const val MIN_SETUP = 1L shl 20
private val work = Executors.newSingleThreadExecutor { r -> Thread(r, "battlenet-client") }
private val sequence = AtomicLong()
@Volatile var opener: ((List<String>) -> Unit)? = null
fun setup(context: Context): File = File(LinuxRuntime.rootDir(context), SETUP)
internal fun setupReady(file: File): Boolean = runCatching {
file.length() >= MIN_SETUP && file.inputStream().use { input ->
val head = ByteArray(2)
input.read(head) == 2 && head[0] == 'M'.code.toByte() && head[1] == 'Z'.code.toByte()
}
}.getOrDefault(false)
internal fun account(config: String?): String? {
val client = runCatching { JSONObject(config ?: return null).optJSONObject("Client") }.getOrNull() ?: return null
if (client.optString("AutoLogin") != "true") return null
return client.optString("SavedAccountNames").split(',').map { it.trim() }.firstOrNull { it.isNotEmpty() }
}
private fun config(context: Context) = File(BattleNet.prefix(context), CONFIG)
fun signedInAs(context: Context): String? =
if (!BattleNet.installed(context)) null
else account(runCatching { config(context).readText() }.getOrNull())?.let(StoreAccounts::maskEmail)
fun syncAccount(context: Context): Boolean {
val name = signedInAs(context)
if (name == StoreAccounts.signedInAs(context, Store.BATTLENET)) return false
if (name == null) StoreAccounts.clear(context, Store.BATTLENET)
else StoreAccounts.write(context, Store.BATTLENET, JSONObject().put("display_name", name))
Log.i(TAG, if (name == null) "Battle.net is signed out" else "Battle.net is signed in")
return true
}
fun refresh(context: Context) {
val app = context.applicationContext
work.execute {
if (runCatching { syncAccount(app) }.getOrDefault(false)) StoresState.notifyLibraryChanged(app)
}
}
fun signIn(context: Context) {
val app = context.applicationContext
work.execute {
if (BattleNet.installed(app) || setupReady(setup(app))) {
open(emptyList())
return@execute
}
StoresState.post {
if (DownloadQueue.isActive(DOWNLOAD_KEY)) return@post
val entry = DownloadEntry(
Store.BATTLENET, DOWNLOAD_ID, app.getString(R.string.bnet_name),
location = StoreInstallRoot.labelFor(app, setup(app)),
)
DownloadQueue.enqueue(app, entry) { SetupDownload(app) }
StoresState.openDownloads = true
}
}
}
fun signOut(context: Context) {
val file = config(context)
runCatching {
val json = JSONObject(file.readText())
json.optJSONObject("Client")?.put("AutoLogin", "false") ?: return@runCatching
val staged = File(file.path + ".droiddeck")
staged.writeText(json.toString(4))
check(staged.renameTo(file))
Log.i(TAG, "Battle.net will ask for a sign-in at its next start")
}.onFailure { Log.w(TAG, "Battle.net's sign-in kept: ${it.javaClass.simpleName}") }
}
fun request(sessionRoot: File, args: List<String>): Boolean = runCatching {
require(args.none { '\n' in it })
val now = System.nanoTime()
val name = "$REQUEST.%020d".format(java.util.Locale.ROOT, sequence.updateAndGet { maxOf(it + 1, now) })
val staged = File(sessionRoot, "$name.tmp")
staged.writeText(args.joinToString("\n") + "\n")
check(staged.renameTo(File(sessionRoot, name)))
Log.i(TAG, "handed ${args.firstOrNull()} to the open Battle.net")
}.onFailure { Log.w(TAG, "Battle.net request not left: ${it.javaClass.simpleName}") }.isSuccess
fun clearRequests(sessionRoot: File) {
sessionRoot.listFiles { file -> file.name == REQUEST || file.name.startsWith("$REQUEST.") }?.forEach { it.delete() }
}
fun open(args: List<String>) {
StoresState.post { opener?.invoke(args) }
}
fun library(context: Context, root: File = preferred(context)): List<String> =
AddedGames.guestPath(context, StoreInstallRoot.storeDir(root, Store.BATTLENET))?.let { listOf("--library", it) }.orEmpty()
internal fun preferred(context: Context): File {
val second = StoreInstallRoot.libraryRoot(context)?.absolutePath
return StoreInstallRoot.targets(context).firstOrNull { it.root.absolutePath == second && (it.root.isDirectory || it.root.mkdirs()) }?.root
?: StoreInstallRoot.internalRoot(context)
}
fun installGame(context: Context, uid: String, root: File) {
val app = context.applicationContext
work.execute { open(library(app, root) + listOf("install-game", uid)) }
}
internal fun downloaded(context: Context) {
Log.i(TAG, "Battle.net's installer downloaded from Blizzard")
open(emptyList())
StoresState.post { StoresState.notifyLibraryChanged(context) }
}
}
object BattleNetBackend : StoreBackend {
override val store: Store = Store.BATTLENET
override fun signIn(context: Context) = BattleNetClient.signIn(context)
override fun signOut(context: Context) {
BattleNetClient.signOut(context)
StoresState.post { StoresState.shelves.remove(store); StoresState.found.remove(store) }
}
override fun syncLibrary(context: Context, force: Boolean) {
val app = context.applicationContext
Thread({
val items = runCatching { installed(app).map { item(app, it.title, owned = true) } }.getOrDefault(emptyList())
StoresState.post { StoresState.library[store] = items }
}, "battlenet-library").start()
}
override fun loadShelves(context: Context, force: Boolean) {
val app = context.applicationContext
Thread({
val known = shelves(app)
StoresState.post { StoresState.shelves[store] = known }
if (runCatching { BattleNet.fetchCovers(app) }.getOrDefault(false)) {
val covered = shelves(app)
val items = runCatching { installed(app).map { item(app, it.title, owned = true) } }.getOrDefault(emptyList())
StoresState.post {
StoresState.shelves[store] = covered
StoresState.library[store] = items
StoresState.notifyLibraryChanged(app)
}
}
}, "battlenet-shelves").start()
}
override fun search(context: Context, query: String): List<CatalogItem> =
BattleNet.STORE.filter { it.name.contains(query, ignoreCase = true) }.map { item(context, it) }
override fun install(context: Context, item: CatalogItem, root: File) = BattleNetClient.installGame(context, item.id, root)
override fun uninstall(context: Context, game: InstalledStoreGame) = BattleNetClient.open(emptyList())
fun installed(context: Context): List<BattleNet.Game> = if (BattleNet.installed(context)) BattleNet.games(context) else emptyList()
fun installedGames(context: Context): List<InstalledStoreGame> = installed(context).map { game ->
val art = BattleNet.art(context, game.title)
val cover = art.cover?.let { Uri.fromFile(it).toString() }
InstalledStoreGame(StoreGameSidecar(store, game.title.uid, game.name, "", cover = cover, hero = art.header?.let { Uri.fromFile(it).toString() } ?: cover), game.folder)
}
private fun shelves(context: Context): StoreShelves {
val items = BattleNet.STORE.map { item(context, it) }
return StoreShelves(trending = items, art = items.mapNotNull { it.tallImageUrl })
}
private fun item(context: Context, title: BattleNet.Title, owned: Boolean = false): CatalogItem {
val art = BattleNet.art(context, title)
return CatalogItem(
store, title.uid, title.name,
imageUrl = (art.header ?: art.cover)?.let { Uri.fromFile(it).toString() },
tallImageUrl = art.cover?.let { Uri.fromFile(it).toString() },
owned = owned,
)
}
}
internal class SetupDownload(private val app: Context) : DownloadQueue.DownloadJob {
private val cancelled = AtomicBoolean(false)
@Volatile private var connection: HttpURLConnection? = null
override fun run(handle: DownloadQueue.JobHandle): String? {
handle.stage(DownloadStage.DOWNLOAD)
if (!LinuxRuntime.isInstalled(app)) throw IllegalStateException(app.getString(R.string.epic_client_no_runtime))
val file = BattleNetClient.setup(app)
val partial = File(file.path + ".part")
file.parentFile?.mkdirs()
var attempt = 0
while (!cancelled.get()) {
try {
fetch(partial, handle)
if (cancelled.get()) break
if (!BattleNetClient.setupReady(partial)) throw IOException("not a Windows program")
if (!partial.renameTo(file)) throw IOException("could not keep the installer")
BattleNetClient.downloaded(app)
return file.absolutePath
} catch (e: IOException) {
partial.delete()
if (cancelled.get()) break
attempt++
handle.log("Battle.net installer attempt $attempt: ${e.message ?: e.javaClass.simpleName}")
if (attempt >= ATTEMPTS) throw IllegalStateException(app.getString(R.string.epic_client_download_failed, e.message ?: e.javaClass.simpleName))
val until = System.currentTimeMillis() + (2_000L shl (attempt - 1))
while (System.currentTimeMillis() < until && !cancelled.get()) Thread.sleep(100)
}
}
partial.delete()
return null
}
private fun fetch(partial: File, handle: DownloadQueue.JobHandle) {
val conn = (URL(BattleNetClient.INSTALLER_URL).openConnection() as HttpURLConnection).apply {
connectTimeout = 20_000
readTimeout = 30_000
instanceFollowRedirects = true
setRequestProperty("User-Agent", "DroidDeck")
}
connection = conn
try {
if (conn.responseCode != 200) throw IOException("HTTP ${conn.responseCode}")
if (conn.url.protocol != "https") throw IOException("not served over HTTPS")
val total = conn.contentLengthLong
var done = 0L
conn.inputStream.use { input ->
FileOutputStream(partial).use { out ->
val buf = ByteArray(64 * 1024)
while (!cancelled.get()) {
val n = input.read(buf)
if (n < 0) break
out.write(buf, 0, n)
done += n
handle.progress(done, total)
}
out.fd.sync()
}
}
if (!cancelled.get() && total > 0 && done != total) throw IOException("the download ended early")
} finally {
connection = null
runCatching { conn.disconnect() }
}
}
override fun cancel(deleteFiles: Boolean) {
cancelled.set(true)
runCatching { connection?.disconnect() }
}
private companion object {
const val ATTEMPTS = 4
}
}
@@ -0,0 +1,93 @@
package com.droiddeck.launcher.stores.battlenet
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import java.io.File
import java.io.IOException
import java.net.CookieManager
import java.net.CookiePolicy
import java.net.HttpURLConnection
import java.net.URL
internal object BlizzardArt {
private const val SHOP = "https://us.shop.battle.net/en-us/product/"
private const val MAX_PAGE = 16 shl 20
private const val MAX_IMAGE = 12 shl 20
private const val WIDE = 1280
private val OG = Regex("""<meta property="og:image" content="(https://[^"]+)"""")
private val THUMB = Regex("""\\?"imageUrl\\?":\\?"(//catalog\.blzstatic\.com/[^"\\]+)""")
private val HOSTS = listOf(".blzstatic.com", ".blz-contentstack.com", "blz-contentstack-images.akamaized.net")
internal fun imageUrl(page: String): String? {
val og = OG.find(page)?.groupValues?.get(1)?.takeUnless { "youtube" in it || "maxresdefault" in it }
val thumbs = THUMB.findAll(page).map { it.groupValues[1] }.filter { "_bundle" !in it }.map { "https:$it" }
return (sequenceOf(og) + thumbs).filterNotNull().firstOrNull(::allowed)
}
private fun allowed(url: String): Boolean {
val host = runCatching { URL(url).host }.getOrNull() ?: return false
return HOSTS.any { h -> host == h.trimStart('.') || host.endsWith(h) }
}
fun fetch(slug: String, wide: File, cover: File?): Boolean {
val page = get(URL(SHOP + slug), MAX_PAGE, true)?.toString(Charsets.UTF_8) ?: return false
val url = imageUrl(page) ?: return false
val bytes = get(URL(url.substringBefore('?') + "?imwidth=$WIDE"), MAX_IMAGE, false) ?: return false
val art = BitmapFactory.decodeByteArray(bytes, 0, bytes.size) ?: return false
try {
val scaled = if (art.width > WIDE) Bitmap.createScaledBitmap(art, WIDE, art.height * WIDE / art.width, true) else art
save(scaled, wide)
if (cover != null) {
val w = minOf(scaled.width, scaled.height * 2 / 3)
val crop = Bitmap.createBitmap(scaled, (scaled.width - w) / 2, 0, w, w * 3 / 2)
save(Bitmap.createScaledBitmap(crop, 600, 900, true), cover)
}
return true
} finally {
art.recycle()
}
}
private fun save(bitmap: Bitmap, file: File) {
val tmp = File(file.path + ".tmp")
tmp.outputStream().use { if (!bitmap.compress(Bitmap.CompressFormat.JPEG, 90, it)) throw IOException("not saved") }
if (!tmp.renameTo(file)) throw IOException("not kept")
}
private fun get(start: URL, limit: Int, follow: Boolean): ByteArray? {
val cookies = CookieManager(null, CookiePolicy.ACCEPT_ALL)
var url = start
repeat(8) {
if (url.protocol != "https") return null
val conn = (url.openConnection() as HttpURLConnection).apply {
instanceFollowRedirects = false
connectTimeout = 15_000
readTimeout = 20_000
setRequestProperty("User-Agent", "DroidDeck")
cookies.get(url.toURI(), emptyMap()).forEach { (k, v) -> if (v.isNotEmpty()) setRequestProperty(k, v.joinToString("; ")) }
}
try {
val code = conn.responseCode
cookies.put(url.toURI(), conn.headerFields)
when {
code == 200 -> return conn.inputStream.use { input ->
val out = java.io.ByteArrayOutputStream()
val buf = ByteArray(64 * 1024)
while (true) {
val n = input.read(buf)
if (n < 0) break
out.write(buf, 0, n)
if (out.size() > limit) return null
}
out.toByteArray()
}
follow && code in 301..308 -> url = URL(url, conn.getHeaderField("Location") ?: return null)
else -> return null
}
} finally {
conn.disconnect()
}
}
return null
}
}
@@ -100,6 +100,10 @@ class FrontEndState(
val logsEnabled: Boolean,
val vacDiagnostics: Boolean = false,
val agentCommands: Boolean = false,
val clearCachedApps: Boolean = false,
val adbPaired: Boolean = false,
val backgroundAppLimit: Int = -1,
val memoryHud: String = "off",
val steamGames: List<Library.SteamGame>,
val steamGamesX64: Boolean = false,
val emulators: List<Library.Emulator>,
@@ -124,6 +128,7 @@ class FrontEndState(
val packageStage: String? = null,
val packagePercent: Int = -1,
val sessionRunning: Boolean = false,
val battleNetInstalled: Boolean = false,
val removalPending: Boolean = false,
val runtimeActionsBlocked: Boolean = false,
val backActionsInverted: Boolean = false,
@@ -176,6 +181,7 @@ class FrontEndActions(
val onEmulator: (Library.Emulator) -> Unit,
val onFlatpakApp: (String, String) -> Unit = { _, _ -> },
val onUserApp: (com.droiddeck.launcher.runtime.UserApps.App) -> Unit = {},
val onBattleNet: () -> Unit = {},
val onRom: (Library.Rom) -> Unit,
val onResume: () -> Unit,
val onSteamSettings: () -> Unit,
@@ -200,6 +206,9 @@ class FrontEndActions(
val onLogs: () -> Unit,
val onVacDiagnostics: () -> Unit = {},
val onAgentCommands: () -> Unit = {},
val onClearCachedApps: (Boolean) -> Unit = {},
val onMemoryHud: (String) -> Unit = {},
val onBackgroundAppLimit: (Int) -> Unit = {},
val onShareLogs: () -> Unit = {},
val onClearLogs: () -> Unit = {},
val onResetSettings: () -> Unit = {},
@@ -470,6 +470,38 @@ internal fun SetupPanel(
ActionRow(stringResource(R.string.setup_reset_settings), stringResource(R.string.setup_reset_settings_hint),
stringResource(R.string.setup_reset_settings_button), a.onResetSettings)
}
SettingsGroup(stringResource(R.string.setup_group_memory)) {
ToggleRow(
host, "clear-cached-apps", stringResource(R.string.setup_clear_cached),
stringResource(if (s.adbPaired) R.string.setup_clear_cached_hint else R.string.setup_clear_cached_unpaired),
s.clearCachedApps, enabled = s.adbPaired || s.clearCachedApps,
) { a.onClearCachedApps(it) }
ChoiceRow(
host, "background-app-limit", stringResource(R.string.setup_bg_limit),
stringResource(if (s.adbPaired) R.string.setup_bg_limit_hint else R.string.setup_clear_cached_unpaired),
listOf(
com.droiddeck.launcher.core.BackgroundAppLimit.OFF to stringResource(R.string.game_env_off),
4 to stringResource(R.string.setup_bg_limit_4),
1 to stringResource(R.string.setup_bg_limit_1),
0 to stringResource(R.string.setup_bg_limit_0),
),
s.backgroundAppLimit, enabled = s.adbPaired || s.backgroundAppLimit != com.droiddeck.launcher.core.BackgroundAppLimit.OFF,
onPick = a.onBackgroundAppLimit,
)
ChoiceRow(
host, "memory-hud", stringResource(R.string.setup_memory_hud), stringResource(R.string.setup_memory_hud_hint),
listOf(
com.droiddeck.launcher.session.SessionPrefs.MEMORY_HUD_OFF to stringResource(R.string.game_env_off),
com.droiddeck.launcher.session.SessionPrefs.MEMORY_HUD_SIMPLE to stringResource(R.string.setup_memory_hud_simple),
com.droiddeck.launcher.session.SessionPrefs.MEMORY_HUD_ADVANCED to stringResource(R.string.setup_memory_hud_advanced),
),
s.memoryHud, onPick = a.onMemoryHud,
)
if (!s.adbPaired) ActionRow(
stringResource(R.string.setup_adb_pair), stringResource(R.string.setup_adb_pair_hint),
stringResource(R.string.setup_adb_pair_button), { onRequestWirelessAdb(false) },
)
}
}
GLASSES_TAB -> GlassesSetupPanel()
}
@@ -364,6 +364,7 @@ private fun GameActions(
}
SecondaryButton(stringResource(R.string.stores_xbox_manage), enabled = download == null) { XboxContent.manage(ctx, installed) }
}
if (store == Store.BATTLENET) SecondaryButton(stringResource(R.string.bnet_open)) { a.onBattleNet() }
}
download != null -> {
ActionChip(downloadLabel(download), ok = false)
@@ -378,6 +379,7 @@ private fun GameActions(
}
ConfirmButton(stringResource(R.string.stores_dl_clear), stringResource(R.string.stores_dl_cancel_confirm), compact = true) { DownloadQueue.clear(ctx, failed.key) }
}
store == Store.BATTLENET && item != null -> InstallButton(stringResource(R.string.stores_install), leadOn) { StoresState.requestInstall(ctx, item) }
store == Store.XBOX && item != null && !item.xboxPc && item.xboxCloud -> {
XboxStreamButton(item.id, item.title, main = true, modifier = leadOn)
XboxLibraryButton(item.id, item)
@@ -521,6 +523,7 @@ private fun IconAction(icon: androidx.compose.ui.graphics.vector.ImageVector, la
private fun RemoveButton(title: String, game: Library.SteamGame?, installed: InstalledStoreGame?, a: FrontEndActions) {
val ctx = LocalContext.current
val colors = MaterialTheme.colorScheme
if ((installed?.sidecar?.store?.id ?: game?.source) == Store.BATTLENET.id) return
if (installed != null) {
val key = installed.key
val gone = StoresState.uninstalling[key]
@@ -101,7 +101,8 @@ internal fun GameEnvironmentEditor(byPad: Boolean, initialScope: String = "", on
LaunchedEffect(Unit) {
runCatching {
withContext(Dispatchers.IO) {
GameEnvironmentStore.read(context) to Library.steamGames(context).map { it.appId.toString() to it.name }
GameEnvironmentStore.read(context) to Library.steamGames(context).map { it.appId.toString() to it.name } +
listOfNotNull(com.droiddeck.launcher.runtime.BattleNet.profile(context))
}
}.onSuccess { (settings, installed) -> config = settings; games = installed }
.onFailure { error = true }
@@ -31,6 +31,7 @@ internal fun sourceColours(source: String): SourceColours = when (source) {
Store.AMAZON.id -> SourceColours(Color(0xFF3A2A0A), Color(0xFFFFC266), Color(0xFFFF9900))
Store.XBOX.id -> SourceColours(Color(0xFF17381B), Color(0xFFC6EDC2), Color(0xFF70C850))
Store.ITCH.id -> SourceColours(Color(0xFF3A1A1E), Color(0xFFFFB3B3), Color(0xFFFF5C5C))
Store.BATTLENET.id -> SourceColours(Color(0xFF0A2440), Color(0xFF9DD1FF), Color(0xFF148EFF))
Library.SOURCE_STEAM -> SourceColours(Color(0xFF16293D), Color(0xFF7CC4FF), Color(0xFF1A9FFF))
FLATHUB -> SourceColours(Color(0xFF0B2E2B), Color(0xFF9FE3DD), FlathubTeal)
else -> SourceColours(Color(0xFF1A1D22), Color(0xFF9AA3AF), Color(0xFF9AA3AF))
@@ -44,6 +45,7 @@ internal fun sourceLabel(source: String): String = when (source) {
Store.AMAZON.id -> Store.AMAZON.label
Store.XBOX.id -> Store.XBOX.label
Store.ITCH.id -> Store.ITCH.label
Store.BATTLENET.id -> Store.BATTLENET.label
else -> stringResource(R.string.source_added)
}
@@ -221,7 +221,7 @@ private fun FinishedRow(d: DownloadEntry, s: FrontEndState, a: FrontEndActions,
ArtStrip(d.cover, d.name) {
StripLabel(d.name, d.store.id, stringResource(if (d.state == DownloadState.INSTALLED) R.string.stores_installed_chip else R.string.stores_dl_cancelled), Color.White.copy(alpha = 0.72f))
if (d.state == DownloadState.INSTALLED) Box(Modifier.bloomIn(bloom, GATHER_HOLD_MS + 150)) {
RoundAction(Icons.Filled.PlayArrow, stringResource(R.string.stores_play), primary = true) { if (d.key == EpicClient.DOWNLOAD_KEY) a.onEpicLauncher() else launchStoreGame(ctx, d.store, d.id, s, a) }
RoundAction(Icons.Filled.PlayArrow, stringResource(R.string.stores_play), primary = true) { if (d.key == EpicClient.DOWNLOAD_KEY) a.onEpicLauncher() else if (d.key == com.droiddeck.launcher.stores.battlenet.BattleNetClient.DOWNLOAD_KEY) a.onBattleNet() else launchStoreGame(ctx, d.store, d.id, s, a) }
}
}
}
@@ -372,7 +372,7 @@ private fun DownloadCard(d: DownloadEntry, s: FrontEndState, a: FrontEndActions)
CancelAction { DownloadQueue.clear(ctx, d.key) }
}
DownloadState.INSTALLED -> Box(Modifier.bloomIn(true, 420)) {
RoundAction(Icons.Filled.PlayArrow, stringResource(R.string.stores_play), primary = true) { if (d.key == EpicClient.DOWNLOAD_KEY) a.onEpicLauncher() else launchStoreGame(ctx, d.store, d.id, s, a) }
RoundAction(Icons.Filled.PlayArrow, stringResource(R.string.stores_play), primary = true) { if (d.key == EpicClient.DOWNLOAD_KEY) a.onEpicLauncher() else if (d.key == com.droiddeck.launcher.stores.battlenet.BattleNetClient.DOWNLOAD_KEY) a.onBattleNet() else launchStoreGame(ctx, d.store, d.id, s, a) }
}
DownloadState.CANCELLED -> {}
}
@@ -235,6 +235,12 @@ internal fun StoresPage(s: FrontEndState, a: FrontEndActions, modifier: Modifier
LaunchedEffect(Unit) { StoresState.refresh(ctx) }
val lifecycle = androidx.compose.ui.platform.LocalLifecycleOwner.current.lifecycle
LaunchedEffect(chip) {
if (chip == Store.BATTLENET.id) {
while (true) {
if (lifecycle.currentState.isAtLeast(androidx.lifecycle.Lifecycle.State.RESUMED)) com.droiddeck.launcher.stores.battlenet.BattleNetClient.refresh(ctx)
delay(5_000)
}
}
if (chip == Store.EPIC.id) {
EpicClient.ensure(ctx)
while (true) {
@@ -919,7 +925,7 @@ private fun Storefront(
Shelf(stringResource(R.string.stores_shelf_new), shelf(shelves?.whatsNew), card)
Shelf(stringResource(R.string.stores_shelf_deals), shelf(shelves?.deals), card)
Shelf(stringResource(R.string.stores_shelf_free), shelf(shelves?.free), card)
Shelf(stringResource(R.string.stores_shelf_trending), shelf(shelves?.trending), card)
Shelf(stringResource(if (store == Store.BATTLENET) R.string.bnet_store else R.string.stores_shelf_trending), shelf(shelves?.trending), card)
if (shelves == null) Rise(4) { Box(Modifier.padding(top = 8.dp)) { Note(stringResource(R.string.stores_shelves_loading)) } }
else if (shelves.isEmpty && store == Store.AMAZON) Rise(4) { Box(Modifier.padding(top = 8.dp)) { Note(stringResource(R.string.stores_amazon_no_catalog)) } }
}
@@ -965,6 +971,39 @@ private fun ProfileStrip(store: Store, owned: Int, loaded: Boolean, s: FrontEndS
}
}
if (store == Store.EPIC) EpicLauncherRow(s, a)
if (store == Store.BATTLENET) BattleNetLauncherRow(s, a)
}
}
@Composable
private fun BattleNetLauncherRow(s: FrontEndState, a: FrontEndActions) {
val ctx = LocalContext.current
val colors = MaterialTheme.colorScheme
val pal = LocalPalette.current
val title = stringResource(R.string.bnet_name)
Box(Modifier.fillMaxWidth().height(1.dp).background(pal.line))
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp), modifier = Modifier.fillMaxWidth().testTag("stores-battlenet-launcher")) {
val icon by androidx.compose.runtime.produceState<java.io.File?>(null, s.battleNetInstalled) {
value = if (!s.battleNetInstalled) null
else kotlinx.coroutines.withContext(kotlinx.coroutines.Dispatchers.IO) { com.droiddeck.launcher.runtime.BattleNet.icon(ctx) }
}
if (icon != null) AsyncImage(model = icon, contentDescription = null, contentScale = ContentScale.Fit, modifier = Modifier.size(36.dp).clip(RoundedCornerShape(8.dp)))
Text(title, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f))
Actions {
SecondaryButton(stringResource(R.string.bnet_open), enabled = !s.busy, compact = true) { a.onBattleNet() }
val entry = remember(s.battleNetInstalled) { com.droiddeck.launcher.runtime.BattleNet.launcherEntry(s.battleNetInstalled) }
val scope = entry?.let { com.droiddeck.launcher.session.NoSteamLaunch.scope(it) }
if (entry != null && scope != null) {
val host = rememberMenuHost()
val settings = rememberGameSettings(scope)
Box {
SecondaryButton(stringResource(R.string.game_settings_card), compact = true) {
host.open = if (host.open == GAME_SETTINGS_MENU) null else GAME_SETTINGS_MENU
}
GameSettingsMenus(host, entry, settings)
}
}
}
}
}
@@ -1066,6 +1105,7 @@ internal fun storePalette(base: Palette, store: Store?): Palette {
Store.AMAZON -> Color(0xFFFF9900) to Color(0xFFE07800)
Store.XBOX -> Color(0xFF70C850) to Color(0xFF107C10)
Store.ITCH -> Color(0xFFFF5C5C) to Color(0xFFD93B3B)
Store.BATTLENET -> Color(0xFF148EFF) to Color(0xFF0B6BD3)
null -> return base
}
val on = if (accent.luminance() > 0.18f) Color(0xFF0B0B0D) else Color.White
+21
View File
@@ -2062,6 +2062,8 @@
<string name="stores_shelf_trending">الرائج</string>
<string name="stores_play">تشغيل</string>
<string name="stores_install">تثبيت</string>
<string name="bnet_open">فتح Battle.net</string>
<string name="bnet_store">ألعاب Blizzard</string>
<string name="stores_resume_install">استئناف التثبيت</string>
<string name="stores_dl_interrupted">منقطع</string>
<string name="stores_install_size">تثبيت · %1$s</string>
@@ -3143,6 +3145,25 @@
<string name="spatial_saved_views_hint">يمكن إعادة حساب المشاهدات المحفوظة. ابدأ معايرة جديدة لالتقاطها في نظام إحداثيات التتبع الحالي.</string>
<string name="spatial_model_checksum_error">المجموع الاختباري لنموذج تتبع اليدين غير مطابق</string>
<string name="spatial_opencv_load_error">تعذر تحميل OpenCV</string>
<string name="setup_group_memory">الذاكرة</string>
<string name="setup_clear_cached">إغلاق التطبيقات المخزّنة مؤقتًا قبل الجلسة</string>
<string name="setup_clear_cached_hint">عند بدء الجلسة، يُغلق DroidDeck التطبيقات التي يُبقيها Android في الخلفية، لتحصل اللعبة على ذاكرة أكبر. يجب تفعيل تصحيح الأخطاء اللاسلكي.</string>
<string name="setup_clear_cached_unpaired">يتطلّب إقران DroidDeck بتصحيح الأخطاء اللاسلكي (إقران، أدناه).</string>
<string name="setup_memory_hud">مؤشر الذاكرة</string>
<string name="setup_memory_hud_hint">الذاكرة وswap المستخدمة، على شاشة الجلسة. يقسّمها الوضع المتقدّم بين اللعبة وDroidDeck وAndroid وGPU.</string>
<string name="setup_memory_hud_simple">بسيط</string>
<string name="setup_memory_hud_advanced">متقدّم</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">اللعبة %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">التطبيقات في الخلفية أثناء الجلسة</string>
<string name="setup_bg_limit_hint">أثناء تشغيل الجلسة، يُبقي Android هذا العدد من التطبيقات كحد أقصى في الذاكرة المؤقتة ويُغلق الباقي، لتحصل اللعبة على ذاكرتها. يُعيد DroidDeck الحد إلى ما كان عليه عند انتهاء الجلسة. يجب تفعيل تصحيح الأخطاء اللاسلكي.</string>
<string name="setup_bg_limit_4">4 كحد أقصى</string>
<string name="setup_bg_limit_1">1 كحد أقصى</string>
<string name="setup_bg_limit_0">لا شيء</string>
<string name="setup_adb_pair">تصحيح الأخطاء اللاسلكي</string>
<string name="setup_adb_pair_hint">يُقرن DroidDeck بتصحيح الأخطاء اللاسلكي في Android للخيارات أعلاه. يبقى حد العمليات الفرعية متوقفًا.</string>
<string name="setup_adb_pair_button">إقران</string>
<string name="epic_client_missing">غير مثبَّت</string>
<string name="epic_client_open">فتح</string>
<string name="epic_client_install">تثبيت</string>
@@ -2030,6 +2030,8 @@
<string name="stores_shelf_trending">En tendencia</string>
<string name="stores_play">Jugar</string>
<string name="stores_install">Instalar</string>
<string name="bnet_open">Abrir Battle.net</string>
<string name="bnet_store">Juegos de Blizzard</string>
<string name="stores_resume_install">Reanudar instalación</string>
<string name="stores_dl_interrupted">Interrumpida</string>
<string name="stores_install_size">Instalar · %1$s</string>
@@ -2993,6 +2995,25 @@
<string name="spatial_saved_views_hint">Las vistas guardadas se pueden recalcular. Inicie una nueva calibración para capturar en el sistema de coordenadas de seguimiento actual.</string>
<string name="spatial_model_checksum_error">La suma de comprobación del modelo de mano no coincide</string>
<string name="spatial_opencv_load_error">OpenCV no se pudo cargar</string>
<string name="setup_group_memory">Memoria</string>
<string name="setup_clear_cached">Cerrar apps en caché antes de una sesión</string>
<string name="setup_clear_cached_hint">Al iniciar una sesión, DroidDeck cierra las apps que Android mantiene en segundo plano para que el juego tenga más memoria. La Depuración inalámbrica debe estar activada.</string>
<string name="setup_clear_cached_unpaired">DroidDeck debe estar vinculado con la Depuración inalámbrica (Vincular, abajo).</string>
<string name="setup_memory_hud">Indicador de memoria</string>
<string name="setup_memory_hud_hint">Memoria y swap en uso, en la pantalla de la sesión. Avanzado lo divide entre el juego, DroidDeck, Android y la GPU.</string>
<string name="setup_memory_hud_simple">Simple</string>
<string name="setup_memory_hud_advanced">Avanzado</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">juego %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">Apps en segundo plano durante una sesión</string>
<string name="setup_bg_limit_hint">Mientras una sesión está en curso, Android mantiene en caché como máximo esta cantidad de apps y cierra las demás para que el juego use su memoria. DroidDeck restablece el límite anterior cuando termina la sesión. La Depuración inalámbrica debe estar activada.</string>
<string name="setup_bg_limit_4">Como máximo 4</string>
<string name="setup_bg_limit_1">Como máximo 1</string>
<string name="setup_bg_limit_0">Ninguna</string>
<string name="setup_adb_pair">Depuración inalámbrica</string>
<string name="setup_adb_pair_hint">Vincula DroidDeck con la Depuración inalámbrica de Android para las opciones de arriba. El límite de procesos secundarios sigue desactivado.</string>
<string name="setup_adb_pair_button">Vincular</string>
<string name="epic_client_missing">No instalada</string>
<string name="epic_client_open">Abrir</string>
<string name="epic_client_install">Instalar</string>
+21
View File
@@ -1978,6 +1978,8 @@
<string name="stores_shelf_trending">Актуални</string>
<string name="stores_play">Играй</string>
<string name="stores_install">Инсталирай</string>
<string name="bnet_open">Отвори Battle.net</string>
<string name="bnet_store">Игри на Blizzard</string>
<string name="stores_resume_install">Продължи инсталацията</string>
<string name="stores_dl_interrupted">Прекъснато</string>
<string name="stores_install_size">Инсталация · %1$s</string>
@@ -3007,6 +3009,25 @@
<string name="spatial_saved_views_hint">Запазените изгледи могат да бъдат преизчислени. Започнете ново калибриране за заснемане в текущата координатна система за проследяване.</string>
<string name="spatial_model_checksum_error">Несъответствие на контролната сума на модела на ръката</string>
<string name="spatial_opencv_load_error">OpenCV не можа да се зареди</string>
<string name="setup_group_memory">Памет</string>
<string name="setup_clear_cached">Затваряне на кешираните приложения преди сесия</string>
<string name="setup_clear_cached_hint">При стартиране на сесия DroidDeck затваря приложенията, които Android държи във фонов режим, за да има играта повече памет. Безжичното отстраняване на грешки трябва да е включено.</string>
<string name="setup_clear_cached_unpaired">Изисква DroidDeck да е сдвоен чрез безжично отстраняване на грешки (Сдвояване, по-долу).</string>
<string name="setup_memory_hud">Показател за паметта</string>
<string name="setup_memory_hud_hint">Използвана памет и swap на екрана на сесията. Разширеният режим я разделя между играта, DroidDeck, Android и GPU.</string>
<string name="setup_memory_hud_simple">Опростен</string>
<string name="setup_memory_hud_advanced">Разширен</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">игра %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">Фонови приложения по време на сесия</string>
<string name="setup_bg_limit_hint">Докато сесията работи, Android държи в кеша най-много толкова приложения и затваря останалите, за да получи играта тяхната памет. DroidDeck връща предишното ограничение, когато сесията приключи. Безжичното отстраняване на грешки трябва да е включено.</string>
<string name="setup_bg_limit_4">Най-много 4</string>
<string name="setup_bg_limit_1">Най-много 1</string>
<string name="setup_bg_limit_0">Нито едно</string>
<string name="setup_adb_pair">Безжично отстраняване на грешки</string>
<string name="setup_adb_pair_hint">Сдвоява DroidDeck с безжичното отстраняване на грешки на Android за опциите по-горе. Ограничението на дъщерните процеси остава изключено.</string>
<string name="setup_adb_pair_button">Сдвояване</string>
<string name="epic_client_missing">Не е инсталирано</string>
<string name="epic_client_open">Отвори</string>
<string name="epic_client_install">Инсталиране</string>
+21
View File
@@ -2020,6 +2020,8 @@
<string name="stores_shelf_trending">Populární</string>
<string name="stores_play">Hrát</string>
<string name="stores_install">Instalovat</string>
<string name="bnet_open">Otevřít Battle.net</string>
<string name="bnet_store">Hry od Blizzardu</string>
<string name="stores_resume_install">Pokračovat v instalaci</string>
<string name="stores_dl_interrupted">Přerušeno</string>
<string name="stores_install_size">Instalace · %1$s</string>
@@ -3075,6 +3077,25 @@
<string name="spatial_saved_views_hint">Uložená zobrazení lze přepočítat. Spusťte novou kalibraci pro zachycení v aktuálním sledovacím souřadnicovém systému.</string>
<string name="spatial_model_checksum_error">Neshoda kontrolního součtu modelu ruky</string>
<string name="spatial_opencv_load_error">OpenCV se nepodařilo načíst</string>
<string name="setup_group_memory">Paměť</string>
<string name="setup_clear_cached">Zavřít aplikace v mezipaměti před relací</string>
<string name="setup_clear_cached_hint">Při spuštění relace DroidDeck zavře aplikace, které Android drží na pozadí, aby hra měla více paměti. Musí být zapnuté Bezdrátové ladění.</string>
<string name="setup_clear_cached_unpaired">Vyžaduje DroidDeck spárovaný přes Bezdrátové ladění (Spárovat, níže).</string>
<string name="setup_memory_hud">Ukazatel paměti</string>
<string name="setup_memory_hud_hint">Využitá paměť a swap na obrazovce relace. Pokročilé zobrazení ji rozdělí na hru, DroidDeck, Android a GPU.</string>
<string name="setup_memory_hud_simple">Jednoduché</string>
<string name="setup_memory_hud_advanced">Pokročilé</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">hra %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">Aplikace na pozadí během relace</string>
<string name="setup_bg_limit_hint">Během relace Android ponechá v mezipaměti nejvýše tolik aplikací a ostatní zavře, aby hra dostala jejich paměť. Po skončení relace DroidDeck vrátí limit na původní hodnotu. Musí být zapnuté Bezdrátové ladění.</string>
<string name="setup_bg_limit_4">Nejvýše 4</string>
<string name="setup_bg_limit_1">Nejvýše 1</string>
<string name="setup_bg_limit_0">Žádné</string>
<string name="setup_adb_pair">Bezdrátové ladění</string>
<string name="setup_adb_pair_hint">Spáruje DroidDeck s Bezdrátovým laděním Androidu pro výše uvedené možnosti. Omezení pro dětské procesy zůstane vypnuté.</string>
<string name="setup_adb_pair_button">Spárovat</string>
<string name="epic_client_missing">Není nainstalováno</string>
<string name="epic_client_open">Otevřít</string>
<string name="epic_client_install">Instalovat</string>
+21
View File
@@ -1978,6 +1978,8 @@
<string name="stores_shelf_trending">Populært</string>
<string name="stores_play">Spil</string>
<string name="stores_install">Installer</string>
<string name="bnet_open">Åbn Battle.net</string>
<string name="bnet_store">Blizzard-spil</string>
<string name="stores_resume_install">Genoptag installation</string>
<string name="stores_dl_interrupted">Afbrudt</string>
<string name="stores_install_size">Installation · %1$s</string>
@@ -3007,6 +3009,25 @@
<string name="spatial_saved_views_hint">Gemte visninger kan genberegnes. Start en ny kalibrering for at fange i det aktuelle sporingskoordinatsystem.</string>
<string name="spatial_model_checksum_error">Håndmodel kontrolsum uoverensstemmelse</string>
<string name="spatial_opencv_load_error">OpenCV kunne ikke indlæse</string>
<string name="setup_group_memory">Hukommelse</string>
<string name="setup_clear_cached">Luk cachelagrede apps før en session</string>
<string name="setup_clear_cached_hint">Når en session starter, lukker DroidDeck de apps, Android holder parkeret i baggrunden, så spillet får mere hukommelse. Trådløs fejlretning skal være slået til.</string>
<string name="setup_clear_cached_unpaired">Kræver, at DroidDeck er parret med Trådløs fejlretning (Par, nedenfor).</string>
<string name="setup_memory_hud">Hukommelsesvisning</string>
<string name="setup_memory_hud_hint">Hukommelse og swap i brug på sessionsskærmen. Avanceret fordeler det på spillet, DroidDeck, Android og GPU\'en.</string>
<string name="setup_memory_hud_simple">Enkel</string>
<string name="setup_memory_hud_advanced">Avanceret</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">spil %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">Baggrundsapps under en session</string>
<string name="setup_bg_limit_hint">Mens en session kører, holder Android højst så mange apps i cache og lukker resten, så spillet får deres hukommelse. DroidDeck sætter grænsen tilbage, som den var, når sessionen slutter. Trådløs fejlretning skal være slået til.</string>
<string name="setup_bg_limit_4">Højst 4</string>
<string name="setup_bg_limit_1">Højst 1</string>
<string name="setup_bg_limit_0">Ingen</string>
<string name="setup_adb_pair">Trådløs fejlretning</string>
<string name="setup_adb_pair_hint">Parrer DroidDeck med Androids Trådløs fejlretning til indstillingerne ovenfor. Grænsen for underprocesser forbliver slået fra.</string>
<string name="setup_adb_pair_button">Par</string>
<string name="epic_client_missing">Ikke installeret</string>
<string name="epic_client_open">Åbn</string>
<string name="epic_client_install">Installer</string>
+21
View File
@@ -1970,6 +1970,8 @@
<string name="stores_shelf_trending">Im Trend</string>
<string name="stores_play">Spielen</string>
<string name="stores_install">Installieren</string>
<string name="bnet_open">Battle.net öffnen</string>
<string name="bnet_store">Blizzard-Spiele</string>
<string name="stores_resume_install">Installation fortsetzen</string>
<string name="stores_dl_interrupted">Unterbrochen</string>
<string name="stores_install_size">Installieren · %1$s</string>
@@ -3007,6 +3009,25 @@
<string name="spatial_saved_views_hint">Gespeicherte Ansichten können neu berechnet werden. Starten Sie eine neue Kalibrierung zur Erfassung im aktuellen Tracking-Koordinatensystem.</string>
<string name="spatial_model_checksum_error">Die Prüfsumme des Handmodells stimmt nicht überein</string>
<string name="spatial_opencv_load_error">OpenCV konnte nicht geladen werden</string>
<string name="setup_group_memory">Arbeitsspeicher</string>
<string name="setup_clear_cached">Apps im Cache vor einer Sitzung schließen</string>
<string name="setup_clear_cached_hint">Beim Start einer Sitzung schließt DroidDeck die Apps, die Android im Hintergrund vorhält, damit das Spiel mehr Arbeitsspeicher hat. „Debugging über WLAN“ muss aktiviert sein.</string>
<string name="setup_clear_cached_unpaired">DroidDeck muss über „Debugging über WLAN“ gekoppelt sein (Koppeln, unten).</string>
<string name="setup_memory_hud">Speicheranzeige</string>
<string name="setup_memory_hud_hint">Belegter Arbeitsspeicher und Swap auf dem Sitzungsbildschirm. „Erweitert“ schlüsselt ihn nach Spiel, DroidDeck, Android und GPU auf.</string>
<string name="setup_memory_hud_simple">Einfach</string>
<string name="setup_memory_hud_advanced">Erweitert</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · Swap %3$s/%4$s GB</string>
<string name="memory_hud_split">Spiel %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">Hintergrund-Apps während einer Sitzung</string>
<string name="setup_bg_limit_hint">Während eine Sitzung läuft, hält Android höchstens so viele Apps im Cache und schließt die übrigen, damit das Spiel deren Speicher bekommt. DroidDeck stellt das vorherige Limit wieder her, wenn die Sitzung endet. „Debugging über WLAN“ muss aktiviert sein.</string>
<string name="setup_bg_limit_4">Höchstens 4</string>
<string name="setup_bg_limit_1">Höchstens 1</string>
<string name="setup_bg_limit_0">Keine</string>
<string name="setup_adb_pair">Debugging über WLAN</string>
<string name="setup_adb_pair_hint">Koppelt DroidDeck mit „Debugging über WLAN“ von Android für die Optionen oben. Das Limit für untergeordnete Prozesse bleibt aus.</string>
<string name="setup_adb_pair_button">Koppeln</string>
<string name="epic_client_missing">Nicht installiert</string>
<string name="epic_client_open">Öffnen</string>
<string name="epic_client_install">Installieren</string>
+21
View File
@@ -1978,6 +1978,8 @@
<string name="stores_shelf_trending">Σε άνοδο</string>
<string name="stores_play">Αναπαραγωγή</string>
<string name="stores_install">Εγκατάσταση</string>
<string name="bnet_open">Άνοιγμα του Battle.net</string>
<string name="bnet_store">Παιχνίδια της Blizzard</string>
<string name="stores_resume_install">Συνέχιση εγκατάστασης</string>
<string name="stores_dl_interrupted">Διακόπηκε</string>
<string name="stores_install_size">Εγκατάσταση · %1$s</string>
@@ -3007,6 +3009,25 @@
<string name="spatial_saved_views_hint">Οι αποθηκευμένες προβολές μπορούν να υπολογιστούν εκ νέου. Ξεκινήστε μια νέα βαθμονόμηση για αποτύπωση στο τρέχον σύστημα συντεταγμένων παρακολούθησης.</string>
<string name="spatial_model_checksum_error">Αναντιστοιχία αθροίσματος ελέγχου μοντέλου χεριού</string>
<string name="spatial_opencv_load_error">Δεν ήταν δυνατή η φόρτωση του OpenCV</string>
<string name="setup_group_memory">Μνήμη</string>
<string name="setup_clear_cached">Κλείσιμο εφαρμογών στην προσωρινή μνήμη πριν από τη συνεδρία</string>
<string name="setup_clear_cached_hint">Όταν ξεκινά μια συνεδρία, το DroidDeck κλείνει τις εφαρμογές που το Android κρατά στο παρασκήνιο, ώστε το παιχνίδι να έχει περισσότερη μνήμη. Ο Ασύρματος εντοπισμός σφαλμάτων πρέπει να είναι ενεργός.</string>
<string name="setup_clear_cached_unpaired">Απαιτεί σύζευξη του DroidDeck με τον Ασύρματο εντοπισμό σφαλμάτων (Σύζευξη, παρακάτω).</string>
<string name="setup_memory_hud">Ένδειξη μνήμης</string>
<string name="setup_memory_hud_hint">Μνήμη και swap σε χρήση, στην οθόνη της συνεδρίας. Με την επιλογή «Για προχωρημένους» χωρίζεται σε παιχνίδι, DroidDeck, Android και GPU.</string>
<string name="setup_memory_hud_simple">Απλή</string>
<string name="setup_memory_hud_advanced">Για προχωρημένους</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">παιχνίδι %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">Εφαρμογές παρασκηνίου κατά τη συνεδρία</string>
<string name="setup_bg_limit_hint">Όσο εκτελείται μια συνεδρία, το Android κρατά στην προσωρινή μνήμη το πολύ τόσες εφαρμογές και κλείνει τις υπόλοιπες, ώστε το παιχνίδι να πάρει τη μνήμη τους. Το DroidDeck επαναφέρει το όριο όπως ήταν όταν τελειώσει η συνεδρία. Ο Ασύρματος εντοπισμός σφαλμάτων πρέπει να είναι ενεργός.</string>
<string name="setup_bg_limit_4">Το πολύ 4</string>
<string name="setup_bg_limit_1">Το πολύ 1</string>
<string name="setup_bg_limit_0">Καμία</string>
<string name="setup_adb_pair">Ασύρματος εντοπισμός σφαλμάτων</string>
<string name="setup_adb_pair_hint">Συζευγνύει το DroidDeck με τον Ασύρματο εντοπισμό σφαλμάτων του Android για τις παραπάνω επιλογές. Το όριο θυγατρικών διαδικασιών παραμένει απενεργοποιημένο.</string>
<string name="setup_adb_pair_button">Σύζευξη</string>
<string name="epic_client_missing">Δεν είναι εγκατεστημένο</string>
<string name="epic_client_open">Άνοιγμα</string>
<string name="epic_client_install">Εγκατάσταση</string>
+21
View File
@@ -2001,6 +2001,8 @@
<string name="stores_shelf_trending">En tendencia</string>
<string name="stores_play">Jugar</string>
<string name="stores_install">Instalar</string>
<string name="bnet_open">Abrir Battle.net</string>
<string name="bnet_store">Juegos de Blizzard</string>
<string name="stores_resume_install">Reanudar instalación</string>
<string name="stores_dl_interrupted">Interrumpida</string>
<string name="stores_install_size">Instalar · %1$s</string>
@@ -3043,6 +3045,25 @@
<string name="spatial_saved_views_hint">Las vistas guardadas se pueden recalcular. Inicie una nueva calibración para capturar en el sistema de coordenadas de seguimiento actual.</string>
<string name="spatial_model_checksum_error">La suma de comprobación del modelo de mano no coincide</string>
<string name="spatial_opencv_load_error">OpenCV no se pudo cargar</string>
<string name="setup_group_memory">Memoria</string>
<string name="setup_clear_cached">Cerrar apps en caché antes de una sesión</string>
<string name="setup_clear_cached_hint">Al empezar una sesión, cierra las apps que Android mantiene en segundo plano para que el juego tenga más memoria. La depuración inalámbrica debe estar activada.</string>
<string name="setup_clear_cached_unpaired">DroidDeck debe estar vinculado con la depuración inalámbrica (Vincular, abajo).</string>
<string name="setup_memory_hud">Indicador de memoria</string>
<string name="setup_memory_hud_hint">Memoria y swap en uso, en la pantalla de la sesión. Avanzado lo divide entre el juego, DroidDeck, Android y la GPU.</string>
<string name="setup_memory_hud_simple">Simple</string>
<string name="setup_memory_hud_advanced">Avanzado</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">juego %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">Apps en segundo plano durante una sesión</string>
<string name="setup_bg_limit_hint">Mientras una sesión está en marcha, Android mantiene en caché como máximo este número de apps y cierra las demás, para que el juego tenga su memoria. Se restablece al terminar la sesión. La depuración inalámbrica debe estar activada.</string>
<string name="setup_bg_limit_4">Como máximo 4</string>
<string name="setup_bg_limit_1">Como máximo 1</string>
<string name="setup_bg_limit_0">Ninguna</string>
<string name="setup_adb_pair">Depuración inalámbrica</string>
<string name="setup_adb_pair_hint">Vincula DroidDeck con la depuración inalámbrica de Android para las opciones de arriba. El límite de procesos secundarios sigue desactivado.</string>
<string name="setup_adb_pair_button">Vincular</string>
<string name="epic_client_missing">No instalada</string>
<string name="epic_client_open">Abrir</string>
<string name="epic_client_install">Instalar</string>
+21
View File
@@ -1978,6 +1978,8 @@
<string name="stores_shelf_trending">Nousussa</string>
<string name="stores_play">Pelaa</string>
<string name="stores_install">Asenna</string>
<string name="bnet_open">Avaa Battle.net</string>
<string name="bnet_store">Blizzardin pelit</string>
<string name="stores_resume_install">Jatka asennusta</string>
<string name="stores_dl_interrupted">Keskeytynyt</string>
<string name="stores_install_size">Asenna · %1$s</string>
@@ -3007,6 +3009,25 @@
<string name="spatial_saved_views_hint">Tallennetut näkymät voidaan laskea uudelleen. Aloita uusi kalibrointi kaapataksesi nykyiseen seurantakoordinaattijärjestelmään.</string>
<string name="spatial_model_checksum_error">Käsimallin tarkistussumman epäsuhta</string>
<string name="spatial_opencv_load_error">OpenCV:tä ei voitu ladata</string>
<string name="setup_group_memory">Muisti</string>
<string name="setup_clear_cached">Sulje välimuistissa olevat sovellukset ennen istuntoa</string>
<string name="setup_clear_cached_hint">Kun istunto alkaa, DroidDeck sulkee sovellukset, joita Android pitää taustalla, jotta pelillä on enemmän muistia. Langattoman virheenkorjauksen on oltava päällä.</string>
<string name="setup_clear_cached_unpaired">Vaatii, että DroidDeck on pariutettu Langattoman virheenkorjauksen kautta (Pariuta, alla).</string>
<string name="setup_memory_hud">Muistinäyttö</string>
<string name="setup_memory_hud_hint">Käytössä oleva muisti ja swap istuntonäytöllä. Laajennettu näyttää erikseen pelin, DroidDeckin, Androidin ja GPU:n osuuden.</string>
<string name="setup_memory_hud_simple">Yksinkertainen</string>
<string name="setup_memory_hud_advanced">Laajennettu</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">peli %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">Taustasovellukset istunnon aikana</string>
<string name="setup_bg_limit_hint">Istunnon aikana Android pitää välimuistissa enintään näin monta sovellusta ja sulkee loput, jotta peli saa niiden muistin. DroidDeck palauttaa rajan ennalleen, kun istunto päättyy. Langattoman virheenkorjauksen on oltava päällä.</string>
<string name="setup_bg_limit_4">Enintään 4</string>
<string name="setup_bg_limit_1">Enintään 1</string>
<string name="setup_bg_limit_0">Ei mitään</string>
<string name="setup_adb_pair">Langaton virheenkorjaus</string>
<string name="setup_adb_pair_hint">Pariuttaa DroidDeckin Androidin Langattomaan virheenkorjaukseen yllä olevia asetuksia varten. Lapsiprosessien raja pysyy pois päältä.</string>
<string name="setup_adb_pair_button">Pariuta</string>
<string name="epic_client_missing">Ei asennettu</string>
<string name="epic_client_open">Avaa</string>
<string name="epic_client_install">Asenna</string>
+21
View File
@@ -2001,6 +2001,8 @@
<string name="stores_shelf_trending">Tendances</string>
<string name="stores_play">Jouer</string>
<string name="stores_install">Installer</string>
<string name="bnet_open">Ouvrir Battle.net</string>
<string name="bnet_store">Jeux Blizzard</string>
<string name="stores_resume_install">Reprendre l\'installation</string>
<string name="stores_dl_interrupted">Interrompu</string>
<string name="stores_install_size">Installer · %1$s</string>
@@ -3043,6 +3045,25 @@
<string name="spatial_saved_views_hint">Les vues enregistrées peuvent être recalculées. Démarrez un nouvel étalonnage pour capturer dans le système de coordonnées de suivi actuel.</string>
<string name="spatial_model_checksum_error">Incohérence de la somme de contrôle du modèle manuel</string>
<string name="spatial_opencv_load_error">OpenCV n\'a pas pu charger</string>
<string name="setup_group_memory">Mémoire</string>
<string name="setup_clear_cached">Fermer les applis en cache avant une session</string>
<string name="setup_clear_cached_hint">Au début d\'une session, ferme les applis qu\'Android garde en arrière-plan, pour laisser plus de mémoire au jeu. Le débogage sans fil doit être activé.</string>
<string name="setup_clear_cached_unpaired">DroidDeck doit être associé au débogage sans fil (Associer, ci-dessous).</string>
<string name="setup_memory_hud">Indicateur de mémoire</string>
<string name="setup_memory_hud_hint">Mémoire et swap utilisés, sur l\'écran de la session. Avancé détaille le jeu, DroidDeck, Android et le GPU.</string>
<string name="setup_memory_hud_simple">Simple</string>
<string name="setup_memory_hud_advanced">Avancé</string>
<string name="memory_hud_simple">RAM %1$s/%2$s Go · swap %3$s/%4$s Go</string>
<string name="memory_hud_split">jeu %1$s · DroidDeck %2$s · Android %3$s Go</string>
<string name="memory_hud_gpu">GPU %1$s Go</string>
<string name="setup_bg_limit">Applis en arrière-plan pendant une session</string>
<string name="setup_bg_limit_hint">Pendant une session, Android garde au plus ce nombre d\'applis en cache et ferme les autres, pour laisser leur mémoire au jeu. Rétabli à la fin de la session. Le débogage sans fil doit être activé.</string>
<string name="setup_bg_limit_4">4 au maximum</string>
<string name="setup_bg_limit_1">1 au maximum</string>
<string name="setup_bg_limit_0">Aucune</string>
<string name="setup_adb_pair">Débogage sans fil</string>
<string name="setup_adb_pair_hint">Associe DroidDeck au débogage sans fil d\'Android pour les options ci-dessus. La limite des processus enfants reste désactivée.</string>
<string name="setup_adb_pair_button">Associer</string>
<string name="epic_client_missing">Non installé</string>
<string name="epic_client_open">Ouvrir</string>
<string name="epic_client_install">Installer</string>
+21
View File
@@ -1978,6 +1978,8 @@
<string name="stores_shelf_trending">ट्रेंडिंग</string>
<string name="stores_play">Play</string>
<string name="stores_install">इंस्टॉल करें</string>
<string name="bnet_open">Battle.net खोलें</string>
<string name="bnet_store">Blizzard के गेम</string>
<string name="stores_resume_install">इंस्टॉल फिर से शुरू करें</string>
<string name="stores_dl_interrupted">बाधित</string>
<string name="stores_install_size">इंस्टॉल · %1$s</string>
@@ -3007,6 +3009,25 @@
<string name="spatial_saved_views_hint">सहेजे गए दृश्यों की पुनर्गणना की जा सकती है। वर्तमान ट्रैकिंग समन्वय प्रणाली में कैप्चर करने के लिए एक नया अंशांकन प्रारंभ करें।</string>
<string name="spatial_model_checksum_error">हैंड मॉडल चेकसम बेमेल</string>
<string name="spatial_opencv_load_error">OpenCV लोड नहीं हो सका</string>
<string name="setup_group_memory">मेमोरी</string>
<string name="setup_clear_cached">सेशन से पहले कैश्ड ऐप बंद करें</string>
<string name="setup_clear_cached_hint">सेशन शुरू होने पर DroidDeck उन ऐप को बंद कर देता है जिन्हें Android बैकग्राउंड में रखता है, ताकि गेम को ज़्यादा मेमोरी मिले। वायरलेस डीबगिंग चालू होनी चाहिए।</string>
<string name="setup_clear_cached_unpaired">DroidDeck को वायरलेस डीबगिंग से पेयर करना ज़रूरी है (नीचे, पेयर करें)।</string>
<string name="setup_memory_hud">मेमोरी रीडआउट</string>
<string name="setup_memory_hud_hint">सेशन स्क्रीन पर इस्तेमाल हो रही मेमोरी और swap। एडवांस्ड इसे गेम, DroidDeck, Android और GPU में बांटकर दिखाता है।</string>
<string name="setup_memory_hud_simple">सिंपल</string>
<string name="setup_memory_hud_advanced">एडवांस्ड</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">गेम %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">सेशन के दौरान बैकग्राउंड ऐप</string>
<string name="setup_bg_limit_hint">सेशन चलते समय Android ज़्यादा से ज़्यादा इतने ऐप कैश में रखता है और बाकी बंद कर देता है, ताकि गेम को उनकी मेमोरी मिले। सेशन खत्म होने पर DroidDeck सीमा को पहले जैसा कर देता है। वायरलेस डीबगिंग चालू होनी चाहिए।</string>
<string name="setup_bg_limit_4">ज़्यादा से ज़्यादा 4</string>
<string name="setup_bg_limit_1">ज़्यादा से ज़्यादा 1</string>
<string name="setup_bg_limit_0">कोई नहीं</string>
<string name="setup_adb_pair">वायरलेस डीबगिंग</string>
<string name="setup_adb_pair_hint">ऊपर दिए गए विकल्पों के लिए DroidDeck को Android की वायरलेस डीबगिंग से पेयर करता है। चाइल्ड-प्रोसेस सीमा बंद ही रहती है।</string>
<string name="setup_adb_pair_button">पेयर करें</string>
<string name="epic_client_missing">इंस्टॉल नहीं है</string>
<string name="epic_client_open">खोलें</string>
<string name="epic_client_install">इंस्टॉल करें</string>
+21
View File
@@ -1978,6 +1978,8 @@
<string name="stores_shelf_trending">Felkapott</string>
<string name="stores_play">Játék</string>
<string name="stores_install">Telepítés</string>
<string name="bnet_open">Battle.net megnyitása</string>
<string name="bnet_store">Blizzard-játékok</string>
<string name="stores_resume_install">Telepítés folytatása</string>
<string name="stores_dl_interrupted">Megszakítva</string>
<string name="stores_install_size">Telepítés · %1$s</string>
@@ -3005,6 +3007,25 @@
<string name="spatial_saved_views_hint">Az elmentett nézetek újraszámíthatók. Indítson el egy új kalibrálást, hogy rögzítse az aktuális követési koordináta-rendszerben.</string>
<string name="spatial_model_checksum_error">A kézi modell ellenőrzőösszegének eltérése</string>
<string name="spatial_opencv_load_error">Az OpenCV betöltése nem sikerült</string>
<string name="setup_group_memory">Memória</string>
<string name="setup_clear_cached">Gyorsítótárazott alkalmazások bezárása munkamenet előtt</string>
<string name="setup_clear_cached_hint">Munkamenet indításakor a DroidDeck bezárja azokat az alkalmazásokat, amelyeket az Android a háttérben tart, így a játéknak több memória jut. A vezeték nélküli hibakeresésnek bekapcsolva kell lennie.</string>
<string name="setup_clear_cached_unpaired">A DroidDecket párosítani kell a vezeték nélküli hibakereséssel (Párosítás, lent).</string>
<string name="setup_memory_hud">Memóriakijelzés</string>
<string name="setup_memory_hud_hint">A használt memória és swap a munkamenet képernyőjén. A Speciális nézet szétbontja a játék, a DroidDeck, az Android és a GPU között.</string>
<string name="setup_memory_hud_simple">Egyszerű</string>
<string name="setup_memory_hud_advanced">Speciális</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">játék %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">Háttéralkalmazások munkamenet közben</string>
<string name="setup_bg_limit_hint">Munkamenet közben az Android legfeljebb ennyi alkalmazást tart a gyorsítótárban, a többit bezárja, így azok memóriája a játéké lesz. A munkamenet végén a DroidDeck visszaállítja a korábbi korlátot. A vezeték nélküli hibakeresésnek bekapcsolva kell lennie.</string>
<string name="setup_bg_limit_4">Legfeljebb 4</string>
<string name="setup_bg_limit_1">Legfeljebb 1</string>
<string name="setup_bg_limit_0">Nincs</string>
<string name="setup_adb_pair">Vezeték nélküli hibakeresés</string>
<string name="setup_adb_pair_hint">Párosítja a DroidDecket az Android vezeték nélküli hibakeresésével a fenti beállításokhoz. A gyermekfolyamat-korlát kikapcsolva marad.</string>
<string name="setup_adb_pair_button">Párosítás</string>
<string name="glasses_3dof">3DoF virtuális képernyő</string>
<string name="glasses_6dof">6DoF virtuális képernyő</string>
<string name="epic_client_missing">Nincs telepítve</string>
+21
View File
@@ -1957,6 +1957,8 @@
<string name="stores_shelf_trending">Sedang tren</string>
<string name="stores_play">Mainkan</string>
<string name="stores_install">Instal</string>
<string name="bnet_open">Buka Battle.net</string>
<string name="bnet_store">Game Blizzard</string>
<string name="stores_resume_install">Lanjutkan instalasi</string>
<string name="stores_dl_interrupted">Terhenti</string>
<string name="stores_install_size">Instal · %1$s</string>
@@ -2982,6 +2984,25 @@
<string name="spatial_saved_views_hint">Tampilan yang disimpan dapat dihitung ulang. Mulai kalibrasi baru untuk menangkap sistem koordinat pelacakan saat ini.</string>
<string name="spatial_model_checksum_error">Ketidakcocokan checksum model tangan</string>
<string name="spatial_opencv_load_error">OpenCV tidak dapat memuat</string>
<string name="setup_group_memory">Memori</string>
<string name="setup_clear_cached">Tutup aplikasi dalam cache sebelum sesi</string>
<string name="setup_clear_cached_hint">Saat sesi dimulai, DroidDeck menutup aplikasi yang disimpan Android di latar belakang agar gim mendapat lebih banyak memori. Debugging nirkabel harus aktif.</string>
<string name="setup_clear_cached_unpaired">DroidDeck harus disandingkan dengan Debugging nirkabel (Pasangkan, di bawah).</string>
<string name="setup_memory_hud">Tampilan memori</string>
<string name="setup_memory_hud_hint">Memori dan swap yang digunakan, di layar sesi. Lanjutan merincinya menjadi gim, DroidDeck, Android, dan GPU.</string>
<string name="setup_memory_hud_simple">Sederhana</string>
<string name="setup_memory_hud_advanced">Lanjutan</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">gim %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">Aplikasi latar belakang selama sesi</string>
<string name="setup_bg_limit_hint">Selama sesi berjalan, Android menyimpan paling banyak sejumlah ini aplikasi di cache dan menutup sisanya agar gim mendapat memorinya. DroidDeck mengembalikan batas seperti semula saat sesi berakhir. Debugging nirkabel harus aktif.</string>
<string name="setup_bg_limit_4">Paling banyak 4</string>
<string name="setup_bg_limit_1">Paling banyak 1</string>
<string name="setup_bg_limit_0">Tidak ada</string>
<string name="setup_adb_pair">Debugging nirkabel</string>
<string name="setup_adb_pair_hint">Menyandingkan DroidDeck dengan Debugging nirkabel Android untuk opsi di atas. Batas proses turunan tetap nonaktif.</string>
<string name="setup_adb_pair_button">Pasangkan</string>
<string name="epic_client_missing">Belum terinstal</string>
<string name="epic_client_open">Buka</string>
<string name="epic_client_install">Pasang</string>
+21
View File
@@ -1991,6 +1991,8 @@
<string name="stores_shelf_trending">Di tendenza</string>
<string name="stores_play">Gioca</string>
<string name="stores_install">Installa</string>
<string name="bnet_open">Apri Battle.net</string>
<string name="bnet_store">Giochi Blizzard</string>
<string name="stores_resume_install">Riprendi installazione</string>
<string name="stores_dl_interrupted">Interrotto</string>
<string name="stores_install_size">Installa · %1$s</string>
@@ -3039,6 +3041,25 @@
<string name="spatial_saved_views_hint">Le visualizzazioni salvate possono essere ricalcolate. Avvia una nuova calibrazione per acquisire il sistema di coordinate di tracciamento corrente.</string>
<string name="spatial_model_checksum_error">Mancata corrispondenza del checksum del modello di mano</string>
<string name="spatial_opencv_load_error">Impossibile caricare OpenCV</string>
<string name="setup_group_memory">Memoria</string>
<string name="setup_clear_cached">Chiudi le app in cache prima di una sessione</string>
<string name="setup_clear_cached_hint">All\'avvio di una sessione, DroidDeck chiude le app che Android tiene parcheggiate in background, così il gioco ha più memoria. Il Debug wireless deve essere attivo.</string>
<string name="setup_clear_cached_unpaired">Richiede DroidDeck accoppiato con il Debug wireless (Accoppia, qui sotto).</string>
<string name="setup_memory_hud">Indicatore della memoria</string>
<string name="setup_memory_hud_hint">Memoria e swap in uso, nella schermata della sessione. Avanzato la suddivide tra gioco, DroidDeck, Android e GPU.</string>
<string name="setup_memory_hud_simple">Semplice</string>
<string name="setup_memory_hud_advanced">Avanzato</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">gioco %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">App in background durante una sessione</string>
<string name="setup_bg_limit_hint">Durante una sessione, Android tiene in cache al massimo questo numero di app e chiude le altre, così il gioco ha la loro memoria. Al termine della sessione DroidDeck ripristina il limite precedente. Il Debug wireless deve essere attivo.</string>
<string name="setup_bg_limit_4">Al massimo 4</string>
<string name="setup_bg_limit_1">Al massimo 1</string>
<string name="setup_bg_limit_0">Nessuna</string>
<string name="setup_adb_pair">Debug wireless</string>
<string name="setup_adb_pair_hint">Accoppia DroidDeck al Debug wireless di Android per le opzioni qui sopra. Il limite dei processi figlio resta disattivato.</string>
<string name="setup_adb_pair_button">Accoppia</string>
<string name="setup_glasses_scope">Le impostazioni dello schermo e del tracciamento della testa sono condivise tra menu, giochi e sessioni desktop di DroidDeck.</string>
<string name="spatial_print_job">DroidDeck ChArUco 30 mm</string>
<string name="epic_client_missing">Non installata</string>
+21
View File
@@ -1959,6 +1959,8 @@
<string name="stores_shelf_trending">トレンド</string>
<string name="stores_play">プレイ</string>
<string name="stores_install">インストール</string>
<string name="bnet_open">Battle.net を開く</string>
<string name="bnet_store">Blizzard のゲーム</string>
<string name="stores_resume_install">インストールを再開</string>
<string name="stores_dl_interrupted">中断</string>
<string name="stores_install_size">インストール · %1$s</string>
@@ -2984,6 +2986,25 @@
<string name="spatial_opencv_load_error">OpenCVをロードできませんでした</string>
<string name="tracking_recovery_look">明るい部屋でゆっくりと周囲を見回してください。\nトラッキングカメラを遮るものがないように、家具などの見えるものに顔を向けてください。</string>
<string name="spatial_print_job">DroidDeck ChArUco 30 mm</string>
<string name="setup_group_memory">メモリ</string>
<string name="setup_clear_cached">セッション前にキャッシュ済みアプリを閉じる</string>
<string name="setup_clear_cached_hint">セッションの開始時に、Android がバックグラウンドに保持しているアプリを閉じ、ゲームに使えるメモリを増やします。ワイヤレスデバッグをオンにする必要があります。</string>
<string name="setup_clear_cached_unpaired">DroidDeck をワイヤレスデバッグとペア設定する必要があります(下の「ペア設定」)。</string>
<string name="setup_memory_hud">メモリ表示</string>
<string name="setup_memory_hud_hint">使用中のメモリとスワップをセッション画面に表示します。詳細設定では、ゲーム、DroidDeck、Android、GPU に分けて表示します。</string>
<string name="setup_memory_hud_simple">シンプル</string>
<string name="setup_memory_hud_advanced">詳細設定</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · スワップ %3$s/%4$s GB</string>
<string name="memory_hud_split">ゲーム %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">セッション中のバックグラウンドアプリ</string>
<string name="setup_bg_limit_hint">セッション中、Android がキャッシュに保持するアプリをこの数までに抑え、残りを閉じてゲームにメモリを回します。セッション終了時に元に戻します。ワイヤレスデバッグをオンにする必要があります。</string>
<string name="setup_bg_limit_4">最大 4 個</string>
<string name="setup_bg_limit_1">最大 1 個</string>
<string name="setup_bg_limit_0">なし</string>
<string name="setup_adb_pair">ワイヤレスデバッグ</string>
<string name="setup_adb_pair_hint">上のオプションのために DroidDeck を Android のワイヤレスデバッグとペア設定します。子プロセス制限はオフのままです。</string>
<string name="setup_adb_pair_button">ペア設定</string>
<string name="epic_client_missing">未インストール</string>
<string name="epic_client_open">開く</string>
<string name="epic_client_install">インストール</string>
+21
View File
@@ -1959,6 +1959,8 @@
<string name="stores_shelf_trending">인기 급상승</string>
<string name="stores_play">플레이</string>
<string name="stores_install">설치</string>
<string name="bnet_open">Battle.net 열기</string>
<string name="bnet_store">Blizzard 게임</string>
<string name="stores_resume_install">설치 재개</string>
<string name="stores_dl_interrupted">중단됨</string>
<string name="stores_install_size">설치 · %1$s</string>
@@ -2984,6 +2986,25 @@
<string name="spatial_distance_result">카메라 측정 %1$s; 선택한 거리 %2$s. %3$s</string>
<string name="spatial_wait_previews">보정을 시작하기 전에 두 카메라 미리보기를 모두 기다리세요.</string>
<string name="spatial_saved_views_hint">저장된 뷰는 다시 계산될 수 있습니다. 현재 추적 좌표계에서 캡처하려면 새 보정을 시작하세요.</string>
<string name="setup_group_memory">메모리</string>
<string name="setup_clear_cached">세션 전에 캐시된 앱 닫기</string>
<string name="setup_clear_cached_hint">세션이 시작될 때 Android가 백그라운드에 보관 중인 앱을 닫아 게임이 메모리를 더 쓸 수 있게 합니다. 무선 디버깅이 켜져 있어야 합니다.</string>
<string name="setup_clear_cached_unpaired">DroidDeck을 무선 디버깅과 페어링해야 합니다(아래 페어링).</string>
<string name="setup_memory_hud">메모리 표시</string>
<string name="setup_memory_hud_hint">사용 중인 메모리와 스왑을 세션 화면에 표시합니다. 고급에서는 게임, DroidDeck, Android, GPU로 나눠 보여 줍니다.</string>
<string name="setup_memory_hud_simple">간단</string>
<string name="setup_memory_hud_advanced">고급</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · 스왑 %3$s/%4$s GB</string>
<string name="memory_hud_split">게임 %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">세션 중 백그라운드 앱</string>
<string name="setup_bg_limit_hint">세션이 실행되는 동안 Android가 캐시에 두는 앱을 이 개수까지로 제한하고 나머지는 닫아 게임이 그 메모리를 쓰게 합니다. 세션이 끝나면 원래대로 돌아갑니다. 무선 디버깅이 켜져 있어야 합니다.</string>
<string name="setup_bg_limit_4">최대 4개</string>
<string name="setup_bg_limit_1">최대 1개</string>
<string name="setup_bg_limit_0">없음</string>
<string name="setup_adb_pair">무선 디버깅</string>
<string name="setup_adb_pair_hint">위 옵션을 위해 DroidDeck을 Android 무선 디버깅과 페어링합니다. 하위 프로세스 제한은 꺼진 상태로 유지됩니다.</string>
<string name="setup_adb_pair_button">페어링</string>
<string name="epic_client_missing">설치되지 않음</string>
<string name="epic_client_open">열기</string>
<string name="epic_client_install">설치</string>
+21
View File
@@ -1957,6 +1957,8 @@
<string name="stores_shelf_trending">Tular</string>
<string name="stores_play">Main</string>
<string name="stores_install">Pasang</string>
<string name="bnet_open">Buka Battle.net</string>
<string name="bnet_store">Permainan Blizzard</string>
<string name="stores_resume_install">Sambung pemasangan</string>
<string name="stores_dl_interrupted">Terganggu</string>
<string name="stores_install_size">Pasang · %1$s</string>
@@ -2980,6 +2982,25 @@
<string name="spatial_saved_views_hint">Pandangan yang disimpan boleh dikira semula. Mulakan penentukuran baharu untuk ditangkap dalam sistem koordinat penjejakan semasa.</string>
<string name="spatial_model_checksum_error">Ketakpadanan checksum model tangan</string>
<string name="spatial_opencv_load_error">OpenCV tidak dapat dimuatkan</string>
<string name="setup_group_memory">Memori</string>
<string name="setup_clear_cached">Tutup apl dalam cache sebelum sesi</string>
<string name="setup_clear_cached_hint">Apabila sesi bermula, DroidDeck menutup apl yang disimpan Android di latar belakang supaya permainan mendapat lebih banyak memori. Debugging Wayarles mesti dihidupkan.</string>
<string name="setup_clear_cached_unpaired">Memerlukan DroidDeck digandingkan dengan Debugging Wayarles (Gandingkan, di bawah).</string>
<string name="setup_memory_hud">Paparan memori</string>
<string name="setup_memory_hud_hint">Memori dan swap yang digunakan, pada skrin sesi. Lanjutan memecahkannya kepada permainan, DroidDeck, Android dan GPU.</string>
<string name="setup_memory_hud_simple">Ringkas</string>
<string name="setup_memory_hud_advanced">Lanjutan</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">permainan %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">Apl latar belakang semasa sesi</string>
<string name="setup_bg_limit_hint">Semasa sesi berjalan, Android menyimpan paling banyak bilangan apl ini dalam cache dan menutup selebihnya, supaya permainan mendapat memori apl tersebut. DroidDeck memulihkan had seperti asal apabila sesi tamat. Debugging Wayarles mesti dihidupkan.</string>
<string name="setup_bg_limit_4">Paling banyak 4</string>
<string name="setup_bg_limit_1">Paling banyak 1</string>
<string name="setup_bg_limit_0">Tiada</string>
<string name="setup_adb_pair">Debugging Wayarles</string>
<string name="setup_adb_pair_hint">Menggandingkan DroidDeck dengan Debugging Wayarles Android untuk pilihan di atas. Had proses anak kekal dimatikan.</string>
<string name="setup_adb_pair_button">Gandingkan</string>
<string name="spatial_print_title">DroidDeck - Penentukuran Luma Ultra</string>
<string name="spatial_base_loaded">Penentukuran asas Luma Ultra dimuatkan</string>
<string name="epic_client_missing">Belum dipasang</string>
+21
View File
@@ -1978,6 +1978,8 @@
<string name="stores_shelf_trending">Trender</string>
<string name="stores_play">Spill</string>
<string name="stores_install">Installer</string>
<string name="bnet_open">Åpne Battle.net</string>
<string name="bnet_store">Blizzard-spill</string>
<string name="stores_resume_install">Gjenoppta installasjon</string>
<string name="stores_dl_interrupted">Avbrutt</string>
<string name="stores_install_size">Installer · %1$s</string>
@@ -3007,6 +3009,25 @@
<string name="spatial_saved_views_hint">Lagrede visninger kan beregnes på nytt. Start en ny kalibrering for å fange opp i gjeldende sporingskoordinatsystem.</string>
<string name="spatial_model_checksum_error">Uoverensstemmelse med håndmodellsjekksum</string>
<string name="spatial_opencv_load_error">OpenCV kunne ikke laste</string>
<string name="setup_group_memory">Minne</string>
<string name="setup_clear_cached">Lukk bufrede apper før en sesjon</string>
<string name="setup_clear_cached_hint">Når en sesjon starter, lukker DroidDeck appene Android holder parkert i bakgrunnen, slik at spillet får mer minne. Trådløs feilsøking må være på.</string>
<string name="setup_clear_cached_unpaired">Krever at DroidDeck er paret med trådløs feilsøking (Koble sammen, nedenfor).</string>
<string name="setup_memory_hud">Minnevisning</string>
<string name="setup_memory_hud_hint">Minne og swap i bruk, på sesjonsskjermen. Avansert fordeler det på spillet, DroidDeck, Android og GPU-en.</string>
<string name="setup_memory_hud_simple">Enkel</string>
<string name="setup_memory_hud_advanced">Avansert</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">spill %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">Bakgrunnsapper under en sesjon</string>
<string name="setup_bg_limit_hint">Mens en sesjon kjører, holder Android høyst så mange apper i hurtiglageret og lukker resten, slik at spillet får minnet deres. DroidDeck setter grensen tilbake slik den var når sesjonen avsluttes. Trådløs feilsøking må være på.</string>
<string name="setup_bg_limit_4">Høyst 4</string>
<string name="setup_bg_limit_1">Høyst 1</string>
<string name="setup_bg_limit_0">Ingen</string>
<string name="setup_adb_pair">Trådløs feilsøking</string>
<string name="setup_adb_pair_hint">Kobler DroidDeck sammen med trådløs feilsøking i Android for valgene ovenfor. Grensen for underprosesser forblir av.</string>
<string name="setup_adb_pair_button">Koble sammen</string>
<string name="epic_client_missing">Ikke installert</string>
<string name="epic_client_open">Åpne</string>
<string name="epic_client_install">Installer</string>
+21
View File
@@ -1978,6 +1978,8 @@
<string name="stores_shelf_trending">Populair</string>
<string name="stores_play">Spelen</string>
<string name="stores_install">Installeren</string>
<string name="bnet_open">Battle.net openen</string>
<string name="bnet_store">Blizzard-games</string>
<string name="stores_resume_install">Installatie hervatten</string>
<string name="stores_dl_interrupted">Onderbroken</string>
<string name="stores_install_size">Installeren · %1$s</string>
@@ -3005,6 +3007,25 @@
<string name="spatial_saved_views_hint">Opgeslagen weergaven kunnen opnieuw worden berekend. Start een nieuwe kalibratie om vast te leggen in het huidige volgcoördinatensysteem.</string>
<string name="spatial_model_checksum_error">Controlesom handmodel komt niet overeen</string>
<string name="spatial_opencv_load_error">OpenCV kon niet laden</string>
<string name="setup_group_memory">Geheugen</string>
<string name="setup_clear_cached">Gecachete apps sluiten voor een sessie</string>
<string name="setup_clear_cached_hint">Als een sessie start, sluit DroidDeck de apps die Android op de achtergrond geparkeerd houdt, zodat de game meer geheugen heeft. Draadloos debuggen moet aanstaan.</string>
<string name="setup_clear_cached_unpaired">DroidDeck moet gekoppeld zijn met Draadloos debuggen (Koppelen, hieronder).</string>
<string name="setup_memory_hud">Geheugenweergave</string>
<string name="setup_memory_hud_hint">Gebruikt geheugen en swap, op het sessiescherm. Geavanceerd verdeelt het over de game, DroidDeck, Android en de GPU.</string>
<string name="setup_memory_hud_simple">Eenvoudig</string>
<string name="setup_memory_hud_advanced">Geavanceerd</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">game %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">Achtergrond-apps tijdens een sessie</string>
<string name="setup_bg_limit_hint">Tijdens een sessie houdt Android maximaal dit aantal apps in de cache en sluit de rest, zodat de game hun geheugen krijgt. DroidDeck zet de limiet terug zoals hij was als de sessie eindigt. Draadloos debuggen moet aanstaan.</string>
<string name="setup_bg_limit_4">Maximaal 4</string>
<string name="setup_bg_limit_1">Maximaal 1</string>
<string name="setup_bg_limit_0">Geen</string>
<string name="setup_adb_pair">Draadloos debuggen</string>
<string name="setup_adb_pair_hint">Koppelt DroidDeck aan Draadloos debuggen van Android voor de opties hierboven. De limiet voor subprocessen blijft uit.</string>
<string name="setup_adb_pair_button">Koppelen</string>
<string name="glasses_6dof">Virtueel scherm met 6DoF</string>
<string name="spatial_print_job">DroidDeck ChArUco 30 mm</string>
<string name="epic_client_missing">Niet geïnstalleerd</string>
+21
View File
@@ -2020,6 +2020,8 @@
<string name="stores_shelf_trending">Popularne</string>
<string name="stores_play">Graj</string>
<string name="stores_install">Zainstaluj</string>
<string name="bnet_open">Otwórz Battle.net</string>
<string name="bnet_store">Gry Blizzarda</string>
<string name="stores_resume_install">Wznów instalację</string>
<string name="stores_dl_interrupted">Przerwano</string>
<string name="stores_install_size">Instalacja · %1$s</string>
@@ -3074,6 +3076,25 @@
<string name="spatial_saved_views_hint">Zapisane widoki można przeliczyć. Rozpocznij nową kalibrację, aby przechwycić bieżący układ współrzędnych śledzenia.</string>
<string name="spatial_model_checksum_error">Niezgodność sumy kontrolnej modelu ręki</string>
<string name="spatial_opencv_load_error">Nie można załadować OpenCV</string>
<string name="setup_group_memory">Pamięć</string>
<string name="setup_clear_cached">Zamykaj aplikacje z pamięci podręcznej przed sesją</string>
<string name="setup_clear_cached_hint">Na początku sesji DroidDeck zamyka aplikacje, które Android trzyma w tle, aby gra miała więcej pamięci. Debugowanie bezprzewodowe musi być włączone.</string>
<string name="setup_clear_cached_unpaired">Wymaga sparowania DroidDeck przez Debugowanie bezprzewodowe (Sparuj, poniżej).</string>
<string name="setup_memory_hud">Wskaźnik pamięci</string>
<string name="setup_memory_hud_hint">Używana pamięć i swap na ekranie sesji. Tryb Zaawansowany dzieli ją na grę, DroidDeck, Androida i GPU.</string>
<string name="setup_memory_hud_simple">Prosty</string>
<string name="setup_memory_hud_advanced">Zaawansowany</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">gra %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">Aplikacje w tle podczas sesji</string>
<string name="setup_bg_limit_hint">W trakcie sesji Android trzyma w pamięci podręcznej najwyżej tyle aplikacji, a resztę zamyka, aby gra dostała ich pamięć. Po zakończeniu sesji DroidDeck przywraca poprzedni limit. Debugowanie bezprzewodowe musi być włączone.</string>
<string name="setup_bg_limit_4">Najwyżej 4</string>
<string name="setup_bg_limit_1">Najwyżej 1</string>
<string name="setup_bg_limit_0">Brak</string>
<string name="setup_adb_pair">Debugowanie bezprzewodowe</string>
<string name="setup_adb_pair_hint">Paruje DroidDeck z Debugowaniem bezprzewodowym Androida na potrzeby opcji powyżej. Limit procesów podrzędnych pozostaje wyłączony.</string>
<string name="setup_adb_pair_button">Sparuj</string>
<string name="spatial_gpu_hint">Domyślnie używany jest CPU. GPU jest opcją eksperymentalną i może powodować ponowne uruchamianie SteamVR. Wybór jest resetowany po ponownym uruchomieniu śledzenia.</string>
<string name="spatial_print_job">DroidDeck ChArUco 30 mm</string>
<string name="spatial_connect_hint">Podłącz Luma Ultra i włącz śledzenie pozycji.</string>
@@ -1991,6 +1991,8 @@
<string name="stores_shelf_trending">Tendências</string>
<string name="stores_play">Jogar</string>
<string name="stores_install">Instalar</string>
<string name="bnet_open">Abrir o Battle.net</string>
<string name="bnet_store">Jogos da Blizzard</string>
<string name="stores_resume_install">Retomar instalação</string>
<string name="stores_dl_interrupted">Interrompida</string>
<string name="stores_install_size">Instalar · %1$s</string>
@@ -3040,6 +3042,25 @@
<string name="spatial_saved_views_hint">As visualizações guardadas podem ser recalculadas. Inicie uma nova calibração para captar no sistema de coordenadas de seguimento atual.</string>
<string name="spatial_model_checksum_error">Incompatibilidade de checksum do modelo de mãos</string>
<string name="spatial_opencv_load_error">O OpenCV não conseguiu carregar</string>
<string name="setup_group_memory">Memória</string>
<string name="setup_clear_cached">Fechar apps em cache antes de uma sessão</string>
<string name="setup_clear_cached_hint">Quando uma sessão começa, o DroidDeck fecha as apps que o Android mantém em segundo plano, para que o jogo tenha mais memória. A Depuração sem fios tem de estar ativada.</string>
<string name="setup_clear_cached_unpaired">É necessário sincronizar o DroidDeck com a Depuração sem fios (Sincronizar, abaixo).</string>
<string name="setup_memory_hud">Indicador de memória</string>
<string name="setup_memory_hud_hint">Memória e swap em uso, no ecrã da sessão. O modo Avançado divide-a entre o jogo, o DroidDeck, o Android e a GPU.</string>
<string name="setup_memory_hud_simple">Simples</string>
<string name="setup_memory_hud_advanced">Avançado</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">jogo %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">Apps em segundo plano durante uma sessão</string>
<string name="setup_bg_limit_hint">Enquanto uma sessão decorre, o Android mantém em cache no máximo este número de apps e fecha as restantes, para que o jogo fique com a memória delas. O DroidDeck repõe o limite anterior quando a sessão termina. A Depuração sem fios tem de estar ativada.</string>
<string name="setup_bg_limit_4">No máximo 4</string>
<string name="setup_bg_limit_1">No máximo 1</string>
<string name="setup_bg_limit_0">Nenhuma</string>
<string name="setup_adb_pair">Depuração sem fios</string>
<string name="setup_adb_pair_hint">Sincroniza o DroidDeck com a Depuração sem fios do Android para as opções acima. O limite de processos secundários continua desativado.</string>
<string name="setup_adb_pair_button">Sincronizar</string>
<string name="tracking_recovery_look">Olhe em redor lentamente num ambiente bem iluminado.\nMantenha as câmaras de seguimento desobstruídas e viradas para móveis ou outros detalhes visíveis.</string>
<string name="epic_client_missing">Não instalado</string>
<string name="epic_client_open">Abrir</string>
+21
View File
@@ -1991,6 +1991,8 @@
<string name="stores_shelf_trending">Em alta</string>
<string name="stores_play">Jogar</string>
<string name="stores_install">Instalar</string>
<string name="bnet_open">Abrir o Battle.net</string>
<string name="bnet_store">Jogos da Blizzard</string>
<string name="stores_resume_install">Retomar instalação</string>
<string name="stores_dl_interrupted">Interrompido</string>
<string name="stores_install_size">Instalar · %1$s</string>
@@ -3040,6 +3042,25 @@
<string name="spatial_saved_views_hint">As visualizações salvas podem ser recalculadas. Inicie uma nova calibração para capturar no sistema de coordenadas de rastreamento atual.</string>
<string name="spatial_model_checksum_error">Incompatibilidade de soma de verificação do modelo de mãos</string>
<string name="spatial_opencv_load_error">OpenCV não pôde carregar</string>
<string name="setup_group_memory">Memória</string>
<string name="setup_clear_cached">Fechar apps em cache antes de uma sessão</string>
<string name="setup_clear_cached_hint">Quando uma sessão começa, o DroidDeck fecha os apps que o Android mantém em segundo plano, para que o jogo tenha mais memória. A Depuração por Wi-Fi precisa estar ativada.</string>
<string name="setup_clear_cached_unpaired">O DroidDeck precisa estar pareado com a Depuração por Wi-Fi (Parear, abaixo).</string>
<string name="setup_memory_hud">Indicador de memória</string>
<string name="setup_memory_hud_hint">Memória e swap em uso, na tela da sessão. O modo Avançado divide entre o jogo, o DroidDeck, o Android e a GPU.</string>
<string name="setup_memory_hud_simple">Simples</string>
<string name="setup_memory_hud_advanced">Avançado</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">jogo %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">Apps em segundo plano durante uma sessão</string>
<string name="setup_bg_limit_hint">Enquanto uma sessão está em andamento, o Android mantém no máximo esse número de apps em cache e fecha o restante, para que o jogo fique com a memória deles. O DroidDeck restaura o limite anterior quando a sessão termina. A Depuração por Wi-Fi precisa estar ativada.</string>
<string name="setup_bg_limit_4">No máximo 4</string>
<string name="setup_bg_limit_1">No máximo 1</string>
<string name="setup_bg_limit_0">Nenhum</string>
<string name="setup_adb_pair">Depuração por Wi-Fi</string>
<string name="setup_adb_pair_hint">Pareia o DroidDeck com a Depuração por Wi-Fi do Android para as opções acima. O limite de processos filhos continua desativado.</string>
<string name="setup_adb_pair_button">Parear</string>
<string name="tracking_recovery_look">Olhe ao redor lentamente em um ambiente bem iluminado.\nMantenha as câmeras de rastreamento desobstruídas e voltadas para móveis ou outros detalhes visíveis.</string>
<string name="epic_client_missing">Não instalado</string>
<string name="epic_client_open">Abrir</string>
+21
View File
@@ -1999,6 +1999,8 @@
<string name="stores_shelf_trending">În tendințe</string>
<string name="stores_play">Joacă</string>
<string name="stores_install">Instalează</string>
<string name="bnet_open">Deschide Battle.net</string>
<string name="bnet_store">Jocuri Blizzard</string>
<string name="stores_resume_install">Reia instalarea</string>
<string name="stores_dl_interrupted">Întreruptă</string>
<string name="stores_install_size">Instalare · %1$s</string>
@@ -3041,6 +3043,25 @@
<string name="spatial_saved_views_hint">Vizualizările salvate pot fi recalculate. Începe o nouă calibrare pentru a captura în sistemul de coordonate de urmărire curent.</string>
<string name="spatial_model_checksum_error">Nepotrivire a sumei de control a modelului de mâini</string>
<string name="spatial_opencv_load_error">OpenCV nu s-a putut încărca</string>
<string name="setup_group_memory">Memorie</string>
<string name="setup_clear_cached">Închide aplicațiile din cache înainte de o sesiune</string>
<string name="setup_clear_cached_hint">La pornirea unei sesiuni, DroidDeck închide aplicațiile pe care Android le ține în fundal, ca jocul să aibă mai multă memorie. Depanarea wireless trebuie să fie activată.</string>
<string name="setup_clear_cached_unpaired">DroidDeck trebuie asociat prin Depanarea wireless (Asociază, mai jos).</string>
<string name="setup_memory_hud">Indicator de memorie</string>
<string name="setup_memory_hud_hint">Memoria și swap-ul folosite, pe ecranul sesiunii. Avansat le împarte între joc, DroidDeck, Android și GPU.</string>
<string name="setup_memory_hud_simple">Simplu</string>
<string name="setup_memory_hud_advanced">Avansat</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">joc %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">Aplicații în fundal în timpul unei sesiuni</string>
<string name="setup_bg_limit_hint">Cât timp rulează o sesiune, Android păstrează în cache cel mult atâtea aplicații și le închide pe celelalte, ca jocul să primească memoria lor. DroidDeck readuce limita la valoarea anterioară când se termină sesiunea. Depanarea wireless trebuie să fie activată.</string>
<string name="setup_bg_limit_4">Cel mult 4</string>
<string name="setup_bg_limit_1">Cel mult 1</string>
<string name="setup_bg_limit_0">Niciuna</string>
<string name="setup_adb_pair">Depanare wireless</string>
<string name="setup_adb_pair_hint">Asociază DroidDeck cu Depanarea wireless din Android pentru opțiunile de mai sus. Limita proceselor-copil rămâne dezactivată.</string>
<string name="setup_adb_pair_button">Asociază</string>
<string name="epic_client_missing">Neinstalat</string>
<string name="epic_client_open">Deschide</string>
<string name="epic_client_install">Instalează</string>
+21
View File
@@ -2022,6 +2022,8 @@
<string name="stores_shelf_trending">Популярное</string>
<string name="stores_play">Играть</string>
<string name="stores_install">Установить</string>
<string name="bnet_open">Открыть Battle.net</string>
<string name="bnet_store">Игры Blizzard</string>
<string name="stores_resume_install">Продолжить установку</string>
<string name="stores_dl_interrupted">Прервано</string>
<string name="stores_install_size">Установить · %1$s</string>
@@ -3077,6 +3079,25 @@
<string name="spatial_gpu">Распознавание рук на GPU</string>
<string name="spatial_gpu_hint">По умолчанию используется CPU. Режим GPU экспериментальный и может вызывать перезапуск SteamVR. Выбор сбрасывается при перезапуске отслеживания.</string>
<string name="spatial_inference_error">Распознавание рук недоступно: %1$s. Измените режим CPU/GPU или выключите и снова включите управление руками, чтобы повторить попытку.</string>
<string name="setup_group_memory">Память</string>
<string name="setup_clear_cached">Закрывать фоновые приложения перед сеансом</string>
<string name="setup_clear_cached_hint">При запуске сеанса закрывает приложения, которые Android держит в фоне, чтобы игре досталось больше памяти. Отладка по Wi-Fi должна быть включена.</string>
<string name="setup_clear_cached_unpaired">DroidDeck должен быть сопряжён через отладку по Wi-Fi (кнопка «Сопрячь» ниже).</string>
<string name="setup_memory_hud">Индикатор памяти</string>
<string name="setup_memory_hud_hint">Используемая память и подкачка на экране сеанса. «Дополнительно» показывает отдельно игру, DroidDeck, Android и GPU.</string>
<string name="setup_memory_hud_simple">Простой</string>
<string name="setup_memory_hud_advanced">Дополнительно</string>
<string name="memory_hud_simple">ОЗУ %1$s/%2$s ГБ · подкачка %3$s/%4$s ГБ</string>
<string name="memory_hud_split">игра %1$s · DroidDeck %2$s · Android %3$s ГБ</string>
<string name="memory_hud_gpu">GPU %1$s ГБ</string>
<string name="setup_bg_limit">Фоновые приложения во время сеанса</string>
<string name="setup_bg_limit_hint">Пока идёт сеанс, Android хранит в кэше не больше этого числа приложений и закрывает остальные, чтобы их память досталась игре. После сеанса всё возвращается как было. Отладка по Wi-Fi должна быть включена.</string>
<string name="setup_bg_limit_4">Не больше 4</string>
<string name="setup_bg_limit_1">Не больше 1</string>
<string name="setup_bg_limit_0">Нет</string>
<string name="setup_adb_pair">Отладка по Wi-Fi</string>
<string name="setup_adb_pair_hint">Сопрягает DroidDeck с отладкой Android по Wi-Fi для параметров выше. Ограничение дочерних процессов остаётся отключённым.</string>
<string name="setup_adb_pair_button">Сопрячь</string>
<string name="epic_client_missing">Не установлено</string>
<string name="epic_client_open">Открыть</string>
<string name="epic_client_install">Установить</string>
+21
View File
@@ -1978,6 +1978,8 @@
<string name="stores_shelf_trending">Populärt nu</string>
<string name="stores_play">Spela</string>
<string name="stores_install">Installera</string>
<string name="bnet_open">Öppna Battle.net</string>
<string name="bnet_store">Blizzard-spel</string>
<string name="stores_resume_install">Återuppta installation</string>
<string name="stores_dl_interrupted">Avbruten</string>
<string name="stores_install_size">Installation · %1$s</string>
@@ -3006,6 +3008,25 @@
<string name="spatial_saved_views_hint">Sparade vyer kan räknas om. Starta en ny kalibrering för att fånga i det aktuella spårningskoordinatsystemet.</string>
<string name="spatial_model_checksum_error">Kontrollsumman för handmodellen inte överensstämmer</string>
<string name="spatial_opencv_load_error">OpenCV kunde inte laddas</string>
<string name="setup_group_memory">Minne</string>
<string name="setup_clear_cached">Stäng cachade appar före en session</string>
<string name="setup_clear_cached_hint">När en session startar stänger DroidDeck apparna som Android håller parkerade i bakgrunden, så att spelet får mer minne. Trådlös felsökning måste vara på.</string>
<string name="setup_clear_cached_unpaired">Kräver att DroidDeck är ihopparat via Trådlös felsökning (Para ihop, nedan).</string>
<string name="setup_memory_hud">Minnesvisning</string>
<string name="setup_memory_hud_hint">Minne och swap som används, på sessionsskärmen. Avancerat delar upp det på spelet, DroidDeck, Android och GPU:n.</string>
<string name="setup_memory_hud_simple">Enkel</string>
<string name="setup_memory_hud_advanced">Avancerat</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">spel %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">Bakgrundsappar under en session</string>
<string name="setup_bg_limit_hint">Medan en session pågår håller Android högst så här många appar cachade och stänger resten, så att spelet får deras minne. DroidDeck återställer gränsen som den var när sessionen slutar. Trådlös felsökning måste vara på.</string>
<string name="setup_bg_limit_4">Högst 4</string>
<string name="setup_bg_limit_1">Högst 1</string>
<string name="setup_bg_limit_0">Ingen</string>
<string name="setup_adb_pair">Trådlös felsökning</string>
<string name="setup_adb_pair_hint">Parar ihop DroidDeck med Androids Trådlös felsökning för alternativen ovan. Gränsen för underprocesser förblir av.</string>
<string name="setup_adb_pair_button">Para ihop</string>
<string name="glasses_6dof">Virtuell skärm med 6DoF</string>
<string name="epic_client_missing">Inte installerad</string>
<string name="epic_client_open">Öppna</string>
+21
View File
@@ -1957,6 +1957,8 @@
<string name="stores_shelf_trending">กำลังเป็นที่นิยม</string>
<string name="stores_play">เล่น</string>
<string name="stores_install">ติดตั้ง</string>
<string name="bnet_open">เปิด Battle.net</string>
<string name="bnet_store">เกมของ Blizzard</string>
<string name="stores_resume_install">ดำเนินการติดตั้งต่อ</string>
<string name="stores_dl_interrupted">ถูกขัดจังหวะ</string>
<string name="stores_install_size">ติดตั้ง · %1$s</string>
@@ -2981,6 +2983,25 @@
<string name="spatial_saved_views_hint">มุมมองที่บันทึกไว้สามารถคำนวณใหม่ได้ เริ่มการสอบเทียบใหม่เพื่อบันทึกในระบบพิกัดการติดตามปัจจุบัน</string>
<string name="spatial_model_checksum_error">ผลรวมตรวจสอบแบบจำลองมือไม่ตรงกัน</string>
<string name="spatial_opencv_load_error">OpenCV ไม่สามารถโหลดได้</string>
<string name="setup_group_memory">หน่วยความจำ</string>
<string name="setup_clear_cached">ปิดแอปที่แคชไว้ก่อนเริ่มเซสชัน</string>
<string name="setup_clear_cached_hint">เมื่อเซสชันเริ่ม DroidDeck จะปิดแอปที่ Android พักไว้ในพื้นหลัง เพื่อให้เกมมีหน่วยความจำมากขึ้น ต้องเปิด Wireless debugging ไว้</string>
<string name="setup_clear_cached_unpaired">ต้องจับคู่ DroidDeck กับ Wireless debugging ก่อน (จับคู่ ด้านล่าง)</string>
<string name="setup_memory_hud">การแสดงหน่วยความจำ</string>
<string name="setup_memory_hud_hint">หน่วยความจำและ swap ที่ใช้อยู่ บนหน้าจอเซสชัน โหมดขั้นสูงจะแยกเป็นเกม, DroidDeck, Android และ GPU</string>
<string name="setup_memory_hud_simple">แบบง่าย</string>
<string name="setup_memory_hud_advanced">ขั้นสูง</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">เกม %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">แอปพื้นหลังระหว่างเซสชัน</string>
<string name="setup_bg_limit_hint">ระหว่างที่เซสชันทำงาน Android จะเก็บแอปไว้ในแคชไม่เกินจำนวนนี้และปิดแอปที่เหลือ เพื่อให้เกมได้หน่วยความจำของแอปเหล่านั้น DroidDeck จะคืนค่าขีดจำกัดเดิมเมื่อเซสชันสิ้นสุด ต้องเปิด Wireless debugging ไว้</string>
<string name="setup_bg_limit_4">ไม่เกิน 4</string>
<string name="setup_bg_limit_1">ไม่เกิน 1</string>
<string name="setup_bg_limit_0">ไม่มี</string>
<string name="setup_adb_pair">Wireless debugging</string>
<string name="setup_adb_pair_hint">จับคู่ DroidDeck กับ Wireless debugging ของ Android สำหรับตัวเลือกด้านบน ขีดจำกัดโพรเซสลูกยังคงปิดอยู่</string>
<string name="setup_adb_pair_button">จับคู่</string>
<string name="spatial_restored">กู้คืนมุมมองที่บันทึกไว้แล้ว %1$d รายการ คำนวณการสอบเทียบเพื่อลองอีกครั้ง หรือเริ่มชุดใหม่เพื่อบันทึกข้อมูลเพิ่มเติม</string>
<string name="epic_client_missing">ยังไม่ติดตั้ง</string>
<string name="epic_client_open">เปิด</string>
+21
View File
@@ -1972,6 +1972,8 @@
<string name="stores_shelf_trending">Gündemde</string>
<string name="stores_play">Oyna</string>
<string name="stores_install">Yükle</string>
<string name="bnet_open">Battle.net\'i aç</string>
<string name="bnet_store">Blizzard oyunları</string>
<string name="stores_resume_install">Yüklemeyi sürdür</string>
<string name="stores_dl_interrupted">Kesintiye uğradı</string>
<string name="stores_install_size">Yükle · %1$s</string>
@@ -3006,6 +3008,25 @@
<string name="spatial_saved_views_hint">Kaydedilen görünümler yeniden hesaplanabilir. Geçerli izleme koordinat sistemini yakalamak için yeni bir kalibrasyon başlatın.</string>
<string name="spatial_model_checksum_error">El modeli sağlama toplamı uyuşmazlığı</string>
<string name="spatial_opencv_load_error">OpenCV yüklenemedi</string>
<string name="setup_group_memory">Bellek</string>
<string name="setup_clear_cached">Oturumdan önce önbellekteki uygulamaları kapat</string>
<string name="setup_clear_cached_hint">Bir oturum başladığında DroidDeck, Android\'in arka planda tuttuğu uygulamaları kapatır; böylece oyuna daha fazla bellek kalır. Kablosuz hata ayıklama açık olmalıdır.</string>
<string name="setup_clear_cached_unpaired">DroidDeck\'in Kablosuz hata ayıklama ile eşlenmesi gerekir (Eşle, aşağıda).</string>
<string name="setup_memory_hud">Bellek göstergesi</string>
<string name="setup_memory_hud_hint">Oturum ekranında kullanılan bellek ve swap. Gelişmiş, bunu oyun, DroidDeck, Android ve GPU olarak ayırır.</string>
<string name="setup_memory_hud_simple">Basit</string>
<string name="setup_memory_hud_advanced">Gelişmiş</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">oyun %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">Oturum sırasında arka plan uygulamaları</string>
<string name="setup_bg_limit_hint">Oturum sürerken Android önbellekte en fazla bu kadar uygulama tutar ve gerisini kapatır; böylece onların belleği oyuna kalır. Oturum bittiğinde DroidDeck sınırı eski haline getirir. Kablosuz hata ayıklama açık olmalıdır.</string>
<string name="setup_bg_limit_4">En fazla 4</string>
<string name="setup_bg_limit_1">En fazla 1</string>
<string name="setup_bg_limit_0">Yok</string>
<string name="setup_adb_pair">Kablosuz hata ayıklama</string>
<string name="setup_adb_pair_hint">Yukarıdaki seçenekler için DroidDeck\'i Android\'in Kablosuz hata ayıklama özelliğiyle eşler. Alt süreç sınırı kapalı kalır.</string>
<string name="setup_adb_pair_button">Eşle</string>
<string name="tracking_recovery_look">İyi aydınlatılmış bir odada yavaşça etrafa bakın.\nİzleme kameralarını temiz tutun ve mobilyalara veya diğer görünür ayrıntılara doğru bakın.</string>
<string name="spatial_need_views">Sabit kalibrasyon hedefinin en az 24 farklı görünümünü yakalayın.</string>
<string name="spatial_need_rotation">Akıllı gözlükleri sola ve sağa çevirin, yukarı ve aşağı eğin; dönme olmadan hareket, kamera hizalamasını kalibre edemez.</string>
+21
View File
@@ -2020,6 +2020,8 @@
<string name="stores_shelf_trending">Популярне</string>
<string name="stores_play">Грати</string>
<string name="stores_install">Встановити</string>
<string name="bnet_open">Відкрити Battle.net</string>
<string name="bnet_store">Ігри Blizzard</string>
<string name="stores_resume_install">Продовжити встановлення</string>
<string name="stores_dl_interrupted">Перервано</string>
<string name="stores_install_size">Встановити · %1$s</string>
@@ -3074,6 +3076,25 @@
<string name="spatial_saved_views_hint">Збережені перегляди можна перерахувати. Розпочніть нове калібрування для запису в поточній системі координат відстеження.</string>
<string name="spatial_model_checksum_error">Невідповідність контрольної суми моделі руки</string>
<string name="spatial_opencv_load_error">Не вдалося завантажити OpenCV</string>
<string name="setup_group_memory">Пам\'ять</string>
<string name="setup_clear_cached">Закривати кешовані додатки перед сеансом</string>
<string name="setup_clear_cached_hint">Коли починається сеанс, DroidDeck закриває додатки, які Android тримає у фоні, щоб грі дісталося більше пам\'яті. Бездротове налагодження має бути ввімкнене.</string>
<string name="setup_clear_cached_unpaired">Потрібно поєднати DroidDeck через бездротове налагодження («Поєднати», нижче).</string>
<string name="setup_memory_hud">Показник пам\'яті</string>
<string name="setup_memory_hud_hint">Використана пам\'ять і swap на екрані сеансу. «Розширений» розподіляє її між грою, DroidDeck, Android і GPU.</string>
<string name="setup_memory_hud_simple">Простий</string>
<string name="setup_memory_hud_advanced">Розширений</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">гра %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">Фонові додатки під час сеансу</string>
<string name="setup_bg_limit_hint">Під час сеансу Android тримає в кеші не більше ніж стільки додатків і закриває решту, щоб гра отримала їхню пам\'ять. Коли сеанс завершується, DroidDeck повертає попереднє обмеження. Бездротове налагодження має бути ввімкнене.</string>
<string name="setup_bg_limit_4">Не більше 4</string>
<string name="setup_bg_limit_1">Не більше 1</string>
<string name="setup_bg_limit_0">Жодного</string>
<string name="setup_adb_pair">Бездротове налагодження</string>
<string name="setup_adb_pair_hint">Поєднує DroidDeck з бездротовим налагодженням Android для параметрів вище. Обмеження дочірніх процесів залишається вимкненим.</string>
<string name="setup_adb_pair_button">Поєднати</string>
<string name="spatial_gpu_hint">Типово використовується CPU. Режим GPU є експериментальним і може спричинити перезапуск SteamVR. Вибір скидається після перезапуску відстеження.</string>
<string name="epic_client_missing">Не встановлено</string>
<string name="epic_client_open">Відкрити</string>
+21
View File
@@ -1957,6 +1957,8 @@
<string name="stores_shelf_trending">Xu hướng</string>
<string name="stores_play">Chơi</string>
<string name="stores_install">Cài</string>
<string name="bnet_open">Mở Battle.net</string>
<string name="bnet_store">Trò chơi Blizzard</string>
<string name="stores_resume_install">Tiếp tục cài</string>
<string name="stores_dl_interrupted">Bị gián đoạn</string>
<string name="stores_install_size">Cài · %1$s</string>
@@ -2981,6 +2983,25 @@
<string name="spatial_saved_views_hint">Các lượt xem đã lưu có thể được tính toán lại. Bắt đầu hiệu chuẩn mới để chụp trong hệ tọa độ theo dõi hiện tại.</string>
<string name="spatial_model_checksum_error">Tổng kiểm tra mô hình bàn tay không khớp</string>
<string name="spatial_opencv_load_error">OpenCV không thể tải</string>
<string name="setup_group_memory">Bộ nhớ</string>
<string name="setup_clear_cached">Đóng ứng dụng đã lưu đệm trước phiên</string>
<string name="setup_clear_cached_hint">Khi phiên bắt đầu, DroidDeck đóng các ứng dụng mà Android giữ ở nền để game có thêm bộ nhớ. Phải bật Gỡ lỗi qua mạng không dây.</string>
<string name="setup_clear_cached_unpaired">Cần ghép nối DroidDeck với Gỡ lỗi qua mạng không dây (Ghép nối, bên dưới).</string>
<string name="setup_memory_hud">Chỉ báo bộ nhớ</string>
<string name="setup_memory_hud_hint">Bộ nhớ và swap đang dùng, trên màn hình phiên. Nâng cao chia theo game, DroidDeck, Android và GPU.</string>
<string name="setup_memory_hud_simple">Đơn giản</string>
<string name="setup_memory_hud_advanced">Nâng cao</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">game %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">Ứng dụng nền trong phiên</string>
<string name="setup_bg_limit_hint">Trong khi phiên chạy, Android chỉ giữ tối đa chừng này ứng dụng trong bộ nhớ đệm và đóng phần còn lại để game có bộ nhớ của chúng. DroidDeck đặt lại giới hạn như cũ khi phiên kết thúc. Phải bật Gỡ lỗi qua mạng không dây.</string>
<string name="setup_bg_limit_4">Tối đa 4</string>
<string name="setup_bg_limit_1">Tối đa 1</string>
<string name="setup_bg_limit_0">Không có</string>
<string name="setup_adb_pair">Gỡ lỗi qua mạng không dây</string>
<string name="setup_adb_pair_hint">Ghép nối DroidDeck với Gỡ lỗi qua mạng không dây của Android cho các tùy chọn ở trên. Giới hạn tiến trình con vẫn tắt.</string>
<string name="setup_adb_pair_button">Ghép nối</string>
<string name="tracking_recovery_look">Nhìn xung quanh chậm rãi trong phòng có đủ ánh sáng.\nGiữ cho camera theo dõi rõ ràng và hướng về phía đồ nội thất hoặc các chi tiết có thể nhìn thấy khác.</string>
<string name="epic_client_missing">Chưa cài</string>
<string name="epic_client_open">Mở</string>
@@ -2037,6 +2037,8 @@
<string name="stores_shelf_trending">趋势</string>
<string name="stores_play">游玩</string>
<string name="stores_install">安装</string>
<string name="bnet_open">打开 Battle.net</string>
<string name="bnet_store">暴雪游戏</string>
<string name="stores_resume_install">继续安装</string>
<string name="stores_dl_interrupted">已中断</string>
<string name="stores_install_size">安装 · %1$s</string>
@@ -2986,6 +2988,25 @@
<string name="glasses_6dof">6DoF 虚拟屏幕</string>
<string name="tracking_recovery_look">在光线充足的房间内缓慢环顾四周。\n不要遮挡追踪摄像头,并面向家具等有明显细节的物体。</string>
<string name="spatial_print_job">DroidDeck ChArUco 30 mm</string>
<string name="setup_group_memory">内存</string>
<string name="setup_clear_cached">会话前关闭缓存的应用</string>
<string name="setup_clear_cached_hint">会话开始时关闭 Android 留在后台的应用,让游戏有更多内存可用。需要开启无线调试。</string>
<string name="setup_clear_cached_unpaired">需要先将 DroidDeck 与无线调试配对(见下方“配对”)。</string>
<string name="setup_memory_hud">内存读数</string>
<string name="setup_memory_hud_hint">在会话画面上显示已用内存和交换空间。高级模式会分别显示游戏、DroidDeck、Android 和 GPU。</string>
<string name="setup_memory_hud_simple">简单</string>
<string name="setup_memory_hud_advanced">高级</string>
<string name="memory_hud_simple">内存 %1$s/%2$s GB · 交换 %3$s/%4$s GB</string>
<string name="memory_hud_split">游戏 %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">会话期间的后台应用</string>
<string name="setup_bg_limit_hint">会话运行期间,Android 最多缓存这么多个应用并关闭其余应用,让游戏使用它们的内存。会话结束后恢复原状。需要开启无线调试。</string>
<string name="setup_bg_limit_4">最多 4 个</string>
<string name="setup_bg_limit_1">最多 1 个</string>
<string name="setup_bg_limit_0">无</string>
<string name="setup_adb_pair">无线调试</string>
<string name="setup_adb_pair_hint">为上面的选项将 DroidDeck 与 Android 无线调试配对。子进程限制保持关闭。</string>
<string name="setup_adb_pair_button">配对</string>
<string name="epic_client_missing">未安装</string>
<string name="epic_client_open">打开</string>
<string name="epic_client_install">安装</string>
@@ -1960,6 +1960,8 @@
<string name="stores_shelf_trending">趨勢</string>
<string name="stores_play">開啟遊戲</string>
<string name="stores_install">安裝</string>
<string name="bnet_open">開啟 Battle.net</string>
<string name="bnet_store">Blizzard 遊戲</string>
<string name="stores_resume_install">繼續安裝</string>
<string name="stores_dl_interrupted">已中斷</string>
<string name="stores_install_size">安裝 · %1$s</string>
@@ -2985,6 +2987,25 @@
<string name="glasses_6dof">6DoF 虛擬螢幕</string>
<string name="tracking_recovery_look">在光線充足的房間內緩慢環顧四周。\n不要遮擋追蹤攝影機,並面向家具等有明顯細節的物體。</string>
<string name="spatial_print_job">DroidDeck ChArUco 30 mm</string>
<string name="setup_group_memory">記憶體</string>
<string name="setup_clear_cached">工作階段前關閉快取的應用程式</string>
<string name="setup_clear_cached_hint">工作階段開始時關閉 Android 留在背景的應用程式,讓遊戲有更多記憶體可用。需要開啟無線偵錯。</string>
<string name="setup_clear_cached_unpaired">需要先將 DroidDeck 與無線偵錯配對(見下方「配對」)。</string>
<string name="setup_memory_hud">記憶體讀數</string>
<string name="setup_memory_hud_hint">在工作階段畫面上顯示已用記憶體和交換空間。進階模式會分別顯示遊戲、DroidDeck、Android 和 GPU。</string>
<string name="setup_memory_hud_simple">簡單</string>
<string name="setup_memory_hud_advanced">進階</string>
<string name="memory_hud_simple">記憶體 %1$s/%2$s GB · 交換 %3$s/%4$s GB</string>
<string name="memory_hud_split">遊戲 %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">工作階段期間的背景應用程式</string>
<string name="setup_bg_limit_hint">工作階段執行期間,Android 最多快取這麼多個應用程式並關閉其餘的,讓遊戲使用它們的記憶體。工作階段結束後還原。需要開啟無線偵錯。</string>
<string name="setup_bg_limit_4">最多 4 個</string>
<string name="setup_bg_limit_1">最多 1 個</string>
<string name="setup_bg_limit_0">無</string>
<string name="setup_adb_pair">無線偵錯</string>
<string name="setup_adb_pair_hint">為上面的選項將 DroidDeck 與 Android 無線偵錯配對。子進程限制保持關閉。</string>
<string name="setup_adb_pair_button">配對</string>
<string name="epic_client_missing">未安裝</string>
<string name="epic_client_open">開啟</string>
<string name="epic_client_install">安裝</string>
@@ -1960,6 +1960,8 @@
<string name="stores_shelf_trending">趨勢</string>
<string name="stores_play">執行</string>
<string name="stores_install">安裝</string>
<string name="bnet_open">開啟 Battle.net</string>
<string name="bnet_store">Blizzard 遊戲</string>
<string name="stores_resume_install">繼續安裝</string>
<string name="stores_dl_interrupted">已中斷</string>
<string name="stores_install_size">安裝 · %1$s</string>
@@ -2985,6 +2987,25 @@
<string name="glasses_6dof">6DoF 虛擬螢幕</string>
<string name="tracking_recovery_look">在光線充足的房間內緩慢環顧四周。\n不要遮擋追蹤攝影機,並面向家具等有明顯細節的物體。</string>
<string name="spatial_print_job">DroidDeck ChArUco 30 mm</string>
<string name="setup_group_memory">記憶體</string>
<string name="setup_clear_cached">工作階段前關閉快取的應用程式</string>
<string name="setup_clear_cached_hint">工作階段開始時關閉 Android 留在背景的應用程式,讓遊戲有更多記憶體可用。需要開啟無線偵錯。</string>
<string name="setup_clear_cached_unpaired">需要先將 DroidDeck 與無線偵錯配對(見下方「配對」)。</string>
<string name="setup_memory_hud">記憶體讀數</string>
<string name="setup_memory_hud_hint">在工作階段畫面上顯示已用記憶體和交換空間。進階模式會分別顯示遊戲、DroidDeck、Android 和 GPU。</string>
<string name="setup_memory_hud_simple">簡單</string>
<string name="setup_memory_hud_advanced">進階</string>
<string name="memory_hud_simple">記憶體 %1$s/%2$s GB · 交換 %3$s/%4$s GB</string>
<string name="memory_hud_split">遊戲 %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">工作階段期間的背景應用程式</string>
<string name="setup_bg_limit_hint">工作階段執行期間,Android 最多快取這麼多個應用程式並關閉其餘的,讓遊戲使用它們的記憶體。工作階段結束後還原。需要開啟無線偵錯。</string>
<string name="setup_bg_limit_4">最多 4 個</string>
<string name="setup_bg_limit_1">最多 1 個</string>
<string name="setup_bg_limit_0">無</string>
<string name="setup_adb_pair">無線偵錯</string>
<string name="setup_adb_pair_hint">為上面的選項將 DroidDeck 與 Android 無線偵錯配對。子處理程序限制保持關閉。</string>
<string name="setup_adb_pair_button">配對</string>
<string name="epic_client_missing">未安裝</string>
<string name="epic_client_open">開啟</string>
<string name="epic_client_install">安裝</string>
+22
View File
@@ -143,6 +143,7 @@
<string name="user_apps_remove">Remove</string>
<string name="user_apps_remove_confirm">Press again to remove</string>
<string name="user_apps_stop_session">Stop the session to remove</string>
<string name="bnet_name" translatable="false">Battle.net</string>
<string name="user_apps_script_linked">Runs %1$s from its folder, linked into the session where it lies. Removing the app leaves that folder alone.</string>
<string name="user_apps_script_copied">Runs %1$s from a copy of its folder inside DroidDeck. Removing the app deletes the copy, not the original.</string>
<string name="user_apps_runtime_required">Install the Linux runtime first</string>
@@ -2065,6 +2066,8 @@
<string name="stores_shelf_trending">Trending</string>
<string name="stores_play">Play</string>
<string name="stores_install">Install</string>
<string name="bnet_open">Open Battle.net</string>
<string name="bnet_store">Blizzard games</string>
<string name="stores_resume_install">Resume install</string>
<string name="stores_dl_interrupted">Interrupted</string>
<string name="stores_install_size">Install · %1$s</string>
@@ -3103,6 +3106,25 @@
<string name="spatial_saved_views_hint">Saved views can be recalculated. Start a new calibration to capture in the current tracking frame.</string>
<string name="spatial_model_checksum_error">Hand model checksum mismatch</string>
<string name="spatial_opencv_load_error">OpenCV could not load</string>
<string name="setup_group_memory">Memory</string>
<string name="setup_clear_cached">Clear cached apps before a session</string>
<string name="setup_clear_cached_hint">When a session starts, DroidDeck closes the apps Android keeps parked in the background, so the game has more memory. Wireless debugging must be on.</string>
<string name="setup_clear_cached_unpaired">Needs DroidDeck paired with Wireless debugging (Pair, below).</string>
<string name="setup_memory_hud">Memory readout</string>
<string name="setup_memory_hud_hint">Memory and swap in use, on the session screen. Advanced splits it into the game, DroidDeck, Android and the GPU.</string>
<string name="setup_memory_hud_simple">Simple</string>
<string name="setup_memory_hud_advanced">Advanced</string>
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
<string name="memory_hud_split">game %1$s · DroidDeck %2$s · Android %3$s GB</string>
<string name="memory_hud_gpu">GPU %1$s GB</string>
<string name="setup_bg_limit">Background apps during a session</string>
<string name="setup_bg_limit_hint">While a session runs, Android keeps at most this many apps cached and closes the rest, so the game has their memory. DroidDeck puts the limit back as it was when the session ends. Wireless debugging must be on.</string>
<string name="setup_bg_limit_4">At most 4</string>
<string name="setup_bg_limit_1">At most 1</string>
<string name="setup_bg_limit_0">None</string>
<string name="setup_adb_pair">Wireless debugging</string>
<string name="setup_adb_pair_hint">Pairs DroidDeck with Android\'s Wireless debugging for the options above. The child-process limit stays off.</string>
<string name="setup_adb_pair_button">Pair</string>
<string name="stores_xbox_update">Update / verify</string>
<string name="stores_xbox_manage">Manage content</string>
<string name="stores_xbox_close_first">Close this Xbox game before updating it.</string>
@@ -0,0 +1,40 @@
package com.droiddeck.launcher.core
import com.droiddeck.launcher.session.SessionPrefs
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Assert.assertThrows
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.RuntimeEnvironment
import org.robolectric.annotation.Config
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [28], manifest = Config.NONE)
class BackgroundAppLimitTest {
@Test fun theLimitIsActivityManagersCachedProcessCap() {
assertEquals("device_config get activity_manager max_cached_processes", BackgroundAppLimit.readCommand())
assertEquals("device_config put activity_manager max_cached_processes 4", BackgroundAppLimit.setCommand(4))
assertEquals("device_config put activity_manager max_cached_processes 0", BackgroundAppLimit.setCommand(0))
assertThrows(IllegalArgumentException::class.java) { BackgroundAppLimit.setCommand(-1) }
}
@Test fun whatWasThereIsWhatGoesBack() {
assertNull(BackgroundAppLimit.parse("null\n"))
assertNull(BackgroundAppLimit.parse(""))
assertEquals("16", BackgroundAppLimit.parse("16\n"))
assertEquals("device_config delete activity_manager max_cached_processes", BackgroundAppLimit.restoreCommand(null))
assertEquals("device_config put activity_manager max_cached_processes 16", BackgroundAppLimit.restoreCommand("16"))
}
@Test fun setupOffersOffAndDeveloperOptionsOwnLimits() {
val context = RuntimeEnvironment.getApplication()
assertEquals(BackgroundAppLimit.OFF, SessionPrefs.backgroundAppLimit(context))
for (limit in listOf(4, 1, 0, BackgroundAppLimit.OFF)) {
SessionPrefs.setBackgroundAppLimit(context, limit)
assertEquals(limit, SessionPrefs.backgroundAppLimit(context))
}
assertThrows(IllegalArgumentException::class.java) { SessionPrefs.setBackgroundAppLimit(context, 7) }
}
}
@@ -0,0 +1,378 @@
package com.droiddeck.launcher.runtime
import android.content.Context
import com.droiddeck.launcher.session.ComponentsManager
import com.droiddeck.launcher.session.GameEnvironmentStore
import com.github.luben.zstd.ZstdOutputStream
import org.apache.commons.compress.archivers.tar.TarArchiveEntry
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream
import org.json.JSONArray
import org.json.JSONObject
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNull
import org.junit.Assert.assertThrows
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.RuntimeEnvironment
import org.robolectric.annotation.Config
import java.io.File
import java.nio.file.Files
import java.util.zip.CRC32
private val REGISTRY = """
WINE REGISTRY Version 2
;; All keys relative to \\Machine
[Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Battle.net] 1760380000
#time=1dc3c6e0a5e1f2a
"DisplayName"="Battle.net"
"InstallLocation"="C:\\Program Files (x86)\\Battle.net"
"UninstallString"="\"C:\\Program Files (x86)\\Battle.net\\Battle.net Uninstaller.exe\" --lang=enUS"
[Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Diablo IV] 1760380001
"DisplayIcon"="C:\\Program Files (x86)\\Diablo IV\\Diablo IV Launcher.exe"
"DisplayName"="Diablo\xae IV"
"InstallLocation"="C:\\Program Files (x86)\\Diablo IV"
"Publisher"="Blizzard Entertainment"
"UninstallString"="\"C:\\ProgramData\\Battle.net\\Agent\\Blizzard Uninstaller.exe\" --lang=enUS --uid=fenris --displayname=\"Diablo IV\""
[Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Overwatch] 1760380002
"InstallLocation"="C:\\Program Files (x86)\\Overwatch"
"UninstallString"="\"C:\\ProgramData\\Battle.net\\Agent\\Blizzard Uninstaller.exe\" --lang=enUS --uid=prometheus --displayname=\"Overwatch\""
[Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Steam] 1760380003
"InstallLocation"="C:\\Program Files (x86)\\Steam"
"UninstallString"="C:\\Program Files (x86)\\Steam\\uninstall.exe --uid=steam"
[Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Diablo II Resurrected] 1760380004
"UninstallString"=str(2):"\"C:\\ProgramData\\Battle.net\\Agent\\Blizzard Uninstaller.exe\" --lang=enUS --uid=osi --displayname=\"Diablo II: Resurrected\""
"InstallLocation"="C:/Games/Diablo II Resurrected"
[Software\\Wine\\Fonts] 1760380005
"InstallLocation"="C:\\x"
"UninstallString"="Battle.net --uid=wow"
""".trimStart()
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [28], manifest = Config.NONE)
class BattleNetTest {
private lateinit var context: Context
@Before fun setUp() {
context = RuntimeEnvironment.getApplication()
File(context.filesDir, "components").deleteRecursively()
LinuxRuntime.rootDir(context).deleteRecursively()
}
@Test fun theIdIsTheShortcutIdTheScriptNames() {
val crc = CRC32().apply { update("\"droiddeck-battlenet\"Battle.net".toByteArray()) }.value
assertEquals(crc or 0x80000000L, BattleNet.APP_ID)
}
@Test fun theNewestD2rfixIsTheHighestFexThenTheHighestFix() {
val items = listOf(
item("FEXCore-2610-linux.wcp"),
item("FEXCore-2609-d2rfix25-linux.wcp"),
item("FEXCore-2610-d2rfix9-linux.wcp"),
item("FEXCore-2610-d2rfix28-linux.wcp"),
item("FEXCore-2509.1-d2rfix40-linux.wcp"),
)
assertEquals("FEXCore-2610-d2rfix28-linux.wcp", BattleNet.newestD2rFix(items)?.file)
assertEquals("FEXCore-2610.1-d2rfix1-linux.wcp", BattleNet.newestD2rFix(items + item("FEXCore-2610.1-d2rfix1-linux.wcp"))?.file)
assertEquals("FexCore-2611-D2RFIX2-linux.wcp", BattleNet.newestD2rFix(items + item("FexCore-2611-D2RFIX2-linux.wcp"))?.file)
}
@Test fun onlyFexD2rfixPackagesCount() {
assertNull(BattleNet.newestD2rFix(listOf(item("FEXCore-2610-linux.wcp"), item("FEXCore-2610-d2rfix28-linux.wcp", comp = "dxvk"))))
assertNull(BattleNet.d2rfix("FEXCore-2610-d2rfix28-linux.wcp.part"))
assertNull(BattleNet.d2rfix("FEXCore-2610-d2rfix-linux.wcp"))
assertEquals(listOf(2610L) to 28L, BattleNet.d2rfix("FEXCore-2610-d2rfix28-linux.wcp"))
}
@Test fun theNewestStoredBuildIsSetForThePrefix() {
catalog("FEXCore-2609-d2rfix25-linux.wcp", "FEXCore-2610-d2rfix28-linux.wcp", "FEXCore-2610-linux.wcp")
store("FEXCore-2610-d2rfix28-linux.wcp")
assertEquals("FEXCore-2610-d2rfix28-linux.wcp", BattleNet.ensureFex(context, ::noRefresh))
assertEquals(mapOf("fex" to "FEXCore-2610-d2rfix28-linux.wcp"), ComponentsManager.gameComponents(context, BattleNet.APP_ID.toString()))
assertEquals("FEXCore-2610-d2rfix28-linux.wcp", BattleNet.ensureFex(context, ::noRefresh))
}
@Test fun aNewerBuildReplacesTheOldOne() {
catalog("FEXCore-2609-d2rfix25-linux.wcp")
store("FEXCore-2609-d2rfix25-linux.wcp")
BattleNet.ensureFex(context, ::noRefresh)
catalog("FEXCore-2609-d2rfix25-linux.wcp", "FEXCore-2610-d2rfix28-linux.wcp")
store("FEXCore-2610-d2rfix28-linux.wcp")
BattleNet.ensureFex(context, ::noRefresh)
assertEquals("FEXCore-2610-d2rfix28-linux.wcp", ComponentsManager.gameComponents(context, BattleNet.APP_ID.toString())["fex"])
}
@Test fun aStaleListingIsFetchedAgain() {
catalog("FEXCore-2609-d2rfix25-linux.wcp", fetchedAt = 1)
store("FEXCore-2610-d2rfix28-linux.wcp")
BattleNet.ensureFex(context) { listOf(item("FEXCore-2609-d2rfix25-linux.wcp"), item("FEXCore-2610-d2rfix28-linux.wcp")) }
assertEquals("FEXCore-2610-d2rfix28-linux.wcp", ComponentsManager.gameComponents(context, BattleNet.APP_ID.toString())["fex"])
}
@Test fun aFailedFetchFallsBackOnTheCachedListing() {
catalog("FEXCore-2609-d2rfix25-linux.wcp", fetchedAt = 1)
store("FEXCore-2609-d2rfix25-linux.wcp")
assertEquals("FEXCore-2609-d2rfix25-linux.wcp", BattleNet.ensureFex(context) { error("offline") })
}
@Test fun aListingWithoutD2rfixIsAnError() {
catalog("FEXCore-2610-linux.wcp")
var refreshed = 0
assertThrows(IllegalStateException::class.java) { BattleNet.ensureFex(context) { refreshed++; emptyList() } }
assertEquals(1, refreshed)
assertEquals(emptyMap<String, String>(), ComponentsManager.gameComponents(context, BattleNet.APP_ID.toString()))
}
@Test fun installedIsTheLauncherInThePrefix() {
assertFalse(BattleNet.installed(context))
launcher().apply { parentFile!!.mkdirs(); writeText("MZ") }
assertTrue(BattleNet.installed(context))
}
@Test fun theEnvironmentEditorNamesBattleNetsProfileOnceItIsInstalled() {
assertNull(BattleNet.profile(context))
launcher().apply { parentFile!!.mkdirs(); writeText("MZ") }
assertEquals(BattleNet.APP_ID.toString() to "Battle.net", BattleNet.profile(context))
}
@Test fun removeTakesThePrefixItsMenuEntryAndCacheButNothingItLinksTo() {
catalog("FEXCore-2610-d2rfix28-linux.wcp")
store("FEXCore-2610-d2rfix28-linux.wcp")
BattleNet.ensureFex(context, ::noRefresh)
val root = LinuxRuntime.rootDir(context)
fun put(relative: String) = File(root, relative).apply { parentFile!!.mkdirs(); writeText("x") }
launcher().apply { parentFile!!.mkdirs(); writeText("MZ") }
val outside = File(context.cacheDir, "bnet-outside").apply { mkdirs() }
val kept = File(outside, "kept").apply { writeText("x") }
val drives = File(BattleNet.prefix(context), "pfx/dosdevices").apply { mkdirs() }
Files.createSymbolicLink(File(drives, "z:").toPath(), outside.toPath())
val menu = put("usr/local/share/applications/droiddeck-battlenet.desktop")
val otherMenu = put("usr/local/share/applications/other.desktop")
val log = put("root/.cache/droiddeck/battlenet/battlenet.log")
val otherPrefix = put("root/.local/share/Steam/steamapps/compatdata/123/pfx/system.reg")
BattleNet.remove(context)
assertFalse(BattleNet.prefix(context).exists())
assertFalse(BattleNet.installed(context))
assertTrue(kept.isFile)
assertFalse(menu.exists())
assertTrue(otherMenu.isFile)
assertFalse(log.parentFile!!.exists())
assertTrue(otherPrefix.isFile)
assertNull(BattleNet.fexInUse(context))
outside.deleteRecursively()
}
@Test fun anIdNamesItsTitleWithOrWithoutItsLocale() {
assertEquals("Pro", BattleNet.title("prometheus")?.code)
assertEquals("D3", BattleNet.title("diablo3_enus")?.code)
assertEquals("Fen", BattleNet.title("Fenris")?.code)
assertEquals("WTCG", BattleNet.title("hs_beta")?.code)
assertEquals("Diablo II: Resurrected", BattleNet.title("osi_dede")?.name)
assertEquals("WoWC", BattleNet.title("wow_classic")?.code)
assertEquals("WoWC", BattleNet.title("wow_classic_era_enus")?.code)
assertNull(BattleNet.title("agent"))
assertNull(BattleNet.title("osi_beta"))
}
@Test fun theUninstallEntriesOfBattleNetsGamesAreRead() {
val entries = BattleNet.uninstallEntries(REGISTRY.lineSequence())
assertEquals(listOf(
"fenris" to "C:\\Program Files (x86)\\Diablo IV",
"prometheus" to "C:\\Program Files (x86)\\Overwatch",
"osi" to "C:/Games/Diablo II Resurrected",
), entries)
}
@Test fun productDbsInstallsAreRead() {
val db = message(
field(1, message(field(1, "agent"), field(2, "agent"), field(3, message(field(1, "C:/ProgramData/Battle.net/Agent"))))),
varintField(7, 300),
field(1, message(field(1, "hs_beta"), field(2, "wtcg"), varintField(9, 1), field(3, message(field(1, "C:/Program Files (x86)/Hearthstone"), field(2, "US"))))),
field(1, message(field(1, "s2"))),
field(1, message(field(1, "s1"), field(3, message(field(1, "Z:/mnt/droiddeck-sd/Games/Battle.net/StarCraft"))), field(4, message(field(1, message(varintField(1, 0), varintField(2, 0))))))),
field(1, message(field(1, "wow_classic_anniversary"), field(3, message(field(1, "Z:/root/Games/World of Warcraft"))), field(4, message(field(1, message(varintField(1, 1), varintField(2, 1))))))),
)
assertEquals(listOf("agent" to "C:/ProgramData/Battle.net/Agent", "hs_beta" to "C:/Program Files (x86)/Hearthstone", "wow_classic_anniversary" to "Z:/root/Games/World of Warcraft"),
BattleNet.productDbEntries(db))
assertEquals(emptyList<Pair<String, String>>(), BattleNet.productDbEntries(db.copyOf(db.size - 3)))
assertEquals(emptyList<Pair<String, String>>(), BattleNet.productDbEntries(byteArrayOf(0x0a, 0x7f, 0x01)))
}
@Test fun theGamesAreTheTitlesInstalledInTheirFolders() {
val pfx = File(BattleNet.prefix(context), "pfx").apply { mkdirs() }
File(pfx, "system.reg").writeText(REGISTRY)
File(pfx, "drive_c/ProgramData/Battle.net/Agent").mkdirs()
File(pfx, "drive_c/ProgramData/Battle.net/Agent/product.db").writeBytes(message(
field(1, message(field(1, "hs_beta"), field(3, message(field(1, "C:/Program Files (x86)/Hearthstone"))))),
field(1, message(field(1, "fenris"), field(3, message(field(1, "C:/Program Files (x86)/Diablo IV"))))),
field(1, message(field(1, "wow_classic"), field(3, message(field(1, "C:/Program Files (x86)/World of Warcraft"))))),
))
for (folder in listOf("Program Files (x86)/Diablo IV", "Games/Diablo II Resurrected", "Program Files (x86)/Hearthstone", "Program Files (x86)/World of Warcraft")) {
File(pfx, "drive_c/$folder").mkdirs()
}
val games = BattleNet.games(context)
assertEquals(listOf("Fen", "OSI", "WTCG", "WoWC"), games.map { it.code })
assertEquals(listOf("Diablo IV", "Diablo II: Resurrected", "Hearthstone", "World of Warcraft Classic"), games.map { it.name })
assertEquals(File(pfx, "drive_c/Games/Diablo II Resurrected"), games[1].folder)
assertNull(BattleNet.hostFolder(context, "D:\\Games\\X"))
assertNull(BattleNet.hostFolder(context, "C:\\..\\..\\etc"))
assertNull(BattleNet.hostFolder(context, "Z:\\root\\..\\..\\etc"))
assertEquals(File(LinuxRuntime.rootDir(context), "root/Games/Stores/Battle.net/Hearthstone"),
BattleNet.hostFolder(context, "Z:/root/Games/Stores/Battle.net/Hearthstone/"))
}
@Test fun aGamesShortcutHasBattleNetLaunchItInItsPrefix() {
val folder = File(BattleNet.prefix(context), "pfx/drive_c/Program Files (x86)/Diablo IV").apply { mkdirs() }
File(folder, "Diablo IV Launcher.exe").writeBytes(byteArrayOf(0x4d, 0x5a))
val shortcut = BattleNet.shortcut(context, BattleNet.Game("fenris", "Diablo IV", "Fen", folder))!!
val exe = "/root/.local/share/Steam/steamapps/compatdata/2596113170/pfx/drive_c/Program Files (x86)/Battle.net/Battle.net.exe"
assertEquals(exe, shortcut.guestExe)
assertEquals(exe.substringBeforeLast('/'), shortcut.guestDir)
assertEquals("STEAM_COMPAT_DATA_PATH=/root/.local/share/Steam/steamapps/compatdata/2596113170 %command% --exec=\"launch Fen\"", shortcut.launchOptions)
val crc = CRC32().apply { update("\"$exe\"Diablo IV".toByteArray()) }.value
assertEquals(crc or 0x80000000L, shortcut.appId)
assertEquals((shortcut.appId shl 32) or 0x02000000L, shortcut.gameId)
assertEquals(com.droiddeck.launcher.stores.Store.BATTLENET.id, shortcut.source)
assertEquals("Diablo IV Launcher.exe", shortcut.exe.name)
val listing = com.droiddeck.launcher.frontend.AddedGames.writeListing(context, listOf(shortcut)).readText()
val entry = JSONArray(listing).getJSONObject(0)
assertEquals(com.droiddeck.launcher.stores.Store.BATTLENET.id, entry.getString("store"))
assertEquals(shortcut.launchOptions, entry.getString("launch"))
assertEquals(exe, entry.getString("exe"))
}
@Test fun titlesSharingALaunchCodeShareTheirArt() {
val cover = File(context.filesDir, "battlenet-art/fenris/p.jpg").apply { parentFile!!.mkdirs(); writeBytes(byteArrayOf(1)) }
assertEquals(cover, BattleNet.art(context, BattleNet.title("fen")!!).cover)
val wide = File(context.filesDir, "battlenet-art/wow_classic/blizzard.jpg").apply { parentFile!!.mkdirs(); writeBytes(byteArrayOf(1)) }
assertEquals(wide, BattleNet.art(context, BattleNet.title("wow_classic_anniversary")!!).header)
}
@Test fun theStoreOffersEachTitleOnceAndHidesWhatIsInstalled() {
val codes = BattleNet.STORE.map { it.code }
assertEquals(codes.distinct(), codes)
assertTrue("Fen" in codes && "OSI" in codes && "WTCG" in codes)
assertFalse(BattleNet.STORE.any { it.uid == "d3cn" || it.uid == "fen" })
assertEquals("fenris", BattleNet.STORE.first { it.code == "Fen" }.uid)
assertTrue(BattleNet.STORE.all { it.uid.matches(Regex("[a-z0-9_]{1,32}")) })
val installed = listOf("fenris", "diablo3_enus", null)
val offered = BattleNet.STORE.filter { BattleNet.notInstalled(it, installed) }.map { it.code }
assertFalse("Fen" in offered || "D3" in offered)
assertTrue("OSI" in offered)
}
@Test fun aBattleNetGameStartsWithoutSteamThroughItsShortcutUntilThatIsSwitchedOff() {
File(context.filesDir, "game-environment.json").delete()
val folder = File(BattleNet.prefix(context), "pfx/drive_c/Program Files (x86)/Diablo IV").apply { mkdirs() }
File(folder, "Diablo IV Launcher.exe").writeBytes(byteArrayOf(0x4d, 0x5a))
val shortcut = BattleNet.shortcut(context, BattleNet.Game("fenris", "Diablo IV", "Fen", folder))!!
val game = com.droiddeck.launcher.frontend.Library.SteamGame(
shortcut.appId.toInt(), shortcut.name, null, com.droiddeck.launcher.frontend.Library.ADDED, shortcut.gameId,
source = com.droiddeck.launcher.stores.Store.BATTLENET.id, storeId = shortcut.storeId)
val noSteam = com.droiddeck.launcher.session.NoSteamLaunch
assertEquals(BattleNet.APP_ID.toString(), noSteam.scope(game))
assertFalse(noSteam.enabled(context, game))
assertTrue(BattleNet.ensureNoSteam(context))
assertTrue(noSteam.enabled(context, game))
val command = noSteam.command(game, shortcut)!!
assertEquals(noSteam.BATTLENET, command.program)
assertEquals(listOf("launch", "Fen"), command.args)
GameEnvironmentStore.setGameNoSteam(context, BattleNet.APP_ID.toString(), false)
assertFalse(BattleNet.ensureNoSteam(context))
assertFalse(noSteam.enabled(context, game))
}
@Test fun theGamesAreToldOfAFifthOfThePhonesMemory() {
assertEquals(2048, BattleNet.videoMemory(11113))
assertEquals(1536, BattleNet.videoMemory(7468))
assertEquals(2560, BattleNet.videoMemory(15200))
assertEquals(3584, BattleNet.videoMemory(60000))
assertTrue(BattleNet.videoMemory(Long.MAX_VALUE / 2) < 4096)
assertEquals(
"dxgi.maxDeviceMemory = 2048; dxgi.maxSharedMemory = 2048; d3d9.maxAvailableMemory = 2048",
BattleNet.videoMemoryOptions(2048),
)
}
@Test fun theCapIsTheBattleNetProfilesOwnDxvkConfigUnlessItHasOne() {
File(context.filesDir, "game-environment.json").delete()
val manager = context.getSystemService(android.app.ActivityManager::class.java)
org.robolectric.Shadows.shadowOf(manager).setMemoryInfo(android.app.ActivityManager.MemoryInfo().apply { totalMem = 11113L shl 20 })
val scope = BattleNet.APP_ID.toString()
assertTrue(BattleNet.ensureVideoMemory(context))
assertEquals(BattleNet.videoMemoryOptions(2048), GameEnvironmentStore.read(context).games[scope]?.get("DXVK_CONFIG"))
val published = File(LinuxRuntime.rootDir(context), "root/.config/droiddeck/game-environment.json").readText()
assertTrue("dxgi.maxDeviceMemory = 2048" in JSONObject(published).getJSONObject("games").getJSONObject(scope).getString("DXVK_CONFIG"))
assertFalse(BattleNet.ensureVideoMemory(context))
for (own in listOf("dxvk.maxFrameRate = 30", null)) {
GameEnvironmentStore.save(context, GameEnvironmentStore.read(context).let { it.withEntries(scope, it.entries(scope) + ("DXVK_CONFIG" to own)) })
assertFalse(BattleNet.ensureVideoMemory(context))
assertEquals(own, GameEnvironmentStore.read(context).games[scope]?.get("DXVK_CONFIG"))
}
GameEnvironmentStore.save(context, GameEnvironmentStore.read(context).let { it.withEntries(scope, it.entries(scope) - "DXVK_CONFIG") })
assertTrue(BattleNet.ensureVideoMemory(context))
}
private fun launcher() = File(BattleNet.prefix(context), "pfx/drive_c/Program Files (x86)/Battle.net/Battle.net Launcher.exe")
private fun varint(value: Long): ByteArray {
val out = java.io.ByteArrayOutputStream()
var v = value
while (v >= 0x80) { out.write(((v and 0x7f) or 0x80).toInt()); v = v ushr 7 }
out.write(v.toInt())
return out.toByteArray()
}
private fun field(number: Int, bytes: ByteArray) = varint((number shl 3 or 2).toLong()) + varint(bytes.size.toLong()) + bytes
private fun field(number: Int, text: String) = field(number, text.toByteArray())
private fun varintField(number: Int, value: Long) = varint((number shl 3).toLong()) + varint(value)
private fun message(vararg fields: ByteArray) = fields.fold(ByteArray(0)) { all, f -> all + f }
private fun noRefresh(context: Context): List<ComponentsManager.CatalogItem> = error("the cached listing was fresh")
private fun item(file: String, comp: String = "fex") = ComponentsManager.CatalogItem(
file, comp, "FexCore-Linux", "https://github.com/The412Banner/Nightlies/releases/download/FexCore-Linux/$file", 4, "sha256:" + "ab".repeat(32),
)
private fun catalog(vararg files: String, fetchedAt: Long = System.currentTimeMillis() / 1000) {
val cache = File(context.filesDir, "components/catalog.json")
cache.parentFile!!.mkdirs()
val items = JSONArray()
for (file in files) items.put(JSONObject().put("file", file).put("comp", "fex").put("release", "FexCore-Linux")
.put("url", item(file).url).put("size", 4).put("digest", item(file).digest))
cache.writeText(JSONObject().put("items", items).put("fetchedAt", fetchedAt).toString())
}
private fun store(file: String) {
val wcp = File(context.filesDir, "components/packages/$file")
wcp.parentFile!!.mkdirs()
TarArchiveOutputStream(ZstdOutputStream(wcp.outputStream())).use { tar ->
fun put(name: String, bytes: ByteArray) {
tar.putArchiveEntry(TarArchiveEntry(name).apply { size = bytes.size.toLong() })
tar.write(bytes)
tar.closeArchiveEntry()
}
put("profile.json", JSONObject().put("type", "FEXCore-Linux").put("versionName", file.removeSuffix(".wcp")).toString().toByteArray())
put("files/lib/wine/aarch64-windows/libarm64ecfex.dll", "arm64ec $file".toByteArray())
put("files/lib/wine/aarch64-windows/libwow64fex.dll", "wow64 $file".toByteArray())
}
}
}
@@ -0,0 +1,66 @@
package com.droiddeck.launcher.session
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Test
class MemoryReadoutTest {
private val meminfo = """
MemTotal: 11379920 kB
MemFree: 527864 kB
MemAvailable: 3235768 kB
Buffers: 1024 kB
SwapTotal: 16777212 kB
SwapFree: 10358080 kB
""".trimIndent()
@Test fun memoryAndSwapInUseComeFromMeminfo() {
val device = MemoryReadout.parseMeminfo(meminfo)!!
assertEquals(11379920L - 3235768L, device.usedKb)
assertEquals(16777212L - 10358080L, device.swapUsedKb)
assertEquals("7.8", MemoryReadout.gb(device.usedKb))
assertEquals("10.9", MemoryReadout.gb(device.totalKb))
assertEquals(0L, MemoryReadout.parseMeminfo("MemTotal: 100 kB\nMemAvailable: 40 kB\n")!!.swapUsedKb)
assertNull(MemoryReadout.parseMeminfo("MemTotal: 100 kB\n"))
}
@Test fun aProcessCountsItsResidentAnonymousAndSharedMemory() {
val status = """
Name: Diablo IV.exe
VmRSS: 2000000 kB
RssAnon: 1500000 kB
RssFile: 400000 kB
RssShmem: 100000 kB
VmSwap: 300000 kB
""".trimIndent()
assertEquals(1600000L, MemoryReadout.residentKb(status))
assertEquals(0L, MemoryReadout.residentKb("Name:\tkthreadd\n"))
}
@Test fun theGameIsWhatRunsInAWinePrefix() {
fun env(vararg vars: String) = vars.joinToString("\u0000", postfix = "\u0000").toByteArray()
assertTrue(MemoryReadout.inWinePrefix(env("HOME=/root", "WINEPREFIX=/root/pfx", "DISPLAY=:0")))
assertTrue(MemoryReadout.inWinePrefix("WINEPREFIX=/x".toByteArray()))
assertFalse(MemoryReadout.inWinePrefix(env("HOME=/root", "STEAM_COMPAT_DATA_PATH=/x", "MY_WINEPREFIX=/y")))
assertFalse(MemoryReadout.inWinePrefix(ByteArray(0)))
}
@Test fun androidIsWhatIsLeftOfTheMemoryInUse() {
val device = MemoryReadout.Device(totalKb = 10_000, availableKb = 3_000, swapTotalKb = 0, swapFreeKb = 0)
assertEquals(3_000L, MemoryReadout.androidKb(device, MemoryReadout.Split(gameKb = 2_000, droiddeckKb = 1_000, gpuKb = 1_000)))
assertEquals(4_000L, MemoryReadout.androidKb(device, MemoryReadout.Split(gameKb = 2_000, droiddeckKb = 1_000, gpuKb = null)))
assertEquals(0L, MemoryReadout.androidKb(device, MemoryReadout.Split(gameKb = 6_000, droiddeckKb = 2_000, gpuKb = 1_000)))
}
@Test fun theLogLineSaysEveryPartInMegabytes() {
val device = MemoryReadout.Device(totalKb = 11_379_920, availableKb = 1_048_576, swapTotalKb = 16_777_212, swapFreeKb = 8_388_606)
val split = MemoryReadout.Split(gameKb = 2_097_152, droiddeckKb = 524_288, gpuKb = 3_145_728)
assertEquals(
"used 10089/11113 MB, available 1024 MB, swap 8191/16383 MB | game 2048, droiddeck 512, android 4457, gpu 3072 MB",
MemoryLog.line(device, split),
)
assertTrue(MemoryLog.line(device, split.copy(gpuKb = null)).endsWith("gpu ? MB"))
}
}
@@ -0,0 +1,23 @@
package com.droiddeck.launcher.session
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
class WineProcessesTest {
private fun argv(vararg args: String) = args.joinToString("\u0000", postfix = "\u0000").toByteArray()
@Test fun aWineserverIsKnownByItsProgramOrItsName() {
assertTrue(WineProcesses.isWineserver(argv("/root/.local/share/droiddeck-esync/dist/valve-11/files/bin-arm64/wineserver"), "wineserver\n"))
assertTrue(WineProcesses.isWineserver(argv("wineserver", "-p0"), null))
assertTrue(WineProcesses.isWineserver(null, "wineserver\n"))
assertTrue(WineProcesses.isWineserver(ByteArray(0), "wineserver"))
}
@Test fun nothingElseIs() {
assertFalse(WineProcesses.isWineserver(argv("C:\\windows\\system32\\services.exe"), "services.exe\n"))
assertFalse(WineProcesses.isWineserver(argv("/usr/bin/python3", "/x/files/bin-arm64/wineserver"), "python3\n"))
assertFalse(WineProcesses.isWineserver(argv("/opt/wineserver-helper"), "wineserver-help"))
assertFalse(WineProcesses.isWineserver(null, null))
}
}
@@ -0,0 +1,38 @@
package com.droiddeck.launcher.stores.battlenet
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder
class BattleNetRequestTest {
@get:Rule val tmp = TemporaryFolder()
@Test fun requestsLeftBeforeThePollAreAllKeptInOrder() {
val root = tmp.root
assertTrue(BattleNetClient.request(root, listOf("install-game", "wow")))
assertTrue(BattleNetClient.request(root, listOf("install-game", "fenris")))
assertTrue(BattleNetClient.request(root, listOf("launch", "OSI")))
val names = root.list()!!.sorted()
assertEquals(3, names.size)
assertTrue(names.all { Regex("battlenet-request\\.\\d{20}").matches(it) })
assertEquals(listOf("install-game\nwow\n", "install-game\nfenris\n", "launch\nOSI\n"), names.map { java.io.File(root, it).readText() })
}
@Test fun aLineBreakInAnArgumentIsRefused() {
assertFalse(BattleNetClient.request(tmp.root, listOf("launch", "OSI\nreboot")))
assertEquals(0, tmp.root.list()!!.size)
}
@Test fun aNewSessionClearsEveryLeftRequest() {
val root = tmp.root
BattleNetClient.request(root, listOf("launch", "WTCG"))
java.io.File(root, "battlenet-request").writeText("launch\nPro\n")
java.io.File(root, "battlenet-request.1.tmp").writeText("launch\nPro\n")
java.io.File(root, "battlenet-fex.request").writeText("x")
BattleNetClient.clearRequests(root)
assertEquals(listOf("battlenet-fex.request"), root.list()!!.toList())
}
}
@@ -0,0 +1,30 @@
package com.droiddeck.launcher.stores.battlenet
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Test
class BlizzardArtTest {
@Test fun theShopsKeyArtIsUsed() {
val page = """<meta property="og:image" content="https://blz-contentstack-images.akamaized.net/v3/assets/a/b/c/art.png">"""
assertEquals("https://blz-contentstack-images.akamaized.net/v3/assets/a/b/c/art.png", BlizzardArt.imageUrl(page))
}
@Test fun aVideoStillFallsBackToTheFirstThumbnailThatIsNotABundle() {
val page = """<meta property="og:image" content="https://img.youtube.com/vi/x/maxresdefault.jpg">""" +
"""\"imageUrl\":\"//catalog.blzstatic.com//ff9/a-prod-thumb_bundle.jpg\",""" +
"""\"imageUrl\":\"//catalog.blzstatic.com//feb/b-prod-thumb.jpg\""""
assertEquals("https://catalog.blzstatic.com//feb/b-prod-thumb.jpg", BlizzardArt.imageUrl(page))
}
@Test fun anOpenGraphImageFromAnotherHostFallsBackToTheThumbnail() {
val page = """<meta property="og:image" content="https://example.com/art.png">""" +
"""\"imageUrl\":\"//catalog.blzstatic.com//feb/b-prod-thumb.jpg\""""
assertEquals("https://catalog.blzstatic.com//feb/b-prod-thumb.jpg", BlizzardArt.imageUrl(page))
}
@Test fun artFromOtherHostsIsRefused() {
assertNull(BlizzardArt.imageUrl("""<meta property="og:image" content="https://example.com/art.png">"""))
assertNull(BlizzardArt.imageUrl("""\"imageUrl\":\"//catalog.blzstatic.com//ff9/a-prod-thumb_bundle.jpg\""""))
}
}
+933
View File
@@ -0,0 +1,933 @@
#!/usr/bin/python3
import fcntl
import http.client
import json
import math
import os
import re
import shutil
import signal
import subprocess
import sys
import threading
import time
import urllib.request
HOME = os.environ.get("HOME") or "/root"
BIN = "/usr/local/bin"
PROTON_RUN = os.path.join(BIN, "droiddeck-proton-run")
APP_ID = "2596113170"
INSTALLER_URL = "https://downloader.battle.net/download/getInstallerForGame?os=win&gameProgram=BATTLENET_APP&version=Live"
CLIENT_DIR = ("Program Files (x86)", "Battle.net")
LAUNCHER = "Battle.net Launcher.exe"
CLIENT = "Battle.net.exe"
CONFIG = ("users", "steamuser", "AppData", "Roaming", "Battle.net", "Battle.net.config")
DEFAULT_CONFIG = {"Client": {"HardwareAcceleration": "false", "Streaming": {"StreamingEnabled": "false"}}}
LAUNCH_BEHAVIOR = ("GameLaunchWindowBehavior", "2")
CACHE = os.path.join(HOME, ".cache", "droiddeck", "battlenet")
MENU = "/usr/local/share/applications/droiddeck-battlenet.desktop"
WALLPAPER_DIR = ("users", "steamuser", "AppData", "Local", "DroidDeck")
DESKTOP_KEY = "[Control Panel\\\\Desktop]"
COLORS_KEY = "[Control Panel\\\\Colors]"
WALLPAPER_EDGE = (4, 6, 11)
WALLPAPER_MAX = (1280, 720)
FEX_REQUEST = "battlenet-fex.request"
FEX_RESULT = "battlenet-fex.result"
FEX_WAIT = 120
START_GRACE = 90
POLL = 2
STOP_WAIT = 5
CLOSE_GRACE = 15
HANDOFF_WAIT = 120
GAME_SETTLE = 20
AGENT_GONE = 30
AGENT = "agent.exe"
CODE = re.compile(r"[A-Za-z0-9_]{1,16}")
GAME_UID = re.compile(r"[a-z0-9_]{1,32}")
HANDOVER_WAIT = 1800
CLIENT_READY = 5
READY_SETTLE = 5
CLIENT_WAIT = 300
GAME_GRACE = 15
LAUNCH_WAIT = 15
LAUNCH_ASKS = 3
CLIENT_PATH = re.compile(r"[a-z]:\\(program files \(x86\)|programdata)\\battle\.net\\")
IDLE = {"agent.exe", "conhost.exe", "explorer.exe", "lsass.exe", "plugplay.exe", "rpcss.exe", "services.exe",
"start.exe", "steam.exe", "svchost.exe", "tabtip.exe", "winedevice.exe", "wineserver"}
NOT_GAME = IDLE | {"rundll32.exe", "wineboot.exe", "winemenubuilder.exe"}
MIN_INSTALLER = 1 << 20
SETUP = "Battle.net-Setup.exe"
REQUEST = "battlenet-request"
REQUEST_FILE = re.compile(re.escape(REQUEST) + r"\.\d+")
LIBRARY = None
WOW_UID = re.compile(r"--uid=wow[a-z0-9_]*", re.I)
GAMEPAD_SETTING = re.compile(r"(?im)^\s*SET\s+GamePadEnable\s")
STEAM_CLIENT = {"steam", "steamwebhelper"}
LOG = os.path.join(CACHE, "battlenet.log")
LOG_LIMIT = 512 << 10
def say(message):
line = "droiddeck-battlenet: %s" % message
print(line, file=sys.stderr, flush=True)
try:
os.makedirs(CACHE, exist_ok=True)
if os.path.exists(LOG) and os.path.getsize(LOG) > LOG_LIMIT:
os.replace(LOG, LOG + ".1")
with open(LOG, "a", encoding="utf-8") as f:
f.write("%s [%d] %s\n" % (time.strftime("%Y-%m-%d %H:%M:%S"), os.getpid(), message))
except OSError:
pass
def notify(title, body, icon="dialog-information"):
if not os.environ.get("DBUS_SESSION_BUS_ADDRESS") or not shutil.which("notify-send"):
return
try:
subprocess.run(["notify-send", "-a", "DroidDeck", "-i", icon, title, body],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=5)
except (OSError, subprocess.SubprocessError):
pass
def steam_root():
return os.environ.get("STEAM_COMPAT_CLIENT_INSTALL_PATH") or os.path.join(HOME, ".local", "share", "Steam")
def prefix(root):
return os.path.join(root, "steamapps", "compatdata", APP_ID)
def drive_c(root):
return os.path.join(prefix(root), "pfx", "drive_c")
def client_dir(root):
return os.path.join(drive_c(root), *CLIENT_DIR)
def launcher(root):
return os.path.join(client_dir(root), LAUNCHER)
def installed(root):
return os.path.isfile(launcher(root))
def install_path(library):
return "Z:" + library.rstrip("/")
def write_config(root, library=None):
path = os.path.join(drive_c(root), *CONFIG)
key, value = LAUNCH_BEHAVIOR
try:
with open(path, encoding="utf-8-sig") as f:
config = json.load(f)
except FileNotFoundError:
config = None
except (OSError, ValueError):
return None
first = config is None
if first:
config = json.loads(json.dumps(DEFAULT_CONFIG))
elif not (isinstance(config, dict) and isinstance(config.setdefault("Client", {}), dict)):
return None
client = config["Client"]
changes = []
if client.get(key) != value:
client[key] = value
changes.append("launch")
if client.get("HardwareAcceleration") != "false":
client["HardwareAcceleration"] = "false"
changes.append("acceleration")
if library and isinstance(client.setdefault("Install", {}), dict) \
and str(client["Install"].get("DefaultInstallPath", "")).rstrip("/\\") != install_path(library):
client["Install"]["DefaultInstallPath"] = install_path(library)
changes.append("library")
if not changes:
return None
os.makedirs(os.path.dirname(path), exist_ok=True)
with open(path + ".tmp", "w", encoding="utf-8") as f:
json.dump(config, f, indent=4)
os.replace(path + ".tmp", path)
return "first" if first else " ".join(changes)
def wallpaper_bmp(width, height):
scale = min(width / 1920.0, height / 1080.0)
ox, oy = (width - 1920 * scale) / 2, (height - 1080 * scale) / 2
stops = ((0.0, (20, 33, 58)), (0.5, (10, 17, 32)), (1.0, WALLPAPER_EDGE))
glow = (26, 159, 255)
logo_px = scale * 1.6
def background(u, v):
t = min(math.hypot(u - 960, v - 540) / 1150, 1.0)
(t0, c0), (t1, c1) = (stops[0], stops[1]) if t <= 0.5 else (stops[1], stops[2])
f = (t - t0) / (t1 - t0)
color = [c0[i] + (c1[i] - c0[i]) * f for i in range(3)]
d = math.hypot(u - 947.21, v - 540) / 420
if d < 1:
a = 0.22 * (1 - d)
color = [color[i] * (1 - a) + glow[i] * a for i in range(3)]
return color
def box(x, y, x0, y0, x1, y1):
dx, dy = max(x0 - x, x - x1), max(y0 - y, y - y1)
return math.hypot(max(dx, 0), max(dy, 0)) + min(max(dx, dy), 0)
def white(x, y):
half = max(math.hypot(x - 63.97, y - 111.86) - 111.86, 63.97 - x)
shape = min(box(x, y, -31.98, 0, 63.97, 223.72), half)
hole = min(math.hypot(x - 63.98, y - 111.86) - 71.81,
box(x, y, 56.055, -1, 71.885, 45), box(x, y, 56.055, 178.72, 71.885, 225))
return max(shape, -hole)
rows = []
pad = b"\0" * ((4 - width * 3 % 4) % 4)
for y in range(height - 1, -1, -1):
v = (y + 0.5 - oy) / scale
ly = (v - 361.02) / 1.6
row = bytearray()
for x in range(width):
u = (x + 0.5 - ox) / scale
color = background(u, v)
lx = (u - 844.84) / 1.6
if -40 < lx < 185 and -8 < ly < 232:
for sd, ink in ((white(lx, ly), (255, 255, 255)), (math.hypot(lx - 63.98, ly - 111.86) - 55.98, glow)):
cover = min(max(0.5 - sd * logo_px, 0.0), 1.0)
if cover:
color = [color[i] * (1 - cover) + ink[i] * cover for i in range(3)]
row += bytes((int(color[2] + 0.5), int(color[1] + 0.5), int(color[0] + 0.5)))
rows.append(bytes(row) + pad)
pixels = b"".join(rows)
header = b"BM" + (54 + len(pixels)).to_bytes(4, "little") + b"\0\0\0\0" + (54).to_bytes(4, "little")
info = (40).to_bytes(4, "little") + width.to_bytes(4, "little") + height.to_bytes(4, "little") + \
(1).to_bytes(2, "little") + (24).to_bytes(2, "little") + b"\0" * 4 + len(pixels).to_bytes(4, "little") + \
(2835).to_bytes(4, "little") * 2 + b"\0" * 8
return header + info + pixels
def reg_value(reg, key, name, value):
line = '"%s"="%s"' % (name, value.replace("\\", "\\\\").replace('"', '\\"'))
try:
with open(reg, encoding="utf-8", errors="replace") as f:
rows = f.read().splitlines()
except OSError:
return False
inside, last = False, None
for row in rows:
if row.startswith("["):
inside = row.startswith(key + " ") or row == key
elif inside and row.startswith('"%s"=' % name):
last = row
if last != line:
with open(reg, "a", encoding="utf-8") as out:
out.write("\n%s %d\n%s\n" % (key, int(time.time()), line))
return True
def desktop_size():
width, height = os.environ.get("BL_WIDTH", ""), os.environ.get("BL_HEIGHT", "")
if width.isdigit() and height.isdigit() and 0 < int(width) <= 7680 and 0 < int(height) <= 4320:
return int(width), int(height)
return 1280, 720
def wallpaper(root):
width, height = desktop_size()
shrink = min(1.0, WALLPAPER_MAX[0] / width, WALLPAPER_MAX[1] / height)
width, height = max(1, round(width * shrink)), max(1, round(height * shrink))
name = "wallpaper-%dx%d.bmp" % (width, height)
folder = os.path.join(drive_c(root), *WALLPAPER_DIR)
path = os.path.join(folder, name)
reg = os.path.join(prefix(root), "pfx", "user.reg")
if not os.path.isfile(reg):
return False
if not os.path.isfile(path):
os.makedirs(folder, exist_ok=True)
with open(path + ".tmp", "wb") as f:
f.write(wallpaper_bmp(width, height))
os.replace(path + ".tmp", path)
say("drew DroidDeck's wallpaper for Battle.net's %dx%d desktop" % (width, height))
windows = "C:\\" + "\\".join(WALLPAPER_DIR + (name,))
reg_value(reg, DESKTOP_KEY, "Wallpaper", windows)
reg_value(reg, DESKTOP_KEY, "TileWallpaper", "0")
reg_value(reg, DESKTOP_KEY, "WallpaperStyle", "2" if shrink < 1 else "0")
reg_value(reg, COLORS_KEY, "Background", "%d %d %d" % WALLPAPER_EDGE)
return True
def windows_path(root, path):
found = re.match(r"(?i)^([cz]):[\\/](.*)$", path.strip())
if not found:
return None
parts = [part for part in re.split(r"[\\/]+", found.group(2)) if part]
if not parts or ".." in parts:
return None
return os.path.join(drive_c(root) if found.group(1).lower() == "c" else "/", *parts)
def wow_folders(root):
try:
with open(os.path.join(prefix(root), "pfx", "system.reg"), encoding="utf-8", errors="replace") as f:
rows = f.read().splitlines()
except OSError:
return []
folders, location, wow = [], None, False
for row in rows + ["["]:
if row.startswith("["):
if wow and location:
folders.append(location)
location, wow = None, False
elif row.startswith('"InstallLocation"='):
location = windows_path(root, row.split("=", 1)[1].strip().strip('"').replace("\\\\", "\\"))
elif row.startswith('"UninstallString"=') and WOW_UID.search(row):
wow = True
return [folder for folder in dict.fromkeys(folders) if os.path.isdir(folder)]
def enable_gamepad(root):
changed = []
for folder in wow_folders(root):
try:
flavors = sorted(name for name in os.listdir(folder) if len(name) > 2 and name.startswith("_") and name.endswith("_"))
except OSError:
continue
for name in flavors:
if not os.path.isdir(os.path.join(folder, name)):
continue
path = os.path.join(folder, name, "WTF", "Config.wtf")
try:
with open(path, encoding="utf-8", errors="replace") as f:
text = f.read()
except FileNotFoundError:
text = ""
except OSError:
continue
if GAMEPAD_SETTING.search(text):
continue
try:
os.makedirs(os.path.dirname(path), exist_ok=True)
with open(path, "a", encoding="utf-8") as f:
f.write(("\n" if text and not text.endswith("\n") else "") + 'SET GamePadEnable "1"\n')
except OSError as error:
say("controllers not turned on in %s: %s" % (path, error))
continue
changed.append(path)
say("World of Warcraft's controller support turned on in %s" % path)
return changed
def steam_running(proc="/proc"):
try:
pids = [p for p in os.listdir(proc) if p.isdigit()]
except OSError:
return False
for pid in pids:
try:
with open(os.path.join(proc, pid, "cmdline"), "rb") as f:
argv = [os.path.basename(a.decode("utf-8", "replace")) for a in f.read().split(b"\0")[:2] if a]
except OSError:
continue
if argv[:1] and argv[0] in ("FEX", "FEXInterpreter"):
argv = argv[1:]
if argv[:1] and argv[0] in STEAM_CLIENT:
return True
return False
def proton_env():
env = dict(os.environ)
if not steam_running():
env.setdefault("PROTON_SPOOF_STEAMINPUT_VIDPID", "1")
return env
def configure(root, library=None):
if library:
try:
os.makedirs(library, exist_ok=True)
except OSError as error:
say("%s not made: %s" % (library, error))
try:
change = write_config(root, library)
except OSError as error:
say("Battle.net's config not written: %s" % error)
return
try:
wallpaper(root)
except OSError as error:
say("Battle.net's desktop wallpaper not set: %s" % error)
enable_gamepad(root)
if change == "first":
say("wrote Battle.net's first config: hardware acceleration off, streaming off, closing itself as it launches a game")
elif change:
if "launch" in change:
say("Battle.net's config: closing itself as it launches a game")
if "library" in change:
say("Battle.net's config: games install to %s" % library)
if "acceleration" in change:
say("Battle.net's config: browser hardware acceleration off")
def write_menu(path=MENU):
body = ("[Desktop Entry]\nType=Application\nName=Battle.net\nComment=Blizzard's games and launcher\n"
"Exec=%s\nIcon=applications-games\nTerminal=false\nCategories=Network;\n"
% os.path.join(BIN, "droiddeck-battlenet"))
try:
with open(path, encoding="utf-8") as f:
if f.read() == body:
return
except OSError:
pass
try:
os.makedirs(os.path.dirname(path), exist_ok=True)
with open(path + ".tmp", "w", encoding="utf-8") as f:
f.write(body)
os.replace(path + ".tmp", path)
except OSError as error:
say("menu entry not written: %s" % error)
def ask_fex(launch_dir, wait=FEX_WAIT):
if not launch_dir or not os.path.isdir(launch_dir):
say("not inside a DroidDeck session; FEX stays as Components has it")
return None
result = os.path.join(launch_dir, FEX_RESULT)
request = os.path.join(launch_dir, FEX_REQUEST)
try:
os.unlink(result)
except OSError:
pass
with open(request + ".tmp", "w", encoding="utf-8") as f:
f.write("appid=%s\n" % APP_ID)
os.replace(request + ".tmp", request)
deadline = time.monotonic() + wait
while time.monotonic() < deadline:
try:
with open(result, encoding="utf-8") as f:
answer = f.read().strip()
except OSError:
time.sleep(0.5)
continue
os.unlink(result)
return answer
return None
def wine_processes(pfx, proc="/proc"):
want = os.path.realpath(pfx).rstrip("/")
found = []
try:
pids = [p for p in os.listdir(proc) if p.isdigit()]
except OSError:
return found
for pid in pids:
try:
with open(os.path.join(proc, pid, "environ"), "rb") as f:
env = f.read().split(b"\0")
with open(os.path.join(proc, pid, "cmdline"), "rb") as f:
argv = [a.decode("utf-8", "replace") for a in f.read().split(b"\0") if a]
except OSError:
continue
for item in env:
if item.startswith(b"WINEPREFIX="):
value = item[len(b"WINEPREFIX="):].decode("utf-8", "replace")
if os.path.realpath(value).rstrip("/") == want:
found.append((int(pid), argv))
break
return found
def program(argv):
return re.split(r"[\\/]", argv[0])[-1].lower() if argv else ""
def is_client(argv):
return program(argv) == CLIENT.lower()
def idle(processes):
return all(program(argv) in IDLE for _, argv in processes)
def running(pfx):
return any(is_client(argv) for _, argv in wine_processes(pfx))
def is_battlenet(argv):
return bool(argv) and bool(CLIENT_PATH.match(argv[0].replace("/", "\\").lower()))
def is_game(argv):
if not argv or program(argv) in NOT_GAME or not re.match(r"[A-Za-z]:[\\/]", argv[0]):
return False
return not is_battlenet(argv)
def launched(argv):
return is_game(argv) and "-uid" in (arg.lower() for arg in argv[1:])
def shares_sign_in(argv):
return "-sso" in (arg.lower() for arg in argv[1:])
def agent_up(processes):
return any(is_client(argv) for _, argv in processes) and any(program(argv) == AGENT for _, argv in processes)
class Tidy:
def __init__(self, settle=None, gone=None):
self.settle = GAME_SETTLE if settle is None else settle
self.gone = AGENT_GONE if gone is None else gone
self.game_since = None
self.closed_for_game = False
self.agent_seen = False
self.agent_lost = None
def __call__(self, processes, now):
own = [(pid, argv) for pid, argv in processes if is_battlenet(argv)]
games = [argv for _, argv in processes if launched(argv)]
if games:
self.game_since = self.game_since if self.game_since is not None else now
if own and not self.closed_for_game and now - self.game_since >= self.settle:
self.closed_for_game, self.agent_seen, self.agent_lost = True, False, None
if any(is_client(argv) for _, argv in own) and any(shares_sign_in(argv) for argv in games):
say("Battle.net stayed open beside a game signing in with its token: left open")
return False
say("the game is up: closing what is left of Battle.net (%d process(es)) to leave it their memory" % len(own))
stop(own)
return True
return False
self.game_since, self.closed_for_game = None, False
if not any(is_client(argv) for _, argv in processes):
self.agent_seen, self.agent_lost = False, None
elif agent_up(processes):
self.agent_seen, self.agent_lost = True, None
elif self.agent_seen:
self.agent_lost = self.agent_lost if self.agent_lost is not None else now
if now - self.agent_lost >= self.gone:
say("Battle.net has outlived its Agent: closing it (%d process(es))" % len(own))
stop(own)
notify("Battle.net was closed", "It had lost Blizzard's update service. Open it again to reconnect.",
"dialog-warning")
self.agent_seen, self.agent_lost = False, None
return True
return False
def proton_options():
if os.environ.get("BL_DESKTOP") == "1":
return ["--window"]
width, height = os.environ.get("BL_WIDTH", ""), os.environ.get("BL_HEIGHT", "")
options = ["--desktop", "%sx%s" % (width, height)] if width.isdigit() and height.isdigit() else []
game = os.environ.get("SteamGameId", "")
return options + (["--game-id", game] if game.isdigit() and game != "0" else [])
def stop(processes, wait=STOP_WAIT):
pids = [pid for pid, _ in processes]
for sig in (signal.SIGTERM, signal.SIGKILL):
for pid in pids:
try:
os.kill(pid, sig)
except OSError:
pass
deadline = time.monotonic() + wait
while time.monotonic() < deadline:
pids = [pid for pid in pids if os.path.exists("/proc/%d" % pid)]
if not pids:
return
time.sleep(0.2)
def queued_requests(launch_dir):
try:
names = os.listdir(launch_dir)
except OSError:
return []
return sorted(name for name in names if REQUEST_FILE.fullmatch(name))
def serve_requests(pfx, processes=None, launch_dir=None):
launch_dir = launch_dir or os.environ.get("BL_LAUNCH_DIR")
names = queued_requests(launch_dir) if launch_dir else []
if not names or not agent_up(wine_processes(pfx) if processes is None else processes):
return False
client = os.path.join(pfx, "drive_c", *CLIENT_DIR, CLIENT)
served = False
for name in names:
path = os.path.join(launch_dir, name)
try:
with open(path, encoding="utf-8") as f:
args = [line for line in f.read().splitlines() if line]
os.unlink(path)
except OSError:
continue
if len(args) == 2 and args[0] == "install-game" and GAME_UID.fullmatch(args[1]):
spawn(client, "run", ["--install", "--game=%s" % args[1]])
elif len(args) == 2 and args[0] == "launch" and CODE.fullmatch(args[1]):
spawn(client, "run", ["--exec=launch %s" % args[1]])
else:
say("not a request: %s" % " ".join(args))
continue
say("the app asked for %s" % " ".join(args))
served = True
return served
def wait_while_open(pfx, grace, poll=None):
deadline = time.monotonic() + grace
seen = False
while True:
serve_requests(pfx)
if running(pfx):
seen = True
elif seen or time.monotonic() >= deadline:
return seen
time.sleep(POLL if poll is None else poll)
def proton(exe, args=(), verb=None, watch=None, poll=None, close_grace=None, tidy=None):
cmd = [PROTON_RUN] + proton_options() + ["--prefix", APP_ID] + (["--verb", verb] if verb else []) + [exe] + list(args)
say(" ".join(cmd))
try:
process = subprocess.Popen(cmd, env=proton_env())
except OSError as error:
say("%s: %s" % (PROTON_RUN, error))
return 127, False
seen = False
closed_at = None
grace = CLOSE_GRACE if close_grace is None else close_grace
tidy = Tidy() if tidy is None else tidy
while True:
try:
status = process.wait(timeout=POLL if poll is None else poll)
return status, seen
except subprocess.TimeoutExpired:
pass
if watch is None:
continue
processes = wine_processes(watch)
serve_requests(watch, processes)
now = time.monotonic()
if tidy(processes, now):
seen = True
processes = wine_processes(watch)
if any(is_client(argv) for _, argv in processes):
seen, closed_at = True, None
elif seen and idle(processes):
closed_at = closed_at if closed_at is not None else now
if now - closed_at >= grace:
say("Battle.net closed; stopping %d process(es) it left in its prefix" % len(processes))
stop(processes)
closed_at = None
else:
closed_at = None
def setup_ready(path):
try:
with open(path, "rb") as f:
return f.read(2) == b"MZ" and os.path.getsize(path) >= MIN_INSTALLER
except OSError:
return False
def download(url=INSTALLER_URL, folder=CACHE):
os.makedirs(folder, exist_ok=True)
dest = os.path.join(folder, SETUP)
if setup_ready(dest):
return dest
part = dest + ".part"
try:
try:
request = urllib.request.Request(url, headers={"User-Agent": "DroidDeck"})
with urllib.request.urlopen(request, timeout=60) as response, open(part, "wb") as f:
shutil.copyfileobj(response, f)
length = response.headers.get("Content-Length", "")
if length.isdigit() and f.tell() != int(length):
raise OSError("the download ended early")
except (OSError, http.client.HTTPException) as error:
if not shutil.which("curl"):
raise
say("download through Python failed (%s); trying curl" % error)
if subprocess.call(["curl", "-fsSL", "--max-time", "300", "-o", part, url]) != 0:
raise OSError("curl could not download it")
if not setup_ready(part):
raise OSError("not a Windows program")
os.replace(part, dest)
except (OSError, http.client.HTTPException) as error:
say("installer download failed: %s" % error)
try:
os.unlink(part)
except OSError:
pass
return dest if os.path.isfile(dest) else None
def install(root, pfx, verb=None):
setup = download()
if setup is None:
notify("Battle.net could not be downloaded", "Check the connection and try again.", "dialog-error")
return False, False
configure(root, LIBRARY)
notify("Installing Battle.net", "Blizzard's installer opens in a window. It can take a few minutes.")
_, seen = proton(setup, verb=verb, watch=pfx)
return installed(root), seen
def acquire(folder=CACHE):
os.makedirs(folder, exist_ok=True)
handle = open(os.path.join(folder, "battlenet.lock"), "w")
try:
fcntl.flock(handle, fcntl.LOCK_EX | fcntl.LOCK_NB)
except OSError:
handle.close()
return None
return handle
def status(root):
pfx = os.path.join(prefix(root), "pfx")
return {"appid": int(APP_ID), "prefix": prefix(root), "installed": installed(root),
"launcher": launcher(root), "running": running(pfx)}
def spawn(program, verb, args=()):
cmd = [PROTON_RUN] + proton_options() + ["--prefix", APP_ID, "--verb", verb, program] + list(args)
say(" ".join(cmd))
try:
os.makedirs(CACHE, exist_ok=True)
with open(os.path.join(CACHE, "spawned.log"), "ab") as log:
child = subprocess.Popen(cmd, stdin=subprocess.DEVNULL, stdout=log, stderr=log, start_new_session=True, env=proton_env())
threading.Thread(target=child.wait, daemon=True).start()
except OSError as error:
say("%s: %s" % (PROTON_RUN, error))
return 127
return 0
def show(root, wait=None, poll=None, args=()):
pfx = os.path.join(prefix(root), "pfx")
client = os.path.join(client_dir(root), CLIENT)
deadline = time.monotonic() + (HANDOFF_WAIT if wait is None else wait)
while True:
processes = wine_processes(pfx)
if any(is_client(argv) for _, argv in processes) and os.path.isfile(client) \
and (agent_up(processes) or time.monotonic() >= deadline):
spawn(client, "run", args)
return None
lock = acquire()
if lock is not None:
say("the other start has ended; opening Battle.net")
return lock
if time.monotonic() >= deadline:
say("the other start neither opened Battle.net nor ended")
notify("Battle.net is busy", "Another start is still running; try again in a moment.", "dialog-warning")
return None
time.sleep(POLL if poll is None else poll)
def stop_leftovers(pfx):
processes = wine_processes(pfx)
if not processes:
return True
if not idle(processes):
say("the prefix is in use (%s); Battle.net starts beside it" % ", ".join(sorted({program(a) for _, a in processes} - IDLE)))
return False
say("stopping %d process(es) a closed Battle.net left in its prefix" % len(processes))
stop(processes)
return True
def open_client(root, reinstall=False):
pfx = os.path.join(prefix(root), "pfx")
write_menu()
answer = ask_fex(os.environ.get("BL_LAUNCH_DIR"))
say("FEX: %s" % (answer or "no answer from the app; Components' choice stays"))
if running(pfx):
say("Battle.net is already running in its prefix; waiting for it to close")
wait_while_open(pfx, grace=0)
return 0
verb = None if stop_leftovers(pfx) else "run"
if reinstall or not installed(root):
done, seen = install(root, pfx, verb)
if not done:
notify("Battle.net did not install", "The session's desktop.log says why.", "dialog-error")
return 1
if wait_while_open(pfx, grace=0 if seen else START_GRACE) or seen:
return 0
verb = None if stop_leftovers(pfx) else "run"
configure(root, LIBRARY)
status_code, seen = proton(launcher(root), verb=verb, watch=pfx)
say("Proton returned %d; Battle.net %s" % (status_code, "ran" if seen else "has not been seen yet"))
if not (wait_while_open(pfx, grace=0 if seen else START_GRACE) or seen):
say("Battle.net did not start (the launcher exited with %d)" % status_code)
notify("Battle.net did not start", "The session's desktop.log says why.", "dialog-error")
return status_code or 1
say("Battle.net closed")
return 0
def start(exe, verb=None):
cmd = [PROTON_RUN] + proton_options() + ["--prefix", APP_ID] + (["--verb", verb] if verb else []) + [exe]
say(" ".join(cmd))
try:
return subprocess.Popen(cmd, env=proton_env())
except OSError as error:
say("%s: %s" % (PROTON_RUN, error))
return None
def wait_ready(pfx, wait=None, poll=None, settle=None):
deadline = time.monotonic() + (CLIENT_WAIT if wait is None else wait)
while True:
count = sum(1 for _, argv in wine_processes(pfx) if is_client(argv))
if count >= CLIENT_READY:
time.sleep(READY_SETTLE if settle is None else settle)
return True
if time.monotonic() >= deadline:
return count > 0
time.sleep(POLL if poll is None else poll)
def follow(pfx, poll=None, grace=None, tidy=None, ask=None):
seen, gone_at = False, None
asked, asks = None, 1
grace = GAME_GRACE if grace is None else grace
tidy = Tidy() if tidy is None else tidy
while True:
processes = wine_processes(pfx)
serve_requests(pfx, processes)
now = time.monotonic()
if tidy(processes, now):
processes = wine_processes(pfx)
games = sorted({program(argv) for _, argv in processes if is_game(argv)})
if games:
if not seen:
say("game running: %s" % ", ".join(games))
seen, gone_at = True, None
elif seen or not any(is_client(argv) for _, argv in processes):
gone_at = gone_at if gone_at is not None else now
if now - gone_at >= grace:
say("the game has exited" if seen else "Battle.net closed before a game started")
return seen
else:
gone_at = None
asked = now if asked is None else asked
if ask is not None and asks < LAUNCH_ASKS and now - asked >= LAUNCH_WAIT:
say("Battle.net has not started the game yet; asking again")
ask()
asked, asks = now, asks + 1
time.sleep(POLL if poll is None else poll)
def launch(root, code):
pfx = os.path.join(prefix(root), "pfx")
client = os.path.join(client_dir(root), CLIENT)
if not installed(root) or not os.path.isfile(client):
say("Battle.net is not installed; %s is not launched" % code)
notify("Battle.net is not installed", "Install it from its tile on DroidDeck's Desktop tab.", "dialog-error")
return 1
lock = acquire()
try:
own = None
if lock is not None and not running(pfx):
answer = ask_fex(os.environ.get("BL_LAUNCH_DIR"))
say("FEX: %s" % (answer or "no answer from the app; Components' choice stays"))
verb = None if stop_leftovers(pfx) else "run"
configure(root, LIBRARY)
own = start(launcher(root), verb)
if own is None:
return 127
if not wait_ready(pfx):
say("Battle.net did not open; %s is not launched" % code)
notify("Battle.net did not start", "The session's desktop.log says why.", "dialog-error")
return 1
if code.lower().startswith("wow"):
enable_gamepad(root)
say("launching %s" % code)
spawn(client, "run", ["--exec=launch %s" % code])
played = follow(pfx, ask=lambda: spawn(client, "run", ["--exec=launch %s" % code]))
if own is not None:
leftovers = wine_processes(pfx)
say("stopping what the Battle.net opened for %s left: %d process(es)" % (code, len(leftovers)))
stop(leftovers)
try:
own.wait(timeout=STOP_WAIT * 4)
except subprocess.TimeoutExpired:
say("its Proton is still ending")
return 0 if played else 1
finally:
if lock is not None:
lock.close()
def hand_over(root, args, wait=None):
if not wait_ready(os.path.join(prefix(root), "pfx"), wait=HANDOVER_WAIT if wait is None else wait):
say("Battle.net did not come up; %s not asked for" % " ".join(args))
return False
spawn(os.path.join(client_dir(root), CLIENT), "run", args)
return True
def install_game(root, uid):
args = ["--install", "--game=%s" % uid]
if installed(root) and agent_up(wine_processes(os.path.join(prefix(root), "pfx"))):
say("asking the open Battle.net to install %s" % uid)
spawn(os.path.join(client_dir(root), CLIENT), "run", args)
return 0
lock = acquire()
if lock is None:
say("another start holds the lock")
lock = show(root, args=args)
if lock is None:
return 0
threading.Thread(target=hand_over, args=(root, args), daemon=True).start()
with lock:
return open_client(root)
def main(argv):
global LIBRARY
argv = list(argv)
if len(argv) >= 2 and argv[0] == "--library":
if not argv[1].startswith("/") or "\n" in argv[1]:
say("%s is not a folder" % argv[1])
return 2
LIBRARY = os.path.normpath(argv[1])
argv = argv[2:]
action = argv[0] if argv else "open"
launching = action == "launch" and len(argv) == 2 and CODE.fullmatch(argv[1])
getting = action == "install-game" and len(argv) == 2 and GAME_UID.fullmatch(argv[1])
if not (launching or getting) and (action not in ("open", "install", "status") or len(argv) > 1):
say("usage: droiddeck-battlenet [--library DIR] [open | install | status | launch CODE | install-game ID]")
return 2
root = steam_root()
if action == "status":
print(json.dumps(status(root)))
return 0
os.environ["BL_BATTLENET"] = "1"
if launching:
say("launch %s" % argv[1])
return launch(root, argv[1])
if getting:
say("install-game %s" % argv[1])
return install_game(root, argv[1])
say("%s (%s)" % (action, "from the menu" if not sys.stderr.isatty() else "from a terminal"))
lock = acquire()
if lock is None:
say("another start holds the lock")
lock = show(root)
if lock is None:
return 0
with lock:
return open_client(root, reinstall=action == "install")
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
@@ -1,7 +1,7 @@
#!/usr/bin/python3
"""Runs a Windows program with the Proton the Steam client has chosen for it.
droiddeck-proton-run [--window] PROGRAM [ARGS...]
droiddeck-proton-run [--window] [--prefix ID] [--verb run] [--game-id ID] [--desktop WxH] PROGRAM [ARGS...]
droiddeck-proton-run --app ID [--dir FOLDER] [--options TEXT] [PROGRAM [ARGS...]]
The program belongs to an installed Steam game when it sits in one's folder, to a prefix when it
@@ -10,7 +10,11 @@ its own, under the id the client gives a new shortcut. That title's CompatToolMa
config.vdf picks the tool, else the client's default for all other titles ("0"). The tool is
started as the client starts it - its toolmanifest's command line, the waitforexitandrun verb and
the STEAM_COMPAT_* environment - so its wrapper applies the game's settings, components and audio.
--window keeps the program in the desktop's own window, drawn with WineD3D.
--window keeps the program in the desktop's own window, drawn with WineD3D on the desktop's software
GL (llvmpipe): KWin there composites in software, and the session's zink finds no device.
--prefix ID puts the program in compatdata/ID whatever it is. --verb run starts it beside what already
runs in the prefix, which waitforexitandrun would wait for; the wrapper's launch-time steps are skipped.
--game-id ID keeps the id of the launch it runs for: gamescope shows the windows that carry the id Steam launched.
--app starts one game without the Steam client (its Start without Steam): a Steam game's default
Windows launch option from appinfo.vdf when no program is given, else the program in that
shortcut's own prefix, started in --dir with the shortcut's launch options (--options). Without
@@ -31,7 +35,10 @@ BIN_DIR = os.path.dirname(os.path.abspath(__file__))
STATE = os.path.join(HOME, ".local", "share", "droiddeck-compat", "state.json")
EXTRA_LIBRARIES = ("/mnt/droiddeck", "/mnt/droiddeck-sd")
SYSTEM_TOOLS = ("/usr/share/steam/compatibilitytools.d", "/usr/local/share/steam/compatibilitytools.d")
DESKTOP_GL = {"LIBGL_ALWAYS_SOFTWARE": "1", "GALLIUM_DRIVER": "llvmpipe"}
NOT_DESKTOP_GL = ("MESA_LOADER_DRIVER_OVERRIDE", "LIBGL_KOPPER_DRI2")
VERB = "waitforexitandrun"
VERBS = (VERB, "run")
SHORTCUT_BIT = 0x80000000
STEAM_APP_LIMIT = 2 ** 31
@@ -289,6 +296,15 @@ def locate(program, root):
os.path.dirname(program), root, "own")
def fixed(program, root, appid):
return Target(appid, os.path.join(root, "steamapps", "compatdata", str(appid)),
os.path.dirname(program), root, "fixed")
def prefix_id(value):
return value if value.isdigit() and not value.startswith("0") and int(value) <= 0xFFFFFFFF else None
def split_words(text):
try:
return shlex.split(text or "")
@@ -372,7 +388,7 @@ def steam_launches(target, program, root):
return os.path.relpath(program, target.install).replace(os.sep, "/").lower() in entry.get("launch", ())
def environment(env, target, tool_folder, root, window=False):
def environment(env, target, tool_folder, root, window=False, game_id=None):
env = dict(env)
steamapps = [os.path.join(lib, "steamapps") for lib in libraries(root)]
env.update({
@@ -390,28 +406,52 @@ def environment(env, target, tool_folder, root, window=False):
else:
game = str(number << 32 | 0x02000000)
env.update(SteamAppId="0", STEAM_COMPAT_APP_ID="0", SteamGameId=game, SteamOverlayGameId=game)
if game_id:
env.update(SteamGameId=game_id, SteamOverlayGameId=game_id)
if window:
env.setdefault("PROTON_USE_WINED3D", "1")
env.update(DESKTOP_GL)
for name in NOT_DESKTOP_GL:
env.pop(name, None)
return env
def windows_path(path):
def windows_path(path, compatdata=None):
if compatdata:
drive = os.path.join(compatdata, "pfx", "drive_c")
inside = os.path.relpath(path, drive)
if inside != "." and not inside.startswith(".."):
return "C:\\" + inside.replace("/", "\\")
return "Z:" + path.replace("/", "\\")
def arguments(program, args):
def arguments(program, args, desktop=None, compatdata=None):
if program.lower().endswith(".msi"):
return ["msiexec", "/i", windows_path(program)] + args
if desktop:
return ["explorer.exe", "/desktop=droiddeck,%s" % desktop, windows_path(program, compatdata)] + args
return [program] + args
def main(argv):
window = False
prefix = None
verb = VERB
game_id = None
desktop = None
app, start, options = None, None, None
while argv and argv[0].startswith("--"):
option = argv.pop(0)
if option == "--window":
window = True
elif option == "--prefix" and argv and prefix_id(argv[0]):
prefix = argv.pop(0)
elif option == "--verb" and argv and argv[0] in VERBS:
verb = argv.pop(0)
elif option == "--game-id" and argv and argv[0].isdigit() and argv[0] != "0":
game_id = argv.pop(0)
elif option == "--desktop" and argv and re.fullmatch(r"[1-9][0-9]{2,4}x[1-9][0-9]{2,4}", argv[0]):
desktop = argv.pop(0)
elif option in ("--app", "--dir", "--options") and argv:
value = argv.pop(0)
if option == "--app":
@@ -429,7 +469,7 @@ def main(argv):
say("%s is not an app id" % app)
return 2
if not argv and app is None:
say("usage: droiddeck-proton-run [--window] PROGRAM [ARGS...]")
say("usage: droiddeck-proton-run [--window] [--prefix ID] [--verb run] [--game-id ID] [--desktop WxH] PROGRAM [ARGS...]")
return 2
root = os.environ.get("STEAM_COMPAT_CLIENT_INSTALL_PATH") or STEAM_ROOT
if options is None:
@@ -453,6 +493,8 @@ def main(argv):
args = args + argv[1:]
if app is not None and int(app) >= STEAM_APP_LIMIT:
target = shortcut_target(app, program, start, root)
elif prefix:
target = fixed(program, root, prefix)
else:
target = locate(program, root)
available = tools(root)
@@ -462,7 +504,7 @@ def main(argv):
return 69
folder, command = available[name]
os.makedirs(target.compatdata, exist_ok=True)
env = environment(os.environ, target, folder, root, window)
env = environment(os.environ, target, folder, root, window, game_id)
env.update(extra)
say("%s with %s (%s), %s prefix %s%s" % (program, name, why, target.kind, target.compatdata,
", without the Steam client" if app is not None else ""))
@@ -471,7 +513,7 @@ def main(argv):
except OSError:
os.chdir(os.path.dirname(program))
entry = os.path.join(folder, command)
os.execve(entry, [entry, VERB] + arguments(program, args), env)
os.execve(entry, [entry, verb] + arguments(program, args, desktop, target.compatdata), env)
if __name__ == "__main__":
@@ -25,6 +25,8 @@ Android: an EOS sign-in step that falls back to a browser (a consent Epic asks f
is finished there. An EOS overlay pointer (HKCU\Software\Epic Games\EOS "OverlayPath") an earlier
build wrote is removed - with it the game exited while loading.
Battle.net.exe in Battle.net's prefix is handed to droiddeck-battlenet, which runs the whole launch.
droiddeck-store-launch <the arguments Steam gave the compat tool>
"""
@@ -291,6 +293,27 @@ def create_prefix(compat_data, proton, timeout=120):
CLOUD_TIMEOUT = 15.0
CLOUD_STORES = ("gog", "epic")
STORE_GAME = 10
RAN = 11
RAN_FAILED = 12
BATTLENET = "/usr/local/bin/droiddeck-battlenet"
BATTLENET_EXE = re.compile(r"(?i)/compatdata/2596113170/pfx/drive_c/Program Files \(x86\)/Battle\.net/Battle\.net\.exe$")
BATTLENET_LAUNCH = re.compile(r'(?i)^--exec=\s*"?launch\s+([A-Za-z0-9_]{1,16})"?$')
def battlenet(argv, env=os.environ):
if env.get("BL_BATTLENET"):
return None
exe, code = False, None
for raw in argv:
arg = raw.strip().strip('"').strip("'")
if BATTLENET_EXE.search(arg.replace("\\", "/")):
exe = True
found = BATTLENET_LAUNCH.match(arg)
if found:
code = found.group(1)
if not exe:
return None
return [BATTLENET, "launch", code] if code else [BATTLENET, "open"]
def cloud_on(sidecar):
@@ -511,6 +534,10 @@ def main(argv):
pass
rest = rest[2:]
return exited(rest, code)
command = battlenet(argv)
if command is not None:
log("battlenet " + " ".join(command[1:]))
return RAN if subprocess.call(command) == 0 else RAN_FAILED
found = find_store_game(argv)
if found is None:
return 0
@@ -69,7 +69,10 @@ bl_store_launch() {
fi
[ -x /usr/local/bin/droiddeck-store-launch ] || return 0
/usr/local/bin/droiddeck-store-launch "$@"
[ $? -eq 10 ] && BL_STORE_EXIT=1
rc=$?
[ $rc -eq 10 ] && BL_STORE_EXIT=1
[ $rc -eq 11 ] && exit 0
[ $rc -eq 12 ] && exit 1
return 0
}
File diff suppressed because it is too large. Load diff
+16
View File
@@ -456,6 +456,15 @@ class ProtonRunTest(Temp):
("0", "0", str(appid << 32 | 0x02000000), "1"))
self.assertEqual(env["STEAM_COMPAT_DATA_PATH"], str(self.root / ("steamapps/compatdata/%d" % appid)))
def test_a_window_draws_with_the_desktops_software_gl(self):
target = RUN["Target"]("2596113170", "/c", "/i", str(self.root), "fixed")
session = {"MESA_LOADER_DRIVER_OVERRIDE": "zink", "GALLIUM_DRIVER": "zink", "LIBGL_KOPPER_DRI2": "true"}
env = RUN["environment"](session, target, "/tool", str(self.root), window=True)
self.assertEqual((env["LIBGL_ALWAYS_SOFTWARE"], env["GALLIUM_DRIVER"]), ("1", "llvmpipe"))
self.assertNotIn("MESA_LOADER_DRIVER_OVERRIDE", env)
self.assertNotIn("LIBGL_KOPPER_DRI2", env)
self.assertEqual(RUN["environment"](session, target, "/tool", str(self.root))["GALLIUM_DRIVER"], "zink")
def test_a_steam_game_keeps_its_own_id(self):
target = RUN["Target"]("413150", "/c", "/i", str(self.root), "steam")
env = RUN["environment"]({"PROTON_USE_WINED3D": "0"}, target, "/tool", str(self.root), window=True)
@@ -465,6 +474,13 @@ class ProtonRunTest(Temp):
self.assertEqual(RUN["arguments"]("/root/x/setup.msi", ["/qn"]), ["msiexec", "/i", "Z:\\root\\x\\setup.msi", "/qn"])
self.assertEqual(RUN["arguments"]("/root/x/a.exe", ["-w"]), ["/root/x/a.exe", "-w"])
def test_a_virtual_desktop_runs_the_program_by_its_windows_path(self):
pfx = "/root/Steam/steamapps/compatdata/2596113170"
self.assertEqual(RUN["arguments"](pfx + "/pfx/drive_c/Program Files (x86)/Battle.net/Battle.net Launcher.exe", [], "1280x720", pfx),
["explorer.exe", "/desktop=droiddeck,1280x720", "C:\\Program Files (x86)\\Battle.net\\Battle.net Launcher.exe"])
self.assertEqual(RUN["arguments"]("/root/.cache/setup.exe", ["--lang=enUS"], "1920x1080", pfx),
["explorer.exe", "/desktop=droiddeck,1920x1080", "Z:\\root\\.cache\\setup.exe", "--lang=enUS"])
def test_a_games_own_program_is_left_to_steam(self):
self.write("Steam/appcache/appinfo.vdf", appinfo({413150: STARDEW}))
self.assertEqual(RUN["compat"]()["launch_programs"](STARDEW["config"]),
+30 -1
View File
@@ -277,11 +277,40 @@ class CloudHooks(unittest.TestCase):
for sh in (compat.LAUNCHER_SH, compat.EXTRA_WRAPPER_SH):
self.assertIn('bl_run ${BL_TASKSET:-} /usr/local/bin/droiddeck-game-env', sh)
self.assertNotIn('exec ${BL_TASKSET:-} /usr/local/bin/droiddeck-game-env', sh)
self.assertIn('[ $? -eq 10 ] && BL_STORE_EXIT=1', compat.BL_STORE_SETUP)
self.assertIn('[ $rc -eq 10 ] && BL_STORE_EXIT=1', compat.BL_STORE_SETUP)
self.assertIn('droiddeck-store-launch --exited --code "$rc" "${BL_STORE_ARGS[@]}"', compat.BL_STORE_SETUP)
self.assertIn('exec "$@"', compat.BL_STORE_SETUP)
BNET_EXE = '/root/.local/share/Steam/steamapps/compatdata/2596113170/pfx/drive_c/Program Files (x86)/Battle.net/Battle.net.exe'
class BattleNet(unittest.TestCase):
def test_a_games_shortcut_is_handed_to_droiddeck_battlenet(self):
self.assertEqual([store.BATTLENET, 'launch', 'Fen'], store.battlenet(['waitforexitandrun', BNET_EXE, '--exec=launch Fen'], env={}))
self.assertEqual([store.BATTLENET, 'launch', 'OSI'], store.battlenet(['"%s"' % BNET_EXE, '--exec="launch OSI"'], env={}))
self.assertEqual([store.BATTLENET, 'open'], store.battlenet([BNET_EXE], env={}))
def test_anything_else_and_its_own_starts_are_left_alone(self):
other = BNET_EXE.replace('2596113170', '123')
self.assertIsNone(store.battlenet([other, '--exec=launch Fen'], env={}))
self.assertIsNone(store.battlenet(['/x/Diablo IV/Diablo IV.exe'], env={}))
self.assertIsNone(store.battlenet([BNET_EXE, '--exec=launch Fen'], env={'BL_BATTLENET': '1'}))
self.assertEqual([store.BATTLENET, 'open'], store.battlenet([BNET_EXE, '--exec=launch Fen;rm'], env={}))
def test_the_launch_runs_there_and_the_wrapper_ends_with_it(self):
with patch.dict(os.environ, {}, clear=False), patch.object(store.subprocess, 'call', return_value=0) as call:
os.environ.pop('BL_BATTLENET', None)
self.assertEqual(store.RAN, store.main([BNET_EXE, '--exec=launch Pro']))
call.assert_called_once_with([store.BATTLENET, 'launch', 'Pro'])
with patch.dict(os.environ, {}, clear=False), patch.object(store.subprocess, 'call', return_value=1):
os.environ.pop('BL_BATTLENET', None)
self.assertEqual(store.RAN_FAILED, store.main([BNET_EXE, '--exec=launch Pro']))
self.assertIn('[ $rc -eq 11 ] && exit 0', compat.BL_STORE_SETUP)
self.assertIn('[ $rc -eq 12 ] && exit 1', compat.BL_STORE_SETUP)
self.assertLess(compat.BL_STORE_SETUP.index('droiddeck-store-launch "$@"'), compat.BL_STORE_SETUP.index('[ $rc -eq 11 ] && exit 0'))
class Launchers(unittest.TestCase):
def test_both_proton_launchers_ask_before_proton_starts(self):
sh = compat.LAUNCHER_SH