feat: install Battle.net games from Stores with downloads, updates and uninstall

Battle.net games now install like Epic, Xbox and itch games: Install,
pick a location, and the download runs in the Downloads tab while the
Stores page stays open. droiddeck-battlenet starts Blizzard's own Agent
on its own under a headless gamescope and drives its local API, so no
window opens and nothing waits on the Battle.net client.

- Progress, speed and time left come from the Agent, with pause, resume
  (the Agent keeps what it downloaded) and cancel, which uninstalls the
  partial game and removes its folder.
- A job only finishes once the Agent has really run it and the game is
  playable; the first status after a request can still describe the
  previous operation.
- Installed games check Blizzard's version service and show Update when
  the build on disk is behind; the update repairs missing files too.
- Battle.net games can be uninstalled from their page through the Agent.
- Games land in the chosen location: internal storage, other storage or
  a Games folder.
- The hero keeps its action row clear of the playtime column.
This commit is contained in:
maxjivi05 authored and MaxsTechReview committed 2026-10-26 09:01:02 -04:00
1 parent 9fc48515c1
commit b887e8653d
43 files changed
+1176 -49

No files matched your search

@@ -17,45 +17,45 @@ object BattleNet {
const val PROGRAM = "/usr/local/bin/droiddeck-battlenet"
class Title(val uid: String, val name: String, val code: String, val steam: Int? = null, val shop: String? = null)
class Title(val uid: String, val name: String, val code: String, val steam: Int? = null, val shop: String? = null, val product: String? = null)
internal val TITLES = listOf(
Title("wow", "World of Warcraft", "WoW", shop = "world-of-warcraft-midnight"),
Title("wow_classic", "World of Warcraft Classic", "WoWC", shop = "world-of-warcraft-burning-crusade-classic-anniversary-edition-upgrades"),
Title("wow_classic_era", "World of Warcraft Classic", "WoWC"),
Title("wow_classic_anniversary", "World of Warcraft Classic", "WoWC"),
Title("diablo3", "Diablo III", "D3", shop = "diablo-iii"),
Title("wow", "World of Warcraft", "WoW", shop = "world-of-warcraft-midnight", product = "wow"),
Title("wow_classic", "World of Warcraft Classic", "WoWC", shop = "world-of-warcraft-burning-crusade-classic-anniversary-edition-upgrades", product = "wow_classic"),
Title("wow_classic_era", "World of Warcraft Classic", "WoWC", product = "wow_classic_era"),
Title("wow_classic_anniversary", "World of Warcraft Classic", "WoWC", product = "wow_anniversary"),
Title("diablo3", "Diablo III", "D3", shop = "diablo-iii", product = "d3"),
Title("d3cn", "Diablo III", "D3CN", shop = "diablo-iii"),
Title("s2", "StarCraft II", "S2", shop = "starcraft-ii"),
Title("s1", "StarCraft", "S1", shop = "starcraft-remastered"),
Title("hs_beta", "Hearthstone", "WTCG", shop = "hearthstone"),
Title("heroes", "Heroes of the Storm", "Hero", shop = "heroes-of-the-storm"),
Title("prometheus", "Overwatch 2", "Pro", 2357570, shop = "overwatch"),
Title("w3", "Warcraft III: Reforged", "W3", shop = "warcraft-3-reforged"),
Title("viper", "Call of Duty: Black Ops 4", "VIPR", shop = "call-of-duty-black-ops-4"),
Title("odin", "Call of Duty: Modern Warfare", "ODIN", 2000950, shop = "call-of-duty-modern-warfare"),
Title("lazarus", "Call of Duty: Modern Warfare 2 Campaign Remastered", "LAZR", shop = "call-of-duty-modern-warfare-2-campaign-remastered"),
Title("zeus", "Call of Duty: Black Ops Cold War", "ZEUS", shop = "call-of-duty-black-ops-cold-war"),
Title("fore", "Call of Duty: Vanguard", "FORE", shop = "call-of-duty-vanguard"),
Title("auks", "Call of Duty: Modern Warfare II", "AUKS", shop = "call-of-duty-modern-warfare-ii"),
Title("pinta", "Call of Duty: Modern Warfare III", "PNTA", 2519060, shop = "call-of-duty-modern-warfare-iii"),
Title("wlby", "Crash Bandicoot 4: It's About Time", "WLBY", 1378990, shop = "crash-bandicoot-4"),
Title("osi", "Diablo II: Resurrected", "OSI"),
Title("rtro", "Blizzard Arcade Collection", "RTRO", shop = "blizzard-arcade-collection"),
Title("anbs", "Diablo Immortal", "ANBS", shop = "diablo-immortal"),
Title("fenris", "Diablo IV", "Fen", 2344520, shop = "diablo-iv"),
Title("fen", "Diablo IV", "Fen", 2344520, shop = "diablo-iv"),
Title("d1", "Diablo", "D1", shop = "diablo"),
Title("w1", "Warcraft: Orcs & Humans", "W1", shop = "warcraft-orcs-and-humans"),
Title("w2", "Warcraft II: Battle.net Edition", "W2", shop = "warcraft-2-battle-net-edition"),
Title("w1r", "Warcraft: Remastered", "W1R", shop = "warcraft-1-remastered"),
Title("w2r", "Warcraft II: Remastered", "W2R", shop = "warcraft-2-remastered"),
Title("gryphon", "Warcraft Rumble", "GRY", shop = "warcraft-rumble"),
Title("aris", "Doom: The Dark Ages", "ARIS", 3017860, shop = "doom-the-dark-ages"),
Title("scorpio", "Sea of Thieves", "SCOR", 1172620, shop = "sea-of-thieves"),
Title("arkansas", "The Outer Worlds 2", "ARK", 1449110, shop = "the-outer-worlds-2"),
Title("libra", "Tony Hawk's Pro Skater 3 + 4", "LBRA", 2545710),
Title("aqua", "Avowed", "AQUA", 2457220, shop = "avowed"),
Title("s2", "StarCraft II", "S2", shop = "starcraft-ii", product = "s2"),
Title("s1", "StarCraft", "S1", shop = "starcraft-remastered", product = "s1"),
Title("hs_beta", "Hearthstone", "WTCG", shop = "hearthstone", product = "hsb"),
Title("heroes", "Heroes of the Storm", "Hero", shop = "heroes-of-the-storm", product = "hero"),
Title("prometheus", "Overwatch 2", "Pro", 2357570, shop = "overwatch", product = "pro"),
Title("w3", "Warcraft III: Reforged", "W3", shop = "warcraft-3-reforged", product = "w3"),
Title("viper", "Call of Duty: Black Ops 4", "VIPR", shop = "call-of-duty-black-ops-4", product = "viper"),
Title("odin", "Call of Duty: Modern Warfare", "ODIN", 2000950, shop = "call-of-duty-modern-warfare", product = "odin"),
Title("lazarus", "Call of Duty: Modern Warfare 2 Campaign Remastered", "LAZR", shop = "call-of-duty-modern-warfare-2-campaign-remastered", product = "lazr"),
Title("zeus", "Call of Duty: Black Ops Cold War", "ZEUS", shop = "call-of-duty-black-ops-cold-war", product = "zeus"),
Title("fore", "Call of Duty: Vanguard", "FORE", shop = "call-of-duty-vanguard", product = "fore"),
Title("auks", "Call of Duty: Modern Warfare II", "AUKS", shop = "call-of-duty-modern-warfare-ii", product = "auks"),
Title("pinta", "Call of Duty: Modern Warfare III", "PNTA", 2519060, shop = "call-of-duty-modern-warfare-iii", product = "pinta"),
Title("wlby", "Crash Bandicoot 4: It's About Time", "WLBY", 1378990, shop = "crash-bandicoot-4", product = "wlby"),
Title("osi", "Diablo II: Resurrected", "OSI", product = "osi"),
Title("rtro", "Blizzard Arcade Collection", "RTRO", shop = "blizzard-arcade-collection", product = "rtro"),
Title("anbs", "Diablo Immortal", "ANBS", shop = "diablo-immortal", product = "anbs"),
Title("fenris", "Diablo IV", "Fen", 2344520, shop = "diablo-iv", product = "fenris"),
Title("fen", "Diablo IV", "Fen", 2344520, shop = "diablo-iv", product = "fenris"),
Title("d1", "Diablo", "D1", shop = "diablo", product = "drtl"),
Title("w1", "Warcraft: Orcs & Humans", "W1", shop = "warcraft-orcs-and-humans", product = "war1"),
Title("w2", "Warcraft II: Battle.net Edition", "W2", shop = "warcraft-2-battle-net-edition", product = "w2bn"),
Title("w1r", "Warcraft: Remastered", "W1R", shop = "warcraft-1-remastered", product = "w1r"),
Title("w2r", "Warcraft II: Remastered", "W2R", shop = "warcraft-2-remastered", product = "w2r"),
Title("gryphon", "Warcraft Rumble", "GRY", shop = "warcraft-rumble", product = "gryphon"),
Title("aris", "Doom: The Dark Ages", "ARIS", 3017860, shop = "doom-the-dark-ages", product = "aris"),
Title("scorpio", "Sea of Thieves", "SCOR", 1172620, shop = "sea-of-thieves", product = "scor"),
Title("arkansas", "The Outer Worlds 2", "ARK", 1449110, shop = "the-outer-worlds-2", product = "ark"),
Title("libra", "Tony Hawk's Pro Skater 3 + 4", "LBRA", 2545710, product = "lbra"),
Title("aqua", "Avowed", "AQUA", 2457220, shop = "avowed", product = "aqua"),
)
val STORE: List<Title> get() = TITLES.distinctBy { it.code }.filter { it.uid != "d3cn" && it.code != "WoWC" }
@@ -104,7 +104,7 @@ object BattleNet {
private val NOT_GAMES = setOf("agent", "bna", "battle.net")
class Game(val uid: String, val name: String, val code: String, val folder: File) {
class Game(val uid: String, val name: String, val code: String, val folder: File, val installUid: String = uid) {
val title: Title get() = title(uid) ?: Title(uid, name, code)
}
@@ -172,7 +172,7 @@ object BattleNet {
}
if (title.code in found) continue
val folder = hostFolder(context, path)?.takeIf { it.isDirectory } ?: continue
found[title.code] = Game(title.uid, title.name, title.code, folder)
found[title.code] = Game(title.uid, title.name, title.code, folder, uid)
}
return found.values.toList()
}
@@ -236,7 +236,7 @@ object StoresState {
fun install(context: Context, item: CatalogItem, root: java.io.File? = null, language: String? = null) {
val app = context.applicationContext
val targetRoot = root ?: StoreInstallRoot.defaultTarget(app)?.root ?: StoreInstallRoot.installRoot(app)
if (item.store == Store.BATTLENET) {
if (item.store == Store.BATTLENET && !com.droiddeck.launcher.stores.battlenet.BattleNetInstall.headless(item)) {
backends[item.store]?.install(app, item, targetRoot)
return
}
@@ -273,7 +273,7 @@ object StoresState {
uninstalling[key] = 0f
background("stores-uninstall", onFailure = { main.post { uninstalling.remove(key); onDone() } }) {
runCatching { backends[game.sidecar.store]?.uninstall(app, game) }
if (game.sidecar.store == Store.BATTLENET) {
if (game.sidecar.store == Store.BATTLENET && com.droiddeck.launcher.runtime.BattleNet.games(app).any { it.folder.absolutePath == game.folder.absolutePath }) {
main.post { uninstalling.remove(key); onDone() }
return@background
}
@@ -0,0 +1,283 @@
package com.droiddeck.launcher.stores.battlenet
import android.content.Context
import android.util.Log
import androidx.compose.runtime.mutableStateMapOf
import com.droiddeck.launcher.R
import com.droiddeck.launcher.frontend.AddedGames
import com.droiddeck.launcher.runtime.BattleNet
import com.droiddeck.launcher.runtime.GuestCommand
import com.droiddeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.session.GameStorage
import com.droiddeck.launcher.session.SecondaryLibrary
import com.droiddeck.launcher.stores.CatalogItem
import com.droiddeck.launcher.stores.InstalledStoreGame
import com.droiddeck.launcher.stores.Store
import com.droiddeck.launcher.stores.StoreInstallRoot
import com.droiddeck.launcher.stores.StoreLanguage
import com.droiddeck.launcher.stores.StoresState
import com.droiddeck.launcher.stores.download.DownloadEntry
import com.droiddeck.launcher.stores.download.DownloadQueue
import com.droiddeck.launcher.stores.download.DownloadStage
import org.json.JSONObject
import java.io.File
import java.net.HttpURLConnection
import java.net.URL
import java.util.Locale
import java.util.concurrent.Executors
import java.util.concurrent.atomic.AtomicBoolean
object BattleNetInstall {
private const val TAG = "BattleNetInstall"
internal const val PROGRESS = "BNET_PROGRESS "
internal const val STATE = "BNET_STATE "
internal const val DONE = "BNET_DONE "
internal const val ERROR = "BNET_ERROR "
private const val LIBRARY_GUEST = "/mnt/droiddeck-sd"
private const val VERSIONS = "https://%s.version.battle.net/v2/products/%s/versions"
private const val BUILD_INFO = ".build.info"
private const val CHECK_AGAIN_MS = 30 * 60_000L
internal val LOCALES = listOf(
"enUS", "enGB", "esMX", "esES", "ptBR", "ptPT", "frFR", "deDE", "itIT", "ruRU", "jaJP", "koKR", "plPL", "trTR",
"zhTW", "zhCN", "thTH", "arSA",
)
private val checks = Executors.newSingleThreadExecutor { r -> Thread(r, "battlenet-updates") }
private val checkedAt = HashMap<String, Long>()
val updates = mutableStateMapOf<String, Boolean>()
fun product(id: String): String? = BattleNet.title(id)?.product
fun headless(item: CatalogItem): Boolean = item.store == Store.BATTLENET && product(item.id) != null
internal fun locale(locale: Locale): String {
val language = locale.language.lowercase(Locale.ROOT)
if (language == "zh") {
val traditional = locale.script.equals("Hant", true) || locale.country.uppercase(Locale.ROOT) in setOf("TW", "HK", "MO")
return if (traditional) "zhTW" else "zhCN"
}
val exact = language + locale.country.uppercase(Locale.ROOT)
return LOCALES.firstOrNull { it == exact } ?: LOCALES.firstOrNull { it.startsWith(language) } ?: "enUS"
}
internal fun country(locale: Locale): Pair<String, String> {
val two = locale.country.uppercase(Locale.ROOT)
val three = runCatching { locale.isO3Country.uppercase(Locale.ROOT) }.getOrDefault("")
return if (two.matches(Regex("[A-Z]{2}")) && three.matches(Regex("[A-Z]{3}"))) three to two else "USA" to "US"
}
internal fun binds(context: Context, guest: String): List<String> {
val out = ArrayList<String>()
if (guest.startsWith(StoreInstallRoot.GUEST_EXTERNAL + "/")) out += StoreInstallRoot.externalBindSpecs(context)
if (guest == LIBRARY_GUEST || guest.startsWith("$LIBRARY_GUEST/")) {
GameStorage.effective(context)?.let { library ->
File(LinuxRuntime.rootDir(context), LIBRARY_GUEST.removePrefix("/")).mkdirs()
out += SecondaryLibrary.contentPath(File(library.path)).path + ":" + LIBRARY_GUEST
}
}
return out
}
internal fun run(context: Context, args: List<String>, guest: String?, cancelled: AtomicBoolean?, onLine: (String) -> Unit): Int =
GuestCommand.run(
context, listOf(BattleNet.PROGRAM) + args, logName = "battlenet-agent",
extraBinds = guest?.let { binds(context, it) }, fastPath = true, cancelled = cancelled, onLine = onLine,
)
fun enqueue(context: Context, item: CatalogItem, folder: File, update: Boolean = false) {
val app = context.applicationContext
val entry = DownloadEntry(
Store.BATTLENET, item.id, item.title, cover = item.tallImageUrl ?: item.imageUrl,
location = StoreInstallRoot.labelFor(app, folder),
)
DownloadQueue.enqueue(app, entry) { BattleNetInstaller(app, item, folder, update) }
}
fun update(context: Context, game: InstalledStoreGame) {
val app = context.applicationContext
Thread({
val item = CatalogItem(
Store.BATTLENET, game.sidecar.id, game.sidecar.title, game.sidecar.hero, tallImageUrl = game.sidecar.cover, owned = true,
extra = mapOf(INSTALL_UID to installUid(app, game)),
)
game.folder.parentFile?.parentFile?.let { com.droiddeck.launcher.stores.download.SavedQueue.remember(app, item, it) }
enqueue(app, item, game.folder, update = true)
}, "battlenet-update").start()
}
internal const val INSTALL_UID = "installUid"
internal fun installUid(context: Context, game: InstalledStoreGame): String =
runCatching { BattleNet.games(context).firstOrNull { it.uid == game.sidecar.id }?.installUid }.getOrNull() ?: game.sidecar.id
fun uninstall(context: Context, game: InstalledStoreGame): Boolean {
if (product(game.sidecar.id) == null || !BattleNet.installed(context)) return false
val uid = installUid(context, game)
var done = false
val code = runCatching {
run(context, listOf("agent-uninstall", uid), AddedGames.guestPath(context, game.folder), null) { line ->
if (line.startsWith(DONE)) done = true
}
}.onFailure { Log.w(TAG, "uninstall $uid", it) }.getOrDefault(-1)
Log.i(TAG, "uninstall $uid: ${if (done) "done" else "exit $code"}")
if (done) StoresState.post { StoresState.notifyLibraryChanged(context.applicationContext) }
return done
}
internal fun buildKey(text: String): Pair<String, String>? {
val rows = text.lines().filter { it.isNotBlank() }
if (rows.size < 2) return null
val head = rows[0].split('|').map { it.substringBefore('!') }
val branch = head.indexOf("Branch")
val active = head.indexOf("Active")
val key = head.indexOf("Build Key")
if (branch < 0 || key < 0) return null
val row = rows.drop(1).map { it.split('|') }.firstOrNull { active < 0 || it.getOrNull(active) == "1" } ?: return null
val region = row.getOrNull(branch)?.takeIf { it.matches(Regex("[a-z]{2}")) } ?: return null
val build = row.getOrNull(key)?.takeIf { it.matches(Regex("[0-9a-f]{32}")) } ?: return null
return region to build
}
internal fun latestBuild(text: String, region: String): String? {
val rows = text.lines().filter { it.isNotBlank() && !it.startsWith("##") }
if (rows.isEmpty()) return null
val head = rows[0].split('|').map { it.substringBefore('!') }
val at = head.indexOf("Region")
val key = head.indexOf("BuildConfig")
if (at < 0 || key < 0) return null
return rows.drop(1).map { it.split('|') }.firstOrNull { it.getOrNull(at) == region }?.getOrNull(key)
?.takeIf { it.matches(Regex("[0-9a-f]{32}")) }
}
fun checkUpdate(context: Context, game: InstalledStoreGame, force: Boolean = false) = check(game.sidecar.id, game.folder, force)
internal fun check(id: String, folder: File, force: Boolean) {
val product = product(id) ?: return
val now = System.currentTimeMillis()
synchronized(checkedAt) {
if (!force && now - (checkedAt[id] ?: 0L) < CHECK_AGAIN_MS) return
checkedAt[id] = now
}
checks.execute {
val local = runCatching { buildKey(File(folder, BUILD_INFO).readText()) }.getOrNull() ?: return@execute
val latest = runCatching { latestBuild(fetch(VERSIONS.format(Locale.ROOT, local.first, product)), local.first) }
.onFailure { Log.w(TAG, "versions of $product: ${it.javaClass.simpleName}") }.getOrNull() ?: return@execute
val behind = latest != local.second
Log.i(TAG, "$id: ${if (behind) "update available" else "up to date"}")
StoresState.post { if (behind) updates[id] = true else updates.remove(id) }
}
}
private fun fetch(url: String): String {
val conn = (URL(url).openConnection() as HttpURLConnection).apply {
connectTimeout = 15_000
readTimeout = 15_000
setRequestProperty("User-Agent", "DroidDeck")
}
try {
if (conn.responseCode != 200) throw java.io.IOException("HTTP ${conn.responseCode}")
return conn.inputStream.bufferedReader().use { it.readText() }
} finally {
conn.disconnect()
}
}
internal fun failure(context: Context, reason: String?, code: Int): String {
val detail = when {
reason == null -> "exit $code"
reason == "client" -> return context.getString(R.string.bnet_dl_client_first)
reason.startsWith("agent ") -> context.getString(R.string.bnet_dl_agent_error, reason.removePrefix("agent "))
else -> reason.removePrefix("stopped ")
}
return context.getString(R.string.bnet_dl_failed, detail)
}
internal fun localeTag(context: Context): String = locale(StoreLanguage.localeFor(null, context))
internal enum class Step { PREPARING, DOWNLOADING, APPLYING }
internal fun step(state: Int, phase: Int, current: Long, total: Long): Step = when {
state == DONE_STATE || phase == APPLY_PHASE || total > 0L && current >= total -> Step.APPLYING
total > 0L -> Step.DOWNLOADING
else -> Step.PREPARING
}
private const val DONE_STATE = 1004
private const val APPLY_PHASE = 2000
}
internal class BattleNetInstaller(
private val app: Context,
private val item: CatalogItem,
private val folder: File,
private val update: Boolean,
) : DownloadQueue.DownloadJob {
private val cancelled = AtomicBoolean(false)
private var before = 0L
private var kept = -1L
override fun run(handle: DownloadQueue.JobHandle): String? {
before = DownloadQueue.entry(handle.key)?.bytesTotal ?: 0L
handle.stage(DownloadStage.MANIFEST, app.getString(R.string.bnet_dl_starting))
if (!BattleNet.installed(app)) throw IllegalStateException(app.getString(R.string.bnet_dl_client_first))
val title = BattleNet.title(item.id)
val product = title?.product ?: throw IllegalStateException(app.getString(R.string.bnet_dl_failed, item.id))
val uid = item.extra[BattleNetInstall.INSTALL_UID] ?: title.uid
if (!update) folder.mkdirs()
val guest = AddedGames.guestPath(app, folder) ?: throw IllegalStateException(app.getString(R.string.bnet_dl_failed, folder.path))
val (country, region) = BattleNetInstall.country(Locale.getDefault())
val args = if (update) listOf("agent-update", uid)
else listOf("agent-install", uid, product, guest, BattleNetInstall.localeTag(app), country, region)
var done: JSONObject? = null
var reason: String? = null
val code = BattleNetInstall.run(app, args, guest, cancelled) { line ->
when {
line.startsWith(BattleNetInstall.PROGRESS) ->
runCatching { JSONObject(line.removePrefix(BattleNetInstall.PROGRESS)) }.getOrNull()?.let { progress(handle, it) }
line == BattleNetInstall.STATE + "waiting" -> handle.stage(DownloadStage.MANIFEST, app.getString(R.string.bnet_dl_waiting))
line == BattleNetInstall.STATE + "queued" -> handle.stage(DownloadStage.MANIFEST, app.getString(R.string.bnet_dl_queued))
line == BattleNetInstall.STATE + "starting" -> handle.stage(DownloadStage.MANIFEST, app.getString(R.string.bnet_dl_starting))
line.startsWith(BattleNetInstall.DONE) -> done = runCatching { JSONObject(line.removePrefix(BattleNetInstall.DONE)) }.getOrNull()
line.startsWith(BattleNetInstall.ERROR) -> reason = line.removePrefix(BattleNetInstall.ERROR)
}
}
if (cancelled.get()) return null
if (done == null) throw IllegalStateException(BattleNetInstall.failure(app, reason, code))
handle.log("Battle.net: ${item.title} ${if (update) "updated" else "installed"} ${done?.optString("version").orEmpty()}".trimEnd())
StoresState.post {
BattleNetInstall.updates.remove(item.id)
StoresState.notifyLibraryChanged(app)
}
BattleNetInstall.check(item.id, folder, force = true)
return folder.absolutePath
}
private fun progress(handle: DownloadQueue.JobHandle, status: JSONObject) {
val current = status.optLong("download_current", 0L)
val total = status.optLong("download_total", 0L)
when (BattleNetInstall.step(status.optInt("state", 0), status.optInt("phase", 0), current, total)) {
BattleNetInstall.Step.PREPARING -> handle.stage(DownloadStage.MANIFEST, app.getString(R.string.stores_stage_checking))
BattleNetInstall.Step.DOWNLOADING -> {
if (kept < 0L) kept = (before - total).coerceAtLeast(0L)
handle.progress(kept + current, kept + total)
}
BattleNetInstall.Step.APPLYING -> handle.stage(DownloadStage.INSTALL)
}
}
override fun cancel(deleteFiles: Boolean) {
cancelled.set(true)
if (!deleteFiles || update) return
val uid = item.extra[BattleNetInstall.INSTALL_UID] ?: BattleNet.title(item.id)?.uid ?: return
Thread({
Thread.sleep(2_000)
val gone = runCatching {
BattleNetInstall.run(app, listOf("agent-uninstall", uid), AddedGames.guestPath(app, folder), null) {}
}.getOrDefault(-1)
if (folder.isDirectory) com.droiddeck.launcher.core.FileUtils.delete(folder)
Log.i("BattleNetInstall", "cancelled install of $uid cleaned up (exit $gone)")
}, "battlenet-cancel").start()
}
}
@@ -189,9 +189,15 @@ object BattleNetBackend : StoreBackend {
override fun search(context: Context, query: String): List<CatalogItem> =
BattleNet.STORE.filter { it.name.contains(query, ignoreCase = true) }.map { item(context, it) }
override fun install(context: Context, item: CatalogItem, root: File) = BattleNetClient.installGame(context, item.id, root)
override fun install(context: Context, item: CatalogItem, root: File) {
if (!BattleNetInstall.headless(item)) return BattleNetClient.installGame(context, item.id, root)
val app = context.applicationContext
BattleNetInstall.enqueue(app, item, StoreInstallRoot.folderFor(app, store, item.id, item.title, root))
}
override fun uninstall(context: Context, game: InstalledStoreGame) = BattleNetClient.open(emptyList())
override fun uninstall(context: Context, game: InstalledStoreGame) {
if (!BattleNetInstall.uninstall(context, game)) BattleNetClient.open(emptyList())
}
fun installed(context: Context): List<BattleNet.Game> = if (BattleNet.installed(context)) BattleNet.games(context) else emptyList()
@@ -56,6 +56,7 @@ import androidx.compose.ui.input.key.onPreviewKeyEvent
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.layout.boundsInRoot
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.layout.onSizeChanged
import androidx.compose.ui.layout.positionInRoot
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalConfiguration
@@ -86,6 +87,7 @@ 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.battlenet.BattleNetInstall
import com.droiddeck.launcher.stores.download.DownloadQueue
import com.droiddeck.launcher.stores.download.DownloadState
import com.droiddeck.launcher.stores.formatBytes
@@ -267,13 +269,15 @@ private fun GameHero(
)
}
Spacer(Modifier.matchParentSize().background(Brush.horizontalGradient(0f to colors.background.copy(alpha = 0.94f), 0.55f to colors.background.copy(alpha = 0.58f), 1f to Color.Transparent)))
var scoresWidth by remember { mutableStateOf(0) }
if (scores != null) {
Spacer(Modifier.matchParentSize().background(Brush.horizontalGradient(0.45f to Color.Transparent, 1f to colors.background.copy(alpha = 0.75f))))
HeroScores(scores, Modifier.align(Alignment.BottomEnd).padding(end = 16.dp, bottom = 18.dp))
HeroScores(scores, Modifier.align(Alignment.BottomEnd).padding(end = 16.dp, bottom = 18.dp).onSizeChanged { scoresWidth = it.width })
}
val scoresSpace = with(LocalDensity.current) { if (scores != null && scoresWidth > 0) scoresWidth.toDp() + 16.dp else 0.dp }
Column(
verticalArrangement = Arrangement.spacedBy(6.dp),
modifier = Modifier.align(Alignment.BottomStart).padding(horizontal = 22.dp, vertical = 18.dp),
modifier = Modifier.align(Alignment.BottomStart).padding(start = 22.dp, end = 22.dp + scoresSpace, top = 18.dp, bottom = 18.dp),
content = content,
)
Box(Modifier.align(Alignment.TopEnd).padding(12.dp), content = corner)
@@ -358,7 +362,19 @@ internal fun GameActions(
}
SecondaryButton(stringResource(R.string.stores_xbox_manage), enabled = download == null) { XboxContent.manage(ctx, installed) }
}
if (store == Store.BATTLENET) SecondaryButton(stringResource(R.string.bnet_open)) { a.onBattleNet() }
if (store == Store.BATTLENET) {
if (installed != null && id != null) {
LaunchedEffect(id) { BattleNetInstall.checkUpdate(ctx, installed) }
if (download != null) {
ActionChip(downloadLabel(download), ok = false)
if (download.state != DownloadState.PAUSED) SecondaryButton(stringResource(R.string.stores_dl_pause)) { DownloadQueue.pause(download.key) }
else SecondaryButton(stringResource(R.string.stores_dl_resume)) { DownloadQueue.resume(ctx, download.key) }
} else if (BattleNetInstall.updates[id] == true) {
SecondaryButton(stringResource(R.string.bnet_update)) { BattleNetInstall.update(ctx, installed) }
}
}
SecondaryButton(stringResource(R.string.bnet_open)) { a.onBattleNet() }
}
}
download != null -> {
ActionChip(downloadLabel(download), ok = false)
@@ -534,7 +550,7 @@ private fun IconAction(icon: androidx.compose.ui.graphics.vector.ImageVector, la
private fun RemoveButton(title: String, game: Library.SteamGame?, installed: InstalledStoreGame?, a: FrontEndActions) {
val ctx = LocalContext.current
val colors = MaterialTheme.colorScheme
if ((installed?.sidecar?.store?.id ?: game?.source) == Store.BATTLENET.id) return
if ((installed?.sidecar?.store?.id ?: game?.source) == Store.BATTLENET.id && installed?.sidecar?.id?.let(BattleNetInstall::product) == null) return
if (installed != null) {
val key = installed.key
val gone = StoresState.uninstalling[key]
@@ -1392,7 +1392,11 @@ internal fun downloadLabel(d: com.droiddeck.launcher.stores.download.DownloadEnt
@Composable
internal fun activeStageLabel(d: com.droiddeck.launcher.stores.download.DownloadEntry): String = when (d.stage) {
DownloadStage.MANIFEST -> if (d.stageItemsTotal > 0) stringResource(R.string.stores_stage_checking) else stringResource(R.string.stores_stage_manifest)
DownloadStage.MANIFEST -> when {
d.store == Store.BATTLENET && d.detail.isNotBlank() -> d.detail
d.stageItemsTotal > 0 -> stringResource(R.string.stores_stage_checking)
else -> stringResource(R.string.stores_stage_manifest)
}
DownloadStage.DOWNLOAD -> stringResource(R.string.stores_stage_downloading)
DownloadStage.VERIFY -> stringResource(R.string.stores_stage_verifying)
DownloadStage.INSTALL -> stringResource(R.string.stores_stage_installing)
+7
View File
@@ -2081,6 +2081,13 @@
<string name="stores_play">تشغيل</string>
<string name="stores_install">تثبيت</string>
<string name="bnet_open">فتح Battle.net</string>
<string name="bnet_dl_starting">جارٍ تشغيل أداة التنزيل من Blizzard…</string>
<string name="bnet_dl_waiting">في انتظار إغلاق Battle.net…</string>
<string name="bnet_dl_queued">في انتظار تنزيل Battle.net الآخر…</string>
<string name="bnet_dl_client_first">افتح Battle.net وسجّل الدخول مرة واحدة، ثم ثبّت ألعابه من هنا.</string>
<string name="bnet_dl_failed">توقفت أداة التنزيل من Blizzard: %1$s</string>
<string name="bnet_dl_agent_error">خطأ Blizzard %1$s</string>
<string name="bnet_update">تحديث</string>
<string name="bnet_store">ألعاب Blizzard</string>
<string name="stores_resume_install">استئناف التثبيت</string>
<string name="stores_dl_interrupted">منقطع</string>
@@ -2049,6 +2049,13 @@
<string name="stores_play">Jugar</string>
<string name="stores_install">Instalar</string>
<string name="bnet_open">Abrir Battle.net</string>
<string name="bnet_dl_starting">Iniciando el descargador de Blizzard…</string>
<string name="bnet_dl_waiting">Esperando a que se cierre Battle.net…</string>
<string name="bnet_dl_queued">Esperando la otra descarga de Battle.net…</string>
<string name="bnet_dl_client_first">Abre Battle.net e inicia sesión una vez; luego instala sus juegos desde aquí.</string>
<string name="bnet_dl_failed">El descargador de Blizzard se detuvo: %1$s</string>
<string name="bnet_dl_agent_error">Error de Blizzard %1$s</string>
<string name="bnet_update">Actualizar</string>
<string name="bnet_store">Juegos de Blizzard</string>
<string name="stores_resume_install">Reanudar instalación</string>
<string name="stores_dl_interrupted">Interrumpida</string>
+7
View File
@@ -1997,6 +1997,13 @@
<string name="stores_play">Играй</string>
<string name="stores_install">Инсталирай</string>
<string name="bnet_open">Отвори Battle.net</string>
<string name="bnet_dl_starting">Стартиране на програмата за изтегляне на Blizzard…</string>
<string name="bnet_dl_waiting">Изчакване Battle.net да се затвори…</string>
<string name="bnet_dl_queued">Изчакване на другото изтегляне от Battle.net…</string>
<string name="bnet_dl_client_first">Отворете Battle.net и влезте веднъж, след това инсталирайте игрите му оттук.</string>
<string name="bnet_dl_failed">Програмата за изтегляне на Blizzard спря: %1$s</string>
<string name="bnet_dl_agent_error">Грешка на Blizzard %1$s</string>
<string name="bnet_update">Актуализиране</string>
<string name="bnet_store">Игри на Blizzard</string>
<string name="stores_resume_install">Продължи инсталацията</string>
<string name="stores_dl_interrupted">Прекъснато</string>
+7
View File
@@ -2039,6 +2039,13 @@
<string name="stores_play">Hrát</string>
<string name="stores_install">Instalovat</string>
<string name="bnet_open">Otevřít Battle.net</string>
<string name="bnet_dl_starting">Spouštění stahovače Blizzardu…</string>
<string name="bnet_dl_waiting">Čekání na zavření Battle.net…</string>
<string name="bnet_dl_queued">Čekání na druhé stahování z Battle.net…</string>
<string name="bnet_dl_client_first">Otevřete Battle.net a jednou se přihlaste, pak instalujte jeho hry odsud.</string>
<string name="bnet_dl_failed">Stahovač Blizzardu se zastavil: %1$s</string>
<string name="bnet_dl_agent_error">Chyba Blizzardu %1$s</string>
<string name="bnet_update">Aktualizovat</string>
<string name="bnet_store">Hry od Blizzardu</string>
<string name="stores_resume_install">Pokračovat v instalaci</string>
<string name="stores_dl_interrupted">Přerušeno</string>
+7
View File
@@ -1997,6 +1997,13 @@
<string name="stores_play">Spil</string>
<string name="stores_install">Installer</string>
<string name="bnet_open">Åbn Battle.net</string>
<string name="bnet_dl_starting">Starter Blizzards downloader…</string>
<string name="bnet_dl_waiting">Venter på, at Battle.net lukker…</string>
<string name="bnet_dl_queued">Venter på den anden Battle.net-download…</string>
<string name="bnet_dl_client_first">Åbn Battle.net, og log ind én gang, og installer derefter dets spil herfra.</string>
<string name="bnet_dl_failed">Blizzards downloader stoppede: %1$s</string>
<string name="bnet_dl_agent_error">Blizzard-fejl %1$s</string>
<string name="bnet_update">Opdater</string>
<string name="bnet_store">Blizzard-spil</string>
<string name="stores_resume_install">Genoptag installation</string>
<string name="stores_dl_interrupted">Afbrudt</string>
+7
View File
@@ -1989,6 +1989,13 @@
<string name="stores_play">Spielen</string>
<string name="stores_install">Installieren</string>
<string name="bnet_open">Battle.net öffnen</string>
<string name="bnet_dl_starting">Blizzards Downloader wird gestartet…</string>
<string name="bnet_dl_waiting">Warten, bis Battle.net geschlossen ist…</string>
<string name="bnet_dl_queued">Warten auf den anderen Battle.net-Download…</string>
<string name="bnet_dl_client_first">Öffne Battle.net und melde dich einmal an, dann installiere seine Spiele hier.</string>
<string name="bnet_dl_failed">Blizzards Downloader wurde beendet: %1$s</string>
<string name="bnet_dl_agent_error">Blizzard-Fehler %1$s</string>
<string name="bnet_update">Aktualisieren</string>
<string name="bnet_store">Blizzard-Spiele</string>
<string name="stores_resume_install">Installation fortsetzen</string>
<string name="stores_dl_interrupted">Unterbrochen</string>
+7
View File
@@ -1997,6 +1997,13 @@
<string name="stores_play">Αναπαραγωγή</string>
<string name="stores_install">Εγκατάσταση</string>
<string name="bnet_open">Άνοιγμα του Battle.net</string>
<string name="bnet_dl_starting">Εκκίνηση του προγράμματος λήψης της Blizzard…</string>
<string name="bnet_dl_waiting">Αναμονή για κλείσιμο του Battle.net…</string>
<string name="bnet_dl_queued">Αναμονή για την άλλη λήψη από το Battle.net…</string>
<string name="bnet_dl_client_first">Ανοίξτε το Battle.net και συνδεθείτε μία φορά, έπειτα εγκαταστήστε τα παιχνίδια του από εδώ.</string>
<string name="bnet_dl_failed">Το πρόγραμμα λήψης της Blizzard σταμάτησε: %1$s</string>
<string name="bnet_dl_agent_error">Σφάλμα Blizzard %1$s</string>
<string name="bnet_update">Ενημέρωση</string>
<string name="bnet_store">Παιχνίδια της Blizzard</string>
<string name="stores_resume_install">Συνέχιση εγκατάστασης</string>
<string name="stores_dl_interrupted">Διακόπηκε</string>
+7
View File
@@ -2020,6 +2020,13 @@
<string name="stores_play">Jugar</string>
<string name="stores_install">Instalar</string>
<string name="bnet_open">Abrir Battle.net</string>
<string name="bnet_dl_starting">Iniciando el descargador de Blizzard…</string>
<string name="bnet_dl_waiting">Esperando a que se cierre Battle.net…</string>
<string name="bnet_dl_queued">Esperando a la otra descarga de Battle.net…</string>
<string name="bnet_dl_client_first">Abre Battle.net e inicia sesión una vez; después instala sus juegos desde aquí.</string>
<string name="bnet_dl_failed">El descargador de Blizzard se ha detenido: %1$s</string>
<string name="bnet_dl_agent_error">Error de Blizzard %1$s</string>
<string name="bnet_update">Actualizar</string>
<string name="bnet_store">Juegos de Blizzard</string>
<string name="stores_resume_install">Reanudar instalación</string>
<string name="stores_dl_interrupted">Interrumpida</string>
+7
View File
@@ -1997,6 +1997,13 @@
<string name="stores_play">Pelaa</string>
<string name="stores_install">Asenna</string>
<string name="bnet_open">Avaa Battle.net</string>
<string name="bnet_dl_starting">Käynnistetään Blizzardin latausohjelmaa…</string>
<string name="bnet_dl_waiting">Odotetaan Battle.netin sulkeutumista…</string>
<string name="bnet_dl_queued">Odotetaan toista Battle.net-latausta…</string>
<string name="bnet_dl_client_first">Avaa Battle.net ja kirjaudu sisään kerran, asenna sitten sen pelit täältä.</string>
<string name="bnet_dl_failed">Blizzardin latausohjelma pysähtyi: %1$s</string>
<string name="bnet_dl_agent_error">Blizzard-virhe %1$s</string>
<string name="bnet_update">Päivitä</string>
<string name="bnet_store">Blizzardin pelit</string>
<string name="stores_resume_install">Jatka asennusta</string>
<string name="stores_dl_interrupted">Keskeytynyt</string>
+7
View File
@@ -2020,6 +2020,13 @@
<string name="stores_play">Jouer</string>
<string name="stores_install">Installer</string>
<string name="bnet_open">Ouvrir Battle.net</string>
<string name="bnet_dl_starting">Démarrage du téléchargeur de Blizzard…</string>
<string name="bnet_dl_waiting">En attente de la fermeture de Battle.net…</string>
<string name="bnet_dl_queued">En attente de l\'autre téléchargement Battle.net…</string>
<string name="bnet_dl_client_first">Ouvrez Battle.net et connectez-vous une fois, puis installez ses jeux ici.</string>
<string name="bnet_dl_failed">Le téléchargeur de Blizzard s\'est arrêté : %1$s</string>
<string name="bnet_dl_agent_error">Erreur Blizzard %1$s</string>
<string name="bnet_update">Mettre à jour</string>
<string name="bnet_store">Jeux Blizzard</string>
<string name="stores_resume_install">Reprendre l\'installation</string>
<string name="stores_dl_interrupted">Interrompu</string>
+7
View File
@@ -1997,6 +1997,13 @@
<string name="stores_play">Play</string>
<string name="stores_install">इंस्टॉल करें</string>
<string name="bnet_open">Battle.net खोलें</string>
<string name="bnet_dl_starting">Blizzard का डाउनलोडर शुरू हो रहा है…</string>
<string name="bnet_dl_waiting">Battle.net के बंद होने का इंतज़ार…</string>
<string name="bnet_dl_queued">दूसरे Battle.net डाउनलोड का इंतज़ार…</string>
<string name="bnet_dl_client_first">Battle.net खोलें और एक बार साइन इन करें, फिर इसके गेम यहाँ से इंस्टॉल करें।</string>
<string name="bnet_dl_failed">Blizzard का डाउनलोडर रुक गया: %1$s</string>
<string name="bnet_dl_agent_error">Blizzard त्रुटि %1$s</string>
<string name="bnet_update">अपडेट करें</string>
<string name="bnet_store">Blizzard के गेम</string>
<string name="stores_resume_install">इंस्टॉल फिर से शुरू करें</string>
<string name="stores_dl_interrupted">बाधित</string>
+7
View File
@@ -1997,6 +1997,13 @@
<string name="stores_play">Játék</string>
<string name="stores_install">Telepítés</string>
<string name="bnet_open">Battle.net megnyitása</string>
<string name="bnet_dl_starting">A Blizzard letöltőjének indítása…</string>
<string name="bnet_dl_waiting">Várakozás a Battle.net bezárására…</string>
<string name="bnet_dl_queued">Várakozás a másik Battle.net-letöltésre…</string>
<string name="bnet_dl_client_first">Nyisd meg a Battle.netet, és jelentkezz be egyszer, majd innen telepítsd a játékait.</string>
<string name="bnet_dl_failed">A Blizzard letöltője leállt: %1$s</string>
<string name="bnet_dl_agent_error">Blizzard-hiba: %1$s</string>
<string name="bnet_update">Frissítés</string>
<string name="bnet_store">Blizzard-játékok</string>
<string name="stores_resume_install">Telepítés folytatása</string>
<string name="stores_dl_interrupted">Megszakítva</string>
+7
View File
@@ -1976,6 +1976,13 @@
<string name="stores_play">Mainkan</string>
<string name="stores_install">Instal</string>
<string name="bnet_open">Buka Battle.net</string>
<string name="bnet_dl_starting">Memulai pengunduh Blizzard…</string>
<string name="bnet_dl_waiting">Menunggu Battle.net ditutup…</string>
<string name="bnet_dl_queued">Menunggu unduhan Battle.net lainnya…</string>
<string name="bnet_dl_client_first">Buka Battle.net dan masuk sekali, lalu instal gamenya dari sini.</string>
<string name="bnet_dl_failed">Pengunduh Blizzard berhenti: %1$s</string>
<string name="bnet_dl_agent_error">Kesalahan Blizzard %1$s</string>
<string name="bnet_update">Perbarui</string>
<string name="bnet_store">Game Blizzard</string>
<string name="stores_resume_install">Lanjutkan instalasi</string>
<string name="stores_dl_interrupted">Terhenti</string>
+7
View File
@@ -2010,6 +2010,13 @@
<string name="stores_play">Gioca</string>
<string name="stores_install">Installa</string>
<string name="bnet_open">Apri Battle.net</string>
<string name="bnet_dl_starting">Avvio del downloader di Blizzard…</string>
<string name="bnet_dl_waiting">In attesa della chiusura di Battle.net…</string>
<string name="bnet_dl_queued">In attesa dell\'altro download di Battle.net…</string>
<string name="bnet_dl_client_first">Apri Battle.net ed esegui l\'accesso una volta, poi installa qui i suoi giochi.</string>
<string name="bnet_dl_failed">Il downloader di Blizzard si è fermato: %1$s</string>
<string name="bnet_dl_agent_error">Errore Blizzard %1$s</string>
<string name="bnet_update">Aggiorna</string>
<string name="bnet_store">Giochi Blizzard</string>
<string name="stores_resume_install">Riprendi installazione</string>
<string name="stores_dl_interrupted">Interrotto</string>
+7
View File
@@ -1978,6 +1978,13 @@
<string name="stores_play">プレイ</string>
<string name="stores_install">インストール</string>
<string name="bnet_open">Battle.net を開く</string>
<string name="bnet_dl_starting">Blizzard のダウンローダーを起動しています…</string>
<string name="bnet_dl_waiting">Battle.net が閉じるのを待っています…</string>
<string name="bnet_dl_queued">もう一つの Battle.net のダウンロードを待っています…</string>
<string name="bnet_dl_client_first">Battle.net を開いて一度サインインしてから、ここでゲームをインストールしてください。</string>
<string name="bnet_dl_failed">Blizzard のダウンローダーが停止しました: %1$s</string>
<string name="bnet_dl_agent_error">Blizzard エラー %1$s</string>
<string name="bnet_update">アップデート</string>
<string name="bnet_store">Blizzard のゲーム</string>
<string name="stores_resume_install">インストールを再開</string>
<string name="stores_dl_interrupted">中断</string>
+7
View File
@@ -1978,6 +1978,13 @@
<string name="stores_play">플레이</string>
<string name="stores_install">설치</string>
<string name="bnet_open">Battle.net 열기</string>
<string name="bnet_dl_starting">Blizzard 다운로더를 시작하는 중…</string>
<string name="bnet_dl_waiting">Battle.net이 닫히기를 기다리는 중…</string>
<string name="bnet_dl_queued">다른 Battle.net 다운로드를 기다리는 중…</string>
<string name="bnet_dl_client_first">Battle.net을 열고 한 번 로그인한 다음 여기에서 게임을 설치하세요.</string>
<string name="bnet_dl_failed">Blizzard 다운로더가 중지됨: %1$s</string>
<string name="bnet_dl_agent_error">Blizzard 오류 %1$s</string>
<string name="bnet_update">업데이트</string>
<string name="bnet_store">Blizzard 게임</string>
<string name="stores_resume_install">설치 재개</string>
<string name="stores_dl_interrupted">중단됨</string>
+7
View File
@@ -1976,6 +1976,13 @@
<string name="stores_play">Main</string>
<string name="stores_install">Pasang</string>
<string name="bnet_open">Buka Battle.net</string>
<string name="bnet_dl_starting">Memulakan pemuat turun Blizzard…</string>
<string name="bnet_dl_waiting">Menunggu Battle.net ditutup…</string>
<string name="bnet_dl_queued">Menunggu muat turun Battle.net yang lain…</string>
<string name="bnet_dl_client_first">Buka Battle.net dan log masuk sekali, kemudian pasang permainannya dari sini.</string>
<string name="bnet_dl_failed">Pemuat turun Blizzard berhenti: %1$s</string>
<string name="bnet_dl_agent_error">Ralat Blizzard %1$s</string>
<string name="bnet_update">Kemas kini</string>
<string name="bnet_store">Permainan Blizzard</string>
<string name="stores_resume_install">Sambung pemasangan</string>
<string name="stores_dl_interrupted">Terganggu</string>
+7
View File
@@ -1997,6 +1997,13 @@
<string name="stores_play">Spill</string>
<string name="stores_install">Installer</string>
<string name="bnet_open">Åpne Battle.net</string>
<string name="bnet_dl_starting">Starter Blizzards nedlaster…</string>
<string name="bnet_dl_waiting">Venter på at Battle.net lukkes…</string>
<string name="bnet_dl_queued">Venter på den andre Battle.net-nedlastingen…</string>
<string name="bnet_dl_client_first">Åpne Battle.net og logg på én gang, og installer deretter spillene herfra.</string>
<string name="bnet_dl_failed">Blizzards nedlaster stoppet: %1$s</string>
<string name="bnet_dl_agent_error">Blizzard-feil %1$s</string>
<string name="bnet_update">Oppdater</string>
<string name="bnet_store">Blizzard-spill</string>
<string name="stores_resume_install">Gjenoppta installasjon</string>
<string name="stores_dl_interrupted">Avbrutt</string>
+7
View File
@@ -1997,6 +1997,13 @@
<string name="stores_play">Spelen</string>
<string name="stores_install">Installeren</string>
<string name="bnet_open">Battle.net openen</string>
<string name="bnet_dl_starting">Blizzards downloader wordt gestart…</string>
<string name="bnet_dl_waiting">Wachten tot Battle.net is gesloten…</string>
<string name="bnet_dl_queued">Wachten op de andere Battle.net-download…</string>
<string name="bnet_dl_client_first">Open Battle.net en meld je één keer aan, installeer daarna de games hier.</string>
<string name="bnet_dl_failed">Blizzards downloader is gestopt: %1$s</string>
<string name="bnet_dl_agent_error">Blizzard-fout %1$s</string>
<string name="bnet_update">Bijwerken</string>
<string name="bnet_store">Blizzard-games</string>
<string name="stores_resume_install">Installatie hervatten</string>
<string name="stores_dl_interrupted">Onderbroken</string>
+7
View File
@@ -2039,6 +2039,13 @@
<string name="stores_play">Graj</string>
<string name="stores_install">Zainstaluj</string>
<string name="bnet_open">Otwórz Battle.net</string>
<string name="bnet_dl_starting">Uruchamianie programu pobierającego Blizzarda…</string>
<string name="bnet_dl_waiting">Oczekiwanie na zamknięcie Battle.net…</string>
<string name="bnet_dl_queued">Oczekiwanie na drugie pobieranie z Battle.net…</string>
<string name="bnet_dl_client_first">Otwórz Battle.net i zaloguj się raz, a potem instaluj jego gry tutaj.</string>
<string name="bnet_dl_failed">Program pobierający Blizzarda zatrzymał się: %1$s</string>
<string name="bnet_dl_agent_error">Błąd Blizzarda %1$s</string>
<string name="bnet_update">Aktualizuj</string>
<string name="bnet_store">Gry Blizzarda</string>
<string name="stores_resume_install">Wznów instalację</string>
<string name="stores_dl_interrupted">Przerwano</string>
@@ -2010,6 +2010,13 @@
<string name="stores_play">Jogar</string>
<string name="stores_install">Instalar</string>
<string name="bnet_open">Abrir o Battle.net</string>
<string name="bnet_dl_starting">A iniciar o transferidor da Blizzard…</string>
<string name="bnet_dl_waiting">A aguardar que o Battle.net feche…</string>
<string name="bnet_dl_queued">A aguardar a outra transferência do Battle.net…</string>
<string name="bnet_dl_client_first">Abra o Battle.net e inicie sessão uma vez; depois instale os jogos dele aqui.</string>
<string name="bnet_dl_failed">O transferidor da Blizzard parou: %1$s</string>
<string name="bnet_dl_agent_error">Erro da Blizzard %1$s</string>
<string name="bnet_update">Atualizar</string>
<string name="bnet_store">Jogos da Blizzard</string>
<string name="stores_resume_install">Retomar instalação</string>
<string name="stores_dl_interrupted">Interrompida</string>
+7
View File
@@ -2010,6 +2010,13 @@
<string name="stores_play">Jogar</string>
<string name="stores_install">Instalar</string>
<string name="bnet_open">Abrir o Battle.net</string>
<string name="bnet_dl_starting">Iniciando o downloader da Blizzard…</string>
<string name="bnet_dl_waiting">Aguardando o Battle.net fechar…</string>
<string name="bnet_dl_queued">Aguardando o outro download do Battle.net…</string>
<string name="bnet_dl_client_first">Abra o Battle.net e entre uma vez; depois instale os jogos dele aqui.</string>
<string name="bnet_dl_failed">O downloader da Blizzard parou: %1$s</string>
<string name="bnet_dl_agent_error">Erro da Blizzard %1$s</string>
<string name="bnet_update">Atualizar</string>
<string name="bnet_store">Jogos da Blizzard</string>
<string name="stores_resume_install">Retomar instalação</string>
<string name="stores_dl_interrupted">Interrompido</string>
+7
View File
@@ -2018,6 +2018,13 @@
<string name="stores_play">Joacă</string>
<string name="stores_install">Instalează</string>
<string name="bnet_open">Deschide Battle.net</string>
<string name="bnet_dl_starting">Se pornește programul de descărcare Blizzard…</string>
<string name="bnet_dl_waiting">Se așteaptă închiderea Battle.net…</string>
<string name="bnet_dl_queued">Se așteaptă cealaltă descărcare Battle.net…</string>
<string name="bnet_dl_client_first">Deschide Battle.net și conectează-te o dată, apoi instalează jocurile de aici.</string>
<string name="bnet_dl_failed">Programul de descărcare Blizzard s-a oprit: %1$s</string>
<string name="bnet_dl_agent_error">Eroare Blizzard %1$s</string>
<string name="bnet_update">Actualizează</string>
<string name="bnet_store">Jocuri Blizzard</string>
<string name="stores_resume_install">Reia instalarea</string>
<string name="stores_dl_interrupted">Întreruptă</string>
+7
View File
@@ -2041,6 +2041,13 @@
<string name="stores_play">Играть</string>
<string name="stores_install">Установить</string>
<string name="bnet_open">Открыть Battle.net</string>
<string name="bnet_dl_starting">Запуск загрузчика Blizzard…</string>
<string name="bnet_dl_waiting">Ожидание закрытия Battle.net…</string>
<string name="bnet_dl_queued">Ожидание другой загрузки Battle.net…</string>
<string name="bnet_dl_client_first">Откройте Battle.net и войдите один раз, затем устанавливайте его игры здесь.</string>
<string name="bnet_dl_failed">Загрузчик Blizzard остановился: %1$s</string>
<string name="bnet_dl_agent_error">Ошибка Blizzard %1$s</string>
<string name="bnet_update">Обновить</string>
<string name="bnet_store">Игры Blizzard</string>
<string name="stores_resume_install">Продолжить установку</string>
<string name="stores_dl_interrupted">Прервано</string>
+7
View File
@@ -1997,6 +1997,13 @@
<string name="stores_play">Spela</string>
<string name="stores_install">Installera</string>
<string name="bnet_open">Öppna Battle.net</string>
<string name="bnet_dl_starting">Startar Blizzards nedladdare…</string>
<string name="bnet_dl_waiting">Väntar på att Battle.net stängs…</string>
<string name="bnet_dl_queued">Väntar på den andra Battle.net-nedladdningen…</string>
<string name="bnet_dl_client_first">Öppna Battle.net och logga in en gång, installera sedan dess spel här.</string>
<string name="bnet_dl_failed">Blizzards nedladdare stoppades: %1$s</string>
<string name="bnet_dl_agent_error">Blizzard-fel %1$s</string>
<string name="bnet_update">Uppdatera</string>
<string name="bnet_store">Blizzard-spel</string>
<string name="stores_resume_install">Återuppta installation</string>
<string name="stores_dl_interrupted">Avbruten</string>
+7
View File
@@ -1976,6 +1976,13 @@
<string name="stores_play">เล่น</string>
<string name="stores_install">ติดตั้ง</string>
<string name="bnet_open">เปิด Battle.net</string>
<string name="bnet_dl_starting">กำลังเริ่มตัวดาวน์โหลดของ Blizzard…</string>
<string name="bnet_dl_waiting">กำลังรอให้ Battle.net ปิด…</string>
<string name="bnet_dl_queued">กำลังรอการดาวน์โหลด Battle.net อีกรายการ…</string>
<string name="bnet_dl_client_first">เปิด Battle.net และลงชื่อเข้าใช้หนึ่งครั้ง แล้วติดตั้งเกมจากที่นี่</string>
<string name="bnet_dl_failed">ตัวดาวน์โหลดของ Blizzard หยุดทำงาน: %1$s</string>
<string name="bnet_dl_agent_error">ข้อผิดพลาดของ Blizzard %1$s</string>
<string name="bnet_update">อัปเดต</string>
<string name="bnet_store">เกมของ Blizzard</string>
<string name="stores_resume_install">ดำเนินการติดตั้งต่อ</string>
<string name="stores_dl_interrupted">ถูกขัดจังหวะ</string>
+7
View File
@@ -1991,6 +1991,13 @@
<string name="stores_play">Oyna</string>
<string name="stores_install">Yükle</string>
<string name="bnet_open">Battle.net\'i aç</string>
<string name="bnet_dl_starting">Blizzard indiricisi başlatılıyor…</string>
<string name="bnet_dl_waiting">Battle.net\'in kapanması bekleniyor…</string>
<string name="bnet_dl_queued">Diğer Battle.net indirmesi bekleniyor…</string>
<string name="bnet_dl_client_first">Battle.net\'i açıp bir kez oturum açın, ardından oyunlarını buradan yükleyin.</string>
<string name="bnet_dl_failed">Blizzard indiricisi durdu: %1$s</string>
<string name="bnet_dl_agent_error">Blizzard hatası %1$s</string>
<string name="bnet_update">Güncelle</string>
<string name="bnet_store">Blizzard oyunları</string>
<string name="stores_resume_install">Yüklemeyi sürdür</string>
<string name="stores_dl_interrupted">Kesintiye uğradı</string>
+7
View File
@@ -2039,6 +2039,13 @@
<string name="stores_play">Грати</string>
<string name="stores_install">Встановити</string>
<string name="bnet_open">Відкрити Battle.net</string>
<string name="bnet_dl_starting">Запуск завантажувача Blizzard…</string>
<string name="bnet_dl_waiting">Очікування закриття Battle.net…</string>
<string name="bnet_dl_queued">Очікування іншого завантаження Battle.net…</string>
<string name="bnet_dl_client_first">Відкрийте Battle.net і увійдіть один раз, потім встановлюйте його ігри тут.</string>
<string name="bnet_dl_failed">Завантажувач Blizzard зупинився: %1$s</string>
<string name="bnet_dl_agent_error">Помилка Blizzard %1$s</string>
<string name="bnet_update">Оновити</string>
<string name="bnet_store">Ігри Blizzard</string>
<string name="stores_resume_install">Продовжити встановлення</string>
<string name="stores_dl_interrupted">Перервано</string>
+7
View File
@@ -1976,6 +1976,13 @@
<string name="stores_play">Chơi</string>
<string name="stores_install">Cài</string>
<string name="bnet_open">Mở Battle.net</string>
<string name="bnet_dl_starting">Đang khởi động trình tải xuống của Blizzard…</string>
<string name="bnet_dl_waiting">Đang chờ Battle.net đóng…</string>
<string name="bnet_dl_queued">Đang chờ lượt tải Battle.net khác…</string>
<string name="bnet_dl_client_first">Mở Battle.net và đăng nhập một lần, sau đó cài trò chơi của nó tại đây.</string>
<string name="bnet_dl_failed">Trình tải xuống của Blizzard đã dừng: %1$s</string>
<string name="bnet_dl_agent_error">Lỗi Blizzard %1$s</string>
<string name="bnet_update">Cập nhật</string>
<string name="bnet_store">Trò chơi Blizzard</string>
<string name="stores_resume_install">Tiếp tục cài</string>
<string name="stores_dl_interrupted">Bị gián đoạn</string>
@@ -2056,6 +2056,13 @@
<string name="stores_play">游玩</string>
<string name="stores_install">安装</string>
<string name="bnet_open">打开 Battle.net</string>
<string name="bnet_dl_starting">正在启动暴雪下载器…</string>
<string name="bnet_dl_waiting">正在等待 Battle.net 关闭…</string>
<string name="bnet_dl_queued">正在等待另一个 Battle.net 下载…</string>
<string name="bnet_dl_client_first">请先打开 Battle.net 并登录一次,然后在这里安装其游戏。</string>
<string name="bnet_dl_failed">暴雪下载器已停止:%1$s</string>
<string name="bnet_dl_agent_error">暴雪错误 %1$s</string>
<string name="bnet_update">更新</string>
<string name="bnet_store">暴雪游戏</string>
<string name="stores_resume_install">继续安装</string>
<string name="stores_dl_interrupted">已中断</string>
@@ -1979,6 +1979,13 @@
<string name="stores_play">開啟遊戲</string>
<string name="stores_install">安裝</string>
<string name="bnet_open">開啟 Battle.net</string>
<string name="bnet_dl_starting">正在啟動暴雪下載器…</string>
<string name="bnet_dl_waiting">正在等待 Battle.net 關閉…</string>
<string name="bnet_dl_queued">正在等待另一個 Battle.net 下載…</string>
<string name="bnet_dl_client_first">請先開啟 Battle.net 並登入一次,然後在這裡安裝其遊戲。</string>
<string name="bnet_dl_failed">暴雪下載器已停止:%1$s</string>
<string name="bnet_dl_agent_error">暴雪錯誤 %1$s</string>
<string name="bnet_update">更新</string>
<string name="bnet_store">Blizzard 遊戲</string>
<string name="stores_resume_install">繼續安裝</string>
<string name="stores_dl_interrupted">已中斷</string>
@@ -1979,6 +1979,13 @@
<string name="stores_play">執行</string>
<string name="stores_install">安裝</string>
<string name="bnet_open">開啟 Battle.net</string>
<string name="bnet_dl_starting">正在啟動暴雪下載器…</string>
<string name="bnet_dl_waiting">正在等待 Battle.net 關閉…</string>
<string name="bnet_dl_queued">正在等待另一個 Battle.net 下載…</string>
<string name="bnet_dl_client_first">請先開啟 Battle.net 並登入一次,然後在這裡安裝其遊戲。</string>
<string name="bnet_dl_failed">暴雪下載器已停止:%1$s</string>
<string name="bnet_dl_agent_error">暴雪錯誤 %1$s</string>
<string name="bnet_update">更新</string>
<string name="bnet_store">Blizzard 遊戲</string>
<string name="stores_resume_install">繼續安裝</string>
<string name="stores_dl_interrupted">已中斷</string>
+7
View File
@@ -2094,6 +2094,13 @@
<string name="stores_play">Play</string>
<string name="stores_install">Install</string>
<string name="bnet_open">Open Battle.net</string>
<string name="bnet_dl_starting">Starting Blizzard\'s downloader…</string>
<string name="bnet_dl_waiting">Waiting for Battle.net to close…</string>
<string name="bnet_dl_queued">Waiting for the other Battle.net download…</string>
<string name="bnet_dl_client_first">Open Battle.net and sign in once, then install its games here.</string>
<string name="bnet_dl_failed">Blizzard\'s downloader stopped: %1$s</string>
<string name="bnet_dl_agent_error">Blizzard error %1$s</string>
<string name="bnet_update">Update</string>
<string name="bnet_store">Blizzard games</string>
<string name="stores_resume_install">Resume install</string>
<string name="stores_dl_interrupted">Interrupted</string>
@@ -0,0 +1,75 @@
package com.droiddeck.launcher.stores.battlenet
import com.droiddeck.launcher.runtime.BattleNet
import com.droiddeck.launcher.stores.CatalogItem
import com.droiddeck.launcher.stores.Store
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Test
import java.util.Locale
class BattleNetInstallTest {
private val buildInfo = """
Branch!STRING:0|Active!DEC:1|Build Key!HEX:16|CDN Key!HEX:16|Install Key!HEX:16|IM Size!DEC:4|Version!STRING:0|Product!STRING:0
eu|0|11111111111111111111111111111111|db0583272ed15286569b5f24ce516876|||16.1.1.1|gryphon
us|1|e474008a3535d8ea978949a90d9873e6|db0583272ed15286569b5f24ce516876|||16.1.2.119725|gryphon
""".trimIndent()
private val versions = """
Region!STRING:0|BuildConfig!HEX:16|CDNConfig!HEX:16|KeyRing!HEX:16|BuildId!DEC:4|VersionsName!String:0|ProductConfig!HEX:16
## seqn = 4048130
us|f00d008a3535d8ea978949a90d9873e6|db0583272ed15286569b5f24ce516876||119800|16.1.3.119800|f6a454799d25791e5a37a7547d75ce49
eu|e474008a3535d8ea978949a90d9873e6|db0583272ed15286569b5f24ce516876||119725|16.1.2.119725|f6a454799d25791e5a37a7547d75ce49
""".trimIndent()
@Test fun theActiveRowGivesTheRegionAndBuildOnDisk() {
assertEquals("us" to "e474008a3535d8ea978949a90d9873e6", BattleNetInstall.buildKey(buildInfo))
assertNull(BattleNetInstall.buildKey("Branch!STRING:0|Active!DEC:1\n"))
assertNull(BattleNetInstall.buildKey("Branch!STRING:0|Active!DEC:1|Build Key!HEX:16\nus|1|not-a-key\n"))
}
@Test fun theLiveBuildIsReadForTheSameRegion() {
assertEquals("f00d008a3535d8ea978949a90d9873e6", BattleNetInstall.latestBuild(versions, "us"))
assertEquals("e474008a3535d8ea978949a90d9873e6", BattleNetInstall.latestBuild(versions, "eu"))
assertNull(BattleNetInstall.latestBuild(versions, "kr"))
assertNull(BattleNetInstall.latestBuild("", "us"))
}
@Test fun theDeviceLanguagePicksABlizzardLocale() {
assertEquals("enUS", BattleNetInstall.locale(Locale.US))
assertEquals("enGB", BattleNetInstall.locale(Locale.UK))
assertEquals("enUS", BattleNetInstall.locale(Locale("en", "AU")))
assertEquals("deDE", BattleNetInstall.locale(Locale.GERMANY))
assertEquals("ptBR", BattleNetInstall.locale(Locale("pt", "BR")))
assertEquals("ptPT", BattleNetInstall.locale(Locale("pt", "PT")))
assertEquals("zhTW", BattleNetInstall.locale(Locale.forLanguageTag("zh-Hant-HK")))
assertEquals("zhCN", BattleNetInstall.locale(Locale.SIMPLIFIED_CHINESE))
assertEquals("enUS", BattleNetInstall.locale(Locale("nl", "NL")))
}
@Test fun theCountryIsSentInBothForms() {
assertEquals("DEU" to "DE", BattleNetInstall.country(Locale.GERMANY))
assertEquals("USA" to "US", BattleNetInstall.country(Locale("en")))
}
@Test fun everyStoreTitleWithAProductInstallsHeadless() {
val products = BattleNet.TITLES.mapNotNull { it.product }
assertTrue(products.all { Regex("[a-z0-9_]{1,32}").matches(it) })
assertTrue(BattleNetInstall.headless(CatalogItem(Store.BATTLENET, "gryphon", "Warcraft Rumble", null)))
assertEquals("hsb", BattleNetInstall.product("hs_beta"))
assertEquals("d3", BattleNetInstall.product("diablo3_enus"))
assertFalse(BattleNetInstall.headless(CatalogItem(Store.BATTLENET, "d3cn", "Diablo III", null)))
assertFalse(BattleNetInstall.headless(CatalogItem(Store.EPIC, "gryphon", "Warcraft Rumble", null)))
}
@Test fun theAgentStatusPicksTheDownloadStep() {
assertEquals(BattleNetInstall.Step.PREPARING, BattleNetInstall.step(1008, 0, 0, 0))
assertEquals(BattleNetInstall.Step.PREPARING, BattleNetInstall.step(1003, 500, 0, 0))
assertEquals(BattleNetInstall.Step.DOWNLOADING, BattleNetInstall.step(1003, 500, 31405777, 6746574227))
assertEquals(BattleNetInstall.Step.APPLYING, BattleNetInstall.step(1003, 500, 6746574227, 6746574227))
assertEquals(BattleNetInstall.Step.APPLYING, BattleNetInstall.step(1003, 2000, 1, 9))
assertEquals(BattleNetInstall.Step.APPLYING, BattleNetInstall.step(1004, 1000, 0, 0))
}
}