fix: ship Windows executables as add-on packs and keep them out of the APK (#2676)

* fix(rockstar): ship the launcher service as an add-on pack, not inside the APK

* fix: ship the DiRT ws2_32 stand-in as an add-on pack and reject Windows executables in the APK

* fix(release): reject APK entries under a packed path even when the manifest omits them

* fix(dirt): fetch the ws2_32 stand-in pack once the Linux runtime is installed
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-11-15 13:28:38 -05:00
1 parent 946e9c41e0
commit 9375ed0948
17 files changed
+185 -38

No files matched your search

+1 -1
View File
@@ -55,7 +55,7 @@ jobs:
jq -r --arg n "$2" '.assets // [] | .[] | select(.name == $n) | .digest // empty'
}
commit=$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$BUILD_RUN" --jq .head_sha 2>/dev/null || echo "$GITHUB_SHA")
for name in proot directaudio tracking xbox comet butler powervr ubisoft; do
for name in proot directaudio tracking xbox comet butler powervr ubisoft rockstar dirt; do
file="packs/$name.tar.zst"
[ -f "$file" ] || { echo "::error::$name.tar.zst is missing from Build APK run $BUILD_RUN"; exit 1; }
sha=$(sha256sum "$file" | cut -d' ' -f1)
+1 -1
View File
@@ -36,4 +36,4 @@ __pycache__/
app/src/main/assets/directaudio/
app/src/main/assets/hybris/
/tools/vr/out/
app/src/main/resources/rockstar/helpers/
app/src/main/assets/linuxfs/usr/local/lib/droiddeck-rockstar/
+2 -2
View File
@@ -93,7 +93,7 @@ def trackingPack = rootProject.file('tools/packs/tracking/release.env').readLine
def prootPackPin = rootProject.file('tools/packs/proot/release.env').readLines()
.findAll { it.contains('=') && !it.startsWith('#') }
.collectEntries { def kv = it.split('=', 2); [(kv[0].trim()): kv[1].trim()] }
def addonPacks = ['proot', 'directaudio', 'tracking', 'xbox', 'comet', 'butler', 'powervr', 'ubisoft'].collectEntries { name ->
def addonPacks = ['proot', 'directaudio', 'tracking', 'xbox', 'comet', 'butler', 'powervr', 'ubisoft', 'rockstar', 'dirt'].collectEntries { name ->
def pack = file("build/packs/${name}.tar.zst")
if (!pack.isFile()) {
if (ciBuild) throw new GradleException("Add-on pack ${pack} is missing: run tools/packs/build.sh app/build/packs")
@@ -206,7 +206,7 @@ android {
}
androidResources {
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~:<dir>droiddeck-xbox:<dir>droiddeck-comet:<dir>droiddeck-ubisoft:<dir>directaudio:<dir>hybris'
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~:<dir>droiddeck-xbox:<dir>droiddeck-comet:<dir>droiddeck-ubisoft:<dir>droiddeck-rockstar:<dir>droiddeck-dirt:<dir>directaudio:<dir>hybris'
}
packagingOptions {
@@ -84,12 +84,15 @@ class App : Application() {
if (com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(app).isDirectory) {
com.droiddeck.launcher.core.AddonPack.PROOT.ensure(app)
com.droiddeck.launcher.core.AddonPack.DIRECTAUDIO.ensure(app)
com.droiddeck.launcher.session.SessionFiles.ensureDirtStandIn(app)
}
if (com.droiddeck.launcher.stores.gog.GogComet.enabled(app)) com.droiddeck.launcher.core.AddonPack.COMET.ensure(app)
if (com.droiddeck.launcher.stores.StoreAccounts.signedInAs(app, com.droiddeck.launcher.stores.Store.XBOX) != null)
com.droiddeck.launcher.core.AddonPack.XBOX.ensure(app)
if (com.droiddeck.launcher.stores.StoreAccounts.signedInAs(app, com.droiddeck.launcher.stores.Store.UBISOFT) != null)
com.droiddeck.launcher.session.SessionFiles.ensureUbisoftService(app)
if (com.droiddeck.launcher.stores.StoreAccounts.signedInAs(app, com.droiddeck.launcher.stores.Store.ROCKSTAR) != null)
com.droiddeck.launcher.session.SessionFiles.ensureRockstarService(app)
com.droiddeck.launcher.handtracking.HandTracking.load(app)
}.onFailure { android.util.Log.w("App", "add-on pack prefetch failed", it) }
}, "addon-packs").start()
@@ -2589,7 +2589,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
runCatching { com.droiddeck.launcher.runtime.RuntimeInstallService.start(this, release) }
val ok = com.droiddeck.launcher.runtime.LinuxRuntimeInstaller.install(this, release,
progressFor(RUNTIME_LINES, release.size / 1_000_000))
if (ok) return null
if (ok) {
com.droiddeck.launcher.session.SessionFiles.ensureDirtStandIn(this)
return null
}
SessionEvents.record("runtime.failed", mapOf("step" to "install", "reason" to com.droiddeck.launcher.runtime.LinuxRuntimeInstaller.installError()))
return getString(R.string.session_runtime_install_failed)
}
@@ -172,5 +172,8 @@ internal class AddonPack(
listOf("runtime.tzst", "version.txt"))
val UBISOFT = AddonPack("ubisoft", BuildConfig.PACK_UBISOFT_SHA256, BuildConfig.PACK_UBISOFT_SIZE,
listOf("droiddeck-upc.exe"))
val ROCKSTAR = AddonPack("rockstar", BuildConfig.PACK_ROCKSTAR_SHA256, BuildConfig.PACK_ROCKSTAR_SIZE,
listOf("Launcher32.exe", "Launcher64.exe"))
val DIRT = AddonPack("dirt", BuildConfig.PACK_DIRT_SHA256, BuildConfig.PACK_DIRT_SIZE, listOf("ws2_32.dll"))
}
}
@@ -36,35 +36,60 @@ object SessionFiles {
"etc/xdg/autostart/droiddeck-clipboard.desktop" to "etc/xdg/autostart/droiddeck-clipboard.desktop",
)
private const val UBISOFT_SERVICE = "usr/local/lib/droiddeck-ubisoft/droiddeck-upc.exe"
private val SERVICE_PACKS = mapOf(
AddonPack.UBISOFT to "usr/local/lib/droiddeck-ubisoft",
AddonPack.ROCKSTAR to "usr/local/lib/droiddeck-rockstar",
AddonPack.DIRT to "usr/local/lib/droiddeck-dirt",
)
/** Fetches the Ubisoft pack and, once it lands, stages the service so a running session gets it without restarting. */
fun ensureUbisoftService(context: Context) {
AddonPack.UBISOFT.ensure(context) { app ->
fun ensureUbisoftService(context: Context) = ensureStoreService(context, AddonPack.UBISOFT)
fun ensureRockstarService(context: Context) = ensureStoreService(context, AddonPack.ROCKSTAR)
/** The DiRT 3 / DiRT Showdown ws2_32 stand-in; droiddeck-game-env applies it only when it is staged. */
fun ensureDirtStandIn(context: Context) = ensureStoreService(context, AddonPack.DIRT)
private fun ensureStoreService(context: Context, pack: AddonPack) {
pack.ensure(context) { app ->
com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(app).takeIf { it.isDirectory }
?.let { stageUbisoftService(app, it, null) }
?.let { stageStoreService(app, it, pack, null) }
}
}
/** Blocks until the store's service pack is installed and staged in [root]; false when it could not be fetched. */
fun awaitStoreService(context: Context, store: String, root: File): Boolean {
val pack = SERVICE_PACKS.keys.firstOrNull { it.name == store } ?: return false
if (!pack.await(context)) return false
return stageStoreService(context, root, pack, null)
}
@Synchronized
private fun stageUbisoftService(context: Context, root: File, ledger: StageLedger?) {
val pack = AddonPack.UBISOFT.takeIf { it.installed(context) }?.dir(context) ?: return
val target = File(root, UBISOFT_SERVICE)
if (ledger?.current(UBISOFT_SERVICE, target) == true) return
val staged = File(target.parentFile, target.name + ".staged")
var installed = false
try {
target.parentFile?.mkdirs()
File(pack, "droiddeck-upc.exe").inputStream().use { input ->
staged.outputStream().use { output -> FileUtils.copy(input, output) }
private fun stageStoreService(context: Context, root: File, pack: AddonPack, ledger: StageLedger?): Boolean {
val dir = pack.takeIf { it.installed(context) }?.dir(context) ?: return false
val base = SERVICE_PACKS.getValue(pack)
var all = true
for (file in dir.listFiles().orEmpty().filter { it.isFile && it.name != AddonPack.COMPLETE }.sortedBy { it.name }) {
val relative = "$base/${file.name}"
val target = File(root, relative)
if (ledger?.current(relative, target) == true) continue
val staged = File(target.parentFile, target.name + ".staged")
var installed = false
try {
target.parentFile?.mkdirs()
file.inputStream().use { input ->
staged.outputStream().use { output -> FileUtils.copy(input, output) }
}
installed = staged.setExecutable(true, false) && staged.renameTo(target)
} catch (e: Exception) {
Log.w(TAG, "could not stage the ${pack.name} pack", e)
} finally {
if (!installed) staged.delete()
}
installed = staged.setExecutable(true, false) && staged.renameTo(target)
} catch (e: Exception) {
Log.w(TAG, "could not stage the Ubisoft launcher service", e)
} finally {
if (!installed) staged.delete()
if (installed) ledger?.staged(relative, target) else Log.e(TAG, "$relative NOT staged")
all = all && installed
}
if (installed) ledger?.staged(UBISOFT_SERVICE, target) else Log.e(TAG, "$UBISOFT_SERVICE NOT staged")
return all
}
fun stage(context: Context, root: File, startsSession: Boolean = false) {
@@ -73,8 +98,6 @@ object SessionFiles {
GameEnvironmentStore.publish(context)
WinComponents.publish(context)
val files = arrayOf(
"rockstar/helpers/Launcher32.exe" to "usr/local/lib/droiddeck-rockstar/Launcher32.exe",
"rockstar/helpers/Launcher64.exe" to "usr/local/lib/droiddeck-rockstar/Launcher64.exe",
"usr/local/bin/droiddeck-game-env" to "usr/local/bin/droiddeck-game-env",
"usr/local/bin/droiddeck-game-debug" to "usr/local/bin/droiddeck-game-debug",
"usr/local/bin/droiddeck-game-gpu" to "usr/local/bin/droiddeck-game-gpu",
@@ -234,7 +257,6 @@ object SessionFiles {
"usr/local/lib/droiddeck/uruntime" to "usr/local/lib/droiddeck/uruntime",
"usr/local/lib/droiddeck-pipewire.tzst" to "usr/local/lib/droiddeck-pipewire.tzst",
"usr/local/share/licenses/uruntime/LICENSE" to "usr/local/share/licenses/uruntime/LICENSE",
"usr/local/lib/droiddeck-dirt/ws2_32.dll" to "usr/local/lib/droiddeck-dirt/ws2_32.dll",
) + mangoapp + xclipse.map { it to it } + maliCompat + msitools.map { it to it } + vr + gpuLoad + fexPreloads).filter { (asset, _) ->
val dir = asset.substringBeforeLast('/')
runCatching { context.assets.list("linuxfs/$dir")?.contains(asset.substringAfterLast('/')) == true }.getOrDefault(false)
@@ -248,7 +270,7 @@ object SessionFiles {
var installed = false
try {
target.parentFile?.mkdirs()
(if (asset.startsWith("rockstar/")) requireNotNull(javaClass.getResourceAsStream("/$asset")) else context.assets.open("linuxfs/$asset")).use { input ->
context.assets.open("linuxfs/$asset").use { input ->
staged.outputStream().use { output -> FileUtils.copy(input, output) }
}
installed = staged.setExecutable(true, false) && staged.renameTo(target)
@@ -290,7 +312,7 @@ object SessionFiles {
}
if (installed) ledger.staged(key, target) else Log.e(TAG, "DirectAudio $set/$relative NOT staged")
}
stageUbisoftService(context, root, ledger)
for (pack in SERVICE_PACKS.keys) stageStoreService(context, root, pack, ledger)
ledger.save()
for (old in arrayOf("aarch64-unix", "aarch64-windows", "i386-windows")) File(root, "$DIRECTAUDIO_DIR/lib/wine/$old").deleteRecursively()
val preload = StringBuilder("/usr/local/lib/libblsession.so\n")
@@ -80,6 +80,11 @@ object StoreLaunchRequests {
lastLaunched = Store.ROCKSTAR to request.optString("id")
com.droiddeck.launcher.stores.rockstar.RockstarLaunch.prepare(app, request.optString("id"))
}.getOrElse { JSONObject().put("ok", false).put("reason", "error-" + it.javaClass.simpleName) }
"store-service" -> runCatching {
val root = com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(app)
if (com.droiddeck.launcher.session.SessionFiles.awaitStoreService(app, request.optString("store"), root)) JSONObject().put("ok", true)
else JSONObject().put("ok", false).put("reason", "service-unavailable")
}.getOrElse { JSONObject().put("ok", false).put("reason", "error-" + it.javaClass.simpleName) }
"rockstar-exited" -> {
if (lastLaunched == (Store.ROCKSTAR to request.optString("id"))) lastLaunched = null
JSONObject().put("ok", true)
@@ -141,6 +141,7 @@ object RockstarAuth {
StoreAccounts.clear(context.applicationContext, Store.ROCKSTAR)
return "ticket"
}
com.droiddeck.launcher.session.SessionFiles.ensureRockstarService(context)
return null
}
+1 -1
View File
@@ -433,7 +433,7 @@ if [[ "${DROIDDECK_SKIP_RUST:-0}" != 1 ]]; then
CARGO_TARGET_DIR="${cache_dir}/ubisoft-target" bash tools/ubisoft-launcher/build.sh "${upc_out}"
save_step ubisoft "${upc_key}" "${upc_out}"
fi
rockstar_out="${repo_root}/app/src/main/resources/rockstar/helpers"
rockstar_out="${linuxfs_dir}/usr/local/lib/droiddeck-rockstar"
rockstar_key=$(inputs_hash "windows-gnu" tools/rockstar-launcher/src tools/rockstar-launcher/Cargo.toml tools/rockstar-launcher/Cargo.lock tools/rockstar-launcher/build.sh)
if ! restore_step rockstar "${rockstar_key}" "${rockstar_out}"; then
command -v i686-w64-mingw32-gcc >/dev/null 2>&1 || { echo "i686-w64-mingw32-gcc is required for the Rockstar launcher service." >&2; exit 1; }
@@ -314,6 +314,7 @@ UBISOFT_DIR = "drive_c/Program Files (x86)/Ubisoft/Ubisoft Game Launcher"
UBISOFT_WINDOWS_DIR = "C:\\Program Files (x86)\\Ubisoft\\Ubisoft Game Launcher\\"
UBISOFT_INSTALLER_URL = "https://static3.cdn.ubi.com/orbit/launcher_installer/UbisoftConnectInstaller.exe"
ROCKSTAR_SERVICE = Path("/usr/local/lib/droiddeck-rockstar")
SERVICE_WAIT = 300.0
ROCKSTAR_FOLDER = "drive_c/Program Files/Rockstar Games/Launcher"
ROCKSTAR_TITLES = {"gta3": "Grand Theft Auto III", "gtavc": "Grand Theft Auto: Vice City", "gtasa": "GTA: San Andreas",
"gta4": "Grand Theft Auto IV", "lanoire": "LANoireMTL"}
@@ -446,6 +447,15 @@ def rockstar_runtime(folder, exe, compat_data, arch):
return "installed"
def fetch_service(service, store, launch_dir, ask_app=None):
if service.is_file():
return True
if not launch_dir:
return False
answer = (ask_app or ask)(Path(launch_dir) / "stores", {"op": "store-service", "store": store}, timeout=SERVICE_WAIT)
return isinstance(answer, dict) and bool(answer.get("ok")) and service.is_file()
def prepare_rockstar(folder, sidecar, compat_data, launch_dir, proton="", ask_app=None):
if not compat_data:
return "no-prefix"
@@ -481,7 +491,7 @@ def prepare_rockstar(folder, sidecar, compat_data, launch_dir, proton="", ask_ap
if len(signature) != 6 or signature[:4] != b"PE\0\0" or signature[4:] not in (b"\x4c\x01", b"\x64\x86"):
return "invalid-game-exe"
service = ROCKSTAR_SERVICE / ("Launcher32.exe" if signature[4:] == b"\x4c\x01" else "Launcher64.exe")
if not service.is_file():
if not fetch_service(service, "rockstar", launch_dir, ask_app):
return "no-service"
made = "present" if (Path(compat_data) / "pfx/user.reg").is_file() else create_prefix(compat_data, proton)
if made not in ("created", "present"):
@@ -723,7 +733,7 @@ def prepare_ubisoft(folder, sidecar, compat_data, launch_dir, proton="", ask_app
product = ubisoft_product(sidecar)
if product is None:
return "no-product"
if not UBISOFT_SERVICE.is_file():
if not fetch_service(UBISOFT_SERVICE, "ubisoft", launch_dir, ask_app):
return "no-service"
made = create_prefix(compat_data, proton) if not (Path(compat_data) / "pfx/user.reg").is_file() else "present"
if made not in ("present", "created"):
+2
View File
@@ -78,6 +78,8 @@ pack xbox "$linuxfs/droiddeck-xbox" version xodus-cli xodus-service
pack comet "$linuxfs/droiddeck-comet" version comet
pack powervr "$repo/app/src/main/assets/hybris" runtime.tzst version.txt
[ ! -f "$linuxfs/droiddeck-ubisoft/droiddeck-upc.exe" ] || pack ubisoft "$linuxfs/droiddeck-ubisoft" droiddeck-upc.exe
[ ! -f "$linuxfs/droiddeck-rockstar/Launcher64.exe" ] || pack rockstar "$linuxfs/droiddeck-rockstar" Launcher32.exe Launcher64.exe
[ ! -f "$linuxfs/droiddeck-dirt/ws2_32.dll" ] || pack dirt "$linuxfs/droiddeck-dirt" ws2_32.dll
mkdir "$work/butler"
fetch "https://broth.itch.zone/butler/linux-arm64/${BUTLER_VERSION}/archive/default" \
+22 -3
View File
@@ -14,12 +14,13 @@ ROOT = Path(__file__).resolve().parents[2]
MANIFEST = Path('app/build/runtime-inputs.json')
PACKS = Path('app/build/packs')
PACKED = {'assets/linuxfs/usr/local/lib/droiddeck-xbox/': 'xbox', 'assets/linuxfs/usr/local/lib/droiddeck-comet/': 'comet',
'assets/linuxfs/usr/local/lib/droiddeck-ubisoft/': 'ubisoft',
'assets/linuxfs/usr/local/lib/droiddeck-ubisoft/': 'ubisoft', 'assets/linuxfs/usr/local/lib/droiddeck-rockstar/': 'rockstar',
'assets/linuxfs/usr/local/lib/droiddeck-dirt/': 'dirt',
'assets/directaudio/': 'directaudio', 'assets/hybris/': 'powervr'}
PACKED_FILES = {'lib/arm64-v8a/libproot.so': ('proot', 'libproot.so'),
'lib/arm64-v8a/libproot-loader.so': ('proot', 'libproot-loader.so')}
PACKED_LIBRARIES = ['lib/arm64-v8a/libopencv_java4.so', 'lib/arm64-v8a/libmediapipe_tasks_jni.so']
PACK_NAMES = ['proot', 'directaudio', 'tracking', 'xbox', 'comet', 'butler', 'powervr', 'ubisoft']
PACK_NAMES = ['proot', 'directaudio', 'tracking', 'xbox', 'comet', 'butler', 'powervr', 'ubisoft', 'rockstar', 'dirt']
SOURCE_PATHS = ['app/build.gradle', 'app/src/main/cpp/fakeinput_steam.cpp', 'app/src/main/assets/pulseaudio.tzst',
'tools/linuxfs', 'tools/proot', 'tools/aaudio-sink', 'tools/directaudio', 'tools/packs',
'tools/gamescope/release.env', 'tools/droiddeck-esync/release.env',
@@ -211,12 +212,27 @@ def pack_digests(root, name):
return digests
def windows_binaries(package):
found = []
for info in package.infolist():
if info.is_dir():
continue
with package.open(info) as entry:
if entry.read(2) == b'MZ':
found.append(info.filename)
return found
def check_apk(apk, root=ROOT):
data = verify(root)
packs = {name: pack_digests(root, name) for name in PACK_NAMES
if name != 'ubisoft' or (root / PACKS / 'ubisoft.tar.zst').is_file()}
if name not in ('ubisoft', 'rockstar', 'dirt') or (root / PACKS / (name + '.tar.zst')).is_file()}
with ZipFile(apk) as package:
names = set(package.namelist())
for name in sorted(names):
prefix = next((p for p in PACKED if name.startswith(p)), None)
if prefix:
raise ValueError('APK still carries ' + name + ', which the ' + PACKED[prefix] + ' pack provides')
for library in PACKED_LIBRARIES:
if library in names:
raise ValueError('APK still carries ' + library + ', which the tracking pack provides')
@@ -243,6 +259,9 @@ def check_apk(apk, root=ROOT):
raise ValueError('APK missing ' + name)
if hashlib.sha256(content).hexdigest() != output['sha256']:
raise ValueError('APK has stale runtime input: ' + name)
found = windows_binaries(package)
if found:
raise ValueError('APK carries Windows executables, which ship in add-on packs: ' + ', '.join(found))
if __name__ == '__main__':
+1 -1
View File
@@ -12,7 +12,7 @@ GTA III defaults to full x87 precision for FEX before Wine starts, because reduc
Raw launcher identity requests use `INIT:<nonce>:` with a terminating colon. Framed requests carry their payload length. The reply echoes the complete challenge after `TINI:launcher:`; partial reads do not complete a raw request.
`build.sh` builds 32-bit and 64-bit executables with the GNU Windows targets and stages them as APK resources. `legacy-cipher.bin` contains the fixed client protocol tables, not account credentials or APK signing keys.
`build.sh` builds 32-bit and 64-bit executables with the GNU Windows targets for the `rockstar` add-on pack. The app downloads the pack after Rockstar sign-in, or when a launch finds the service missing, and stages it in the Linux runtime. `legacy-cipher.bin` contains the fixed client protocol tables, not account credentials or APK signing keys.
Run the protocol tests with:
+1 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail
here=$(cd "$(dirname "$0")" && pwd)
out=${1:-"$here/../../app/src/main/resources/rockstar/helpers"}
out=${1:-"$here/../../app/src/main/assets/linuxfs/usr/local/lib/droiddeck-rockstar"}
mkdir -p "$out"
for target in i686-pc-windows-gnu x86_64-pc-windows-gnu; do
rustup target add "$target" >/dev/null 2>&1 || true
+44
View File
@@ -36,6 +36,10 @@ class RuntimeInputsTest(unittest.TestCase):
service = self.root / 'app/src/main/assets/linuxfs/usr/local/lib/droiddeck-ubisoft/droiddeck-upc.exe'
service.parent.mkdir(parents=True)
service.write_bytes(b'MZ service')
rockstar = self.root / 'app/src/main/assets/linuxfs/usr/local/lib/droiddeck-rockstar'
rockstar.mkdir(parents=True)
(rockstar / 'Launcher32.exe').write_bytes(b'MZ launcher 32')
(rockstar / 'Launcher64.exe').write_bytes(b'MZ launcher 64')
self.audio(['pactl', 'modules/arm64/module-aaudio-sink.so', 'modules/arm64/module-directaudio-native-sink.so'])
self.packs()
@@ -189,6 +193,46 @@ class RuntimeInputsTest(unittest.TestCase):
with self.assertRaisesRegex(ValueError, 'ubisoft pack provides'):
runtime.check_apk(apk, self.root)
def test_an_apk_still_carrying_the_rockstar_service_is_rejected(self):
name = 'assets/linuxfs/usr/local/lib/droiddeck-rockstar/Launcher32.exe'
self.assertIn(name, runtime.outputs(self.root))
apk = self.current_apk(self.root / 'bundled.apk', {name: b'MZ launcher 32'})
with self.assertRaisesRegex(ValueError, 'rockstar pack provides'):
runtime.check_apk(apk, self.root)
def test_a_packed_file_the_manifest_does_not_list_is_rejected(self):
name = 'assets/linuxfs/usr/local/lib/droiddeck-rockstar/Unlisted.bin'
self.assertNotIn(name, runtime.outputs(self.root))
apk = self.current_apk(self.root / 'bundled.apk', {name: b'helper data'})
with self.assertRaisesRegex(ValueError, 'Unlisted.bin, which the rockstar pack provides'):
runtime.check_apk(apk, self.root)
def test_a_stale_rockstar_pack_is_rejected(self):
apk = self.current_apk(self.root / 'current.apk')
self.pack('rockstar', {'Launcher32.exe': b'MZ older launcher', 'Launcher64.exe': b'MZ launcher 64'})
with self.assertRaisesRegex(ValueError, 'rockstar is missing or has a stale'):
runtime.check_apk(apk, self.root)
def test_an_apk_carrying_any_windows_executable_is_rejected(self):
for name in ('assets/linuxfs/usr/local/lib/new-helper/helper.exe', 'assets/anything/renamed.bin', 'res/raw/x.dll'):
with self.subTest(name=name):
apk = self.current_apk(self.root / 'windows.apk', {name: b'MZ helper'})
with self.assertRaisesRegex(ValueError, 'Windows executables.*' + name):
runtime.check_apk(apk, self.root)
def test_an_apk_still_carrying_the_dirt_stand_in_is_rejected(self):
dirt = self.root / 'app/src/main/assets/linuxfs/usr/local/lib/droiddeck-dirt'
dirt.mkdir(parents=True)
(dirt / 'ws2_32.dll').write_bytes(b'MZ droiddeck-dirt-ws2_32')
self.packs()
name = 'assets/linuxfs/usr/local/lib/droiddeck-dirt/ws2_32.dll'
self.assertIn(name, runtime.outputs(self.root))
self.assertEqual('dirt', runtime.PACKED['assets/linuxfs/usr/local/lib/droiddeck-dirt/'])
apk = self.current_apk(self.root / 'bundled.apk', {name: b'MZ droiddeck-dirt-ws2_32'})
with self.assertRaisesRegex(ValueError, 'dirt pack provides'):
runtime.check_apk(apk, self.root)
runtime.check_apk(self.current_apk(self.root / 'current.apk'), self.root)
def test_an_apk_still_carrying_the_powervr_runtime_is_rejected(self):
apk = self.current_apk(self.root / 'bundled.apk', {'assets/hybris/runtime.tzst': b'runtime'})
with self.assertRaisesRegex(ValueError, 'powervr pack provides'):
+35
View File
@@ -165,6 +165,41 @@ class RockstarLaunch(unittest.TestCase):
self.assertEqual('rockstar-launch', requests[0]['op'])
self.assertEqual(b'compiled-helper', path.with_name('Launcher.exe').read_bytes())
def test_a_missing_service_is_fetched_from_the_app_before_launch(self):
with tempfile.TemporaryDirectory() as root:
folder, sidecar, prefix, service, answer = self.setup_game(root)
helper = (service / 'Launcher32.exe').read_bytes()
(service / 'Launcher32.exe').unlink()
requests = []
def ask(channel, request, timeout):
requests.append(request)
if request['op'] == 'store-service':
(service / 'Launcher32.exe').write_bytes(helper)
return {'ok': True}
return answer
with patch.object(store, 'ROCKSTAR_SERVICE', service), patch.object(store, 'rockstar_registry', return_value=True):
result = store.prepare_rockstar(folder, sidecar, str(prefix), str(Path(root) / 'channel'), ask_app=ask)
self.assertEqual('ready', result)
self.assertEqual([{'op': 'store-service', 'store': 'rockstar'}], requests[:1])
self.assertEqual('rockstar-launch', requests[1]['op'])
def test_an_unavailable_service_does_not_request_account_data(self):
with tempfile.TemporaryDirectory() as root:
folder, sidecar, prefix, service, _ = self.setup_game(root)
(service / 'Launcher32.exe').unlink()
requests = []
def ask(channel, request, timeout):
requests.append(request)
return {'ok': False, 'reason': 'service-unavailable'}
with patch.object(store, 'ROCKSTAR_SERVICE', service), patch.object(store, 'rockstar_registry', return_value=True):
result = store.prepare_rockstar(folder, sidecar, str(prefix), str(Path(root) / 'channel'), ask_app=ask)
self.assertEqual('no-service', result)
self.assertEqual(['store-service'], [request['op'] for request in requests])
def test_rejected_or_expired_sessions_cannot_reuse_stale_material(self):
for update in ({'ok': False, 'reason': 'not-owned'}, {'material': 'A' * 641}, {'expiresAt': 1}):
with self.subTest(update=update), tempfile.TemporaryDirectory() as root: