Compare commits

...
Author SHA1 Message Date
The412Banner 758335f4df fix(stores): leave updates to Steam, list shared depots like the client, fewer Steam sign-ins
- A game already installed at another build is not updated in place by the
  store engine; the Steam client updates it (it also removes dropped files).
- InstalledDepots and InstallScripts of the shared redistributables app are
  kept in depot-id order, as the client writes them.
- After Steam refuses a sign-in for coming too often (RateLimitExceeded or
  AccountLoginDeniedThrottle) the store waits 30 minutes before trying again.
- The store's Steam sign-in is dropped when a session starts, so it never
  overlaps the Steam client's own.
2026-11-07 07:12:45 +00:00
The412Banner 9bba2f6a3c feat(stores): Steam first in the Stores tabs 2026-11-07 06:45:46 +00:00
The412Banner 15b9700f03 feat(stores): Steam store that downloads outside the Steam client
Steam joins the Stores list. Games download with the Rust engine into the
libraries the active Steam client offers and are registered so the client
sees them installed. Downloads show in the store downloads list with cancel;
uninstall uses the usual confirmation. The Steam session cannot start while
a Steam store download runs, and installs refuse while the session runs.
With no saved Steam sign-in the store only offers to open Steam.
2026-11-07 06:11:08 +00:00
The412Banner 2b87acff4b feat(stores): Steam download engine in the Rust store crate
Adds src/steam: signs in with the Steam client's saved login, lists owned
games, picks the same depots the client would for a Proton game, downloads
them straight into the Steam library folder (no space reservation, no
staging folder, journal kept outside the game folder), installs shared
redistributables, and writes the app manifest and libraryfolders entries the
way the client does on completion. Uninstall matches the client: the game,
its manifest, depot cache and shader cache go; the Proton prefix stays;
shared depots go only when no other installed game needs them.

Derived from WinNative's wn-steam-client (GPL-3.0-or-later); see
src/steam/NOTICE.md. JNI contract in JNI.md.
2026-11-07 06:11:07 +00:00
MaxsTechReview 18c7d56409 fix: Auto components update only DroidDeck-Proton and delete old builds (#2193) 2026-11-06 20:43:44 -05:00
MaxsTechReview 0b4bc827e7 fix(battlenet): stop Battle.net's pages playing videos on the CPU (#2195) 2026-11-06 20:39:37 -05:00
KeegantheVeganat0randKurt Himebauch a552f1e293 fix(hud): isolate strip rendering in a software layer (#2194)
* fix(hud): skip relayout when size is unchanged and cap graph redraws

* fix(hud): limit the redraw and relayout changes to the strip

* fix(hud): draw the strip background from a cached bitmap like the panels

* fix(hud): drop the strip-only redraw cap and relayout skip

* fix(hud): the strip graph redraws at most 15 times a second

* fix(hud): isolate strip rendering in a software layer

---------

Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>
2026-11-06 20:23:10 -05:00
MaxsTechReview 066834d17d feat: compress idle game memory before low-RAM devices run out (#2187) 2026-11-06 19:49:06 -05:00
Kurt Himebauch f33d5b9e09 fix(components): auto updates follow DroidDeck-Proton only (#2190) 2026-11-06 18:41:37 -05:00
MaxsTechReview 250f80fbb5 fix: stop switching between display modes with the same refresh rate (S26 lag and heat since 0.6.7) (#2192)
fix: stop switching between display modes with the same refresh rate
2026-11-06 17:18:24 -05:00
MaxsTechReview 542bbf89c3 fix: launch Battle.net and store games from any game page tab (#2185)
* fix(library): Keep one Play request per game and show Starting while it prepares

* Track launch preparation per game

* Keep each game preparing until its own worker finishes

* Drop store lookups that finish after the activity ends
2026-11-06 15:31:09 -05:00
Kurt Himebauch e1987ca785 chore: pin gamescope to the DroidDeck-Components p22 release (#2183) 2026-11-06 14:35:10 -05:00
MaxsTechReview a81da1e476 feat(components): Auto updates for FEX, DXVK and VKD3D-Proton (#2156)
* feat(components): Auto updates for FEX, DXVK and VKD3D-Proton

Each component gets an Auto or Manual mode on the Default Components page.
Auto installs the newest DroidDeck-Components nightly into every Proton that
ships the component, matching each Proton's ARM64EC or x64 flavour, keeps the
current and replaced builds, and removes older builds it downloaded.

A game that ran on the previous build and exits within 30 seconds twice on the
new one rolls the line back; the failed build is skipped until a newer one is
published. Existing manual choices keep that component on Manual, and DXVK
stays on Manual while a GPU rule pins its version.

* fix(components): Auto notes per line, Original label and first-update rollback

Boot history on the Original is recorded before the first update so that
update can roll back, rollback notes stay with their own component, the
Original shows by name, and new Protons get the current build even when no
newer one is published.

* fix(components): Auto owns only its own downloads and follows in-place Proton updates

Auto deletes only builds it downloaded, re-swaps a Proton whose version
changed under an existing choice, reports a missing nightly listing as a
failed check, writes its state atomically so the page can read it without
waiting on a download, and words the rollback and download messages to
match what it does.

* fix(components): Auto keeps a rollback and reads updated Protons' own files

After a rollback only a build newer than every rejected one is taken, so an
older build still listed in the nightly cannot replace the restored one.
Flavour detection treats a choice saved for an older Proton version as not
applied, so a Proton Steam updated in place is read from its own files and
re-swapped. A failed state rename falls back to a direct write and is logged.

* fix(components): Keep the last good Auto state when a save fails

* fix(components): Serialise Auto state reads and writes

* Install the Linux runtime by itself on first launch

The runtime auto-update skipped devices with no runtime, so FEX, Proton,
DXVK and VKD3D waited for the first Steam launch to install it. Claim a
first install when the device never had a runtime, on a usable network,
outside battery saver and with a supported GPU, and check Proton as
soon as the runtime is ready. A runtime the user removed stays removed.

* fix(components): Check components as soon as Proton is installed

The Auto check stamped its hourly timer even when no Proton was
installed yet, so a fresh device waited an hour after Proton arrived.
Skip the stamp until a Proton exists and run the check right after a
Proton install finishes.

* fix(components): Apply stored builds on every check and retry unfinished rollbacks

A held or failed download no longer skips applying the stored build or
stamps the hourly timer. Stored builds are applied on every check, so a
new Proton is reconciled inside the hour, and a check requested while
one runs is queued. A rollback that could not restore or swap a Proton
is retried and reported only once it finishes. Removing the runtime
marks it as seen so it is not installed again, and the failed-save test
skips where the process can still write read-only files.

* fix(components): Keep rollback restores pending until applied and save state on failure

* fix(components): Hold newer builds until a pending rollback is applied

* fix(components): Drop pending restores for removed Protons

* fix(components): Never auto-install a non-ARM64X build over a Proton's own ARM64X DXVK or VKD3D

* fix(components): Read probe archives outside the lock and block auto updates while the original build is unknown

* fix(components): Require ARM64X when any Proton on the line needs it, and before each swap
2026-11-06 13:56:34 -05:00
MaxsTechReview 116728917f fix(input): Keep the Android pointer hidden over the game after hovering session menus (#2176)
* fix(input): Keep the Android pointer hidden over the game after hovering session menus

* fix(input): Defer the overlay pointer icon from a container, since ComposeView is final
2026-11-06 13:56:30 -05:00
MaxsTechReview 5f180d909b fix(input): Click a touch stick only on a fast double tap (#2173)
* fix(input): Click a touch stick only on a fast double tap

* fix(input): Count the release position in stick tap travel

* fix(input): Treat cancelled pointer-ups as cancelled stick touches
2026-11-06 13:56:25 -05:00
Kurt Himebauch 88acdbc3ab ci: publish gamescope builds to DroidDeck-Components and never replace a tag (#2181) 2026-11-06 13:36:56 -05:00
Kurt Himebauch 42b2810822 ci: retry PR test build cleanup and sweep leftovers every six hours (#2180) 2026-11-06 13:36:52 -05:00
Kurt Himebauch 1001bc00af fix: PiP scales the full-size output instead of shrinking it (#2174)
* fix: PiP scales the full-size output instead of shrinking it

* fix: hide the performance HUD as PiP starts so it does not flash at full size
2026-11-06 13:24:37 -05:00
MaxsTechReview 69c6c14f3f fix(wow): Clear the game field selection after reading and sending chat (#2175)
* fix(wow): Clear the game field selection after reading and sending chat

* fix(wow): Skip the field cleanup when the chat request has closed
2026-11-06 13:17:13 -05:00
MaxsTechReview 6060f2288f feat(wow): voice type and keyboard chat bar for World of Warcraft (#2171)
* Add voice and keyboard chat input for World of Warcraft

Open a chat bar with an editable text field when a WoW client focuses
a text box (reported by Proton's winex11 IME context hook through
agent/wine-ime.json). First use asks for Voice type or Android keyboard
with a remember toggle; the choice is also in the side menu's Keyboard
group while a WoW client runs. Voice type uses the device's speech
recognition service. On dual-screen devices the bar and keyboard open
on the second screen. Send types the text and presses Enter; Cancel
presses Escape.

* Cover the Arm64 WoW client in the chat match test

* Give the second-screen chat bar the session's result and back owners

* Open the WoW chat bar with the game field's current text

When the bar opens, select and copy the game's text field and fill the
bar with it through the session clipboard bridge, then put the guest
clipboard back. Send selects the field first, so the bar's text
replaces what was there instead of being appended.

* Keep WoW chat consistent across screen changes and failed field reads

Close the bar when the game field closes even after the program name
is cleared, move the bar to the top screen when the second screen drops
it, and drop any pending second-screen keyboard request when the bar
opens. A field read that gets no copy of its own leaves the game text
unselected and Send then types without replacing it. Ctrl is only
pressed and released when nothing else holds it, and a pending read
ends when the clipboard bridge stops.

* fix(session): Close WoW chat for other programs and keep the game cursor on cancelled reads
2026-11-06 12:17:37 -05:00
William Allenandmaxjivi05 a1bc8467fd feat: show Steam launch options on the Launch tab (#2163)
* Show Steam launch options on the Launch tab

* fix: Launch options is one row on the Launch tab, like the shortcut fields

* fix(launch): reread Steam's launch options when the game page resumes

* fix(launch): keep launch options disabled while they reload on resume

* fix(launch): a saved launch option is not replaced by a read that started before it

* fix(launch): an unreadable Steam config keeps the shown launch options instead of clearing them

* fix(launch): an unparsable Steam config and a pending reload keep the shown launch options

* fix(launch): the resume reload follows the game the panel shows

---------

Co-authored-by: maxjivi05 <maxjividen@gmail.com>
2026-11-06 10:43:44 -05:00
Kurt Himebauch d6566f0dbe feat: GOG achievements on by default, drop stores engine row (#2168) 2026-11-06 10:22:42 -05:00
156 changed files with 18367 additions and 401 deletions

No files matched your search

+17 -3
View File
@@ -39,11 +39,25 @@ jobs:
path: |
gamescope.tzst
gamescope.tzst.sha256
- uses: actions/create-github-app-token@v2
id: components-token
if: github.event_name == 'workflow_dispatch' && inputs.tag != ''
with:
app-id: ${{ vars.DROIDDECK_CI_APP_ID }}
private-key: ${{ secrets.DROIDDECK_CI_APP_KEY }}
owner: Droid-Deck
repositories: DroidDeck-Components
- name: Publish
if: github.event_name == 'workflow_dispatch' && inputs.tag != ''
env:
GH_TOKEN: ${{ github.token }}
GH_TOKEN: ${{ steps.components-token.outputs.token }}
GH_REPO: Droid-Deck/DroidDeck-Components
TAG: ${{ inputs.tag }}
run: |
set -euo pipefail
gh release create "${{ inputs.tag }}" --latest=false --prerelease=false --title "${{ inputs.tag }}" --notes "gamescope 3.16.29 with tools/gamescope/patches; staged by the apk over /usr/local/bin/gamescope. sha256 $(cut -d' ' -f1 gamescope.tzst.sha256)" gamescope.tzst gamescope.tzst.sha256 || gh release upload "${{ inputs.tag }}" gamescope.tzst gamescope.tzst.sha256 --clobber
gh release edit "${{ inputs.tag }}" --latest=false --prerelease=false
if gh release view "$TAG" >/dev/null 2>&1; then
echo "::error::$TAG is already published in DroidDeck-Components, and published tags are never replaced: use a new tag"
exit 1
fi
gh release create "$TAG" --latest=false --prerelease=false --title "$TAG" --notes "gamescope 3.16.29 with tools/gamescope/patches ($GITHUB_REPOSITORY $GITHUB_SHA, run $GITHUB_RUN_ID); staged by the apk over /usr/local/bin/gamescope. sha256 $(cut -d' ' -f1 gamescope.tzst.sha256)" gamescope.tzst gamescope.tzst.sha256
gh release edit "$TAG" --latest=false --prerelease=false
+10 -2
View File
@@ -47,10 +47,18 @@ jobs:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
set -euo pipefail
retry() {
for attempt in 1 2 3 4; do
"$@" && return 0
[ "$attempt" = 4 ] || sleep $((attempt * 20))
done
return 1
}
existing=$(retry gh api --paginate "repos/Droid-Deck/DroidDeck-CI/releases?per_page=100" --jq '.[].tag_name')
found=0
for tag in "pr-$PR_NUMBER" "pr-$PR_NUMBER.0"; do
if gh release view "$tag" -R Droid-Deck/DroidDeck-CI >/dev/null 2>&1; then
gh release delete "$tag" -R Droid-Deck/DroidDeck-CI --yes --cleanup-tag
if grep -qxF "$tag" <<<"$existing"; then
retry gh release delete "$tag" -R Droid-Deck/DroidDeck-CI --yes --cleanup-tag
echo "Deleted $tag"
found=1
fi
+57
View File
@@ -0,0 +1,57 @@
name: PR Release Sweep
run-name: sweep test builds of closed PRs
on:
schedule:
- cron: '17 */6 * * *'
workflow_dispatch:
permissions:
contents: read
pull-requests: read
concurrency:
group: pr-release-sweep
cancel-in-progress: false
jobs:
sweep:
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/create-github-app-token@v2
id: ci-token
with:
app-id: ${{ vars.DROIDDECK_CI_APP_ID }}
private-key: ${{ secrets.DROIDDECK_CI_APP_KEY }}
owner: Droid-Deck
repositories: DroidDeck-CI
- name: Delete test builds whose PR is no longer open
env:
CI_TOKEN: ${{ steps.ci-token.outputs.token }}
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
retry() {
for attempt in 1 2 3 4; do
"$@" && return 0
[ "$attempt" = 4 ] || sleep $((attempt * 20))
done
return 1
}
tags=$(GH_TOKEN="$CI_TOKEN" retry gh api --paginate "repos/Droid-Deck/DroidDeck-CI/releases?per_page=100" --jq '.[].tag_name' |
grep -E '^pr-[0-9]+(\.0)?$' || true)
failed=0
for tag in $tags; do
number=${tag#pr-}
number=${number%.0}
state=$(retry gh api "repos/$GITHUB_REPOSITORY/pulls/$number" --jq .state) || { failed=1; continue; }
if [ "$state" != open ]; then
if GH_TOKEN="$CI_TOKEN" retry gh release delete "$tag" -R Droid-Deck/DroidDeck-CI --yes --cleanup-tag; then
echo "Deleted $tag (PR #$number is $state)"
else
failed=1
fi
fi
done
exit "$failed"
@@ -61,6 +61,7 @@ class App : Application() {
com.droiddeck.launcher.stores.StoresState.register(com.droiddeck.launcher.stores.xbox.XboxBackend)
com.droiddeck.launcher.sync.Syncthing.init(this)
com.droiddeck.launcher.stores.StoresState.register(com.droiddeck.launcher.stores.battlenet.BattleNetBackend)
com.droiddeck.launcher.stores.StoresState.register(com.droiddeck.launcher.stores.steam.SteamBackend)
}
private fun prefetchAddonPacks() {
@@ -5,8 +5,11 @@ import android.util.Log
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import com.droiddeck.launcher.session.ComponentUpdater
import com.droiddeck.launcher.session.ComponentUpdates
import com.droiddeck.launcher.session.ComponentsManager
import com.droiddeck.launcher.session.ProtonDefault
import com.droiddeck.launcher.session.SessionPrefs
internal class ComponentsMenu(private val activity: android.app.Activity, private val ui: Handler) {
var compSnapshot by mutableStateOf<ComponentsManager.Snapshot?>(null)
@@ -20,6 +23,10 @@ internal class ComponentsMenu(private val activity: android.app.Activity, privat
get() = downloads
private set(value) { downloads = value }
val compDownloadRevision: Long get() = downloadRevision
var compModes by mutableStateOf<Map<String, String>>(emptyMap())
var compAuto by mutableStateOf<Map<String, List<ComponentUpdater.Status>>>(emptyMap())
var compAutoHeld by mutableStateOf<Set<String>>(emptySet())
var compAutoChecking by mutableStateOf(false)
private var shownDefault: String? = null
fun refreshComponents(snapshotFirst: Boolean = false) {
@@ -29,7 +36,14 @@ internal class ComponentsMenu(private val activity: android.app.Activity, privat
val snap = runCatching { ComponentsManager.snapshot(activity) }.onFailure { Log.w(TAG, "components", it) }.getOrNull()
val cat = runCatching { ComponentsManager.catalog(activity, false) }.getOrNull()
val chosen = snap?.let { s -> runCatching { ProtonDefault.selectedId(activity, s.protons.map { it.proton }) }.getOrNull() }
runCatching { ComponentUpdater.settle(activity) }
val modes = ComponentsManager.COMPONENTS.associateWith { SessionPrefs.componentMode(activity, it) }
val auto = ComponentsManager.COMPONENTS.associateWith { runCatching { ComponentUpdater.status(activity, it) }.getOrDefault(emptyList()) }
val held = if (runCatching { ComponentsManager.hardwareDxvk(activity) }.getOrDefault(false)) setOf("dxvk") else emptySet()
ui.post {
compModes = modes
compAuto = auto
compAutoHeld = held
compSnapshot = snap ?: ComponentsManager.Snapshot(emptyList(), emptyList())
if (cat != null && cat.fetchedAt > 0) { compCatalog = cat.items; compCatalogAt = cat.fetchedAt }
if (chosen != null && chosen != shownDefault) {
@@ -42,6 +56,35 @@ internal class ComponentsMenu(private val activity: android.app.Activity, privat
}, "components").start()
}
fun chooseComponentMode(comp: String, mode: String) {
SessionPrefs.setComponentMode(activity, comp, mode)
compModes = compModes + (comp to mode)
if (mode != ComponentUpdates.AUTO) return
checkComponentUpdates(force = true)
}
private var checkAgain: Boolean? = null
fun checkComponentUpdates(force: Boolean) {
if (compAutoChecking) {
checkAgain = force || checkAgain == true
return
}
compAutoChecking = true
Thread({
val notes = runCatching { ComponentUpdater.ensure(activity, force) }.onFailure { Log.w(TAG, "component updates", it) }.getOrDefault(emptyList())
ui.post {
compAutoChecking = false
checkAgain?.let { again ->
checkAgain = null
checkComponentUpdates(again)
}
if (notes.isNotEmpty()) android.widget.Toast.makeText(activity, notes.joinToString("\n"), android.widget.Toast.LENGTH_LONG).show()
refreshComponents()
}
}, "component-updates").start()
}
fun chooseProton(id: String) {
val proton = compSnapshot?.protons?.firstOrNull { it.proton.id == id }?.proton ?: return
compProton = id
@@ -40,6 +40,8 @@ import com.droiddeck.launcher.ui.PackageRow
import com.droiddeck.launcher.ui.exposeTestTags
import com.droiddeck.launcher.session.OfflineMode
import com.droiddeck.launcher.session.ProtonExtras
import com.droiddeck.launcher.session.ComponentUpdater
import com.droiddeck.launcher.session.ComponentUpdates
import com.droiddeck.launcher.session.ComponentsManager
import com.droiddeck.launcher.ui.ComponentsPage
import com.droiddeck.launcher.session.GameSaves
@@ -94,7 +96,11 @@ class FrontEndActivity : ComponentActivity() {
private val components = ComponentsMenu(this, ui)
private val decky = DeckyMenu(this, ui)
private val updates = UpdatesMenu(this, ui)
private val protons = ProtonMenu(this, ui) { !busy && flood == null && compatLaunch == null && pkgStage == null && components.compBusy == null }
private val protons = ProtonMenu(
this, ui,
idle = { !busy && flood == null && compatLaunch == null && pkgStage == null && components.compBusy == null },
onInstalled = { if (!OfflineMode.enabled(this)) components.checkComponentUpdates(force = false) },
)
private var installed by mutableStateOf<String?>(null)
private var flood by mutableStateOf<PendingFlood?>(null)
@@ -201,6 +207,7 @@ class FrontEndActivity : ComponentActivity() {
private var gameStoresSpeedTier by mutableStateOf("fast")
private var navRequest by mutableStateOf<String?>(null)
private val gameLaunchRequest = java.util.concurrent.atomic.AtomicLong()
private var preparingGames by mutableStateOf(emptySet<String>())
private var storesShowMature by mutableStateOf(false)
private var storesSort by mutableStateOf(SessionPrefs.STORES_SORTS.first())
private var storesView by mutableStateOf(SessionPrefs.DEFAULT_STORES_VIEW)
@@ -1137,6 +1144,7 @@ class FrontEndActivity : ComponentActivity() {
installed = installed, ready = ready, available = available?.version, removalPending = removalPending, runtimeActionsBlocked = runtimeChangesBlocked(),
vkBridge = vkBridge, venus = venus, venusHostVulkan = venusHostVulkan, vkBridgeSafe = vkBridgeSafe, bridgeProtonDxvk = bridgeProtonDxvk, adreno = adrenoGpu,
shortcutPicker = shortcutPicker,
preparingGames = preparingGames,
shortcutLibraryScanning = shortcutLibraryScanning,
gameSyncFolder = gameSyncFolder,
busy = busy, stage = stage, percent = percent,
@@ -1215,14 +1223,26 @@ class FrontEndActivity : ComponentActivity() {
},
onSteamGame = { g ->
if (shortcutPicker) chooseGameShortcut(g)
else {
val request = gameLaunchRequest.incrementAndGet()
com.droiddeck.launcher.frontend.AutoComponents.beforeLaunch(this, g) {
if (request != gameLaunchRequest.get() || isFinishing || isDestroyed) return@beforeLaunch
com.droiddeck.launcher.stores.StoreLaunch.prepare(this, g) {
if (request == gameLaunchRequest.get() && !isFinishing && !isDestroyed) launchGame(g)
else if (g.launchKey !in preparingGames) {
preparingGames = preparingGames + g.launchKey
prepareAndLaunch(g, g.launchKey)
}
},
onStoreGame = { store, id ->
val key = "${store.id}:$id"
if (key !in preparingGames) {
preparingGames = preparingGames + key
val app = applicationContext
Thread({
val g = runCatching { com.droiddeck.launcher.stores.StoreLaunch.installedGame(app, store, id) }.getOrNull()
runOnUiThread {
if (g != null && !isFinishing && !isDestroyed) prepareAndLaunch(g, key)
else {
preparingGames = preparingGames - key
if (g == null && !isFinishing && !isDestroyed) android.widget.Toast.makeText(this, R.string.stores_launch_not_registered, android.widget.Toast.LENGTH_LONG).show()
}
}
}
}, "store-play").start()
}
},
onEpicLauncher = { openEpicLauncher() },
@@ -1880,6 +1900,13 @@ class FrontEndActivity : ComponentActivity() {
if (applied.isNotEmpty()) ui.post {
android.widget.Toast.makeText(this, getString(R.string.main_applied, applied.joinToString(", ")), android.widget.Toast.LENGTH_LONG).show()
}
if (!OfflineMode.enabled(this)) {
val updated = runCatching { ComponentUpdater.ensure(this, force = false) }
.onFailure { android.util.Log.w("ComponentUpdater", "automatic component updates", it) }.getOrDefault(emptyList())
if (updated.isNotEmpty()) ui.post {
android.widget.Toast.makeText(this, updated.joinToString("\n"), android.widget.Toast.LENGTH_LONG).show()
}
}
ui.post {
componentsQueueBusy = false
if (showComponents) components.refreshComponents()
@@ -1942,6 +1969,18 @@ class FrontEndActivity : ComponentActivity() {
if (Build.VERSION.SDK_INT >= 33) state.getParcelable(key, Intent::class.java)
else @Suppress("DEPRECATION") state.getParcelable(key)
private fun prepareAndLaunch(g: Library.SteamGame, key: String) {
val request = gameLaunchRequest.incrementAndGet()
val done = { preparingGames = preparingGames - key }
com.droiddeck.launcher.frontend.AutoComponents.beforeLaunch(this, g, onBlocked = done) {
if (request != gameLaunchRequest.get() || isFinishing || isDestroyed) { done(); return@beforeLaunch }
com.droiddeck.launcher.stores.StoreLaunch.prepare(this, g) {
done()
if (request == gameLaunchRequest.get() && !isFinishing && !isDestroyed) launchGame(g)
}
}
}
override fun onDestroy() {
gameLaunchRequest.incrementAndGet()
cancelCompatLaunch()
@@ -2127,9 +2166,11 @@ class FrontEndActivity : ComponentActivity() {
private fun importComponent(uri: Uri) {
val name = displayNameOf(uri) ?: "imported.wcp"
components.componentAction(getString(R.string.comp_busy_importing)) {
val tmp = File(cacheDir, "component-import.wcp")
contentResolver.openInputStream(uri)?.use { input -> tmp.outputStream().use { input.copyTo(it) } } ?: error(getString(R.string.comp_cannot_read))
try { getString(R.string.comp_imported, ComponentsManager.importPackage(this, tmp, name).version) } finally { tmp.delete() }
val tmp = File.createTempFile("component-import", ".wcp", cacheDir)
try {
contentResolver.openInputStream(uri)?.use { input -> tmp.outputStream().use { input.copyTo(it) } } ?: error(getString(R.string.comp_cannot_read))
getString(R.string.comp_imported, ComponentUpdater.importPackage(this, tmp, name).version)
} finally { tmp.delete() }
}
}
@@ -2153,7 +2194,15 @@ class FrontEndActivity : ComponentActivity() {
onDeletePackage = { file -> components.componentAction(getString(R.string.comp_busy_deleting)) { ComponentsManager.deletePackage(this, file) } },
onDeleteOriginal = { version -> components.compProton?.let { pid -> components.componentAction(getString(R.string.comp_busy_deleting)) { ComponentsManager.deleteOriginal(this, pid, components.compComp, version) } } },
onDownload = { components.downloadComponent(it) },
onRefresh = { components.refreshComponentCatalog() },
onRefresh = {
components.refreshComponentCatalog()
if (components.compModes.values.any { it == ComponentUpdates.AUTO }) components.checkComponentUpdates(force = true)
},
compModes = components.compModes,
compAuto = components.compAuto,
compAutoHeld = components.compAutoHeld,
compAutoChecking = components.compAutoChecking,
onCompMode = { comp, mode -> components.chooseComponentMode(comp, mode) },
onImport = { pickComponent.launch(InAppFilePicker.buildIntent(this, WCP_EXT, getString(R.string.comp_pick_wcp))) },
onBack = { if (!com.droiddeck.launcher.ui.Hops.back { showComponents = false }) showComponents = false },
games = steamGames,
@@ -2907,6 +2956,10 @@ class FrontEndActivity : ComponentActivity() {
android.widget.Toast.makeText(this, R.string.storage_cleanup_busy, android.widget.Toast.LENGTH_SHORT).show()
return false
}
if (!SessionState.running && com.droiddeck.launcher.stores.steam.SteamStore.blocksSession(intent)) {
android.widget.Toast.makeText(this, R.string.steam_store_session_wait, android.widget.Toast.LENGTH_SHORT).show()
return false
}
refreshPhantomStatus()
if (steamSession && PhantomProcessLimit.blocksSteam(phantomProcessStatus)) {
showPhantomGate = true
@@ -2982,6 +3035,7 @@ class FrontEndActivity : ComponentActivity() {
private fun removeRuntime() {
if (runtimeChangesBlocked()) return
val removal = LinuxRuntimeInstaller.beginUninstall(this) ?: return
com.droiddeck.launcher.runtime.RuntimeAutoUpdate.seed(this)
ready = false
com.droiddeck.launcher.runtime.RuntimeInstallService.keepRemovalAlive(this)
followRuntimeOperation { removal.run(it) }
@@ -3008,6 +3062,7 @@ class FrontEndActivity : ComponentActivity() {
android.widget.Toast.makeText(this, it, android.widget.Toast.LENGTH_LONG).show()
}
refresh()
if (ok == true && LinuxRuntime.isInstalled(this)) protons.checkUpdates()
}
}, "runtime-operation").start()
}
@@ -3015,9 +3070,12 @@ class FrontEndActivity : ComponentActivity() {
private fun autoUpdateRuntime() {
val release = available?.takeIf { catalogFresh } ?: return
if (!lifecycle.currentState.isAtLeast(androidx.lifecycle.Lifecycle.State.RESUMED) || runtimeChangesBlocked() || removalPending) return
if (release.version == installed || installed == null) return
if (installed != null) com.droiddeck.launcher.runtime.RuntimeAutoUpdate.seed(this)
if (release.version == installed) return
if (installed == null && (OfflineMode.enabled(this) || !com.droiddeck.launcher.core.DeviceSupport.canDraw(this) ||
!com.droiddeck.launcher.frontend.AutoComponents.online(this) || com.droiddeck.launcher.frontend.AutoComponents.unfavourable(this))) return
if (com.droiddeck.launcher.runtime.RuntimeAutoUpdate.claim(this, installed, release.version)) {
Log.i(TAG, "runtime: updating $installed to ${release.version} by itself")
Log.i(TAG, "runtime: installing ${release.version} over ${installed ?: "nothing"} by itself")
install(release)
}
}
@@ -18,6 +18,7 @@ import com.droiddeck.launcher.runtime.LinuxRuntimeInstaller
internal class ProtonMenu(
private val activity: android.app.Activity,
private val ui: Handler,
private val onInstalled: () -> Unit = {},
private val idle: () -> Boolean = { true },
) {
private object Operation {
@@ -61,6 +62,7 @@ internal class ProtonMenu(
if (automatic) Log.w("ProtonMenu", "auto-update ${tool.id}: $problem")
else android.widget.Toast.makeText(activity, problem, android.widget.Toast.LENGTH_LONG).show()
}
if (problem == null) onInstalled()
if (automatic) ensureAutoUpdates()
}
}, "install-proton-$id").start()
@@ -4,6 +4,7 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.imePadding
import android.hardware.input.InputManager
import android.hardware.display.DisplayManager
import android.content.Intent
@@ -233,6 +234,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
private var screenKeyBind: List<Int>? = null
private var screenKeyDir: Int? = null
private var screenKeyTextFocus = false
private val appTextFocus get() = screenKeyTextFocus || wowChat.request != null
private val wowChat by lazy { com.droiddeck.launcher.ui.WowChat(this, ::sendWowChat, ::cancelWowChat, ::readGameField) }
private var wowChatBottom: SecondScreenPresentation? = null
private var wowChatOnTop by mutableStateOf(false)
private var screenKeyEdit by mutableStateOf<com.droiddeck.launcher.input.ScreenKey?>(null)
private var screenLayoutsOpen by mutableStateOf(false)
private var screenKeysShown by mutableStateOf(true)
@@ -624,6 +629,16 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
finish()
return
}
if (savedInstanceState == null && !SessionState.running && com.droiddeck.launcher.stores.steam.SteamStore.blocksSession(intent)) {
runtimeRemovalBlocked = true
android.widget.Toast.makeText(this, R.string.steam_store_session_wait, android.widget.Toast.LENGTH_SHORT).show()
finish()
return
}
if (savedInstanceState == null && !SessionState.running) {
// The Steam client signs in itself; the store's own sign-in must not overlap it.
Thread({ com.droiddeck.launcher.stores.steam.SteamEngine.forget() }, "steam-store-signout").start()
}
if (!SessionState.running && SessionState.phase in setOf(SessionPhase.IDLE, SessionPhase.FAILED)) {
val mode = intent.getStringExtra(SessionService.EXTRA_MODE) ?: SessionService.MODE_STEAM
SessionState.programArgs = intent.getStringArrayExtra(SessionService.EXTRA_PROGRAM_ARGS)?.toList().orEmpty()
@@ -826,7 +841,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
window.setBackgroundDrawable(android.graphics.drawable.ColorDrawable(it))
}
sessionOverlay = createSessionOverlay()
root.addView(sessionOverlay)
root.addView(object : FrameLayout(this) {
override fun onResolvePointerIcon(event: MotionEvent, pointerIndex: Int): android.view.PointerIcon? =
if (platformPointerShown == true) super.onResolvePointerIcon(event, pointerIndex) else null
}.apply { addView(sessionOverlay) })
setContentView(root)
glassesScope.launch { Glasses.state.collect {
glasses = it
@@ -910,6 +928,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
}
androidx.compose.runtime.LaunchedEffect(AgentGuest.steamKeyboard) { updateOnScreenControls() }
androidx.compose.runtime.LaunchedEffect(AgentGuest.desktopTextField) { onDesktopTextField(AgentGuest.desktopTextField) }
androidx.compose.runtime.LaunchedEffect(AgentGuest.gameTextField, AgentGuest.gameProgram) { onGameTextField(AgentGuest.gameTextField) }
androidx.compose.runtime.LaunchedEffect(wowChat.request) { placeWowChat() }
androidx.compose.runtime.LaunchedEffect(pipUi, pcKeyboardOpen) { updateDesktopKeyboardButton() }
val keyboardRequestsSeen = androidx.compose.runtime.remember { intArrayOf(AgentGuest.keyboardRequests) }
androidx.compose.runtime.LaunchedEffect(AgentGuest.keyboardRequests) {
@@ -1033,6 +1053,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
}
}
}
if (wowChat.asking) com.droiddeck.launcher.ui.WowChatChoiceDialog(wowChat)
if (wowChatOnTop && wowChat.request != null) androidx.compose.foundation.layout.Box(
Modifier.fillMaxSize().imePadding(), contentAlignment = androidx.compose.ui.Alignment.BottomCenter,
) { com.droiddeck.launcher.ui.WowChatPanel(wowChat) }
if (gestureSettingsOpen) com.droiddeck.launcher.ui.TouchGestureDialog(
game = gestureGame,
onDismiss = { gestureSettingsOpen = false },
@@ -1310,6 +1334,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
},
onKeyboard = { drawerOpen = false; pcKeyboardOpen = false; keyboard?.toggle() },
onHardwareKeyboard = ::togglePcKeyboard,
wowChatShown = com.droiddeck.launcher.ui.WowChat.isWow(AgentGuest.gameProgram),
wowChat = wowChat.remembered,
onWowChat = wowChat::choose,
controller = controllerSettings,
onRumble = { on -> updateControllerPrefs { ControllerPrefs.setRumble(this@SessionActivity, on) } },
onSteamButton = { on -> updateControllerPrefs { ControllerPrefs.setSteamButton(this@SessionActivity, on) } },
@@ -2270,9 +2297,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
}
private fun windowOutputSize(width: Int, height: Int): Pair<Int, Int>? {
if (width <= 0 || height <= 0) return null
if (isInPictureInPictureMode) return com.droiddeck.launcher.session.PipPolicy.outputSize(
width, height, SessionState.outputSize.first, SessionState.outputSize.second)
if (width <= 0 || height <= 0 || isInPictureInPictureMode) return null
if (bottomGame != null) return when {
SessionState.followScreen ->
com.droiddeck.launcher.session.SessionDisplay.followSize(width, height, false, SessionState.followScale)
@@ -2642,7 +2667,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
SessionState.mode == SessionService.MODE_STEAM && SessionState.running &&
SessionState.firstFrameSeen && !SessionState.suspended && !ended &&
!pipUi && !drawerOpen && !pcKeyboardOpen && !achievementsOpen &&
!gestureSettingsOpen && !screenKeyTextFocus && window.decorView.hasWindowFocus()
!gestureSettingsOpen && !appTextFocus && window.decorView.hasWindowFocus()
if (steamVolume) {
val audio = getSystemService(android.media.AudioManager::class.java)
if (com.droiddeck.launcher.input.SteamVolumeKeys.dispatch(event, !audio.isVolumeFixed) { direction ->
@@ -2656,10 +2681,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
Log.i(TAG, String.format(java.util.Locale.ROOT, "back key device=%d (%s) source=0x%x flags=0x%x",
event.deviceId, event.device?.name, event.source, event.flags))
}
val mouseToGuest = !pipUi && !screenKeyTextFocus && !drawerOpen && !pcKeyboardOpen && !achievementsOpen && !gestureSettingsOpen &&
val mouseToGuest = !pipUi && !appTextFocus && !drawerOpen && !pcKeyboardOpen && !achievementsOpen && !gestureSettingsOpen &&
!SessionState.suspended && !(::loading.isInitialized && (loading.visible || loading.ended))
if (mouseBackInput.onKeyEvent(event, mouseToGuest)) return true
val backToQam = !pipUi && !screenKeyTextFocus && !drawerOpen && !pcKeyboardOpen && !achievementsOpen &&
val backToQam = !pipUi && !appTextFocus && !drawerOpen && !pcKeyboardOpen && !achievementsOpen &&
SessionState.mode == SessionService.MODE_STEAM && SessionState.running && SessionState.firstFrameSeen &&
!SessionState.suspended && padBridge?.canHoldQam() == true
if (backQamInput.onKeyEvent(event, backToQam)) {
@@ -2668,7 +2693,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
return true
}
if (pipUi) return true
if (screenKeyTextFocus) return super.dispatchKeyEvent(event)
if (appTextFocus) return super.dispatchKeyEvent(event)
if (physicalShortcuts.onKey(
event,
enabled = SessionState.running && !SessionState.suspended &&
@@ -3552,20 +3577,105 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
showCursor(px, py)
}
private fun openBottomKeyboard() {
if (!started) return
private fun bottomKeyboardPresentation(): SecondScreenPresentation? {
if (!started) return null
if (secondScreenPresentation?.showsKeyboard != true && dockDrawer()) {
val target = com.droiddeck.launcher.input.DualScreen.sessionDisplay(this, displayManager, shownOnDisplayId) ?: return
val target = com.droiddeck.launcher.input.DualScreen.sessionDisplay(this, displayManager, shownOnDisplayId) ?: return null
if (drawerOpen || drawerPinned) drawerOpen = false
typingReturnMode = secondScreenMode
selectedSecondScreenDisplay = target.displayId
selectSecondScreenMode(SecondScreenMode.KEYBOARD_TRACKPAD)
}
val presentation = secondScreenPresentation ?: return
if (!presentation.showsKeyboard) return
val display = presentation.display?.displayId ?: return
return secondScreenPresentation?.takeIf { it.showsKeyboard && it.display != null }
}
private fun openBottomKeyboard() {
val presentation = bottomKeyboardPresentation() ?: return
presentation.requestKeyboard(forField = true)
com.droiddeck.launcher.ui.SessionTyping.focusDisplay(this, display)
com.droiddeck.launcher.ui.SessionTyping.focusDisplay(this, presentation.display.displayId)
}
private fun onGameTextField(focused: Boolean) {
if (!focused || !com.droiddeck.launcher.ui.WowChat.isWow(AgentGuest.gameProgram)) wowChat.chatClosed()
else if (resumed && !pipUi && !pcKeyboardOpen &&
resources.configuration.hardKeyboardHidden != android.content.res.Configuration.HARDKEYBOARDHIDDEN_NO) {
keyboard?.takeIf { it.shown }?.hide()
wowChat.chatOpened()
}
}
private fun placeWowChat() {
val open = wowChat.request != null
val shown = wowChatBottom
wowChatOnTop = false
if (open && shown == null) {
val presentation = bottomKeyboardPresentation()
if (presentation == null) {
wowChatOnTop = true
return
}
wowChatBottom = presentation
presentation.showChat(onLost = {
if (wowChatBottom === presentation) {
wowChatBottom = null
wowChatOnTop = wowChat.request != null
}
}) {
androidx.compose.runtime.CompositionLocalProvider(
androidx.activity.compose.LocalActivityResultRegistryOwner provides this,
androidx.activity.compose.LocalOnBackPressedDispatcherOwner provides this,
) { DroidDeckTheme { com.droiddeck.launcher.ui.WowChatPanel(wowChat) } }
}
com.droiddeck.launcher.ui.SessionTyping.focusDisplay(this, presentation.display.displayId)
} else if (!open && shown != null) {
wowChatBottom = null
shown.hideChat()
if (secondScreenPresentation === shown) bottomKeyboardClosed()
}
}
private fun sendWowChat(text: String, replace: Boolean) {
val host = keyboard ?: return
if (replace) {
selectGameField()
if (text.isEmpty()) host.tap(KeyEvent.KEYCODE_DEL)
} else {
endGameField()
}
host.type(text)
host.tap(KeyEvent.KEYCODE_ENTER)
uiHandler.postDelayed({
if (AgentGuest.gameTextField && com.droiddeck.launcher.ui.WowChat.isWow(AgentGuest.gameProgram)) endGameField()
}, FIELD_SETTLE_MS)
}
private fun endGameField() {
WaylandCompositor.nativeSendKey(KEY_END, 1)
WaylandCompositor.nativeSendKey(KEY_END, 0)
}
private fun selectGameField(vararg then: Int) {
val held = KEY_LEFTCTRL in guestKeysDown || KEY_LEFTCTRL in gestureKeysDown
if (!held) WaylandCompositor.nativeSendKey(KEY_LEFTCTRL, 1)
for (key in intArrayOf(KEY_A) + then) {
WaylandCompositor.nativeSendKey(key, 1)
WaylandCompositor.nativeSendKey(key, 0)
}
if (!held) WaylandCompositor.nativeSendKey(KEY_LEFTCTRL, 0)
}
private fun readGameField(done: (String?) -> Unit) {
val opened = wowChat.request
val stillOpen = { wowChat.request === opened && AgentGuest.gameTextField }
sessionClipboard.captureGuest(FIELD_READ_MS, onTimeout = { if (stillOpen()) endGameField() }) { text ->
if (text != null && stillOpen()) endGameField()
done(text)
}
selectGameField(KEY_C)
}
private fun cancelWowChat() {
keyboard?.tap(KeyEvent.KEYCODE_ESCAPE)
}
private fun bottomKeyboardClosed() {
@@ -3990,7 +4100,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
}
private fun appUiOwnsPointer(): Boolean =
drawerOpen || pcKeyboardOpen || achievementsOpen || pipUi || glassesOutputActive || bottomOutputActive || touchEditorOpen
drawerOpen || pcKeyboardOpen || achievementsOpen || pipUi || glassesOutputActive || bottomOutputActive || touchEditorOpen || wowChatOnTop
private fun applyPlatformPointer(shown: Boolean) {
if (!::sessionRoot.isInitialized || !::surfaceView.isInitialized) return
@@ -4285,6 +4395,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
private fun showPipUi(show: Boolean) {
pipUi = show
if (show) {
if (::hud.isInitialized) hud.setHidden(true)
drawerOpen = false
pcKeyboardOpen = false
achievementsOpen = false
@@ -5199,6 +5310,11 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
private const val AXIS_UNITS_PER_PIXEL = 3f
private const val KEY_LEFTCTRL = 29
private const val KEY_RIGHTCTRL = 97
private const val KEY_A = 30
private const val KEY_C = 46
private const val KEY_END = 107
private const val FIELD_READ_MS = 600L
private const val FIELD_SETTLE_MS = 200L
private const val BTN_SIDE = 0x113
private const val BTN_EXTRA = 0x114
private const val DESKTOP_GRAB_TAP_MS = 500L
@@ -26,6 +26,10 @@ object AgentGuest {
private set
var keyboardRequests by mutableIntStateOf(0)
private set
var gameTextField by mutableStateOf(false)
private set
var gameProgram by mutableStateOf<String?>(null)
private set
var keyboardDismissals by mutableIntStateOf(0)
private set
@Volatile private var keyboardRoute = false
@@ -43,7 +47,7 @@ object AgentGuest {
observer?.stopWatching()
observer = null
lastFocusKey = null
main.post { steamKeyboard = false; desktopTextField = false }
main.post { steamKeyboard = false; desktopTextField = false; gameTextField = false; gameProgram = null }
val dir = dir(context)
dir.deleteRecursively()
dir.mkdirs()
@@ -59,6 +63,7 @@ object AgentGuest {
"focus.json" -> readJson(File(dir, path))?.let(::recordFocus)
"keyboard.json" -> readJson(File(dir, path))?.let { recordKeyboard(this, it) }
"ime.json" -> readJson(File(dir, path))?.let { recordTextField(this, it) }
"wine-ime.json" -> readJson(File(dir, path))?.let { recordGameTextField(this, it) }
"keyboard-request.json" -> readJson(File(dir, path))?.let { recordKeyboardRequest(this) }
"keyboard-dismiss.json" -> readJson(File(dir, path))?.let { recordKeyboardDismiss(this) }
}
@@ -71,7 +76,7 @@ object AgentGuest {
synchronized(lock) {
observer?.stopWatching()
observer = null
main.post { steamKeyboard = false; desktopTextField = false }
main.post { steamKeyboard = false; desktopTextField = false; gameTextField = false; gameProgram = null }
}
}
@@ -129,6 +134,16 @@ object AgentGuest {
SessionEvents.record("ime.changed", mapOf("textField" to focused, "seq" to snapshot.optInt("seq")))
}
private fun recordGameTextField(source: FileObserver, snapshot: JSONObject) {
val focused = snapshot.optBoolean("textField")
val program = snapshot.optString("program").takeIf { it.isNotEmpty() }
synchronized(lock) {
if (source !== observer) return
main.post { gameProgram = program; gameTextField = focused }
}
SessionEvents.record("game.ime.changed", mapOf("textField" to focused, "program" to program, "seq" to snapshot.optInt("seq")))
}
private fun recordFocus(snapshot: JSONObject) {
val fields = linkedMapOf<String, Any?>(
"focusedApp" to snapshot.opt("focusedApp"),
@@ -475,15 +475,15 @@ object AutoComponents {
return true
}
fun beforeLaunch(context: Context, game: Library.SteamGame, onReady: () -> Unit) {
fun beforeLaunch(context: Context, game: Library.SteamGame, onBlocked: () -> Unit = {}, onReady: () -> Unit) {
val app = context.applicationContext
Thread({
val ready = runCatching { prepareLaunch(app, game) }.getOrElse {
Log.w(TAG, "${game.name}: launch repair discovery failed: ${it.javaClass.simpleName}: ${it.message}")
false
}
Handler(Looper.getMainLooper()).post(if (ready) onReady else onBlocked)
queueGame(app, game, asked = false)
if (ready) Handler(Looper.getMainLooper()).post(onReady)
}, "auto-components-launch").apply { isDaemon = true; start() }
}
@@ -23,6 +23,7 @@ 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 launchKey: String get() = if (storeId != null) "$source:$storeId" else gameIdString
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)
@@ -14,8 +14,8 @@ object SteamLaunchOptions {
private const val TAG = "SteamLaunchOptions"
private val STEAM = listOf("UserLocalConfigStore", "Software", "Valve", "Steam")
fun current(context: Context, appId: Int): String =
SteamLiveShortcuts.launchOptions(context, appId.toLong()) ?: steam(SessionPrefs.activeSteamRoot(context), appId).orEmpty()
fun current(context: Context, appId: Int): String? =
SteamLiveShortcuts.launchOptions(context, appId.toLong()) ?: steam(SessionPrefs.activeSteamRoot(context), appId)
enum class Saved { YES, NO, DESKTOP }
@@ -35,7 +35,8 @@ object SteamLaunchOptions {
internal fun steam(steamHome: File, appId: Int): String? {
val config = AddedGames.accountConfig(steamHome) ?: return null
val text = runCatching { File(config, "localconfig.vdf").readText() }.getOrNull() ?: return null
return launchOptions(text, appId)
if (section(text, STEAM) == null) return null
return launchOptions(text, appId).orEmpty()
}
internal fun write(steamHome: File, appId: Int, options: String): Boolean {
@@ -141,6 +141,8 @@ class DroidDeckHudView(context: Context) : View(context) {
private var dDividerTop = -1f
private var dFrame: Bitmap? = null
private var dFrameKey = ""
private var sFrame: Bitmap? = null
private var sFrameKey = ""
private val glowPaint = Paint(Paint.ANTI_ALIAS_FLAG)
private val colGpu = 0xFF5EE08A.toInt()
@@ -274,9 +276,17 @@ class DroidDeckHudView(context: Context) : View(context) {
seenFpsUpdates = updates
periodDone.trySend(Unit)
}
if (graphRect != null) invalidate()
if (graphRect == null) return
if (stripRect != null) {
val now = SystemClock.uptimeMillis()
if (now - lastGraphDrawMs < STRIP_GRAPH_REDRAW_MS) return
lastGraphDrawMs = now
}
invalidate()
}
private var lastGraphDrawMs = 0L
private fun cycleSize() {
size = size.next()
onSizeCycledListener?.accept(size.token)
@@ -524,6 +534,9 @@ class DroidDeckHudView(context: Context) : View(context) {
private val inkRect = android.graphics.Rect()
private fun rebuild() {
val renderingLayer = if (size == DroidDeckHudSize.STRIP && dock == DroidDeckHudDock.NONE)
LAYER_TYPE_SOFTWARE else LAYER_TYPE_NONE
if (layerType != renderingLayer) setLayerType(renderingLayer, null)
glyphs.clear(); tileRects.clear(); graphRect = null
headerMark = null; headerWordmark = null; chipRect = null; dPanel = null; dDividerTop = -1f; tabRect = null; stripRect = null
val s = snap
@@ -1369,17 +1382,30 @@ class DroidDeckHudView(context: Context) : View(context) {
}
private fun drawStrip(canvas: Canvas, rect: RectF) {
headerPaint.shader = null
headerPaint.color = panelColor()
canvas.drawRect(rect, headerPaint)
val stroke = outlineWidth()
if (stroke <= 0f) return
val line = max(stroke / 2f, density)
val p = parent as? View
val atBottom = p != null && p.height > 0 && y + height / 2f > p.height / 2f
headerPaint.color = withAlpha(outlineColor(), (110 + 145 * outlineIntensity).roundToInt().coerceAtMost(255))
if (atBottom) canvas.drawRect(rect.left, rect.top, rect.right, rect.top + line, headerPaint)
else canvas.drawRect(rect.left, rect.bottom - line, rect.right, rect.bottom, headerPaint)
stripFrame(rect, atBottom)?.let { canvas.drawBitmap(it, 0f, 0f, null) }
}
private fun stripFrame(rect: RectF, atBottom: Boolean): Bitmap? {
val w = rect.width().roundToInt(); val h = rect.height().roundToInt()
if (w <= 0 || h <= 0) return null
val stroke = outlineWidth()
val key = "$w,$h,$stroke,$atBottom,$surfaceRgb,$bgOpacity,$outlineIntensity,${outlineColor()}"
if (key == sFrameKey) sFrame?.let { return it }
val bmp = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888)
val c = Canvas(bmp)
headerPaint.shader = null
headerPaint.color = panelColor()
c.drawRect(rect, headerPaint)
if (stroke > 0f) {
val line = max(stroke / 2f, density)
headerPaint.color = withAlpha(outlineColor(), (110 + 145 * outlineIntensity).roundToInt().coerceAtMost(255))
if (atBottom) c.drawRect(rect.left, rect.top, rect.right, rect.top + line, headerPaint)
else c.drawRect(rect.left, rect.bottom - line, rect.right, rect.bottom, headerPaint)
}
sFrame = bmp; sFrameKey = key
return bmp
}
private fun outlineWidth(): Float = if (outlineIntensity > 0f) outlineIntensity * sp(3.5f) else 0f
@@ -1499,6 +1525,7 @@ class DroidDeckHudView(context: Context) : View(context) {
const val TAB_PAD_X_SP = 7f
const val TAB_PAD_Y_SP = 5.5f
const val REFRESH_MS = 500L
const val STRIP_GRAPH_REDRAW_MS = 66L
private const val HUE_IDLE_MS = 500L
const val MIN_SCALE = 0.5f
const val MAX_SCALE = 2f
@@ -89,21 +89,31 @@ class KeyboardHost(
clearFocus()
}
fun type(text: CharSequence?) {
if (text.isNullOrEmpty()) return
val events = map.getEvents(text.toString().toCharArray())
if (events != null) {
for (event in events) sendKeyEvent(event)
} else {
for (ch in text) {
val t = System.currentTimeMillis()
val down = KeyEvent(t, t, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_UNKNOWN, 0, 0,
KeyCharacterMap.VIRTUAL_KEYBOARD, 0, 0, 0)
sendKeyEvent(CharKeyEvent(down, ch))
sendKeyEvent(CharKeyEvent(KeyEvent.changeAction(down, KeyEvent.ACTION_UP), ch))
}
}
}
fun tap(keyCode: Int) {
val t = System.currentTimeMillis()
sendKeyEvent(KeyEvent(t, t, KeyEvent.ACTION_DOWN, keyCode, 0))
sendKeyEvent(KeyEvent(t, t, KeyEvent.ACTION_UP, keyCode, 0))
}
private inner class KeyConnection : BaseInputConnection(this, false) {
override fun commitText(text: CharSequence?, newCursorPosition: Int): Boolean {
if (text.isNullOrEmpty()) return true
val events = map.getEvents(text.toString().toCharArray())
if (events != null) {
for (event in events) sendKeyEvent(event)
} else {
for (ch in text) {
val t = System.currentTimeMillis()
val down = KeyEvent(t, t, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_UNKNOWN, 0, 0,
KeyCharacterMap.VIRTUAL_KEYBOARD, 0, 0, 0)
sendKeyEvent(CharKeyEvent(down, ch))
sendKeyEvent(CharKeyEvent(KeyEvent.changeAction(down, KeyEvent.ACTION_UP), ch))
}
}
type(text)
return true
}
@@ -123,12 +133,6 @@ class KeyboardHost(
return true
}
private fun tap(keyCode: Int) {
val t = System.currentTimeMillis()
sendKeyEvent(KeyEvent(t, t, KeyEvent.ACTION_DOWN, keyCode, 0))
sendKeyEvent(KeyEvent(t, t, KeyEvent.ACTION_UP, keyCode, 0))
}
override fun getTextBeforeCursor(n: Int, flags: Int): CharSequence = ""
override fun getTextAfterCursor(n: Int, flags: Int): CharSequence = ""
override fun getSelectedText(flags: Int): CharSequence? = null
@@ -15,6 +15,7 @@ import android.view.View
import android.view.WindowInsets
import com.droiddeck.launcher.session.SessionPrefs
import kotlin.math.abs
import kotlin.math.hypot
import kotlin.math.max
import kotlin.math.min
import kotlin.math.sin
@@ -48,6 +49,10 @@ class OnScreenControls(
var dirty = false
var clicked = false
var lastUp = 0L
var downAt = 0L
var downX = 0f
var downY = 0f
var travel = 0f
val wide = id in shoulderIds
val halfW get() = if (wide) radius * SHOULDER_WIDTH else radius
val halfH get() = if (wide) radius * SHOULDER_HEIGHT else radius
@@ -61,6 +66,7 @@ class OnScreenControls(
}
fun drag(x: Float, y: Float): Boolean {
travel = max(travel, hypot(x - downX, y - downY))
var dx = x - ax
var dy = y - ay
val d = sqrt(dx * dx + dy * dy)
@@ -73,6 +79,14 @@ class OnScreenControls(
}
private val stickRedraw = ThrottledRedraw(this, STICK_REDRAW_MS)
private val tapSlop = android.view.ViewConfiguration.get(context).scaledTouchSlop.toFloat()
private fun stickTap(control: Control, event: MotionEvent): Boolean {
val i = event.actionIndex
val travel = max(control.travel, hypot(event.getX(i) - control.downX, event.getY(i) - control.downY))
return stickTap(control.downAt, event.eventTime, travel, tapSlop, control.clicked,
event.actionMasked == MotionEvent.ACTION_CANCEL || (event.flags and MotionEvent.FLAG_CANCELED) != 0)
}
private val controls = listOf(
Control("up", "dpad", -1, 26f, 0f, -52f),
@@ -545,6 +559,10 @@ class OnScreenControls(
control.pressedBy = event.getPointerId(index)
if (control.stick >= 0) {
control.clicked = settings.stickClick && control.lastUp > 0L && event.eventTime - control.lastUp < DOUBLE_TAP_MS
control.downAt = event.eventTime
control.downX = event.getX(index)
control.downY = event.getY(index)
control.travel = 0f
val adaptive = settings.adaptiveSticks
control.ax = if (adaptive) event.getX(index) else control.cx
control.ay = if (adaptive) event.getY(index) else control.cy
@@ -613,7 +631,7 @@ class OnScreenControls(
for (control in controls) {
if (control.pressedBy == pointer || event.actionMasked == MotionEvent.ACTION_CANCEL) {
if (control.pressedBy != -1) changed = true
if (control.stick >= 0 && control.pressedBy != -1) control.lastUp = if (control.clicked || event.actionMasked == MotionEvent.ACTION_CANCEL) 0L else event.eventTime
if (control.stick >= 0 && control.pressedBy != -1) control.lastUp = if (stickTap(control, event)) event.eventTime else 0L
control.pressedBy = -1
control.clicked = false
if (control.stick >= 0 && (control.kx != 0f || control.ky != 0f)) control.dirty = true
@@ -794,6 +812,10 @@ class OnScreenControls(
private companion object {
const val DOUBLE_TAP_MS = 300L
const val STICK_TAP_MS = 200L
internal fun stickTap(downAt: Long, upAt: Long, travel: Float, slop: Float, clicked: Boolean, cancelled: Boolean): Boolean =
!clicked && !cancelled && upAt - downAt <= STICK_TAP_MS && travel <= slop
const val STICK_REDRAW_MS = 33L
const val MIN_STICK_MOVE_PX = 1f
const val MIN_FACE_MM = 9.5f
@@ -19,11 +19,20 @@ class SessionClipboard(context: Context, private val hasFocus: () -> Boolean) {
private var published = false
private var shared: String? = null
private var echo: String? = null
private var capture: ((String?) -> Unit)? = null
private var captureBefore: String? = null
private var captureLate: (() -> Unit)? = null
private val androidListener = ClipboardManager.OnPrimaryClipChangedListener { refresh(changed = true) }
private val guestListener = object : WaylandCompositor.ClipboardListener {
override fun onGuestClipboardText(text: String) {
handler.post {
if (active && hasFocus() && WaylandCompositor.isClipboardListener(this)) {
val taken = capture?.takeIf { text != captureBefore }
if (taken != null && WaylandCompositor.isClipboardListener(this)) {
capture = null
handler.removeCallbacks(captureTimeout)
WaylandCompositor.setClipboardText(shared)
taken(text)
} else if (active && hasFocus() && WaylandCompositor.isClipboardListener(this)) {
val current = clipboard.primaryClip?.takeIf { it.itemCount > 0 }?.getItemAt(0)?.text
shared = text
published = true
@@ -36,6 +45,21 @@ class SessionClipboard(context: Context, private val hasFocus: () -> Boolean) {
}
}
private val captureTimeout = Runnable {
val taken = capture ?: return@Runnable
capture = null
captureLate?.invoke()
taken(null)
}
fun captureGuest(timeoutMs: Long, onTimeout: () -> Unit = {}, onText: (String?) -> Unit) {
capture?.let { handler.removeCallbacks(captureTimeout); it(null) }
capture = onText
captureLate = onTimeout
captureBefore = shared
handler.postDelayed(captureTimeout, timeoutMs)
}
fun start() {
if (active) return
active = true
@@ -47,6 +71,8 @@ class SessionClipboard(context: Context, private val hasFocus: () -> Boolean) {
fun stop() {
if (!active) return
active = false
handler.removeCallbacks(captureTimeout)
capture?.let { capture = null; it(null) }
clipboard.removePrimaryClipChangedListener(androidListener)
WaylandCompositor.clearClipboardListener(guestListener)
handler.removeCallbacksAndMessages(null)
@@ -8,8 +8,10 @@ object RuntimeAutoUpdate {
const val MAX_ATTEMPTS = 3
const val RETRY_MS = 10 * 60_000L
fun due(installed: String?, release: String?, attempts: Int, lastAt: Long = 0L, now: Long = lastAt + RETRY_MS): Boolean =
installed != null && !release.isNullOrEmpty() && release != installed && attempts < MAX_ATTEMPTS &&
private const val SEEDED = "seeded"
fun due(installed: String?, release: String?, attempts: Int, lastAt: Long = 0L, now: Long = lastAt + RETRY_MS, first: Boolean = false): Boolean =
(installed != null || first) && !release.isNullOrEmpty() && release != installed && attempts < MAX_ATTEMPTS &&
(attempts == 0 || now - lastAt !in 0 until RETRY_MS)
fun key(appVersion: Int, release: String) = "$appVersion:$release"
@@ -20,11 +22,17 @@ object RuntimeAutoUpdate {
val key = key(BuildConfig.VERSION_CODE, release)
synchronized(this) {
val attempts = prefs.getInt(key, 0)
if (!due(installed, release, attempts, prefs.getLong("$key@at", 0L), now)) return false
val first = installed == null && !prefs.getBoolean(SEEDED, false)
if (!due(installed, release, attempts, prefs.getLong("$key@at", 0L), now, first)) return false
val edit = prefs.edit()
prefs.all.keys.filterNot { it.startsWith("${BuildConfig.VERSION_CODE}:") }.forEach { edit.remove(it) }
prefs.all.keys.filterNot { it.startsWith("${BuildConfig.VERSION_CODE}:") || it == SEEDED }.forEach { edit.remove(it) }
edit.putInt(key, attempts + 1).putLong("$key@at", now).apply()
return true
}
}
fun seed(context: Context) {
val prefs = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
if (!prefs.getBoolean(SEEDED, false)) prefs.edit().putBoolean(SEEDED, true).apply()
}
}
@@ -0,0 +1,401 @@
package com.droiddeck.launcher.session
import android.content.Context
import android.util.AtomicFile
import android.util.Log
import com.droiddeck.launcher.R
import com.droiddeck.launcher.frontend.AutoComponents
import org.json.JSONArray
import org.json.JSONObject
import java.io.File
object ComponentUpdater {
private const val TAG = "ComponentUpdater"
private const val CHECK_EVERY_MS = 3_600_000L
private const val BOOTED_KEPT = 200
private const val HANDED_BACK = "handedBack"
internal const val HAND_BACK_FILES = "handBackFiles"
private const val IMPORTED = "imported"
private val lock = Any()
private val io = Any()
data class Status(val line: String, val current: String, val previous: String, val protons: List<String>, val note: String)
private fun file(context: Context) = File(File(context.filesDir, "components").apply { mkdirs() }, "updates.json")
private fun load(context: Context): JSONObject = synchronized(io) {
runCatching { JSONObject(String(AtomicFile(file(context)).readFully(), Charsets.UTF_8)) }.getOrDefault(JSONObject())
}
private fun save(context: Context, state: JSONObject) {
synchronized(io) {
val atomic = AtomicFile(file(context))
val output = runCatching { atomic.startWrite() }.onFailure { Log.w(TAG, "could not save", it) }.getOrNull() ?: return
try {
output.write(state.toString(1).toByteArray(Charsets.UTF_8))
atomic.finishWrite(output)
} catch (error: Exception) {
atomic.failWrite(output)
Log.w(TAG, "could not save", error)
}
}
}
private fun Map<String, Map<String, ComponentsManager.Choice>>.choiceOf(p: ComponentsManager.Proton, comp: String): ComponentsManager.Choice? =
this[p.id]?.get(comp)?.takeIf { it.protonVersion == p.version }
private fun Map<String, Map<String, ComponentsManager.Choice>>.fileOf(p: ComponentsManager.Proton, comp: String): String? = choiceOf(p, comp)?.file
private class Target(val comp: String, val p: ComponentsManager.Proton, val line: ComponentUpdates.Line, val ls: JSONObject) {
val key: String get() = line.key
}
private fun JSONObject.obj(key: String): JSONObject = optJSONObject(key) ?: JSONObject().also { put(key, it) }
private fun JSONArray?.strings(): Set<String> = this?.let { a -> (0 until a.length()).map { a.optString(it) }.toSet() } ?: emptySet()
private fun JSONObject.strings(key: String): Set<String> = optJSONArray(key).strings()
private fun JSONObject?.ints(): Map<String, Int> = this?.keys()?.asSequence()?.associateWith { optInt(it) } ?: emptyMap()
private fun JSONObject?.texts(): Map<String, String> = this?.keys()?.asSequence()?.associateWith { optString(it) } ?: emptyMap()
fun settle(context: Context) {
val owned = load(context).optJSONObject("lines")?.let { lines -> lines.keys().asSequence().flatMap { lines.optJSONObject(it).strings("owned") }.toSet() } ?: emptySet()
val own = (runCatching { ComponentsManager.protons(context) }.getOrNull() ?: return).filter(ComponentUpdates::follows).mapTo(HashSet()) { it.id }
val choices = ComponentsManager.activeChoices(context).filterKeys { it in own }.values.flatMap { it.entries }
for (comp in ComponentsManager.COMPONENTS) {
if (SessionPrefs.componentModeChosen(context, comp)) continue
val manual = choices.any { (c, choice) -> c == comp && ComponentUpdates.manual(choice, null, owned) }
SessionPrefs.setComponentMode(context, comp, if (manual) ComponentUpdates.MANUAL else ComponentUpdates.AUTO)
}
}
private fun managed(context: Context, comp: String): Boolean =
SessionPrefs.componentMode(context, comp) == ComponentUpdates.AUTO && !(comp == "dxvk" && ComponentsManager.hardwareDxvk(context))
private fun logLines(context: Context): Sequence<String> {
val dir = ComponentsManager.steamLogs(context)
return sequenceOf("console_log.previous.txt", "console_log.txt").map { File(dir, it) }.filter { it.isFile }
.flatMap { f -> runCatching { f.readLines() }.getOrDefault(emptyList()).asSequence() }
}
private val STAMP = Regex("""^\[(\d{4}-\d\d-\d\d \d\d:\d\d:\d\d)]""")
private fun latestStamp(context: Context): String =
logLines(context).mapNotNull { STAMP.find(it)?.groupValues?.get(1) }.maxOrNull() ?: "0"
private fun lineOf(context: Context, state: JSONObject, p: ComponentsManager.Proton, comp: String): ComponentUpdates.Line? {
if (!ComponentUpdates.follows(p) || !ComponentsManager.supports(p, comp)) return null
if (comp == "fex") return ComponentUpdates.line("fex", false)
val key = "${p.id}|${p.version}"
val flavors = state.obj("flavors").obj(key)
val arm64ec = if (flavors.has(comp)) flavors.optBoolean(comp) else ComponentsManager.arm64ec(context, p, comp)?.also { flavors.put(comp, it) }
return arm64ec?.let { ComponentUpdates.line(comp, it) }
}
fun ensure(context: Context, force: Boolean): List<String> = synchronized(lock) {
if (SessionState.running) return emptyList()
settle(context)
val state = load(context)
val notes = ArrayList<String>()
val found = runCatching { ComponentsManager.protons(context) }.getOrNull()
val protons = found ?: emptyList()
if (found != null) handBack(context, state, found)
judge(context, state, protons, notes)
val due = force || System.currentTimeMillis() - state.optLong("checkedAt") >= CHECK_EVERY_MS
val wanted = ComponentsManager.COMPONENTS.filter { managed(context, it) }
if (wanted.isEmpty() || protons.isEmpty()) {
save(context, state)
return notes
}
try {
dropRemoved(state, protons)
val checked = due && check(context, state, protons, wanted, force, notes)
apply(context, state, protons, wanted, notes)
prune(context, state)
if (checked) state.put("checkedAt", System.currentTimeMillis())
} finally {
save(context, state)
}
notes
}
private fun check(
context: Context, state: JSONObject, protons: List<ComponentsManager.Proton>, wanted: List<String>, force: Boolean, notes: MutableList<String>,
): Boolean {
if (!AutoComponents.isOnline(context)) {
state.put("note", context.getString(R.string.comp_auto_waits_network))
return false
}
val catalog = runCatching { ComponentsManager.catalog(context, true).items }
.onFailure { Log.w(TAG, "catalog", it) }.getOrDefault(emptyList())
if (catalog.none { it.release == ComponentsManager.DD_NIGHTLY }) {
state.put("note", context.getString(R.string.comp_auto_check_failed))
return false
}
val holdBack = !force && AutoComponents.constrained(context)
val lines = state.obj("lines")
var complete = true
state.remove("note")
for (comp in wanted) for (p in protons) {
val line = lineOf(context, state, p, comp) ?: continue
val ls = lines.obj(line.key)
if (rollingBack(ls)) {
complete = false
continue
}
val current = ls.optString("current")
val missing = current.isNotEmpty() && !ComponentsManager.isStored(context, current)
val relisted = if (missing) catalog.firstOrNull { it.file == current } else null
if (relisted != null) {
if (holdBack) {
state.put("note", context.getString(R.string.comp_auto_waits_unmetered))
complete = false
continue
}
val got = runCatching { ComponentsManager.download(context, relisted) {} }
if (got.isFailure) {
Log.w(TAG, "download ${relisted.file} again", got.exceptionOrNull())
state.put("note", context.getString(R.string.comp_auto_check_failed))
complete = false
continue
}
own(state, ls, current)
}
val target = ComponentUpdates.pick(catalog, line, ls.strings("bad"))
if (target == null || current == target.file) continue
val stored = ComponentsManager.isStored(context, target.file)
if (!stored) {
if (holdBack) {
state.put("note", context.getString(R.string.comp_auto_waits_unmetered))
complete = false
continue
}
val got = runCatching { ComponentsManager.download(context, target) {} }
if (got.isFailure) {
Log.w(TAG, "download ${target.file}", got.exceptionOrNull())
state.put("note", context.getString(R.string.comp_auto_check_failed))
complete = false
continue
}
}
val stocks = protons.filter { lineOf(context, state, it, comp)?.key == line.key }.map { ComponentsManager.arm64x(context, it, comp) }
if (ComponentUpdates.needsArm64x(line, stocks) && !ComponentsManager.packageArm64x(context, target.file, comp)) {
Log.w(TAG, "${target.file} is not ARM64X like ${p.name}'s own ${line.key}; skipped")
ls.put("bad", JSONArray(ls.strings("bad") + target.file))
if (!stored) runCatching { ComponentsManager.deletePackage(context, target.file) }
continue
}
ls.put("previous", if (missing && relisted == null) ComponentUpdates.ORIGINAL else current.ifEmpty { ComponentUpdates.ORIGINAL })
.put("current", target.file).put("since", latestStamp(context)).put("failed", JSONObject())
if (!stored) own(state, ls, target.file)
ls.remove("note")
notes += context.getString(R.string.comp_auto_updated, ComponentsManager.LABEL[comp], target.file.removeSuffix(".wcp"))
}
return complete
}
private fun apply(context: Context, state: JSONObject, protons: List<ComponentsManager.Proton>, wanted: List<String>, notes: MutableList<String>) {
val lines = state.obj("lines")
val auto = placed(state)
val choices = ComponentsManager.activeChoices(context)
val targets = wanted.flatMap { comp ->
protons.mapNotNull { p -> lineOf(context, state, p, comp)?.let { line -> lines.optJSONObject(line.key)?.let { Target(comp, p, line, it) } } }
}.filterNot { t -> ComponentUpdates.manual(choices.choiceOf(t.p, t.comp), t.ls.optJSONObject("applied")?.optString(t.p.id), auto, t.ls.optString("current")) }
for (t in targets) {
val from = t.ls.optJSONObject("restore")?.optString(t.p.id).orEmpty()
val current = t.ls.optString("current")
if (from.isNotEmpty()) {
if (choices.fileOf(t.p, t.comp) == from) runCatching { ComponentsManager.restore(context, t.p.id, t.comp, ComponentsManager.safeName(t.p.version)) }
.onFailure { Log.w(TAG, "restore ${t.p.name} ${t.key}", it) }
} else if (current.isNotEmpty() && choices.fileOf(t.p, t.comp) != current) {
if (ComponentUpdates.needsArm64x(t.line, listOf(ComponentsManager.arm64x(context, t.p, t.comp))) &&
!ComponentsManager.packageArm64x(context, current, t.comp)) continue
runCatching { ComponentsManager.swap(context, t.p.id, current) }
.onFailure { Log.w(TAG, "${t.p.name} ${t.key}", it) }
}
}
val after = ComponentsManager.activeChoices(context)
val unfinished = HashSet<String>()
for (t in targets) {
val restore = t.ls.optJSONObject("restore")
val from = restore?.optString(t.p.id).orEmpty()
val current = t.ls.optString("current")
if (from.isNotEmpty()) {
if (after.fileOf(t.p, t.comp) == from) unfinished += t.key
else {
restore?.remove(t.p.id)
if (after.choiceOf(t.p, t.comp)?.file?.startsWith("original ") != false) t.ls.optJSONObject("applied")?.remove(t.p.id)
}
} else if (current.isNotEmpty()) {
if (after.fileOf(t.p, t.comp) == current) t.ls.obj("applied").put(t.p.id, current) else unfinished += t.key
}
}
for (key in lines.keys().asSequence().toList()) {
val ls = lines.optJSONObject(key) ?: continue
val pending = ls.optString("pendingNote")
if (pending.isEmpty() || key in unfinished || (ls.optJSONObject("restore")?.length() ?: 0) > 0) continue
ls.remove("pendingNote")
ls.put("note", pending)
notes += pending
}
}
private fun own(state: JSONObject, ls: JSONObject, file: String) {
ls.put("owned", JSONArray(ls.strings("owned") + file))
state.put(IMPORTED, JSONArray(state.strings(IMPORTED) - file))
}
fun importPackage(context: Context, source: File, name: String): ComponentsManager.Package = synchronized(lock) {
ComponentsManager.importPackage(context, source, name).also { disown(context, it.file) }
}
fun disown(context: Context, file: String) = synchronized(lock) {
val state = load(context)
state.optJSONObject("lines")?.let { lines ->
lines.keys().asSequence().mapNotNull { lines.optJSONObject(it) }.filter { file in it.strings("owned") }
.forEach { it.put("owned", JSONArray(it.strings("owned") - file)) }
}
state.put(IMPORTED, JSONArray(state.strings(IMPORTED) + file))
save(context, state)
}
internal fun placed(state: JSONObject): Set<String> {
val remembered = state.strings(HAND_BACK_FILES)
val lines = state.optJSONObject("lines") ?: return remembered - state.strings(IMPORTED)
return remembered + lines.keys().asSequence().flatMap { k ->
val ls = lines.optJSONObject(k) ?: return@flatMap emptySequence()
(ls.strings("owned") + ls.strings("bad") + ls.optString("current") + ls.optString("previous")).asSequence()
}.filter { it.isNotEmpty() }.toSet() - state.strings(IMPORTED)
}
private fun handBack(context: Context, state: JSONObject, protons: List<ComponentsManager.Proton>) {
if (state.optBoolean(HANDED_BACK)) return
val placed = placed(state)
state.put(HAND_BACK_FILES, JSONArray(placed.sorted()))
val own = protons.filter(ComponentUpdates::follows).mapTo(HashSet()) { it.id }
runCatching { ComponentsManager.dropQueuedPackages(context, placed) { it in own || ComponentUpdates.ownId(it) } }.onFailure { Log.w(TAG, "drop queued Auto builds", it) }.getOrNull() ?: return
val strays = ComponentUpdates.strays(protons, ComponentsManager.activeChoices(context), placed)
for ((p, comp) in strays) {
runCatching { ComponentsManager.restoreUnlessQueued(context, p.id, comp, ComponentsManager.safeName(p.version)) }
.onFailure { Log.w(TAG, "hand back ${p.name} $comp", it) }
}
val after = ComponentsManager.activeChoices(context)
if (ComponentUpdates.strays(protons, after, placed).isEmpty() && !ComponentUpdates.unseen(protons, after, placed)) {
state.put(HANDED_BACK, true)
state.remove(HAND_BACK_FILES)
}
}
internal fun dropRemoved(state: JSONObject, protons: List<ComponentsManager.Proton>) {
val installed = protons.mapTo(HashSet()) { it.id }
val lines = state.optJSONObject("lines") ?: return
for (key in lines.keys().asSequence().toList()) {
val restore = lines.optJSONObject(key)?.optJSONObject("restore") ?: continue
for (id in restore.keys().asSequence().toList()) if (id !in installed) restore.remove(id)
}
}
internal fun rollingBack(ls: JSONObject): Boolean =
(ls.optJSONObject("restore")?.length() ?: 0) > 0 || ls.optString("pendingNote").isNotEmpty()
private fun judge(context: Context, state: JSONObject, protons: List<ComponentsManager.Proton>, notes: MutableList<String>) {
val mark = state.optString("logMark")
val runs = ComponentUpdates.launches(logLines(context), mark)
if (runs.isEmpty()) return
state.put("logMark", runs.maxOf { it.start })
val byTool = protons.associateBy { it.dir.name }
val lines = state.obj("lines")
for (comp in ComponentsManager.COMPONENTS) {
val onLine = HashMap<String, MutableList<ComponentUpdates.Launch>>()
for (run in runs) {
val p = byTool[run.tool] ?: continue
if (ComponentsManager.gameComponents(context, run.app).containsKey(comp)) continue
val line = lineOf(context, state, p, comp) ?: continue
onLine.getOrPut(line.key) { ArrayList() } += run
}
for ((key, list) in onLine) {
val ls = lines.obj(key)
val verdict = ComponentUpdates.judge(ComponentUpdates.Trial(
ls.optString("current"), ls.optString("previous"), ls.optString("since"),
ls.optJSONObject("booted").texts(), ls.optJSONObject("failed").ints(),
), list)
ls.put("booted", JSONObject(verdict.booted.entries.toList().takeLast(BOOTED_KEPT).associate { it.key to it.value } as Map<*, *>))
ls.put("failed", JSONObject(verdict.failed as Map<*, *>))
if (verdict.rollBack && managed(context, comp)) rollBack(context, state, protons, comp, key, notes)
}
}
}
private fun rollBack(context: Context, state: JSONObject, protons: List<ComponentsManager.Proton>, comp: String, key: String, notes: MutableList<String>) {
val ls = state.obj("lines").obj(key)
val bad = ls.optString("current")
val onLine = protons.filter { lineOf(context, state, it, comp)?.key == key }
val line = ComponentUpdates.LINES.first { it.key == key }
val back = ls.optString("previous").takeIf { prev -> prev == ComponentUpdates.ORIGINAL || (ComponentsManager.isStored(context, prev) &&
(!ComponentUpdates.needsArm64x(line, onLine.map { ComponentsManager.arm64x(context, it, comp) }) || ComponentsManager.packageArm64x(context, prev, comp))) }
?: ComponentUpdates.ORIGINAL
val choices = ComponentsManager.activeChoices(context)
val targets = onLine.filter { choices.fileOf(it, comp) == bad }
for (p in targets) {
runCatching {
if (back == ComponentUpdates.ORIGINAL) ComponentsManager.restore(context, p.id, comp, ComponentsManager.safeName(p.version))
else ComponentsManager.swap(context, p.id, back)
}.onFailure { Log.w(TAG, "roll back ${p.name} $key", it) }
}
val after = ComponentsManager.activeChoices(context)
val unfinished = targets.filter { after.fileOf(it, comp) == bad }
for (p in targets - unfinished.toSet()) {
if (back == ComponentUpdates.ORIGINAL) ls.optJSONObject("applied")?.remove(p.id)
else if (after.fileOf(p, comp) == back) ls.obj("applied").put(p.id, back)
}
ls.put("bad", JSONArray(ls.strings("bad") + bad)).put("current", back).put("previous", ComponentUpdates.ORIGINAL)
.put("since", latestStamp(context)).put("failed", JSONObject())
if (back == ComponentUpdates.ORIGINAL) ls.obj("restore").let { restore -> unfinished.forEach { restore.put(it.id, bad) } }
val label = ComponentsManager.LABEL[comp]
val shown = back.ifEmpty { context.getString(R.string.comp_tag_original) }.removeSuffix(".wcp")
val note = context.getString(R.string.comp_auto_rolled_back, label, bad.removeSuffix(".wcp"), shown)
Log.w(TAG, note)
if (unfinished.isNotEmpty()) {
ls.put("pendingNote", note)
return
}
ls.remove("pendingNote")
ls.put("note", note)
notes += note
prune(context, state)
}
private fun prune(context: Context, state: JSONObject) {
val lines = state.obj("lines")
val selected = ComponentsManager.selectedPackages(context)
val keep = lines.keys().asSequence().flatMap { k ->
val ls = lines.optJSONObject(k) ?: return@flatMap emptySequence()
ComponentUpdates.keep(ls.optString("current"), ls.optString("previous"), selected).asSequence()
}.toSet()
val stored = ComponentsManager.storedFiles(context)
val followed = ComponentUpdates.LINES.filter { managed(context, it.comp) }
for (k in lines.keys().asSequence().toList()) {
val ls = lines.optJSONObject(k) ?: continue
val owned = ls.strings("owned")
val stale = ComponentUpdates.stale(followed.firstOrNull { it.key == k }, owned, stored, keep, ls.optString("current"), ls.strings("bad").toSet())
val gone = stale.filter { runCatching { ComponentsManager.deleteUnused(context, it) }.getOrDefault(false) }
ls.put("owned", JSONArray(owned - gone.toSet()))
}
}
fun status(context: Context, comp: String): List<Status> {
val state = load(context)
val lines = state.optJSONObject("lines") ?: JSONObject()
val protons = runCatching { ComponentsManager.protons(context) }.getOrDefault(emptyList())
val byLine = protons.groupBy { lineOf(context, state, it, comp)?.key }
return ComponentUpdates.LINES.filter { it.comp == comp }.mapNotNull { line ->
val on = byLine[line.key].orEmpty()
val ls = lines.optJSONObject(line.key)
if (on.isEmpty() && ls == null) return@mapNotNull null
val note = ls?.optString("note").orEmpty().ifEmpty { state.optString("note") }
Status(line.key, ls?.optString("current").orEmpty(), ls?.optString("previous").orEmpty(), on.map { it.name }, note)
}
}
}
@@ -0,0 +1,167 @@
package com.droiddeck.launcher.session
import java.nio.ByteBuffer
import java.nio.ByteOrder
import java.text.SimpleDateFormat
import java.util.Locale
object ComponentUpdates {
const val AUTO = "auto"
const val MANUAL = "manual"
const val ORIGINAL = ""
const val BOOT_SECONDS = 30L
const val BOOTED_SECONDS = 60L
const val FAILED_BOOTS_BEFORE_ROLLBACK = 2
data class Line(val key: String, val comp: String, val prefix: String)
val LINES = listOf(
Line("dxvk", "dxvk", "DD-dxvk-"),
Line("dxvk-arm64ec", "dxvk", "DD-dxvk-arm64ec-"),
Line("vkd3d", "vkd3d", "DD-vkd3d-proton-"),
Line("vkd3d-arm64ec", "vkd3d", "DD-vkd3d-proton-arm64ec-"),
Line("fex", "fex", "DD-FEXCore-"),
)
private val OWN_PREFIX = ProtonExtras.tools.first { it.id == ProtonExtras.OWN }.prefix
fun follows(p: ComponentsManager.Proton): Boolean = !p.valve && p.dir.name.startsWith(OWN_PREFIX)
fun ownId(protonId: String): Boolean = protonId.startsWith(ComponentsManager.safeName(OWN_PREFIX))
fun strays(
protons: List<ComponentsManager.Proton>,
choices: Map<String, Map<String, ComponentsManager.Choice>>,
placed: Set<String>,
): List<Pair<ComponentsManager.Proton, String>> =
protons.filterNot(::follows).flatMap { p ->
choices[p.id].orEmpty().filter { (_, c) -> !c.auto && c.protonVersion == p.version && c.file in placed }.keys.map { p to it }
}
fun unseen(
protons: List<ComponentsManager.Proton>,
choices: Map<String, Map<String, ComponentsManager.Choice>>,
placed: Set<String>,
): Boolean {
val found = protons.mapTo(HashSet()) { it.id }
return choices.any { (id, comps) -> id !in found && comps.values.any { !it.auto && it.file in placed } }
}
fun line(comp: String, arm64ec: Boolean): Line = LINES.first {
it.comp == comp && (comp == "fex" || it.key.endsWith("-arm64ec") == arm64ec)
}
fun pick(items: List<ComponentsManager.CatalogItem>, line: Line, bad: Set<String>): ComponentsManager.CatalogItem? {
val newestBad = bad.filter { belongs(it, line) }.maxWithOrNull { a, b -> ProtonExtras.compareVersions(a, b) }
return items.filter { it.release == ComponentsManager.DD_NIGHTLY && it.comp == line.comp && belongs(it.file, line) }
.filter { newestBad == null || ProtonExtras.compareVersions(it.file, newestBad) > 0 }
.maxWithOrNull { a, b -> ProtonExtras.compareVersions(a.file, b.file) }
}
fun belongs(file: String, line: Line): Boolean =
file.startsWith(line.prefix) && file.removePrefix(line.prefix).firstOrNull()?.isDigit() == true
fun arm64ec(pe: ByteArray): Boolean? = runCatching {
val b = ByteBuffer.wrap(pe).order(ByteOrder.LITTLE_ENDIAN)
val header = b.getInt(0x3c)
if (b.getInt(header) != 0x4550) return null
val sections = b.getShort(header + 6).toInt() and 0xffff
val optionalSize = b.getShort(header + 20).toInt() and 0xffff
val optional = header + 24
if ((b.getShort(optional).toInt() and 0xffff) != 0x20b) return false
val loadConfigRva = b.getInt(optional + 112 + 10 * 8)
if (loadConfigRva == 0) return false
val table = optional + optionalSize
var offset = -1
for (i in 0 until sections) {
val s = table + i * 40
val size = b.getInt(s + 8)
val va = b.getInt(s + 12)
if (loadConfigRva >= va && loadConfigRva < va + maxOf(size, 1)) offset = b.getInt(s + 20) + loadConfigRva - va
}
if (offset < 0) return null
b.getInt(offset) >= 0xC8 + 8 && b.getLong(offset + 0xC8) != 0L
}.getOrNull()
fun arm64x(pe: ByteArray): Boolean = runCatching {
val b = ByteBuffer.wrap(pe).order(ByteOrder.LITTLE_ENDIAN)
val header = b.getInt(0x3c)
b.getInt(header) == 0x4550 && (b.getShort(header + 4).toInt() and 0xffff) == 0xaa64 && arm64ec(pe) == true
}.getOrDefault(false)
fun allArm64x(dlls: Map<String, ByteArray>, owned: Set<String>): Boolean {
val graphics = dlls.filterKeys { it.lowercase() in owned }
return graphics.isNotEmpty() && graphics.values.all(::arm64x)
}
fun needsArm64x(line: Line, stocks: List<Boolean?>): Boolean =
line.key.endsWith("-arm64ec") && stocks.any { it != false }
data class Launch(val app: String, val tool: String, val start: String, val seconds: Long)
private val PROCESS = Regex("""^\[(\d{4}-\d\d-\d\d \d\d:\d\d:\d\d)] Game process (added|removed)\s*: AppID (\d+)(?: "(.*))?""")
private val TOOL = Regex("""compatibilitytools\.d/([^/'"]+)['"]?/|steamapps/common/([^/'"]+)['"]?/proton""")
fun launches(log: Sequence<String>, after: String): List<Launch> {
val format = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US)
val open = HashMap<String, Pair<String, String>>()
val out = ArrayList<Launch>()
for (line in log) {
val m = PROCESS.find(line) ?: continue
val (time, what, app) = m.destructured
if (time <= after) continue
if (what == "added") {
val tool = TOOL.find(m.groupValues[4])?.let { t -> t.groupValues[1].ifEmpty { t.groupValues[2] } } ?: continue
open[app] = time to tool
} else {
val (start, tool) = open.remove(app) ?: continue
val seconds = runCatching { (format.parse(time)!!.time - format.parse(start)!!.time) / 1000 }.getOrNull() ?: continue
out += Launch(app, tool, start, seconds)
}
}
return out
}
data class Trial(
val current: String,
val previous: String,
val since: String,
val booted: Map<String, String>,
val failed: Map<String, Int>,
)
data class Verdict(val booted: Map<String, String>, val failed: Map<String, Int>, val rollBack: Boolean)
fun judge(trial: Trial, runs: List<Launch>): Verdict {
val booted = trial.booted.toMutableMap()
val failed = trial.failed.toMutableMap()
var rollBack = false
for (run in runs) {
val build = if (trial.since.isNotEmpty() && run.start > trial.since) trial.current else trial.previous
if (run.seconds >= BOOTED_SECONDS) {
booted[run.app] = build
if (build == trial.current) failed.remove(run.app)
} else if (run.seconds < BOOT_SECONDS && build == trial.current && trial.current != trial.previous &&
booted[run.app] == trial.previous) {
val n = (failed[run.app] ?: 0) + 1
failed[run.app] = n
if (n >= FAILED_BOOTS_BEFORE_ROLLBACK) rollBack = true
}
}
return Verdict(booted, failed, rollBack)
}
fun keep(current: String, previous: String, selected: Set<String>): Set<String> =
(setOf(current, previous) + selected) - ORIGINAL
fun manual(choice: ComponentsManager.Choice?, applied: String?, auto: Set<String>, current: String? = null): Boolean =
choice != null && !choice.auto && !choice.file.startsWith("original ") && choice.file != current &&
(if (applied.isNullOrEmpty()) choice.file !in auto else choice.file != applied)
fun stale(line: Line?, owned: Set<String>, stored: List<String>, keep: Set<String>, current: String, bad: Set<String> = emptySet()): List<String> {
val ranked = line?.takeIf { belongs(current, it) }
fun newer(file: String) = ranked != null && belongs(file, ranked) && ProtonExtras.compareVersions(file, current) > 0
return (owned + stored.filter { ranked != null && belongs(it, ranked) })
.filter { it !in keep && ((it in bad && it in owned) || !newer(it)) }.distinct()
}
}
@@ -84,6 +84,7 @@ object ComponentsManager {
private fun root(context: Context) = LinuxRuntime.rootDir(context)
private fun steam(context: Context) = File(root(context), "root/.local/share/Steam")
fun steamLogs(context: Context) = File(steam(context), "logs")
private fun host(context: Context, guest: String) = File(root(context), guest.removePrefix("/"))
private fun dataDir(context: Context) = File(context.filesDir, "components").apply { mkdirs() }
private fun packagesDir(context: Context) = File(dataDir(context), "packages").apply { mkdirs() }
@@ -699,6 +700,12 @@ object ComponentsManager {
context.getString(R.string.cmgr_restore_done, LABEL[comp], p.name, protonVersion)
}
fun restoreUnlessQueued(context: Context, protonId: String, comp: String, protonVersion: String): Boolean = synchronized(lock) {
if (loadState(context).optJSONObject("queued")?.optJSONObject(protonId)?.has(comp) == true) return false
restore(context, protonId, comp, protonVersion)
true
}
private fun applyOriginal(context: Context, p: Proton, comp: String, protonVersion: String, wcp: File, state: JSONObject) {
val current = protonVersion == safeName(p.version)
if (!current) ensureOriginal(context, p, comp, state)
@@ -749,6 +756,25 @@ object ComponentsManager {
saveState(context, state)
}
fun dropQueuedPackages(context: Context, files: Set<String>, keep: (String) -> Boolean): Int = synchronized(lock) {
val state = loadState(context)
val queued = state.sub("queued")
var dropped = 0
for (pid in queued.keys().asSequence().toList()) {
if (keep(pid)) continue
val comps = queued.optJSONObject(pid) ?: continue
for (comp in comps.keys().asSequence().toList()) {
val entry = comps.optJSONObject(comp) ?: continue
if (entry.optString("kind") != "package" || entry.optBoolean("auto") || entry.optString("file") !in files) continue
comps.remove(comp)
dropped++
}
if (comps.length() == 0) queued.remove(pid)
}
if (dropped > 0) saveState(context, state)
dropped
}
class StoredPackage(val pkg: Package, val inUse: Boolean)
class StoredOriginal(val protonId: String, val protonName: String?, val comp: String, val protonVersion: String, val size: Long, val kept: Boolean)
class Stored(val packages: List<StoredPackage>, val originals: List<StoredOriginal>)
@@ -756,7 +782,11 @@ object ComponentsManager {
internal fun liveSelection(key: String, entry: JSONObject, proton: Proton?): Boolean =
proton != null && (key == "queued" || entry.optString("protonVersion") == proton.version)
private fun packagesInUse(state: JSONObject, installed: Map<String, Proton>): Set<String> {
internal fun liveOnAny(key: String, entry: JSONObject, installs: List<Proton>?): Boolean =
installs?.any { liveSelection(key, entry, it) } == true
internal fun packagesInUse(state: JSONObject, installed: List<Proton>): Set<String> {
val byId = installed.groupBy { it.id }
val names = HashSet<String>()
for (key in listOf("active", "queued")) {
val byProton = state.optJSONObject(key) ?: continue
@@ -764,7 +794,7 @@ object ComponentsManager {
val comps = byProton.optJSONObject(pid) ?: continue
for (comp in comps.keys()) {
val entry = comps.optJSONObject(comp) ?: continue
if (liveSelection(key, entry, installed[pid])) entry.optString("file").takeIf { it.isNotEmpty() }?.let(names::add)
if (liveOnAny(key, entry, byId[pid])) entry.optString("file").takeIf { it.isNotEmpty() }?.let(names::add)
}
}
}
@@ -786,7 +816,7 @@ object ComponentsManager {
fun stored(context: Context): Stored = synchronized(lock) {
val state = loadState(context)
val installed = protons(context).distinctBy { it.id }.associateBy { it.id }
val used = packagesInUse(state, installed)
val used = packagesInUse(state, protons(context))
val originals = originalsDir(context).listFiles()?.filter { it.isDirectory }?.flatMap { proton ->
proton.listFiles()?.filter { it.isDirectory }?.flatMap { version ->
COMPONENTS.mapNotNull { comp ->
@@ -813,15 +843,15 @@ object ComponentsManager {
}
private fun checkPackageUnused(context: Context, state: JSONObject, name: String) {
val installed = protons(context).distinctBy { it.id }.associateBy { it.id }
val installed = protons(context).groupBy { it.id }
for (key in listOf("queued", "active")) {
val byProton = state.sub(key)
for (pid in byProton.keys()) {
val comps = byProton.optJSONObject(pid) ?: continue
for (comp in comps.keys()) {
val entry = comps.optJSONObject(comp) ?: continue
check(entry.optString("file") != name || !liveSelection(key, entry, installed[pid])) {
context.getString(R.string.cmgr_package_in_use, name, installed[pid]?.name ?: pid)
check(entry.optString("file") != name || !liveOnAny(key, entry, installed[pid])) {
context.getString(R.string.cmgr_package_in_use, name, installed[pid]?.firstOrNull()?.name ?: pid)
}
}
}
@@ -911,7 +941,7 @@ object ComponentsManager {
fun deletePackage(context: Context, file: String): String = synchronized(lock) {
val name = safeName(file)
val state = loadState(context)
val installed = protons(context).distinctBy { it.id }.associateBy { it.id }
val installed = protons(context).groupBy { it.id }
var changed = false
for (key in listOf("queued", "active")) {
val byProton = state.sub(key)
@@ -920,7 +950,7 @@ object ComponentsManager {
for (comp in comps.keys().asSequence().toList()) {
val entry = comps.optJSONObject(comp) ?: continue
if (entry.optString("file") != name) continue
check(!liveSelection(key, entry, installed[pid])) { context.getString(R.string.cmgr_package_in_use, name, installed[pid]?.name ?: pid) }
check(!liveOnAny(key, entry, installed[pid])) { context.getString(R.string.cmgr_package_in_use, name, installed[pid]?.firstOrNull()?.name ?: pid) }
comps.remove(comp)
changed = true
}
@@ -967,9 +997,16 @@ object ComponentsManager {
if (!force && cache.isFile) runCatching { return parseCatalog(JSONObject(cache.readText())) }
if (!force) return Catalog(emptyList(), 0)
val items = JSONArray()
val previous = if (cache.isFile) runCatching { JSONObject(cache.readText()).optJSONArray("items") }.getOrNull() else null
var fetched = 0
for ((repo, tag) in SOURCES) {
val body = Downloader.downloadString("https://api.github.com/repos/$repo/releases/tags/$tag") ?: continue
val assets = runCatching { JSONObject(body).optJSONArray("assets") }.getOrNull() ?: continue
val body = Downloader.downloadString("https://api.github.com/repos/$repo/releases/tags/$tag")
val assets = body?.let { runCatching { JSONObject(it).optJSONArray("assets") }.getOrNull() }
if (assets == null) {
keepSource(previous, tag, items)
continue
}
fetched++
for (i in 0 until assets.length()) {
val a = assets.getJSONObject(i)
val name = a.optString("name")
@@ -980,13 +1017,18 @@ 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())) }
if (fetched == 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)
return parseCatalog(out)
}
internal fun keepSource(previous: JSONArray?, tag: String, into: JSONArray) {
previous ?: return
for (i in 0 until previous.length()) previous.optJSONObject(i)?.takeIf { it.optString("release") == tag }?.let(into::put)
}
private fun parseCatalog(o: JSONObject): Catalog {
val arr = o.optJSONArray("items") ?: JSONArray()
val items = (0 until arr.length()).map { arr.getJSONObject(it) }.map {
@@ -1031,6 +1073,86 @@ object ComponentsManager {
ForcedPackage(setOf(GpuInfo.Family.A6XX), "dxvk", "dxvk-2.7.1-linux.wcp", "Dxvk-Linux"),
)
private val ARM64EC_PROBE = mapOf("dxvk" to "d3d11.dll", "vkd3d" to "d3d12.dll")
fun arm64ec(context: Context, p: Proton, comp: String): Boolean? = stockProbe(context, p, comp)?.let(ComponentUpdates::arm64ec)
fun arm64x(context: Context, p: Proton, comp: String): Boolean? = stockProbe(context, p, comp)?.let(ComponentUpdates::arm64x)
fun packageArm64x(context: Context, file: String, comp: String): Boolean {
val dir = "${COMP_DIR[comp] ?: return false}/aarch64-windows/"
val f = File(packagesDir(context), safeName(file)).takeIf { it.isFile } ?: return false
val dlls = runCatching {
readWcp(f) { tar ->
val found = HashMap<String, ByteArray>()
while (true) {
val e = tar.nextTarEntry ?: break
val rel = normalize(e.name)
if (!e.isDirectory && rel.startsWith(dir) && '/' !in rel.removePrefix(dir)) found[rel.removePrefix(dir)] = tar.readBytes()
}
found
}
}.getOrNull() ?: return false
return ComponentUpdates.allArm64x(dlls, COMP_DLLS.getValue(comp))
}
private fun readWcpEntry(f: File, rel: String): ByteArray? = readWcp(f) { tar ->
var found: ByteArray? = null
while (found == null) {
val e = tar.nextTarEntry ?: break
if (!e.isDirectory && normalize(e.name) == rel) found = tar.readBytes()
}
found
}
private fun stockProbe(context: Context, p: Proton, comp: String): ByteArray? {
val rel = "${COMP_DIR[comp] ?: return null}/aarch64-windows/${ARM64EC_PROBE.getValue(comp)}"
val original = synchronized(lock) {
val swapped = loadState(context).optJSONObject("active")?.optJSONObject(p.id)?.optJSONObject(comp)
?.let { liveSelection("active", it, p) } == true
if (!swapped) return File(p.dir, rel).takeIf { it.isFile }?.let { runCatching { it.readBytes() }.getOrNull() }
originalFile(context, p, comp).takeIf { it.isFile } ?: return null
}
return runCatching { readWcpEntry(original, rel) }.getOrNull()
}
fun supports(p: Proton, comp: String): Boolean =
if (comp == "fex") File(p.dir, FEX_FILES.first()).isFile else File(p.dir, "${COMP_DIR.getValue(comp)}/aarch64-windows").isDirectory
fun hardwareDxvk(context: Context): Boolean =
runtimeManaged(context, "dxvk") || FORCED_PACKAGES.any { it.comp == "dxvk" && it.matches(GpuInfo.detect()) } ||
(com.droiddeck.launcher.core.DeviceSupport.vkBridge(context) && !SessionPrefs.bridgeProtonDxvk(context) &&
bridgeDxvk(AppVulkan.detect(context)) != null)
data class Choice(val file: String, val auto: Boolean, val protonVersion: String)
fun activeChoices(context: Context): Map<String, Map<String, Choice>> = synchronized(lock) {
val active = loadState(context).optJSONObject("active") ?: return emptyMap()
active.keys().asSequence().toList().associateWith { pid ->
val comps = active.optJSONObject(pid) ?: JSONObject()
comps.keys().asSequence().toList().mapNotNull { c ->
comps.optJSONObject(c)?.let { c to Choice(it.optString("file"), it.optBoolean("auto"), it.optString("protonVersion")) }
}.toMap()
}
}
fun selectedPackages(context: Context): Set<String> = synchronized(lock) {
packagesInUse(loadState(context), protons(context))
}
fun deleteUnused(context: Context, file: String): Boolean = synchronized(lock) {
val name = safeName(file)
val f = File(packagesDir(context), name)
if (!f.isFile || name in packagesInUse(loadState(context), protons(context))) return false
deletePackage(context, name)
true
}
fun storedFiles(context: Context): List<String> =
packagesDir(context).listFiles()?.filter { it.isFile && it.name.endsWith(".wcp") }?.map { it.name } ?: emptyList()
fun isStored(context: Context, file: String): Boolean = File(packagesDir(context), safeName(file)).isFile
internal fun forcedPackageWanted(activeFile: String?, protonVersionMatches: Boolean): Boolean =
activeFile.isNullOrEmpty() || !protonVersionMatches
@@ -21,7 +21,7 @@ object PerfMode {
val cur = display.mode
val cap = minOf(peakRefreshCap(a), refreshLimit.takeIf { it > 0 }?.toFloat() ?: Float.POSITIVE_INFINITY)
val best = selectMode(display.supportedModes, cur, fpsLimit, cap)
if (best != null && a.window.attributes.preferredDisplayModeId != best.modeId) {
if (best != null && needsChange(display.supportedModes, a.window.attributes.preferredDisplayModeId, best)) {
a.window.attributes = a.window.attributes.apply { preferredDisplayModeId = best.modeId }
"display ${cur.refreshRate.toInt()} → ${best.refreshRate.toInt()} Hz (mode ${best.modeId})"
} else "display ${cur.refreshRate.toInt()} Hz"
@@ -64,6 +64,11 @@ object PerfMode {
?: sameSize.minByOrNull { it.refreshRate }
}
internal fun needsChange(modes: Array<Display.Mode>, preferredId: Int, best: Display.Mode): Boolean {
val preferred = modes.firstOrNull { preferredId != 0 && it.modeId == preferredId } ?: return true
return Math.abs(preferred.refreshRate - best.refreshRate) > 0.5f
}
fun cadenceFits(hz: Float, fpsLimit: Int): Boolean {
if (fpsLimit <= 0) return true
val ratio = hz / fpsLimit
@@ -11,12 +11,4 @@ object PipPolicy {
height.toDouble() / width > 2.39 -> 100 to 239
else -> width to height
}
fun outputSize(width: Int, height: Int, outputWidth: Int, outputHeight: Int): Pair<Int, Int>? {
if (width <= 0 || height <= 0 || outputWidth <= 0 || outputHeight <= 0) return null
val scale = minOf(width.toFloat() / outputWidth, height.toFloat() / outputHeight)
val fittedWidth = ((outputWidth * scale).toInt() and 1.inv()).coerceAtLeast(2)
val fittedHeight = ((outputHeight * scale).toInt() and 1.inv()).coerceAtLeast(2)
return fittedWidth to fittedHeight
}
}
@@ -351,6 +351,8 @@ object SessionPrefs {
}
const val PC_KEYBOARD_SIZE_DEFAULT = 47
const val WOW_CHAT_VOICE = "voice"
const val WOW_CHAT_KEYBOARD = "keyboard"
val PC_KEYBOARD_SIZE_RANGE = 25..70
const val PC_KEYBOARD_OPACITY_DEFAULT = 100
val PC_KEYBOARD_OPACITY_RANGE = 30..100
@@ -362,6 +364,13 @@ object SessionPrefs {
prefs(context).edit().putInt("pcKeyboardSize", percent.coerceIn(PC_KEYBOARD_SIZE_RANGE)).apply()
}
fun wowChatInput(context: Context): String? =
prefs(context).getString("wowChatInput", null)?.takeIf { it == WOW_CHAT_VOICE || it == WOW_CHAT_KEYBOARD }
fun setWowChatInput(context: Context, mode: String?) {
prefs(context).edit().apply { if (mode == null) remove("wowChatInput") else putString("wowChatInput", mode) }.apply()
}
fun pcKeyboardOpacity(context: Context): Int =
prefs(context).getInt("pcKeyboardOpacity", PC_KEYBOARD_OPACITY_DEFAULT).takeIf { it in PC_KEYBOARD_OPACITY_RANGE } ?: PC_KEYBOARD_OPACITY_DEFAULT
@@ -499,6 +508,17 @@ object SessionPrefs {
prefs(context).edit().putString("gpuDriverMode", mode).apply()
}
fun componentMode(context: Context, comp: String): String =
prefs(context).getString("componentMode.$comp", ComponentUpdates.AUTO)
?.takeIf { it == ComponentUpdates.AUTO || it == ComponentUpdates.MANUAL } ?: ComponentUpdates.AUTO
fun componentModeChosen(context: Context, comp: String): Boolean = prefs(context).contains("componentMode.$comp")
fun setComponentMode(context: Context, comp: String, mode: String) {
require(mode == ComponentUpdates.AUTO || mode == ComponentUpdates.MANUAL)
prefs(context).edit().putString("componentMode.$comp", mode).commit()
}
fun settleGpuDriverMode(context: Context) {
val p = prefs(context)
if (p.contains("gpuDriverMode")) return
@@ -30,7 +30,7 @@ object SettingsReset {
)
internal val SESSION_PREFIXES = listOf(
"resolutionCap.", "displayResolution.", "customRes.", "hdr.", "fpsLimit.", "performanceMode.", "suspendPolicy.",
"resolutionCap.", "displayResolution.", "customRes.", "hdr.", "fpsLimit.", "performanceMode.", "suspendPolicy.", "componentMode.",
)
private val STEAM_TOUCH_KEYS = listOf("feedback", "autoFade", "gyro", "shake")
@@ -87,7 +87,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.GAMEJOLT, Store.XBOX, Store.BATTLENET -> ""
Store.AMAZON, Store.ITCH, Store.GAMEJOLT, Store.XBOX, Store.BATTLENET, Store.STEAM -> ""
} ?: return null
p.edit()
.putString("cloud_template_$id", fetched.ifEmpty { TEMPLATE_NONE })
@@ -148,7 +148,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.GAMEJOLT, Store.XBOX, Store.BATTLENET -> null
Store.AMAZON, Store.ITCH, Store.GAMEJOLT, Store.XBOX, Store.BATTLENET, Store.STEAM -> null
}
return dir to (if (dir == null) "unresolved" else "ok")
}
@@ -173,7 +173,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.GAMEJOLT, Store.XBOX, Store.BATTLENET -> null
Store.AMAZON, Store.ITCH, Store.GAMEJOLT, Store.XBOX, Store.BATTLENET, Store.STEAM -> null
}
private fun gogScopedToken(context: Context, id: String, clientId: String): String? {
@@ -13,7 +13,7 @@ internal object LoginFlows {
Store.EPIC -> epicFlow()
Store.AMAZON -> amazonFlow()
Store.GAMEJOLT -> gameJoltFlow(browserUserAgent)
Store.ITCH, Store.XBOX, Store.BATTLENET -> null
Store.ITCH, Store.XBOX, Store.BATTLENET, Store.STEAM -> null
}
@Volatile var epicFlow: () -> StoreLoginActivity.Flow? = { null }
@@ -1,6 +1,7 @@
package com.droiddeck.launcher.stores
enum class Store(val id: String, val label: String, val shortLabel: String) {
STEAM("steamstore", "Steam", "Steam"),
GOG("gog", "GOG", "GOG"),
EPIC("epic", "Epic Games", "Epic"),
AMAZON("amazon", "Amazon Games", "Amazon"),
@@ -90,7 +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 (store == Store.BATTLENET || store == Store.STEAM) 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 }
}
@@ -226,7 +226,7 @@ object StoreInstallRoot {
fun storeDir(root: File, store: Store): File = File(root, store.folder)
fun gameFolders(context: Context): List<File> = roots(context).flatMap { root ->
Store.entries.flatMap { store ->
Store.entries.filter { it != Store.STEAM }.flatMap { store ->
storeDir(root, store).listFiles { f -> f.isDirectory }?.sortedBy { it.name.lowercase() } ?: emptyList()
}
}
@@ -246,7 +246,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.filter { it != Store.BATTLENET }.flatMap { store ->
Store.entries.filter { it != Store.BATTLENET && it != Store.STEAM }.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.GAMEJOLT -> {}
Store.GOG, Store.XBOX, Store.BATTLENET -> {}
Store.GOG, Store.XBOX, Store.BATTLENET, Store.STEAM -> {}
}
}
}, pool).exceptionally { error ->
@@ -114,5 +114,6 @@ object StoreSizes {
Store.GOG, Store.XBOX, Store.BATTLENET -> 0L
Store.ITCH -> com.droiddeck.launcher.stores.itch.ItchLibrary.size(context, item)
Store.GAMEJOLT -> com.droiddeck.launcher.stores.gamejolt.GameJoltBuilds.size(context, item)
Store.STEAM -> com.droiddeck.launcher.stores.steam.SteamStore.plannedBytes(context, item)
} }
}
@@ -4,6 +4,7 @@ data class StoreTab(val store: Store, val shown: Boolean)
fun arrangeStoreTabs(order: List<String>, hidden: Set<String>): List<StoreTab> {
val known = Store.entries.associateBy { it.id }
val listed = order.mapNotNull { known[it] }.distinct()
val saved = order.mapNotNull { known[it] }.distinct()
val listed = if (saved.isNotEmpty() && Store.STEAM !in saved) listOf(Store.STEAM) + saved else saved
return (listed + Store.entries.filterNot { it in listed }).map { StoreTab(it, it.id !in hidden) }
}
@@ -85,6 +85,8 @@ object StoresState {
do {
seen = refreshRequests.get()
runCatching { com.droiddeck.launcher.stores.battlenet.BattleNetClient.syncAccount(app) }
runCatching { com.droiddeck.launcher.stores.steam.SteamStore.syncAccount(app) }
runCatching { com.droiddeck.launcher.stores.steam.SteamStore.scanInstalled(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 || it.state == StoreGameSidecar.STATE_UPDATING }?.let { InstalledStoreGame(it, folder) }
@@ -238,6 +240,7 @@ object StoresState {
fun requestInstall(context: Context, item: CatalogItem) {
askForNotifications(context)
if (item.store == Store.STEAM) { com.droiddeck.launcher.stores.steam.SteamStore.requestInstall(context, item); return }
if (item.store == Store.ITCH && item.extra["uploadId"].isNullOrEmpty()) { itchPicking = item; return }
if (item.store == Store.GAMEJOLT && item.extra["buildId"].isNullOrEmpty()) { gameJoltPicking = item; return }
if (isUnfinished(item)) { install(context, item); return }
@@ -256,6 +259,7 @@ object StoresState {
fun install(context: Context, item: CatalogItem, root: java.io.File? = null, language: String? = null) {
val app = context.applicationContext
if (item.store == Store.STEAM) { com.droiddeck.launcher.stores.steam.SteamStore.restore(app, item); return }
val targetRoot = root ?: StoreInstallRoot.defaultTarget(app)?.root ?: StoreInstallRoot.installRoot(app)
if (item.store == Store.BATTLENET && !com.droiddeck.launcher.stores.battlenet.BattleNetInstall.headless(item)) {
backends[item.store]?.install(app, item, targetRoot)
@@ -39,7 +39,7 @@ object GogComet {
var status by mutableStateOf("off")
private set
fun enabled(context: Context) = GogPrefs.get(context).getBoolean("achievements", false)
fun enabled(context: Context) = GogPrefs.get(context).getBoolean("achievements", true)
fun setEnabled(context: Context, on: Boolean) {
GogPrefs.get(context).edit().putBoolean("achievements", on).apply()
@@ -0,0 +1,121 @@
package com.droiddeck.launcher.stores.steam
import android.content.Context
import android.os.Environment
import com.droiddeck.launcher.R
import com.droiddeck.launcher.frontend.AddedGames
import com.droiddeck.launcher.frontend.Library
import com.droiddeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.session.GameStorage
import com.droiddeck.launcher.session.SecondaryLibrary
import com.droiddeck.launcher.session.SessionPhase
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.session.SessionService
import com.droiddeck.launcher.session.SessionState
import com.droiddeck.launcher.session.SteamLibraries
import com.droiddeck.launcher.stores.StoreInstallRoot
import org.json.JSONArray
import org.json.JSONObject
import java.io.File
/** The active Steam client's folders as the app sees them. Reads storage; call off the main thread. */
internal object SteamClient {
const val X86_64 = "x86_64"
class Target(
val library: SteamLibraryFolders.Library, val engineHost: File, val label: String,
val freeBytes: Long, val removable: Boolean, val folder: Boolean,
)
fun activeArch(context: Context): String = SessionPrefs.activeSteamClientArch(context)
private fun guestHome(arch: String) = if (arch == X86_64) "/root/.droiddeck-x64" else "/root"
fun guestRoot(arch: String) = "${guestHome(arch)}/.local/share/Steam"
private fun aliases(arch: String) = listOf(guestRoot(arch), "${guestHome(arch)}/.steam/steam", "${guestHome(arch)}/.steam/root")
fun root(context: Context, arch: String = activeArch(context)): File = SessionPrefs.steamRoot(context, arch)
fun registry(context: Context, arch: String = activeArch(context)): File =
File(LinuxRuntime.rootDir(context), guestHome(arch).removePrefix("/") + "/.steam/registry.vdf")
fun loginUsers(context: Context, arch: String = activeArch(context)): File = File(root(context, arch), "config/loginusers.vdf")
fun language(context: Context): String =
runCatching { SteamLibraryFolders.language(registry(context).readText()) }.getOrNull() ?: "english"
fun mounts(context: Context): List<SteamLibraryFolders.Mount> {
val out = ArrayList<SteamLibraryFolders.Mount>()
GameStorage.effective(context)?.let { card -> SecondaryLibrary.CARD_GUESTS.forEach { out += SteamLibraryFolders.Mount(it, File(card.path)) } }
SteamLibraries.list(context).forEach { out += SteamLibraryFolders.Mount(it.guest, it.host) }
AddedGames.roots(context).forEach { out += SteamLibraryFolders.Mount(it.guest, it.host) }
StoreInstallRoot.externalRoots(context).forEach { (host, guest) -> out += SteamLibraryFolders.Mount(guest, host) }
out += SteamLibraryFolders.Mount("/root/Storage", Environment.getExternalStorageDirectory())
return out
}
/** Every library the client lists in libraryfolders.vdf that maps to a folder of the app. */
fun libraries(context: Context, arch: String = activeArch(context)): List<SteamLibraryFolders.Library> {
val root = root(context, arch)
val text = runCatching { File(root, "steamapps/libraryfolders.vdf").readText() }.getOrNull().orEmpty()
return SteamLibraryFolders.resolve(
SteamLibraryFolders.parse(text), guestRoot(arch), aliases(arch), root, mounts(context), LinuxRuntime.rootDir(context),
)
}
private fun canonical(file: File): String = runCatching { file.canonicalPath }.getOrDefault(file.absolutePath)
/** The card and added libraries are written through the raw card view when Android allows it, as the session binds them. */
private fun engineView(context: Context): (File) -> File {
val bases = listOfNotNull(GameStorage.effective(context)?.let { File(it.path) }) + SteamLibraries.list(context).map { it.host }
val seen = HashMap<String, File>()
return { host ->
val path = host.absolutePath
val base = bases.filter { path == it.absolutePath || path.startsWith(it.absolutePath + "/") }.maxByOrNull { it.absolutePath.length }
if (base == null) host else {
val content = seen.getOrPut(base.absolutePath) { SecondaryLibrary.contentPath(base) }
if (content.absolutePath == base.absolutePath) host
else path.removePrefix(base.absolutePath).trimStart('/').let { if (it.isEmpty()) content else File(content, it) }
}
}
}
class EngineLibraries(val libraries: List<Pair<SteamLibraryFolders.Library, File>>) {
val json: String get() = JSONArray().apply {
for ((library, host) in libraries) put(JSONObject().put("host", host.absolutePath).put("guest", library.guest))
}.toString()
fun hostOf(library: SteamLibraryFolders.Library): File =
libraries.firstOrNull { it.first.guest == library.guest }?.second ?: library.host
}
fun engineLibraries(context: Context): EngineLibraries {
val view = engineView(context)
return EngineLibraries(libraries(context).filter { it.host.isDirectory }.map { it to view(it.host) })
}
fun targets(context: Context): List<Target> {
val arch = activeArch(context)
val card = GameStorage.effective(context)?.let { canonical(File(it.path)) }
val known = Library.steamLibraries(context, arch).associate { (host, label) ->
canonical(host) to if (label == "internal") context.getString(R.string.games_internal) else label
}
val engine = engineLibraries(context)
return engine.libraries.mapNotNull { (library, host) ->
if (!library.host.isDirectory || !library.host.canWrite()) return@mapNotNull null
val path = canonical(library.host)
val onCard = card != null && (path == card || path.startsWith("$card/"))
val label = library.label.ifBlank {
if (library.main) context.getString(R.string.stores_target_internal) else known[path] ?: File(library.guest).name
}
Target(library, host, label, StoreInstallRoot.availableBytes(host), removable = onCard, folder = !library.main && !onCard)
}
}
/** True while a session that can run the Steam client is up or starting. */
fun clientMayRun(): Boolean {
val up = SessionState.running || (SessionState.phase != SessionPhase.IDLE && SessionState.phase != SessionPhase.FAILED)
return up && SessionState.mode != SessionService.MODE_RUN
}
}
@@ -0,0 +1,98 @@
package com.droiddeck.launcher.stores.steam
import android.content.Context
import android.os.SystemClock
import android.util.Log
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.stores.StoresNative
import org.json.JSONArray
import org.json.JSONObject
/** Blocking calls into the Rust engine; they reach the network, so never on the main thread. */
internal object SteamEngine {
private const val TAG = "SteamEngine"
const val MISSING = "engine_missing"
const val MISSING_TEXT = "Steam: the store engine is not available"
private const val RETRY_MS = 60_000L
/** After Steam refuses sign-ins for coming too often, wait well past its limit. */
private const val THROTTLED_MS = 30 * 60_000L
private val lock = Any()
@Volatile private var signedIn = false
private var failed: JSONObject? = null
private var failedAt = 0L
fun failure(error: String): JSONObject = JSONObject().put("ok", false).put("error", error)
private fun call(op: String, block: () -> String): JSONObject {
if (!StoresNative.ensureLoaded()) return failure(MISSING)
val text = try {
block()
} catch (e: UnsatisfiedLinkError) {
Log.w(TAG, "$op: not in this engine build")
return failure(MISSING)
} catch (t: Throwable) {
Log.w(TAG, "$op: ${t.javaClass.simpleName}")
return failure(t.javaClass.simpleName)
}
return runCatching { JSONObject(text) }.getOrElse { failure("$op: unreadable answer") }
}
fun signIn(context: Context): JSONObject {
synchronized(lock) {
if (signedIn) return JSONObject().put("ok", true)
failed?.takeIf { SystemClock.elapsedRealtime() - failedAt < waitAfter(it) }?.let { return it }
val roots = JSONArray()
.put(SessionPrefs.steamRoot(context, "arm64").absolutePath)
.put(SessionPrefs.steamRoot(context, SteamClient.X86_64).absolutePath)
val registry = SteamClient.registry(context).absolutePath
val answer = call("signIn") { SteamNative.nativeSignIn(roots.toString(), registry, "") }
signedIn = answer.optBoolean("ok")
failed = if (signedIn) null else answer
failedAt = SystemClock.elapsedRealtime()
if (!signedIn) Log.w(TAG, "sign-in: ${answer.optString("error")}")
return answer
}
}
private fun waitAfter(failure: JSONObject): Long {
val error = failure.optString("error")
return if ("RateLimitExceeded" in error || "Throttle" in error) THROTTLED_MS else RETRY_MS
}
fun forget() {
synchronized(lock) {
failed = null
if (!signedIn) return
signedIn = false
try {
SteamNative.nativeSignOut()
} catch (t: Throwable) {
Log.w(TAG, "sign-out: ${t.javaClass.simpleName}")
}
}
}
private fun signedCall(context: Context, op: String, block: () -> String): JSONObject {
synchronized(lock) {
val signIn = signIn(context)
if (!signIn.optBoolean("ok")) return signIn
val answer = call(op, block)
val error = answer.optString("error").lowercase()
if (!answer.optBoolean("ok") && listOf("logon", "sign", "session", "connect").any { it in error }) signedIn = false
return answer
}
}
fun library(context: Context): JSONObject = signedCall(context, "library") { SteamNative.nativeLibrary() }
fun plan(context: Context, appId: Int, language: String): JSONObject =
signedCall(context, "plan") { SteamNative.nativePlan(appId, language) }
fun uninstall(appId: Int, steamRoot: String, host: String, guest: String, roots: String): JSONObject {
synchronized(lock) {
return call("uninstall") { SteamNative.nativeUninstall(appId, steamRoot, host, guest, roots) }
}
}
}
@@ -0,0 +1,145 @@
package com.droiddeck.launcher.stores.steam
import android.content.Context
import com.droiddeck.launcher.R
import com.droiddeck.launcher.stores.download.DownloadQueue
import com.droiddeck.launcher.stores.download.DownloadStage
import com.droiddeck.launcher.stores.download.StoreDownloadTier
import org.json.JSONObject
import java.io.File
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicReference
/** Called by the engine on its own threads. */
interface SteamInstallListener {
fun onProgress(doneBytes: Long, totalBytes: Long, phase: String?)
fun onComplete(ok: Boolean, result: String?)
}
internal class SteamInstallJob(
private val app: Context,
private val appId: Int,
private val libraryGuest: String,
) : DownloadQueue.DownloadJob {
private val cancelled = AtomicBoolean(false)
private val started = AtomicBoolean(false)
@Volatile private var discard = false
@Volatile private var installDir: String? = null
@Volatile private var libraryHost: File? = null
override fun run(handle: DownloadQueue.JobHandle): String? {
started.set(true)
try {
return install(handle)
} finally {
if (discard) SteamStore.discardPartial(app, appId, libraryGuest, libraryHost, installDir)
}
}
private fun install(handle: DownloadQueue.JobHandle): String? {
handle.stage(DownloadStage.MANIFEST)
if (SteamClient.clientMayRun()) throw IllegalStateException(app.getString(R.string.steam_store_close_steam))
val engine = SteamClient.engineLibraries(app)
val target = engine.libraries.firstOrNull { it.first.guest == libraryGuest }
?: throw IllegalStateException(app.getString(R.string.game_sync_err_steam_library))
libraryHost = target.second
val signIn = SteamEngine.signIn(app)
if (!signIn.optBoolean("ok")) {
SteamStore.signInFailed(app, signIn.optString("error"))
throw IllegalStateException(SteamStore.errorText(app, signIn))
}
val language = SteamClient.language(app)
val (plan, planned) = SteamStore.plan(app, appId, language)
if (plan == null) throw IllegalStateException(SteamStore.errorText(app, planned))
installDir = plan.installDir
if (plan.installBytes > 0) handle.diskSize(plan.installBytes)
if (cancelled.get()) return null
val tier = StoreDownloadTier.current(app)
val journal = File(app.filesDir, "${SteamStore.JOURNAL}/$appId").apply { mkdirs() }
handle.log("steam: $appId tier=${tier.id} window=${tier.networkWindow} process_workers=${tier.processWorkers}")
val done = CountDownLatch(1)
val succeeded = AtomicBoolean(false)
val answer = AtomicReference("")
val listener = object : SteamInstallListener {
private var stage: DownloadStage? = null
private var shown = -1L
override fun onProgress(doneBytes: Long, totalBytes: Long, phase: String?) {
synchronized(this) {
val now = SteamLibraryFolders.stageOf(phase.orEmpty())
if (now != stage) {
stage = now
shown = -1L
}
if (doneBytes < shown) return
shown = doneBytes
if (now == DownloadStage.DOWNLOAD) handle.progress(doneBytes, totalBytes)
else {
handle.stage(now)
if (totalBytes > 0) handle.stageProgress(doneBytes, totalBytes, bytes = true)
}
}
}
override fun onComplete(ok: Boolean, result: String?) {
answer.set(result.orEmpty())
succeeded.set(ok)
done.countDown()
}
}
val native = try {
SteamNative.nativeStart(
appId, language, SteamClient.root(app).absolutePath, target.second.absolutePath, libraryGuest, engine.json,
journal.absolutePath, "", tier.networkWindow.coerceIn(1, 128), tier.processWorkers, listener,
)
} catch (e: UnsatisfiedLinkError) {
throw IllegalStateException(SteamEngine.MISSING_TEXT)
}
if (native == 0L && done.count > 0L) throw IllegalStateException(SteamStore.errorText(app, parse(answer.get())))
if (native != 0L) {
try {
var forwarded = false
while (true) {
val finished = try {
done.await(CANCEL_POLL_MS, TimeUnit.MILLISECONDS)
} catch (e: InterruptedException) {
cancelled.set(true)
false
}
if (finished) break
if (!forwarded && cancelled.get()) {
runCatching { SteamNative.nativeCancel(native) }
forwarded = true
}
}
} finally {
runCatching { SteamNative.nativeRelease(native) }
}
}
val result = parse(answer.get())
if (succeeded.get() && result.optBoolean("ok", true)) {
journal.deleteRecursively()
SteamStore.scanInstalled(app)
return File(target.first.host, "steamapps/common/${plan.installDir}").path
}
if (cancelled.get() || result.optString("error") == "cancelled") return null
throw IllegalStateException(SteamStore.errorText(app, result))
}
private fun parse(text: String): JSONObject =
runCatching { JSONObject(text) }.getOrElse { SteamEngine.failure(text.ifBlank { "install failed" }) }
override fun cancel(deleteFiles: Boolean) {
cancelled.set(true)
if (!deleteFiles) return
discard = true
if (!started.get()) SteamStore.discardPartial(app, appId, libraryGuest, null, null)
}
private companion object {
const val CANCEL_POLL_MS = 250L
}
}
@@ -0,0 +1,150 @@
package com.droiddeck.launcher.stores.steam
import com.droiddeck.launcher.storage.SteamStorage
import com.droiddeck.launcher.stores.download.DownloadStage
import java.io.File
internal object SteamLibraryFolders {
data class Folder(val path: String, val label: String)
class Mount(guest: String, val host: File) {
val guest: String = guest.trimEnd('/')
}
data class Library(val guest: String, val host: File, val label: String, val main: Boolean)
data class Installed(val appId: Int, val name: String, val installDir: String?, val library: Library, val sizeOnDisk: Long)
/** Guest folders that exist only as binds of the session; without their bind they are empty mount points in the rootfs. */
val BIND_ONLY = listOf("/mnt", "/media", "/storage", "/sdcard", "/root/Storage", "/root/ROMs", "/root/Games")
private val TOKEN = Regex("\"((?:\\\\.|[^\"\\\\])*)\"|[{}]|//[^\n]*")
private val ACF = Regex("appmanifest_\\d+\\.acf")
private val SIZE_ON_DISK = Regex("^\\s*\"SizeOnDisk\"\\s*\"(\\d+)\"", setOf(RegexOption.MULTILINE, RegexOption.IGNORE_CASE))
private fun walk(text: String, pair: (blocks: List<String>, key: String, value: String) -> Unit, closed: (blocks: List<String>) -> Unit = {}) {
val blocks = ArrayList<String>()
var key: String? = null
for (m in TOKEN.findAll(text)) {
val token = m.value
when {
token.startsWith("//") -> {}
token == "{" -> { blocks.add(key.orEmpty()); key = null }
token == "}" -> { if (blocks.isNotEmpty()) { closed(blocks); blocks.removeAt(blocks.lastIndex) }; key = null }
key == null -> key = unescape(m.groupValues[1])
else -> { pair(blocks, key, unescape(m.groupValues[1])); key = null }
}
}
}
private fun unescape(s: String): String {
if ('\\' !in s) return s
val out = StringBuilder(s.length)
var i = 0
while (i < s.length) {
if (s[i] == '\\' && i + 1 < s.length) { out.append(s[i + 1]); i += 2 } else { out.append(s[i]); i++ }
}
return out.toString()
}
private fun inRoot(blocks: List<String>) = blocks.firstOrNull()?.equals("libraryfolders", ignoreCase = true) == true
fun parse(text: String): List<Folder> {
val out = ArrayList<Folder>()
var path: String? = null
var label = ""
walk(text, pair = { blocks, key, value ->
if (!inRoot(blocks)) return@walk
if (blocks.size == 1 && key.isNotEmpty() && key.all(Char::isDigit)) out += Folder(value, "")
if (blocks.size == 2) when (key.lowercase()) {
"path" -> path = value
"label" -> label = value
}
}, closed = { blocks ->
if (blocks.size == 2 && inRoot(blocks)) path?.let { out += Folder(it, label) }
if (blocks.size == 2) { path = null; label = "" }
})
return out
}
fun normalize(path: String): String? {
val p = path.trim().replace(Regex("/+"), "/").trimEnd('/')
if (!p.startsWith("/") || p.split('/').any { it == ".." || it == "." }) return null
return p
}
private fun under(path: String, prefix: String) = path == prefix || path.startsWith("$prefix/")
fun hostFor(guest: String, mounts: List<Mount>, rootfs: File): File? {
val path = normalize(guest) ?: return null
mounts.filter { it.guest.isNotEmpty() && under(path, it.guest) }.maxByOrNull { it.guest.length }?.let { m ->
val rest = path.removePrefix(m.guest).trimStart('/')
return if (rest.isEmpty()) m.host else File(m.host, rest)
}
if (BIND_ONLY.any { under(path, it) } || !under(path, "/root")) return null
return File(rootfs, path.removePrefix("/"))
}
fun resolve(folders: List<Folder>, mainGuest: String, aliases: Collection<String>, mainHost: File, mounts: List<Mount>, rootfs: File): List<Library> {
val mains = (aliases + mainGuest).mapNotNull(::normalize).toSet()
val listed = if (folders.any { normalize(it.path) in mains }) folders else listOf(Folder(mainGuest, "")) + folders
val out = ArrayList<Library>()
for (f in listed) {
val guest = normalize(f.path) ?: continue
val main = guest in mains
val host = if (main) mainHost else hostFor(guest, mounts, rootfs) ?: continue
if (out.any { it.host.path == host.path || (main && it.main) }) continue
out += Library(guest, host, f.label.trim(), main)
}
return out.sortedByDescending { it.main }
}
fun installed(libraries: List<Library>, read: (File) -> String? = { runCatching { it.readText() }.getOrNull() }): Map<Int, Installed> {
val out = LinkedHashMap<Int, Installed>()
for (library in libraries) {
val apps = File(library.host, "steamapps")
val names = apps.list() ?: continue
for (name in names.sorted()) {
if (!ACF.matches(name)) continue
val file = File(apps, name)
val text = read(file) ?: continue
val manifest = SteamStorage.parseManifest(file, text) ?: continue
if (!manifest.installed || SteamStorage.isTool(manifest) || manifest.appId in out) continue
val size = SIZE_ON_DISK.find(text)?.groupValues?.get(1)?.toLongOrNull() ?: 0L
out[manifest.appId] = Installed(manifest.appId, manifest.name, manifest.installDir, library, size)
}
}
return out
}
/** The account the client signs in with by itself: remembered, the most recent one first. */
fun savedAccount(loginUsers: String): String? {
val users = LinkedHashMap<String, HashMap<String, String>>()
walk(loginUsers, pair = { blocks, key, value ->
if (blocks.size == 2 && blocks[0].equals("users", ignoreCase = true)) users.getOrPut(blocks[1]) { HashMap() }[key.lowercase()] = value
})
val remembered = users.values.filter { it["rememberpassword"] == "1" }
val user = remembered.firstOrNull { it["mostrecent"] == "1" }
?: remembered.maxByOrNull { it["timestamp"]?.toLongOrNull() ?: 0L }
?: return null
return user["personaname"]?.takeIf { it.isNotBlank() } ?: user["accountname"]?.takeIf { it.isNotBlank() }
}
fun language(registry: String): String? {
var found: String? = null
walk(registry, pair = { blocks, key, value ->
if (found == null && key.equals("language", ignoreCase = true) && blocks.lastOrNull().equals("Steam", ignoreCase = true) && value.isNotBlank()) found = value
})
return found
}
fun stageOf(phase: String): DownloadStage {
val p = phase.lowercase()
return when {
"verif" in p || "validat" in p -> DownloadStage.VERIFY
listOf("install", "regist", "final", "commit", "acf", "apply").any { it in p } -> DownloadStage.INSTALL
listOf("manifest", "plan", "prepar", "check", "scan", "clean", "alloc", "connect", "logon", "login", "sign").any { it in p } -> DownloadStage.MANIFEST
else -> DownloadStage.DOWNLOAD
}
}
}
@@ -0,0 +1,12 @@
package com.droiddeck.launcher.stores.steam
object SteamNative {
@JvmStatic external fun nativeSignIn(steamRootsJson: String, registryVdfPath: String, caBundlePath: String): String
@JvmStatic external fun nativeSignOut()
@JvmStatic external fun nativeLibrary(): String
@JvmStatic external fun nativePlan(appId: Int, language: String): String
@JvmStatic external fun nativeStart(appId: Int, language: String, steamRoot: String, gameLibraryHost: String, gameLibraryGuest: String, libraryRootsJson: String, journalDir: String, caBundlePath: String, maxWorkers: Int, processWorkers: Int, listener: Any): Long
@JvmStatic external fun nativeCancel(handle: Long)
@JvmStatic external fun nativeRelease(handle: Long)
@JvmStatic external fun nativeUninstall(appId: Int, steamRoot: String, gameLibraryHost: String, gameLibraryGuest: String, libraryRootsJson: String): String
}
@@ -0,0 +1,346 @@
package com.droiddeck.launcher.stores.steam
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.util.Log
import android.widget.Toast
import androidx.annotation.StringRes
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import com.droiddeck.launcher.R
import com.droiddeck.launcher.frontend.Library
import com.droiddeck.launcher.session.SessionService
import com.droiddeck.launcher.storage.SteamStorage
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.StoreInstallRoot
import com.droiddeck.launcher.stores.StoreInstalls
import com.droiddeck.launcher.stores.StoreShelves
import com.droiddeck.launcher.stores.StoreSizes
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.DownloadState
import com.droiddeck.launcher.stores.download.SavedQueue
import com.droiddeck.launcher.stores.formatBytes
import org.json.JSONArray
import org.json.JSONObject
import java.io.File
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.Executors
/** Games land in the active client's own libraries, registered as the client does, and only while no session can run the client. */
internal object SteamStore {
private const val TAG = "SteamStore"
private const val PREFS = "steam-store"
internal const val JOURNAL = "steam-store/journal"
private const val CDN = "https://cdn.cloudflare.steamstatic.com/steam/apps/"
private const val LIBRARY = "library"
private const val LIBRARY_LABEL = "libraryLabel"
private val SIGNED_OUT = setOf("no_saved_login", "remember_me_off", "decrypt_failed")
var installed by mutableStateOf<Map<Int, SteamLibraryFolders.Installed>>(emptyMap())
private set
var picking by mutableStateOf<CatalogItem?>(null)
class Plan(val installDir: String, val downloadBytes: Long, val installBytes: Long, val buildId: String) {
companion object {
fun of(json: JSONObject): Plan? {
if (!json.optBoolean("ok")) return null
val dir = json.optString("installDir").takeIf { SteamStore.validDir(it) } ?: return null
return Plan(dir, json.optLong("downloadBytes"), json.optLong("installBytes"), json.optString("buildId"))
}
}
}
private val plans = ConcurrentHashMap<Int, Plan>()
private val work = Executors.newSingleThreadExecutor { r -> Thread(r, "steam-store") }
@Volatile private var rejectedThisRun: String? = null
fun key(appId: Int): String = "${Store.STEAM.id}:$appId"
private fun validDir(dir: String) = dir.isNotBlank() && dir != "." && dir != ".." && '/' !in dir && '\\' !in dir
private fun prefs(context: Context) = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
private fun toast(context: Context, @StringRes text: Int) {
val app = context.applicationContext
StoresState.post { Toast.makeText(app, text, Toast.LENGTH_LONG).show() }
}
internal fun isSignInError(error: String) = error in SIGNED_OUT || error.startsWith("logon_failed")
internal fun errorText(context: Context, answer: JSONObject): String {
val error = answer.optString("error")
return when {
error == SteamEngine.MISSING -> SteamEngine.MISSING_TEXT
isSignInError(error) -> context.getString(R.string.stores_login_title, Store.STEAM.label)
error.isBlank() -> "Steam: install failed"
else -> error
}
}
private fun fingerprint(context: Context): String {
val users = SteamClient.loginUsers(context)
val registry = SteamClient.registry(context)
return "${SteamClient.activeArch(context)}:${users.lastModified()}:${users.length()}:${registry.lastModified()}:${registry.length()}"
}
private fun savedAccount(context: Context): String? {
val print = fingerprint(context)
if (print == rejectedThisRun || print == prefs(context).getString("rejected", null)) return null
return runCatching { SteamLibraryFolders.savedAccount(SteamClient.loginUsers(context).readText()) }.getOrNull()
}
/** Mirrors the client's saved sign-in into the store account; reads storage. */
fun syncAccount(context: Context): Boolean {
val name = savedAccount(context)
if (name == StoreAccounts.signedInAs(context, Store.STEAM)) return false
if (name == null) StoreAccounts.clear(context, Store.STEAM)
else StoreAccounts.write(context, Store.STEAM, JSONObject().put("display_name", name))
SteamEngine.forget()
StoresState.post {
StoresState.library.remove(Store.STEAM)
StoresState.problems.remove(Store.STEAM)
}
Log.i(TAG, if (name == null) "no saved Steam sign-in" else "Steam sign-in found")
return true
}
internal fun signInFailed(context: Context, error: String) {
if (error == SteamEngine.MISSING) return
val print = fingerprint(context)
rejectedThisRun = print
if (error in SIGNED_OUT) prefs(context).edit().putString("rejected", print).apply()
StoreAccounts.clear(context, Store.STEAM)
StoresState.logLine("Steam: the saved sign-in was not accepted ($error)")
StoresState.post {
StoresState.accounts.remove(Store.STEAM)
StoresState.library.remove(Store.STEAM)
}
}
fun poll(context: Context) {
val app = context.applicationContext
work.execute {
val changed = runCatching { syncAccount(app) }.getOrDefault(false)
runCatching { scanInstalled(app) }
if (changed) StoresState.notifyLibraryChanged(app)
}
}
private class Read(val modified: Long, val length: Long, val text: String)
private val manifests = ConcurrentHashMap<String, Read>()
private fun readManifest(file: File): String? {
val modified = file.lastModified()
val length = file.length()
manifests[file.path]?.takeIf { it.modified == modified && it.length == length }?.let { return it.text }
val text = runCatching { file.readText() }.getOrNull() ?: return null
manifests[file.path] = Read(modified, length, text)
return text
}
/** Owned games count as installed when an appmanifest with StateFlags 4 is in one of the active client's libraries. */
fun scanInstalled(context: Context) {
val found = SteamLibraryFolders.installed(SteamClient.libraries(context), ::readManifest)
StoresState.post {
if (found != installed) installed = found
for ((id, game) in found) if (game.sizeOnDisk > 0 && StoreSizes.onDisk[key(id)] != game.sizeOnDisk) StoreSizes.onDisk[key(id)] = game.sizeOnDisk
}
}
fun downloading(): Boolean = StoresState.latestDownloads.any {
it.store == Store.STEAM && (it.state == DownloadState.RUNNING || it.state == DownloadState.QUEUED)
}
/** A Steam store download holds every session that could start the Steam client. */
fun blocksSession(intent: Intent?): Boolean {
val mode = intent?.getStringExtra(SessionService.EXTRA_MODE) ?: SessionService.MODE_STEAM
return mode != SessionService.MODE_RUN && downloading()
}
internal fun syncLibrary(context: Context, force: Boolean) {
val app = context.applicationContext
if (force) plans.clear()
work.execute {
val answer = SteamEngine.library(app)
if (!answer.optBoolean("ok")) {
val error = answer.optString("error")
if (isSignInError(error)) signInFailed(app, error)
else StoresState.post {
StoresState.problems[Store.STEAM] = errorText(app, answer)
StoresState.library[Store.STEAM] = emptyList()
}
return@execute
}
val art = runCatching { Library.steamLibraryArt(app).toMap() }.getOrDefault(emptyMap())
val items = items(answer.optJSONArray("games"), art)
runCatching { scanInstalled(app) }
StoresState.logLine("Steam: library has ${items.size} games")
StoresState.post {
StoresState.problems.remove(Store.STEAM)
StoresState.library[Store.STEAM] = items
}
}
}
private fun items(games: JSONArray?, art: Map<Int, File>): List<CatalogItem> {
val out = ArrayList<CatalogItem>()
for (i in 0 until (games?.length() ?: 0)) {
val game = games?.optJSONObject(i) ?: continue
val id = game.optInt("appId").takeIf { it > 0 } ?: continue
val type = game.optString("type").lowercase()
if (type.isNotEmpty() && type != "game") continue
val name = game.optString("name").takeIf { it.isNotBlank() } ?: continue
out += CatalogItem(
Store.STEAM, id.toString(), name,
imageUrl = "$CDN$id/header.jpg",
tallImageUrl = art[id]?.let { Uri.fromFile(it).toString() } ?: "$CDN$id/library_600x900.jpg",
isFree = game.optBoolean("free"),
storeUrl = "https://store.steampowered.com/app/$id/",
owned = true,
)
}
return out.distinctBy { it.id }.sortedBy { it.title.lowercase() }
}
internal fun shelves(context: Context): StoreShelves {
val art = runCatching { Library.steamLibraryArt(context) }.getOrDefault(emptyList()).map { Uri.fromFile(it.second).toString() }
return StoreShelves(art = art)
}
/** Reaches the network; call off the main thread. */
internal fun plan(context: Context, appId: Int, language: String = SteamClient.language(context)): Pair<Plan?, JSONObject> {
plans[appId]?.let { return it to JSONObject().put("ok", true) }
val answer = SteamEngine.plan(context, appId, language)
val plan = Plan.of(answer)
val error = answer.optString("error")
if (plan != null) plans[appId] = plan
else if (isSignInError(error)) signInFailed(context, error)
return plan to answer
}
internal fun plannedBytes(context: Context, item: CatalogItem): Long =
item.id.toIntOrNull()?.let { plan(context, it).first?.installBytes } ?: 0L
fun requestInstall(context: Context, item: CatalogItem) {
if (SteamClient.clientMayRun()) {
toast(context, R.string.steam_store_close_steam)
return
}
picking = item
}
fun install(context: Context, item: CatalogItem, target: SteamClient.Target) {
val app = context.applicationContext
val appId = item.id.toIntOrNull() ?: return
if (SteamClient.clientMayRun()) {
toast(app, R.string.steam_store_close_steam)
return
}
val plan = plans[appId]
val needed = plan?.installBytes ?: 0L
val tagged = item.copy(extra = item.extra + mapOf(LIBRARY to target.library.guest, LIBRARY_LABEL to target.label))
val entry = DownloadEntry(
Store.STEAM, item.id, item.title, cover = item.imageUrl,
bytesTotal = plan?.downloadBytes ?: 0L, location = target.label,
)
SavedQueue.remember(app, tagged, target.library.host)
if (StoreInstallRoot.insufficientSpace(needed, target.freeBytes)) {
val error = app.getString(R.string.stores_storage_insufficient, formatBytes(needed), formatBytes(target.freeBytes))
DownloadQueue.recordFailed(app, entry, error) { requestInstall(app, item) }
return
}
DownloadQueue.enqueue(app, entry) { SteamInstallJob(app, appId, target.library.guest) }
}
internal fun restore(context: Context, item: CatalogItem) {
val app = context.applicationContext
val appId = item.id.toIntOrNull() ?: return
val guest = item.extra[LIBRARY] ?: return
SavedQueue.remember(app, item, null)
val entry = DownloadEntry(Store.STEAM, item.id, item.title, cover = item.imageUrl, location = item.extra[LIBRARY_LABEL].orEmpty())
DownloadQueue.enqueue(app, entry) { SteamInstallJob(app, appId, guest) }
}
fun uninstall(context: Context, appId: Int, onDone: () -> Unit = {}) {
val app = context.applicationContext
if (SteamClient.clientMayRun()) {
toast(app, R.string.steam_store_close_steam)
return
}
val key = key(appId)
if (key in StoresState.uninstalling) return
StoresState.uninstalling[key] = 0f
Thread({
val answer = runCatching {
val game = SteamLibraryFolders.installed(SteamClient.libraries(app))[appId]
if (game == null) JSONObject().put("ok", true)
else {
val engine = SteamClient.engineLibraries(app)
SteamEngine.uninstall(appId, SteamClient.root(app).absolutePath, engine.hostOf(game.library).absolutePath, game.library.guest, engine.json)
}
}.getOrElse { SteamEngine.failure(it.javaClass.simpleName) }
val ok = answer.optBoolean("ok")
StoresState.logLine(if (ok) "Steam: uninstalled $appId" else "Steam: uninstall of $appId failed: ${answer.optString("error")}")
runCatching { scanInstalled(app) }
StoresState.post {
StoresState.uninstalling.remove(key)
if (ok) StoreSizes.onDisk.remove(key)
else Toast.makeText(app, errorText(app, answer), Toast.LENGTH_LONG).show()
onDone()
}
}, "steam-uninstall").start()
}
/** Removes what a cancelled download left; a finished install stays. */
internal fun discardPartial(context: Context, appId: Int, guest: String, host: File?, installDir: String?) {
File(context.filesDir, "$JOURNAL/$appId").deleteRecursively()
val library = host ?: runCatching {
SteamClient.engineLibraries(context).libraries.firstOrNull { it.first.guest == guest }?.second
}.getOrNull() ?: return
val apps = File(library, "steamapps")
val acf = File(apps, "appmanifest_$appId.acf")
val manifest = acf.takeIf { it.isFile }?.let { f -> runCatching { SteamStorage.parseManifest(f, f.readText()) }.getOrNull() }
if (manifest?.installed == true) return
val dir = (installDir ?: manifest?.installDir ?: plans[appId]?.installDir)?.takeIf { validDir(it) }
if (dir != null) StoreInstalls.deleteTree(File(apps, "common/$dir"))
StoreInstalls.deleteTree(File(apps, "downloading/$appId"))
if (manifest != null) acf.delete()
StoresState.logLine("Steam: removed the unfinished download of $appId")
}
}
internal object SteamBackend : StoreBackend {
override val store: Store = Store.STEAM
override fun signIn(context: Context) {
StoresState.logLine("Steam: sign in from the Steam client")
}
override fun signOut(context: Context) = SteamEngine.forget()
override fun syncLibrary(context: Context, force: Boolean) = SteamStore.syncLibrary(context, force)
override fun loadShelves(context: Context, force: Boolean) {
val app = context.applicationContext
Thread({
val shelves = SteamStore.shelves(app)
StoresState.post { StoresState.shelves[store] = shelves }
}, "steam-shelves").start()
}
override fun search(context: Context, query: String): List<CatalogItem> =
StoresState.library[store].orEmpty().filter { it.title.contains(query, ignoreCase = true) }
override fun install(context: Context, item: CatalogItem, root: File) = SteamStore.restore(context, item)
override fun uninstall(context: Context, game: InstalledStoreGame) {}
}
@@ -49,7 +49,9 @@ import androidx.compose.ui.input.InputMode
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalConfiguration
import android.content.Context
import androidx.compose.runtime.DisposableEffect
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
@@ -60,6 +62,8 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import coil.compose.AsyncImage
import com.droiddeck.launcher.R
import com.droiddeck.launcher.frontend.AddedGameArt
@@ -192,7 +196,7 @@ internal fun SteamGameArtEditor(
game: com.droiddeck.launcher.frontend.Library.SteamGame, onClose: () -> Unit, onChanged: () -> Unit,
) {
val target = remember(game.appId) { ArtTarget.of(game) }
ArtOnlyEditor(game.name, target, game, { SteamGameArt.describe(it, game) }, onClose, onChanged, launchAppId = game.appId)
ArtOnlyEditor(game.name, target, game, { SteamGameArt.describe(it, game) }, onClose, onChanged)
}
@Composable
@@ -208,25 +212,17 @@ internal fun StoreGameArtEditor(folder: String, name: String, onClose: () -> Uni
@Composable
private fun ArtOnlyEditor(
name: String, target: ArtTarget?, refresh: Any?, describe: (Context) -> List<AddedGameArt.SlotState>,
onClose: () -> Unit, onChanged: () -> Unit, launchAppId: Int? = null,
onClose: () -> Unit, onChanged: () -> Unit,
) {
val app = LocalContext.current.applicationContext
val colors = MaterialTheme.colorScheme
val scope = rememberCoroutineScope()
val shown = rememberShown(onClose)
val close = { shown.targetState = false }
var version by remember { mutableIntStateOf(0) }
var arts by remember { mutableStateOf<List<AddedGameArt.SlotState>>(emptyList()) }
var artSlot by remember { mutableStateOf<AddedGameArt.Slot?>(null) }
var logoOpen by remember { mutableStateOf(false) }
var launchOptions by remember { mutableStateOf<String?>(null) }
var launchVersion by remember { mutableIntStateOf(0) }
var editingLaunch by remember { mutableStateOf<String?>(null) }
var launchSaving by remember { mutableStateOf(false) }
var launchError by remember { mutableStateOf<Int?>(null) }
val position = rememberLogoPosition(target, version)
LaunchedEffect(version, refresh) { if (target != null) arts = withContext(Dispatchers.IO) { describe(app) } }
LaunchedEffect(launchAppId, launchVersion) { if (launchAppId != null) launchOptions = withContext(Dispatchers.IO) { SteamLaunchOptions.current(app, launchAppId) } }
val first = remember { FocusRequester() }
LaunchedEffect(Unit) { focusWithinFrames({ false }) { first } }
AppDialog(shown, close, "artEditor", wide = false, maxWidth = 460.dp) {
@@ -236,19 +232,10 @@ private fun ArtOnlyEditor(
verticalArrangement = Arrangement.spacedBy(6.dp),
modifier = Modifier.fillMaxWidth().heightIn(max = maxHeight).verticalScroll(rememberScrollState()),
) {
if (launchAppId != null) {
FieldRow(stringResource(R.string.edit_launch_options), focus = first, onClick = { if (!launchSaving) launchOptions?.let { editingLaunch = it } }) {
val options = launchOptions
if (options == null || launchSaving) Loading() else ValueText(options.ifEmpty { "—" }, muted = options.isEmpty())
}
val error = launchError
if (error != null) Text(stringResource(error), fontSize = 12.sp, color = colors.error, modifier = Modifier.padding(start = 4.dp))
else Text(stringResource(R.string.edit_launch_options_steam_hint), fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(start = 4.dp))
}
Text(stringResource(R.string.edit_artwork), fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(start = 4.dp, top = if (launchAppId != null) 8.dp else 2.dp))
Text(stringResource(R.string.edit_artwork), fontSize = 12.sp, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(start = 4.dp, top = 2.dp))
for (slot in AddedGameArt.Slot.values()) key(slot) {
val state = arts.firstOrNull { it.slot == slot }
FieldRow(slot.label(), focus = if (slot == AddedGameArt.Slot.COVER && launchAppId == null) first else null, onClick = { if (target != null) artSlot = slot }) {
FieldRow(slot.label(), focus = if (slot == AddedGameArt.Slot.COVER) first else null, onClick = { if (target != null) artSlot = slot }) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp)) {
SlotThumb(slot, state?.file)
if (state != null) ValueText(artSourceLabel(state.source), muted = true) else Loading()
@@ -258,27 +245,6 @@ private fun ArtOnlyEditor(
PickerRow(Icons.Outlined.Tune, stringResource(R.string.art_adjust_logo), logoPositionSummary(position?.value), enabled = target != null && position != null) { logoOpen = true }
}
}
val before = editingLaunch
if (before != null && launchAppId != null) TextEntryDialog(stringResource(R.string.edit_launch_options), before, onDismiss = { editingLaunch = null }) { value ->
if (launchSaving || value == before.trim()) return@TextEntryDialog
launchSaving = true
scope.launch {
try {
val saved = withContext(Dispatchers.IO) { SteamLaunchOptions.set(app, launchAppId, value, before) }
launchError = when (saved) {
SteamLaunchOptions.Saved.YES -> null
SteamLaunchOptions.Saved.DESKTOP -> R.string.edit_launch_options_desktop
SteamLaunchOptions.Saved.NO -> R.string.edit_launch_options_not_saved
}
if (saved == SteamLaunchOptions.Saved.YES) launchOptions = value else {
launchOptions = null
launchVersion++
}
} finally {
launchSaving = false
}
}
}
val chosen = target ?: return
artSlot?.let { slot ->
ArtChooserDialog(chosen, slot, arts.firstOrNull { it.slot == slot }, onBack = { artSlot = null }, onCloseAll = { artSlot = null; close() }) { version++; onChanged() }
@@ -287,6 +253,72 @@ private fun ArtOnlyEditor(
if (logoOpen && loaded != null) LogoPositionHost(chosen, arts, loaded, onBack = { logoOpen = false }, onCloseAll = { logoOpen = false; close() }) { version++; onChanged() }
}
@Composable
internal fun SteamLaunchOptionsPanel(appId: Int) {
val app = LocalContext.current.applicationContext
val colors = MaterialTheme.colorScheme
val scope = rememberCoroutineScope()
var options by remember(appId) { mutableStateOf<String?>(null) }
var version by remember(appId) { mutableIntStateOf(0) }
var editing by remember(appId) { mutableStateOf<String?>(null) }
var saving by remember(appId) { mutableStateOf(false) }
var loading by remember(appId) { mutableStateOf(false) }
var error by remember(appId) { mutableStateOf<Int?>(null) }
LaunchedEffect(appId, version) {
options = withContext(Dispatchers.IO) { SteamLaunchOptions.current(app, appId) } ?: options.orEmpty()
loading = false
}
val lifecycle = LocalLifecycleOwner.current.lifecycle
DisposableEffect(lifecycle, appId) {
val observer = LifecycleEventObserver { _, event ->
if (event == Lifecycle.Event.ON_RESUME && !saving) {
loading = true
version++
}
}
lifecycle.addObserver(observer)
onDispose { lifecycle.removeObserver(observer) }
}
Column(Modifier.fillMaxWidth().tabPanel(), verticalArrangement = Arrangement.spacedBy(2.dp)) {
val value = options
MenuItem(
stringResource(R.string.edit_launch_options), checked = false, enabled = value != null && !saving && !loading,
detail = if (value == null || saving || loading) "…" else value.ifEmpty { "—" },
) { if (!saving && !loading) options?.let { editing = it } }
val message = error
Text(
stringResource(message ?: R.string.edit_launch_options_steam_hint),
fontSize = 12.sp,
color = if (message == null) colors.onSurfaceVariant else colors.error,
modifier = Modifier.padding(start = 4.dp),
)
}
val before = editing
if (before != null) TextEntryDialog(stringResource(R.string.edit_launch_options), before, onDismiss = { editing = null }) { value ->
if (saving || value == before.trim()) return@TextEntryDialog
saving = true
scope.launch {
try {
val saved = withContext(Dispatchers.IO) { SteamLaunchOptions.set(app, appId, value, before) }
error = when (saved) {
SteamLaunchOptions.Saved.YES -> null
SteamLaunchOptions.Saved.DESKTOP -> R.string.edit_launch_options_desktop
SteamLaunchOptions.Saved.NO -> R.string.edit_launch_options_not_saved
}
if (saved == SteamLaunchOptions.Saved.YES) {
options = value
version++
} else {
options = null
version++
}
} finally {
saving = false
}
}
}
}
private class LoadedPosition(val value: LogoPosition.Value?)
@Composable
@@ -11,6 +11,7 @@ import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material3.Button
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@@ -110,7 +111,16 @@ internal class BottomScreenTextInput(private val fallback: TextInputService) : P
}
@Composable
internal fun TypingPanel(request: TypingRequest, onDone: () -> Unit) {
internal fun TypingPanel(
request: TypingRequest,
modifier: Modifier = Modifier.fillMaxSize(),
title: String = stringResource(R.string.dual_typing_title),
done: String = stringResource(R.string.dual_typing_done),
onCancel: (() -> Unit)? = null,
leading: (@Composable () -> Unit)? = null,
showKeyboard: Boolean = true,
onDone: () -> Unit,
) {
val colors = MaterialTheme.colorScheme
var field by remember(request) { mutableStateOf(request.value) }
LaunchedEffect(request.value) {
@@ -120,19 +130,22 @@ internal fun TypingPanel(request: TypingRequest, onDone: () -> Unit) {
val keyboard = LocalSoftwareKeyboardController.current
LaunchedEffect(request) {
kotlinx.coroutines.delay(120)
if (!showKeyboard) return@LaunchedEffect
runCatching { focus.requestFocus() }
keyboard?.show()
}
val options = request.imeOptions
val secret = options.keyboardType == KeyboardType.Password || options.keyboardType == KeyboardType.NumberPassword
Column(
Modifier.fillMaxSize().background(colors.background).padding(horizontal = 20.dp, vertical = 14.dp),
modifier.background(colors.background).padding(horizontal = 20.dp, vertical = 14.dp),
verticalArrangement = Arrangement.spacedBy(10.dp),
) {
Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
Text(stringResource(R.string.dual_typing_title), fontSize = 15.sp, fontWeight = FontWeight.SemiBold,
Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
leading?.invoke()
Text(title, fontSize = 15.sp, fontWeight = FontWeight.SemiBold,
color = colors.onSurfaceVariant, modifier = Modifier.weight(1f))
Button(onClick = onDone, modifier = Modifier.testTag("dual-typing-done")) { Text(stringResource(R.string.dual_typing_done)) }
if (onCancel != null) OutlinedButton(onClick = onCancel, modifier = Modifier.testTag("dual-typing-cancel")) { Text(stringResource(R.string.common_cancel)) }
Button(onClick = onDone, modifier = Modifier.testTag("dual-typing-done")) { Text(done) }
}
OutlinedTextField(
value = field,
@@ -81,6 +81,8 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.droiddeck.launcher.R
import com.droiddeck.launcher.session.ComponentUpdater
import com.droiddeck.launcher.session.ComponentUpdates
import com.droiddeck.launcher.session.ComponentsManager
import com.droiddeck.launcher.session.ComponentsManager.CatalogItem
import com.droiddeck.launcher.session.ComponentsManager.Snapshot
@@ -163,6 +165,11 @@ fun ComponentsPage(
protons: ProtonsState = ProtonsState(),
protonActions: ProtonsActions = ProtonsActions(),
protonOptions: @Composable () -> Unit = {},
compModes: Map<String, String> = emptyMap(),
compAuto: Map<String, List<ComponentUpdater.Status>> = emptyMap(),
compAutoHeld: Set<String> = emptySet(),
compAutoChecking: Boolean = false,
onCompMode: (String, String) -> Unit = { _, _ -> },
) {
val colors = MaterialTheme.colorScheme
val pal = LocalPalette.current
@@ -521,6 +528,9 @@ fun ComponentsPage(
else -> stringResource(R.string.comp_nightlies_count, availableRows(l, catalog, snapshot).size)
}
}
val followed = view?.proton?.let(ComponentUpdates::follows) == true
val moded: (String) -> Boolean = { followed && it in compModes && it !in compAutoHeld && !ComponentsManager.runtimeManaged(it, gpu.systemPowerVr) }
val automatic: (String) -> Boolean = { moded(it) && compModes[it] == ComponentUpdates.AUTO }
val installedRows: @Composable ColumnScope.(String, Boolean) -> Unit = { l, right ->
when (l) {
PROTON_TAB -> {
@@ -535,7 +545,7 @@ fun ComponentsPage(
(if (swaps > 0) stringResource(R.string.comp_swapped, v.proton.version, swaps) else stringResource(R.string.comp_all_original, v.proton.version))
.let { if (v.inUseByGame) stringResource(R.string.comp_game_running_suffix, it) else it },
v.proton.id == view?.proton?.id, removable = removable,
modifier = (if (i == 0) Modifier.focusRequester(firstRow) else Modifier).trackRow(key, rowsAt),
modifier = (if (i == 0 && !moded(l)) Modifier.focusRequester(firstRow) else Modifier).trackRow(key, rowsAt),
onSelect = { if (v.proton.id != view?.proton?.id) { onProton(v.proton.id); flyHome(key, PROTON_TAB) } },
onDelete = {
if (extra != null) ask(key, right, ctx.getString(R.string.proton_remove_title, v.proton.name), ctx.getString(R.string.proton_remove_body), ctx.getString(R.string.store_remove), true, v.proton.name) {
@@ -555,7 +565,7 @@ fun ComponentsPage(
val key = "row:$l:${item.file ?: item.protonVersion}"
ChoiceLine(
item.name, item.detail, item.selected, item.removable, tag = item.tag, enabled = !managedDxvk,
modifier = (if (i == 0 && !managedDxvk) Modifier.focusRequester(firstRow) else Modifier).trackRow(key, rowsAt),
modifier = (if (i == 0 && !managedDxvk && !moded(l)) Modifier.focusRequester(firstRow) else Modifier).trackRow(key, rowsAt),
onSelect = {
if (managedDxvk || item.selected || p == null) return@ChoiceLine
val waits = if (view.inUseByGame) ctx.getString(R.string.comp_waits_long) else ctx.getString(R.string.comp_applies_long)
@@ -680,15 +690,31 @@ fun ComponentsPage(
label = "layerRows",
) { k -> body(k) }
}
if (single) {
slide { k -> RowGroup(installedTitle(k)) { installedRows(k, false) } }
Spacer(Modifier.height(12.dp))
slide { k -> RowGroup(availableTitle(k)) { availableRows(k) } }
} else Row(horizontalArrangement = Arrangement.spacedBy(14.dp), verticalAlignment = Alignment.Top) {
Column(Modifier.weight(1f)) { slide { k -> RowGroup(installedTitle(k)) { installedRows(k, false) } } }
Column(Modifier.weight(1f)) { slide { k -> RowGroup(availableTitle(k)) { availableRows(k) } } }
if (moded(l)) slide { k ->
if (moded(k)) Column(verticalArrangement = Arrangement.spacedBy(14.dp), modifier = Modifier.padding(bottom = 14.dp)) {
PanelHeading(stringResource(R.string.comp_mode_title))
ModeChoices(
listOf(
Triple(ComponentUpdates.AUTO, R.string.common_auto, R.string.comp_mode_auto_detail),
Triple(ComponentUpdates.MANUAL, R.string.drivers_manual, R.string.comp_mode_manual_detail),
),
if (automatic(k)) ComponentUpdates.AUTO else ComponentUpdates.MANUAL, single, firstRow,
onPick = { onCompMode(k, it) },
)
if (automatic(k)) AutoComponentBody(ComponentsManager.LABEL[k] ?: k, compAuto[k].orEmpty(), compAutoChecking)
}
}
if (!automatic(l)) {
if (single) {
slide { k -> RowGroup(installedTitle(k)) { installedRows(k, false) } }
Spacer(Modifier.height(12.dp))
slide { k -> RowGroup(availableTitle(k)) { availableRows(k) } }
} else Row(horizontalArrangement = Arrangement.spacedBy(14.dp), verticalAlignment = Alignment.Top) {
Column(Modifier.weight(1f)) { slide { k -> RowGroup(installedTitle(k)) { installedRows(k, false) } } }
Column(Modifier.weight(1f)) { slide { k -> RowGroup(availableTitle(k)) { availableRows(k) } } }
}
Box(Modifier.padding(top = 14.dp)) { slide { k -> actions(k) } }
}
Box(Modifier.padding(top = 14.dp)) { slide { k -> actions(k) } }
if (l == "fex") {
SettingsGroup(stringResource(R.string.fex_preset_title)) {
SettingsRow(stringResource(R.string.fex_preset_title), null) {
@@ -1078,6 +1104,25 @@ private fun RowGroup(title: String, content: @Composable ColumnScope.() -> Unit)
}
}
@Composable
private fun AutoComponentBody(label: String, lines: List<ComponentUpdater.Status>, checking: Boolean) {
val colors = MaterialTheme.colorScheme
Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
PanelTitle(stringResource(R.string.comp_auto_title, label), stringResource(R.string.comp_auto_hint))
if (lines.isEmpty()) EmptyLine(stringResource(R.string.comp_auto_none))
for (line in lines) {
val previous = line.previous.removeSuffix(".wcp").ifEmpty { stringResource(R.string.comp_tag_original) }
val fallback = if (line.current.isEmpty()) null else stringResource(R.string.comp_auto_fallback, previous)
PanelRow(
line.current.removeSuffix(".wcp").ifEmpty { stringResource(if (checking) R.string.comp_auto_checking else R.string.comp_tag_original) },
listOfNotNull(line.protons.joinToString(", ").ifEmpty { null }, fallback).joinToString(" · "),
selected = true, onClick = null,
)
}
lines.map { it.note }.filter { it.isNotEmpty() }.distinct().forEach { Text(it, fontSize = 13.sp, color = colors.onSurfaceVariant) }
}
}
@Composable
private fun EmptyLine(text: String) {
Text(text, fontSize = 13.sp, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(horizontal = 14.dp, vertical = 12.dp))
@@ -122,6 +122,7 @@ class FrontEndState(
val frameGen: FrameGen.Mode = FrameGen.Mode.OFF,
val lossless: Lossless.State = Lossless.State.NONE,
val shortcutPicker: Boolean = false,
val preparingGames: Set<String> = emptySet(),
val shortcutLibraryScanning: Boolean = false,
val gameSyncFolder: String? = null,
val pageKey: String? = null,
@@ -188,6 +189,7 @@ class FrontEndActions(
val onPlayDesktopUi: () -> Unit,
val onSteamUrl: (String) -> Unit = {},
val onSteamGame: (Library.SteamGame) -> Unit,
val onStoreGame: (com.droiddeck.launcher.stores.Store, String) -> Unit = { _, _ -> },
val onGameShortcut: (Library.SteamGame) -> Unit = {},
val onExportGameFile: (Library.SteamGame) -> Unit = {},
val onSyncGameFiles: () -> Unit = {},
@@ -725,6 +727,7 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
com.droiddeck.launcher.stores.StoresState.pendingInstall?.let { item -> StoreTheme(item.store) { InstallWhere(item) } }
com.droiddeck.launcher.stores.StoresState.itchPicking?.let { item -> StoreTheme(item.store) { ItchBuildPicker(item) { com.droiddeck.launcher.stores.StoresState.itchPicking = null } } }
com.droiddeck.launcher.stores.StoresState.gameJoltPicking?.let { item -> StoreTheme(item.store) { GameJoltBuildPicker(item) { com.droiddeck.launcher.stores.StoresState.gameJoltPicking = null } } }
com.droiddeck.launcher.stores.steam.SteamStore.picking?.let { item -> StoreTheme(item.store) { SteamInstallWhereDialog(item) { com.droiddeck.launcher.stores.steam.SteamStore.picking = null } } }
StepsLayer(screenAt)
appToChooseDisplay?.let { app ->
@@ -56,6 +56,7 @@ import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.rotate
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.focus.focusProperties
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.semantics.Role
@@ -150,6 +151,27 @@ internal fun Chip(t: String, ok: Boolean) {
@Composable
internal fun rememberHot(src: MutableInteractionSource): Boolean = src.collectIsFocusedAsState().value || src.collectIsHoveredAsState().value
@Composable
internal fun DialogToggleRow(label: String, checked: Boolean, onChange: (Boolean) -> Unit) {
val pal = LocalPalette.current
val src = remember { MutableInteractionSource() }
val hot = rememberHot(src)
val flip = { onChange(!checked) }
Row(
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp),
modifier = Modifier.fillMaxWidth().clip(Shape12)
.background(if (hot) pal.signal.copy(alpha = 0.12f) else Color.Transparent)
.border(if (hot) 2.dp else 1.dp, if (hot) pal.signal else pal.line, Shape12)
.hoverable(src)
.clickable(interactionSource = src, indication = null, role = Role.Switch, onClick = flip)
.controllerConfirm(onClick = flip)
.padding(start = 14.dp, end = 4.dp),
) {
Text(label, fontSize = 14.sp, color = MaterialTheme.colorScheme.onBackground, modifier = Modifier.weight(1f))
ToggleSwitch(checked, label = label, modifier = Modifier.focusProperties { canFocus = false }) { onChange(it) }
}
}
@Composable
internal fun PrimaryButton(
text: String,
@@ -103,6 +103,7 @@ import com.droiddeck.launcher.stores.StoreSizes
import com.droiddeck.launcher.stores.StoresState
import com.droiddeck.launcher.stores.gamejolt.GameJoltApi
import com.droiddeck.launcher.stores.battlenet.BattleNetInstall
import com.droiddeck.launcher.stores.steam.SteamStore
import com.droiddeck.launcher.stores.download.DownloadQueue
import com.droiddeck.launcher.stores.download.DownloadState
import com.droiddeck.launcher.stores.formatBytes
@@ -122,6 +123,7 @@ import androidx.compose.runtime.getValue
internal class GameRef(val appId: Int?, val store: Store?, val storeId: String?) {
fun game(games: List<Library.SteamGame>): Library.SteamGame? = when {
appId != null -> games.firstOrNull { it.appId == appId }
store == Store.STEAM && storeId != null -> games.firstOrNull { Library.fromSteamClient(it) && it.appId.toString() == storeId }
store != null && storeId != null -> games.firstOrNull { it.source == store.id && it.storeId == storeId }
else -> null
}
@@ -225,7 +227,7 @@ internal fun GameDetail(
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
if (installed != null && installed.sidecar.store == Store.ITCH) ItchCheckButton(installed)
if (installed != null && installed.sidecar.store == Store.GAMEJOLT) GameJoltCheckButton(installed)
RemoveButton(title, game, installed, a)
if (store == Store.STEAM) SteamRemoveButton(title, id?.toIntOrNull(), a) else RemoveButton(title, game, installed, a)
}
}
}
@@ -408,11 +410,13 @@ internal fun GameActions(
!cloud && (game != null || installed != null) -> {
val gone = storeKey?.let { StoresState.uninstalling[it] }
val xboxBusy = store == Store.XBOX && id != null && XboxContent.busy(id)
val preparing = (game?.launchKey ?: storeKey)?.let { it in s.preparingGames } == true
PrimaryButton(
stringResource(R.string.stores_play), enabled = !s.busy && gone == null && download == null && !xboxBusy && (store != Store.GOG || installed?.sidecar?.isInstalled != false),
stringResource(if (preparing) R.string.store_starting else R.string.stores_play),
enabled = !s.busy && !preparing && gone == null && download == null && !xboxBusy && (store != Store.GOG || installed?.sidecar?.isInstalled != false),
main = true, icon = Icons.Filled.PlayArrow, modifier = leadOn,
) {
if (game != null) a.onSteamGame(game) else if (store != null && id != null) launchStoreGame(ctx, store, id, s, a)
if (game != null) a.onSteamGame(game) else if (store != null && id != null) launchStoreGame(store, id, s, a)
}
if (game != null) {
if (compactMenu) GameMoreMenu(game, a) else {
@@ -715,6 +719,43 @@ private fun RemoveButton(title: String, game: Library.SteamGame?, installed: Ins
)
}
@Composable
private fun SteamRemoveButton(title: String, appId: Int?, a: FrontEndActions) {
val ctx = LocalContext.current
val colors = MaterialTheme.colorScheme
val game = appId?.let { SteamStore.installed[it] } ?: return
val key = SteamStore.key(game.appId)
if (StoresState.uninstalling[key] != null) {
val uninstalling = stringResource(R.string.stores_uninstalling)
Box(contentAlignment = Alignment.Center, modifier = Modifier.size(40.dp).glass(CircleShape).semantics { contentDescription = uninstalling }) {
CircularProgressIndicator(strokeWidth = 2.dp, color = colors.error, modifier = Modifier.size(20.dp))
}
return
}
val heading = stringResource(R.string.stores_uninstall_title, title)
val body = if (game.sizeOnDisk > 0) stringResource(R.string.stores_uninstall_body_size, formatBytes(game.sizeOnDisk)) else stringResource(R.string.games_uninstall_body)
val keep = stringResource(R.string.stores_notification_keep)
val remove = stringResource(R.string.stores_uninstall)
val busy = StoresState.download(key)?.isActive == true
val placed = remember { arrayOfNulls<androidx.compose.ui.layout.LayoutCoordinates>(1) }
Box(Modifier.onGloballyPositioned { placed[0] = it }) {
IconAction(Icons.Outlined.Delete, remove, "game:remove", danger = true, enabled = !busy, frosted = true) {
val at = placed[0]?.takeIf { it.isAttached }?.boundsInRoot() ?: return@IconAction
var confirmed = false
Steps.ask(StepAsk(anchor = at, side = StepSide.Left, accent = colors.error, items = 3, pillCorner = 12.dp, maxWidth = 340.dp,
onDismiss = { if (confirmed) SteamStore.uninstall(ctx, game.appId) { StoresState.refresh(ctx); a.onLibraryChanged() } },
handle = { Icon(Icons.Outlined.Delete, null, tint = colors.error, modifier = Modifier.size(18.dp)) }) {
StepTitle(heading)
Text(body, fontSize = 13.sp, lineHeight = 18.sp, color = colors.onSurfaceVariant, modifier = Modifier.stepItem(1).padding(start = 4.dp, bottom = 12.dp))
Row(horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End), modifier = Modifier.fillMaxWidth().stepItem(2)) {
StepChoice(keep, enabled = open, modifier = Modifier.focusRequester(first)) { Steps.fold() }
StepChoice(remove, danger = true, enabled = open) { confirmed = true; Steps.fold() }
}
})
}
}
}
@Composable
private fun InstallButton(label: String, modifier: Modifier = Modifier, onInstall: () -> Unit) {
val placed = remember { arrayOfNulls<androidx.compose.ui.layout.LayoutCoordinates>(1) }
@@ -808,11 +849,17 @@ private fun LaunchTab(game: Library.SteamGame, s: FrontEndState, a: FrontEndActi
val host = rememberMenuHost()
Column(verticalArrangement = Arrangement.spacedBy(12.dp), modifier = Modifier.fillMaxWidth()) {
LaunchSettings(s, a, host, game, hopRail ?: GameRef.key(game))
if (canEditSteamLaunchOptions(game, s.shortcutPicker)) {
SteamLaunchOptionsPanel(game.appId)
}
val folder = game.gameFiles
if (game.library == Library.ADDED && game.source == Library.ADDED && !s.shortcutPicker && folder != null) ShortcutFields(game, folder)
}
}
internal fun canEditSteamLaunchOptions(game: Library.SteamGame, shortcutPicker: Boolean): Boolean =
!shortcutPicker && game.source == Library.SOURCE_STEAM && game.library != Library.ADDED
@Composable
private fun ShortcutFields(game: Library.SteamGame, folder: File) {
val ctx = LocalContext.current
@@ -250,18 +250,8 @@ internal fun GpuDriversBody(
Triple(GPU_MODE_PAIR, R.string.gpu_mode_pair, R.string.gpu_mode_pair_detail),
Triple(GPU_MODE_MIX, R.string.gpu_mode_mix, R.string.gpu_mode_mix_detail),
)
val choice: @Composable (Int, Modifier) -> Unit = { i, mod ->
val (id, title, detail) = modes[i]
PanelRow(
stringResource(title), stringResource(detail), gpu.mode == id,
modifier = mod.then(if (gpu.mode == id) Modifier.focusRequester(first) else Modifier)
.then(if (i == 0) Modifier.onGloballyPositioned { placed[1] = it }.onFocusChanged { if (it.isFocused) revealCard() } else Modifier),
onClick = { if (gpu.mode != id) actions.onMode(id) },
)
}
if (single) Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { modes.indices.forEach { choice(it, Modifier) } }
else Row(horizontalArrangement = Arrangement.spacedBy(10.dp), modifier = Modifier.fillMaxWidth().height(IntrinsicSize.Min)) {
modes.indices.forEach { choice(it, Modifier.weight(1f).fillMaxHeight()) }
ModeChoices(modes, gpu.mode, single, first, onPick = actions.onMode) { i ->
if (i == 0) Modifier.onGloballyPositioned { placed[1] = it }.onFocusChanged { if (it.isFocused) revealCard() } else Modifier
}
when (gpu.mode) {
GPU_MODE_AUTO -> AutoBody(gpu, actions)
@@ -439,12 +429,35 @@ internal const val SLOT_DISPLAY = "panel"
internal const val SLOT_RUNTIME = "rt"
@Composable
private fun PanelHeading(text: String) {
internal fun ModeChoices(
modes: List<Triple<String, Int, Int>>,
selected: String,
single: Boolean,
first: FocusRequester,
onPick: (String) -> Unit,
extra: (Int) -> Modifier = { Modifier },
) {
val choice: @Composable (Int, Modifier) -> Unit = { i, mod ->
val (id, title, detail) = modes[i]
PanelRow(
stringResource(title), stringResource(detail), selected == id,
modifier = mod.then(if (selected == id) Modifier.focusRequester(first) else Modifier).then(extra(i)),
onClick = { if (selected != id) onPick(id) },
)
}
if (single) Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { modes.indices.forEach { choice(it, Modifier) } }
else Row(horizontalArrangement = Arrangement.spacedBy(10.dp), modifier = Modifier.fillMaxWidth().height(IntrinsicSize.Min)) {
modes.indices.forEach { choice(it, Modifier.weight(1f).fillMaxHeight()) }
}
}
@Composable
internal fun PanelHeading(text: String) {
Text(text.uppercase(), fontSize = 12.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 1.5.sp, color = MaterialTheme.colorScheme.onSurfaceVariant)
}
@Composable
private fun PanelTitle(title: String, hint: String) {
internal fun PanelTitle(title: String, hint: String) {
Column(verticalArrangement = Arrangement.spacedBy(3.dp), modifier = Modifier.padding(top = 4.dp)) {
Text(title, fontSize = 18.sp, fontWeight = FontWeight.SemiBold, color = MaterialTheme.colorScheme.onBackground)
Text(hint, fontSize = 13.sp, color = MaterialTheme.colorScheme.onSurfaceVariant)
@@ -461,7 +474,7 @@ private fun Pill(text: String, fill: Color, ink: Color) {
}
@Composable
private fun PanelRow(
internal fun PanelRow(
title: String,
detail: String,
selected: Boolean,
@@ -136,7 +136,7 @@ internal fun libraryEntries(
out += LibraryEntry(GameRef.key(g), g.source, g.name, g, item,
installed = g.library != Library.XBOX_CLOUD || storeKey in installedStore)
}
for (store in Store.entries) for (item in owned[store].orEmpty()) {
for (store in Store.entries) if (store != Store.STEAM) for (item in owned[store].orEmpty()) {
if (!claimed.add(item.key)) continue
out += LibraryEntry(GameRef.key(item), store.id, item.title, null, item, installed = item.key in installedStore)
}
@@ -215,7 +215,7 @@ internal fun LibraryPage(s: FrontEndState, a: FrontEndActions, selected: String,
LaunchedEffect(Unit) { StoresState.refresh(ctx) }
remember { LibraryDisplay.load(ctx) }
val stores = s.gameStoresEnabled && !s.shortcutPicker
val signedIn = Store.entries.filter { StoresState.isSignedIn(it) }
val signedIn = Store.entries.filter { it != Store.STEAM && StoresState.isSignedIn(it) }
LaunchedEffect(stores, signedIn) { if (stores) signedIn.forEach { StoresState.loadLibrary(ctx, it) } }
val owned = if (stores) signedIn.associateWith { StoresState.library[it].orEmpty() } else emptyMap()
val installedStore = StoresState.installed.map { it.key }.toSet()
@@ -46,6 +46,8 @@ class SecondScreenPresentation(
private val frame = FrameLayout(context)
private var menuView: androidx.compose.ui.platform.ComposeView? = null
private var dashboardView: androidx.compose.ui.platform.ComposeView? = null
private var chatView: androidx.compose.ui.platform.ComposeView? = null
private var chatLost: (() -> Unit)? = null
var menuShown = false
private set
private val root = LinearLayout(context).apply {
@@ -78,7 +80,7 @@ class SecondScreenPresentation(
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
root.setOnApplyWindowInsetsListener { view, insets ->
if (insets.isVisible(WindowInsets.Type.ime())) imeSeen = true
else if (imeSeen) keyboardClosed()
else if (imeSeen && chatView == null) keyboardClosed()
view.onApplyWindowInsets(insets)
}
}
@@ -128,6 +130,37 @@ class SecondScreenPresentation(
if (created && isShowing && currentMode == SecondScreenMode.TERMINAL && terminalPanel?.ready != true) renderMode()
}
fun showChat(onLost: () -> Unit, content: @androidx.compose.runtime.Composable () -> Unit) {
if (!showsKeyboard || chatView != null) return
keyboardHost?.takeIf { it.shown }?.hide()
keyboardShown.value = false
keyboardPending = false
fieldKeyboard = false
chatLost = onLost
ownComposeViews()
val view = androidx.compose.ui.platform.ComposeView(context).apply {
isFocusable = true
isFocusableInTouchMode = true
setContent { content() }
}
chatView = view
root.addView(view, 1.coerceAtMost(root.childCount), LinearLayout.LayoutParams(-1, -2))
}
fun hideChat() {
chatLost = null
dropChat()
}
private fun dropChat() {
val view = chatView ?: return
chatView = null
chatLost?.let { lost -> chatLost = null; sessionActivity.runOnUiThread(lost) }
imeSeen = false
root.removeView(view)
view.disposeComposition()
}
val showsKeyboard: Boolean get() = isShowing && !menuShown && currentMode == SecondScreenMode.KEYBOARD_TRACKPAD
val showsControls: Boolean get() = isShowing && currentMode != SecondScreenMode.NONE
@@ -178,6 +211,7 @@ class SecondScreenPresentation(
showMenu(false)
closeDashboard()
closeTerminal()
dropChat()
keyboardHost?.hide()
keyboardHost = null
dismiss()
@@ -212,6 +246,7 @@ class SecondScreenPresentation(
}
private fun renderMode() {
dropChat()
fieldKeyboard = false
keyboardHost?.hide()
keyboardHost = null
@@ -264,6 +264,9 @@ class DrawerActions(
val onImportLossless: () -> Unit,
val onKeyboard: () -> Unit,
val onHardwareKeyboard: () -> Unit,
val wowChatShown: Boolean = false,
val wowChat: String? = null,
val onWowChat: (String?) -> Unit = {},
val onSteamMenu: (() -> Unit)?,
val onQam: (() -> Unit)?,
val onAchievements: (() -> Unit)? = null,
@@ -698,6 +701,15 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
host.open = null; a.onKeyboard()
}
}
if (a.wowChatShown) ChoiceRow(
host, "wow-chat", stringResource(R.string.wow_chat_title), null,
listOf(
null to stringResource(R.string.wow_chat_ask),
SessionPrefs.WOW_CHAT_VOICE to stringResource(R.string.wow_chat_voice),
SessionPrefs.WOW_CHAT_KEYBOARD to stringResource(R.string.pckb_android),
),
a.wowChat, chipModifier = focus.track(page, "wow-chat"), onPick = a.onWowChat,
)
val keyboardContext = LocalContext.current
remember { PcKeyboardPrefs.load(keyboardContext) }
SliderRow(
@@ -1,14 +1,8 @@
package com.droiddeck.launcher.ui
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.hoverable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Usb
@@ -18,12 +12,7 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.focus.focusProperties
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.res.stringResource
@@ -48,23 +37,7 @@ internal fun SlowUsbDialog(drive: UsbLink.SlowDrive, never: Boolean, onNever: (B
stringResource(message, drive.name, UsbLink.generation(drive.mbps), speed, UsbLink.megabytesPerSecond(drive.mbps)),
fontSize = 13.sp, lineHeight = 18.sp, color = MaterialTheme.colorScheme.onSurfaceVariant,
)
val pal = LocalPalette.current
val src = remember { MutableInteractionSource() }
val hot = rememberHot(src)
val flip = { onNever(!never) }
Row(
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp),
modifier = Modifier.fillMaxWidth().clip(Shape12)
.background(if (hot) pal.signal.copy(alpha = 0.12f) else Color.Transparent)
.border(if (hot) 2.dp else 1.dp, if (hot) pal.signal else pal.line, Shape12)
.hoverable(src)
.clickable(interactionSource = src, indication = null, role = Role.Switch, onClick = flip)
.controllerConfirm(onClick = flip)
.padding(start = 14.dp, end = 4.dp),
) {
Text(stringResource(R.string.slow_usb_never), fontSize = 14.sp, color = MaterialTheme.colorScheme.onBackground, modifier = Modifier.weight(1f))
ToggleSwitch(never, label = stringResource(R.string.slow_usb_never), modifier = Modifier.focusProperties { canFocus = false }) { onNever(it) }
}
DialogToggleRow(stringResource(R.string.slow_usb_never), never, onNever)
Row(horizontalArrangement = Arrangement.End, modifier = Modifier.fillMaxWidth()) {
PrimaryButton(stringResource(R.string.slow_usb_dismiss), modifier = Modifier.focusRequester(focus), onClick = close)
}
@@ -33,14 +33,14 @@ internal fun sourceColours(source: String): SourceColours = when (source) {
Store.ITCH.id -> SourceColours(Color(0xFF3A1A1E), Color(0xFFFFB3B3), Color(0xFFFF5C5C))
Store.GAMEJOLT.id -> SourceColours(Color(0xFF232E00), Color(0xFFE3FF66), Color(0xFFCCFF00))
Store.BATTLENET.id -> SourceColours(Color(0xFF0A2440), Color(0xFF9DD1FF), Color(0xFF148EFF))
Library.SOURCE_STEAM -> SourceColours(Color(0xFF16293D), Color(0xFF7CC4FF), Color(0xFF1A9FFF))
Library.SOURCE_STEAM, Store.STEAM.id -> SourceColours(Color(0xFF16293D), Color(0xFF7CC4FF), Color(0xFF1A9FFF))
FLATHUB -> SourceColours(Color(0xFF0B2E2B), Color(0xFF9FE3DD), FlathubTeal)
else -> SourceColours(Color(0xFF1A1D22), Color(0xFF9AA3AF), Color(0xFF9AA3AF))
}
@Composable
internal fun sourceLabel(source: String): String = when (source) {
Library.SOURCE_STEAM -> stringResource(R.string.source_steam)
Library.SOURCE_STEAM, Store.STEAM.id -> stringResource(R.string.source_steam)
Store.GOG.id -> Store.GOG.label
Store.EPIC.id -> Store.EPIC.label
Store.AMAZON.id -> Store.AMAZON.label
@@ -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 if (d.key == com.droiddeck.launcher.stores.battlenet.BattleNetClient.DOWNLOAD_KEY) a.onBattleNet() 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(d.store, d.id, s, a) }
}
}
}
@@ -374,7 +374,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 if (d.key == com.droiddeck.launcher.stores.battlenet.BattleNetClient.DOWNLOAD_KEY) a.onBattleNet() 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(d.store, d.id, s, a) }
}
DownloadState.CANCELLED -> {}
}
@@ -545,6 +545,5 @@ internal fun storesSettingsStep(at: Rect, s: androidx.compose.runtime.State<Fron
com.droiddeck.launcher.stores.gog.GogComet.setEnabled(context, it)
}
}
StoresEngineRow()
}
}
@@ -27,6 +27,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.produceState
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
@@ -46,7 +47,10 @@ import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.stores.CatalogItem
import com.droiddeck.launcher.stores.StoreInstallRoot
import com.droiddeck.launcher.stores.StoreLanguage
import com.droiddeck.launcher.stores.StoreSizes
import com.droiddeck.launcher.stores.StoresState
import com.droiddeck.launcher.stores.steam.SteamClient
import com.droiddeck.launcher.stores.steam.SteamStore
import com.droiddeck.launcher.stores.formatBytes
import com.droiddeck.launcher.stores.gog.GogDownloadManager
import kotlinx.coroutines.Dispatchers
@@ -133,6 +137,61 @@ internal fun InstallWhereDialog(item: CatalogItem, onDismiss: () -> Unit) {
}
}
@Composable
internal fun SteamInstallWhereDialog(item: CatalogItem, onDismiss: () -> Unit) {
val ctx = LocalContext.current
val colors = MaterialTheme.colorScheme
val shown = rememberShown(onDismiss)
val close = { shown.targetState = false }
val targets by produceState<List<SteamClient.Target>?>(null, item.key) {
value = withContext(Dispatchers.IO) { runCatching { SteamClient.targets(ctx) }.getOrDefault(emptyList()) }
}
val needed by produceState(StoreSizes.size(item), item.key) {
val bytes = withContext(Dispatchers.IO) { runCatching { SteamStore.plannedBytes(ctx, item) }.getOrDefault(0L) }
if (bytes > 0L) value = bytes
}
val list = targets
val focus = remember(list?.size) { List(list?.size ?: 0) { FocusRequester() } }
LaunchedEffect(focus) { if (focus.isNotEmpty()) focusWithinFrames({ false }) { focus[0] } }
AppDialog(shown, close, "steamInstallWhere", wide = false, maxWidth = 440.dp) {
Rise(0) {
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth()) {
Text(
stringResource(R.string.stores_install_title, item.title), fontSize = 15.sp, color = colors.onBackground,
maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f),
)
Text(
stringResource(R.string.common_cancel), fontSize = 13.sp, fontWeight = FontWeight.SemiBold, color = colors.onSurfaceVariant,
modifier = Modifier.clip(Shape12).focusGlide().clickable(role = Role.Button, onClick = close).controllerConfirm(onClick = close).padding(horizontal = 10.dp, vertical = 6.dp),
)
}
}
Rise(1) {
when {
list == null -> androidx.compose.material3.LinearProgressIndicator(Modifier.fillMaxWidth().height(3.dp))
list.isEmpty() -> Note(stringResource(R.string.game_sync_err_steam_library))
else -> Column(verticalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.fillMaxWidth()) {
list.forEachIndexed { i, t ->
val isLow = StoreInstallRoot.insufficientSpace(needed, t.freeBytes)
val freeText = when {
t.freeBytes < 0L -> stringResource(R.string.stores_target_free_unknown)
isLow -> stringResource(R.string.stores_storage_low, formatBytes(t.freeBytes), formatBytes(needed))
else -> stringResource(R.string.stores_target_free, formatBytes(t.freeBytes))
}
TargetRow(
label = t.label, free = freeText, removable = t.removable, folder = t.folder, focus = focus[i],
modifier = Modifier.fillMaxWidth(), warning = isLow,
) {
SteamStore.install(ctx, item, t)
close()
}
}
}
}
}
}
}
@Composable
private fun TargetRow(label: String, free: String, removable: Boolean, folder: Boolean, focus: FocusRequester, modifier: Modifier, warning: Boolean = false, onPick: () -> Unit) {
val colors = MaterialTheme.colorScheme
@@ -216,6 +216,12 @@ internal fun StoresPage(s: FrontEndState, a: FrontEndActions, modifier: Modifier
delay(5_000)
}
}
if (chip == Store.STEAM.id) {
while (true) {
if (lifecycle.currentState.isAtLeast(androidx.lifecycle.Lifecycle.State.RESUMED)) com.droiddeck.launcher.stores.steam.SteamStore.poll(ctx)
delay(5_000)
}
}
if (chip == Store.EPIC.id) {
EpicClient.ensure(ctx)
while (true) {
@@ -382,7 +388,7 @@ internal fun StoresPage(s: FrontEndState, a: FrontEndActions, modifier: Modifier
!k.accountsLoaded -> Box(Modifier.fillMaxWidth().padding(top = 16.dp)) {
androidx.compose.material3.LinearProgressIndicator(Modifier.fillMaxWidth().height(3.dp))
}
!k.signedIn -> Box(Modifier.fillMaxWidth().verticalScroll(scroll).padding(top = 4.dp, bottom = 16.dp)) { SignInCard(st, viewportH - 20.dp) }
!k.signedIn -> Box(Modifier.fillMaxWidth().verticalScroll(scroll).padding(top = 4.dp, bottom = 16.dp)) { SignInCard(st, viewportH - 20.dp, onSignIn = if (st == Store.STEAM) a.onPlay else null) }
else -> Storefront(st, query, s, a, grids.getOrPut(k) { LazyGridState() }, clearSearchFocus = openGame != null, onQuery = { query = it }, onOpen = { open(it) })
}
}
@@ -736,7 +742,7 @@ internal fun CountPill(count: Int) {
@Composable
private fun SignInCard(store: Store, height: Dp) {
private fun SignInCard(store: Store, height: Dp, onSignIn: (() -> Unit)? = null) {
val ctx = LocalContext.current
val colors = MaterialTheme.colorScheme
val pal = LocalPalette.current
@@ -785,21 +791,23 @@ private fun SignInCard(store: Store, height: Dp) {
)
}
Spacer(Modifier.height(6.dp))
Rise(3) { SignInButton(store, large = true) }
Rise(3) { SignInButton(store, large = true, onSignIn = onSignIn) }
}
}
}
@Composable
private fun SignInButton(store: Store, large: Boolean = false) {
private fun SignInButton(store: Store, large: Boolean = false, onSignIn: (() -> Unit)? = null) {
val ctx = LocalContext.current
val colors = MaterialTheme.colorScheme
val placed = remember { arrayOfNulls<androidx.compose.ui.layout.LayoutCoordinates>(1) }
var askKey by remember { mutableStateOf(false) }
if (askKey) ItchKeyDialog { askKey = false }
Box(Modifier.onGloballyPositioned { placed[0] = it }) {
PrimaryButton(stringResource(R.string.stores_signin), main = true, large = large, icon = if (large) Icons.AutoMirrored.Filled.Login else null) {
if (store == Store.ITCH) askKey = true
val label = if (onSignIn != null) stringResource(R.string.stores_login_title, store.label) else stringResource(R.string.stores_signin)
PrimaryButton(label, main = true, large = large, icon = if (large) Icons.AutoMirrored.Filled.Login else null) {
if (onSignIn != null) onSignIn()
else if (store == Store.ITCH) askKey = true
else {
val at = placed[0]?.takeIf { it.isAttached }?.boundsInRoot()
if (at == null || Motion.scale == 0f || StoresMotion.signIn != null) StoresState.signIn(ctx, store)
@@ -822,7 +830,11 @@ private fun Storefront(
val library = StoresState.library[store] ?: emptyList()
val shelves = StoresState.shelves[store]
val found = StoresState.found[store] ?: emptyList()
val installedKeys = remember(StoresState.installed) { StoresState.installed.filter { it.sidecar.store == store }.map { it.sidecar.id }.toSet() }
val steamInstalled = if (store == Store.STEAM) com.droiddeck.launcher.stores.steam.SteamStore.installed else emptyMap()
val installedKeys = remember(StoresState.installed, steamInstalled) {
if (store == Store.STEAM) steamInstalled.keys.mapTo(HashSet()) { it.toString() }
else StoresState.installed.filter { it.sidecar.store == store }.map { it.sidecar.id }.toSet()
}
val q = query.trim().lowercase()
val foundKeys = remember(found) { found.map { it.key }.toSet() }
fun shown(i: CatalogItem) = s.storesShowMature || !i.mature || i.accessible
@@ -832,9 +844,11 @@ private fun Storefront(
LaunchedEffect(gameJolt, s.storesShowMature) { if (gameJolt) GameJoltBrowseState.sync(ctx, s.storesShowMature) }
val browsing = q.isEmpty() && ((store == Store.ITCH && ItchBrowseState.active) || gameJolt)
val browseItems = if (!browsing) emptyList() else if (gameJolt) GameJoltBrowseState.items else ItchBrowseState.items
val catalog = store == Store.BATTLENET && q.isEmpty()
val steam = store == Store.STEAM
val catalog = (store == Store.BATTLENET || steam) && q.isEmpty()
val visible = remember(found, library, shelves, q, s.storesShowMature, browsing, browseItems, catalog) {
if (catalog) shelf(shelves?.trending) ?: emptyList()
if (catalog && steam) library.filter(::shown)
else if (catalog) shelf(shelves?.trending) ?: emptyList()
else if (browsing) {
val owned = library.associateBy { it.id }
browseItems.map { owned[it.id] ?: it }.filter(::shown)
@@ -847,7 +861,8 @@ private fun Storefront(
browsing && gameJolt && GameJoltBrowseState.failed -> R.string.stores_gamejolt_browse_failed
browsing && !gameJolt && ItchBrowseState.loading -> R.string.stores_shelves_loading
browsing && !gameJolt && ItchBrowseState.failed -> R.string.stores_itch_browse_failed
catalog && shelves == null -> R.string.stores_shelves_loading
catalog && steam && !StoresState.library.containsKey(store) -> R.string.stores_shelves_loading
catalog && !steam && shelves == null -> R.string.stores_shelves_loading
else -> R.string.stores_nothing_matches
})
var firstPlaced = false
@@ -863,7 +878,7 @@ private fun Storefront(
val barLine = StoresState.status[store]?.takeIf { bareTab && syncCount(it) != null }
val itchBar = store == Store.ITCH && q.isEmpty()
val gameJoltBar = gameJolt && q.isEmpty()
val headerItems = 2 + (if (barLine != null) 1 else 0) + (if (StoresState.problems[store] != null) 1 else 0) + (if (itchBar || gameJoltBar) 1 else 0) + (if (catalog) 1 else 0)
val headerItems = 2 + (if (barLine != null) 1 else 0) + (if (StoresState.problems[store] != null) 1 else 0) + (if (itchBar || gameJoltBar) 1 else 0) + (if (catalog && !steam) 1 else 0)
val card: @Composable (CatalogItem) -> Unit = { item ->
val first = if (searching) item.key == visible.firstOrNull()?.key else !firstPlaced
firstPlaced = true
@@ -913,7 +928,7 @@ private fun Storefront(
StoresState.problems[store]?.let { line -> item(key = "problem", span = { GridItemSpan(maxLineSpan) }) { Rise(3) { Box(Modifier.padding(bottom = 8.dp)) { Note(line) } } } }
if (itchBar) item(key = "itch-browse-bar", span = { GridItemSpan(maxLineSpan) }) { ItchBrowseBar() }
if (gameJoltBar) item(key = "gamejolt-browse-bar", span = { GridItemSpan(maxLineSpan) }) { GameJoltBrowseBar(s.storesShowMature) }
if (catalog) item(key = "catalog-label", span = { GridItemSpan(maxLineSpan) }) {
if (catalog && !steam) item(key = "catalog-label", span = { GridItemSpan(maxLineSpan) }) {
Box(Modifier.padding(top = 10.dp)) { SectionLabel(stringResource(R.string.bnet_store)) }
}
if (searching) {
@@ -959,7 +974,7 @@ private fun ProfileStrip(store: Store, owned: Int, loaded: Boolean, s: FrontEndS
)
}
Actions {
SmallTextButton(stringResource(R.string.stores_owned_in_library), key = "owned-in-library") {
if (store != Store.STEAM) SmallTextButton(stringResource(R.string.stores_owned_in_library), key = "owned-in-library") {
LibraryView.showOwned(ctx, store)
show("games")
}
@@ -967,7 +982,7 @@ private fun ProfileStrip(store: Store, owned: Int, loaded: Boolean, s: FrontEndS
if (store == Store.XBOX) SmallTextButton(stringResource(R.string.stores_xbox_cloud_settings), key = "xbox-cloud-settings") {
ctx.startActivity(android.content.Intent(ctx, com.droiddeck.launcher.stores.xbox.XboxCloudSettingsActivity::class.java))
}
SignOutButton(store, name)
if (store != Store.STEAM) SignOutButton(store, name)
}
}
if (store == Store.EPIC) EpicLauncherRow(s, a)
@@ -1157,6 +1172,7 @@ internal fun storePalette(base: Palette, store: Store?): Palette {
Store.ITCH -> Color(0xFFFF5C5C) to Color(0xFFD93B3B)
Store.GAMEJOLT -> Color(0xFFCCFF00) to Color(0xFFA3CC00)
Store.BATTLENET -> Color(0xFF148EFF) to Color(0xFF0B6BD3)
Store.STEAM -> Color(0xFF1A9FFF) to Color(0xFF0F6FC0)
null -> return base
}
val on = if (accent.luminance() > 0.18f) Color(0xFF0B0B0D) else Color.White
@@ -1430,18 +1446,7 @@ internal fun openUrl(ctx: android.content.Context, url: String) {
runCatching { ctx.startActivity(android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse(url)).addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK)) }
}
internal fun launchStoreGame(ctx: android.content.Context, store: Store, id: String, s: FrontEndState, a: FrontEndActions) {
internal fun launchStoreGame(store: Store, id: String, s: FrontEndState, a: FrontEndActions) {
val game = s.steamGames.firstOrNull { it.source == store.id && it.storeId == id }
if (game != null) {
a.onSteamGame(game)
return
}
val app = ctx.applicationContext
Thread({
val installed = runCatching { com.droiddeck.launcher.stores.StoreLaunch.installedGame(app, store, id) }.getOrNull()
StoresState.post {
if (installed == null) android.widget.Toast.makeText(ctx, R.string.stores_launch_not_registered, android.widget.Toast.LENGTH_LONG).show()
else a.onSteamGame(installed)
}
}, "store-play").start()
if (game != null) a.onSteamGame(game) else a.onStoreGame(store, id)
}
@@ -1,18 +0,0 @@
package com.droiddeck.launcher.ui
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import com.droiddeck.launcher.R
import com.droiddeck.launcher.stores.StoresNative
@Composable
internal fun StoresEngineRow() {
val version = StoresNative.version
SettingsRow(
stringResource(R.string.setup_stores_engine),
null,
) {
Chip(if (version != null) stringResource(R.string.setup_stores_engine_chip_ready) else stringResource(R.string.setup_stores_engine_chip_missing), ok = version != null)
}
}
@@ -0,0 +1,230 @@
package com.droiddeck.launcher.ui
import android.Manifest
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Bundle
import android.speech.RecognitionListener
import android.speech.RecognizerIntent
import android.speech.SpeechRecognizer
import android.widget.Toast
import androidx.activity.compose.BackHandler
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Mic
import androidx.compose.material3.FilledIconToggleButton
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextRange
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.ImeOptions
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.unit.dp
import com.droiddeck.launcher.R
import com.droiddeck.launcher.session.SessionPrefs
class WowChat(
private val context: Context,
private val onSend: (String, Boolean) -> Unit,
private val onCancel: () -> Unit,
private val readField: ((String?) -> Unit) -> Unit = {},
) {
var request by mutableStateOf<TypingRequest?>(null)
private set
var asking by mutableStateOf(false)
private set
var listening by mutableStateOf(false)
private set
var voice by mutableStateOf(false)
private set
var remembered by mutableStateOf(SessionPrefs.wowChatInput(context))
private set
private var recognizer: SpeechRecognizer? = null
private var spokenBase = ""
private var fieldRead = false
val open: Boolean get() = request != null || asking
fun chatOpened() {
if (open) return
when (val mode = remembered) {
null -> asking = true
else -> start(mode)
}
}
fun chatClosed() {
asking = false
finish()
}
fun pick(mode: String, remember: Boolean) {
asking = false
if (remember) choose(mode)
start(mode)
}
fun choose(mode: String?) {
SessionPrefs.setWowChatInput(context, mode)
remembered = SessionPrefs.wowChatInput(context)
}
fun dismissChoice() {
asking = false
onCancel()
}
fun send() {
val text = request?.value?.text.orEmpty()
val replace = fieldRead
finish()
onSend(text, replace)
}
fun cancel() {
finish()
onCancel()
}
private fun start(mode: String) {
voice = mode == SessionPrefs.WOW_CHAT_VOICE && voiceAvailable(context)
if (mode == SessionPrefs.WOW_CHAT_VOICE && !voice) Toast.makeText(context, R.string.wow_chat_voice_unavailable, Toast.LENGTH_SHORT).show()
val opened = TypingRequest(TextFieldValue(""), ImeOptions(singleLine = true, imeAction = ImeAction.Send), {}, {})
fieldRead = false
request = opened
readField { text ->
if (request === opened && !text.isNullOrEmpty() && opened.value.text.isEmpty()) {
fieldRead = true
opened.value = TextFieldValue(text, TextRange(text.length))
if (recognizer != null) spokenBase = "${text.trimEnd()} "
}
}
}
private fun finish() {
stopListening()
request = null
voice = false
}
fun listen() {
val active = request ?: return
stopListening()
val speech = runCatching { SpeechRecognizer.createSpeechRecognizer(context) }.getOrNull() ?: return
recognizer = speech
spokenBase = active.value.text.trimEnd().let { if (it.isEmpty()) it else "$it " }
speech.setRecognitionListener(object : RecognitionListener {
override fun onReadyForSpeech(params: Bundle?) { listening = true }
override fun onBeginningOfSpeech() {}
override fun onRmsChanged(rmsdB: Float) {}
override fun onBufferReceived(buffer: ByteArray?) {}
override fun onEndOfSpeech() {}
override fun onError(error: Int) { if (recognizer === speech) stopListening() }
override fun onResults(results: Bundle?) {
if (recognizer !== speech) return
heard(results)
stopListening()
}
override fun onPartialResults(partialResults: Bundle?) { if (recognizer === speech) heard(partialResults) }
override fun onEvent(eventType: Int, params: Bundle?) {}
})
val intent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH)
.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM)
.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true)
.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, context.packageName)
runCatching { speech.startListening(intent) }.onFailure { stopListening() }
}
private fun heard(results: Bundle?) {
val spoken = results?.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION)?.firstOrNull()?.takeIf { it.isNotBlank() } ?: return
val text = spokenBase + spoken
request?.value = TextFieldValue(text, TextRange(text.length))
}
fun stopListening() {
listening = false
val speech = recognizer ?: return
recognizer = null
runCatching { speech.cancel() }
runCatching { speech.destroy() }
}
companion object {
private val PROGRAM = Regex("wow[\\w-]*\\.exe", RegexOption.IGNORE_CASE)
fun isWow(program: String?): Boolean = program != null && PROGRAM.matches(program)
fun voiceAvailable(context: Context): Boolean = SpeechRecognizer.isRecognitionAvailable(context)
}
}
@Composable
internal fun WowChatPanel(chat: WowChat, modifier: Modifier = Modifier.fillMaxWidth()) {
val request = chat.request ?: return
val context = LocalContext.current
val mic = rememberLauncherForActivityResult(ActivityResultContracts.RequestPermission()) { granted ->
if (granted) chat.listen() else Toast.makeText(context, R.string.wow_chat_mic_denied, Toast.LENGTH_SHORT).show()
}
val listen = {
if (context.checkSelfPermission(Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED) chat.listen()
else mic.launch(Manifest.permission.RECORD_AUDIO)
}
LaunchedEffect(request) { if (chat.voice) listen() }
DisposableEffect(request) { onDispose { chat.stopListening() } }
BackHandler(onBack = chat::cancel)
TypingPanel(
request, modifier,
title = stringResource(if (chat.listening) R.string.wow_chat_listening else R.string.wow_chat_title),
done = stringResource(R.string.wow_chat_send),
onCancel = chat::cancel,
showKeyboard = !chat.voice,
leading = if (WowChat.voiceAvailable(context)) ({
FilledIconToggleButton(
checked = chat.listening,
onCheckedChange = { on -> if (on) listen() else chat.stopListening() },
modifier = Modifier.testTag("wow-chat-mic"),
) { Icon(Icons.Filled.Mic, stringResource(R.string.wow_chat_voice)) }
}) else null,
onDone = chat::send,
)
}
@Composable
internal fun WowChatChoiceDialog(chat: WowChat) {
var remember by remember { mutableStateOf(true) }
var picked by remember { mutableStateOf<String?>(null) }
val shown = rememberShown {
val mode = picked
if (mode != null) chat.pick(mode, remember) else chat.dismissChoice()
}
val close = { shown.targetState = false }
val choose = { mode: String -> picked = mode; close() }
val focus = remember { FocusRequester() }
LaunchedEffect(Unit) { runCatching { focus.requestFocus() } }
AppDialog(shown, close, "wowChat", wide = false, maxWidth = 520.dp) {
DialogTitleRow(stringResource(R.string.wow_chat_title), close)
DialogToggleRow(stringResource(R.string.wow_chat_remember), remember) { remember = it }
Row(horizontalArrangement = Arrangement.spacedBy(10.dp, androidx.compose.ui.Alignment.End), modifier = Modifier.fillMaxWidth()) {
SecondaryButton(stringResource(R.string.pckb_android), modifier = Modifier.testTag("wow-chat-keyboard")) { choose(SessionPrefs.WOW_CHAT_KEYBOARD) }
PrimaryButton(stringResource(R.string.wow_chat_voice), icon = Icons.Filled.Mic,
modifier = Modifier.focusRequester(focus).testTag("wow-chat-voice")) { choose(SessionPrefs.WOW_CHAT_VOICE) }
}
}
}
+23 -3
View File
@@ -564,6 +564,19 @@
<string name="comp_tag_in_use">قيد الاستخدام</string>
<string name="comp_tag_new">جديد</string>
<string name="comp_tag_stored">مخزّن</string>
<string name="comp_mode_title">كيفية اختيار الإصدارات</string>
<string name="comp_mode_auto_detail">أحدث إصدار من DroidDeck، محدّث دائمًا</string>
<string name="comp_mode_manual_detail">اختر الإصدارات وثبّتها بنفسك</string>
<string name="comp_auto_title">يُبقي Auto ‏%1$s محدّثًا</string>
<string name="comp_auto_hint">تُثبَّت الإصدارات الجديدة في الخلفية. إذا أُغلقت لعبة كانت تعمل خلال ثوانٍ مرتين، يعود Auto إلى الإصدار الذي كان يعمل.</string>
<string name="comp_auto_fallback">الاحتياطي: %1$s</string>
<string name="comp_auto_checking">جارٍ البحث عن إصدارات…</string>
<string name="comp_auto_none">لا يستخدمه أي DroidDeck-Proton</string>
<string name="comp_auto_waits_network">تنتظر تحديثات Auto اتصالًا.</string>
<string name="comp_auto_check_failed">تعذّر البحث عن إصدارات جديدة.</string>
<string name="comp_auto_waits_unmetered">تنتظر الإصدارات الجديدة اتصالًا غير محدود، وإيقاف توفير البطارية، وجهازًا غير ساخن.</string>
<string name="comp_auto_updated">تم تحديث %1$s إلى %2$s.</string>
<string name="comp_auto_rolled_back">أغلق %1$s %2$s لعبة خلال ثوانٍ مرتين، لذا عاد Auto إلى %3$s.</string>
<string name="perf_title">الأداء</string>
<string name="perf_lede">أنوية CPU وإصلاحات الجلسة واسم المضيف. يُطبَّق في الجلسة التالية.</string>
<string name="perf_client_cores_group">أنوية عميل Steam</string>
@@ -2329,9 +2342,6 @@
<string name="source_added">مخصَّص</string>
<string name="setup_stores">المتاجر</string>
<string name="setup_stores_speed">فئة سرعة التنزيل</string>
<string name="setup_stores_engine">محرك المتاجر</string>
<string name="setup_stores_engine_chip_ready">● المحرك جاهز</string>
<string name="setup_stores_engine_chip_missing">غير مبنيّ</string>
<string name="stores_tier_balanced">متوازن</string>
<string name="stores_tier_fast">سريع</string>
<string name="stores_tier_max">أقصى</string>
@@ -3832,4 +3842,14 @@
<string name="stores_gamejolt_filter_status">الحالة</string>
<string name="stores_gamejolt_filter_partners">الشركاء</string>
<string name="stores_gamejolt_followed">الألعاب المتابَعة</string>
<string name="wow_chat_title">إدخال الدردشة</string>
<string name="wow_chat_voice">الكتابة بالصوت</string>
<string name="wow_chat_remember">تذكّر هذا الاختيار</string>
<string name="wow_chat_ask">السؤال في كل مرة</string>
<string name="wow_chat_send">إرسال</string>
<string name="wow_chat_listening">جارٍ الاستماع…</string>
<string name="wow_chat_voice_unavailable">الكتابة بالصوت غير متاحة على هذا الجهاز.</string>
<string name="wow_chat_mic_denied">يلزم الوصول إلى الميكروفون للكتابة بالصوت.</string>
<string name="steam_store_close_steam">أغلق Steam أولاً</string>
<string name="steam_store_session_wait">أوقف تنزيل Steam مؤقتًا أولاً</string>
</resources>
+23 -3
View File
@@ -558,6 +558,19 @@
<string name="comp_tag_in_use">En uso</string>
<string name="comp_tag_new">Nuevo</string>
<string name="comp_tag_stored">Guardado</string>
<string name="comp_mode_title">Cómo se eligen las versiones</string>
<string name="comp_mode_auto_detail">Versión más reciente de DroidDeck, siempre al día</string>
<string name="comp_mode_manual_detail">Elige e instala las versiones tú mismo</string>
<string name="comp_auto_title">Auto mantiene %1$s al día</string>
<string name="comp_auto_hint">Las nuevas versiones se instalan en segundo plano. Si un juego que funcionaba se cierra en segundos dos veces, Auto vuelve a la versión que funcionaba.</string>
<string name="comp_auto_fallback">Respaldo: %1$s</string>
<string name="comp_auto_checking">Buscando versiones…</string>
<string name="comp_auto_none">Ningún DroidDeck-Proton lo usa</string>
<string name="comp_auto_waits_network">Las actualizaciones Auto esperan una conexión.</string>
<string name="comp_auto_check_failed">No se pudieron buscar nuevas versiones.</string>
<string name="comp_auto_waits_unmetered">Las nuevas versiones esperan una conexión sin límite de datos, el ahorro de batería desactivado y el dispositivo frío.</string>
<string name="comp_auto_updated">%1$s actualizado a %2$s.</string>
<string name="comp_auto_rolled_back">%1$s %2$s cerró un juego en segundos dos veces, así que Auto volvió a %3$s.</string>
<string name="perf_title">Rendimiento</string>
<string name="perf_lede">Núcleos de CPU, correcciones de sesión y nombre del host. Se aplica en la próxima sesión.</string>
<string name="perf_client_cores_group">Núcleos del cliente de Steam</string>
@@ -2298,9 +2311,6 @@
<string name="source_added">Personalizados</string>
<string name="setup_stores">Tiendas</string>
<string name="setup_stores_speed">Nivel de velocidad de descarga</string>
<string name="setup_stores_engine">Motor de las tiendas</string>
<string name="setup_stores_engine_chip_ready">● Motor listo</string>
<string name="setup_stores_engine_chip_missing">Sin compilar</string>
<string name="stores_tier_balanced">Equilibrado</string>
<string name="stores_tier_fast">Rápido</string>
<string name="stores_tier_max">Máximo</string>
@@ -3688,4 +3698,14 @@
<string name="stores_gamejolt_filter_status">Estado</string>
<string name="stores_gamejolt_filter_partners">Socios</string>
<string name="stores_gamejolt_followed">Juegos seguidos</string>
<string name="wow_chat_title">Entrada del chat</string>
<string name="wow_chat_voice">Dictado por voz</string>
<string name="wow_chat_remember">Recordar esta selección</string>
<string name="wow_chat_ask">Preguntar cada vez</string>
<string name="wow_chat_send">Enviar</string>
<string name="wow_chat_listening">Escuchando…</string>
<string name="wow_chat_voice_unavailable">El dictado por voz no está disponible en este dispositivo.</string>
<string name="wow_chat_mic_denied">Se necesita acceso al micrófono para el dictado por voz.</string>
<string name="steam_store_close_steam">Cierra Steam primero</string>
<string name="steam_store_session_wait">Pausa primero la descarga de Steam</string>
</resources>
+23 -3
View File
@@ -556,6 +556,19 @@
<string name="comp_tag_in_use">В употреба</string>
<string name="comp_tag_new">Ново</string>
<string name="comp_tag_stored">Запазено</string>
<string name="comp_mode_title">Как се избират версиите</string>
<string name="comp_mode_auto_detail">Най-новата версия на DroidDeck, винаги актуална</string>
<string name="comp_mode_manual_detail">Избирайте и инсталирайте версии сами</string>
<string name="comp_auto_title">Auto поддържа %1$s актуален</string>
<string name="comp_auto_hint">Новите версии се инсталират във фонов режим. Ако игра, която е работила, се затвори до секунди два пъти, Auto се връща към работещата версия.</string>
<string name="comp_auto_fallback">Резервна: %1$s</string>
<string name="comp_auto_checking">Търсене на версии…</string>
<string name="comp_auto_none">Нито един DroidDeck-Proton не го използва</string>
<string name="comp_auto_waits_network">Актуализациите Auto чакат връзка.</string>
<string name="comp_auto_check_failed">Новите версии не можаха да бъдат проверени.</string>
<string name="comp_auto_waits_unmetered">Новите версии чакат неотчитана връзка, изключен режим за пестене на батерията и охладено устройство.</string>
<string name="comp_auto_updated">%1$s е обновен до %2$s.</string>
<string name="comp_auto_rolled_back">%1$s %2$s два пъти затвори игра до секунди, затова Auto се върна към %3$s.</string>
<string name="perf_title">Производителност</string>
<string name="perf_lede">CPU ядра, корекции на сесията и името на хоста. Прилага се от следващата сесия.</string>
<string name="perf_client_cores_group">Ядра за клиента на Steam</string>
@@ -2229,9 +2242,6 @@
<string name="source_added">Персонализирана</string>
<string name="setup_stores">Магазини</string>
<string name="setup_stores_speed">Скорост на изтегляне</string>
<string name="setup_stores_engine">Ядро на магазините</string>
<string name="setup_stores_engine_chip_ready">● Ядрото е готово</string>
<string name="setup_stores_engine_chip_missing">Не е компилирано</string>
<string name="stores_tier_balanced">Балансирано</string>
<string name="stores_tier_fast">Бързо</string>
<string name="stores_tier_max">Максимално</string>
@@ -3676,4 +3686,14 @@
<string name="stores_gamejolt_filter_status">Статус</string>
<string name="stores_gamejolt_filter_partners">Партньори</string>
<string name="stores_gamejolt_followed">Следвани игри</string>
<string name="wow_chat_title">Въвеждане в чата</string>
<string name="wow_chat_voice">Гласово въвеждане</string>
<string name="wow_chat_remember">Запомни този избор</string>
<string name="wow_chat_ask">Питай всеки път</string>
<string name="wow_chat_send">Изпрати</string>
<string name="wow_chat_listening">Слушане…</string>
<string name="wow_chat_voice_unavailable">Гласовото въвеждане не е налично на това устройство.</string>
<string name="wow_chat_mic_denied">За гласово въвеждане е нужен достъп до микрофона.</string>
<string name="steam_store_close_steam">Първо затворете Steam</string>
<string name="steam_store_session_wait">Първо поставете на пауза изтеглянето от Steam</string>
</resources>
+23 -3
View File
@@ -560,6 +560,19 @@
<string name="comp_tag_in_use">Používá se</string>
<string name="comp_tag_new">Nové</string>
<string name="comp_tag_stored">Uloženo</string>
<string name="comp_mode_title">Jak se vybírají sestavení</string>
<string name="comp_mode_auto_detail">Nejnovější sestavení DroidDeck, stále aktuální</string>
<string name="comp_mode_manual_detail">Vyberte a instalujte sestavení sami</string>
<string name="comp_auto_title">Auto udržuje %1$s aktuální</string>
<string name="comp_auto_hint">Nová sestavení se instalují na pozadí. Pokud se hra, která dřív fungovala, dvakrát zavře během pár sekund, Auto se vrátí k funkčnímu sestavení.</string>
<string name="comp_auto_fallback">Záložní: %1$s</string>
<string name="comp_auto_checking">Hledání sestavení…</string>
<string name="comp_auto_none">Žádný DroidDeck-Proton to nepoužívá</string>
<string name="comp_auto_waits_network">Aktualizace Auto čekají na připojení.</string>
<string name="comp_auto_check_failed">Nová sestavení nelze zkontrolovat.</string>
<string name="comp_auto_waits_unmetered">Nová sestavení čekají na neměřené připojení, vypnutou úsporu baterie a nepřehřáté zařízení.</string>
<string name="comp_auto_updated">%1$s aktualizováno na %2$s.</string>
<string name="comp_auto_rolled_back">%1$s %2$s dvakrát zavřelo hru během pár sekund, proto se Auto vrátilo k %3$s.</string>
<string name="perf_title">Výkon</string>
<string name="perf_lede">Jádra CPU, opravy relace a název hostitele. Použije se od příští relace.</string>
<string name="perf_client_cores_group">Jádra pro klienta Steam</string>
@@ -2279,9 +2292,6 @@
<string name="source_added">Vlastní</string>
<string name="setup_stores">Obchody</string>
<string name="setup_stores_speed">Úroveň rychlosti stahování</string>
<string name="setup_stores_engine">Jádro obchodů</string>
<string name="setup_stores_engine_chip_ready">● Jádro je připraveno</string>
<string name="setup_stores_engine_chip_missing">Není sestaveno</string>
<string name="stores_tier_balanced">Vyvážené</string>
<string name="stores_tier_fast">Rychlé</string>
<string name="stores_tier_max">Maximální</string>
@@ -3754,4 +3764,14 @@
<string name="stores_gamejolt_filter_status">Stav</string>
<string name="stores_gamejolt_filter_partners">Partneři</string>
<string name="stores_gamejolt_followed">Sledované hry</string>
<string name="wow_chat_title">Zadávání do chatu</string>
<string name="wow_chat_voice">Hlasové psaní</string>
<string name="wow_chat_remember">Zapamatovat tuto volbu</string>
<string name="wow_chat_ask">Pokaždé se zeptat</string>
<string name="wow_chat_send">Odeslat</string>
<string name="wow_chat_listening">Poslouchám…</string>
<string name="wow_chat_voice_unavailable">Hlasové psaní není na tomto zařízení k dispozici.</string>
<string name="wow_chat_mic_denied">Pro hlasové psaní je potřeba přístup k mikrofonu.</string>
<string name="steam_store_close_steam">Nejprve zavřete Steam</string>
<string name="steam_store_session_wait">Nejprve pozastavte stahování ze Steamu</string>
</resources>
+23 -3
View File
@@ -556,6 +556,19 @@
<string name="comp_tag_in_use">I brug</string>
<string name="comp_tag_new">Ny</string>
<string name="comp_tag_stored">Gemt</string>
<string name="comp_mode_title">Sådan vælges builds</string>
<string name="comp_mode_auto_detail">Nyeste DroidDeck-build, altid opdateret</string>
<string name="comp_mode_manual_detail">Vælg og installer builds selv</string>
<string name="comp_auto_title">Auto holder %1$s opdateret</string>
<string name="comp_auto_hint">Nye builds installeres i baggrunden. Hvis et spil, der virkede før, lukker inden for sekunder to gange, går Auto tilbage til det build, der virkede.</string>
<string name="comp_auto_fallback">Reserve: %1$s</string>
<string name="comp_auto_checking">Søger efter builds…</string>
<string name="comp_auto_none">Ingen DroidDeck-Proton bruger dette</string>
<string name="comp_auto_waits_network">Auto-opdateringer venter på en forbindelse.</string>
<string name="comp_auto_check_failed">Kunne ikke søge efter nye builds.</string>
<string name="comp_auto_waits_unmetered">Nye builds venter på en ubegrænset forbindelse, slået batterisparer fra og en kølig enhed.</string>
<string name="comp_auto_updated">%1$s opdateret til %2$s.</string>
<string name="comp_auto_rolled_back">%1$s %2$s lukkede et spil inden for sekunder to gange, så Auto gik tilbage til %3$s.</string>
<string name="perf_title">Ydelse</string>
<string name="perf_lede">CPU-kerner, sessionsrettelser og værtsnavn. Gælder fra næste session.</string>
<string name="perf_client_cores_group">Steam-klientens kerner</string>
@@ -2229,9 +2242,6 @@
<string name="source_added">Brugerdefineret</string>
<string name="setup_stores">Butikker</string>
<string name="setup_stores_speed">Downloadhastighed</string>
<string name="setup_stores_engine">Butiksmotor</string>
<string name="setup_stores_engine_chip_ready">● Motor klar</string>
<string name="setup_stores_engine_chip_missing">Ikke bygget</string>
<string name="stores_tier_balanced">Afbalanceret</string>
<string name="stores_tier_fast">Hurtig</string>
<string name="stores_tier_max">Maks</string>
@@ -3676,4 +3686,14 @@
<string name="stores_gamejolt_filter_status">Status</string>
<string name="stores_gamejolt_filter_partners">Partnere</string>
<string name="stores_gamejolt_followed">Fulgte spil</string>
<string name="wow_chat_title">Chatinput</string>
<string name="wow_chat_voice">Stemmeindtastning</string>
<string name="wow_chat_remember">Husk dette valg</string>
<string name="wow_chat_ask">Spørg hver gang</string>
<string name="wow_chat_send">Send</string>
<string name="wow_chat_listening">Lytter…</string>
<string name="wow_chat_voice_unavailable">Stemmeindtastning er ikke tilgængelig på denne enhed.</string>
<string name="wow_chat_mic_denied">Mikrofonadgang er nødvendig for stemmeindtastning.</string>
<string name="steam_store_close_steam">Luk Steam først</string>
<string name="steam_store_session_wait">Sæt Steam-downloaden på pause først</string>
</resources>
+23 -3
View File
@@ -556,6 +556,19 @@
<string name="comp_tag_in_use">In Verwendung</string>
<string name="comp_tag_new">Neu</string>
<string name="comp_tag_stored">Gespeichert</string>
<string name="comp_mode_title">Wie Builds gewählt werden</string>
<string name="comp_mode_auto_detail">Neuester DroidDeck-Build, stets aktuell</string>
<string name="comp_mode_manual_detail">Builds selbst auswählen und installieren</string>
<string name="comp_auto_title">Auto hält %1$s aktuell</string>
<string name="comp_auto_hint">Neue Builds werden im Hintergrund installiert. Schließt sich ein Spiel, das vorher lief, zweimal nach wenigen Sekunden, kehrt Auto zum funktionierenden Build zurück.</string>
<string name="comp_auto_fallback">Ausweich-Build: %1$s</string>
<string name="comp_auto_checking">Suche nach Builds…</string>
<string name="comp_auto_none">Kein DroidDeck-Proton nutzt dies</string>
<string name="comp_auto_waits_network">Auto-Updates warten auf eine Verbindung.</string>
<string name="comp_auto_check_failed">Neue Builds konnten nicht geprüft werden.</string>
<string name="comp_auto_waits_unmetered">Neue Builds warten auf eine nicht getaktete Verbindung, ausgeschalteten Energiesparmodus und ein kühles Gerät.</string>
<string name="comp_auto_updated">%1$s auf %2$s aktualisiert.</string>
<string name="comp_auto_rolled_back">%1$s %2$s hat ein Spiel zweimal nach wenigen Sekunden beendet, daher ist Auto zu %3$s zurückgekehrt.</string>
<string name="perf_title">Leistung</string>
<string name="perf_lede">CPU-Kerne, Sitzungskorrekturen und der Hostname. Gilt ab der nächsten Sitzung.</string>
<string name="perf_client_cores_group">Steam-Client-Kerne</string>
@@ -2221,9 +2234,6 @@
<string name="source_added">Eigene</string>
<string name="setup_stores">Stores</string>
<string name="setup_stores_speed">Download-Tempo</string>
<string name="setup_stores_engine">Store-Engine</string>
<string name="setup_stores_engine_chip_ready">● Engine bereit</string>
<string name="setup_stores_engine_chip_missing">Nicht gebaut</string>
<string name="stores_tier_balanced">Ausgewogen</string>
<string name="stores_tier_fast">Schnell</string>
<string name="stores_tier_max">Max.</string>
@@ -3676,4 +3686,14 @@
<string name="stores_gamejolt_filter_status">Status</string>
<string name="stores_gamejolt_filter_partners">Partner</string>
<string name="stores_gamejolt_followed">Gefolgte Spiele</string>
<string name="wow_chat_title">Chat-Eingabe</string>
<string name="wow_chat_voice">Spracheingabe</string>
<string name="wow_chat_remember">Diese Auswahl merken</string>
<string name="wow_chat_ask">Jedes Mal fragen</string>
<string name="wow_chat_send">Senden</string>
<string name="wow_chat_listening">Hört zu…</string>
<string name="wow_chat_voice_unavailable">Spracheingabe ist auf diesem Gerät nicht verfügbar.</string>
<string name="wow_chat_mic_denied">Für die Spracheingabe wird Mikrofonzugriff benötigt.</string>
<string name="steam_store_close_steam">Schließe zuerst Steam</string>
<string name="steam_store_session_wait">Pausiere zuerst den Steam-Download</string>
</resources>
+23 -3
View File
@@ -556,6 +556,19 @@
<string name="comp_tag_in_use">Σε χρήση</string>
<string name="comp_tag_new">Νέο</string>
<string name="comp_tag_stored">Αποθηκευμένο</string>
<string name="comp_mode_title">Πώς επιλέγονται οι εκδόσεις</string>
<string name="comp_mode_auto_detail">Νεότερη έκδοση DroidDeck, πάντα ενημερωμένη</string>
<string name="comp_mode_manual_detail">Επιλέξτε και εγκαταστήστε εκδόσεις μόνοι σας</string>
<string name="comp_auto_title">Το Auto κρατά το %1$s ενημερωμένο</string>
<string name="comp_auto_hint">Οι νέες εκδόσεις εγκαθίστανται στο παρασκήνιο. Αν ένα παιχνίδι που λειτουργούσε κλείσει μέσα σε δευτερόλεπτα δύο φορές, το Auto επιστρέφει στην έκδοση που λειτουργούσε.</string>
<string name="comp_auto_fallback">Εφεδρική: %1$s</string>
<string name="comp_auto_checking">Αναζήτηση εκδόσεων…</string>
<string name="comp_auto_none">Κανένα DroidDeck-Proton δεν το χρησιμοποιεί</string>
<string name="comp_auto_waits_network">Οι ενημερώσεις Auto περιμένουν σύνδεση.</string>
<string name="comp_auto_check_failed">Δεν ήταν δυνατός ο έλεγχος για νέες εκδόσεις.</string>
<string name="comp_auto_waits_unmetered">Οι νέες εκδόσεις περιμένουν σύνδεση χωρίς όριο δεδομένων, απενεργοποιημένη εξοικονόμηση μπαταρίας και δροσερή συσκευή.</string>
<string name="comp_auto_updated">Το %1$s ενημερώθηκε σε %2$s.</string>
<string name="comp_auto_rolled_back">Το %1$s %2$s έκλεισε ένα παιχνίδι μέσα σε δευτερόλεπτα δύο φορές, οπότε το Auto επέστρεψε στο %3$s.</string>
<string name="perf_title">Απόδοση</string>
<string name="perf_lede">Πυρήνες CPU, διορθώσεις συνεδρίας και το όνομα κεντρικού υπολογιστή. Εφαρμόζεται στην επόμενη συνεδρία.</string>
<string name="perf_client_cores_group">Πυρήνες πελάτη Steam</string>
@@ -2229,9 +2242,6 @@
<string name="source_added">Προσαρμοσμένο</string>
<string name="setup_stores">Καταστήματα</string>
<string name="setup_stores_speed">Επίπεδο ταχύτητας λήψης</string>
<string name="setup_stores_engine">Μηχανή καταστημάτων</string>
<string name="setup_stores_engine_chip_ready">● Η μηχανή είναι έτοιμη</string>
<string name="setup_stores_engine_chip_missing">Δεν έχει χτιστεί</string>
<string name="stores_tier_balanced">Ισορροπημένο</string>
<string name="stores_tier_fast">Ταχύ</string>
<string name="stores_tier_max">Μέγιστο</string>
@@ -3676,4 +3686,14 @@
<string name="stores_gamejolt_filter_status">Κατάσταση</string>
<string name="stores_gamejolt_filter_partners">Συνεργάτες</string>
<string name="stores_gamejolt_followed">Παιχνίδια που ακολουθείτε</string>
<string name="wow_chat_title">Εισαγωγή συνομιλίας</string>
<string name="wow_chat_voice">Φωνητική πληκτρολόγηση</string>
<string name="wow_chat_remember">Απομνημόνευση αυτής της επιλογής</string>
<string name="wow_chat_ask">Ερώτηση κάθε φορά</string>
<string name="wow_chat_send">Αποστολή</string>
<string name="wow_chat_listening">Ακρόαση…</string>
<string name="wow_chat_voice_unavailable">Η φωνητική πληκτρολόγηση δεν είναι διαθέσιμη σε αυτή τη συσκευή.</string>
<string name="wow_chat_mic_denied">Απαιτείται πρόσβαση στο μικρόφωνο για φωνητική πληκτρολόγηση.</string>
<string name="steam_store_close_steam">Κλείστε πρώτα το Steam</string>
<string name="steam_store_session_wait">Θέστε πρώτα σε παύση τη λήψη του Steam</string>
</resources>
+23 -3
View File
@@ -558,6 +558,19 @@
<string name="comp_tag_in_use">En uso</string>
<string name="comp_tag_new">Nuevo</string>
<string name="comp_tag_stored">Guardado</string>
<string name="comp_mode_title">Cómo se eligen las versiones</string>
<string name="comp_mode_auto_detail">Versión más reciente de DroidDeck, siempre al día</string>
<string name="comp_mode_manual_detail">Elige e instala las versiones tú mismo</string>
<string name="comp_auto_title">Auto mantiene %1$s al día</string>
<string name="comp_auto_hint">Las nuevas versiones se instalan en segundo plano. Si un juego que funcionaba se cierra en segundos dos veces, Auto vuelve a la versión que funcionaba.</string>
<string name="comp_auto_fallback">Respaldo: %1$s</string>
<string name="comp_auto_checking">Buscando versiones…</string>
<string name="comp_auto_none">Ningún DroidDeck-Proton lo usa</string>
<string name="comp_auto_waits_network">Las actualizaciones Auto esperan una conexión.</string>
<string name="comp_auto_check_failed">No se pudieron buscar nuevas versiones.</string>
<string name="comp_auto_waits_unmetered">Las nuevas versiones esperan una conexión sin límite de datos, el ahorro de batería desactivado y el dispositivo frío.</string>
<string name="comp_auto_updated">%1$s actualizado a %2$s.</string>
<string name="comp_auto_rolled_back">%1$s %2$s cerró un juego en segundos dos veces, así que Auto volvió a %3$s.</string>
<string name="perf_title">Rendimiento</string>
<string name="perf_lede">Núcleos de CPU, correcciones de sesión y nombre del host. Se aplica en la próxima sesión.</string>
<string name="perf_client_cores_group">Núcleos del cliente de Steam</string>
@@ -2254,9 +2267,6 @@
<string name="source_added">Personalizados</string>
<string name="setup_stores">Tiendas</string>
<string name="setup_stores_speed">Nivel de velocidad de descarga</string>
<string name="setup_stores_engine">Motor de las tiendas</string>
<string name="setup_stores_engine_chip_ready">● Motor listo</string>
<string name="setup_stores_engine_chip_missing">Sin compilar</string>
<string name="stores_tier_balanced">Equilibrado</string>
<string name="stores_tier_fast">Rápido</string>
<string name="stores_tier_max">Máximo</string>
@@ -3715,4 +3725,14 @@
<string name="stores_gamejolt_filter_status">Estado</string>
<string name="stores_gamejolt_filter_partners">Socios</string>
<string name="stores_gamejolt_followed">Juegos seguidos</string>
<string name="wow_chat_title">Entrada del chat</string>
<string name="wow_chat_voice">Dictado por voz</string>
<string name="wow_chat_remember">Recordar esta selección</string>
<string name="wow_chat_ask">Preguntar cada vez</string>
<string name="wow_chat_send">Enviar</string>
<string name="wow_chat_listening">Escuchando…</string>
<string name="wow_chat_voice_unavailable">El dictado por voz no está disponible en este dispositivo.</string>
<string name="wow_chat_mic_denied">Se necesita acceso al micrófono para el dictado por voz.</string>
<string name="steam_store_close_steam">Cierra Steam primero</string>
<string name="steam_store_session_wait">Pausa primero la descarga de Steam</string>
</resources>
+23 -3
View File
@@ -556,6 +556,19 @@
<string name="comp_tag_in_use">Käytössä</string>
<string name="comp_tag_new">Uusi</string>
<string name="comp_tag_stored">Tallennettu</string>
<string name="comp_mode_title">Miten versiot valitaan</string>
<string name="comp_mode_auto_detail">Uusin DroidDeck-versio, aina ajan tasalla</string>
<string name="comp_mode_manual_detail">Valitse ja asenna versiot itse</string>
<string name="comp_auto_title">Auto pitää %1$s ajan tasalla</string>
<string name="comp_auto_hint">Uudet versiot asentuvat taustalla. Jos aiemmin toiminut peli sulkeutuu sekunneissa kahdesti, Auto palaa toimineeseen versioon.</string>
<string name="comp_auto_fallback">Varaversio: %1$s</string>
<string name="comp_auto_checking">Haetaan versioita…</string>
<string name="comp_auto_none">Mikään DroidDeck-Proton ei käytä tätä</string>
<string name="comp_auto_waits_network">Auto-päivitykset odottavat yhteyttä.</string>
<string name="comp_auto_check_failed">Uusia versioita ei voitu tarkistaa.</string>
<string name="comp_auto_waits_unmetered">Uudet versiot odottavat rajoittamatonta yhteyttä, virransäästön poistoa ja viileää laitetta.</string>
<string name="comp_auto_updated">%1$s päivitetty versioon %2$s.</string>
<string name="comp_auto_rolled_back">%1$s %2$s sulki pelin sekunneissa kahdesti, joten Auto palasi versioon %3$s.</string>
<string name="perf_title">Suorituskyky</string>
<string name="perf_lede">CPU-ytimet, istunnon korjaukset ja isäntänimi. Tulee voimaan seuraavassa istunnossa.</string>
<string name="perf_client_cores_group">Steam-asiakasohjelman ytimet</string>
@@ -2229,9 +2242,6 @@
<string name="source_added">Mukautettu</string>
<string name="setup_stores">Kaupat</string>
<string name="setup_stores_speed">Latausnopeuden taso</string>
<string name="setup_stores_engine">Kauppojen moottori</string>
<string name="setup_stores_engine_chip_ready">● Moottori valmis</string>
<string name="setup_stores_engine_chip_missing">Ei koottu</string>
<string name="stores_tier_balanced">Tasapainotettu</string>
<string name="stores_tier_fast">Nopea</string>
<string name="stores_tier_max">Maksimi</string>
@@ -3676,4 +3686,14 @@
<string name="stores_gamejolt_filter_status">Tila</string>
<string name="stores_gamejolt_filter_partners">Kumppanit</string>
<string name="stores_gamejolt_followed">Seuratut pelit</string>
<string name="wow_chat_title">Chatin syöttö</string>
<string name="wow_chat_voice">Puhekirjoitus</string>
<string name="wow_chat_remember">Muista tämä valinta</string>
<string name="wow_chat_ask">Kysy joka kerta</string>
<string name="wow_chat_send">Lähetä</string>
<string name="wow_chat_listening">Kuunnellaan…</string>
<string name="wow_chat_voice_unavailable">Puhekirjoitus ei ole käytettävissä tällä laitteella.</string>
<string name="wow_chat_mic_denied">Puhekirjoitus vaatii mikrofonin käyttöoikeuden.</string>
<string name="steam_store_close_steam">Sulje Steam ensin</string>
<string name="steam_store_session_wait">Keskeytä Steam-lataus ensin</string>
</resources>
+23 -3
View File
@@ -558,6 +558,19 @@
<string name="comp_tag_in_use">Utilisé</string>
<string name="comp_tag_new">Nouveau</string>
<string name="comp_tag_stored">Enregistré</string>
<string name="comp_mode_title">Choix des versions</string>
<string name="comp_mode_auto_detail">Dernière version DroidDeck, toujours à jour</string>
<string name="comp_mode_manual_detail">Choisir et installer les versions vous-même</string>
<string name="comp_auto_title">Auto garde %1$s à jour</string>
<string name="comp_auto_hint">Les nouvelles versions s\'installent en arrière-plan. Si un jeu qui fonctionnait se ferme deux fois en quelques secondes, Auto revient à la version qui fonctionnait.</string>
<string name="comp_auto_fallback">Secours : %1$s</string>
<string name="comp_auto_checking">Recherche de versions…</string>
<string name="comp_auto_none">Aucun DroidDeck-Proton ne l\'utilise</string>
<string name="comp_auto_waits_network">Les mises à jour Auto attendent une connexion.</string>
<string name="comp_auto_check_failed">Impossible de vérifier les nouvelles versions.</string>
<string name="comp_auto_waits_unmetered">Les nouvelles versions attendent une connexion non limitée, l\'économiseur de batterie désactivé et un appareil frais.</string>
<string name="comp_auto_updated">%1$s mis à jour vers %2$s.</string>
<string name="comp_auto_rolled_back">%1$s %2$s a fermé un jeu en quelques secondes deux fois, Auto est donc revenu à %3$s.</string>
<string name="perf_title">Performance</string>
<string name="perf_lede">Cœurs CPU, correctifs de session et nom d\'hôte. Prendra effet à la prochaine session.</string>
<string name="perf_client_cores_group">Cœurs du client Steam</string>
@@ -2254,9 +2267,6 @@
<string name="source_added">Personnalisé</string>
<string name="setup_stores">Boutiques</string>
<string name="setup_stores_speed">Niveau de vitesse de téléchargement</string>
<string name="setup_stores_engine">Moteur des boutiques</string>
<string name="setup_stores_engine_chip_ready">● Moteur prêt</string>
<string name="setup_stores_engine_chip_missing">Non compilé</string>
<string name="stores_tier_balanced">Équilibré</string>
<string name="stores_tier_fast">Rapide</string>
<string name="stores_tier_max">Max</string>
@@ -3715,4 +3725,14 @@
<string name="stores_gamejolt_filter_status">Statut</string>
<string name="stores_gamejolt_filter_partners">Partenaires</string>
<string name="stores_gamejolt_followed">Jeux suivis</string>
<string name="wow_chat_title">Saisie du chat</string>
<string name="wow_chat_voice">Saisie vocale</string>
<string name="wow_chat_remember">Mémoriser ce choix</string>
<string name="wow_chat_ask">Demander à chaque fois</string>
<string name="wow_chat_send">Envoyer</string>
<string name="wow_chat_listening">Écoute…</string>
<string name="wow_chat_voice_unavailable">La saisie vocale n\'est pas disponible sur cet appareil.</string>
<string name="wow_chat_mic_denied">L\'accès au micro est nécessaire pour la saisie vocale.</string>
<string name="steam_store_close_steam">Fermez d\'abord Steam</string>
<string name="steam_store_session_wait">Mettez d\'abord en pause le téléchargement Steam</string>
</resources>
+23 -3
View File
@@ -556,6 +556,19 @@
<string name="comp_tag_in_use">उपयोग में</string>
<string name="comp_tag_new">नया</string>
<string name="comp_tag_stored">सेव है</string>
<string name="comp_mode_title">बिल्ड कैसे चुने जाते हैं</string>
<string name="comp_mode_auto_detail">सबसे नया DroidDeck बिल्ड, हमेशा अपडेट</string>
<string name="comp_mode_manual_detail">बिल्ड खुद चुनें और इंस्टॉल करें</string>
<string name="comp_auto_title">Auto %1$s को अपडेट रखता है</string>
<string name="comp_auto_hint">नए बिल्ड बैकग्राउंड में इंस्टॉल होते हैं। अगर पहले चलने वाला गेम दो बार कुछ सेकंड में बंद हो जाए, तो Auto काम करने वाले बिल्ड पर लौट जाता है।</string>
<string name="comp_auto_fallback">फ़ॉलबैक: %1$s</string>
<string name="comp_auto_checking">बिल्ड खोजे जा रहे हैं…</string>
<string name="comp_auto_none">कोई DroidDeck-Proton इसका उपयोग नहीं करता</string>
<string name="comp_auto_waits_network">Auto अपडेट कनेक्शन का इंतज़ार कर रहे हैं।</string>
<string name="comp_auto_check_failed">नए बिल्ड नहीं जाँचे जा सके।</string>
<string name="comp_auto_waits_unmetered">नए बिल्ड बिना सीमा वाले कनेक्शन, बंद बैटरी सेवर और ठंडे डिवाइस का इंतज़ार करते हैं।</string>
<string name="comp_auto_updated">%1$s को %2$s पर अपडेट किया गया।</string>
<string name="comp_auto_rolled_back">%1$s %2$s ने दो बार कुछ सेकंड में गेम बंद कर दिया, इसलिए Auto %3$s पर लौट गया।</string>
<string name="perf_title">परफ़ॉर्मेंस</string>
<string name="perf_lede">CPU कोर, सेशन फ़िक्स और होस्ट नाम। अगले सेशन से लागू होता है।</string>
<string name="perf_client_cores_group">Steam क्लाइंट कोर</string>
@@ -2229,9 +2242,6 @@
<string name="source_added">कस्टम</string>
<string name="setup_stores">स्टोर</string>
<string name="setup_stores_speed">डाउनलोड स्पीड टियर</string>
<string name="setup_stores_engine">स्टोर इंजन</string>
<string name="setup_stores_engine_chip_ready">● इंजन तैयार</string>
<string name="setup_stores_engine_chip_missing">नहीं बना</string>
<string name="stores_tier_balanced">बैलेंस्ड</string>
<string name="stores_tier_fast">फ़ास्ट</string>
<string name="stores_tier_max">मैक्स</string>
@@ -3676,4 +3686,14 @@
<string name="stores_gamejolt_filter_status">स्थिति</string>
<string name="stores_gamejolt_filter_partners">पार्टनर</string>
<string name="stores_gamejolt_followed">फ़ॉलो किए गए गेम</string>
<string name="wow_chat_title">चैट इनपुट</string>
<string name="wow_chat_voice">आवाज़ से टाइप करें</string>
<string name="wow_chat_remember">यह चुनाव याद रखें</string>
<string name="wow_chat_ask">हर बार पूछें</string>
<string name="wow_chat_send">भेजें</string>
<string name="wow_chat_listening">सुन रहा है…</string>
<string name="wow_chat_voice_unavailable">इस डिवाइस पर आवाज़ से टाइपिंग उपलब्ध नहीं है।</string>
<string name="wow_chat_mic_denied">आवाज़ से टाइपिंग के लिए माइक्रोफ़ोन की अनुमति चाहिए।</string>
<string name="steam_store_close_steam">पहले Steam बंद करें</string>
<string name="steam_store_session_wait">पहले Steam डाउनलोड रोकें</string>
</resources>
+23 -3
View File
@@ -556,6 +556,19 @@
<string name="comp_tag_in_use">Használatban</string>
<string name="comp_tag_new">Új</string>
<string name="comp_tag_stored">Tárolva</string>
<string name="comp_mode_title">Hogyan választódnak a buildek</string>
<string name="comp_mode_auto_detail">Legújabb DroidDeck build, mindig naprakész</string>
<string name="comp_mode_manual_detail">Buildek kiválasztása és telepítése saját kézzel</string>
<string name="comp_auto_title">Az Auto naprakészen tartja: %1$s</string>
<string name="comp_auto_hint">Az új buildek a háttérben települnek. Ha egy korábban működő játék kétszer is másodperceken belül bezárul, az Auto visszaáll a működő buildre.</string>
<string name="comp_auto_fallback">Tartalék: %1$s</string>
<string name="comp_auto_checking">Buildek keresése…</string>
<string name="comp_auto_none">Egyik DroidDeck-Proton sem használja</string>
<string name="comp_auto_waits_network">Az Auto frissítések kapcsolatra várnak.</string>
<string name="comp_auto_check_failed">Nem sikerült új buildeket keresni.</string>
<string name="comp_auto_waits_unmetered">Az új buildek nem forgalomkorlátos kapcsolatra, kikapcsolt energiatakarékos módra és hűvös eszközre várnak.</string>
<string name="comp_auto_updated">%1$s frissítve: %2$s.</string>
<string name="comp_auto_rolled_back">%1$s %2$s kétszer is másodperceken belül bezárt egy játékot, ezért az Auto visszaállt erre: %3$s.</string>
<string name="perf_title">Teljesítmény</string>
<string name="perf_lede">CPU-magok, munkamenet-javítások és a hosztnév. A következő munkamenettől érvényes.</string>
<string name="perf_client_cores_group">Steam-kliens magok</string>
@@ -2229,9 +2242,6 @@
<string name="source_added">Egyéni</string>
<string name="setup_stores">Áruházak</string>
<string name="setup_stores_speed">Letöltési sebességi szint</string>
<string name="setup_stores_engine">Áruházmotor</string>
<string name="setup_stores_engine_chip_ready">● A motor kész</string>
<string name="setup_stores_engine_chip_missing">Nincs buildelve</string>
<string name="stores_tier_balanced">Kiegyensúlyozott</string>
<string name="stores_tier_fast">Gyors</string>
<string name="stores_tier_max">Max</string>
@@ -3676,4 +3686,14 @@
<string name="stores_gamejolt_filter_status">Állapot</string>
<string name="stores_gamejolt_filter_partners">Partnerek</string>
<string name="stores_gamejolt_followed">Követett játékok</string>
<string name="wow_chat_title">Csevegés bevitele</string>
<string name="wow_chat_voice">Hangalapú gépelés</string>
<string name="wow_chat_remember">Választás megjegyzése</string>
<string name="wow_chat_ask">Kérdezzen minden alkalommal</string>
<string name="wow_chat_send">Küldés</string>
<string name="wow_chat_listening">Figyelés…</string>
<string name="wow_chat_voice_unavailable">A hangalapú gépelés nem érhető el ezen az eszközön.</string>
<string name="wow_chat_mic_denied">A hangalapú gépeléshez mikrofon-hozzáférés szükséges.</string>
<string name="steam_store_close_steam">Előbb zárd be a Steamet</string>
<string name="steam_store_session_wait">Előbb szüneteltesd a Steam-letöltést</string>
</resources>
+23 -3
View File
@@ -554,6 +554,19 @@
<string name="comp_tag_in_use">Digunakan</string>
<string name="comp_tag_new">Baru</string>
<string name="comp_tag_stored">Tersimpan</string>
<string name="comp_mode_title">Cara build dipilih</string>
<string name="comp_mode_auto_detail">Build DroidDeck terbaru, selalu mutakhir</string>
<string name="comp_mode_manual_detail">Pilih dan pasang build sendiri</string>
<string name="comp_auto_title">Auto menjaga %1$s tetap mutakhir</string>
<string name="comp_auto_hint">Build baru dipasang di latar belakang. Jika game yang sebelumnya berjalan tertutup dalam hitungan detik dua kali, Auto kembali ke build yang berfungsi.</string>
<string name="comp_auto_fallback">Cadangan: %1$s</string>
<string name="comp_auto_checking">Mencari build…</string>
<string name="comp_auto_none">Tidak ada DroidDeck-Proton yang memakainya</string>
<string name="comp_auto_waits_network">Pembaruan Auto menunggu koneksi.</string>
<string name="comp_auto_check_failed">Tidak dapat memeriksa build baru.</string>
<string name="comp_auto_waits_unmetered">Build baru menunggu koneksi tanpa kuota, penghemat baterai mati, dan perangkat yang dingin.</string>
<string name="comp_auto_updated">%1$s diperbarui ke %2$s.</string>
<string name="comp_auto_rolled_back">%1$s %2$s menutup game dalam hitungan detik dua kali, jadi Auto kembali ke %3$s.</string>
<string name="perf_title">Performa</string>
<string name="perf_lede">Core CPU, perbaikan sesi, dan nama host. Berlaku pada sesi berikutnya.</string>
<string name="perf_client_cores_group">Core klien Steam</string>
@@ -2204,9 +2217,6 @@
<string name="source_added">Khusus</string>
<string name="setup_stores">Toko</string>
<string name="setup_stores_speed">Tingkat kecepatan unduhan</string>
<string name="setup_stores_engine">Mesin toko</string>
<string name="setup_stores_engine_chip_ready">● Mesin siap</string>
<string name="setup_stores_engine_chip_missing">Belum dibuat</string>
<string name="stores_tier_balanced">Seimbang</string>
<string name="stores_tier_fast">Cepat</string>
<string name="stores_tier_max">Maks</string>
@@ -3646,4 +3656,14 @@
<string name="stores_gamejolt_filter_status">Status</string>
<string name="stores_gamejolt_filter_partners">Mitra</string>
<string name="stores_gamejolt_followed">Game yang diikuti</string>
<string name="wow_chat_title">Input obrolan</string>
<string name="wow_chat_voice">Ketik dengan suara</string>
<string name="wow_chat_remember">Ingat pilihan ini</string>
<string name="wow_chat_ask">Tanya setiap kali</string>
<string name="wow_chat_send">Kirim</string>
<string name="wow_chat_listening">Mendengarkan…</string>
<string name="wow_chat_voice_unavailable">Ketik dengan suara tidak tersedia di perangkat ini.</string>
<string name="wow_chat_mic_denied">Akses mikrofon diperlukan untuk mengetik dengan suara.</string>
<string name="steam_store_close_steam">Tutup Steam terlebih dahulu</string>
<string name="steam_store_session_wait">Jeda unduhan Steam terlebih dahulu</string>
</resources>
+23 -3
View File
@@ -558,6 +558,19 @@
<string name="comp_tag_in_use">In uso</string>
<string name="comp_tag_new">Nuovo</string>
<string name="comp_tag_stored">Salvato</string>
<string name="comp_mode_title">Come vengono scelte le build</string>
<string name="comp_mode_auto_detail">Build DroidDeck più recente, sempre aggiornata</string>
<string name="comp_mode_manual_detail">Scegli e installa tu le build</string>
<string name="comp_auto_title">Auto mantiene aggiornato %1$s</string>
<string name="comp_auto_hint">Le nuove build si installano in background. Se un gioco che funzionava si chiude in pochi secondi per due volte, Auto torna alla build che funzionava.</string>
<string name="comp_auto_fallback">Riserva: %1$s</string>
<string name="comp_auto_checking">Ricerca build…</string>
<string name="comp_auto_none">Nessun DroidDeck-Proton lo usa</string>
<string name="comp_auto_waits_network">Gli aggiornamenti Auto attendono una connessione.</string>
<string name="comp_auto_check_failed">Impossibile cercare nuove build.</string>
<string name="comp_auto_waits_unmetered">Le nuove build attendono una connessione non a consumo, il risparmio batteria disattivato e un dispositivo fresco.</string>
<string name="comp_auto_updated">%1$s aggiornato a %2$s.</string>
<string name="comp_auto_rolled_back">%1$s %2$s ha chiuso un gioco in pochi secondi per due volte, quindi Auto è tornato a %3$s.</string>
<string name="perf_title">Prestazioni</string>
<string name="perf_lede">Core della CPU, correzioni della sessione e nome host. Si applica dalla prossima sessione.</string>
<string name="perf_client_cores_group">Core del client Steam</string>
@@ -2246,9 +2259,6 @@
<string name="source_added">Personalizzati</string>
<string name="setup_stores">Negozi</string>
<string name="setup_stores_speed">Livello di velocità di download</string>
<string name="setup_stores_engine">Motore dei negozi</string>
<string name="setup_stores_engine_chip_ready">● Motore pronto</string>
<string name="setup_stores_engine_chip_missing">Non compilato</string>
<string name="stores_tier_balanced">Bilanciato</string>
<string name="stores_tier_fast">Veloce</string>
<string name="stores_tier_max">Massimo</string>
@@ -3715,4 +3725,14 @@
<string name="stores_gamejolt_filter_status">Stato</string>
<string name="stores_gamejolt_filter_partners">Partner</string>
<string name="stores_gamejolt_followed">Giochi seguiti</string>
<string name="wow_chat_title">Input della chat</string>
<string name="wow_chat_voice">Digitazione vocale</string>
<string name="wow_chat_remember">Ricorda questa scelta</string>
<string name="wow_chat_ask">Chiedi ogni volta</string>
<string name="wow_chat_send">Invia</string>
<string name="wow_chat_listening">In ascolto…</string>
<string name="wow_chat_voice_unavailable">La digitazione vocale non è disponibile su questo dispositivo.</string>
<string name="wow_chat_mic_denied">Per la digitazione vocale serve l\'accesso al microfono.</string>
<string name="steam_store_close_steam">Chiudi prima Steam</string>
<string name="steam_store_session_wait">Metti prima in pausa il download di Steam</string>
</resources>
+23 -3
View File
@@ -554,6 +554,19 @@
<string name="comp_tag_in_use">使用中</string>
<string name="comp_tag_new">新規</string>
<string name="comp_tag_stored">保存済み</string>
<string name="comp_mode_title">ビルドの選び方</string>
<string name="comp_mode_auto_detail">最新の DroidDeck ビルドを常に維持</string>
<string name="comp_mode_manual_detail">ビルドを自分で選んでインストール</string>
<string name="comp_auto_title">Auto が %1$s を最新に保ちます</string>
<string name="comp_auto_hint">新しいビルドはバックグラウンドでインストールされます。以前動いていたゲームが数秒で 2 回終了した場合、Auto は動作していたビルドに戻します。</string>
<string name="comp_auto_fallback">予備: %1$s</string>
<string name="comp_auto_checking">ビルドを確認中…</string>
<string name="comp_auto_none">これを使う DroidDeck-Proton はありません</string>
<string name="comp_auto_waits_network">Auto 更新は接続を待っています。</string>
<string name="comp_auto_check_failed">新しいビルドを確認できませんでした。</string>
<string name="comp_auto_waits_unmetered">新しいビルドは従量制でない接続、バッテリーセーバーのオフ、端末が熱くない状態を待ちます。</string>
<string name="comp_auto_updated">%1$s を %2$s に更新しました。</string>
<string name="comp_auto_rolled_back">%1$s %2$s でゲームが数秒で 2 回終了したため、Auto は %3$s に戻しました。</string>
<string name="perf_title">パフォーマンス</string>
<string name="perf_lede">CPUコア、セッション修正、ホスト名。次回のセッションで有効になります。</string>
<string name="perf_client_cores_group">Steamクライアントコア</string>
@@ -2204,9 +2217,6 @@
<string name="source_added">カスタム</string>
<string name="setup_stores">ストア</string>
<string name="setup_stores_speed">ダウンロード速度レベル</string>
<string name="setup_stores_engine">ストアエンジン</string>
<string name="setup_stores_engine_chip_ready">● エンジン準備完了</string>
<string name="setup_stores_engine_chip_missing">未ビルド</string>
<string name="stores_tier_balanced">バランス</string>
<string name="stores_tier_fast">高速</string>
<string name="stores_tier_max">最大</string>
@@ -3646,4 +3656,14 @@
<string name="stores_gamejolt_filter_status">ステータス</string>
<string name="stores_gamejolt_filter_partners">パートナー</string>
<string name="stores_gamejolt_followed">フォロー中のゲーム</string>
<string name="wow_chat_title">チャット入力</string>
<string name="wow_chat_voice">音声入力</string>
<string name="wow_chat_remember">この選択を記憶する</string>
<string name="wow_chat_ask">毎回確認する</string>
<string name="wow_chat_send">送信</string>
<string name="wow_chat_listening">聞き取り中…</string>
<string name="wow_chat_voice_unavailable">このデバイスでは音声入力を使用できません。</string>
<string name="wow_chat_mic_denied">音声入力にはマイクへのアクセスが必要です。</string>
<string name="steam_store_close_steam">先に Steam を閉じてください</string>
<string name="steam_store_session_wait">先に Steam のダウンロードを一時停止してください</string>
</resources>
+23 -3
View File
@@ -554,6 +554,19 @@
<string name="comp_tag_in_use">사용 중</string>
<string name="comp_tag_new">신규</string>
<string name="comp_tag_stored">저장됨</string>
<string name="comp_mode_title">빌드 선택 방식</string>
<string name="comp_mode_auto_detail">최신 DroidDeck 빌드, 항상 최신 유지</string>
<string name="comp_mode_manual_detail">빌드를 직접 선택하고 설치</string>
<string name="comp_auto_title">Auto가 %1$s을(를) 최신으로 유지합니다</string>
<string name="comp_auto_hint">새 빌드는 백그라운드에서 설치됩니다. 이전에 실행되던 게임이 몇 초 만에 두 번 종료되면 Auto가 작동하던 빌드로 되돌립니다.</string>
<string name="comp_auto_fallback">대체: %1$s</string>
<string name="comp_auto_checking">빌드 확인 중…</string>
<string name="comp_auto_none">이를 사용하는 DroidDeck-Proton이 없습니다</string>
<string name="comp_auto_waits_network">Auto 업데이트가 연결을 기다리는 중입니다.</string>
<string name="comp_auto_check_failed">새 빌드를 확인할 수 없습니다.</string>
<string name="comp_auto_waits_unmetered">새 빌드는 데이터 무제한 연결, 배터리 세이버 꺼짐, 기기가 뜨겁지 않은 상태를 기다립니다.</string>
<string name="comp_auto_updated">%1$s을(를) %2$s(으)로 업데이트했습니다.</string>
<string name="comp_auto_rolled_back">%1$s %2$s(으)로 게임이 몇 초 만에 두 번 종료되어 Auto가 %3$s(으)로 되돌렸습니다.</string>
<string name="perf_title">성능</string>
<string name="perf_lede">CPU 코어, 세션 수정 및 호스트 이름. 다음 세션에 적용됩니다.</string>
<string name="perf_client_cores_group">Steam 클라이언트 코어</string>
@@ -2204,9 +2217,6 @@
<string name="source_added">사용자 정의</string>
<string name="setup_stores">스토어</string>
<string name="setup_stores_speed">다운로드 속도 단계</string>
<string name="setup_stores_engine">스토어 엔진</string>
<string name="setup_stores_engine_chip_ready">● 엔진 준비됨</string>
<string name="setup_stores_engine_chip_missing">빌드되지 않음</string>
<string name="stores_tier_balanced">균형</string>
<string name="stores_tier_fast">빠름</string>
<string name="stores_tier_max">최대</string>
@@ -3646,4 +3656,14 @@
<string name="stores_gamejolt_filter_status">상태</string>
<string name="stores_gamejolt_filter_partners">파트너</string>
<string name="stores_gamejolt_followed">팔로우한 게임</string>
<string name="wow_chat_title">채팅 입력</string>
<string name="wow_chat_voice">음성 입력</string>
<string name="wow_chat_remember">이 선택 기억하기</string>
<string name="wow_chat_ask">매번 묻기</string>
<string name="wow_chat_send">보내기</string>
<string name="wow_chat_listening">듣는 중…</string>
<string name="wow_chat_voice_unavailable">이 기기에서는 음성 입력을 사용할 수 없습니다.</string>
<string name="wow_chat_mic_denied">음성 입력을 하려면 마이크 접근 권한이 필요합니다.</string>
<string name="steam_store_close_steam">먼저 Steam을 닫으세요</string>
<string name="steam_store_session_wait">먼저 Steam 다운로드를 일시 중지하세요</string>
</resources>
+23 -3
View File
@@ -554,6 +554,19 @@
<string name="comp_tag_in_use">Digunakan</string>
<string name="comp_tag_new">Baharu</string>
<string name="comp_tag_stored">Disimpan</string>
<string name="comp_mode_title">Cara binaan dipilih</string>
<string name="comp_mode_auto_detail">Binaan DroidDeck terbaharu, sentiasa terkini</string>
<string name="comp_mode_manual_detail">Pilih dan pasang binaan sendiri</string>
<string name="comp_auto_title">Auto memastikan %1$s sentiasa terkini</string>
<string name="comp_auto_hint">Binaan baharu dipasang di latar belakang. Jika permainan yang pernah berjalan tertutup dalam beberapa saat dua kali, Auto kembali ke binaan yang berfungsi.</string>
<string name="comp_auto_fallback">Sandaran: %1$s</string>
<string name="comp_auto_checking">Mencari binaan…</string>
<string name="comp_auto_none">Tiada DroidDeck-Proton yang menggunakannya</string>
<string name="comp_auto_waits_network">Kemas kini Auto menunggu sambungan.</string>
<string name="comp_auto_check_failed">Tidak dapat menyemak binaan baharu.</string>
<string name="comp_auto_waits_unmetered">Binaan baharu menunggu sambungan tanpa meter, penjimat bateri dimatikan dan peranti yang sejuk.</string>
<string name="comp_auto_updated">%1$s dikemas kini ke %2$s.</string>
<string name="comp_auto_rolled_back">%1$s %2$s menutup permainan dalam beberapa saat dua kali, jadi Auto kembali ke %3$s.</string>
<string name="perf_title">Prestasi</string>
<string name="perf_lede">Teras CPU, pembaikan sesi dan nama hos. Berkuat kuasa pada sesi seterusnya.</string>
<string name="perf_client_cores_group">Teras klien Steam</string>
@@ -2204,9 +2217,6 @@
<string name="source_added">Tersuai</string>
<string name="setup_stores">Kedai</string>
<string name="setup_stores_speed">Tahap kelajuan muat turun</string>
<string name="setup_stores_engine">Enjin kedai</string>
<string name="setup_stores_engine_chip_ready">● Enjin sedia</string>
<string name="setup_stores_engine_chip_missing">Tidak dibina</string>
<string name="stores_tier_balanced">Seimbang</string>
<string name="stores_tier_fast">Pantas</string>
<string name="stores_tier_max">Maksimum</string>
@@ -3646,4 +3656,14 @@
<string name="stores_gamejolt_filter_status">Status</string>
<string name="stores_gamejolt_filter_partners">Rakan kongsi</string>
<string name="stores_gamejolt_followed">Permainan diikuti</string>
<string name="wow_chat_title">Input sembang</string>
<string name="wow_chat_voice">Taip dengan suara</string>
<string name="wow_chat_remember">Ingat pilihan ini</string>
<string name="wow_chat_ask">Tanya setiap kali</string>
<string name="wow_chat_send">Hantar</string>
<string name="wow_chat_listening">Mendengar…</string>
<string name="wow_chat_voice_unavailable">Taip dengan suara tidak tersedia pada peranti ini.</string>
<string name="wow_chat_mic_denied">Akses mikrofon diperlukan untuk menaip dengan suara.</string>
<string name="steam_store_close_steam">Tutup Steam dahulu</string>
<string name="steam_store_session_wait">Jeda muat turun Steam dahulu</string>
</resources>
+23 -3
View File
@@ -556,6 +556,19 @@
<string name="comp_tag_in_use">I bruk</string>
<string name="comp_tag_new">Ny</string>
<string name="comp_tag_stored">Lagret</string>
<string name="comp_mode_title">Slik velges bygg</string>
<string name="comp_mode_auto_detail">Nyeste DroidDeck-bygg, alltid oppdatert</string>
<string name="comp_mode_manual_detail">Velg og installer bygg selv</string>
<string name="comp_auto_title">Auto holder %1$s oppdatert</string>
<string name="comp_auto_hint">Nye bygg installeres i bakgrunnen. Hvis et spill som fungerte før lukkes innen sekunder to ganger, går Auto tilbake til bygget som fungerte.</string>
<string name="comp_auto_fallback">Reserve: %1$s</string>
<string name="comp_auto_checking">Ser etter bygg…</string>
<string name="comp_auto_none">Ingen DroidDeck-Proton bruker dette</string>
<string name="comp_auto_waits_network">Auto-oppdateringer venter på en tilkobling.</string>
<string name="comp_auto_check_failed">Kunne ikke se etter nye bygg.</string>
<string name="comp_auto_waits_unmetered">Nye bygg venter på en ubegrenset tilkobling, avslått batterisparing og en kjølig enhet.</string>
<string name="comp_auto_updated">%1$s oppdatert til %2$s.</string>
<string name="comp_auto_rolled_back">%1$s %2$s lukket et spill innen sekunder to ganger, så Auto gikk tilbake til %3$s.</string>
<string name="perf_title">Ytelse</string>
<string name="perf_lede">CPU-kjerner, sesjonsfikser og vertsnavnet. Gjelder fra neste sesjon.</string>
<string name="perf_client_cores_group">Steam-klientens kjerner</string>
@@ -2229,9 +2242,6 @@
<string name="source_added">Egendefinert</string>
<string name="setup_stores">Butikker</string>
<string name="setup_stores_speed">Nedlastingshastighetsnivå</string>
<string name="setup_stores_engine">Butikkmotor</string>
<string name="setup_stores_engine_chip_ready">● Motor klar</string>
<string name="setup_stores_engine_chip_missing">Ikke bygget</string>
<string name="stores_tier_balanced">Balansert</string>
<string name="stores_tier_fast">Rask</string>
<string name="stores_tier_max">Maks</string>
@@ -3676,4 +3686,14 @@
<string name="stores_gamejolt_filter_status">Status</string>
<string name="stores_gamejolt_filter_partners">Partnere</string>
<string name="stores_gamejolt_followed">Fulgte spill</string>
<string name="wow_chat_title">Chatinndata</string>
<string name="wow_chat_voice">Taleinntasting</string>
<string name="wow_chat_remember">Husk dette valget</string>
<string name="wow_chat_ask">Spør hver gang</string>
<string name="wow_chat_send">Send</string>
<string name="wow_chat_listening">Lytter…</string>
<string name="wow_chat_voice_unavailable">Taleinntasting er ikke tilgjengelig på denne enheten.</string>
<string name="wow_chat_mic_denied">Mikrofontilgang trengs for taleinntasting.</string>
<string name="steam_store_close_steam">Lukk Steam først</string>
<string name="steam_store_session_wait">Sett Steam-nedlastingen på pause først</string>
</resources>
+23 -3
View File
@@ -556,6 +556,19 @@
<string name="comp_tag_in_use">In gebruik</string>
<string name="comp_tag_new">Nieuw</string>
<string name="comp_tag_stored">Bewaard</string>
<string name="comp_mode_title">Hoe builds worden gekozen</string>
<string name="comp_mode_auto_detail">Nieuwste DroidDeck-build, altijd actueel</string>
<string name="comp_mode_manual_detail">Kies en installeer builds zelf</string>
<string name="comp_auto_title">Auto houdt %1$s actueel</string>
<string name="comp_auto_hint">Nieuwe builds worden op de achtergrond geïnstalleerd. Sluit een game die eerder werkte twee keer binnen enkele seconden, dan gaat Auto terug naar de build die werkte.</string>
<string name="comp_auto_fallback">Terugval: %1$s</string>
<string name="comp_auto_checking">Zoeken naar builds…</string>
<string name="comp_auto_none">Geen DroidDeck-Proton gebruikt dit</string>
<string name="comp_auto_waits_network">Auto-updates wachten op een verbinding.</string>
<string name="comp_auto_check_failed">Kon niet op nieuwe builds controleren.</string>
<string name="comp_auto_waits_unmetered">Nieuwe builds wachten op een onbeperkte verbinding, batterijbesparing uit en een koel apparaat.</string>
<string name="comp_auto_updated">%1$s bijgewerkt naar %2$s.</string>
<string name="comp_auto_rolled_back">%1$s %2$s sloot een game twee keer binnen enkele seconden, dus Auto ging terug naar %3$s.</string>
<string name="perf_title">Prestaties</string>
<string name="perf_lede">CPU-cores, sessiefixes en de hostnaam. Geldt vanaf de volgende sessie.</string>
<string name="perf_client_cores_group">Cores voor de Steam-client</string>
@@ -2229,9 +2242,6 @@
<string name="source_added">Aangepast</string>
<string name="setup_stores">Winkels</string>
<string name="setup_stores_speed">Niveau voor downloadsnelheid</string>
<string name="setup_stores_engine">Winkels-engine</string>
<string name="setup_stores_engine_chip_ready">● Engine gereed</string>
<string name="setup_stores_engine_chip_missing">Niet gebouwd</string>
<string name="stores_tier_balanced">Gebalanceerd</string>
<string name="stores_tier_fast">Snel</string>
<string name="stores_tier_max">Max</string>
@@ -3676,4 +3686,14 @@
<string name="stores_gamejolt_filter_status">Status</string>
<string name="stores_gamejolt_filter_partners">Partners</string>
<string name="stores_gamejolt_followed">Gevolgde games</string>
<string name="wow_chat_title">Chatinvoer</string>
<string name="wow_chat_voice">Spraakinvoer</string>
<string name="wow_chat_remember">Deze keuze onthouden</string>
<string name="wow_chat_ask">Elke keer vragen</string>
<string name="wow_chat_send">Verzenden</string>
<string name="wow_chat_listening">Luisteren…</string>
<string name="wow_chat_voice_unavailable">Spraakinvoer is niet beschikbaar op dit apparaat.</string>
<string name="wow_chat_mic_denied">Voor spraakinvoer is toegang tot de microfoon nodig.</string>
<string name="steam_store_close_steam">Sluit eerst Steam</string>
<string name="steam_store_session_wait">Pauzeer eerst de Steam-download</string>
</resources>
+23 -3
View File
@@ -560,6 +560,19 @@
<string name="comp_tag_in_use">W użyciu</string>
<string name="comp_tag_new">Nowy</string>
<string name="comp_tag_stored">Zapisany</string>
<string name="comp_mode_title">Jak wybierane są wersje</string>
<string name="comp_mode_auto_detail">Najnowsza wersja DroidDeck, zawsze aktualna</string>
<string name="comp_mode_manual_detail">Wybieraj i instaluj wersje samodzielnie</string>
<string name="comp_auto_title">Auto utrzymuje %1$s w aktualności</string>
<string name="comp_auto_hint">Nowe wersje instalują się w tle. Jeśli gra, która działała, dwa razy zamknie się po kilku sekundach, Auto wróci do działającej wersji.</string>
<string name="comp_auto_fallback">Zapasowa: %1$s</string>
<string name="comp_auto_checking">Szukanie wersji…</string>
<string name="comp_auto_none">Żaden DroidDeck-Proton tego nie używa</string>
<string name="comp_auto_waits_network">Aktualizacje Auto czekają na połączenie.</string>
<string name="comp_auto_check_failed">Nie udało się sprawdzić nowych wersji.</string>
<string name="comp_auto_waits_unmetered">Nowe wersje czekają na połączenie bez limitu, wyłączone oszczędzanie baterii i chłodne urządzenie.</string>
<string name="comp_auto_updated">%1$s zaktualizowano do %2$s.</string>
<string name="comp_auto_rolled_back">%1$s %2$s dwa razy zamknął grę po kilku sekundach, więc Auto wróciło do %3$s.</string>
<string name="perf_title">Wydajność</string>
<string name="perf_lede">Rdzenie CPU, poprawki sesji i nazwa hosta. Działa od następnej sesji.</string>
<string name="perf_client_cores_group">Rdzenie klienta Steam</string>
@@ -2279,9 +2292,6 @@
<string name="source_added">Własna</string>
<string name="setup_stores">Sklepy</string>
<string name="setup_stores_speed">Poziom szybkości pobierania</string>
<string name="setup_stores_engine">Mechanizm sklepów</string>
<string name="setup_stores_engine_chip_ready">● Mechanizm gotowy</string>
<string name="setup_stores_engine_chip_missing">Nie zbudowano</string>
<string name="stores_tier_balanced">Zbalansowany</string>
<string name="stores_tier_fast">Szybki</string>
<string name="stores_tier_max">Maksymalny</string>
@@ -3754,4 +3764,14 @@
<string name="stores_gamejolt_filter_status">Status</string>
<string name="stores_gamejolt_filter_partners">Partnerzy</string>
<string name="stores_gamejolt_followed">Obserwowane gry</string>
<string name="wow_chat_title">Wpisywanie na czacie</string>
<string name="wow_chat_voice">Pisanie głosowe</string>
<string name="wow_chat_remember">Zapamiętaj ten wybór</string>
<string name="wow_chat_ask">Pytaj za każdym razem</string>
<string name="wow_chat_send">Wyślij</string>
<string name="wow_chat_listening">Słucham…</string>
<string name="wow_chat_voice_unavailable">Pisanie głosowe nie jest dostępne na tym urządzeniu.</string>
<string name="wow_chat_mic_denied">Pisanie głosowe wymaga dostępu do mikrofonu.</string>
<string name="steam_store_close_steam">Najpierw zamknij Steam</string>
<string name="steam_store_session_wait">Najpierw wstrzymaj pobieranie ze Steam</string>
</resources>
+23 -3
View File
@@ -558,6 +558,19 @@
<string name="comp_tag_in_use">Em utilização</string>
<string name="comp_tag_new">Novo</string>
<string name="comp_tag_stored">Guardado</string>
<string name="comp_mode_title">Como as versões são escolhidas</string>
<string name="comp_mode_auto_detail">Versão mais recente do DroidDeck, sempre atualizada</string>
<string name="comp_mode_manual_detail">Escolha e instale as versões manualmente</string>
<string name="comp_auto_title">Auto mantém %1$s atualizado</string>
<string name="comp_auto_hint">As novas versões são instaladas em segundo plano. Se um jogo que funcionava fechar em segundos duas vezes, Auto volta à versão que funcionava.</string>
<string name="comp_auto_fallback">Reserva: %1$s</string>
<string name="comp_auto_checking">A procurar versões…</string>
<string name="comp_auto_none">Nenhum DroidDeck-Proton usa isto</string>
<string name="comp_auto_waits_network">As atualizações Auto aguardam uma ligação.</string>
<string name="comp_auto_check_failed">Não foi possível procurar novas versões.</string>
<string name="comp_auto_waits_unmetered">As novas versões aguardam uma ligação não limitada, a poupança de bateria desligada e o dispositivo fresco.</string>
<string name="comp_auto_updated">%1$s atualizado para %2$s.</string>
<string name="comp_auto_rolled_back">%1$s %2$s fechou um jogo em segundos duas vezes, por isso Auto voltou a %3$s.</string>
<string name="perf_title">Desempenho</string>
<string name="perf_lede">Núcleos da CPU, correções da sessão e nome do anfitrião. Aplica-se na próxima sessão.</string>
<string name="perf_client_cores_group">Núcleos do cliente Steam</string>
@@ -2246,9 +2259,6 @@
<string name="source_added">Personalizados</string>
<string name="setup_stores">Lojas</string>
<string name="setup_stores_speed">Nível de velocidade de transferência</string>
<string name="setup_stores_engine">Motor das lojas</string>
<string name="setup_stores_engine_chip_ready">● Motor pronto</string>
<string name="setup_stores_engine_chip_missing">Não compilado</string>
<string name="stores_tier_balanced">Equilibrado</string>
<string name="stores_tier_fast">Rápido</string>
<string name="stores_tier_max">Máximo</string>
@@ -3715,4 +3725,14 @@
<string name="stores_gamejolt_filter_status">Estado</string>
<string name="stores_gamejolt_filter_partners">Parceiros</string>
<string name="stores_gamejolt_followed">Jogos seguidos</string>
<string name="wow_chat_title">Introdução no chat</string>
<string name="wow_chat_voice">Escrita por voz</string>
<string name="wow_chat_remember">Lembrar esta escolha</string>
<string name="wow_chat_ask">Perguntar sempre</string>
<string name="wow_chat_send">Enviar</string>
<string name="wow_chat_listening">A ouvir…</string>
<string name="wow_chat_voice_unavailable">A escrita por voz não está disponível neste dispositivo.</string>
<string name="wow_chat_mic_denied">É necessário acesso ao microfone para a escrita por voz.</string>
<string name="steam_store_close_steam">Feche primeiro o Steam</string>
<string name="steam_store_session_wait">Coloque primeiro em pausa a transferência do Steam</string>
</resources>
+23 -3
View File
@@ -558,6 +558,19 @@
<string name="comp_tag_in_use">Em uso</string>
<string name="comp_tag_new">Novo</string>
<string name="comp_tag_stored">Armazenado</string>
<string name="comp_mode_title">Como as versões são escolhidas</string>
<string name="comp_mode_auto_detail">Versão mais recente do DroidDeck, sempre atualizada</string>
<string name="comp_mode_manual_detail">Escolha e instale as versões você mesmo</string>
<string name="comp_auto_title">Auto mantém %1$s atualizado</string>
<string name="comp_auto_hint">Novas versões são instaladas em segundo plano. Se um jogo que funcionava fechar em segundos duas vezes, Auto volta para a versão que funcionava.</string>
<string name="comp_auto_fallback">Reserva: %1$s</string>
<string name="comp_auto_checking">Procurando versões…</string>
<string name="comp_auto_none">Nenhum DroidDeck-Proton usa isto</string>
<string name="comp_auto_waits_network">As atualizações Auto aguardam uma conexão.</string>
<string name="comp_auto_check_failed">Não foi possível procurar novas versões.</string>
<string name="comp_auto_waits_unmetered">Novas versões aguardam uma conexão não limitada, a economia de bateria desligada e o aparelho frio.</string>
<string name="comp_auto_updated">%1$s atualizado para %2$s.</string>
<string name="comp_auto_rolled_back">%1$s %2$s fechou um jogo em segundos duas vezes, então Auto voltou para %3$s.</string>
<string name="perf_title">Desempenho</string>
<string name="perf_lede">Núcleos da CPU, correções da sessão e o nome do host. Vale a partir da próxima sessão.</string>
<string name="perf_client_cores_group">Núcleos do cliente Steam</string>
@@ -2246,9 +2259,6 @@
<string name="source_added">Personalizado</string>
<string name="setup_stores">Lojas</string>
<string name="setup_stores_speed">Nível de velocidade de download</string>
<string name="setup_stores_engine">Mecanismo das lojas</string>
<string name="setup_stores_engine_chip_ready">● Mecanismo pronto</string>
<string name="setup_stores_engine_chip_missing">Não compilado</string>
<string name="stores_tier_balanced">Equilibrado</string>
<string name="stores_tier_fast">Rápido</string>
<string name="stores_tier_max">Máximo</string>
@@ -3715,4 +3725,14 @@
<string name="stores_gamejolt_filter_status">Status</string>
<string name="stores_gamejolt_filter_partners">Parceiros</string>
<string name="stores_gamejolt_followed">Jogos seguidos</string>
<string name="wow_chat_title">Entrada do chat</string>
<string name="wow_chat_voice">Digitação por voz</string>
<string name="wow_chat_remember">Lembrar esta escolha</string>
<string name="wow_chat_ask">Perguntar sempre</string>
<string name="wow_chat_send">Enviar</string>
<string name="wow_chat_listening">Ouvindo…</string>
<string name="wow_chat_voice_unavailable">A digitação por voz não está disponível neste dispositivo.</string>
<string name="wow_chat_mic_denied">É preciso acesso ao microfone para a digitação por voz.</string>
<string name="steam_store_close_steam">Feche o Steam primeiro</string>
<string name="steam_store_session_wait">Pause o download do Steam primeiro</string>
</resources>
+23 -3
View File
@@ -558,6 +558,19 @@
<string name="comp_tag_in_use">În uz</string>
<string name="comp_tag_new">Nou</string>
<string name="comp_tag_stored">Salvat</string>
<string name="comp_mode_title">Cum se aleg versiunile</string>
<string name="comp_mode_auto_detail">Cea mai nouă versiune DroidDeck, mereu actualizată</string>
<string name="comp_mode_manual_detail">Alege și instalează singur versiunile</string>
<string name="comp_auto_title">Auto menține %1$s actualizat</string>
<string name="comp_auto_hint">Versiunile noi se instalează în fundal. Dacă un joc care mergea se închide în câteva secunde de două ori, Auto revine la versiunea care funcționa.</string>
<string name="comp_auto_fallback">Rezervă: %1$s</string>
<string name="comp_auto_checking">Se caută versiuni…</string>
<string name="comp_auto_none">Niciun DroidDeck-Proton nu folosește asta</string>
<string name="comp_auto_waits_network">Actualizările Auto așteaptă o conexiune.</string>
<string name="comp_auto_check_failed">Nu s-au putut căuta versiuni noi.</string>
<string name="comp_auto_waits_unmetered">Versiunile noi așteaptă o conexiune fără limită de date, economisirea bateriei oprită și un dispozitiv răcit.</string>
<string name="comp_auto_updated">%1$s actualizat la %2$s.</string>
<string name="comp_auto_rolled_back">%1$s %2$s a închis un joc în câteva secunde de două ori, așa că Auto a revenit la %3$s.</string>
<string name="perf_title">Performanță</string>
<string name="perf_lede">Nuclee CPU, remedieri de sesiune și numele hostului. Se aplică la sesiunea următoare.</string>
<string name="perf_client_cores_group">Nuclee pentru clientul Steam</string>
@@ -2254,9 +2267,6 @@
<string name="source_added">Personalizat</string>
<string name="setup_stores">Magazine</string>
<string name="setup_stores_speed">Nivelul vitezei de descărcare</string>
<string name="setup_stores_engine">Motorul magazinelor</string>
<string name="setup_stores_engine_chip_ready">● Motor pregătit</string>
<string name="setup_stores_engine_chip_missing">Necompilat</string>
<string name="stores_tier_balanced">Echilibrat</string>
<string name="stores_tier_fast">Rapid</string>
<string name="stores_tier_max">Maxim</string>
@@ -3715,4 +3725,14 @@
<string name="stores_gamejolt_filter_status">Stare</string>
<string name="stores_gamejolt_filter_partners">Parteneri</string>
<string name="stores_gamejolt_followed">Jocuri urmărite</string>
<string name="wow_chat_title">Introducere în chat</string>
<string name="wow_chat_voice">Tastare vocală</string>
<string name="wow_chat_remember">Ține minte această alegere</string>
<string name="wow_chat_ask">Întreabă de fiecare dată</string>
<string name="wow_chat_send">Trimite</string>
<string name="wow_chat_listening">Se ascultă…</string>
<string name="wow_chat_voice_unavailable">Tastarea vocală nu este disponibilă pe acest dispozitiv.</string>
<string name="wow_chat_mic_denied">Pentru tastarea vocală este necesar accesul la microfon.</string>
<string name="steam_store_close_steam">Închide mai întâi Steam</string>
<string name="steam_store_session_wait">Pune mai întâi pe pauză descărcarea Steam</string>
</resources>
+23 -3
View File
@@ -579,6 +579,19 @@
<string name="comp_tag_in_use">Используется</string>
<string name="comp_tag_new">Новый</string>
<string name="comp_tag_stored">Сохранено</string>
<string name="comp_mode_title">Как выбираются сборки</string>
<string name="comp_mode_auto_detail">Новейшая сборка DroidDeck, всегда актуальна</string>
<string name="comp_mode_manual_detail">Выбирайте и устанавливайте сборки сами</string>
<string name="comp_auto_title">Auto поддерживает %1$s в актуальном состоянии</string>
<string name="comp_auto_hint">Новые сборки ставятся в фоне. Если игра, которая раньше работала, дважды закроется за несколько секунд, Auto вернётся к рабочей сборке.</string>
<string name="comp_auto_fallback">Запасная: %1$s</string>
<string name="comp_auto_checking">Поиск сборок…</string>
<string name="comp_auto_none">Ни один DroidDeck-Proton это не использует</string>
<string name="comp_auto_waits_network">Обновления Auto ждут подключения.</string>
<string name="comp_auto_check_failed">Не удалось проверить новые сборки.</string>
<string name="comp_auto_waits_unmetered">Новые сборки ждут безлимитного подключения, выключенной экономии заряда и остывшего устройства.</string>
<string name="comp_auto_updated">%1$s обновлён до %2$s.</string>
<string name="comp_auto_rolled_back">%1$s %2$s дважды закрыл игру за несколько секунд, поэтому Auto вернулся к %3$s.</string>
<string name="perf_title">Производительность</string>
<string name="perf_lede">Ядра CPU, исправления сессии и имя хоста. Вступит в силу в следующей сессии.</string>
<string name="perf_client_cores_group">Ядра клиента Steam</string>
@@ -2362,9 +2375,6 @@
<string name="source_added">Свои</string>
<string name="setup_stores">Магазины</string>
<string name="setup_stores_speed">Уровень скорости загрузки</string>
<string name="setup_stores_engine">Движок магазинов</string>
<string name="setup_stores_engine_chip_ready">● Движок готов</string>
<string name="setup_stores_engine_chip_missing">Не собран</string>
<string name="stores_tier_balanced">Сбалансированный</string>
<string name="stores_tier_fast">Быстрый</string>
<string name="stores_tier_max">Максимальный</string>
@@ -3837,4 +3847,14 @@
<string name="stores_gamejolt_filter_status">Статус</string>
<string name="stores_gamejolt_filter_partners">Партнёры</string>
<string name="stores_gamejolt_followed">Отслеживаемые игры</string>
<string name="wow_chat_title">Ввод в чат</string>
<string name="wow_chat_voice">Голосовой ввод</string>
<string name="wow_chat_remember">Запомнить этот выбор</string>
<string name="wow_chat_ask">Спрашивать каждый раз</string>
<string name="wow_chat_send">Отправить</string>
<string name="wow_chat_listening">Слушаю…</string>
<string name="wow_chat_voice_unavailable">Голосовой ввод недоступен на этом устройстве.</string>
<string name="wow_chat_mic_denied">Для голосового ввода нужен доступ к микрофону.</string>
<string name="steam_store_close_steam">Сначала закройте Steam</string>
<string name="steam_store_session_wait">Сначала приостановите загрузку Steam</string>
</resources>
+23 -3
View File
@@ -556,6 +556,19 @@
<string name="comp_tag_in_use">I bruk</string>
<string name="comp_tag_new">Ny</string>
<string name="comp_tag_stored">Sparad</string>
<string name="comp_mode_title">Hur byggen väljs</string>
<string name="comp_mode_auto_detail">Senaste DroidDeck-bygget, alltid aktuellt</string>
<string name="comp_mode_manual_detail">Välj och installera byggen själv</string>
<string name="comp_auto_title">Auto håller %1$s aktuellt</string>
<string name="comp_auto_hint">Nya byggen installeras i bakgrunden. Om ett spel som fungerade stängs inom sekunder två gånger går Auto tillbaka till bygget som fungerade.</string>
<string name="comp_auto_fallback">Reserv: %1$s</string>
<string name="comp_auto_checking">Söker efter byggen…</string>
<string name="comp_auto_none">Ingen DroidDeck-Proton använder detta</string>
<string name="comp_auto_waits_network">Auto-uppdateringar väntar på en anslutning.</string>
<string name="comp_auto_check_failed">Kunde inte söka efter nya byggen.</string>
<string name="comp_auto_waits_unmetered">Nya byggen väntar på en obegränsad anslutning, avstängt batterisparläge och en sval enhet.</string>
<string name="comp_auto_updated">%1$s uppdaterat till %2$s.</string>
<string name="comp_auto_rolled_back">%1$s %2$s stängde ett spel inom sekunder två gånger, så Auto gick tillbaka till %3$s.</string>
<string name="perf_title">Prestanda</string>
<string name="perf_lede">CPU-kärnor, sessionsfixar och värdnamnet. Gäller från nästa session.</string>
<string name="perf_client_cores_group">Steam-klientens kärnor</string>
@@ -2229,9 +2242,6 @@
<string name="source_added">Egna</string>
<string name="setup_stores">Butiker</string>
<string name="setup_stores_speed">Nedladdningshastighet</string>
<string name="setup_stores_engine">Butiksmotor</string>
<string name="setup_stores_engine_chip_ready">● Motor redo</string>
<string name="setup_stores_engine_chip_missing">Inte byggd</string>
<string name="stores_tier_balanced">Balanserad</string>
<string name="stores_tier_fast">Snabb</string>
<string name="stores_tier_max">Max</string>
@@ -3676,4 +3686,14 @@
<string name="stores_gamejolt_filter_status">Status</string>
<string name="stores_gamejolt_filter_partners">Partner</string>
<string name="stores_gamejolt_followed">Följda spel</string>
<string name="wow_chat_title">Chattinmatning</string>
<string name="wow_chat_voice">Röstinmatning</string>
<string name="wow_chat_remember">Kom ihåg det här valet</string>
<string name="wow_chat_ask">Fråga varje gång</string>
<string name="wow_chat_send">Skicka</string>
<string name="wow_chat_listening">Lyssnar…</string>
<string name="wow_chat_voice_unavailable">Röstinmatning är inte tillgänglig på den här enheten.</string>
<string name="wow_chat_mic_denied">Mikrofonåtkomst krävs för röstinmatning.</string>
<string name="steam_store_close_steam">Stäng Steam först</string>
<string name="steam_store_session_wait">Pausa Steam-nedladdningen först</string>
</resources>
+23 -3
View File
@@ -554,6 +554,19 @@
<string name="comp_tag_in_use">ใช้งานอยู่</string>
<string name="comp_tag_new">ใหม่</string>
<string name="comp_tag_stored">บันทึกไว้</string>
<string name="comp_mode_title">วิธีเลือกบิลด์</string>
<string name="comp_mode_auto_detail">บิลด์ DroidDeck ล่าสุด อัปเดตอยู่เสมอ</string>
<string name="comp_mode_manual_detail">เลือกและติดตั้งบิลด์เอง</string>
<string name="comp_auto_title">Auto ทำให้ %1$s เป็นปัจจุบัน</string>
<string name="comp_auto_hint">บิลด์ใหม่จะติดตั้งในเบื้องหลัง หากเกมที่เคยเล่นได้ปิดลงภายในไม่กี่วินาทีสองครั้ง Auto จะกลับไปใช้บิลด์ที่ใช้งานได้</string>
<string name="comp_auto_fallback">สำรอง: %1$s</string>
<string name="comp_auto_checking">กำลังค้นหาบิลด์…</string>
<string name="comp_auto_none">ไม่มี DroidDeck-Proton ที่ใช้สิ่งนี้</string>
<string name="comp_auto_waits_network">การอัปเดต Auto กำลังรอการเชื่อมต่อ</string>
<string name="comp_auto_check_failed">ตรวจหาบิลด์ใหม่ไม่ได้</string>
<string name="comp_auto_waits_unmetered">บิลด์ใหม่จะรอการเชื่อมต่อที่ไม่จำกัดปริมาณ ปิดโหมดประหยัดแบตเตอรี่ และอุปกรณ์ที่ไม่ร้อน</string>
<string name="comp_auto_updated">อัปเดต %1$s เป็น %2$s แล้ว</string>
<string name="comp_auto_rolled_back">%1$s %2$s ทำให้เกมปิดภายในไม่กี่วินาทีสองครั้ง Auto จึงกลับไปใช้ %3$s</string>
<string name="perf_title">ประสิทธิภาพ</string>
<string name="perf_lede">คอร์ CPU การแก้ไขเซสชัน และชื่อโฮสต์ จะมีผลในเซสชันถัดไป</string>
<string name="perf_client_cores_group">คอร์สำหรับไคลเอนต์ Steam</string>
@@ -2204,9 +2217,6 @@
<string name="source_added">กำหนดเอง</string>
<string name="setup_stores">สโตร์</string>
<string name="setup_stores_speed">ระดับความเร็วการดาวน์โหลด</string>
<string name="setup_stores_engine">เอนจินสโตร์</string>
<string name="setup_stores_engine_chip_ready">● เอนจินพร้อมใช้งาน</string>
<string name="setup_stores_engine_chip_missing">ยังไม่สร้าง</string>
<string name="stores_tier_balanced">สมดุล</string>
<string name="stores_tier_fast">เร็ว</string>
<string name="stores_tier_max">สูงสุด</string>
@@ -3646,4 +3656,14 @@
<string name="stores_gamejolt_filter_status">สถานะ</string>
<string name="stores_gamejolt_filter_partners">พาร์ตเนอร์</string>
<string name="stores_gamejolt_followed">เกมที่ติดตาม</string>
<string name="wow_chat_title">การป้อนแชท</string>
<string name="wow_chat_voice">พิมพ์ด้วยเสียง</string>
<string name="wow_chat_remember">จดจำตัวเลือกนี้</string>
<string name="wow_chat_ask">ถามทุกครั้ง</string>
<string name="wow_chat_send">ส่ง</string>
<string name="wow_chat_listening">กำลังฟัง…</string>
<string name="wow_chat_voice_unavailable">อุปกรณ์นี้ไม่รองรับการพิมพ์ด้วยเสียง</string>
<string name="wow_chat_mic_denied">ต้องอนุญาตให้เข้าถึงไมโครโฟนเพื่อพิมพ์ด้วยเสียง</string>
<string name="steam_store_close_steam">ปิด Steam ก่อน</string>
<string name="steam_store_session_wait">หยุดการดาวน์โหลด Steam ชั่วคราวก่อน</string>
</resources>
+23 -3
View File
@@ -556,6 +556,19 @@
<string name="comp_tag_in_use">Kullanımda</string>
<string name="comp_tag_new">Yeni</string>
<string name="comp_tag_stored">Saklandı</string>
<string name="comp_mode_title">Sürümler nasıl seçilir</string>
<string name="comp_mode_auto_detail">En yeni DroidDeck sürümü, hep güncel</string>
<string name="comp_mode_manual_detail">Sürümleri kendin seç ve yükle</string>
<string name="comp_auto_title">Auto %1$s bileşenini güncel tutar</string>
<string name="comp_auto_hint">Yeni sürümler arka planda yüklenir. Önceden çalışan bir oyun iki kez saniyeler içinde kapanırsa Auto çalışan sürüme geri döner.</string>
<string name="comp_auto_fallback">Yedek: %1$s</string>
<string name="comp_auto_checking">Sürümler aranıyor…</string>
<string name="comp_auto_none">Hiçbir DroidDeck-Proton bunu kullanmıyor</string>
<string name="comp_auto_waits_network">Auto güncellemeleri bağlantı bekliyor.</string>
<string name="comp_auto_check_failed">Yeni sürümler denetlenemedi.</string>
<string name="comp_auto_waits_unmetered">Yeni sürümler sınırsız bir bağlantı, kapalı pil tasarrufu ve serin bir cihaz bekler.</string>
<string name="comp_auto_updated">%1$s, %2$s sürümüne güncellendi.</string>
<string name="comp_auto_rolled_back">%1$s %2$s bir oyunu iki kez saniyeler içinde kapattı, bu yüzden Auto %3$s sürümüne döndü.</string>
<string name="perf_title">Performans</string>
<string name="perf_lede">CPU çekirdekleri, oturum düzeltmeleri ve ana bilgisayar adı. Sonraki oturumda uygulanır.</string>
<string name="perf_client_cores_group">Steam istemcisi çekirdekleri</string>
@@ -2221,9 +2234,6 @@
<string name="source_added">Özel</string>
<string name="setup_stores">Mağazalar</string>
<string name="setup_stores_speed">İndirme hızı katmanı</string>
<string name="setup_stores_engine">Mağazalar motoru</string>
<string name="setup_stores_engine_chip_ready">● Motor hazır</string>
<string name="setup_stores_engine_chip_missing">Derlenmedi</string>
<string name="stores_tier_balanced">Dengeli</string>
<string name="stores_tier_fast">Hızlı</string>
<string name="stores_tier_max">Maks</string>
@@ -3676,4 +3686,14 @@
<string name="stores_gamejolt_filter_status">Durum</string>
<string name="stores_gamejolt_filter_partners">Ortaklar</string>
<string name="stores_gamejolt_followed">Takip edilen oyunlar</string>
<string name="wow_chat_title">Sohbet girişi</string>
<string name="wow_chat_voice">Sesle yazma</string>
<string name="wow_chat_remember">Bu seçimi hatırla</string>
<string name="wow_chat_ask">Her seferinde sor</string>
<string name="wow_chat_send">Gönder</string>
<string name="wow_chat_listening">Dinleniyor…</string>
<string name="wow_chat_voice_unavailable">Sesle yazma bu cihazda kullanılamıyor.</string>
<string name="wow_chat_mic_denied">Sesle yazma için mikrofon erişimi gerekiyor.</string>
<string name="steam_store_close_steam">Önce Steam\'i kapatın</string>
<string name="steam_store_session_wait">Önce Steam indirmesini duraklatın</string>
</resources>
+23 -3
View File
@@ -560,6 +560,19 @@
<string name="comp_tag_in_use">Використовується</string>
<string name="comp_tag_new">Нове</string>
<string name="comp_tag_stored">Збережено</string>
<string name="comp_mode_title">Як вибираються збірки</string>
<string name="comp_mode_auto_detail">Найновіша збірка DroidDeck, завжди актуальна</string>
<string name="comp_mode_manual_detail">Вибирайте та встановлюйте збірки самостійно</string>
<string name="comp_auto_title">Auto підтримує %1$s в актуальному стані</string>
<string name="comp_auto_hint">Нові збірки встановлюються у фоні. Якщо гра, яка раніше працювала, двічі закриється за кілька секунд, Auto повернеться до робочої збірки.</string>
<string name="comp_auto_fallback">Запасна: %1$s</string>
<string name="comp_auto_checking">Пошук збірок…</string>
<string name="comp_auto_none">Жоден DroidDeck-Proton цього не використовує</string>
<string name="comp_auto_waits_network">Оновлення Auto чекають на з’єднання.</string>
<string name="comp_auto_check_failed">Не вдалося перевірити нові збірки.</string>
<string name="comp_auto_waits_unmetered">Нові збірки чекають на безлімітне з’єднання, вимкнену економію заряду та охолоджений пристрій.</string>
<string name="comp_auto_updated">%1$s оновлено до %2$s.</string>
<string name="comp_auto_rolled_back">%1$s %2$s двічі закрив гру за кілька секунд, тому Auto повернувся до %3$s.</string>
<string name="perf_title">Продуктивність</string>
<string name="perf_lede">Ядра CPU, виправлення сеансу та ім’я хоста. Застосовується в наступному сеансі.</string>
<string name="perf_client_cores_group">Ядра клієнта Steam</string>
@@ -2279,9 +2292,6 @@
<string name="source_added">Власна</string>
<string name="setup_stores">Магазини</string>
<string name="setup_stores_speed">Рівень швидкості завантаження</string>
<string name="setup_stores_engine">Рушій магазинів</string>
<string name="setup_stores_engine_chip_ready">● Рушій готовий</string>
<string name="setup_stores_engine_chip_missing">Не зібрано</string>
<string name="stores_tier_balanced">Збалансований</string>
<string name="stores_tier_fast">Швидкий</string>
<string name="stores_tier_max">Максимальний</string>
@@ -3754,4 +3764,14 @@
<string name="stores_gamejolt_filter_status">Статус</string>
<string name="stores_gamejolt_filter_partners">Партнери</string>
<string name="stores_gamejolt_followed">Ігри, за якими ви стежите</string>
<string name="wow_chat_title">Введення в чат</string>
<string name="wow_chat_voice">Голосове введення</string>
<string name="wow_chat_remember">Запам\'ятати цей вибір</string>
<string name="wow_chat_ask">Питати щоразу</string>
<string name="wow_chat_send">Надіслати</string>
<string name="wow_chat_listening">Слухаю…</string>
<string name="wow_chat_voice_unavailable">Голосове введення недоступне на цьому пристрої.</string>
<string name="wow_chat_mic_denied">Для голосового введення потрібен доступ до мікрофона.</string>
<string name="steam_store_close_steam">Спочатку закрийте Steam</string>
<string name="steam_store_session_wait">Спочатку призупиніть завантаження Steam</string>
</resources>
+23 -3
View File
@@ -554,6 +554,19 @@
<string name="comp_tag_in_use">Đang dùng</string>
<string name="comp_tag_new">Mới</string>
<string name="comp_tag_stored">Đã lưu</string>
<string name="comp_mode_title">Cách chọn bản dựng</string>
<string name="comp_mode_auto_detail">Bản dựng DroidDeck mới nhất, luôn cập nhật</string>
<string name="comp_mode_manual_detail">Tự chọn và cài bản dựng</string>
<string name="comp_auto_title">Auto giữ %1$s luôn cập nhật</string>
<string name="comp_auto_hint">Bản dựng mới được cài ở nền. Nếu một trò chơi từng chạy được bị đóng sau vài giây hai lần, Auto quay lại bản dựng đã chạy được.</string>
<string name="comp_auto_fallback">Dự phòng: %1$s</string>
<string name="comp_auto_checking">Đang tìm bản dựng…</string>
<string name="comp_auto_none">Không DroidDeck-Proton nào dùng thành phần này</string>
<string name="comp_auto_waits_network">Cập nhật Auto đang chờ kết nối.</string>
<string name="comp_auto_check_failed">Không thể kiểm tra bản dựng mới.</string>
<string name="comp_auto_waits_unmetered">Bản dựng mới chờ kết nối không đo lưu lượng, tắt tiết kiệm pin và thiết bị đủ mát.</string>
<string name="comp_auto_updated">Đã cập nhật %1$s lên %2$s.</string>
<string name="comp_auto_rolled_back">%1$s %2$s làm trò chơi đóng sau vài giây hai lần, nên Auto đã quay lại %3$s.</string>
<string name="perf_title">Hiệu năng</string>
<string name="perf_lede">Lõi CPU, các bản sửa phiên và tên máy chủ. Áp dụng từ phiên sau.</string>
<string name="perf_client_cores_group">Lõi client Steam</string>
@@ -2204,9 +2217,6 @@
<string name="source_added">Tùy chỉnh</string>
<string name="setup_stores">Cửa hàng</string>
<string name="setup_stores_speed">Mức tốc độ tải</string>
<string name="setup_stores_engine">Engine stores</string>
<string name="setup_stores_engine_chip_ready">● Engine sẵn sàng</string>
<string name="setup_stores_engine_chip_missing">Chưa build</string>
<string name="stores_tier_balanced">Cân bằng</string>
<string name="stores_tier_fast">Nhanh</string>
<string name="stores_tier_max">Tối đa</string>
@@ -3646,4 +3656,14 @@
<string name="stores_gamejolt_filter_status">Trạng thái</string>
<string name="stores_gamejolt_filter_partners">Đối tác</string>
<string name="stores_gamejolt_followed">Game đang theo dõi</string>
<string name="wow_chat_title">Nhập trò chuyện</string>
<string name="wow_chat_voice">Nhập bằng giọng nói</string>
<string name="wow_chat_remember">Ghi nhớ lựa chọn này</string>
<string name="wow_chat_ask">Hỏi mỗi lần</string>
<string name="wow_chat_send">Gửi</string>
<string name="wow_chat_listening">Đang nghe…</string>
<string name="wow_chat_voice_unavailable">Thiết bị này không hỗ trợ nhập bằng giọng nói.</string>
<string name="wow_chat_mic_denied">Cần quyền truy cập micrô để nhập bằng giọng nói.</string>
<string name="steam_store_close_steam">Hãy đóng Steam trước</string>
<string name="steam_store_session_wait">Hãy tạm dừng tải xuống Steam trước</string>
</resources>
+23 -3
View File
@@ -554,6 +554,19 @@
<string name="comp_tag_in_use">使用中</string>
<string name="comp_tag_new">新</string>
<string name="comp_tag_stored">已存储</string>
<string name="comp_mode_title">版本的选择方式</string>
<string name="comp_mode_auto_detail">最新 DroidDeck 版本,始终保持更新</string>
<string name="comp_mode_manual_detail">自行选择并安装版本</string>
<string name="comp_auto_title">Auto 会让 %1$s 保持最新</string>
<string name="comp_auto_hint">新版本会在后台安装。如果之前能运行的游戏两次在几秒内关闭,Auto 会退回到之前可用的版本。</string>
<string name="comp_auto_fallback">备用:%1$s</string>
<string name="comp_auto_checking">正在检查版本…</string>
<string name="comp_auto_none">没有 DroidDeck-Proton 使用它</string>
<string name="comp_auto_waits_network">Auto 更新正在等待网络连接。</string>
<string name="comp_auto_check_failed">无法检查新版本。</string>
<string name="comp_auto_waits_unmetered">新版本将等待不按流量计费的网络、关闭省电模式且设备不过热时下载。</string>
<string name="comp_auto_updated">%1$s 已更新到 %2$s。</string>
<string name="comp_auto_rolled_back">%1$s %2$s 两次在几秒内关闭了游戏,因此 Auto 已退回到 %3$s。</string>
<string name="perf_title">性能</string>
<string name="perf_lede">CPU 核心、会话修复和主机名。将在下次会话生效。</string>
<string name="perf_client_cores_group">Steam 客户端核心</string>
@@ -2285,9 +2298,6 @@
<string name="source_added">自定义</string>
<string name="setup_stores">游戏商店</string>
<string name="setup_stores_speed">下载速度档位</string>
<string name="setup_stores_engine">商店引擎</string>
<string name="setup_stores_engine_chip_ready">● 引擎就绪</string>
<string name="setup_stores_engine_chip_missing">未构建</string>
<string name="stores_tier_balanced">均衡</string>
<string name="stores_tier_fast">快速</string>
<string name="stores_tier_max">最高</string>
@@ -3650,4 +3660,14 @@
<string name="stores_gamejolt_filter_status">状态</string>
<string name="stores_gamejolt_filter_partners">合作伙伴</string>
<string name="stores_gamejolt_followed">已关注的游戏</string>
<string name="wow_chat_title">聊天输入</string>
<string name="wow_chat_voice">语音输入</string>
<string name="wow_chat_remember">记住此选择</string>
<string name="wow_chat_ask">每次询问</string>
<string name="wow_chat_send">发送</string>
<string name="wow_chat_listening">正在聆听…</string>
<string name="wow_chat_voice_unavailable">此设备不支持语音输入。</string>
<string name="wow_chat_mic_denied">语音输入需要麦克风权限。</string>
<string name="steam_store_close_steam">请先关闭 Steam</string>
<string name="steam_store_session_wait">请先暂停 Steam 下载</string>
</resources>
+23 -3
View File
@@ -554,6 +554,19 @@
<string name="comp_tag_in_use">使用中</string>
<string name="comp_tag_new">新</string>
<string name="comp_tag_stored">已儲存</string>
<string name="comp_mode_title">版本的選擇方式</string>
<string name="comp_mode_auto_detail">最新 DroidDeck 版本,持續保持更新</string>
<string name="comp_mode_manual_detail">自行選擇並安裝版本</string>
<string name="comp_auto_title">Auto 會令 %1$s 保持最新</string>
<string name="comp_auto_hint">新版本會在背景安裝。如果之前能執行的遊戲兩次在幾秒內關閉,Auto 會退回到之前可用的版本。</string>
<string name="comp_auto_fallback">備用:%1$s</string>
<string name="comp_auto_checking">正在檢查版本…</string>
<string name="comp_auto_none">沒有 DroidDeck-Proton 使用它</string>
<string name="comp_auto_waits_network">Auto 更新正在等待網絡連線。</string>
<string name="comp_auto_check_failed">無法檢查新版本。</string>
<string name="comp_auto_waits_unmetered">新版本將等待非按流量收費的網絡、關閉省電模式且裝置不過熱時下載。</string>
<string name="comp_auto_updated">%1$s 已更新至 %2$s。</string>
<string name="comp_auto_rolled_back">%1$s %2$s 兩次在幾秒內關閉了遊戲,因此 Auto 已退回到 %3$s。</string>
<string name="perf_title">效能</string>
<string name="perf_lede">CPU 核心、會話修正和主機名稱。下次會話生效。</string>
<string name="perf_client_cores_group">Steam 用戶端核心</string>
@@ -2204,9 +2217,6 @@
<string name="source_added">自訂</string>
<string name="setup_stores">商店</string>
<string name="setup_stores_speed">下載速度等級</string>
<string name="setup_stores_engine">商店引擎</string>
<string name="setup_stores_engine_chip_ready">● 引擎已就緒</string>
<string name="setup_stores_engine_chip_missing">未建置</string>
<string name="stores_tier_balanced">平衡</string>
<string name="stores_tier_fast">快速</string>
<string name="stores_tier_max">最高</string>
@@ -3649,4 +3659,14 @@
<string name="setup_gpu_bridged">GPU 透過 Mali 橋接</string>
<string name="gpuinfo_bridge">透過 Mali 橋接執行,使用手機內建的 Vulkan 驅動程式</string>
<string name="gpuinfo_bridge_off">關閉 Mali 橋接時不受支援:Turnip 需要 Adreno(Snapdragon)GPU</string>
<string name="wow_chat_title">聊天輸入</string>
<string name="wow_chat_voice">語音輸入</string>
<string name="wow_chat_remember">記住此選擇</string>
<string name="wow_chat_ask">每次詢問</string>
<string name="wow_chat_send">傳送</string>
<string name="wow_chat_listening">正在聆聽…</string>
<string name="wow_chat_voice_unavailable">此裝置不支援語音輸入。</string>
<string name="wow_chat_mic_denied">語音輸入需要咪高峰權限。</string>
<string name="steam_store_close_steam">請先關閉 Steam</string>
<string name="steam_store_session_wait">請先暫停 Steam 下載</string>
</resources>
+23 -3
View File
@@ -554,6 +554,19 @@
<string name="comp_tag_in_use">使用中</string>
<string name="comp_tag_new">新</string>
<string name="comp_tag_stored">已儲存</string>
<string name="comp_mode_title">版本的選擇方式</string>
<string name="comp_mode_auto_detail">最新 DroidDeck 版本,持續保持更新</string>
<string name="comp_mode_manual_detail">自行選擇並安裝版本</string>
<string name="comp_auto_title">Auto 會讓 %1$s 保持最新</string>
<string name="comp_auto_hint">新版本會在背景安裝。如果先前能執行的遊戲兩次在幾秒內關閉,Auto 會退回到先前可用的版本。</string>
<string name="comp_auto_fallback">備用:%1$s</string>
<string name="comp_auto_checking">正在檢查版本…</string>
<string name="comp_auto_none">沒有 DroidDeck-Proton 使用它</string>
<string name="comp_auto_waits_network">Auto 更新正在等待網路連線。</string>
<string name="comp_auto_check_failed">無法檢查新版本。</string>
<string name="comp_auto_waits_unmetered">新版本將等待非計量網路、關閉省電模式且裝置不過熱時下載。</string>
<string name="comp_auto_updated">%1$s 已更新至 %2$s。</string>
<string name="comp_auto_rolled_back">%1$s %2$s 兩次在幾秒內關閉了遊戲,因此 Auto 已退回到 %3$s。</string>
<string name="perf_title">效能</string>
<string name="perf_lede">CPU 核心、工作階段修復和主機名稱。下次工作階段生效。</string>
<string name="perf_client_cores_group">Steam 用戶端核心</string>
@@ -2204,9 +2217,6 @@
<string name="source_added">自訂</string>
<string name="setup_stores">遊戲商店</string>
<string name="setup_stores_speed">下載速度等級</string>
<string name="setup_stores_engine">商店引擎</string>
<string name="setup_stores_engine_chip_ready">● 引擎已就緒</string>
<string name="setup_stores_engine_chip_missing">尚未組建</string>
<string name="stores_tier_balanced">平衡</string>
<string name="stores_tier_fast">快速</string>
<string name="stores_tier_max">最高</string>
@@ -3649,4 +3659,14 @@
<string name="setup_gpu_bridged">GPU 透過 Mali 橋接</string>
<string name="gpuinfo_bridge">透過 Mali 橋接執行,使用手機內建的 Vulkan 驅動程式</string>
<string name="gpuinfo_bridge_off">關閉 Mali 橋接時不受支援:Turnip 需要 Adreno(Snapdragon)GPU</string>
<string name="wow_chat_title">聊天輸入</string>
<string name="wow_chat_voice">語音輸入</string>
<string name="wow_chat_remember">記住此選擇</string>
<string name="wow_chat_ask">每次詢問</string>
<string name="wow_chat_send">傳送</string>
<string name="wow_chat_listening">正在聆聽…</string>
<string name="wow_chat_voice_unavailable">此裝置不支援語音輸入。</string>
<string name="wow_chat_mic_denied">語音輸入需要麥克風權限。</string>
<string name="steam_store_close_steam">請先關閉 Steam</string>
<string name="steam_store_session_wait">請先暫停 Steam 下載</string>
</resources>
+23 -3
View File
@@ -604,6 +604,19 @@
<string name="comp_tag_in_use">In use</string>
<string name="comp_tag_new">New</string>
<string name="comp_tag_stored">Stored</string>
<string name="comp_mode_title">How builds are chosen</string>
<string name="comp_mode_auto_detail">Newest DroidDeck build, kept current</string>
<string name="comp_mode_manual_detail">Pick and install builds yourself</string>
<string name="comp_auto_title">Auto keeps %1$s current</string>
<string name="comp_auto_hint">New builds install in the background. If a game that ran before closes within seconds twice, Auto goes back to the build that worked.</string>
<string name="comp_auto_fallback">Fallback: %1$s</string>
<string name="comp_auto_checking">Checking for builds…</string>
<string name="comp_auto_none">No DroidDeck-Proton uses this</string>
<string name="comp_auto_waits_network">Auto updates wait for a connection.</string>
<string name="comp_auto_check_failed">Couldn\'t check for new builds.</string>
<string name="comp_auto_waits_unmetered">New builds wait for an unmetered connection, battery saver off and a cool device.</string>
<string name="comp_auto_updated">%1$s updated to %2$s.</string>
<string name="comp_auto_rolled_back">%1$s %2$s closed a game within seconds twice, so Auto went back to %3$s.</string>
<string name="perf_title">Performance</string>
<string name="perf_lede">CPU cores, session fixes and the host name. Applies next session.</string>
<string name="perf_client_cores_group">Steam client cores</string>
@@ -2454,9 +2467,6 @@
<string name="source_added">Custom</string>
<string name="setup_stores">Stores</string>
<string name="setup_stores_speed">Download speed tier</string>
<string name="setup_stores_engine">Stores engine</string>
<string name="setup_stores_engine_chip_ready">● Engine ready</string>
<string name="setup_stores_engine_chip_missing">Not built</string>
<string name="stores_tier_balanced">Balanced</string>
<string name="stores_tier_fast">Fast</string>
<string name="stores_tier_max">Max</string>
@@ -3834,4 +3844,14 @@
<string name="stores_gamejolt_filter_status">Status</string>
<string name="stores_gamejolt_filter_partners">Partners</string>
<string name="stores_gamejolt_followed">Followed games</string>
<string name="wow_chat_title">Chat input</string>
<string name="wow_chat_voice">Voice type</string>
<string name="wow_chat_remember">Remember this selection</string>
<string name="wow_chat_ask">Ask each time</string>
<string name="wow_chat_send">Send</string>
<string name="wow_chat_listening">Listening…</string>
<string name="wow_chat_voice_unavailable">Voice typing is not available on this device.</string>
<string name="wow_chat_mic_denied">Microphone access is needed for voice typing.</string>
<string name="steam_store_close_steam">Close Steam first</string>
<string name="steam_store_session_wait">Pause the Steam download first</string>
</resources>
+336 -6
View File
@@ -8,6 +8,17 @@ version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
[[package]]
name = "aes"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
dependencies = [
"cfg-if",
"cipher",
"cpufeatures",
]
[[package]]
name = "async-compression"
version = "0.4.42"
@@ -26,12 +37,24 @@ version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "autocfg"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
[[package]]
name = "base64"
version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]]
name = "base64ct"
version = "1.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"
[[package]]
name = "bitflags"
version = "2.11.1"
@@ -47,6 +70,15 @@ dependencies = [
"generic-array",
]
[[package]]
name = "block-padding"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93"
dependencies = [
"generic-array",
]
[[package]]
name = "bumpalo"
version = "3.20.3"
@@ -65,6 +97,15 @@ version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"
[[package]]
name = "cbc"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6"
dependencies = [
"cipher",
]
[[package]]
name = "cc"
version = "1.2.62"
@@ -93,6 +134,16 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]]
name = "cipher"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
dependencies = [
"crypto-common",
"inout",
]
[[package]]
name = "combine"
version = "4.6.7"
@@ -120,6 +171,12 @@ version = "0.4.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc14f565cf027a105f7a44ccf9e5b424348421a1d8952a8fc9d499d313107789"
[[package]]
name = "const-oid"
version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
[[package]]
name = "cpufeatures"
version = "0.2.17"
@@ -163,6 +220,23 @@ dependencies = [
"typenum",
]
[[package]]
name = "data-encoding"
version = "2.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06"
[[package]]
name = "der"
version = "0.7.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb"
dependencies = [
"const-oid",
"pem-rfc7468",
"zeroize",
]
[[package]]
name = "digest"
version = "0.10.7"
@@ -170,7 +244,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
"block-buffer",
"const-oid",
"crypto-common",
"subtle",
]
[[package]]
@@ -188,17 +264,26 @@ dependencies = [
name = "droiddeckstores"
version = "0.1.0"
dependencies = [
"aes",
"cbc",
"cc",
"crc32fast",
"flate2",
"futures-util",
"hmac",
"jni",
"libc",
"lzma-rs",
"rand 0.8.8",
"reqwest",
"rsa",
"ruzstd",
"serde_json",
"sha1",
"sha2",
"tokio",
"tungstenite",
"zeroize",
]
[[package]]
@@ -314,6 +399,15 @@ version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
[[package]]
name = "hmac"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
dependencies = [
"digest",
]
[[package]]
name = "http"
version = "1.4.1"
@@ -386,7 +480,7 @@ dependencies = [
"tokio",
"tokio-rustls",
"tower-service",
"webpki-roots",
"webpki-roots 1.0.7",
]
[[package]]
@@ -525,6 +619,16 @@ dependencies = [
"hashbrown",
]
[[package]]
name = "inout"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01"
dependencies = [
"block-padding",
"generic-array",
]
[[package]]
name = "ipnet"
version = "2.12.0"
@@ -593,12 +697,27 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "lazy_static"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb"
dependencies = [
"spin",
]
[[package]]
name = "libc"
version = "0.2.186"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
[[package]]
name = "libm"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
[[package]]
name = "litemap"
version = "0.8.2"
@@ -654,12 +773,66 @@ dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "num-bigint-dig"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e661dda6640fad38e827a6d4a310ff4763082116fe217f279885c97f511bb0b7"
dependencies = [
"lazy_static",
"libm",
"num-integer",
"num-iter",
"num-traits",
"rand 0.8.8",
"smallvec",
"zeroize",
]
[[package]]
name = "num-integer"
version = "0.1.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b"
dependencies = [
"num-traits",
]
[[package]]
name = "num-iter"
version = "0.1.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b"
dependencies = [
"num-integer",
"num-traits",
]
[[package]]
name = "num-traits"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
"autocfg",
"libm",
]
[[package]]
name = "once_cell"
version = "1.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
[[package]]
name = "pem-rfc7468"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412"
dependencies = [
"base64ct",
]
[[package]]
name = "percent-encoding"
version = "2.3.2"
@@ -672,6 +845,27 @@ version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
[[package]]
name = "pkcs1"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f"
dependencies = [
"der",
"pkcs8",
"spki",
]
[[package]]
name = "pkcs8"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"
dependencies = [
"der",
"spki",
]
[[package]]
name = "potential_utf"
version = "0.1.5"
@@ -728,7 +922,7 @@ dependencies = [
"bytes",
"getrandom 0.3.4",
"lru-slab",
"rand",
"rand 0.9.4",
"ring",
"rustc-hash",
"rustls",
@@ -769,14 +963,35 @@ version = "5.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
[[package]]
name = "rand"
version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c"
dependencies = [
"libc",
"rand_chacha 0.3.1",
"rand_core 0.6.4",
]
[[package]]
name = "rand"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea"
dependencies = [
"rand_chacha",
"rand_core",
"rand_chacha 0.9.0",
"rand_core 0.9.5",
]
[[package]]
name = "rand_chacha"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
"ppv-lite86",
"rand_core 0.6.4",
]
[[package]]
@@ -786,7 +1001,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
dependencies = [
"ppv-lite86",
"rand_core",
"rand_core 0.9.5",
]
[[package]]
name = "rand_core"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
"getrandom 0.2.17",
]
[[package]]
@@ -833,7 +1057,7 @@ dependencies = [
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"webpki-roots",
"webpki-roots 1.0.7",
]
[[package]]
@@ -850,6 +1074,26 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "rsa"
version = "0.9.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d"
dependencies = [
"const-oid",
"digest",
"num-bigint-dig",
"num-integer",
"num-traits",
"pkcs1",
"pkcs8",
"rand_core 0.6.4",
"signature",
"spki",
"subtle",
"zeroize",
]
[[package]]
name = "rustc-hash"
version = "2.1.2"
@@ -897,6 +1141,15 @@ version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
[[package]]
name = "ruzstd"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fad02996bfc73da3e301efe90b1837be9ed8f4a462b6ed410aa35d00381de89f"
dependencies = [
"twox-hash",
]
[[package]]
name = "ryu"
version = "1.0.23"
@@ -995,6 +1248,16 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "signature"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"
dependencies = [
"digest",
"rand_core 0.6.4",
]
[[package]]
name = "simd-adler32"
version = "0.3.9"
@@ -1023,12 +1286,34 @@ dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "spin"
version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e"
[[package]]
name = "spki"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d"
dependencies = [
"base64ct",
"der",
]
[[package]]
name = "stable_deref_trait"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "subtle"
version = "2.6.1"
@@ -1243,6 +1528,36 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
[[package]]
name = "tungstenite"
version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4793cb5e56680ecbb1d843515b23b6de9a75eb04b66643e256a396d43be33c13"
dependencies = [
"bytes",
"data-encoding",
"http",
"httparse",
"log",
"rand 0.9.4",
"rustls",
"rustls-pki-types",
"sha1",
"thiserror 2.0.18",
"utf-8",
"webpki-roots 0.26.11",
]
[[package]]
name = "twox-hash"
version = "1.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675"
dependencies = [
"cfg-if",
"static_assertions",
]
[[package]]
name = "typenum"
version = "1.20.0"
@@ -1273,6 +1588,12 @@ dependencies = [
"serde",
]
[[package]]
name = "utf-8"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
[[package]]
name = "utf8_iter"
version = "1.0.4"
@@ -1394,6 +1715,15 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "webpki-roots"
version = "0.26.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9"
dependencies = [
"webpki-roots 1.0.7",
]
[[package]]
name = "webpki-roots"
version = "1.0.7"
+10 -1
View File
@@ -10,16 +10,25 @@ name = "droiddeckstores"
crate-type = ["cdylib"]
[dependencies]
aes = "0.8"
cbc = { version = "0.1", features = ["alloc", "block-padding"] }
crc32fast = "1"
hmac = "0.12"
jni = "0.21"
libc = "0.2"
lzma-rs = { version = "0.3", default-features = false }
lzma-rs = { version = "0.3", default-features = false, features = ["raw_decoder"] }
flate2 = { version = "1", default-features = false, features = ["rust_backend"] }
rand = "0.8"
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "gzip"] }
rsa = "0.9"
ruzstd = "0.7"
tokio = { version = "1", default-features = false, features = ["rt", "net", "time", "sync"] }
futures-util = { version = "0.3", default-features = false, features = ["std"] }
serde_json = { version = "1", features = ["preserve_order"] }
sha1 = "0.10"
sha2 = "0.10"
tungstenite = { version = "0.26", default-features = false, features = ["handshake", "rustls-tls-webpki-roots"] }
zeroize = "1"
[build-dependencies]
cc = "1"
+196 -5
View File
@@ -2,19 +2,19 @@
The Kotlin side of the store download engines mirrors this file exactly. Every symbol the library
exports is listed here with the class it binds to, the JNI signature, when it is called and on
which thread. The GOG engine and the shared fetch core came from Bannerlator's
`bl-steam-client` crate (method names and signatures match Bannerlator's `BlGogDownload`, only the
package and class names changed). The Epic module (`src/epic/`) and the Amazon module
which thread. The GOG engine, the shared fetch core and the Steam module (`src/steam/`, see its
`NOTICE.md`) are derived from WinNative's `wn-steam-client` crate (GPL-3.0-or-later,
https://github.com/WinNative-Emu/WinNative). The Epic module (`src/epic/`) and the Amazon module
(`src/amazon/`) are DroidDeck's own, each written from a functional spec (see
`docs/development/epic-cleanroom.md` and `docs/development/amazon-cleanroom.md`); their JNI
surfaces below are new.
surfaces below are new, as is the Steam one.
Load it once with `System.loadLibrary("droiddeckstores")`. The library is built by Gradle
(`buildRustStores`, see `app/build.gradle`) and is absent from a `-PskipRust=true` build, so every
call site must be ready for `UnsatisfiedLinkError` on `loadLibrary` or on the first `external`
call and degrade to "store unavailable".
## Conventions that hold for all three engines
## Conventions that hold for all engines
- The `external` functions are declared `@JvmStatic` in a Kotlin `object` (a `JClass` arrives as
the second JNI argument). Declaring them in a plain `object` without `@JvmStatic` also binds —
@@ -290,9 +290,200 @@ absent or that of empty input are created without a request. `.amazon_download_i
created when a run starts and removed when it succeeds, which also creates
`.amazon_download_complete`; nothing reads either marker.
## `com.droiddeck.launcher.stores.steam.SteamNative`
Steam store engine (`src/steam/`): signs in with the Linux Steam client's saved login, lists the
account's games, plans and downloads a game straight into the Steam library folder the client
uses, then writes what the client writes on completion, so the client sees the game as installed
and does not update or verify it. Kotlin runs downloads and uninstalls only while the Steam client
is closed.
```kotlin
package com.droiddeck.launcher.stores.steam
object SteamNative {
@JvmStatic external fun nativeSignIn(steamRootsJson: String, registryVdfPath: String, caBundlePath: String): String
@JvmStatic external fun nativeSignOut()
@JvmStatic external fun nativeLibrary(): String
@JvmStatic external fun nativePlan(appId: Int, language: String): String
@JvmStatic external fun nativeStart(appId: Int, language: String, steamRoot: String, gameLibraryHost: String, gameLibraryGuest: String, libraryRootsJson: String, journalDir: String, caBundlePath: String, maxWorkers: Int, processWorkers: Int, listener: Any): Long
@JvmStatic external fun nativeCancel(handle: Long)
@JvmStatic external fun nativeRelease(handle: Long)
@JvmStatic external fun nativeUninstall(appId: Int, steamRoot: String, gameLibraryHost: String, gameLibraryGuest: String, libraryRootsJson: String): String
}
```
| Method | JNI signature | Symbol suffix |
|---|---|---|
| `nativeSignIn(steamRootsJson, registryVdfPath, caBundlePath): String` | `(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;` | `nativeSignIn` |
| `nativeSignOut()` | `()V` | `nativeSignOut` |
| `nativeLibrary(): String` | `()Ljava/lang/String;` | `nativeLibrary` |
| `nativePlan(appId, language): String` | `(ILjava/lang/String;)Ljava/lang/String;` | `nativePlan` |
| `nativeStart(...)`: Long | `(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IILjava/lang/Object;)J` | `nativeStart` |
| `nativeCancel(handle: Long)` | `(J)V` | `nativeCancel` |
| `nativeRelease(handle: Long)` | `(J)V` | `nativeRelease` |
| `nativeUninstall(appId, steamRoot, gameLibraryHost, gameLibraryGuest, libraryRootsJson): String` | `(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;` | `nativeUninstall` |
Full symbols are `Java_com_droiddeck_launcher_stores_steam_SteamNative_<suffix>`. Every `String`
answer is a UTF-8 JSON object with `"ok": true|false`; a failure carries `"error": "<short
reason>"`. `nativeSignIn`, `nativeLibrary`, `nativePlan` and `nativeUninstall` block on the
network or the disk: call them off the main thread. A Rust panic is caught at the boundary and
answers `{"ok":false,"error":"internal_error"}`.
Paths: "host" paths are Android paths the app can open; "guest" paths are what the Steam client
sees inside proot (what `libraryfolders.vdf` holds). `libraryRootsJson` is a JSON array of
`{"host": "...", "guest": "..."}`, one per library of the active client; it is used to find shared
app folders and `libraryfolders.vdf` entries, and the game library is added to it when missing.
### `nativeSignIn`
`steamRootsJson`: JSON array of host paths of Steam roots (arm64 and x86-64 clients), searched in
order. `registryVdfPath`: host path of `~/.steam/registry.vdf` (`""` = none). `caBundlePath`: see
conventions (used for the CM directory request).
Reads, never writes: `<root>/config/loginusers.vdf` (accounts), `<root>/local.vdf`
(`MachineUserConfigStore/Software/Valve/Steam/ConnectCache`, keys matched case-insensitively; the
entry whose key starts with the 8-hex-digit CRC32 of the lowercased account name), and
`registry.vdf` (`Registry/HKCU/Software/Valve/Steam/AutoLoginUser`). The account is
`AutoLoginUser` when it names a known account, else the one with `MostRecent` `"1"`, else the
newest `Timestamp`. The token is decrypted in memory (key = SHA-256 of the lowercased account
name; AES-256-ECB-wrapped IV, AES-256-CBC + PKCS#7), checked to be a Steam JWT for that
SteamID64, sent once in the CM logon and zeroized. It is never logged, written, renewed or
replaced.
Answers `{"ok":true,"account":"<AccountName>","steamId":"<SteamID64>"}` or
`{"ok":false,"error":…}` with `no_saved_login` (no account in any `loginusers.vdf`),
`remember_me_off` (`RememberPassword` `"0"`, or no ConnectCache entry: signed out),
`decrypt_failed` (the entry does not decrypt to this account's token), or `logon_failed: …`
(`logon_failed: eresult=<n> <name>` when Steam refused the logon, e.g. `eresult=5
InvalidPassword` for an expired token; otherwise a connection reason). One process-wide session:
a second call while it is logged on answers at once with the same account. After logon the
session sends no persona, friends or presence messages.
`nativeSignOut()` logs off and drops the session; it never touches the client's files.
### `nativeLibrary`
`{"ok":true,"games":[{"appId":291550,"name":"Brawlhalla","installDir":"Brawlhalla","type":"game","free":true}…]}`:
every app the account's licenses grant (package 0, the basic Steam license, is skipped) whose
PICS `common.type` is `game`, sorted by name. `free` = appinfo marks it free to play
(`common.freetogame` or `extended.isfreeapp` `"1"`). Loaded once per session (the first call
fetches PICS for every owned app and can take a while). `not_signed_in` without a session.
### `nativePlan`
What `nativeStart` would install for `appId` with `language` (Steam's language names, e.g.
`english`):
```json
{"ok":true,"appId":291550,"name":"Brawlhalla","installDir":"Brawlhalla","buildId":26465982,
"language":"english","downloadBytes":…,"installBytes":1594368732,
"depots":[{"depotId":291551,"manifestId":"4224536525702420323","size":1565156559,"dlcAppId":0}],
"shared":[{"depotId":228988,"fromAppId":228980,"manifestId":"6645201662696499616","size":29212173}]}
```
Selection (what the client picks for a Windows game run through Proton): `config.oslist` empty or
containing `windows`; `config.osarch` empty or `64` (`32` only when no `64` depot exists);
`config.language` empty or the language (english when the game has no depot for the requested
language but has english ones; the answer's `language` is the one used); no `lowviolence`
depots; DLC depots (`dlcappid`) only when the DLC is owned; `depotfromapp`/`sharedinstall`
depots are listed under `shared` with the owning app (e.g. 228980 Steamworks Common
Redistributables), whose public manifest they use. Manifest gids are the public branch's, sizes
come from PICS, `buildId` is the public branch's. `installBytes`/`downloadBytes` include the
shared depots (they are not checked against what is already installed here). Errors:
`not_signed_in`, `not_owned`, `appinfo unavailable`, `no installable Windows depot`. A free app
the account does not own yet is planned without asking for its license.
### `nativeStart`
Parameters: `appId`, `language`, `steamRoot` (host path of the active client's Steam root; its
`steamapps/` and `config/` hold the two `libraryfolders.vdf` copies, `depotcache/` its cached
manifests), `gameLibraryHost`/`gameLibraryGuest` (the library to install into), `libraryRootsJson`,
`journalDir` (app-private directory for resume journals), `caBundlePath`, `maxWorkers` (request
window ceiling; `0` = 16), `processWorkers` (decrypt/decompress/write threads; `0` = half the
cores, 2 to 6; on SD cards the card writes, not the network, tend to be the limit), `listener`.
Returns `0` without any callback when the listener is null, `appId <= 0`, the JavaVM or a global
ref cannot be obtained, `steamRoot`/`gameLibraryHost`/`gameLibraryGuest`/`journalDir` is empty,
or the worker thread cannot be spawned. Otherwise the run is on a thread named `steam-dl`
(background priority) and `onComplete` fires exactly once, last. `nativeCancel` is idempotent and
safe until `nativeRelease`; call `nativeRelease` exactly once per non-zero handle, after
`onComplete`.
| Listener method | JNI signature | When |
|---|---|---|
| `onProgress(doneBytes: Long, totalBytes: Long, phase: String)` | `(JJLjava/lang/String;)V` | `phase` is `preparing` (sign-in check, plan, takeover, keys, manifests; `0`/`0`), `downloading` (the game's depots), `shared` (shared depots) or `registering`. `doneBytes`/`totalBytes` count the depot files (decompressed) of everything this run installs, shared depots included; chunks already correct on disk count as done. At most every 250 ms, plus at every phase change and depot end. |
| `onComplete(ok: Boolean, result: String)` | `(ZLjava/lang/String;)V` | `{"ok":true,"alreadyInstalled":false}` after a download, `{"ok":true,"alreadyInstalled":true}` when the game was already fully installed at the current build (nothing downloaded or written), or `{"ok":false,"error":"…"}`: `cancelled`, `not_signed_in`, `already_running` (a run for the same app is active), `not_owned`, `free_license_refused`, `library_not_in_libraryfolders` (no `libraryfolders.vdf` entry has the guest path), `not_enough_space: need … MiB, have … MiB`, `access_denied: depot <id>`, or a short message for network and disk failures. |
What a run does, in order:
1. Plans as `nativePlan`; a free app the account does not own is first added to the account with
`CMsgClientRequestFreeLicense`.
2. Takeover check on `<gameLibraryHost>/steamapps/appmanifest_<appId>.acf`: absent → fresh
install; `StateFlags` has 4 and none of the update/download/validate bits and `buildid` is the
current build → `alreadyInstalled`; fully installed at another build → files are checked and
updated in place and the manifest is merged; otherwise (a half-finished client download) the
manifest, `steamapps/downloading/<appId>` and `steamapps/temp/<appId>` are deleted (and any
journal for the app) before downloading.
3. Downloads the game's depots in place into `<gameLibraryHost>/steamapps/common/<installdir>`:
no temp files, no space reservation, each file trimmed to its exact size when its last chunk
lands. A chunk used several times is fetched once. Files already on disk are read back chunk by
chunk and only wrong or missing chunks are fetched (resume, update, taking over a client's
partial files).
4. Shared depots go into the library that holds `appmanifest_<fromAppId>.acf` (else the Steam
root's own library), folder `steamapps/common/<that app's installdir>`; a shared depot already
installed at the planned manifest is skipped.
5. Registers: writes `appmanifest_<appId>.acf` (keys in the client's order: `appid`, `Universe`,
`name`, `StateFlags` 4, `installdir`, `LastUpdated`, `LastPlayed`, `SizeOnDisk` (the game's
depots), `StagingSize`, `buildid`, `LastOwner` (SteamID64), `DownloadType` 1, `UpdateResult`,
`BytesToDownload`/`BytesDownloaded` (compressed size of every installed depot, shared
included), `BytesToStage`/`BytesStaged` (installed size of the game's depots plus the shared
depots installed in this run), `TargetBuildID`, `AutoUpdateBehavior`,
`AllowOtherDownloadsWhileRunning`, `ScheduledAutoUpdate`, `InstalledDepots`
(`manifest`, `size`, plus `dlcappid` for DLC depots), `InstallScripts` when a game depot has
one, `SharedDepots`, `UserConfig`/`MountedConfig` `language`), merging into an existing file
(unknown keys, `LastPlayed` and the auto-update settings are kept). Updates the shared app's
manifest (`SizeOnDisk`, `InstalledDepots`, `InstallScripts` entry such as
`"228988" "_CommonRedist\\vcredist\\2019\\installscript.vdf"`; created when missing).
Adds `"<appId>" "0"` under `apps` of the matching entry in both
`<steamRoot>/steamapps/libraryfolders.vdf` and `<steamRoot>/config/libraryfolders.vdf` (the
client fills in the size later); nothing else there changes. All files are written through a
temp file + rename.
Never written: `config.vdf`, `localconfig.vdf`, `registry.vdf` (the client regenerates them) and
`depotcache/` (the client keeps manifests there with decrypted file names, not in the CDN form
this engine caches; it fetches them when it needs them).
On-disk protocol of the journal: `<journalDir>/<appId>/depot.config` (JSON: `buildId`, the
finished manifest per depot or an in-progress sentinel) and `<depot>_<manifest>.manifest` (raw
CDN manifests). A cancelled or failed run keeps it, and the next `nativeStart` for the same app
resumes (finished depots are skipped, the rest is checked on disk); a journal written for another
build is dropped. It is deleted after a successful registration. Nothing extra is ever left in
the game folder.
### `nativeUninstall`
Matches the client's own uninstall: deletes `<gameLibraryHost>/steamapps/common/<installdir>` and
the game's `appmanifest_<appId>.acf`, `<steamRoot>/depotcache/<depot>_<manifest>.manifest` for
the game's `InstalledDepots` and `<steamRoot>/steamapps/shadercache/<appId>`; keeps
`steamapps/compatdata/<appId>` (the Proton prefix, i.e. saves). For each of the game's
`SharedDepots` that no other installed game in any library lists, deletes that depot's files from
the shared app's folder (empty folders stay, as with the client) and removes its
`InstalledDepots` and `InstallScripts` entries and its size from the shared app's manifest. The
file list comes from the client's `depotcache` copy of that manifest, else from the CDN through
the live session; without either the shared depot is left installed and listed in `keptShared`.
Removes the app from `apps` in both `libraryfolders.vdf` copies.
Answers `{"ok":true,"removedShared":[228988],"keptShared":[]}`, or `{"ok":false,"error":…}`:
`not_installed` (no app manifest), `bad installdir in app manifest`, `bad arguments`, or a disk
error.
## Log tags
Lines go to logcat under `GogNative` and `EpicNative` (the Amazon module logs only through
`onLog`). Bannerlator used `BL_GOG_DL` for the GOG engine; the fetch core's line grammar
(`fetch-start`, `fetch-window`, `throughput`, `fetch-end`, `summary`) is unchanged, so its tuning
notes still read against a DroidDeck log.
The Steam module logs under `DroidDeckSteam` and never logs a token; its chunk downloads go
through the fetch core with the label `steam depot=<id>`.
+2 -1
View File
@@ -1,4 +1,4 @@
//! Ported from Bannerlator's bl-steam-client crate (GPL-3.0-or-later), itself derived from WinNative's wn-steam-client.
//! DroidDeck's store download engines. The Steam client and the shared fetch core are derived from WinNative's wn-steam-client (GPL-3.0-or-later, https://github.com/WinNative-Emu/WinNative).
#![allow(clippy::missing_safety_doc, clippy::result_large_err)]
@@ -9,4 +9,5 @@ pub mod fetch_tuning;
pub mod gog;
pub mod md5_small;
pub mod priority;
pub mod steam;
pub mod stores_jni;
@@ -0,0 +1,48 @@
# Steam store engine: provenance and license notice
The Steam module of `libdroiddeckstores.so` (`app/src/main/rust/stores/src/steam/`) is a
**derivative work of the `wn-steam-client` crate from the WinNative project**,
<https://github.com/WinNative-Emu/WinNative>, directory
`app/src/main/cpp/wn-steam-client/rust`, taken at upstream commit `a2020b7` (2026-09-01).
The upstream crate is published under **GPL-3.0-or-later**; this derivative is distributed under
the same license as part of DroidDeck. Copyright in the original code remains with the WinNative
authors and contributors, including maxjivi05.
The shared fetch core (`src/fetch_core.rs`, `src/fetch_tuning.rs`) and `src/md5_small.rs`, which
this module uses, come from the same upstream crate.
## Modifications made in DroidDeck (GPL-3.0 §5(a) statement of changes)
Date of modification: 2026-11-07.
- Ported into the `droiddeckstores` crate as the module `steam`; identifiers, log tag
(`DroidDeckSteam`) and thread name (`steam-dl`) follow DroidDeck naming.
- Kept, with import paths adapted: WebSocket transport (`ws_connection`, `transport`), channel
encryption and handshake (`encrypted_channel`, `handshake_messages`, `crypto`, `key_dictionary`),
CM server discovery (`cm_server`, `cm_server_list`, `steam_directory`), wire formats
(`emsg`, `cmsg_protobuf_header`, `proto_envelope`, `proto_wire`, `wire_format`, `base64`, `vdf`),
`heartbeat`, `job_manager`, `content_manifest`, `depot_chunk`, and the protobuf messages for
logon, licenses, PICS, depot keys, manifest request codes, CDN servers and free licenses.
- `cm_client` reduced to logon with a refresh token, heartbeat, log-off and the download-store
requests; the logon sends `machine_id` `DroidDeck-Steam`; logon and log-off EResults are kept
for error reporting.
- `cm_runtime`: no persona or friends traffic after logon, the C-ABI bridge (`cm_bridge`) is
removed, and outbound messages are cleared from memory once sent.
- Blocking HTTP replaced by a one-shot request helper (`http`); `cdn_client` reduced to `cdn`
(URLs, manifest and HTTP-delivered appinfo fetches); CDN servers are de-duplicated by host,
capped at 10 and filtered by `allowed_app_ids`.
- `depot_writer` rewritten on DroidDeck's shared fetch core: files are written in place without
`fallocate` or zero-fill and trimmed with `set_len`; the number of decode/write workers is a
parameter; a chunk used in several places is fetched once; on resume, chunks on disk are read
back and checked before anything is fetched.
- `depot_config` / `depot_downloader`: the resume journal moved out of the game folder into a
caller-given directory, keyed by app and build; the progress sidecar and clean-pause markers are
dropped.
- New: `signin` (reuse of the Linux Steam client's saved login), `session` (one process-wide CM
session), `library`, `plan` (depot selection), `register` (app manifests, shared depots,
`libraryfolders.vdf`, takeover of half-finished client downloads, uninstall), `kv` (Valve
KeyValues writer), `install` (download orchestration) and a new JNI layer (`jni`).
- Not ported: QR and password sign-in, auth sessions, friends, chat and chat images, persona,
lobbies, cloud, user stats, achievements, inventory, published files and workshop, app and
ownership tickets, playing-session control, the Wine bridge, the other stores' downloaders,
the version module and the original JNI layer.
@@ -0,0 +1,97 @@
const ALPHABET: &[u8; 64] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
pub fn encode(bytes: &[u8]) -> String {
if bytes.is_empty() {
return String::new();
}
let mut out = String::with_capacity(bytes.len().div_ceil(3) * 4);
let (chunks, remainder) = bytes.as_chunks::<3>();
for chunk in chunks {
let v = ((chunk[0] as u32) << 16) | ((chunk[1] as u32) << 8) | chunk[2] as u32;
out.push(ALPHABET[((v >> 18) & 0x3f) as usize] as char);
out.push(ALPHABET[((v >> 12) & 0x3f) as usize] as char);
out.push(ALPHABET[((v >> 6) & 0x3f) as usize] as char);
out.push(ALPHABET[(v & 0x3f) as usize] as char);
}
match remainder {
[a] => {
let v = (*a as u32) << 16;
out.push(ALPHABET[((v >> 18) & 0x3f) as usize] as char);
out.push(ALPHABET[((v >> 12) & 0x3f) as usize] as char);
out.push('=');
out.push('=');
}
[a, b] => {
let v = ((*a as u32) << 16) | ((*b as u32) << 8);
out.push(ALPHABET[((v >> 18) & 0x3f) as usize] as char);
out.push(ALPHABET[((v >> 12) & 0x3f) as usize] as char);
out.push(ALPHABET[((v >> 6) & 0x3f) as usize] as char);
out.push('=');
}
[] => {}
_ => unreachable!(),
}
out
}
pub fn decode(s: &str) -> Option<Vec<u8>> {
let mut out = Vec::with_capacity((s.len() / 4) * 3 + 3);
let mut acc = 0u32;
let mut bits = 0u32;
for b in s.bytes() {
let v = value_of(b)?;
let Some(v) = v else {
continue;
};
acc = (acc << 6) | v as u32;
bits += 6;
if bits >= 8 {
bits -= 8;
out.push(((acc >> bits) & 0xff) as u8);
}
}
Some(out)
}
fn value_of(b: u8) -> Option<Option<u8>> {
match b {
b'A'..=b'Z' => Some(Some(b - b'A')),
b'a'..=b'z' => Some(Some(b - b'a' + 26)),
b'0'..=b'9' => Some(Some(b - b'0' + 52)),
b'+' | b'-' => Some(Some(62)),
b'/' | b'_' => Some(Some(63)),
b'=' | b' ' | b'\t' | b'\n' | b'\r' => Some(None),
_ => None,
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn encodes_rfc4648_padding() {
assert_eq!(encode(b""), "");
assert_eq!(encode(b"f"), "Zg==");
assert_eq!(encode(b"fo"), "Zm8=");
assert_eq!(encode(b"foo"), "Zm9v");
assert_eq!(encode(b"foobar"), "Zm9vYmFy");
}
#[test]
fn decodes_standard_urlsafe_and_whitespace() {
assert_eq!(decode("Zm9v YmFy"), Some(b"foobar".to_vec()));
assert_eq!(decode("SGVsbG8td29ybGQ_"), Some(b"Hello-world?".to_vec()));
assert_eq!(decode("Zg=="), Some(b"f".to_vec()));
}
#[test]
fn invalid_character_fails() {
assert_eq!(decode("Zm9v*"), None);
}
}
+439
View File
@@ -0,0 +1,439 @@
//! SteamPipe CDN: URL formation, manifest + HTTP-delivered appinfo fetches, and the zip/gzip
//! helpers they need. Chunk bodies are fetched by the shared fetch core (`crate::fetch_core`).
use crate::steam::pb::ccontentserverdirectory::CContentServerDirectoryServerInfo;
use flate2::read::{DeflateDecoder, GzDecoder};
use std::io::Read;
use std::time::Duration;
/// Distinct CDN hosts a depot run spreads over. Each chunk carries one URL per host, so this also
/// bounds the per-chunk URL memory.
pub const MAX_CDN_HOSTS: usize = 10;
pub const MAX_MANIFEST_FETCH_ATTEMPTS: usize = 5;
#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub struct CdnManifestResult {
pub raw_manifest: Vec<u8>,
pub error: String,
pub http_status: i32,
}
impl CdnManifestResult {
pub fn ok(&self) -> bool {
self.error.is_empty() && !self.raw_manifest.is_empty()
}
}
pub fn default_timeout() -> Duration {
Duration::from_secs(30)
}
pub fn build_manifest_url(
server: &CContentServerDirectoryServerInfo,
depot_id: u32,
manifest_id: u64,
request_code: u64,
) -> Result<String, String> {
let host = preferred_host(server).ok_or_else(|| "cdn server has no host".to_string())?;
let mut url = format!(
"{}://{}:{}/depot/{}/manifest/{}/5",
if server.use_https() { "https" } else { "http" },
host,
server.port(),
depot_id,
manifest_id
);
if request_code != 0 {
url.push('/');
url.push_str(&request_code.to_string());
}
Ok(url)
}
pub fn build_chunk_url(
server: &CContentServerDirectoryServerInfo,
depot_id: u32,
chunk_sha: &[u8],
) -> Result<String, String> {
if chunk_sha.is_empty() {
return Err("empty chunk sha".to_string());
}
let host = preferred_host(server).ok_or_else(|| "cdn server has no host".to_string())?;
Ok(format!(
"{}://{}:{}/depot/{}/chunk/{}",
if server.use_https() { "https" } else { "http" },
host,
server.port(),
depot_id,
hex_encode(chunk_sha)
))
}
/// The per-host key the fetch core caps concurrency on (vhost when present, as the URL uses it).
pub fn host_key(server: &CContentServerDirectoryServerInfo) -> String {
preferred_host(server).unwrap_or_default().to_string()
}
/// Usable servers (not China-only, with a host), de-duplicated by host key, in directory order,
/// at most [`MAX_CDN_HOSTS`].
pub fn usable_servers(
servers: &[CContentServerDirectoryServerInfo],
) -> Vec<CContentServerDirectoryServerInfo> {
let mut out: Vec<CContentServerDirectoryServerInfo> = Vec::new();
for server in servers {
if server.steam_china_only || server.host.is_empty() {
continue;
}
let key = host_key(server);
if out.iter().any(|s| host_key(s) == key) {
continue;
}
out.push(server.clone());
if out.len() >= MAX_CDN_HOSTS {
break;
}
}
out
}
pub fn fetch_manifest(
server: &CContentServerDirectoryServerInfo,
depot_id: u32,
manifest_id: u64,
request_code: u64,
ca_bundle_path: &str,
timeout: Duration,
) -> CdnManifestResult {
let url = match build_manifest_url(server, depot_id, manifest_id, request_code) {
Ok(url) => url,
Err(error) => {
return CdnManifestResult {
error,
..Default::default()
}
}
};
match crate::steam::http::get(&url, timeout, ca_bundle_path) {
Ok(response) => validate_manifest_response(
response.status as i32,
response.body,
response.content_length,
),
Err(error) => CdnManifestResult {
error,
..Default::default()
},
}
}
/// Tries the servers in order (wrapping) with the shared back-off, up to
/// [`MAX_MANIFEST_FETCH_ATTEMPTS`] attempts.
pub fn fetch_manifest_with_retry(
servers: &[CContentServerDirectoryServerInfo],
depot_id: u32,
manifest_id: u64,
request_code: u64,
ca_bundle_path: &str,
cancel: &std::sync::atomic::AtomicBool,
) -> CdnManifestResult {
if servers.is_empty() {
return CdnManifestResult {
error: "no CDN servers available".to_string(),
..Default::default()
};
}
let mut last = CdnManifestResult::default();
for attempt in 0..MAX_MANIFEST_FETCH_ATTEMPTS {
if cancel.load(std::sync::atomic::Ordering::Relaxed) {
return CdnManifestResult {
error: "cancelled".to_string(),
..Default::default()
};
}
if attempt > 0 {
std::thread::sleep(Duration::from_millis(
crate::fetch_tuning::retry_backoff_millis(attempt as u32),
));
}
let server = &servers[attempt % servers.len()];
last = fetch_manifest(
server,
depot_id,
manifest_id,
request_code,
ca_bundle_path,
default_timeout(),
);
if last.ok() {
return last;
}
}
last
}
/// HTTP-delivered PICS appinfo URL (large appinfo the CM did not inline).
pub fn build_appinfo_url(http_host: &str, app_id: u32, sha: &[u8]) -> String {
format!(
"http://{}/appinfo/{}/sha/{}.txt.gz",
http_host,
app_id,
hex_encode(sha)
)
}
/// Fetch + gunzip an HTTP-delivered appinfo blob (same VDF as an inline `buffer`).
pub fn fetch_appinfo(
http_host: &str,
app_id: u32,
sha: &[u8],
ca_bundle_path: &str,
timeout: Duration,
) -> Option<Vec<u8>> {
if http_host.is_empty() || sha.is_empty() {
return None;
}
let url = build_appinfo_url(http_host, app_id, sha);
let response = crate::steam::http::get(&url, timeout, ca_bundle_path).ok()?;
if response.status != 200 || response.body.is_empty() {
return None;
}
Some(maybe_gunzip(response.body))
}
pub fn validate_manifest_response(
http_status: i32,
body: Vec<u8>,
content_length: Option<u64>,
) -> CdnManifestResult {
if http_status != 200 {
return CdnManifestResult {
http_status,
error: format!("HTTP status {http_status}"),
..Default::default()
};
}
if let Some(expected) = content_length {
if body.len() as u64 != expected {
return CdnManifestResult {
http_status,
error: "manifest body truncated (length mismatch)".to_string(),
..Default::default()
};
}
}
let Some(raw_manifest) = unzip_first_entry(&body) else {
return CdnManifestResult {
http_status,
error: "manifest unzip failed".to_string(),
..Default::default()
};
};
CdnManifestResult {
raw_manifest,
error: String::new(),
http_status,
}
}
pub fn unzip_first_entry(zip: &[u8]) -> Option<Vec<u8>> {
if zip.len() < 30 || read_u32(zip, 0)? != 0x0403_4b50 {
return None;
}
let flags = read_u16(zip, 6)?;
let method = read_u16(zip, 8)?;
let comp_size = read_u32(zip, 18)? as usize;
let uncomp_size = read_u32(zip, 22)? as usize;
let name_len = read_u16(zip, 26)? as usize;
let extra_len = read_u16(zip, 28)? as usize;
if (flags & 0x08) != 0 {
return None;
}
let data_off = 30usize.checked_add(name_len)?.checked_add(extra_len)?;
if data_off.checked_add(comp_size)? > zip.len() {
return None;
}
let data = &zip[data_off..data_off + comp_size];
match method {
0 => Some(data.to_vec()),
8 => {
let mut out = Vec::with_capacity(uncomp_size);
DeflateDecoder::new(data).read_to_end(&mut out).ok()?;
Some(out)
}
_ => None,
}
}
/// Gunzip; pass through already-inflated bytes (edge caches may decompress).
pub fn maybe_gunzip(body: Vec<u8>) -> Vec<u8> {
if body.len() >= 2 && body[0] == 0x1f && body[1] == 0x8b {
let mut out = Vec::new();
if GzDecoder::new(&body[..]).read_to_end(&mut out).is_ok() && !out.is_empty() {
return out;
}
}
body
}
pub fn hex_encode(bytes: &[u8]) -> String {
crate::gog::to_hex(bytes)
}
fn preferred_host(server: &CContentServerDirectoryServerInfo) -> Option<&str> {
if !server.vhost.is_empty() {
Some(&server.vhost)
} else if !server.host.is_empty() {
Some(&server.host)
} else {
None
}
}
fn read_u16(buf: &[u8], off: usize) -> Option<u16> {
Some(u16::from_le_bytes(buf.get(off..off + 2)?.try_into().ok()?))
}
fn read_u32(buf: &[u8], off: usize) -> Option<u32> {
Some(u32::from_le_bytes(buf.get(off..off + 4)?.try_into().ok()?))
}
#[cfg(test)]
mod tests {
use super::*;
use flate2::{write::DeflateEncoder, Compression};
use std::io::Write;
#[test]
fn extracts_stored_zip_entry() {
let zip = zip_with_entry(0, b"manifest bytes");
assert_eq!(unzip_first_entry(&zip), Some(b"manifest bytes".to_vec()));
}
#[test]
fn extracts_deflated_zip_entry() {
let mut encoder = DeflateEncoder::new(Vec::new(), Compression::default());
encoder.write_all(b"manifest bytes").unwrap();
let deflated = encoder.finish().unwrap();
let zip = zip_with_compressed_entry(8, &deflated, b"manifest bytes".len() as u32);
assert_eq!(unzip_first_entry(&zip), Some(b"manifest bytes".to_vec()));
}
#[test]
fn rejects_data_descriptor_zip_entry() {
let mut zip = zip_with_entry(0, b"x");
zip[6] = 0x08;
assert_eq!(unzip_first_entry(&zip), None);
}
#[test]
fn hex_encodes_lowercase() {
assert_eq!(hex_encode(&[0, 1, 0xab, 0xff]), "0001abff");
}
#[test]
fn builds_http_appinfo_url() {
assert_eq!(
build_appinfo_url("cache1.steamcontent.com", 601150, &[0xab, 0xcd, 0x01]),
"http://cache1.steamcontent.com/appinfo/601150/sha/abcd01.txt.gz"
);
}
#[test]
fn gunzips_gzip_and_passes_through_plain_vdf() {
use flate2::write::GzEncoder;
let mut encoder = GzEncoder::new(Vec::new(), Compression::default());
encoder.write_all(b"\"appinfo\"{}").unwrap();
let gz = encoder.finish().unwrap();
assert_eq!(maybe_gunzip(gz), b"\"appinfo\"{}");
assert_eq!(maybe_gunzip(b"\"appinfo\"{}".to_vec()), b"\"appinfo\"{}");
}
#[test]
fn builds_manifest_and_chunk_urls() {
let server = CContentServerDirectoryServerInfo {
host: "edge.steamcontent.com".into(),
vhost: "cdn.example".into(),
https_support: "mandatory".into(),
..Default::default()
};
assert_eq!(
build_manifest_url(&server, 100, 200, 300).unwrap(),
"https://cdn.example:443/depot/100/manifest/200/5/300"
);
assert_eq!(
build_chunk_url(&server, 100, &[0xab, 0xcd]).unwrap(),
"https://cdn.example:443/depot/100/chunk/abcd"
);
let plain = CContentServerDirectoryServerInfo {
host: "cache1.example".into(),
..Default::default()
};
assert_eq!(
build_manifest_url(&plain, 1, 2, 0).unwrap(),
"http://cache1.example:80/depot/1/manifest/2/5"
);
}
#[test]
fn usable_servers_drop_china_empty_and_duplicate_hosts() {
let server = |host: &str, vhost: &str, china: bool| CContentServerDirectoryServerInfo {
host: host.into(),
vhost: vhost.into(),
steam_china_only: china,
..Default::default()
};
let list = usable_servers(&[
server("a", "", false),
server("b", "", true),
server("", "", false),
server("c", "a", false),
server("d", "", false),
]);
let hosts: Vec<_> = list.iter().map(host_key).collect();
assert_eq!(hosts, vec!["a", "d"]);
let many: Vec<_> = (0..20)
.map(|i| server(&format!("h{i}"), "", false))
.collect();
assert_eq!(usable_servers(&many).len(), MAX_CDN_HOSTS);
}
#[test]
fn validates_http_status_lengths_and_manifest_zip() {
let zip = zip_with_entry(0, b"manifest bytes");
let ok = validate_manifest_response(200, zip.clone(), Some(zip.len() as u64));
assert!(ok.ok());
assert_eq!(ok.raw_manifest, b"manifest bytes");
let short = validate_manifest_response(200, zip, Some(999));
assert_eq!(short.error, "manifest body truncated (length mismatch)");
assert_eq!(
validate_manifest_response(404, vec![], None).error,
"HTTP status 404"
);
}
fn zip_with_entry(method: u16, data: &[u8]) -> Vec<u8> {
zip_with_compressed_entry(method, data, data.len() as u32)
}
fn zip_with_compressed_entry(method: u16, data: &[u8], uncomp_size: u32) -> Vec<u8> {
let mut out = Vec::new();
out.extend_from_slice(&0x0403_4b50u32.to_le_bytes());
out.extend_from_slice(&20u16.to_le_bytes());
out.extend_from_slice(&0u16.to_le_bytes());
out.extend_from_slice(&method.to_le_bytes());
out.extend_from_slice(&0u16.to_le_bytes());
out.extend_from_slice(&0u16.to_le_bytes());
out.extend_from_slice(&0u32.to_le_bytes());
out.extend_from_slice(&(data.len() as u32).to_le_bytes());
out.extend_from_slice(&uncomp_size.to_le_bytes());
out.extend_from_slice(&1u16.to_le_bytes());
out.extend_from_slice(&0u16.to_le_bytes());
out.extend_from_slice(b"x");
out.extend_from_slice(data);
out
}
}
@@ -0,0 +1,852 @@
//! CM session state and message builders: logon with a refresh token, heartbeat, log-off, and the
//! requests a download store needs (PICS, depot keys, manifest request codes, CDN server list,
//! free licenses). Social, stats, cloud, lobby and ticket messages are not part of this port.
use crate::steam::cmsg_protobuf_header::{CMsgProtoBufHeader, INVALID_JOB_ID};
use crate::steam::crypto::generate_session_key;
use crate::steam::emsg::EMsg;
use crate::steam::job_manager::JobResult;
use crate::steam::pb::ccontentserverdirectory::{
CContentServerDirectoryGetManifestRequestCodeRequest,
CContentServerDirectoryGetServersForSteamPipeRequest,
};
use crate::steam::pb::cmsg_client_get_depot_decryption_key::CMsgClientGetDepotDecryptionKey;
use crate::steam::pb::cmsg_client_license_list::{CMsgClientLicenseList, License};
use crate::steam::pb::cmsg_client_pics::{
CMsgClientPICSAccessTokenRequest, CMsgClientPICSProductInfoRequest, PicsAppInfoReq,
PicsPackageInfoReq,
};
use crate::steam::pb::cmsg_client_request_free_license::CMsgClientRequestFreeLicense;
use crate::steam::pb::cmsg_clientserver_login::{
CMsgClientHeartBeat, CMsgClientHello, CMsgClientLogOff, CMsgClientLogon,
CMsgClientLogonResponse,
};
use crate::steam::proto_envelope::encode_proto_envelope;
use flate2::read::{GzDecoder, ZlibDecoder};
use std::io::Read;
use std::sync::atomic::{AtomicI32, AtomicU32, AtomicU64, AtomicU8, Ordering};
use std::sync::Mutex;
/// Sent as `machine_id` in the logon.
pub const MACHINE_ID: &[u8] = b"DroidDeck-Steam";
const LOGON_PROTOCOL_VERSION: u32 = 65580;
const LOGON_CLIENT_OS_TYPE: u32 = 16;
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[repr(u8)]
pub enum ClientState {
Disconnected,
Connecting,
Connected,
LoggedOn,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum InboundAction {
DeliverJob(JobResult),
Multi,
PicsProductInfo,
LogonOk,
LoggedOff,
LicenseList(usize),
ClientMessage,
Ignored,
ParseFailed(&'static str),
}
#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub struct CMsgMultiBody {
pub size_unzipped: u32,
pub message_body: Vec<u8>,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct OutboundProtoMessage {
pub emsg: EMsg,
pub routing_appid: u32,
pub body: Vec<u8>,
pub wire: Vec<u8>,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct OutboundServiceCall {
pub method_name: String,
pub authed: bool,
pub job_id: u64,
pub request_body: Vec<u8>,
pub wire: Vec<u8>,
}
pub struct CMClientCore {
state: AtomicU8,
steam_id: AtomicU64,
session_id: AtomicI32,
cell_id: AtomicU32,
/// EResult of the last logon response or log-off (0 = none yet).
last_logon_eresult: AtomicI32,
license_list: Mutex<Option<Vec<License>>>,
outbound_wires: Mutex<Vec<Vec<u8>>>,
}
impl Default for CMClientCore {
fn default() -> Self {
Self {
state: AtomicU8::new(ClientState::Disconnected as u8),
steam_id: AtomicU64::new(0),
session_id: AtomicI32::new(0),
cell_id: AtomicU32::new(0),
last_logon_eresult: AtomicI32::new(0),
license_list: Mutex::new(None),
outbound_wires: Mutex::new(Vec::new()),
}
}
}
impl CMClientCore {
pub fn state(&self) -> ClientState {
match self.state.load(Ordering::Relaxed) {
1 => ClientState::Connecting,
2 => ClientState::Connected,
3 => ClientState::LoggedOn,
_ => ClientState::Disconnected,
}
}
pub fn set_state(&self, state: ClientState) {
self.state.store(state as u8, Ordering::Relaxed);
}
pub fn reset_session_identity(&self) {
self.steam_id.store(0, Ordering::Relaxed);
self.session_id.store(0, Ordering::Relaxed);
self.outbound_wires
.lock()
.expect("outbound queue poisoned")
.clear();
}
pub fn steam_id(&self) -> u64 {
self.steam_id.load(Ordering::Relaxed)
}
pub fn session_id(&self) -> i32 {
self.session_id.load(Ordering::Relaxed)
}
pub fn cell_id(&self) -> u32 {
self.cell_id.load(Ordering::Relaxed)
}
pub fn last_logon_eresult(&self) -> i32 {
self.last_logon_eresult.load(Ordering::Relaxed)
}
pub fn clear_last_logon_eresult(&self) {
self.last_logon_eresult.store(0, Ordering::Relaxed);
}
/// The license list Steam pushed after logon; `None` until it arrived.
pub fn license_list(&self) -> Option<Vec<License>> {
self.license_list
.lock()
.expect("license list poisoned")
.clone()
}
pub fn enqueue_proto_message(&self, message: Option<OutboundProtoMessage>) -> bool {
let Some(message) = message else {
return false;
};
self.enqueue_wire(message.wire)
}
pub fn enqueue_wire(&self, wire: Vec<u8>) -> bool {
if wire.is_empty() {
return false;
}
self.outbound_wires
.lock()
.expect("outbound queue poisoned")
.push(wire);
true
}
pub fn restore_outbound_wires_front(&self, mut wires: Vec<Vec<u8>>) {
if wires.is_empty() {
return;
}
let mut queue = self.outbound_wires.lock().expect("outbound queue poisoned");
if queue.is_empty() {
*queue = wires;
return;
}
let mut restored = Vec::with_capacity(wires.len() + queue.len());
restored.append(&mut wires);
restored.append(&mut queue);
*queue = restored;
}
pub fn take_outbound_wires(&self) -> Vec<Vec<u8>> {
std::mem::take(&mut *self.outbound_wires.lock().expect("outbound queue poisoned"))
}
pub fn build_proto_message(&self, emsg: EMsg, body: &[u8], routing_appid: u32) -> Vec<u8> {
let mut header = CMsgProtoBufHeader {
steamid: self.steam_id(),
client_sessionid: self.session_id(),
routing_appid,
..Default::default()
};
if emsg == EMsg::CLIENT_LOGON && header.steamid == 0 {
header.steamid = 0x0110_0001_0000_0000;
}
encode_proto_envelope(emsg, &header, body)
}
pub fn build_client_hello(&self) -> OutboundProtoMessage {
let body = CMsgClientHello::default().serialize();
let wire = self.build_proto_message(EMsg::CLIENT_HELLO, &body, 0);
OutboundProtoMessage {
emsg: EMsg::CLIENT_HELLO,
routing_appid: 0,
body,
wire,
}
}
pub fn build_heartbeat(&self) -> OutboundProtoMessage {
let body = CMsgClientHeartBeat::default().serialize();
let wire = self.build_proto_message(EMsg::CLIENT_HEART_BEAT, &body, 0);
OutboundProtoMessage {
emsg: EMsg::CLIENT_HEART_BEAT,
routing_appid: 0,
body,
wire,
}
}
pub fn build_logoff(&self) -> Option<OutboundProtoMessage> {
if self.state() != ClientState::LoggedOn {
return None;
}
self.build_outbound_proto_message(EMsg::CLIENT_LOG_OFF, CMsgClientLogOff.serialize(), 0)
}
/// `ClientLogon` carrying the saved refresh token as `access_token`. The returned wire holds
/// the token; drop it as soon as it is queued.
pub fn build_logon_with_refresh_token(
&self,
refresh_token: &str,
account_name: &str,
client_supplied_steam_id: u64,
) -> Option<OutboundProtoMessage> {
if self.state() != ClientState::Connected || refresh_token.is_empty() {
return None;
}
let mut msg = CMsgClientLogon {
access_token: refresh_token.to_string(),
account_name: account_name.to_string(),
client_supplied_steam_id,
machine_id: MACHINE_ID.to_vec(),
protocol_version: LOGON_PROTOCOL_VERSION,
client_os_type: LOGON_CLIENT_OS_TYPE,
supports_rate_limit_response: true,
..Default::default()
};
if let Some(key) = generate_session_key() {
let mut client_instance_id = 0u64;
for (idx, byte) in key.bytes.iter().take(8).enumerate() {
client_instance_id |= (*byte as u64) << (idx * 8);
}
msg.client_instance_id = client_instance_id.max(1);
let mut login_id = 0u32;
for (idx, byte) in key.bytes.iter().skip(8).take(4).enumerate() {
login_id |= (*byte as u32) << (idx * 8);
}
msg.obfuscated_private_ip = login_id.max(1);
}
let body = msg.serialize();
zeroize::Zeroize::zeroize(&mut msg.access_token);
let wire = self.build_proto_message(EMsg::CLIENT_LOGON, &body, 0);
let mut body = body;
zeroize::Zeroize::zeroize(&mut body);
Some(OutboundProtoMessage {
emsg: EMsg::CLIENT_LOGON,
routing_appid: 0,
body: Vec::new(),
wire,
})
}
pub fn build_service_method_call(
&self,
method_name: &str,
authed: bool,
job_id: u64,
request_body: &[u8],
) -> Vec<u8> {
let header = CMsgProtoBufHeader {
steamid: self.steam_id(),
client_sessionid: self.session_id(),
jobid_source: job_id,
jobid_target: INVALID_JOB_ID,
target_job_name: method_name.to_string(),
..Default::default()
};
let emsg = if authed {
EMsg::SERVICE_METHOD_CALL_FROM_CLIENT
} else {
EMsg::SERVICE_METHOD_CALL_FROM_CLIENT_NON_AUTHED
};
encode_proto_envelope(emsg, &header, request_body)
}
pub fn build_outbound_proto_message(
&self,
emsg: EMsg,
body: Vec<u8>,
routing_appid: u32,
) -> Option<OutboundProtoMessage> {
if self.state() != ClientState::LoggedOn {
return None;
}
let wire = self.build_proto_message(emsg, &body, routing_appid);
Some(OutboundProtoMessage {
emsg,
routing_appid,
body,
wire,
})
}
pub fn build_job_proto_message(
&self,
emsg: EMsg,
job_id: u64,
body: Vec<u8>,
routing_appid: u32,
) -> Option<OutboundProtoMessage> {
if self.state() != ClientState::LoggedOn {
return None;
}
let header = CMsgProtoBufHeader {
steamid: self.steam_id(),
client_sessionid: self.session_id(),
routing_appid,
jobid_source: job_id,
jobid_target: INVALID_JOB_ID,
..Default::default()
};
let wire = encode_proto_envelope(emsg, &header, &body);
Some(OutboundProtoMessage {
emsg,
routing_appid,
body,
wire,
})
}
pub fn build_authed_service_call(
&self,
method_name: &str,
job_id: u64,
request_body: Vec<u8>,
) -> Option<OutboundServiceCall> {
if self.state() != ClientState::LoggedOn {
return None;
}
let wire = self.build_service_method_call(method_name, true, job_id, &request_body);
Some(OutboundServiceCall {
method_name: method_name.to_string(),
authed: true,
job_id,
request_body,
wire,
})
}
pub fn build_get_depot_decryption_key(
&self,
depot_id: u32,
app_id: u32,
job_id: u64,
) -> Option<OutboundProtoMessage> {
if depot_id == 0 || app_id == 0 {
return None;
}
self.build_job_proto_message(
EMsg::CLIENT_GET_DEPOT_DECRYPTION_KEY,
job_id,
CMsgClientGetDepotDecryptionKey { depot_id, app_id }.serialize(),
0,
)
}
pub fn build_manifest_request_code_call(
&self,
app_id: u32,
depot_id: u32,
manifest_id: u64,
branch: &str,
job_id: u64,
) -> Option<OutboundServiceCall> {
if app_id == 0 || depot_id == 0 || manifest_id == 0 {
return None;
}
let lower = branch.to_ascii_lowercase();
let app_branch = if lower.is_empty() || lower == "public" {
String::new()
} else {
branch.to_string()
};
self.build_authed_service_call(
"ContentServerDirectory.GetManifestRequestCode#1",
job_id,
CContentServerDirectoryGetManifestRequestCodeRequest {
app_id,
depot_id,
manifest_id,
app_branch,
branch_password_hash: String::new(),
}
.serialize(),
)
}
pub fn build_get_cdn_servers_call(
&self,
cell_id: u32,
job_id: u64,
) -> Option<OutboundServiceCall> {
self.build_authed_service_call(
"ContentServerDirectory.GetServersForSteamPipe#1",
job_id,
CContentServerDirectoryGetServersForSteamPipeRequest {
cell_id,
..Default::default()
}
.serialize(),
)
}
pub fn build_pics_access_tokens(
&self,
packageids: Vec<u32>,
appids: Vec<u32>,
job_id: u64,
) -> Option<OutboundProtoMessage> {
self.build_job_proto_message(
EMsg::CLIENT_PICS_ACCESS_TOKEN_REQUEST,
job_id,
CMsgClientPICSAccessTokenRequest { packageids, appids }.serialize(),
0,
)
}
pub fn build_pics_product_info(
&self,
packages: Vec<PicsPackageInfoReq>,
apps: Vec<PicsAppInfoReq>,
meta_data_only: bool,
job_id: u64,
) -> Option<OutboundProtoMessage> {
self.build_job_proto_message(
EMsg::CLIENT_PICS_PRODUCT_INFO_REQUEST,
job_id,
CMsgClientPICSProductInfoRequest {
packages,
apps,
meta_data_only,
single_response: false,
..Default::default()
}
.serialize(),
0,
)
}
/// Succeeds only for apps Steam gives away; a paid unowned app comes back with a non-OK
/// EResult in the response body.
pub fn build_request_free_license(
&self,
app_ids: &[u32],
job_id: u64,
) -> Option<OutboundProtoMessage> {
if app_ids.is_empty() {
return None;
}
self.build_job_proto_message(
EMsg::CLIENT_REQUEST_FREE_LICENSE,
job_id,
CMsgClientRequestFreeLicense {
appids: app_ids.to_vec(),
}
.serialize(),
0,
)
}
pub fn route_inbound(
&self,
emsg: EMsg,
header: &CMsgProtoBufHeader,
body: &[u8],
) -> InboundAction {
match emsg {
EMsg::SERVICE_METHOD_RESPONSE
| EMsg::CLIENT_PICS_ACCESS_TOKEN_RESPONSE
| EMsg::CLIENT_GET_DEPOT_DECRYPTION_KEY_RESPONSE
// 5573 carries its own EResult in the body; the job only reports transport health.
| EMsg::CLIENT_REQUEST_FREE_LICENSE_RESPONSE => {
if header.jobid_target == INVALID_JOB_ID {
InboundAction::Ignored
} else {
let eresult = if header.eresult == -1 {
1
} else {
header.eresult
};
InboundAction::DeliverJob(JobResult {
eresult,
error_message: header.error_message.clone(),
body: body.to_vec(),
synthetic_failure: false,
})
}
}
EMsg::CLIENT_PICS_PRODUCT_INFO_RESPONSE => InboundAction::PicsProductInfo,
EMsg::MULTI => InboundAction::Multi,
EMsg::CLIENT_LOGON_RESPONSE => {
let Some(resp) = CMsgClientLogonResponse::deserialize(body) else {
return InboundAction::ParseFailed("ClientLogonResponse");
};
self.last_logon_eresult
.store(resp.eresult, Ordering::Relaxed);
if resp.eresult == 1 {
self.state
.store(ClientState::LoggedOn as u8, Ordering::Relaxed);
self.steam_id
.store(resp.client_supplied_steamid, Ordering::Relaxed);
self.session_id
.store(header.client_sessionid, Ordering::Relaxed);
self.cell_id.store(resp.cell_id, Ordering::Relaxed);
InboundAction::LogonOk
} else {
InboundAction::LoggedOff
}
}
EMsg::CLIENT_LOGGED_OFF | EMsg::CLIENT_SERVER_UNAVAILABLE => {
if self.state() == ClientState::LoggedOn {
self.state
.store(ClientState::Connected as u8, Ordering::Relaxed);
}
if emsg == EMsg::CLIENT_LOGGED_OFF {
let eresult = crate::steam::pb::cmsg_clientserver_login::CMsgClientLoggedOff::deserialize(body)
.map(|m| m.eresult)
.unwrap_or(2);
self.last_logon_eresult.store(eresult, Ordering::Relaxed);
}
self.steam_id.store(0, Ordering::Relaxed);
self.session_id.store(0, Ordering::Relaxed);
InboundAction::LoggedOff
}
EMsg::CLIENT_LICENSE_LIST => {
let Some(msg) = CMsgClientLicenseList::deserialize(body) else {
return InboundAction::ParseFailed("ClientLicenseList");
};
let count = msg.licenses.len();
*self.license_list.lock().expect("license list poisoned") = Some(msg.licenses);
InboundAction::LicenseList(count)
}
_ => InboundAction::ClientMessage,
}
}
}
pub fn parse_cmsg_multi(body: &[u8]) -> Option<CMsgMultiBody> {
let mut reader = crate::steam::proto_wire::Reader::new(body);
let mut multi = CMsgMultiBody::default();
while !reader.eof() {
let Some(tag) = reader.next_tag() else {
return reader.ok().then_some(multi);
};
match tag.field_number {
1 => multi.size_unzipped = reader.u32()?,
2 => multi.message_body = reader.bytes()?.to_vec(),
_ => {
if !reader.skip(tag.wire_type) {
return None;
}
}
}
}
Some(multi)
}
pub fn decode_multi_records(body: &[u8]) -> Option<Vec<Vec<u8>>> {
let multi = parse_cmsg_multi(body)?;
let records = if multi.size_unzipped > 0 {
gunzip_or_zlib(&multi.message_body, multi.size_unzipped as usize)?
} else {
multi.message_body
};
let mut out = Vec::new();
let mut offset = 0usize;
while offset + 4 <= records.len() {
let inner_len = crate::steam::wire_format::read_u32_le(&records[offset..]) as usize;
offset += 4;
if inner_len == 0 || offset + inner_len > records.len() {
return None;
}
out.push(records[offset..offset + inner_len].to_vec());
offset += inner_len;
}
(offset == records.len()).then_some(out)
}
fn gunzip_or_zlib(compressed: &[u8], expected_size: usize) -> Option<Vec<u8>> {
let mut out = Vec::with_capacity(expected_size);
if GzDecoder::new(compressed).read_to_end(&mut out).is_ok() && !out.is_empty() {
return Some(out);
}
out.clear();
if ZlibDecoder::new(compressed).read_to_end(&mut out).is_ok() && !out.is_empty() {
return Some(out);
}
None
}
#[cfg(test)]
mod tests {
use super::*;
use crate::steam::proto_envelope::decode_proto_envelope;
use crate::steam::proto_wire::{WireType, Writer};
use flate2::write::GzEncoder;
use flate2::Compression;
use std::io::Write;
#[test]
fn service_method_call_sets_authed_and_non_authed_emsgs() {
let core = CMClientCore::default();
core.steam_id.store(123, Ordering::Relaxed);
core.session_id.store(7, Ordering::Relaxed);
let authed = decode_proto_envelope(&core.build_service_method_call(
"ContentServerDirectory.GetServersForSteamPipe#1",
true,
55,
b"req",
))
.unwrap();
assert_eq!(authed.emsg, EMsg::SERVICE_METHOD_CALL_FROM_CLIENT);
assert_eq!(authed.header.steamid, 123);
assert_eq!(authed.header.client_sessionid, 7);
assert_eq!(authed.header.jobid_source, 55);
assert_eq!(authed.body, b"req");
let non = decode_proto_envelope(&core.build_service_method_call("X.Y#1", false, 56, b""))
.unwrap();
assert_eq!(non.emsg, EMsg::SERVICE_METHOD_CALL_FROM_CLIENT_NON_AUTHED);
}
#[test]
fn cmsg_multi_decodes_plain_and_gzip_records() {
let first = encode_proto_envelope(EMsg::CLIENT_HELLO, &CMsgProtoBufHeader::default(), b"a");
let second = encode_proto_envelope(
EMsg::CLIENT_LICENSE_LIST,
&CMsgProtoBufHeader::default(),
b"b",
);
let mut records = Vec::new();
records.extend_from_slice(&(first.len() as u32).to_le_bytes());
records.extend_from_slice(&first);
records.extend_from_slice(&(second.len() as u32).to_le_bytes());
records.extend_from_slice(&second);
let mut body = Vec::new();
Writer::new(&mut body).bytes_field(2, &records);
assert_eq!(
decode_multi_records(&body).unwrap(),
vec![first.clone(), second.clone()]
);
let mut encoder = GzEncoder::new(Vec::new(), Compression::default());
encoder.write_all(&records).unwrap();
let zipped = encoder.finish().unwrap();
let mut zipped_body = Vec::new();
{
let mut writer = Writer::new(&mut zipped_body);
writer.uint32_field(1, records.len() as u32);
writer.bytes_field(2, &zipped);
}
assert_eq!(
decode_multi_records(&zipped_body).unwrap(),
vec![first, second]
);
}
#[test]
fn logon_needs_connected_state_and_carries_token_and_machine_id() {
let core = CMClientCore::default();
assert!(core
.build_logon_with_refresh_token("refresh", "ada", 0)
.is_none());
core.set_state(ClientState::Connected);
let logon = core
.build_logon_with_refresh_token("refresh", "ada", 123)
.unwrap();
assert_eq!(logon.emsg, EMsg::CLIENT_LOGON);
let decoded = decode_proto_envelope(&logon.wire).unwrap();
assert_eq!(decoded.header.steamid, 0x0110_0001_0000_0000);
assert!(decoded.body.windows(7).any(|w| w == b"refresh"));
assert!(decoded
.body
.windows(MACHINE_ID.len())
.any(|w| w == MACHINE_ID));
assert!(logon.body.is_empty());
assert!(core.build_logon_with_refresh_token("", "ada", 1).is_none());
assert!(core.build_logoff().is_none());
core.set_state(ClientState::LoggedOn);
assert_eq!(core.build_logoff().unwrap().emsg, EMsg::CLIENT_LOG_OFF);
}
#[test]
fn logon_response_updates_session_identity_and_eresult() {
let core = CMClientCore::default();
let mut body = Vec::new();
{
let mut w = Writer::new(&mut body);
w.int32_field(1, 1);
w.tag(20, WireType::Fixed64);
w.raw_bytes(&765u64.to_le_bytes());
}
let header = CMsgProtoBufHeader {
client_sessionid: 42,
..Default::default()
};
assert_eq!(
core.route_inbound(EMsg::CLIENT_LOGON_RESPONSE, &header, &body),
InboundAction::LogonOk
);
assert_eq!(core.state(), ClientState::LoggedOn);
assert_eq!(core.steam_id(), 765);
assert_eq!(core.session_id(), 42);
assert_eq!(core.last_logon_eresult(), 1);
assert_eq!(
core.route_inbound(EMsg::CLIENT_LOGGED_OFF, &CMsgProtoBufHeader::default(), &[]),
InboundAction::LoggedOff
);
assert_eq!(core.state(), ClientState::Connected);
assert_eq!(core.steam_id(), 0);
let mut refused = Vec::new();
Writer::new(&mut refused).int32_field(1, 5);
let fresh = CMClientCore::default();
assert_eq!(
fresh.route_inbound(EMsg::CLIENT_LOGON_RESPONSE, &header, &refused),
InboundAction::LoggedOff
);
assert_eq!(fresh.last_logon_eresult(), 5);
assert_eq!(fresh.state(), ClientState::Disconnected);
}
#[test]
fn license_list_push_is_stored() {
let core = CMClientCore::default();
assert!(core.license_list().is_none());
assert_eq!(
core.route_inbound(
EMsg::CLIENT_LICENSE_LIST,
&CMsgProtoBufHeader::default(),
&[]
),
InboundAction::LicenseList(0)
);
assert_eq!(core.license_list(), Some(Vec::new()));
}
#[test]
fn downloader_builders_use_the_expected_messages() {
let core = logged_on_core();
let depot_key = core.build_get_depot_decryption_key(11, 22, 33).unwrap();
let decoded = decode_proto_envelope(&depot_key.wire).unwrap();
assert_eq!(decoded.emsg, EMsg::CLIENT_GET_DEPOT_DECRYPTION_KEY);
assert_eq!(decoded.header.jobid_source, 33);
let public = core
.build_manifest_request_code_call(480, 100, 555, "public", 44)
.unwrap();
assert_eq!(
public.method_name,
"ContentServerDirectory.GetManifestRequestCode#1"
);
assert!(!public.request_body.windows(6).any(|w| w == b"public"));
let beta = core
.build_manifest_request_code_call(480, 100, 555, "Beta", 45)
.unwrap();
assert!(beta.request_body.windows(4).any(|w| w == b"Beta"));
let servers = core.build_get_cdn_servers_call(7, 46).unwrap();
assert_eq!(
servers.method_name,
"ContentServerDirectory.GetServersForSteamPipe#1"
);
let product = core
.build_pics_product_info(
vec![PicsPackageInfoReq {
packageid: 100,
access_token: 7,
}],
vec![PicsAppInfoReq {
appid: 480,
access_token: 8,
only_public_obsolete: false,
}],
true,
3,
)
.unwrap();
assert_eq!(product.emsg, EMsg::CLIENT_PICS_PRODUCT_INFO_REQUEST);
assert!(product.body.windows(2).any(|w| w == [0x18, 1]));
let free = core.build_request_free_license(&[440], 50).unwrap();
assert_eq!(free.emsg, EMsg::CLIENT_REQUEST_FREE_LICENSE);
assert_eq!(free.body, [0x10, 0xb8, 0x03]);
assert!(core.build_request_free_license(&[], 51).is_none());
}
#[test]
fn job_responses_are_delivered_and_builders_need_logon() {
let core = logged_on_core();
let header = CMsgProtoBufHeader {
jobid_target: 50,
..Default::default()
};
assert!(matches!(
core.route_inbound(EMsg::CLIENT_REQUEST_FREE_LICENSE_RESPONSE, &header, &[]),
InboundAction::DeliverJob(_)
));
assert_eq!(
core.route_inbound(
EMsg::SERVICE_METHOD_RESPONSE,
&CMsgProtoBufHeader::default(),
&[]
),
InboundAction::Ignored
);
let offline = CMClientCore::default();
assert!(offline.build_get_depot_decryption_key(1, 2, 3).is_none());
assert!(offline.build_get_cdn_servers_call(0, 1).is_none());
}
fn logged_on_core() -> CMClientCore {
let core = CMClientCore::default();
core.state
.store(ClientState::LoggedOn as u8, Ordering::Relaxed);
core.steam_id.store(7656119, Ordering::Relaxed);
core.session_id.store(42, Ordering::Relaxed);
core
}
}
@@ -0,0 +1,569 @@
use crate::steam::cm_client::{decode_multi_records, CMClientCore, ClientState, InboundAction};
use crate::steam::cmsg_protobuf_header::{CMsgProtoBufHeader, INVALID_JOB_ID};
use crate::steam::emsg::{has_proto_flag, strip_proto_flag, EMsg};
use crate::steam::encrypted_channel::{ChannelDisconnectReason, ChannelState, EncryptedChannel};
use crate::steam::heartbeat::Heartbeat;
use crate::steam::job_manager::{JobManager, JobResult};
use crate::steam::pb::cmsg_client_pics::CMsgClientPICSProductInfoResponse;
use crate::steam::pb::cmsg_clientserver_login::CMsgClientLogonResponse;
use crate::steam::proto_envelope::decode_proto_envelope;
use crate::steam::transport::Transport;
use crate::steam::wire_format::read_u32_le;
use std::collections::HashMap;
use std::panic::{self, AssertUnwindSafe};
use std::sync::{Arc, Mutex};
use std::time::Duration;
use zeroize::Zeroize;
type StateCallback = Box<dyn Fn(ClientState) + Send + Sync + 'static>;
type ClientMessageCallback = Box<dyn Fn(EMsg, &CMsgProtoBufHeader, &[u8]) + Send + Sync + 'static>;
pub struct CMClientRuntime {
core: Arc<CMClientCore>,
channel: EncryptedChannel,
jobs: JobManager,
heartbeat: Mutex<Heartbeat>,
pics_product_info: Mutex<HashMap<u64, CMsgClientPICSProductInfoResponse>>,
on_state: Mutex<Option<StateCallback>>,
on_client_message: Mutex<Option<ClientMessageCallback>>,
}
impl CMClientRuntime {
pub fn new(core: Arc<CMClientCore>, transport: Box<dyn Transport>) -> Arc<Self> {
let runtime = Arc::new(Self {
core,
channel: EncryptedChannel::new(transport),
jobs: JobManager::default(),
heartbeat: Mutex::new(Heartbeat::default()),
pics_product_info: Mutex::new(HashMap::new()),
on_state: Mutex::new(None),
on_client_message: Mutex::new(None),
});
let weak = Arc::downgrade(&runtime);
runtime.channel.set_on_connected(move || {
if let Some(runtime) = weak.upgrade() {
runtime.on_channel_connected();
}
});
let weak = Arc::downgrade(&runtime);
runtime.channel.set_on_disconnected(move |reason, detail| {
if let Some(runtime) = weak.upgrade() {
runtime.on_channel_disconnected(reason, detail);
}
});
let weak = Arc::downgrade(&runtime);
runtime.channel.set_on_message(move |bytes| {
if let Some(runtime) = weak.upgrade() {
runtime.handle_channel_message(bytes);
}
});
runtime
}
pub fn core(&self) -> &Arc<CMClientCore> {
&self.core
}
pub fn connect(&self, url: &str) -> bool {
self.core.set_state(ClientState::Connecting);
self.notify_state(ClientState::Connecting);
if self.channel.connect(url) {
true
} else {
self.core.set_state(ClientState::Disconnected);
self.notify_state(ClientState::Disconnected);
false
}
}
pub fn disconnect(&self) {
self.heartbeat.lock().expect("heartbeat poisoned").stop();
self.channel.disconnect();
self.jobs.fail_all("CMClient disconnected");
self.core.reset_session_identity();
self.core.set_state(ClientState::Disconnected);
self.notify_state(ClientState::Disconnected);
}
pub fn set_ca_bundle_path(&self, path: &str) {
self.channel.set_ca_bundle_path(path);
}
pub fn set_on_state<F>(&self, callback: F)
where
F: Fn(ClientState) + Send + Sync + 'static,
{
*self.on_state.lock().expect("runtime callback poisoned") = Some(Box::new(callback));
}
pub fn set_on_client_message<F>(&self, callback: F)
where
F: Fn(EMsg, &CMsgProtoBufHeader, &[u8]) + Send + Sync + 'static,
{
*self
.on_client_message
.lock()
.expect("runtime callback poisoned") = Some(Box::new(callback));
}
pub fn next_job_id(&self) -> u64 {
self.jobs.next_job_id()
}
pub fn track_job<F>(&self, job_id: u64, callback: F, timeout: Option<Duration>)
where
F: FnOnce(JobResult) + Send + 'static,
{
self.jobs.track(job_id, callback, timeout);
}
pub fn flush_outbound(&self) -> usize {
if self.channel.state() != ChannelState::Encrypted {
return 0;
}
let mut wires = self.core.take_outbound_wires();
let mut sent = 0usize;
for idx in 0..wires.len() {
if self.channel.send(&wires[idx]) {
// Outbound wires can hold the logon token; clear each one once it is sent.
wires[idx].zeroize();
sent += 1;
continue;
}
self.core.restore_outbound_wires_front(wires.split_off(idx));
break;
}
sent
}
pub fn handle_channel_message(self: &Arc<Self>, bytes: &[u8]) -> InboundAction {
let Some(envelope) = decode_proto_envelope(bytes) else {
return self.handle_non_proto_message(bytes);
};
self.process_envelope(envelope.emsg, &envelope.header, &envelope.body)
}
fn process_envelope(
self: &Arc<Self>,
emsg: EMsg,
header: &CMsgProtoBufHeader,
body: &[u8],
) -> InboundAction {
let action = self.core.route_inbound(emsg, header, body);
match &action {
InboundAction::Multi => {
if let Some(records) = decode_multi_records(body) {
for record in records {
self.handle_channel_message(&record);
}
}
}
InboundAction::DeliverJob(result) => {
self.jobs.deliver(
header.jobid_target,
result.eresult,
result.error_message.clone(),
&result.body,
);
}
InboundAction::LogonOk => {
// No persona or friends traffic: this session exists only to download.
self.start_heartbeat_from_logon(body);
self.notify_state(ClientState::LoggedOn);
self.notify_client_message(emsg, header, body);
}
InboundAction::LoggedOff => {
self.heartbeat.lock().expect("heartbeat poisoned").stop();
self.notify_state(self.core.state());
self.notify_client_message(emsg, header, body);
}
InboundAction::Ignored | InboundAction::ParseFailed(_) => {}
InboundAction::PicsProductInfo => self.handle_pics_product_info(header, body),
InboundAction::LicenseList(_) | InboundAction::ClientMessage => {
self.notify_client_message(emsg, header, body);
}
}
action
}
fn on_channel_connected(self: &Arc<Self>) {
self.core.set_state(ClientState::Connected);
self.notify_state(ClientState::Connected);
// Always send ClientHello first; pre-existing queued wires (e.g. a
// logon enqueued before the channel finished negotiating) must come
// after the Hello or Steam rejects the conversation as malformed.
// If a Hello was already prequeued, do not duplicate it.
let queued = self.core.take_outbound_wires();
let head_is_hello = queued
.first()
.and_then(|wire| decode_proto_envelope(wire))
.is_some_and(|env| env.emsg == EMsg::CLIENT_HELLO);
let combined = if head_is_hello {
queued
} else {
let hello = self.core.build_client_hello().wire;
let mut combined = Vec::with_capacity(queued.len() + 1);
combined.push(hello);
combined.extend(queued);
combined
};
self.core.restore_outbound_wires_front(combined);
self.flush_outbound();
}
fn on_channel_disconnected(self: &Arc<Self>, _reason: ChannelDisconnectReason, detail: &str) {
self.heartbeat.lock().expect("heartbeat poisoned").stop();
self.jobs
.fail_all(&format!("channel disconnected: {detail}"));
self.pics_product_info
.lock()
.expect("pics product info poisoned")
.clear();
self.core.reset_session_identity();
self.core.set_state(ClientState::Disconnected);
self.notify_state(ClientState::Disconnected);
}
fn handle_pics_product_info(&self, header: &CMsgProtoBufHeader, body: &[u8]) {
if header.jobid_target == INVALID_JOB_ID {
return;
}
let Some(response) = CMsgClientPICSProductInfoResponse::deserialize(body) else {
self.jobs.deliver(
header.jobid_target,
-1,
"PICS product-info parse failed".to_string(),
&[],
);
return;
};
let mut pending = self
.pics_product_info
.lock()
.expect("pics product info poisoned");
if response.response_pending {
let acc = pending.entry(header.jobid_target).or_default();
merge_pics_product_info(acc, response);
return;
}
let mut merged = pending.remove(&header.jobid_target).unwrap_or_default();
merge_pics_product_info(&mut merged, response);
let body = merged.serialize();
self.jobs
.deliver(header.jobid_target, 1, String::new(), &body);
}
fn start_heartbeat_from_logon(self: &Arc<Self>, body: &[u8]) {
let Some(resp) = CMsgClientLogonResponse::deserialize(body) else {
return;
};
if resp.heartbeat_seconds <= 0 {
return;
}
let weak = Arc::downgrade(self);
let interval = Duration::from_secs(resp.heartbeat_seconds as u64);
self.heartbeat
.lock()
.expect("heartbeat poisoned")
.start(interval, move || {
if let Some(runtime) = weak.upgrade() {
runtime
.core
.enqueue_wire(runtime.core.build_heartbeat().wire);
runtime.flush_outbound();
}
});
}
fn handle_non_proto_message(&self, bytes: &[u8]) -> InboundAction {
if bytes.len() >= 4 {
let raw = read_u32_le(bytes);
if !has_proto_flag(raw) {
let legacy = strip_proto_flag(raw);
if legacy == EMsg::CHANNEL_ENCRYPT_REQUEST
|| legacy == EMsg::CHANNEL_ENCRYPT_RESPONSE
|| legacy == EMsg::CHANNEL_ENCRYPT_RESULT
{
return InboundAction::Ignored;
}
}
}
InboundAction::ParseFailed("ProtoEnvelope")
}
fn notify_state(&self, state: ClientState) {
if let Some(callback) = self
.on_state
.lock()
.expect("runtime callback poisoned")
.as_ref()
{
let _ = panic::catch_unwind(AssertUnwindSafe(|| callback(state)));
}
}
fn notify_client_message(&self, emsg: EMsg, header: &CMsgProtoBufHeader, body: &[u8]) {
if let Some(callback) = self
.on_client_message
.lock()
.expect("runtime callback poisoned")
.as_ref()
{
let _ = panic::catch_unwind(AssertUnwindSafe(|| callback(emsg, header, body)));
}
}
}
fn merge_pics_product_info(
acc: &mut CMsgClientPICSProductInfoResponse,
mut next: CMsgClientPICSProductInfoResponse,
) {
acc.apps.append(&mut next.apps);
acc.packages.append(&mut next.packages);
acc.unknown_appids.append(&mut next.unknown_appids);
acc.unknown_packageids.append(&mut next.unknown_packageids);
if next.http_min_size > 0 {
acc.http_min_size = next.http_min_size;
}
if !next.http_host.is_empty() {
acc.http_host = next.http_host;
}
acc.meta_data_only = next.meta_data_only;
acc.response_pending = false;
}
#[cfg(test)]
mod tests {
use super::*;
use crate::steam::proto_envelope::encode_proto_envelope;
use crate::steam::proto_wire::Writer as ProtoWriter;
use crate::steam::transport::{ConnectedCallback, DisconnectedCallback, MessageCallback};
use crate::steam::transport::{TransportDisconnectReason, TransportState};
use crate::steam::wire_format::Writer as WireWriter;
use std::sync::mpsc;
#[test]
fn connected_channel_sends_client_hello_and_reports_state() {
let shared = Arc::new(MockTransportState::default());
let runtime = runtime_with_shared_transport(Arc::clone(&shared));
let states = Arc::new(Mutex::new(Vec::new()));
let states_cb = Arc::clone(&states);
runtime.set_on_state(move |state| states_cb.lock().unwrap().push(state));
assert!(runtime.connect("wss://cm.example.com:443/cmsocket/"));
shared.fire_connected();
assert_eq!(
states.lock().unwrap().as_slice(),
&[ClientState::Connecting, ClientState::Connected]
);
let sent = shared.take_sent();
assert_eq!(
decode_proto_envelope(&sent[0]).unwrap().emsg,
EMsg::CLIENT_HELLO
);
}
#[test]
fn connected_channel_flushes_prequeued_hello_without_duplicate() {
let shared = Arc::new(MockTransportState::default());
let runtime = runtime_with_shared_transport(Arc::clone(&shared));
runtime
.core
.enqueue_wire(runtime.core.build_client_hello().wire);
assert!(runtime.connect("wss://cm.example.com:443/cmsocket/"));
shared.fire_connected();
let sent = shared.take_sent();
assert_eq!(sent.len(), 1);
assert_eq!(
decode_proto_envelope(&sent[0]).unwrap().emsg,
EMsg::CLIENT_HELLO
);
}
#[test]
fn flush_outbound_preserves_core_queue_order() {
let shared = Arc::new(MockTransportState::default());
let runtime = runtime_with_shared_transport(Arc::clone(&shared));
assert!(runtime.connect("wss://cm.example.com:443/cmsocket/"));
shared.fire_connected();
shared.take_sent();
runtime.core.enqueue_wire(vec![1, 2, 3]);
runtime.core.enqueue_wire(vec![4, 5, 6]);
assert_eq!(runtime.flush_outbound(), 2);
assert_eq!(shared.take_sent(), vec![vec![1, 2, 3], vec![4, 5, 6]]);
}
#[test]
fn inbound_job_response_is_delivered() {
let shared = Arc::new(MockTransportState::default());
let runtime = runtime_with_shared_transport(shared);
let job_id = runtime.next_job_id();
let (tx, rx) = mpsc::channel();
runtime.track_job(job_id, move |result| tx.send(result).unwrap(), None);
let header = CMsgProtoBufHeader {
jobid_target: job_id,
eresult: 1,
..Default::default()
};
let wire = encode_proto_envelope(EMsg::SERVICE_METHOD_RESPONSE, &header, b"reply");
assert_eq!(
runtime.handle_channel_message(&wire),
InboundAction::DeliverJob(JobResult {
eresult: 1,
error_message: String::new(),
body: b"reply".to_vec(),
synthetic_failure: false,
})
);
assert_eq!(rx.recv().unwrap().body, b"reply");
}
#[test]
fn multi_records_are_redispatched() {
let shared = Arc::new(MockTransportState::default());
let runtime = runtime_with_shared_transport(shared);
let (tx, rx) = mpsc::channel();
runtime.set_on_client_message(move |emsg, _, body| {
tx.send((emsg, body.to_vec())).unwrap();
});
let inner = encode_proto_envelope(
EMsg::CLIENT_SESSION_TOKEN,
&CMsgProtoBufHeader::default(),
&account_info_body("Ada"),
);
let mut records = Vec::new();
WireWriter::new(&mut records).u32(inner.len() as u32);
records.extend_from_slice(&inner);
let mut multi_body = Vec::new();
ProtoWriter::new(&mut multi_body).bytes_field(2, &records);
let multi = encode_proto_envelope(EMsg::MULTI, &CMsgProtoBufHeader::default(), &multi_body);
assert_eq!(runtime.handle_channel_message(&multi), InboundAction::Multi);
assert_eq!(
rx.recv().unwrap(),
(EMsg::CLIENT_SESSION_TOKEN, account_info_body("Ada"))
);
}
#[test]
fn legacy_channel_encrypt_frames_are_ignored() {
let shared = Arc::new(MockTransportState::default());
let runtime = runtime_with_shared_transport(shared);
let mut legacy = Vec::new();
WireWriter::new(&mut legacy).u32(EMsg::CHANNEL_ENCRYPT_REQUEST.0);
assert_eq!(
runtime.handle_channel_message(&legacy),
InboundAction::Ignored
);
}
fn runtime_with_shared_transport(shared: Arc<MockTransportState>) -> Arc<CMClientRuntime> {
CMClientRuntime::new(
Arc::new(CMClientCore::default()),
Box::new(MockTransport { shared }),
)
}
fn account_info_body(name: &str) -> Vec<u8> {
let mut body = Vec::new();
ProtoWriter::new(&mut body).string_field(1, name);
body
}
struct MockTransportState {
state: Mutex<TransportState>,
connected: Mutex<Option<ConnectedCallback>>,
disconnected: Mutex<Option<DisconnectedCallback>>,
message: Mutex<Option<MessageCallback>>,
sent: Mutex<Vec<Vec<u8>>>,
}
impl Default for MockTransportState {
fn default() -> Self {
Self {
state: Mutex::new(TransportState::Disconnected),
connected: Mutex::new(None),
disconnected: Mutex::new(None),
message: Mutex::new(None),
sent: Mutex::new(Vec::new()),
}
}
}
impl MockTransportState {
fn fire_connected(&self) {
*self.state.lock().unwrap() = TransportState::Connected;
if let Some(callback) = self.connected.lock().unwrap().as_ref() {
callback();
}
}
#[allow(dead_code)]
fn fire_disconnected(&self, reason: TransportDisconnectReason, detail: &str) {
*self.state.lock().unwrap() = TransportState::Disconnected;
if let Some(callback) = self.disconnected.lock().unwrap().as_ref() {
callback(reason, detail);
}
}
#[allow(dead_code)]
fn fire_message(&self, bytes: &[u8]) {
if let Some(callback) = self.message.lock().unwrap().as_ref() {
callback(bytes);
}
}
fn take_sent(&self) -> Vec<Vec<u8>> {
std::mem::take(&mut *self.sent.lock().unwrap())
}
}
struct MockTransport {
shared: Arc<MockTransportState>,
}
impl Transport for MockTransport {
fn connect(&mut self, _url: &str) -> bool {
*self.shared.state.lock().unwrap() = TransportState::Connecting;
true
}
fn send(&mut self, data: &[u8]) -> bool {
if self.state() != TransportState::Connected {
return false;
}
self.shared.sent.lock().unwrap().push(data.to_vec());
true
}
fn disconnect(&mut self) {
*self.shared.state.lock().unwrap() = TransportState::Disconnected;
}
fn state(&self) -> TransportState {
*self.shared.state.lock().unwrap()
}
fn set_on_message(&mut self, cb: MessageCallback) {
*self.shared.message.lock().unwrap() = Some(cb);
}
fn set_on_connected(&mut self, cb: ConnectedCallback) {
*self.shared.connected.lock().unwrap() = Some(cb);
}
fn set_on_disconnected(&mut self, cb: DisconnectedCallback) {
*self.shared.disconnected.lock().unwrap() = Some(cb);
}
}
}
@@ -0,0 +1,81 @@
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
#[repr(u8)]
pub enum CmTransport {
#[default]
Unknown = 0,
WebSocket = 1,
Tcp = 2,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct CmServer {
pub endpoint: String,
pub host: String,
pub port: u16,
pub transport: CmTransport,
pub realm: String,
pub datacenter: String,
pub load: i32,
pub weighted_load: f32,
}
impl CmServer {
pub fn websocket_url(&self) -> String {
if self.transport != CmTransport::WebSocket || self.host.is_empty() || self.port == 0 {
return String::new();
}
format!("wss://{}:{}/cmsocket/", self.host, self.port)
}
}
pub fn parse_endpoint(endpoint: &str) -> Option<(String, u16)> {
let colon = endpoint.rfind(':')?;
if colon == 0 || colon + 1 == endpoint.len() {
return None;
}
let mut host = &endpoint[..colon];
if host.len() >= 2 && host.starts_with('[') && host.ends_with(']') {
host = &host[1..host.len() - 1];
}
let port_text = &endpoint[colon + 1..];
if !port_text.bytes().all(|b| b.is_ascii_digit()) {
return None;
}
let port = port_text.parse::<u32>().ok()?;
if port == 0 || port > u16::MAX as u32 {
return None;
}
Some((host.to_string(), port as u16))
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn parses_host_port_and_ipv6_brackets() {
assert_eq!(
parse_endpoint("cm.example.com:443"),
Some(("cm.example.com".to_string(), 443))
);
assert_eq!(
parse_endpoint("[2001:db8::1]:27017"),
Some(("2001:db8::1".to_string(), 27017))
);
assert_eq!(parse_endpoint("missing-port"), None);
assert_eq!(parse_endpoint("host:0"), None);
assert_eq!(parse_endpoint("host:+443"), None);
assert_eq!(parse_endpoint("host:70000"), None);
}
#[test]
fn websocket_url_requires_websocket_transport() {
let server = CmServer {
host: "cm.example.com".to_string(),
port: 443,
transport: CmTransport::WebSocket,
..Default::default()
};
assert_eq!(server.websocket_url(), "wss://cm.example.com:443/cmsocket/");
}
}
@@ -0,0 +1,205 @@
use crate::steam::cm_server::{CmServer, CmTransport};
use std::sync::Mutex;
use std::time::{Duration, Instant};
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum ServerQuality {
Good,
Bad,
}
pub const DEFAULT_BAD_MEMORY: Duration = Duration::from_secs(5 * 60);
pub struct CmServerList {
inner: Mutex<Inner>,
bad_memory: Duration,
}
#[derive(Default)]
struct Inner {
entries: Vec<Entry>,
next_index: usize,
}
struct Entry {
server: CmServer,
quality: ServerQuality,
marked_bad_at: Option<Instant>,
}
impl Default for CmServerList {
fn default() -> Self {
Self::new(DEFAULT_BAD_MEMORY)
}
}
impl CmServerList {
pub fn new(bad_memory: Duration) -> Self {
Self {
inner: Mutex::new(Inner::default()),
bad_memory,
}
}
pub fn replace_all(&self, servers: &[CmServer]) {
let mut inner = self.inner.lock().unwrap();
inner.entries = servers
.iter()
.cloned()
.map(|server| Entry {
server,
quality: ServerQuality::Good,
marked_bad_at: None,
})
.collect();
inner.next_index = 0;
}
pub fn add(&self, server: CmServer) {
self.inner.lock().unwrap().entries.push(Entry {
server,
quality: ServerQuality::Good,
marked_bad_at: None,
});
}
pub fn size(&self) -> usize {
self.inner.lock().unwrap().entries.len()
}
pub fn next_good(&self) -> Option<CmServer> {
let mut inner = self.inner.lock().unwrap();
if inner.entries.is_empty() {
return None;
}
promote_expired(&mut inner.entries, self.bad_memory);
let n = inner.entries.len();
for i in 0..n {
let idx = (inner.next_index + i) % n;
if inner.entries[idx].quality == ServerQuality::Good {
inner.next_index = (idx + 1) % n;
return Some(inner.entries[idx].server.clone());
}
}
None
}
pub fn mark_bad(&self, endpoint: &str) {
let mut inner = self.inner.lock().unwrap();
if let Some(entry) = inner
.entries
.iter_mut()
.find(|e| e.server.endpoint == endpoint)
{
entry.quality = ServerQuality::Bad;
entry.marked_bad_at = Some(Instant::now());
}
}
pub fn mark_good(&self, endpoint: &str) {
let mut inner = self.inner.lock().unwrap();
if let Some(entry) = inner
.entries
.iter_mut()
.find(|e| e.server.endpoint == endpoint)
{
entry.quality = ServerQuality::Good;
entry.marked_bad_at = None;
}
}
pub fn reset_quality(&self) {
let mut inner = self.inner.lock().unwrap();
for entry in &mut inner.entries {
entry.quality = ServerQuality::Good;
entry.marked_bad_at = None;
}
}
}
fn promote_expired(entries: &mut [Entry], bad_memory: Duration) {
let now = Instant::now();
for entry in entries {
if entry.quality == ServerQuality::Bad
&& entry
.marked_bad_at
.is_some_and(|t| now.duration_since(t) >= bad_memory)
{
entry.quality = ServerQuality::Good;
entry.marked_bad_at = None;
}
}
}
pub fn hardcoded_fallback_servers() -> Vec<CmServer> {
const FALLBACK: &[(&str, &str)] = &[
("ext1-sea1.steamserver.net", "sea1"),
("ext2-sea1.steamserver.net", "sea1"),
("ext1-iad1.steamserver.net", "iad1"),
("ext2-iad1.steamserver.net", "iad1"),
("ext1-fra1.steamserver.net", "fra1"),
("ext2-fra1.steamserver.net", "fra1"),
("ext1-lax1.steamserver.net", "lax1"),
("ext1-sgp1.steamserver.net", "sgp1"),
];
FALLBACK
.iter()
.map(|(host, dc)| CmServer {
endpoint: format!("{host}:443"),
host: (*host).to_string(),
port: 443,
transport: CmTransport::WebSocket,
realm: "steamglobal".to_string(),
datacenter: (*dc).to_string(),
load: 0,
weighted_load: 0.0,
})
.collect()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn next_good_round_robins_and_skips_bad() {
let list = CmServerList::default();
let a = server("a:443");
let b = server("b:443");
list.replace_all(&[a.clone(), b.clone()]);
assert_eq!(list.next_good().unwrap().endpoint, a.endpoint);
list.mark_bad(&b.endpoint);
assert_eq!(list.next_good().unwrap().endpoint, a.endpoint);
list.mark_good(&b.endpoint);
assert_eq!(list.next_good().unwrap().endpoint, b.endpoint);
}
#[test]
fn bad_servers_promote_after_memory_interval() {
let list = CmServerList::new(Duration::ZERO);
let a = server("a:443");
list.replace_all(std::slice::from_ref(&a));
list.mark_bad(&a.endpoint);
assert_eq!(list.next_good().unwrap().endpoint, a.endpoint);
}
#[test]
fn fallback_servers_are_websocket_urls() {
let servers = hardcoded_fallback_servers();
assert!(!servers.is_empty());
assert!(servers
.iter()
.all(|s| s.websocket_url().starts_with("wss://")));
}
fn server(endpoint: &str) -> CmServer {
let (host, port) = crate::steam::cm_server::parse_endpoint(endpoint).unwrap();
CmServer {
endpoint: endpoint.to_string(),
host,
port,
transport: CmTransport::WebSocket,
..Default::default()
}
}
}
Loaded 100 of 156 files, more files were not shown because too many files have changed in this diff. Show more