mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 12:35:42 +00:00
Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c40c6845eb | ||
|
|
e101a78791 | ||
|
|
aaa9fb129c | ||
|
|
8e31e07380 | ||
|
|
5ccceed827 | ||
|
|
6e581c9a56 | ||
|
|
756cd4eae9 | ||
|
|
d31ad1c279 | ||
|
|
e090db2d58 | ||
|
|
a97ade6a67 | ||
|
|
89f90812f8 |
No files matched your search
@@ -73,7 +73,6 @@ DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. V
|
||||
- DwarFS AppImages are unpacked without proot by `dwarfsextract` from [DwarFS](https://github.com/mhx/dwarfs) by Marcus Holland-Moritz (MIT), the release binary uruntime embeds, taken out of its self-extracting wrapper and shipped with its licence.
|
||||
- x86 programs linking OpenSSL 3 use the copy in the [Steam Linux Runtime 4.0](https://gitlab.steamos.cloud/steamrt/steamrt). x86 Linux games get the `/etc/asound.conf` that [pressure-vessel](https://gitlab.steamos.cloud/steamrt/steam-runtime-tools) writes.
|
||||
- `WriteProcessMemory` hooks fall back to `/proc/<pid>/mem` the way [Wine](https://gitlab.winehq.org/wine/wine)'s `server/ptrace.c` did before Wine 11.
|
||||
- Windows components give Wine Mono a `Gac=n` assembly override only for assemblies in Mono's own GAC, following the assembly search order in [Wine](https://gitlab.winehq.org/wine/wine)'s `dlls/mscoree/metahost.c`.
|
||||
- Windows programs on noexec storage get executable copies of their image pages, following [@yujikaido](https://github.com/yujikaido)'s finding in [droiddeck-rp4pro](https://github.com/yujikaido/droiddeck-rp4pro) that Wine's own processes need the noexec shim.
|
||||
- Wine write watches use userfaultfd support in [Proton](https://github.com/ValveSoftware/wine)'s `dlls/ntdll/unix/virtual.c` (LGPL-2.1-or-later). libddsession supplies the arm64 syscall number and answers `PAGEMAP_SCAN` from `/proc/self/pagemap`.
|
||||
- libddsession runs Wine's arm64 `SIGUSR2` context handler (`dlls/ntdll/unix/signal_arm64.c`, LGPL-2.1-or-later) in place on a frame laid out like [Linux](https://github.com/torvalds/linux)'s `arch/arm64/kernel/signal.c`, and serves `fill_vm_counters` in `dlls/ntdll/unix/process.c` the kernel's own `/proc/<pid>/status`.
|
||||
|
||||
@@ -349,7 +349,9 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
||||
releaseChecking = true
|
||||
autoStatus = activity.getString(R.string.drivers_checking_latest)
|
||||
Thread({
|
||||
val problem = if (force || releasesStale()) runCatching { TurnipReleases.refresh(activity) }.exceptionOrNull()?.message else null
|
||||
val failure = if (force || releasesStale()) runCatching { TurnipReleases.refresh(activity) }.exceptionOrNull() else null
|
||||
val problem = failure?.message
|
||||
val checkFailed = failure != null
|
||||
val holdBack = !force && com.droiddeck.launcher.frontend.AutoComponents.constrained(activity)
|
||||
runCatching { com.droiddeck.launcher.gpu.VulkanInfo.query() }
|
||||
ui.post {
|
||||
@@ -367,8 +369,19 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
||||
SessionPrefs.maliFallbackByAuto(activity), gpu.family.mali,
|
||||
pair?.key?.let { DriverPairs.isNonAdreno(it) } == true,
|
||||
)) endMaliFallback()
|
||||
autoStatus = problem?.let { activity.getString(R.string.drivers_up_to_date_check_failed, it) }
|
||||
?: activity.getString(R.string.upd_current_status)
|
||||
autoStatus = if (checkFailed || TurnipReleases.cached(activity)?.failed?.contains(TurnipReleases.NON_ADRENO_LABEL) == true)
|
||||
activity.getString(R.string.drivers_up_to_date_check_failed, problem ?: TurnipReleases.NON_ADRENO_LABEL)
|
||||
else activity.getString(R.string.upd_current_status)
|
||||
}
|
||||
gpu.family == GpuInfo.Family.POWERVR && (pair == null || !pair.complete) &&
|
||||
(checkFailed || TurnipReleases.cached(activity)?.failed?.contains(TurnipReleases.NON_ADRENO_LABEL) == true) -> {
|
||||
if (gpu.name.contains("Xclipse", ignoreCase = true) && DriverPairs.xclipseNeedsUpstream(gpu.name)) {
|
||||
if (!SessionState.running) SessionPrefs.ensurePowerVrAutoDrivers(activity, powerVr = true, autoOwnedOnly = true)
|
||||
} else {
|
||||
SessionPrefs.ensurePowerVrAutoDrivers(activity)
|
||||
}
|
||||
autoStatus = activity.getString(R.string.upd_couldnt_check, problem ?: TurnipReleases.NON_ADRENO_LABEL)
|
||||
refreshDrivers()
|
||||
}
|
||||
gpu.family == GpuInfo.Family.POWERVR && (pair == null || !pair.complete) -> {
|
||||
// RADV is not published right now: the Xclipse falls back to the system route.
|
||||
@@ -381,7 +394,7 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
||||
refreshDrivers()
|
||||
}
|
||||
gpu.family.mali && (pair == null || !pair.complete) &&
|
||||
(problem != null || TurnipReleases.cached(activity)?.failed?.contains(TurnipReleases.NON_ADRENO_LABEL) == true) -> {
|
||||
(checkFailed || TurnipReleases.cached(activity)?.failed?.contains(TurnipReleases.NON_ADRENO_LABEL) == true) -> {
|
||||
// The list could not be read: nothing is known to be missing, so a working route stays.
|
||||
// With no open driver, Venus or bridge the session would run the runtime's Turnip,
|
||||
// which finds no GPU on a Mali, so the stand-in goes on anyway.
|
||||
|
||||
@@ -483,12 +483,6 @@ object WinComponents {
|
||||
return dir
|
||||
}
|
||||
|
||||
internal fun nativeDlls(c: Component): List<String> = c.steps.filter { it.action == "override_dll" }.flatMap { step ->
|
||||
listOf(step.str("dll") to step.str("type")) + (step.json.optJSONArray("bundle")?.let { b ->
|
||||
(0 until b.length()).map { b.getJSONObject(it).let { o -> o.optString("value") to o.optString("data") } }
|
||||
} ?: emptyList())
|
||||
}.filter { (dll, type) -> type == "native" && validId(dll) }.map { it.first.lowercase() }.distinct()
|
||||
|
||||
private fun installPackage(context: Context, c: Component, step: Step, staging: File, onProgress: (Progress) -> Unit): Pair<JSONObject?, String> {
|
||||
val root = LinuxRuntime.rootDir(context)
|
||||
val url = step.str("url")
|
||||
@@ -506,9 +500,7 @@ object WinComponents {
|
||||
onProgress(Progress(c.name, "installing", Phase.INSTALL, 0))
|
||||
var result: JSONObject? = null
|
||||
var problem: String? = null
|
||||
val native = nativeDlls(c)
|
||||
val flags = if (native.isEmpty()) emptyList() else listOf("--native", native.joinToString(","))
|
||||
val status = GuestCommand.run(context, guest(listOf(MSI_INSTALL) + flags + listOf("/$MSI_CACHE/${file.name}", "/$STORE/${staging.name}")),
|
||||
val status = GuestCommand.run(context, guest(listOf(MSI_INSTALL, "/$MSI_CACHE/${file.name}", "/$STORE/${staging.name}")),
|
||||
logName = "wincomponents-${c.name}") { line ->
|
||||
when {
|
||||
line.startsWith("progress ") -> engineLine(line.removePrefix("progress ")).let { (text, pct) -> onProgress(Progress(c.name, text, Phase.INSTALL, pct)) }
|
||||
|
||||
@@ -121,6 +121,8 @@ object StoresState {
|
||||
var unfinished by mutableStateOf<List<StoreInstallRoot.Unfinished>>(emptyList())
|
||||
internal set
|
||||
|
||||
var steamPicking by mutableStateOf<CatalogItem?>(null)
|
||||
|
||||
fun isUnfinished(item: CatalogItem): Boolean = unfinished.any {
|
||||
it.store == item.store && (it.id == item.id || (it.id == null && it.folder.name == StoreInstallRoot.folderName(item.title, item.id)))
|
||||
}
|
||||
|
||||
@@ -6,9 +6,6 @@ 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
|
||||
@@ -46,8 +43,6 @@ internal object SteamStore {
|
||||
/** InvalidPassword, AccessDenied, AccountNotFound, Revoked, Expired, AccountLogonDenied. */
|
||||
private val REFUSALS = setOf(5, 15, 18, 26, 27, 63)
|
||||
|
||||
var picking by mutableStateOf<CatalogItem?>(null)
|
||||
|
||||
class Plan(val installDir: String, val downloadBytes: Long, val installBytes: Long, val buildId: String, val linuxBuild: Boolean) {
|
||||
companion object {
|
||||
fun of(json: JSONObject): Plan? {
|
||||
@@ -222,7 +217,7 @@ internal object SteamStore {
|
||||
toast(context, R.string.steam_store_close_steam)
|
||||
return
|
||||
}
|
||||
picking = item
|
||||
StoresState.steamPicking = item
|
||||
}
|
||||
|
||||
fun install(context: Context, item: CatalogItem, target: SteamClient.Target) {
|
||||
|
||||
@@ -847,7 +847,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 } } }
|
||||
com.droiddeck.launcher.stores.StoresState.steamPicking?.let { item -> StoreTheme(item.store) { SteamInstallWhereDialog(item) { com.droiddeck.launcher.stores.StoresState.steamPicking = null } } }
|
||||
StepsLayer(screenAt)
|
||||
UiZooSheet()
|
||||
SessionDrawerPreview(s.secondScreenDisplays)
|
||||
|
||||
@@ -2,16 +2,24 @@ package com.droiddeck.launcher
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import com.droiddeck.launcher.session.QuestExperimental
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.gpu.DriverBundle
|
||||
import com.droiddeck.launcher.gpu.DriverPairs
|
||||
import com.droiddeck.launcher.gpu.GpuInfo
|
||||
import com.droiddeck.launcher.gpu.GpuInfo.Family
|
||||
import com.droiddeck.launcher.gpu.LinuxVulkanDriverManager
|
||||
import com.droiddeck.launcher.gpu.TpUbwcHint
|
||||
import com.droiddeck.launcher.gpu.TurnipDriver
|
||||
import com.droiddeck.launcher.gpu.TurnipReleases
|
||||
import com.droiddeck.launcher.gpu.VulkanInfo
|
||||
import com.droiddeck.launcher.gpu.SystemVulkanDriver
|
||||
import com.droiddeck.launcher.session.QuestExperimental
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.wayland.CompositorHost
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertNull
|
||||
@@ -22,12 +30,16 @@ import org.junit.runner.RunWith
|
||||
import org.robolectric.Robolectric
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
import org.robolectric.Shadows.shadowOf
|
||||
import org.robolectric.annotation.Config
|
||||
import org.robolectric.shadows.ShadowBuild
|
||||
import org.robolectric.shadows.ShadowLooper
|
||||
import org.robolectric.annotation.Implementation
|
||||
import org.robolectric.annotation.Implements
|
||||
import org.robolectric.util.ReflectionHelpers
|
||||
import java.io.File
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipOutputStream
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [28], manifest = Config.NONE, shadows = [DriverMenusAutoTest.XclipseDriver::class])
|
||||
@@ -171,4 +183,118 @@ class DriverMenusAutoTest {
|
||||
menus.refreshDrivers()
|
||||
assertTrue(menus.tpUbwcRestartRequired())
|
||||
}
|
||||
|
||||
private fun library(libc: String) = ByteArray(64).also {
|
||||
byteArrayOf(0x7f, 'E'.code.toByte(), 'L'.code.toByte(), 'F'.code.toByte(), 2, 1).copyInto(it)
|
||||
it[18] = 0xB7.toByte()
|
||||
} + libc.toByteArray() + ByteArray(1)
|
||||
|
||||
private fun bundleZip(context: Context): Uri {
|
||||
val manifest = JSONObject()
|
||||
.put("package", "PanVK Mali JM").put("version", "1.0").put("tag", "panvk-mali-jm")
|
||||
.put("drivers", JSONObject()
|
||||
.put("android", JSONObject().put("path", "android"))
|
||||
.put("linux", JSONObject().put("path", "linux")))
|
||||
val file = File.createTempFile("bundle", ".zip", context.cacheDir)
|
||||
ZipOutputStream(file.outputStream()).use { z ->
|
||||
fun put(name: String, data: ByteArray) { z.putNextEntry(ZipEntry(name)); z.write(data); z.closeEntry() }
|
||||
put("manifest.json", manifest.toString().toByteArray())
|
||||
put("android/meta.json", JSONObject().put("name", "PanVK Mali JM").put("libraryName", "libvulkan_freedreno.so").toString().toByteArray())
|
||||
put("android/libvulkan_freedreno.so", library("libc.so"))
|
||||
put("linux/meta.json", JSONObject().put("name", "PanVK Mali JM").toString().toByteArray())
|
||||
put("linux/libvulkan_freedreno.so", library("libc.so.6"))
|
||||
}
|
||||
return Uri.fromFile(file)
|
||||
}
|
||||
|
||||
private fun setCachedMaliJmPair(context: Context, assetName: String = "PanVK-JM-Pair.zip") {
|
||||
val asset = JSONObject()
|
||||
.put("source", TurnipReleases.NON_ADRENO_LABEL).put("tag", "panvk-mali-jm")
|
||||
.put("name", assetName).put("url", "https://example/$assetName")
|
||||
.put("size", 1L).put("linux", false).put("label", "Android + Linux · PanVK Mali JM")
|
||||
.put("sha256", "0".repeat(64)).put("pair", DriverPairs.NAD_MALI_JM)
|
||||
.put("bundle", true).put("id", 1L).put("updated_at", "2026-01-01T00:00:00Z")
|
||||
val stored = JSONObject().put("assets", JSONArray().put(asset))
|
||||
.put("latest", JSONArray()).put("failed", JSONArray())
|
||||
.put("checkedAt", System.currentTimeMillis())
|
||||
context.getSharedPreferences("turnip_releases", Context.MODE_PRIVATE)
|
||||
.edit().putString("latest", stored.toString()).commit()
|
||||
}
|
||||
|
||||
private fun prepareActiveMaliJmPair(assetName: String = "PanVK-JM-Pair.zip"): Pair<Activity, DriverMenus> {
|
||||
ShadowBuild.setModel("Generic phone")
|
||||
ShadowBuild.setDevice("generic")
|
||||
val activity = Robolectric.buildActivity(Activity::class.java).setup().get()
|
||||
val bundle = DriverBundle.install(activity, bundleZip(activity))
|
||||
setCachedMaliJmPair(activity, assetName)
|
||||
TurnipReleases.recordDownload(activity, TurnipReleases.cached(activity)!!.assets.first(), bundle.id)
|
||||
SessionPrefs.setGpuDriverMode(activity, SessionPrefs.GPU_DRIVERS_AUTO)
|
||||
SessionPrefs.setAndroidDriver(activity, TurnipDriver.AUTO)
|
||||
SessionPrefs.setLinuxDriver(activity, bundle.linuxId)
|
||||
val menus = DriverMenus(activity, Handler(Looper.getMainLooper()))
|
||||
ReflectionHelpers.setField(menus, "gpu", GpuInfo("Mali-G78", 78, Family.MALI_JM, "", false))
|
||||
menus.refreshDrivers()
|
||||
return activity to menus
|
||||
}
|
||||
|
||||
@Test fun activeRecommendedPairWithNullRefreshFailureShowsCheckFailureStatus() {
|
||||
val (activity, menus) = prepareActiveMaliJmPair()
|
||||
val original = TurnipReleases.fetch
|
||||
TurnipReleases.fetch = { _, _, _ -> throw java.io.IOException(null as String?) }
|
||||
try {
|
||||
menus.ensureAuto(force = true)
|
||||
for (i in 0..40) {
|
||||
shadowOf(Looper.getMainLooper()).idle()
|
||||
Thread.sleep(50)
|
||||
shadowOf(Looper.getMainLooper()).idle()
|
||||
if (!menus.releaseChecking) break
|
||||
}
|
||||
assertEquals(activity.getString(R.string.drivers_up_to_date_check_failed, TurnipReleases.NON_ADRENO_LABEL), menus.autoStatus)
|
||||
} finally { TurnipReleases.fetch = original }
|
||||
}
|
||||
|
||||
@Test fun activeRecommendedPairWithSuccessfulRefreshShowsCurrentStatus() {
|
||||
val (activity, menus) = prepareActiveMaliJmPair()
|
||||
menus.ensureAuto(force = false)
|
||||
for (i in 0..40) {
|
||||
shadowOf(Looper.getMainLooper()).idle()
|
||||
Thread.sleep(50)
|
||||
shadowOf(Looper.getMainLooper()).idle()
|
||||
if (!menus.releaseChecking) break
|
||||
}
|
||||
assertEquals(activity.getString(R.string.upd_current_status), menus.autoStatus)
|
||||
}
|
||||
|
||||
@Test fun activeRecommendedPairWithSuccessfulForcedRefreshShowsCurrentStatus() {
|
||||
val (activity, menus) = prepareActiveMaliJmPair("PanVK-Mali-JM-Pair.zip")
|
||||
val asset = TurnipReleases.cached(activity)!!.assets.single()
|
||||
val releases = JSONArray().put(JSONObject()
|
||||
.put("tag_name", asset.tag)
|
||||
.put("assets", JSONArray().put(JSONObject()
|
||||
.put("name", asset.name).put("browser_download_url", asset.url)
|
||||
.put("digest", "sha256:" + asset.sha256).put("size", 1L)
|
||||
.put("id", 1L).put("updated_at", "2026-01-01T00:00:00Z"))))
|
||||
val original = TurnipReleases.fetch
|
||||
val requests = java.util.concurrent.atomic.AtomicInteger()
|
||||
TurnipReleases.fetch = { _, _, url ->
|
||||
if (url.contains("droiddeck-nonadreno-drivers/releases")) {
|
||||
requests.incrementAndGet()
|
||||
releases.toString()
|
||||
} else "[]"
|
||||
}
|
||||
try {
|
||||
menus.ensureAuto(force = true)
|
||||
for (i in 0..40) {
|
||||
shadowOf(Looper.getMainLooper()).idle()
|
||||
Thread.sleep(50)
|
||||
shadowOf(Looper.getMainLooper()).idle()
|
||||
if (!menus.releaseChecking) break
|
||||
}
|
||||
assertFalse(menus.releaseChecking)
|
||||
assertTrue(requests.get() > 0)
|
||||
assertTrue(TurnipReleases.cached(activity)!!.failed.isEmpty())
|
||||
assertEquals(activity.getString(R.string.upd_current_status), menus.autoStatus)
|
||||
} finally { TurnipReleases.fetch = original }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,14 +32,6 @@ class WinComponentsSupportTest {
|
||||
step("install_msi", "url" to "$base/ps-x86.msi"), step("install_msi", "url" to "$base/ps-x64.msi"))))
|
||||
}
|
||||
|
||||
@Test fun onlyDllsOrderedNativeAreKeptFromDownlevelSystemComponents() {
|
||||
val c = component("dotnet40", step("override_dll", "dll" to "MSCOREE", "type" to "native"),
|
||||
step("override_dll", "dll" to "fusion", "type" to "builtin"), step("override_dll", "dll" to "msvcr100"),
|
||||
step("override_dll", "dll" to "../x", "type" to "native"), step("install_exe", "url" to "$base/dotnet40.exe"))
|
||||
assertEquals(listOf("mscoree"), WinComponents.nativeDlls(c))
|
||||
assertEquals(emptyList<String>(), WinComponents.nativeDlls(component("xna40", step("install_msi", "url" to "$base/xna40.msi"))))
|
||||
}
|
||||
|
||||
@Test fun builtInArm64RuntimeInstallsTheRedistributable() {
|
||||
val c = WinComponents.builtInArm64Runtime()
|
||||
assertEquals(Support.READY, support(c))
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.droiddeck.launcher.stores.steam
|
||||
|
||||
import androidx.compose.runtime.State
|
||||
import androidx.compose.runtime.snapshots.Snapshot
|
||||
import androidx.compose.runtime.snapshots.StateObject
|
||||
import com.droiddeck.launcher.stores.StoresState
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [33], manifest = Config.NONE)
|
||||
class SteamPickingSnapshotTest {
|
||||
@Test
|
||||
fun theInstallPickerIsReadableInASnapshotOpenedBeforeTheSteamEngineStarts() {
|
||||
StoresState.steamPicking = null
|
||||
val snapshot = Snapshot.takeMutableSnapshot()
|
||||
try {
|
||||
thread { SteamStore.hashCode() }.join()
|
||||
assertNull(snapshot.enter { StoresState.steamPicking })
|
||||
} finally {
|
||||
snapshot.dispose()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theSteamEngineHoldsNoComposeState() {
|
||||
val stateFields = SteamStore::class.java.declaredFields.filter {
|
||||
StateObject::class.java.isAssignableFrom(it.type) || State::class.java.isAssignableFrom(it.type)
|
||||
}
|
||||
assertTrue(stateFields.joinToString { it.name }, stateFields.isEmpty())
|
||||
}
|
||||
}
|
||||
Vendored
+1
-1
Submodule external/MaliBridge updated: 64a3f22354...95a1e600a5.
@@ -50,8 +50,6 @@ SYSTEM_PROPERTIES = {
|
||||
"Msix64": "6", "ALLUSERS": "1", "Privileged": "1", "AdminUser": "1", "MsiNTProductType": "1",
|
||||
"UILevel": "2", "INSTALLLEVEL": "1", "ProgramFilesFolder": None, "VersionMsi": "5.00",
|
||||
}
|
||||
DOWNLEVEL_PROPERTIES = {"VersionNT": "502", "VersionNT64": "502", "WindowsBuild": "3790", "ServicePackLevel": "2"}
|
||||
SYSTEM_DIRS = ("drive_c/windows/system32", "drive_c/windows/syswow64")
|
||||
|
||||
NATIVE_ARCHITECTURE = {"intel": "x86", "x64": "AMD64", "amd64": "AMD64", "arm64": "ARM64"}
|
||||
ARCHITECTURE_VALUE = ("system\\currentcontrolset\\control\\session manager\\environment", "processor_architecture")
|
||||
@@ -325,9 +323,8 @@ def clr_version(path):
|
||||
|
||||
|
||||
class Installer:
|
||||
def __init__(self, msi, out, package=None, span=None, native=()):
|
||||
def __init__(self, msi, out, package=None, span=None):
|
||||
self.pkg = package or Package(msi)
|
||||
self.native = {name.lower() for name in native}
|
||||
self.out = Path(out)
|
||||
self.span = span or Span()
|
||||
self.notes = []
|
||||
@@ -482,19 +479,10 @@ class Installer:
|
||||
owners = mapped.get(name)
|
||||
if owners is not None and not owners & self.included_features:
|
||||
continue
|
||||
if not self.conditions.evaluate(row.get("Condition", ""), default=True) and not self.downlevel_native(row):
|
||||
if not self.conditions.evaluate(row.get("Condition", ""), default=True):
|
||||
continue
|
||||
self.included_components.add(name)
|
||||
|
||||
def downlevel_native(self, row):
|
||||
if not self.native or (self.directory(row.get("Directory_", "")) or "").lower() not in SYSTEM_DIRS:
|
||||
return False
|
||||
key = next((f for f in self.pkg.table("File") if f["File"] == row.get("KeyPath")), None)
|
||||
if key is None or Path(long_name(key["FileName"])).stem.lower() not in self.native:
|
||||
return False
|
||||
props = dict(self.props, **DOWNLEVEL_PROPERTIES)
|
||||
return Conditions(props, self.feature_state, self.component_state).evaluate(row.get("Condition", ""), default=False)
|
||||
|
||||
def assemblies(self):
|
||||
names = {}
|
||||
for row in self.pkg.table("MsiAssemblyName"):
|
||||
@@ -900,7 +888,7 @@ def choose_packages(found, root):
|
||||
return native or top
|
||||
|
||||
|
||||
def install_wrapper(path, out, native=()):
|
||||
def install_wrapper(path, out):
|
||||
total = {"product": "", "version": "", "counts": {"files": 0, "assemblies": 0, "registry": 0}, "notes": [], "packages": []}
|
||||
with tempfile.TemporaryDirectory(dir=str(out.parent), prefix=".unpack-") as work:
|
||||
dest = Path(work) / "x"
|
||||
@@ -913,7 +901,7 @@ def install_wrapper(path, out, native=()):
|
||||
lo, hi = 0.1 + 0.9 * index / len(packages), 0.1 + 0.9 * (index + 1) / len(packages)
|
||||
progress("package %d of %d: %s" % (index + 1, len(packages), package.name), lo)
|
||||
try:
|
||||
result = Installer(str(package), out, span=Span(lo, hi), native=native).install()
|
||||
result = Installer(str(package), out, span=Span(lo, hi)).install()
|
||||
except MsiError as error:
|
||||
if "installs nothing" in str(error) and len(packages) > 1:
|
||||
total["notes"].append("%s: %s" % (package.name, error))
|
||||
@@ -967,10 +955,6 @@ def unpack_only(path, dest):
|
||||
|
||||
def main():
|
||||
args = sys.argv[1:]
|
||||
native = []
|
||||
while len(args) > 1 and args[0] == "--native":
|
||||
native += [name for name in args[1].split(",") if name]
|
||||
args = args[2:]
|
||||
if len(args) == 3 and args[0] == "--unpack":
|
||||
try:
|
||||
result = unpack_only(Path(args[1]), Path(args[2]))
|
||||
@@ -980,16 +964,16 @@ def main():
|
||||
print("result " + json.dumps(result), flush=True)
|
||||
return 0
|
||||
if len(args) != 2:
|
||||
print("usage: droiddeck-msi-install [--native dll,...] <package.msi | installer.exe> <component dir>\n"
|
||||
print("usage: droiddeck-msi-install <package.msi | installer.exe> <component dir>\n"
|
||||
" droiddeck-msi-install --unpack <archive> <dir>", file=sys.stderr)
|
||||
return 2
|
||||
source, out = Path(args[0]), Path(args[1])
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
try:
|
||||
if kind_of(source) == "msi":
|
||||
result = Installer(str(source), out, native=native).install()
|
||||
result = Installer(str(source), out).install()
|
||||
else:
|
||||
result = install_wrapper(source, out, native)
|
||||
result = install_wrapper(source, out)
|
||||
except MsiError as error:
|
||||
print("error " + str(error), flush=True)
|
||||
return 1
|
||||
|
||||
@@ -23,7 +23,6 @@ BUILTIN_MARKS = (b"Wine builtin DLL", b"Wine placeholder DLL")
|
||||
ARCH_DIRS = ("system32", "syswow64")
|
||||
ID = re.compile(r"[A-Za-z0-9][A-Za-z0-9._-]{0,63}")
|
||||
HIVES = {"HKLM": "system.reg", "HKCU": "user.reg"}
|
||||
PROTON_MONO = ("files/share/wine/mono", "dist/share/wine/mono")
|
||||
VALUE_TYPES = {"key", "sz", "expand_sz", "multi_sz", "dword", "binary", "append", "prepend"}
|
||||
|
||||
|
||||
@@ -45,7 +44,7 @@ def wanted(app_id, selection=SELECTION):
|
||||
return ids
|
||||
|
||||
|
||||
def component(store, cid, mono=frozenset()):
|
||||
def component(store, cid):
|
||||
root = Path(store) / cid
|
||||
try:
|
||||
with open(root / "component.json", encoding="utf-8") as source:
|
||||
@@ -66,40 +65,7 @@ def component(store, cid, mono=frozenset()):
|
||||
if entry.is_file() and not entry.is_symlink():
|
||||
files.append(("drive_c/" + entry.relative_to(drive).as_posix(), entry))
|
||||
requires = [r for r in meta.get("requires", []) if valid_id(r)]
|
||||
overrides = [str(o) for o in meta.get("overrides", [])]
|
||||
values = registry_values(root)
|
||||
if any(o.strip().lower() == "mscoree=n" for o in overrides):
|
||||
assemblies = set()
|
||||
for rel, _ in files:
|
||||
parts = Path(rel.lower()).parts
|
||||
gac_paths = (("windows", "assembly"), ("windows", "microsoft.net", "assembly"))
|
||||
if rel.lower().endswith(".dll") and Path(rel).stem.lower() in mono and any(
|
||||
parts[i:i + len(prefix)] == prefix
|
||||
and i + len(prefix) < len(parts)
|
||||
and (parts[i + len(prefix)] == "gac" or parts[i + len(prefix)].startswith("gac_"))
|
||||
for prefix in gac_paths for i in range(len(parts) - len(prefix))):
|
||||
assemblies.add(Path(rel).stem)
|
||||
assemblies = sorted(assemblies)
|
||||
values = [{"hive": "HKCU", "key": "Software\\Wine\\Mono\\AsmOverrides", "name": name,
|
||||
"type": "sz", "data": "Gac=n", "generated": True} for name in assemblies] + values
|
||||
return overrides, files, requires, values
|
||||
|
||||
|
||||
def mono_assemblies(pfx, proton=None):
|
||||
candidates = [[spelled(Path(pfx) / "drive_c/windows/mono/mono-2.0/lib/mono/gac")]]
|
||||
if proton:
|
||||
candidates += [sorted((Path(proton).parent / home).glob("wine-mono*/lib/mono/gac")) for home in PROTON_MONO]
|
||||
for gacs in candidates:
|
||||
names = set()
|
||||
for gac in gacs:
|
||||
try:
|
||||
with os.scandir(gac) as entries:
|
||||
names.update(entry.name.lower() for entry in entries if entry.is_dir())
|
||||
except OSError:
|
||||
pass
|
||||
if names:
|
||||
return names
|
||||
return set()
|
||||
return [str(o) for o in meta.get("overrides", [])], files, requires, registry_values(root)
|
||||
|
||||
|
||||
def registry_values(root):
|
||||
@@ -452,8 +418,7 @@ def apply_registry(pfx, values, state, held=()):
|
||||
files[hive] = RegistryFile(pfx / name)
|
||||
old = state.get("registry") if isinstance(state.get("registry"), dict) else {}
|
||||
keep, notes, written, waiting = {}, [], 0, 0
|
||||
ordered = [item for item in values if item[1].get("generated")] + [item for item in values if not item[1].get("generated")]
|
||||
for cid, value in ordered:
|
||||
for cid, value in values:
|
||||
reg = files.get(value["hive"])
|
||||
if reg is None:
|
||||
waiting += 1
|
||||
@@ -597,9 +562,8 @@ def apply(compat_path, app_id, selection=SELECTION, store=STORE, pending=PENDING
|
||||
saved_requires = dict(saved_requires, **{cid: loose})
|
||||
inferred.add(cid)
|
||||
kept_overrides, kept_requires = {}, {}
|
||||
mono = mono_assemblies(pfx, proton)
|
||||
for cid in expand(store, ids, saved_requires):
|
||||
found = component(store, cid, mono)
|
||||
found = component(store, cid)
|
||||
if found is None:
|
||||
if cid in saved_requires or cid in recorded or cid in owners or cid in registry_owners:
|
||||
held.add(cid)
|
||||
@@ -719,10 +683,10 @@ def overrides_value(names):
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) not in (3, 4):
|
||||
print("usage: droiddeck-wincomponents <compatdata dir> <appid> [proton]", file=sys.stderr)
|
||||
if len(sys.argv) != 3:
|
||||
print("usage: droiddeck-wincomponents <compatdata dir> <appid>", file=sys.stderr)
|
||||
return 2
|
||||
names, notes = apply(sys.argv[1], sys.argv[2], proton=sys.argv[3] if len(sys.argv) == 4 else None)
|
||||
names, notes = apply(sys.argv[1], sys.argv[2])
|
||||
for note in notes:
|
||||
print(note)
|
||||
print("WINEDLLOVERRIDES=" + overrides_value(names))
|
||||
|
||||
@@ -452,7 +452,8 @@ static int ddnatv_execve(const char *filename, char *const argv[], char *const e
|
||||
char resolved_target[PATH_MAX];
|
||||
|
||||
// Only intercept binaries/scripts within DDNATV_ROOT
|
||||
if ((g_ddnatv_root[0] != '\0' && strncmp(target, g_ddnatv_root, g_ddnatv_root_len) == 0) || is_mapped_guest_path(filename)) {
|
||||
if ((g_ddnatv_root[0] != '\0' && strncmp(target, g_ddnatv_root, g_ddnatv_root_len) == 0) || is_mapped_guest_path(filename) ||
|
||||
is_bound_guest_program(target)) {
|
||||
struct exec_probe probe;
|
||||
const char *elf_target = select_exec_target(target, resolved_target, sizeof(resolved_target), &probe);
|
||||
if (probe.is_elf && !probe.is_dynamic) static_elf = elf_target;
|
||||
@@ -969,7 +970,8 @@ static int ddnatv_posix_spawn(pid_t *pid, const char *path,
|
||||
}
|
||||
|
||||
char *const *orig_ep = envp ? envp : environ;
|
||||
int in_root = (g_ddnatv_root[0] != '\0' && strncmp(target, g_ddnatv_root, g_ddnatv_root_len) == 0) || is_mapped_guest_path(path);
|
||||
int in_root = (g_ddnatv_root[0] != '\0' && strncmp(target, g_ddnatv_root, g_ddnatv_root_len) == 0) || is_mapped_guest_path(path) ||
|
||||
is_bound_guest_program(target);
|
||||
|
||||
struct exec_probe probe;
|
||||
char resolved_target[PATH_MAX];
|
||||
|
||||
@@ -983,6 +983,14 @@ static int is_host_interpreter(const char *interp, const char *rewritten) {
|
||||
return probe.android_interp;
|
||||
}
|
||||
|
||||
static int is_bound_guest_program(const char *path) {
|
||||
if (g_ddnatv_root[0] == '\0' || !is_identity_bound_path(path)) return 0;
|
||||
struct exec_probe probe;
|
||||
probe_exec_file(path, &probe);
|
||||
if (probe.is_elf) return probe.is_dynamic && !probe.android_interp;
|
||||
return probe.n >= 2 && probe.hdr[0] == '#' && probe.hdr[1] == '!';
|
||||
}
|
||||
|
||||
// argv for running `script` with its interpreter: interp [arg] script args... (the script's own
|
||||
// argv[0] is dropped, as the kernel does). free() the result.
|
||||
static char **build_script_argv(const char *interp, const char *interp_arg, const char *script, char *const argv[]) {
|
||||
|
||||
@@ -234,6 +234,13 @@ static int is_mapped_guest_path(const char *path) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int is_identity_bound_path(const char *path) {
|
||||
if (!path || path[0] != '/') return 0;
|
||||
for (int i = 0; i < g_nbinds; i++)
|
||||
if (g_binds[i].identity && is_path_prefix(path, g_binds[i].dst, g_binds[i].dst_len)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Android's own mounts and files, which must never be redirected into the rootfs.
|
||||
// `path` starts with '/'; a prefix can only match when its second character does.
|
||||
static int is_android_host_path(const char *path) {
|
||||
|
||||
@@ -29,8 +29,8 @@ def rows(columns, *values):
|
||||
return [dict(zip(names, value)) for value in values]
|
||||
|
||||
|
||||
def installer(tables, out="/tmp/unused", summary=None, native=()):
|
||||
return MSI["Installer"]("fake.msi", out, FakePackage(tables, summary), native=native)
|
||||
def installer(tables, out="/tmp/unused", summary=None):
|
||||
return MSI["Installer"]("fake.msi", out, FakePackage(tables, summary))
|
||||
|
||||
|
||||
class ChoosePackagesTest(unittest.TestCase):
|
||||
@@ -174,40 +174,6 @@ class LayoutTest(unittest.TestCase):
|
||||
inst.select()
|
||||
self.assertEqual(inst.included_components, {"Up", "Wide"})
|
||||
|
||||
def downlevel_shim(self, native, directory="SysShim", key="ShimDll", condition="VersionNT < 600"):
|
||||
inst = installer({
|
||||
"Directory": rows("Directory Directory_Parent DefaultDir",
|
||||
("TARGETDIR", "", "SourceDir"),
|
||||
("ProgramFilesFolder", "TARGETDIR", "PFiles"),
|
||||
("AppDir", "ProgramFilesFolder", "App"),
|
||||
("SysShim", "TARGETDIR", "Win")),
|
||||
"CustomAction": rows("Action Type Source Target", ("SetSys", "51", "SysShim", "[SystemFolder]")),
|
||||
"InstallExecuteSequence": rows("Action Condition Sequence", ("SetSys", "", "1")),
|
||||
"Feature": rows("Feature Feature_Parent Level", ("Main", "", "1")),
|
||||
"Component": rows("Component Directory_ Attributes Condition KeyPath",
|
||||
("Shim", directory, "0", condition, key),
|
||||
("Old", "SysShim", "0", "VersionNT < 600", "OldDll"),
|
||||
("Vista", "SysShim", "0", "VersionNT = 600", "VistaDll")),
|
||||
"FeatureComponents": rows("Feature_ Component_", ("Main", "Shim"), ("Main", "Old"), ("Main", "Vista")),
|
||||
"File": rows("File Component_ FileName", ("ShimDll", "Shim", "MSCOREE.DLL|mscoree.dll"),
|
||||
("OldDll", "Old", "dxva2.dll"), ("VistaDll", "Vista", "mscoree.dll")),
|
||||
}, native=native)
|
||||
inst.run_set_actions()
|
||||
inst.select()
|
||||
return inst.included_components
|
||||
|
||||
def test_a_native_override_keeps_a_system_file_newer_windows_ships_itself(self):
|
||||
self.assertEqual(self.downlevel_shim(["mscoree"]), {"Shim"})
|
||||
|
||||
def test_without_a_native_override_os_version_conditions_still_apply(self):
|
||||
self.assertEqual(self.downlevel_shim([]), set())
|
||||
self.assertEqual(self.downlevel_shim(["mscorwks"]), set())
|
||||
|
||||
def test_only_system_folders_and_downlevel_conditions_are_relaxed(self):
|
||||
self.assertEqual(self.downlevel_shim(["mscoree"], directory="AppDir"), set())
|
||||
self.assertEqual(self.downlevel_shim(["mscoree"], condition="VersionNT = 600"), set())
|
||||
self.assertEqual(self.downlevel_shim(["mscoree"], condition="VersionNT < 600 AND VersionNT64"), {"Shim"})
|
||||
|
||||
def architecture_package(self, platform, key="SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", name="PROCESSOR_ARCHITECTURE"):
|
||||
return installer({
|
||||
"Feature": rows("Feature Feature_Parent Level", ("Main", "", "1")),
|
||||
|
||||
@@ -120,6 +120,14 @@ class NativeHookLdsoSpawnTest(unittest.TestCase):
|
||||
script.parent.mkdir(exist_ok=True)
|
||||
script.write_text(f"#!{interpreter}\n")
|
||||
script.chmod(0o755)
|
||||
cls.app_files = tmp / "app-files"
|
||||
cls.app_files.mkdir()
|
||||
shutil.copy(cls.probe, cls.app_files / "tool")
|
||||
shutil.copy(cls.android / "sh", cls.app_files / "android-tool")
|
||||
for name, interpreter in (("guest.py", GUEST_TOOL), ("android.sh", f"{ANDROID_DIR}/sh")):
|
||||
(cls.app_files / name).write_text(f"#!{interpreter}\n")
|
||||
for entry in cls.app_files.iterdir():
|
||||
entry.chmod(0o755)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
@@ -220,6 +228,32 @@ class NativeHookLdsoSpawnTest(unittest.TestCase):
|
||||
call = self.call(how, "/opt/host.sh", "x", binds=f"{self.runtime}:{BOUND_DIR}")
|
||||
self.assertEqual([HOST_SHELL, HOST_SHELL, str(self.root / "opt/host.sh"), "x"], call)
|
||||
|
||||
def test_a_script_on_a_mount_at_its_host_path_runs_with_the_guest_interpreter(self):
|
||||
script = str(self.app_files / "guest.py")
|
||||
for how in ("exec", "spawn"):
|
||||
with self.subTest(how=how):
|
||||
call = self.call(how, script, "x", binds=f"{self.app_files}:{self.app_files}")
|
||||
self.assertEqual(str(self.root / GUEST_LDSO.lstrip("/")), call[0])
|
||||
self.assertEqual([str(self.root / GUEST_TOOL.lstrip("/")), script, "x"], call[-3:])
|
||||
|
||||
def test_a_glibc_program_on_a_mount_at_its_host_path_starts_through_the_guest_ldso(self):
|
||||
tool = str(self.app_files / "tool")
|
||||
for how in ("exec", "spawn"):
|
||||
with self.subTest(how=how):
|
||||
call = self.call(how, tool, "x", binds=f"{self.app_files}:{self.app_files}")
|
||||
self.assertEqual(str(self.root / GUEST_LDSO.lstrip("/")), call[0])
|
||||
self.assertEqual([tool, "x"], call[-2:])
|
||||
|
||||
def test_android_programs_on_a_mount_at_its_host_path_stay_on_the_host(self):
|
||||
tool = str(self.app_files / "android-tool")
|
||||
script = str(self.app_files / "android.sh")
|
||||
sh = str(self.android / "sh")
|
||||
binds = f"{self.app_files}:{self.app_files}|{self.android}:{ANDROID_DIR}"
|
||||
for how in ("exec", "spawn"):
|
||||
with self.subTest(how=how):
|
||||
self.assertEqual([tool, tool, "x"], self.call(how, tool, "x", binds=binds))
|
||||
self.assertEqual([sh, sh, script, "x"], self.call(how, script, "x", binds=binds))
|
||||
|
||||
def test_an_android_interpreter_reached_through_a_bind_stays_on_the_host(self):
|
||||
sh = str(self.android / "sh")
|
||||
for how in ("exec", "spawn"):
|
||||
|
||||
@@ -19,7 +19,6 @@ class WinComponentsTest(unittest.TestCase):
|
||||
self.compat = root / "compatdata/2571976725"
|
||||
self.selection = root / "wincomponents.json"
|
||||
self.pfx = self.compat / "pfx/drive_c/windows"
|
||||
self.mono_proton = root / "mono-proton"
|
||||
|
||||
def tearDown(self):
|
||||
self.tmp.cleanup()
|
||||
@@ -36,12 +35,8 @@ class WinComponentsTest(unittest.TestCase):
|
||||
def pick(self, *ids):
|
||||
self.selection.write_text(json.dumps({"version": 1, "games": {"2571976725": list(ids)}}))
|
||||
|
||||
def mono(self, *names, home="files/share/wine/mono/wine-mono"):
|
||||
for name in names:
|
||||
(self.mono_proton / home / "lib/mono/gac" / name / "4.0.0.0__b77a5c561934e089").mkdir(parents=True)
|
||||
|
||||
def apply(self, proton=None, env=None):
|
||||
return MODULE["apply"](self.compat, "2571976725", self.selection, self.store, proton=proton or self.mono_proton / "proton", env=env)
|
||||
return MODULE["apply"](self.compat, "2571976725", self.selection, self.store, proton=proton, env=env)
|
||||
|
||||
def proton(self, arm=True):
|
||||
root = Path(self.tmp.name) / ("arm-proton" if arm else "x64-proton")
|
||||
@@ -460,24 +455,6 @@ class WinComponentsTest(unittest.TestCase):
|
||||
self.assertEqual(GAME_ENV["win_components"](str(self.compat) + "/", "2571976725"), "openal32=n,b")
|
||||
self.assertEqual(GAME_ENV["win_components"]("", "2571976725"), "")
|
||||
|
||||
def test_game_env_hands_proton_to_the_mono_check(self):
|
||||
self.component("framework", ["mscoree=n"], {
|
||||
"drive_c/windows/Microsoft.NET/assembly/GAC_MSIL/System/v4/System.dll": b"system",
|
||||
})
|
||||
self.mono("System")
|
||||
self.pfx.parent.mkdir(parents=True)
|
||||
user = self.compat / "pfx/user.reg"
|
||||
user.write_text("WINE REGISTRY Version 2\n")
|
||||
self.pick("framework")
|
||||
globals_ = GAME_ENV["win_components"].__globals__
|
||||
real = runpy.run_path(str(BIN / "droiddeck-wincomponents"))
|
||||
real["apply"].__defaults__ = (self.selection, self.store, self.selection.parent / "no-pending.json", None, None, None)
|
||||
with mock.patch.dict(globals_, {"runpy": mock.Mock(run_path=lambda _path: real)}):
|
||||
self.assertEqual(GAME_ENV["win_components"](str(self.compat), "2571976725", str(self.mono_proton / "proton")),
|
||||
"mscoree=n,b")
|
||||
registry = MODULE["RegistryFile"](user)
|
||||
self.assertEqual(registry.get("Software\\Wine\\Mono\\AsmOverrides", "System"), '"System"="Gac=n"')
|
||||
|
||||
def test_bundle_brings_its_parts_and_catalog_names_with_dots_work(self):
|
||||
self.component("dmband", ["dmband"], {"syswow64/dmband.dll": b"band"})
|
||||
self.component("dsound", ["dsound=n"], {"syswow64/dsound.dll": b"ds"})
|
||||
@@ -522,153 +499,6 @@ class WinComponentsTest(unittest.TestCase):
|
||||
self.assertEqual(MODULE["overrides_value"](names), "mscoree=n,b")
|
||||
self.assertIn("mscoree=n has no native DLL in the prefix; using n,b", notes)
|
||||
|
||||
def test_framework_gac_component_disables_windows_gac_for_mono(self):
|
||||
self.component("dotnet48", ["mscoree=n"], {
|
||||
"drive_c/windows/Microsoft.NET/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll": b"system",
|
||||
})
|
||||
self.mono("System")
|
||||
self.pfx.parent.mkdir(parents=True)
|
||||
user = self.compat / "pfx/user.reg"
|
||||
user.write_text("WINE REGISTRY Version 2\n")
|
||||
self.pick("dotnet48")
|
||||
self.apply()
|
||||
self.assertIn(
|
||||
'"System"="Gac=n"',
|
||||
user.read_text(),
|
||||
)
|
||||
self.pick()
|
||||
self.apply()
|
||||
self.assertNotIn('"System"="Gac=n"', user.read_text())
|
||||
|
||||
def test_msi_clr2_and_unsuffixed_gac_assemblies_disable_windows_gac_for_mono(self):
|
||||
self.component("dotnet", ["mscoree=n"], {
|
||||
"drive_c/windows/assembly/GAC_MSIL/System/v2.0.0.0__b77a5c561934e089/System.dll": b"system",
|
||||
"drive_c/windows/assembly/GAC/Legacy/v1.0.0.0__1234567890abcdef/Legacy.dll": b"legacy",
|
||||
})
|
||||
self.mono("System", "Legacy", home="dist/share/wine/mono/wine-mono-7.4.0")
|
||||
self.pfx.parent.mkdir(parents=True)
|
||||
user = self.compat / "pfx/user.reg"
|
||||
user.write_text("WINE REGISTRY Version 2\n")
|
||||
self.pick("dotnet")
|
||||
self.apply()
|
||||
registry = MODULE["RegistryFile"](user)
|
||||
key = "Software\\Wine\\Mono\\AsmOverrides"
|
||||
self.assertEqual(registry.get(key, "System"), '"System"="Gac=n"')
|
||||
self.assertEqual(registry.get(key, "Legacy"), '"Legacy"="Gac=n"')
|
||||
|
||||
def test_framework_gac_override_keeps_other_assemblies_and_explicit_component_values(self):
|
||||
self.component("framework", ["mscoree=n"], {
|
||||
"drive_c/windows/Microsoft.NET/assembly/GAC_MSIL/System/v4/System.dll": b"system",
|
||||
"drive_c/windows/Microsoft.NET/assembly/GAC_MSIL/System.Core/v4/System.Core.dll": b"core",
|
||||
})
|
||||
self.mono("System", "System.Core")
|
||||
key = "Software\\Wine\\Mono\\AsmOverrides"
|
||||
(self.store / "framework/registry.json").write_text(json.dumps({"values": [
|
||||
{"hive": "HKCU", "key": key, "name": "System", "type": "sz", "data": "Gac=y"},
|
||||
]}))
|
||||
self.pfx.parent.mkdir(parents=True)
|
||||
user = self.compat / "pfx/user.reg"
|
||||
original = ('WINE REGISTRY Version 2\n\n' + MODULE["reg_key_line"](key)
|
||||
+ ' 1\n"*"="Gac=y"\n"Microsoft.Xna.Framework"="Gac=y"\n')
|
||||
user.write_text(original)
|
||||
self.pick("framework")
|
||||
names, _ = self.apply()
|
||||
self.assertEqual(names, ["mscoree=n,b"])
|
||||
registry = MODULE["RegistryFile"](user)
|
||||
self.assertEqual(registry.get(key, "System"), '\"System\"=\"Gac=y\"')
|
||||
self.assertEqual(registry.get(key, "System.Core"), '\"System.Core\"=\"Gac=n\"')
|
||||
self.assertEqual(registry.get(key, "*"), '\"*\"=\"Gac=y\"')
|
||||
self.assertEqual(registry.get(key, "Microsoft.Xna.Framework"),
|
||||
'\"Microsoft.Xna.Framework\"=\"Gac=y\"')
|
||||
self.pick()
|
||||
self.apply()
|
||||
registry = MODULE["RegistryFile"](user)
|
||||
self.assertIsNone(registry.get(key, "System"))
|
||||
self.assertIsNone(registry.get(key, "System.Core"))
|
||||
self.assertEqual(registry.get(key, "*"), '\"*\"=\"Gac=y\"')
|
||||
|
||||
def test_explicit_registry_value_in_earlier_component_wins_over_later_generated_gac_override(self):
|
||||
key = "Software\\Wine\\Mono\\AsmOverrides"
|
||||
self.component("first", [], {})
|
||||
(self.store / "first/registry.json").write_text(json.dumps({"values": [
|
||||
{"hive": "HKCU", "key": key, "name": "System", "type": "sz", "data": "Gac=y"},
|
||||
]}))
|
||||
self.component("second", ["mscoree=n"], {
|
||||
"drive_c/windows/Microsoft.NET/assembly/GAC_MSIL/System/v4/System.dll": b"system",
|
||||
})
|
||||
self.mono("System")
|
||||
self.pfx.parent.mkdir(parents=True)
|
||||
user = self.compat / "pfx/user.reg"
|
||||
user.write_text("WINE REGISTRY Version 2\n")
|
||||
self.pick("first", "second")
|
||||
self.apply()
|
||||
registry = MODULE["RegistryFile"](user)
|
||||
self.assertEqual(registry.get(key, "System"), '"System"="Gac=y"')
|
||||
|
||||
def test_unselected_framework_and_non_framework_components_do_not_change_mono(self):
|
||||
gac = "drive_c/windows/Microsoft.NET/assembly/GAC_MSIL/System/v4/System.dll"
|
||||
self.component("framework", ["mscoree=n"], {gac: b"system"})
|
||||
self.component("other", ["other=n"], {gac: b"other"})
|
||||
self.mono("System")
|
||||
self.pfx.parent.mkdir(parents=True)
|
||||
user = self.compat / "pfx/user.reg"
|
||||
original = "WINE REGISTRY Version 2\n"
|
||||
user.write_text(original)
|
||||
self.pick("other")
|
||||
self.apply()
|
||||
self.assertEqual(user.read_text(), original)
|
||||
self.pick()
|
||||
self.apply()
|
||||
self.assertEqual(user.read_text(), original)
|
||||
|
||||
def test_gac_assemblies_missing_from_mono_keep_the_windows_gac(self):
|
||||
self.component("framework", ["mscoree=n"], {
|
||||
"drive_c/windows/Microsoft.NET/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll": b"system",
|
||||
"drive_c/windows/Microsoft.NET/assembly/GAC_MSIL/Vendor.Engine/v4.0_1.0.0.0__0123456789abcdef/Vendor.Engine.dll": b"vendor",
|
||||
"drive_c/windows/assembly/GAC/stdole/7.0.3300.0__b03f5f7f11d50a3a/stdole.dll": b"stdole",
|
||||
})
|
||||
self.mono("System")
|
||||
self.pfx.parent.mkdir(parents=True)
|
||||
user = self.compat / "pfx/user.reg"
|
||||
user.write_text("WINE REGISTRY Version 2\n")
|
||||
self.pick("framework")
|
||||
self.apply()
|
||||
registry = MODULE["RegistryFile"](user)
|
||||
key = "Software\\Wine\\Mono\\AsmOverrides"
|
||||
self.assertEqual(registry.get(key, "System"), '"System"="Gac=n"')
|
||||
self.assertIsNone(registry.get(key, "Vendor.Engine"))
|
||||
self.assertIsNone(registry.get(key, "stdole"))
|
||||
|
||||
def test_no_mono_runtime_found_leaves_mono_settings_alone(self):
|
||||
self.component("framework", ["mscoree=n"], {
|
||||
"drive_c/windows/Microsoft.NET/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll": b"system",
|
||||
})
|
||||
(self.mono_proton / "files/share/wine/mono/wine-mono/lib/mono/gac").mkdir(parents=True)
|
||||
self.pfx.parent.mkdir(parents=True)
|
||||
user = self.compat / "pfx/user.reg"
|
||||
original = "WINE REGISTRY Version 2\n"
|
||||
user.write_text(original)
|
||||
self.pick("framework")
|
||||
names, _ = self.apply()
|
||||
self.assertEqual(names, ["mscoree=n,b"])
|
||||
self.assertEqual(user.read_text(), original)
|
||||
|
||||
def test_a_prefix_mono_install_is_used_before_protons(self):
|
||||
self.component("framework", ["mscoree=n"], {
|
||||
"drive_c/windows/Microsoft.NET/assembly/GAC_MSIL/System/v4/System.dll": b"system",
|
||||
"drive_c/windows/Microsoft.NET/assembly/GAC_MSIL/System.Core/v4/System.Core.dll": b"core",
|
||||
})
|
||||
self.mono("System", "System.Core")
|
||||
(self.pfx / "Mono/mono-2.0/lib/mono/gac/System/4.0.0.0__b77a5c561934e089").mkdir(parents=True)
|
||||
user = self.compat / "pfx/user.reg"
|
||||
user.write_text("WINE REGISTRY Version 2\n")
|
||||
self.pick("framework")
|
||||
self.apply()
|
||||
registry = MODULE["RegistryFile"](user)
|
||||
key = "Software\\Wine\\Mono\\AsmOverrides"
|
||||
self.assertEqual(registry.get(key, "System"), '"System"="Gac=n"')
|
||||
self.assertIsNone(registry.get(key, "System.Core"))
|
||||
|
||||
def test_a_wine_placeholder_file_is_not_a_native_dll(self):
|
||||
self.component("dotnet48", ["mscoree=n"], {})
|
||||
for arch in ("system32", "syswow64"):
|
||||
|
||||
Reference in new issue
Block a user