mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 12:35:42 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00c0c6174e |
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`.
|
||||
|
||||
@@ -4130,17 +4130,6 @@ EXPORT ssize_t read(int fd, void *buf, size_t count) {
|
||||
return read_input(fd, buf, count);
|
||||
}
|
||||
|
||||
extern "C" [[noreturn]] void __chk_fail(void);
|
||||
|
||||
/* Programs built with _FORTIFY_SOURCE (Flatpak runtimes among them) call these instead of read, poll
|
||||
* and ppoll, and glibc's versions go straight to the kernel. */
|
||||
EXPORT ssize_t __read_chk(int fd, void *buf, size_t count, size_t buflen) {
|
||||
static auto next_read_chk = reinterpret_cast<ssize_t (*)(int, void *, size_t, size_t)>(dlsym(RTLD_NEXT, "__read_chk"));
|
||||
if (count > buflen) __chk_fail();
|
||||
if (next_read_chk && !is_fake_input_fd(fd)) return next_read_chk(fd, buf, count, buflen);
|
||||
return read_input(fd, buf, count);
|
||||
}
|
||||
|
||||
EXPORT ssize_t readv(int fd, const struct iovec *iov, int iovcnt) {
|
||||
if (!is_fake_input_fd(fd)) return syscall(SYS_readv, fd, iov, iovcnt);
|
||||
if (iovcnt < 0 || iovcnt > IOV_MAX) {
|
||||
@@ -4389,17 +4378,6 @@ EXPORT int ppoll(struct pollfd *fds, nfds_t nfds,
|
||||
return my_ppoll(fds, nfds, timeout, sigmask);
|
||||
}
|
||||
|
||||
EXPORT int __poll_chk(struct pollfd *fds, nfds_t nfds, int timeout, size_t fdslen) {
|
||||
if (fdslen / sizeof(*fds) < nfds) __chk_fail();
|
||||
return poll(fds, nfds, timeout);
|
||||
}
|
||||
|
||||
EXPORT int __ppoll_chk(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,
|
||||
const sigset_t *sigmask, size_t fdslen) {
|
||||
if (fdslen / sizeof(*fds) < nfds) __chk_fail();
|
||||
return ppoll(fds, nfds, timeout, sigmask);
|
||||
}
|
||||
|
||||
EXPORT int select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *exceptfds, struct timeval *timeout) {
|
||||
const auto my_select = next_symbol<decltype(&::select)>(Next::select);
|
||||
|
||||
@@ -61,19 +61,7 @@ object GameEnvironment {
|
||||
}
|
||||
|
||||
fun effective(config: Config, preset: String, scope: String, forceSsbs: Boolean = false): Map<String, String?> =
|
||||
defaults(preset, forceSsbs) + config.shared + if (scope.isEmpty()) emptyMap() else knownGames[scope].orEmpty() + config.games[scope].orEmpty()
|
||||
|
||||
/**
|
||||
* What some Steam games need here whatever the shared settings say; the game's own settings still win.
|
||||
* GTA III dies at 0042A703 when a new game starts with FEX's reduced x87 precision, as the Rockstar store copy does.
|
||||
*/
|
||||
val knownGames: Map<String, Map<String, String?>> = mapOf(
|
||||
"12100" to mapOf("FEX_X87REDUCEDPRECISION" to "0"),
|
||||
)
|
||||
|
||||
/** [config] with [knownGames] folded under each game's own settings, for the guest to read. */
|
||||
fun withKnownGames(config: Config): Config =
|
||||
config.copy(games = config.games + knownGames.mapValues { (scope, known) -> known + config.games[scope].orEmpty() })
|
||||
defaults(preset, forceSsbs) + config.shared + if (scope.isEmpty()) emptyMap() else config.games[scope].orEmpty()
|
||||
|
||||
fun hasOverride(config: Config, scope: String, name: String): Boolean =
|
||||
scope.isNotEmpty() && config.entries(scope).containsKey(name)
|
||||
@@ -90,7 +78,7 @@ object GameEnvironment {
|
||||
val entries = config.games[scope].orEmpty()
|
||||
if (FexPreset.environmentKeys.none(entries::containsKey)) return null
|
||||
return FexPreset.all.firstOrNull { preset ->
|
||||
val expected = presetFor(scope, preset.id)
|
||||
val expected = FexPreset.environment(preset.id)
|
||||
FexPreset.environmentKeys.all { key -> entries.containsKey(key) && entries[key] == expected[key] }
|
||||
}?.id ?: CUSTOM_FEX_PRESET
|
||||
}
|
||||
@@ -100,16 +88,12 @@ object GameEnvironment {
|
||||
require(preset == null || FexPreset.all.any { it.id == preset })
|
||||
val entries = config.entries(scope).filterKeys { it !in FexPreset.environmentKeys }.toMutableMap()
|
||||
if (preset != null) {
|
||||
val values = presetFor(scope, preset)
|
||||
val values = FexPreset.environment(preset)
|
||||
FexPreset.environmentKeys.forEach { key -> entries[key] = values[key] }
|
||||
}
|
||||
return config.withEntries(scope, entries)
|
||||
}
|
||||
|
||||
/** A FEX preset as a game gets it: picking one never undoes a fix the game is known to need. */
|
||||
private fun presetFor(scope: String, preset: String): Map<String, String?> =
|
||||
FexPreset.environment(preset) + knownGames[scope].orEmpty().filterKeys { it in FexPreset.environmentKeys }
|
||||
|
||||
const val CUSTOM_FEX_PRESET = "__custom__"
|
||||
|
||||
val syncBackends = listOf(SessionPrefs.SYNC_NTSYNC, SessionPrefs.SYNC_FSYNC, SessionPrefs.SYNC_ESYNC, SessionPrefs.SYNC_WINESERVER)
|
||||
|
||||
@@ -114,7 +114,7 @@ object GameEnvironmentStore {
|
||||
) {
|
||||
publishGameCores(context)
|
||||
val stored = config ?: read(context)
|
||||
val resolved = GameEnvironment.withKnownGames(stored).copy(shared = GameEnvironment.defaults(SessionPrefs.fexPreset(context), SessionPrefs.forceSsbs(context)) + stored.shared)
|
||||
val resolved = stored.copy(shared = GameEnvironment.defaults(SessionPrefs.fexPreset(context), SessionPrefs.forceSsbs(context)) + stored.shared)
|
||||
val json = encode(resolved)
|
||||
val dxvk = TextureFiltering.dxvkOptions(
|
||||
SessionPrefs.textureAnisotropy(context), SessionPrefs.textureLodBias(context),
|
||||
|
||||
@@ -35,7 +35,6 @@ object SessionFiles {
|
||||
"usr/local/bin/kwin_wayland_wrapper" to "usr/local/bin/kwin_wayland_wrapper",
|
||||
"usr/lib/firefox/defaults/pref/droiddeck.js" to "usr/lib/firefox/defaults/pref/droiddeck.js",
|
||||
"etc/xdg/autostart/droiddeck-clipboard.desktop" to "etc/xdg/autostart/droiddeck-clipboard.desktop",
|
||||
"usr/share/applications/droiddeck-return-gaming.desktop" to "usr/share/applications/droiddeck-return-gaming.desktop",
|
||||
"etc/xdg/fastfetch/config.jsonc" to "etc/xdg/fastfetch/config.jsonc",
|
||||
)
|
||||
|
||||
|
||||
@@ -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)) }
|
||||
|
||||
@@ -20,24 +20,6 @@ class GameEnvironmentTest {
|
||||
assertEquals("1", GameEnvironment.effective(config, "", "43", forceSsbs = true)[GameEnvironment.FORCE_SSBS])
|
||||
}
|
||||
|
||||
@Test fun knownGameFixesBeatSharedSettingsButNotTheGamesOwn() {
|
||||
val shared = GameEnvironment.Config(shared = mapOf("FEX_X87REDUCEDPRECISION" to "1"))
|
||||
assertEquals("0", GameEnvironment.effective(shared, "PERFORMANCE_TSO", "12100")["FEX_X87REDUCEDPRECISION"])
|
||||
assertEquals("1", GameEnvironment.effective(shared, "PERFORMANCE_TSO", "12110")["FEX_X87REDUCEDPRECISION"])
|
||||
val own = shared.withEntries("12100", mapOf("FEX_X87REDUCEDPRECISION" to "1"))
|
||||
assertEquals("1", GameEnvironment.effective(own, "PERFORMANCE_TSO", "12100")["FEX_X87REDUCEDPRECISION"])
|
||||
assertEquals("1", GameEnvironment.withKnownGames(own).games["12100"]?.get("FEX_X87REDUCEDPRECISION"))
|
||||
assertEquals("0", GameEnvironment.withKnownGames(shared).games["12100"]?.get("FEX_X87REDUCEDPRECISION"))
|
||||
}
|
||||
|
||||
@Test fun aGamePresetKeepsTheGamesKnownFix() {
|
||||
val picked = GameEnvironment.withGameFexPreset(GameEnvironment.Config(), "12100", "PERFORMANCE")
|
||||
assertEquals("0", GameEnvironment.effective(picked, "PERFORMANCE_TSO", "12100")["FEX_X87REDUCEDPRECISION"])
|
||||
assertEquals("PERFORMANCE", GameEnvironment.gameFexPreset(picked, "12100"))
|
||||
val other = GameEnvironment.withGameFexPreset(GameEnvironment.Config(), "12110", "PERFORMANCE")
|
||||
assertEquals("1", GameEnvironment.effective(other, "PERFORMANCE_TSO", "12110")["FEX_X87REDUCEDPRECISION"])
|
||||
}
|
||||
|
||||
@Test fun gameOverridesSharedAndPresetWithoutLeakingToOtherGames() {
|
||||
val config = GameEnvironment.Config(
|
||||
shared = mapOf("FEX_MULTIBLOCK" to "0", "VKD3D_FEATURE_LEVEL" to "12_2"),
|
||||
|
||||
@@ -202,19 +202,11 @@ class GameEnvironmentStoreTest {
|
||||
assertEquals("false", published.shared["MESA_SHADER_CACHE_DISABLE"])
|
||||
assertFalse(published.shared.containsKey("VKD3D_FEATURE_LEVEL"))
|
||||
assertFalse(published.shared.containsKey("VKD3D_SHADER_MODEL"))
|
||||
assertEquals(config.games + GameEnvironment.knownGames, published.games)
|
||||
assertEquals(config.games, published.games)
|
||||
assertEquals(config.shared["LITERAL"], published.shared["LITERAL"])
|
||||
assertEquals("", published.shared["EMPTY"])
|
||||
}
|
||||
|
||||
@Test fun aKnownGamesFixReachesTheGuestWithoutBeingSavedAsTheUsersSetting() {
|
||||
GameEnvironmentStore.save(context, GameEnvironment.Config())
|
||||
assertEquals(emptyMap<String, Map<String, String?>>(), GameEnvironmentStore.read(context).games)
|
||||
val published = GameEnvironmentStore.decode(JSONObject(guest.readText()))
|
||||
assertEquals(GameEnvironment.knownGames, published.games)
|
||||
assertEquals("0", published.entries("12100")["FEX_X87REDUCEDPRECISION"])
|
||||
}
|
||||
|
||||
@Test fun publishingPreservesExplicitSharedGraphicsCapabilities() {
|
||||
val config = GameEnvironment.Config(shared = mapOf(
|
||||
"VKD3D_FEATURE_LEVEL" to "12_1", "VKD3D_SHADER_MODEL" to "6_6",
|
||||
@@ -274,7 +266,7 @@ class GameEnvironmentStoreTest {
|
||||
assertEquals(original.entries("43"), saved.entries("43"))
|
||||
assertEquals("PERFORMANCE_TSO", SessionPrefs.fexPreset(context))
|
||||
val published = GameEnvironmentStore.decode(JSONObject(guest.readText()))
|
||||
assertEquals(saved.games + GameEnvironment.knownGames, published.games)
|
||||
assertEquals(saved.games, published.games)
|
||||
assertEquals("0", published.shared["FEX_HALFBARRIERTSOENABLED"])
|
||||
assertEquals("1", published.entries("42")["FEX_HALFBARRIERTSOENABLED"])
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -252,13 +252,15 @@ self-extractor stops at "Path not found", so the values it installs are applied
|
||||
`goggame-<id>.info`, and a script's own `setRegistry` entries always win over the built-in table.
|
||||
|
||||
The script's `supportData` actions run right after: files and folders from the game folder
|
||||
(`{app}`) or its support files (`{supportDir}`, `support/<id>/`) are copied to `{userdocs}` and
|
||||
`{localappdata}` in the prefix, and `type: folder` without a source creates the folder. Mods such
|
||||
as one-click editions ship their `Plugins.txt` and INI files this way. Paths match without regard
|
||||
(`{app}`) or its support files (`{supportDir}`, `support/<id>/`) are copied to `{userdocs}`,
|
||||
`{localappdata}` or `{userappdata}` in the prefix, and `type: folder` without a source creates the
|
||||
folder. Mods such as one-click editions ship their `Plugins.txt` and INI files this way. The
|
||||
`savePath` action's `savePath` folder is created with the same path rules, including the common
|
||||
case where a one-click edition names it again as a `supportData` folder. Paths match without regard
|
||||
to case, links are copied as links, and a path outside those folders is refused. A file the
|
||||
player already has is replaced only when the action says `overwrite`. `.droiddeck-gog-support` in
|
||||
the prefix holds the actions' hash, so they run once per script revision and a player's later
|
||||
edits stay.
|
||||
player already has is replaced only when the action says `overwrite`. `.droiddeck-gog-support` and
|
||||
`.droiddeck-gog-save-path` in the prefix hold the actions' hashes, so they run once per script
|
||||
revision and a player's later edits stay.
|
||||
|
||||
A GOG game's exe comes from its own manifest first: `goggame-<id>.info`'s play task in category
|
||||
`game` (`isPrimary` first), or a primary `launcher` task for launcher games, whose `path` stays
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
[Desktop Entry]
|
||||
Name=Return to Gaming Mode
|
||||
Comment=Log out of the desktop and go back to Steam
|
||||
Exec=dbus-send --session --type=method_call --dest=org.kde.Shutdown /Shutdown org.kde.Shutdown.logout
|
||||
Icon=steamdeck-gaming-return
|
||||
Terminal=false
|
||||
Type=Application
|
||||
StartupNotify=false
|
||||
NoDisplay=true
|
||||
@@ -229,16 +229,12 @@ fi
|
||||
if ! /usr/local/bin/droiddeck-pipewire start; then
|
||||
echo "== pipewire: not running; screen capture has no picture"
|
||||
fi
|
||||
return_gaming=/run/droiddeck/return-gaming
|
||||
mkdir -p /run/droiddeck
|
||||
rm -f "$return_gaming"
|
||||
echo "== droiddeck-desktop: Plasma on $WAYLAND_DISPLAY"
|
||||
dbus-run-session -- startplasma-wayland
|
||||
rc=$?
|
||||
/usr/local/bin/droiddeck-pipewire stop
|
||||
echo "== droiddeck-desktop: Plasma ended ($rc)"
|
||||
if [ "$rc" -eq 0 ] && [ -z "${DD_BOTTOM_DESKTOP:-}" ] && [ -e "$return_gaming" ]; then
|
||||
rm -f "$return_gaming"
|
||||
if [ "$rc" -eq 0 ] && [ -z "${DD_BOTTOM_DESKTOP:-}" ]; then
|
||||
/usr/local/bin/droiddeck-steam-launch bigpicture
|
||||
sleep 30
|
||||
fi
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Name=Return to Gaming Mode
|
||||
Comment=Log out of the desktop and go back to Steam
|
||||
Exec=sh -c ": > /run/droiddeck/return-gaming; dbus-send --session --print-reply --type=method_call --dest=org.kde.Shutdown /Shutdown org.kde.Shutdown.logout >/dev/null || rm -f /run/droiddeck/return-gaming"
|
||||
Icon=steamdeck-gaming-return
|
||||
Terminal=false
|
||||
Type=Application
|
||||
StartupNotify=false
|
||||
NoDisplay=true
|
||||
@@ -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
|
||||
|
||||
@@ -1149,7 +1149,6 @@ case $mode in
|
||||
droiddeck-steam-library "$steam_root" || true
|
||||
step "setting up the ARM64 Proton compatibility tool"
|
||||
steam-compatibility "$steam_root" || true
|
||||
steam-compatibility "$steam_root" --seed-arm64-tools || true
|
||||
if [ -z "${DD_DESKTOP:-}" ] && [ "${DD_STEAM_UI:-}" != desktop ]; then
|
||||
droiddeck-steam-ui-scale "$steam_root" "${DD_WIDTH:-1280}" "${DD_HEIGHT:-720}" || true
|
||||
fi
|
||||
|
||||
@@ -968,6 +968,7 @@ def prepare_gog(sidecar, compat_data, launch_dir):
|
||||
GOG_SCRIPTS = "goggame-*.script"
|
||||
GOG_REGISTRY_MARK = ".droiddeck-gog-registry"
|
||||
GOG_SUPPORT_MARK = ".droiddeck-gog-support"
|
||||
GOG_SAVE_PATH_MARK = ".droiddeck-gog-save-path"
|
||||
GOG_ROOTS = {"HKEY_LOCAL_MACHINE": "HKEY_LOCAL_MACHINE", "HKLM": "HKEY_LOCAL_MACHINE",
|
||||
"HKEY_CURRENT_USER": "HKEY_CURRENT_USER", "HKCU": "HKEY_CURRENT_USER",
|
||||
"HKEY_CLASSES_ROOT": "HKEY_CLASSES_ROOT", "HKCR": "HKEY_CLASSES_ROOT"}
|
||||
@@ -1716,7 +1717,7 @@ def prepare_steam_ea(argv, compat_data, launch_dir):
|
||||
return REPLACED
|
||||
|
||||
|
||||
def gog_support_actions(folder):
|
||||
def gog_script_actions(folder, name):
|
||||
found = []
|
||||
for script in sorted(Path(folder).glob(GOG_SCRIPTS)):
|
||||
product = script.name[len("goggame-"):-len(".script")]
|
||||
@@ -1726,17 +1727,22 @@ def gog_support_actions(folder):
|
||||
continue
|
||||
for action in actions if isinstance(actions, list) else []:
|
||||
install = action.get("install") if isinstance(action, dict) else None
|
||||
if isinstance(install, dict) and install.get("action") == "supportData" \
|
||||
if isinstance(install, dict) and install.get("action") == name \
|
||||
and isinstance(install.get("arguments"), dict):
|
||||
found.append((product, install["arguments"]))
|
||||
return found
|
||||
|
||||
|
||||
def gog_support_actions(folder):
|
||||
return gog_script_actions(folder, "supportData")
|
||||
|
||||
|
||||
def gog_support_bases(folder, product, pfx):
|
||||
user = Path(pfx) / "drive_c" / "users" / "steamuser"
|
||||
support = Path(folder) / "support" / product
|
||||
return {"app": Path(folder), "supportdir": support, "support": support,
|
||||
"userdocs": user / "Documents", "localappdata": user / "AppData" / "Local"}
|
||||
"userdocs": user / "Documents", "localappdata": user / "AppData" / "Local",
|
||||
"userappdata": user / "AppData" / "Roaming"}
|
||||
|
||||
|
||||
def gog_inside(path, base):
|
||||
@@ -1830,6 +1836,44 @@ def gog_support_data(folder, compat_data, proton):
|
||||
return "copied=%d%s" % (copied, note)
|
||||
|
||||
|
||||
def gog_save_paths(folder, compat_data, proton):
|
||||
actions = gog_script_actions(folder, "savePath")
|
||||
if not actions:
|
||||
return "none"
|
||||
pfx = Path(compat_data) / "pfx" if compat_data else None
|
||||
if not pfx or not (pfx / "drive_c" / "users" / "steamuser").is_dir():
|
||||
made = create_prefix(compat_data, proton)
|
||||
if made not in ("present", "created") or not (pfx / "drive_c" / "users" / "steamuser").is_dir():
|
||||
return "no-prefix"
|
||||
stamp = hashlib.sha256(json.dumps(actions, sort_keys=True).encode("utf-8")).hexdigest()
|
||||
marker = pfx / GOG_SAVE_PATH_MARK
|
||||
try:
|
||||
if marker.is_file() and marker.read_text() == stamp:
|
||||
return "ready"
|
||||
except OSError:
|
||||
pass
|
||||
paths = skipped = 0
|
||||
for product, arguments in actions:
|
||||
bases = gog_support_bases(folder, product, pfx)
|
||||
found = gog_support_path(arguments.get("savePath") or arguments.get("target"), bases)
|
||||
if found is None:
|
||||
skipped += 1
|
||||
continue
|
||||
target, _root = found
|
||||
try:
|
||||
target.mkdir(parents=True, exist_ok=True)
|
||||
paths += 1
|
||||
except OSError:
|
||||
skipped += 1
|
||||
note = " skipped=%d" % skipped if skipped else ""
|
||||
if not skipped:
|
||||
try:
|
||||
marker.write_text(stamp)
|
||||
except OSError:
|
||||
pass
|
||||
return "paths=%d%s" % (paths, note)
|
||||
|
||||
|
||||
def main(argv):
|
||||
if os.environ.get("DROIDDECK_GOG_MAINTENANCE") == "1":
|
||||
return 0
|
||||
@@ -1876,6 +1920,7 @@ def main(argv):
|
||||
prepare_gog(sidecar, compat_data, launch_dir)
|
||||
log("gog registry: " + apply_gog_registry(folder, compat_data, os.environ.get("DD_STORE_PROTON", "")))
|
||||
log("gog support data: " + gog_support_data(folder, compat_data, os.environ.get("DD_STORE_PROTON", "")))
|
||||
log("gog save paths: " + gog_save_paths(folder, compat_data, os.environ.get("DD_STORE_PROTON", "")))
|
||||
if store == "rockstar":
|
||||
if game not in ROCKSTAR_TITLES and not rockstar_sdk(folder, sidecar):
|
||||
if compat_data:
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -5,7 +5,6 @@ import re
|
||||
import runpy
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
TOOL = "droiddeck-proton-arm64"
|
||||
TOOL_11 = "droiddeck-proton-11-arm64"
|
||||
@@ -27,8 +26,6 @@ SNIPER_APPID = "1628350"
|
||||
SLR4_APPID = "4183110"
|
||||
FEX_DEPENDENCIES = (FEX_APPID, SNIPER_APPID, SLR4_APPID)
|
||||
REQUIRED_TOOLS = (PROTON_ARM64_APPID,) + FEX_DEPENDENCIES
|
||||
ARM64_TOOL_DEPENDENCIES = (("1826330", "Proton EasyAntiCheat Runtime"),
|
||||
("1070560", "Steam Linux Runtime 1.0 (scout)"))
|
||||
# "0" = the app's "Valve Proton only when needed": Valve's ARM64 Proton is fetched only for a title or
|
||||
# default set to a tool built from it, or while no own Proton build is installed.
|
||||
VALVE_PROTON_ENV = "DD_VALVE_PROTON"
|
||||
@@ -1015,15 +1012,10 @@ def manifest_text(appid, name, installdir, bare=False):
|
||||
return text[:-2] + ' "AutoUpdateBehavior" "1"\n}\n' if bare else text
|
||||
|
||||
|
||||
def manifest_paths(steam_root, app):
|
||||
for library in libraries(steam_root):
|
||||
yield os.path.join(library, "steamapps", "appmanifest_%s.acf" % app)
|
||||
|
||||
|
||||
def app_manifest(steam_root, app):
|
||||
for path in manifest_paths(steam_root, app):
|
||||
for library in libraries(steam_root):
|
||||
try:
|
||||
with open(path, encoding="utf-8", errors="replace") as f:
|
||||
with open(os.path.join(library, "steamapps", "appmanifest_%s.acf" % app), encoding="utf-8", errors="replace") as f:
|
||||
return tokenize(f.read())
|
||||
except OSError:
|
||||
continue
|
||||
@@ -1038,57 +1030,6 @@ def manifest_flags(tokens):
|
||||
return 0
|
||||
|
||||
|
||||
def installed_manifest(path):
|
||||
try:
|
||||
with open(path, encoding="utf-8", errors="replace") as f:
|
||||
return bool(manifest_flags(tokenize(f.read())) & FULLY_INSTALLED)
|
||||
except OSError:
|
||||
return False
|
||||
|
||||
|
||||
def seed_unavailable_arm64_tools(steam_root):
|
||||
entries = appinfo_entries(os.path.join(steam_root, "appcache", "appinfo.vdf"),
|
||||
[app for app, _ in ARM64_TOOL_DEPENDENCIES])
|
||||
steamapps = os.path.join(steam_root, "steamapps")
|
||||
os.makedirs(steamapps, exist_ok=True)
|
||||
seeded = []
|
||||
for app, display in ARM64_TOOL_DEPENDENCIES:
|
||||
entry = entries.get(app)
|
||||
if entry is not None:
|
||||
if entry["type"] not in ("", "tool"):
|
||||
continue
|
||||
if "arm64" in entry["osarch"] or "aarch64" in entry["osarch"]:
|
||||
continue
|
||||
existing = [p for p in manifest_paths(steam_root, app) if os.path.isfile(p)]
|
||||
if any(installed_manifest(p) for p in existing):
|
||||
continue
|
||||
name = (entry or {}).get("name") or display
|
||||
installdir = (entry or {}).get("installdir") or name
|
||||
path = existing[0] if existing else os.path.join(steamapps, "appmanifest_%s.acf" % app)
|
||||
temporary = None
|
||||
try:
|
||||
with tempfile.NamedTemporaryFile(mode="w", encoding="utf-8",
|
||||
dir=os.path.dirname(path),
|
||||
prefix=".appmanifest_", delete=False) as f:
|
||||
temporary = f.name
|
||||
f.write(manifest_text(app, name, installdir, True))
|
||||
if existing:
|
||||
os.replace(temporary, path)
|
||||
else:
|
||||
os.link(temporary, path)
|
||||
except OSError as e:
|
||||
print("steam-compatibility: could not mark %s installed (%s)" % (app, e))
|
||||
continue
|
||||
finally:
|
||||
if temporary is not None:
|
||||
try:
|
||||
os.unlink(temporary)
|
||||
except OSError:
|
||||
pass
|
||||
seeded.append(app)
|
||||
return seeded
|
||||
|
||||
|
||||
def valve_proton_on_demand():
|
||||
return os.environ.get(VALVE_PROTON_ENV) == "0"
|
||||
|
||||
@@ -1860,11 +1801,6 @@ def main():
|
||||
steam_root = sys.argv[1]
|
||||
if "--valve-proton-needed" in sys.argv[2:]:
|
||||
sys.exit(0 if valve_proton_needed(steam_root) else 1)
|
||||
if "--seed-arm64-tools" in sys.argv[2:]:
|
||||
seeded = seed_unavailable_arm64_tools(steam_root)
|
||||
if seeded:
|
||||
print("steam-compatibility: marked unavailable ARM64 tool(s) installed: %s" % ", ".join(seeded))
|
||||
return
|
||||
if "--x64" in sys.argv[2:]:
|
||||
x64_repoint(steam_root, os.environ.get("DD_COMPAT_TOOL"), "--live" in sys.argv[2:])
|
||||
return
|
||||
|
||||
@@ -32,7 +32,6 @@ def source_assets(overlay=OVERLAY):
|
||||
result[desktop / name] = 'assets/linuxfs/usr/local/bin/' + name
|
||||
result[desktop / 'firefox-droiddeck.js'] = 'assets/linuxfs/usr/lib/firefox/defaults/pref/droiddeck.js'
|
||||
result[desktop / 'droiddeck-clipboard.desktop'] = 'assets/linuxfs/etc/xdg/autostart/droiddeck-clipboard.desktop'
|
||||
result[desktop / 'droiddeck-return-gaming.desktop'] = 'assets/linuxfs/usr/share/applications/droiddeck-return-gaming.desktop'
|
||||
result[desktop / 'fastfetch.jsonc'] = 'assets/linuxfs/etc/xdg/fastfetch/config.jsonc'
|
||||
result[overlay.parent.parent / 'mangoapp/mangoapp'] = 'assets/linuxfs/usr/local/bin/mangoapp'
|
||||
return result
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
import os
|
||||
import re
|
||||
import shlex
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
DESKTOP = ROOT / "tools/linuxfs/desktop"
|
||||
SCRIPT = (DESKTOP / "droiddeck-desktop").read_text()
|
||||
ENTRY = (DESKTOP / "droiddeck-return-gaming.desktop").read_text()
|
||||
|
||||
|
||||
class DesktopReturnGamingTest(unittest.TestCase):
|
||||
def session(self, logout, rc=0, bottom=False):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
run = Path(tmp, "run")
|
||||
launched = Path(tmp, "launched")
|
||||
exec_line = re.search(r"^Exec=(.*)$", ENTRY, re.M).group(1)
|
||||
inner = shlex.split(exec_line)[2].replace("dbus-send", "true")
|
||||
plasma = Path(tmp, "plasma")
|
||||
plasma.write_text("#!/bin/sh\n%s\nexit %d\n" % (inner if logout == "return" else ":", rc))
|
||||
plasma.chmod(0o755)
|
||||
steam = Path(tmp, "steam-launch")
|
||||
steam.write_text('#!/bin/sh\necho "$*" > %s\n' % launched)
|
||||
steam.chmod(0o755)
|
||||
tail = SCRIPT[SCRIPT.index("return_gaming="):]
|
||||
tail = tail.replace("dbus-run-session -- startplasma-wayland", str(plasma))
|
||||
tail = tail.replace("/usr/local/bin/droiddeck-pipewire stop", ":")
|
||||
tail = tail.replace("/usr/local/bin/droiddeck-steam-launch", str(steam))
|
||||
tail = tail.replace("sleep 30", ":")
|
||||
tail = tail.replace("/run/droiddeck", str(run))
|
||||
plasma.write_text(plasma.read_text().replace("/run/droiddeck", str(run)))
|
||||
env = {k: v for k, v in os.environ.items() if k != "DD_BOTTOM_DESKTOP"}
|
||||
if bottom:
|
||||
env["DD_BOTTOM_DESKTOP"] = "1"
|
||||
run.mkdir()
|
||||
(run / "return-gaming").write_text("")
|
||||
status = subprocess.run(["sh", "-c", tail], env=env, capture_output=True, text=True).returncode
|
||||
return status, launched.read_text().strip() if launched.exists() else None, (run / "return-gaming").exists()
|
||||
|
||||
def test_return_to_gaming_mode_opens_steam(self):
|
||||
self.assertEqual(self.session("return"), (0, "bigpicture", False))
|
||||
|
||||
def test_log_out_goes_back_without_steam_even_after_an_earlier_request(self):
|
||||
self.assertEqual(self.session("logout"), (0, None, False))
|
||||
|
||||
def test_a_failed_session_and_the_bottom_desktop_never_open_steam(self):
|
||||
self.assertEqual(self.session("return", rc=1)[:2], (1, None))
|
||||
self.assertEqual(self.session("return", bottom=True)[:2], (0, None))
|
||||
|
||||
def test_the_logout_request_outlives_starting_the_shutdown_service(self):
|
||||
exec_line = re.search(r"^Exec=(.*)$", ENTRY, re.M).group(1)
|
||||
call = shlex.split(shlex.split(exec_line)[2].split(";")[-1])
|
||||
self.assertEqual(call[0], "dbus-send")
|
||||
self.assertIn("--print-reply", call)
|
||||
|
||||
def test_a_rejected_logout_request_forgets_the_return_to_gaming_mode(self):
|
||||
exec_line = re.search(r"^Exec=(.*)$", ENTRY, re.M).group(1)
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
inner = shlex.split(exec_line)[2].replace("/run/droiddeck", tmp)
|
||||
for sender, kept in (("true", True), ("false", False)):
|
||||
subprocess.run(["sh", "-c", inner.replace("dbus-send", sender, 1)], check=False)
|
||||
self.assertEqual(Path(tmp, "return-gaming").exists(), kept)
|
||||
|
||||
def test_the_app_ships_the_shortcut_with_the_script(self):
|
||||
source = (ROOT / "app/src/main/java/com/droiddeck/launcher/session/SessionFiles.kt").read_text()
|
||||
self.assertIn('"usr/share/applications/droiddeck-return-gaming.desktop" to '
|
||||
'"usr/share/applications/droiddeck-return-gaming.desktop"', source)
|
||||
self.assertIn("droiddeck-return-gaming.desktop", (ROOT / "tools/release/check_session_assets.py").read_text())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -29,21 +29,14 @@ PAD_TYPE_STEAM = 1
|
||||
READER = r"""
|
||||
#include <fcntl.h>
|
||||
#include <linux/input.h>
|
||||
#include <poll.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/uio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
ssize_t __read_chk(int fd, void *buffer, size_t size, size_t buffer_size);
|
||||
int __poll_chk(struct pollfd *fds, nfds_t nfds, int timeout, size_t fds_size);
|
||||
|
||||
static int vector_count;
|
||||
static int fortified;
|
||||
|
||||
static ssize_t controller_read(int fd, void *buffer, size_t size)
|
||||
{
|
||||
if (fortified)
|
||||
return __read_chk(fd, buffer, size, size);
|
||||
if (!vector_count)
|
||||
return read(fd, buffer, size);
|
||||
struct iovec vectors[3] = {
|
||||
@@ -60,8 +53,7 @@ static ssize_t controller_read(int fd, void *buffer, size_t size)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
fortified = argc > 1 && argv[1][0] == 'f';
|
||||
vector_count = argc > 1 && !fortified ? (argv[1][0] == '1' ? 1 : 3) : 0;
|
||||
vector_count = argc > 1 ? (argv[1][0] == '1' ? 1 : 3) : 0;
|
||||
struct input_event events[64];
|
||||
int fd = open("/dev/input/event16", O_RDONLY | O_NONBLOCK);
|
||||
if (fd < 0) {
|
||||
@@ -70,17 +62,11 @@ int main(int argc, char **argv)
|
||||
}
|
||||
while (controller_read(fd, events, sizeof(events)) > 0)
|
||||
;
|
||||
struct pollfd idle = {fd, POLLIN, 0};
|
||||
if (fortified && __poll_chk(&idle, 1, 0, sizeof(idle)) != 0)
|
||||
return 3;
|
||||
puts("ready");
|
||||
fflush(stdout);
|
||||
char go;
|
||||
if (read(0, &go, 1) != 1)
|
||||
return 1;
|
||||
struct pollfd ready = {fd, POLLIN, 0};
|
||||
if (fortified && (__poll_chk(&ready, 1, 1000, sizeof(ready)) != 1 || !(ready.revents & POLLIN)))
|
||||
return 2;
|
||||
ssize_t got = controller_read(fd, events, sizeof(events));
|
||||
for (ssize_t i = 0; i < got / (ssize_t)sizeof(events[0]); i++)
|
||||
printf("%ld.%06ld %u %u %d\n", (long)events[i].time.tv_sec, (long)events[i].time.tv_usec, events[i].type,
|
||||
@@ -359,7 +345,7 @@ class FakeinputRingTest(unittest.TestCase):
|
||||
subprocess.run(["gcc", bits, "-o", str(binary), str(self.tmp / (name + ".c"))], check=True)
|
||||
return library, binary
|
||||
|
||||
def read_through(self, bits, vectors=None, overlay=False, virtual=True, program=READER, fortified=False):
|
||||
def read_through(self, bits, vectors=None, overlay=False, virtual=True, program=READER):
|
||||
if not virtual:
|
||||
program = program.replace("event16", "event0")
|
||||
library, reader = self.build(bits, program, "reader")
|
||||
@@ -373,7 +359,7 @@ class FakeinputRingTest(unittest.TestCase):
|
||||
overlay_library = self.tmp / "overlay.so"
|
||||
subprocess.run(["gcc", bits, "-shared", "-fPIC", "-o", str(overlay_library), str(source)], check=True)
|
||||
env["LD_PRELOAD"] = str(overlay_library) + ":" + str(library)
|
||||
command = [str(reader)] + (["fortified"] if fortified else [str(vectors)] if vectors else [])
|
||||
command = [str(reader)] + ([str(vectors)] if vectors else [])
|
||||
process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, env=env, text=True)
|
||||
self.addCleanup(process.kill)
|
||||
self.assertEqual(process.stdout.readline(), "ready\n")
|
||||
@@ -395,10 +381,6 @@ class FakeinputRingTest(unittest.TestCase):
|
||||
self.assertEqual(self.read_through("-m64"),
|
||||
"1700000000.250000 1 304 1\n1700000001.250000 3 1 -32768\n1700000002.250000 0 0 0\n")
|
||||
|
||||
def test_a_fortified_guest_polls_and_reads_the_ring(self):
|
||||
self.assertEqual(self.read_through("-m64", virtual=False, fortified=True),
|
||||
"1700000000.250000 1 304 1\n1700000001.250000 3 1 -32768\n1700000002.250000 0 0 0\n")
|
||||
|
||||
def test_readv_reads_events_instead_of_the_backing_file(self):
|
||||
self.assertEqual(self.read_through("-m64", vectors=1),
|
||||
"1700000000.250000 1 304 1\n1700000001.250000 3 1 -32768\n1700000002.250000 0 0 0\n")
|
||||
|
||||
@@ -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")),
|
||||
|
||||
@@ -1,205 +0,0 @@
|
||||
import runpy
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from unittest import mock
|
||||
|
||||
from tools.tests.test_droiddeck_fex import AppInfoTest
|
||||
|
||||
BIN = Path(__file__).resolve().parents[1] / "linuxfs/overlay/usr/local/bin"
|
||||
SESSION = BIN / "droiddeck-session"
|
||||
COMPAT = runpy.run_path(str(BIN / "steam-compatibility"))
|
||||
EAC = 1826330
|
||||
SCOUT = 1070560
|
||||
EAC_ID = str(EAC)
|
||||
SCOUT_ID = str(SCOUT)
|
||||
EAC_NAME = "Proton EasyAntiCheat Runtime"
|
||||
SCOUT_NAME = "Steam Linux Runtime 1.0 (scout)"
|
||||
|
||||
|
||||
def tool(name, osarch="", kind="tool", installdir=None):
|
||||
return {
|
||||
"common": {"name": name, "oslist": "linux", "osarch": osarch, "type": kind},
|
||||
"config": {"installdir": installdir or name},
|
||||
}
|
||||
|
||||
|
||||
class SteamToolManifestSeedTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
temporary = tempfile.TemporaryDirectory()
|
||||
self.addCleanup(temporary.cleanup)
|
||||
self.root = Path(temporary.name)
|
||||
self.steam = self.root / "Steam"
|
||||
(self.steam / "appcache").mkdir(parents=True)
|
||||
(self.steam / "steamapps").mkdir()
|
||||
self.entries = {EAC: tool(EAC_NAME), SCOUT: tool(SCOUT_NAME)}
|
||||
self.write_appinfo()
|
||||
|
||||
def write_appinfo(self, entries=None):
|
||||
COMPAT["APPINFO_CACHE"].clear()
|
||||
(self.steam / "appcache/appinfo.vdf").write_bytes(
|
||||
AppInfoTest.appinfo(self.entries if entries is None else entries))
|
||||
|
||||
def manifest(self, app, root=None):
|
||||
return (root or self.steam) / ("steamapps/appmanifest_%s.acf" % app)
|
||||
|
||||
def seed(self):
|
||||
return COMPAT["seed_unavailable_arm64_tools"](str(self.steam))
|
||||
|
||||
def test_seeds_bare_manifests_for_unavailable_tool_dependencies(self):
|
||||
self.assertEqual(self.seed(), [EAC_ID, SCOUT_ID])
|
||||
for app, name in ((EAC_ID, EAC_NAME), (SCOUT_ID, SCOUT_NAME)):
|
||||
text = self.manifest(app).read_text()
|
||||
for expected in ('"appid" "%s"' % app, '"Universe" "1"', '"StateFlags" "4"',
|
||||
'"name" "%s"' % name, '"installdir" "%s"' % name,
|
||||
'"AutoUpdateBehavior" "1"'):
|
||||
self.assertIn(expected, text)
|
||||
self.assertFalse(self.manifest("976730").exists())
|
||||
|
||||
def test_seeding_is_idempotent(self):
|
||||
self.seed()
|
||||
first = {app: self.manifest(app).read_text() for app in (EAC_ID, SCOUT_ID)}
|
||||
self.assertEqual(self.seed(), [])
|
||||
self.assertEqual({app: self.manifest(app).read_text() for app in first}, first)
|
||||
|
||||
def test_a_real_install_in_another_library_is_never_overwritten(self):
|
||||
other = self.root / "SD"
|
||||
(other / "steamapps").mkdir(parents=True)
|
||||
existing = '"AppState"\n{\n\t"appid"\t"%s"\n\t"StateFlags"\t"4"\n}\n' % SCOUT_ID
|
||||
(other / ("steamapps/appmanifest_%s.acf" % SCOUT_ID)).write_text(existing)
|
||||
(self.steam / "steamapps/libraryfolders.vdf").write_text(
|
||||
'"libraryfolders"\n{\n\t"0"\n\t{\n\t\t"path"\t\t"%s"\n\t}\n}\n' % other)
|
||||
self.assertEqual(self.seed(), [EAC_ID])
|
||||
self.assertFalse(self.manifest(SCOUT_ID).exists())
|
||||
self.assertEqual((other / ("steamapps/appmanifest_%s.acf" % SCOUT_ID)).read_text(), existing)
|
||||
|
||||
def test_a_partial_install_in_another_library_is_completed_in_place(self):
|
||||
other = self.root / "SD"
|
||||
(other / "steamapps").mkdir(parents=True)
|
||||
partial = '"AppState"\n{\n\t"appid"\t"%s"\n\t"StateFlags"\t"2"\n}\n' % SCOUT_ID
|
||||
(other / ("steamapps/appmanifest_%s.acf" % SCOUT_ID)).write_text(partial)
|
||||
(self.steam / "steamapps/libraryfolders.vdf").write_text(
|
||||
'"libraryfolders"\n{\n\t"0"\n\t{\n\t\t"path"\t\t"%s"\n\t}\n}\n' % other)
|
||||
self.assertEqual(self.seed(), [EAC_ID, SCOUT_ID])
|
||||
self.assertFalse(self.manifest(SCOUT_ID).exists())
|
||||
self.assertIn('"StateFlags" "4"',
|
||||
(other / ("steamapps/appmanifest_%s.acf" % SCOUT_ID)).read_text())
|
||||
|
||||
def test_a_real_install_in_any_library_wins_over_a_partial_one(self):
|
||||
other = self.root / "SD"
|
||||
(other / "steamapps").mkdir(parents=True)
|
||||
partial = '"AppState"\n{\n\t"appid"\t"%s"\n\t"StateFlags"\t"2"\n}\n' % SCOUT_ID
|
||||
installed = '"AppState"\n{\n\t"appid"\t"%s"\n\t"StateFlags"\t"4"\n}\n' % SCOUT_ID
|
||||
self.manifest(SCOUT_ID).write_text(partial)
|
||||
(other / ("steamapps/appmanifest_%s.acf" % SCOUT_ID)).write_text(installed)
|
||||
(self.steam / "steamapps/libraryfolders.vdf").write_text(
|
||||
'"libraryfolders"\n{\n\t"0"\n\t{\n\t\t"path"\t\t"%s"\n\t}\n}\n' % other)
|
||||
self.assertEqual(self.seed(), [EAC_ID])
|
||||
self.assertEqual(self.manifest(SCOUT_ID).read_text(), partial)
|
||||
self.assertEqual((other / ("steamapps/appmanifest_%s.acf" % SCOUT_ID)).read_text(), installed)
|
||||
|
||||
def test_a_failed_write_leaves_no_manifest_behind(self):
|
||||
real_link = COMPAT["os"].link
|
||||
|
||||
def fail_for_scout(source, target):
|
||||
if SCOUT_ID in str(target):
|
||||
raise OSError("disk full")
|
||||
return real_link(source, target)
|
||||
|
||||
with mock.patch.object(COMPAT["os"], "link", side_effect=fail_for_scout):
|
||||
self.assertEqual(self.seed(), [EAC_ID])
|
||||
self.assertFalse(self.manifest(SCOUT_ID).exists())
|
||||
self.assertEqual(sorted(p.name for p in (self.steam / "steamapps").iterdir()),
|
||||
["appmanifest_%s.acf" % EAC_ID])
|
||||
self.assertEqual(self.seed(), [SCOUT_ID])
|
||||
self.assertEqual(self.manifest(SCOUT_ID).read_text(),
|
||||
COMPAT["manifest_text"](SCOUT_ID, SCOUT_NAME, SCOUT_NAME, True))
|
||||
|
||||
def test_new_manifest_publication_preserves_a_concurrent_install(self):
|
||||
real_link = COMPAT["os"].link
|
||||
installed = COMPAT["manifest_text"](SCOUT_ID, "Existing tool", "Existing", False)
|
||||
|
||||
def publish(source, target):
|
||||
if SCOUT_ID in str(target):
|
||||
Path(target).write_text(installed)
|
||||
return real_link(source, target)
|
||||
|
||||
with mock.patch.object(COMPAT["os"], "link", side_effect=publish):
|
||||
self.assertEqual(self.seed(), [EAC_ID])
|
||||
self.assertEqual(self.manifest(SCOUT_ID).read_text(), installed)
|
||||
self.assertEqual(self.seed(), [])
|
||||
self.assertFalse(list((self.steam / "steamapps").glob(".appmanifest_*")))
|
||||
|
||||
def test_partial_staged_write_is_not_published_and_retry_repairs(self):
|
||||
real_temporary = COMPAT["tempfile"].NamedTemporaryFile
|
||||
|
||||
def temporary(*args, **kwargs):
|
||||
output = real_temporary(*args, **kwargs)
|
||||
real_write = output.write
|
||||
|
||||
def write(text):
|
||||
if SCOUT_ID in text:
|
||||
real_write(text[:text.index(' "installdir"')])
|
||||
output.flush()
|
||||
raise OSError("disk full")
|
||||
return real_write(text)
|
||||
|
||||
output.write = write
|
||||
return output
|
||||
|
||||
with mock.patch.object(COMPAT["tempfile"], "NamedTemporaryFile", side_effect=temporary):
|
||||
self.assertEqual(self.seed(), [EAC_ID])
|
||||
self.assertFalse(self.manifest(SCOUT_ID).exists())
|
||||
self.assertFalse(list((self.steam / "steamapps").glob(".appmanifest_*")))
|
||||
self.assertEqual(self.seed(), [SCOUT_ID])
|
||||
self.assertEqual(self.manifest(SCOUT_ID).read_text(),
|
||||
COMPAT["manifest_text"](SCOUT_ID, SCOUT_NAME, SCOUT_NAME, True))
|
||||
|
||||
def test_failed_replacement_preserves_partial_manifest_and_retry_repairs(self):
|
||||
partial = '"AppState" { "appid" "%s" "StateFlags" "2" }' % SCOUT_ID
|
||||
self.manifest(SCOUT_ID).write_text(partial)
|
||||
with mock.patch.object(COMPAT["os"], "replace", side_effect=OSError("disk full")):
|
||||
self.assertEqual(self.seed(), [EAC_ID])
|
||||
self.assertEqual(self.manifest(SCOUT_ID).read_text(), partial)
|
||||
self.assertFalse(list((self.steam / "steamapps").glob(".appmanifest_*")))
|
||||
self.assertEqual(self.seed(), [SCOUT_ID])
|
||||
self.assertEqual(self.manifest(SCOUT_ID).read_text(),
|
||||
COMPAT["manifest_text"](SCOUT_ID, SCOUT_NAME, SCOUT_NAME, True))
|
||||
|
||||
def test_tools_with_an_arm64_depot_are_skipped(self):
|
||||
entries = dict(self.entries)
|
||||
entries[SCOUT] = tool(SCOUT_NAME, osarch="arm64")
|
||||
self.write_appinfo(entries)
|
||||
self.assertEqual(self.seed(), [EAC_ID])
|
||||
self.assertFalse(self.manifest(SCOUT_ID).exists())
|
||||
|
||||
def test_an_app_that_is_not_a_tool_is_skipped(self):
|
||||
entries = dict(self.entries)
|
||||
entries[SCOUT] = tool(SCOUT_NAME, kind="game")
|
||||
self.write_appinfo(entries)
|
||||
self.assertEqual(self.seed(), [EAC_ID])
|
||||
self.assertFalse(self.manifest(SCOUT_ID).exists())
|
||||
|
||||
def test_missing_appinfo_uses_the_display_names(self):
|
||||
(self.steam / "appcache/appinfo.vdf").unlink()
|
||||
COMPAT["APPINFO_CACHE"].clear()
|
||||
self.assertEqual(self.seed(), [EAC_ID, SCOUT_ID])
|
||||
self.assertIn('"name" "%s"' % SCOUT_NAME, self.manifest(SCOUT_ID).read_text())
|
||||
|
||||
def test_flag_seeds_without_running_full_compatibility_setup(self):
|
||||
with mock.patch.object(COMPAT["sys"], "argv",
|
||||
["steam-compatibility", str(self.steam), "--seed-arm64-tools"]):
|
||||
COMPAT["main"]()
|
||||
self.assertTrue(self.manifest(EAC_ID).is_file())
|
||||
self.assertTrue(self.manifest(SCOUT_ID).is_file())
|
||||
self.assertFalse((self.steam / "compatibilitytools.d").exists())
|
||||
|
||||
def test_session_seeds_only_on_the_arm64_client_path(self):
|
||||
arm64, x64 = SESSION.read_text().split(
|
||||
" else\n _dd_x64_tool=$(droiddeck-steam-x64 --default-tool)", 1)
|
||||
self.assertIn('steam-compatibility "$steam_root" --seed-arm64-tools', arm64)
|
||||
self.assertNotIn("--seed-arm64-tools", x64)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -626,6 +626,10 @@ def support_data(**arguments):
|
||||
return {'install': {'action': 'supportData', 'arguments': arguments}, 'name': 'supportData'}
|
||||
|
||||
|
||||
def save_path(**arguments):
|
||||
return {'install': {'action': 'savePath', 'arguments': arguments}, 'name': 'saveFolders'}
|
||||
|
||||
|
||||
class GogSupportData(unittest.TestCase):
|
||||
def prefix(self, root):
|
||||
user = Path(root) / 'compat/pfx/drive_c/users/steamuser'
|
||||
@@ -809,6 +813,101 @@ class GogSupportData(unittest.TestCase):
|
||||
self.assertTrue((Path(root) / 'compat/pfx/drive_c/users/steamuser/Documents/My Games/G').is_dir())
|
||||
|
||||
|
||||
class GogSavePaths(unittest.TestCase):
|
||||
def prefix(self, root):
|
||||
user = Path(root) / 'compat/pfx/drive_c/users/steamuser'
|
||||
user.mkdir(parents=True)
|
||||
return user
|
||||
|
||||
def test_the_london_script_creates_its_save_path_and_keeps_player_settings(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
folder = game(root, store_id='gog', ident='1897848199')
|
||||
user = self.prefix(root)
|
||||
support = folder / 'support/1897848199'
|
||||
(support / 'docs').mkdir(parents=True)
|
||||
(folder / '__AppData').mkdir()
|
||||
(folder / '__AppData/save.dat').write_text('save')
|
||||
for name in ('Fallout4Prefs.ini', 'Fallout4.ini'):
|
||||
(support / 'docs' / name).write_text('[Archive]\n')
|
||||
for name in ('DLCList.txt', 'Plugins.txt', 'UserDownloadedContent.txt'):
|
||||
(support / name).write_text('*LondonWorldSpace.esm\n')
|
||||
gog_script(folder, '1897848199', [
|
||||
save_path(savePath='{userdocs}/My Games/Fallout4', type='folder'),
|
||||
set_registry(root='HKLM', subkey='Software\\Bethesda Softworks\\Fallout4',
|
||||
valueName='Installed Path', valueData='{app}\\', valueType='string'),
|
||||
support_data(type='folder', target='{userdocs}/My Games/Fallout4'),
|
||||
support_data(type='folder', target='{localappdata}/Fallout4'),
|
||||
support_data(type='file', overwrite=True, source='{supportDir}/docs/Fallout4Prefs.ini',
|
||||
target='{userdocs}/My Games/Fallout4/Fallout4Prefs.ini'),
|
||||
support_data(type='file', overwrite=True, source='{supportDir}/docs/Fallout4.ini',
|
||||
target='{userdocs}/My Games/Fallout4/Fallout4.ini'),
|
||||
support_data(type='file', overwrite=True, source='{supportDir}/DLCList.txt',
|
||||
target='{localappdata}/Fallout4/DLCList.txt'),
|
||||
support_data(type='file', overwrite=True, source='{supportDir}/Plugins.txt',
|
||||
target='{localappdata}/Fallout4/Plugins.txt'),
|
||||
support_data(type='file', overwrite=True, source='{supportDir}/UserDownloadedContent.txt',
|
||||
target='{localappdata}/Fallout4/UserDownloadedContent.txt'),
|
||||
support_data(type='folder', overwrite=True, source='{app}/__AppData', target='{localappdata}/Fallout4'),
|
||||
])
|
||||
with patch.object(store, 'create_prefix') as create:
|
||||
self.assertEqual('copied=6', store.gog_support_data(folder, root + '/compat', '/proton'))
|
||||
self.assertEqual('paths=1', store.gog_save_paths(folder, root + '/compat', '/proton'))
|
||||
create.assert_not_called()
|
||||
saves = user / 'Documents/My Games/Fallout4'
|
||||
self.assertTrue(saves.is_dir())
|
||||
self.assertEqual('[Archive]\n', (saves / 'Fallout4.ini').read_text())
|
||||
self.assertEqual('*LondonWorldSpace.esm\n', (user / 'AppData/Local/Fallout4/Plugins.txt').read_text())
|
||||
self.assertTrue((Path(root) / 'compat/pfx' / store.GOG_SAVE_PATH_MARK).is_file())
|
||||
(saves / 'my settings.ini').write_text('player')
|
||||
self.assertEqual('ready', store.gog_save_paths(folder, root + '/compat', '/proton'))
|
||||
self.assertEqual('player', (saves / 'my settings.ini').read_text())
|
||||
|
||||
def test_only_save_path_actions_create_known_folders(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
folder = game(root, store_id='gog', ident='9')
|
||||
user = self.prefix(root)
|
||||
saves = user / 'Documents/My Games/Fallout4'
|
||||
saves.mkdir(parents=True)
|
||||
(saves / 'Fallout4Prefs.ini').write_text('player')
|
||||
gog_script(folder, '9', [
|
||||
set_registry(root='HKLM', subkey='Software\\Game', valueName='a', valueData='b', valueType='string'),
|
||||
{'install': {'action': 'createFolder', 'arguments': {'savePath': '{userdocs}/Other'}}},
|
||||
save_path(savePath='{windir}/evil'),
|
||||
save_path(savePath='{userdocs}/../../escape'),
|
||||
save_path(savePath='{userappdata}/Ubisoft/Anno1404/Config'),
|
||||
])
|
||||
self.assertEqual('paths=1 skipped=2', store.gog_save_paths(folder, root + '/compat', '/proton'))
|
||||
self.assertTrue((user / 'AppData/Roaming/Ubisoft/Anno1404/Config').is_dir())
|
||||
self.assertFalse((user / 'Documents/Other').exists())
|
||||
self.assertFalse((Path(root) / 'escape').exists())
|
||||
self.assertEqual('player', (saves / 'Fallout4Prefs.ini').read_text())
|
||||
self.assertFalse((Path(root) / 'compat/pfx' / store.GOG_SAVE_PATH_MARK).exists())
|
||||
|
||||
def test_without_save_paths_no_prefix_is_made(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
folder = game(root, store_id='gog', ident='9')
|
||||
gog_script(folder, '9', [set_registry(root='HKLM', subkey='Software\\Game', valueName='a',
|
||||
valueData='b', valueType='string')])
|
||||
with patch.object(store, 'create_prefix') as create:
|
||||
self.assertEqual('none', store.gog_save_paths(folder, root + '/compat', '/proton'))
|
||||
create.assert_not_called()
|
||||
|
||||
def test_a_missing_prefix_is_made_first(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
folder = game(root, store_id='gog', ident='9')
|
||||
gog_script(folder, '9', [save_path(savePath='{userdocs}/My Games/G')])
|
||||
with patch.object(store, 'create_prefix', return_value='failed') as create:
|
||||
self.assertEqual('no-prefix', store.gog_save_paths(folder, root + '/compat', '/proton'))
|
||||
create.assert_called_once_with(root + '/compat', '/proton')
|
||||
|
||||
def made(compat_data, proton):
|
||||
self.prefix(root)
|
||||
return 'created'
|
||||
with patch.object(store, 'create_prefix', side_effect=made):
|
||||
self.assertEqual('paths=1', store.gog_save_paths(folder, root + '/compat', '/proton'))
|
||||
self.assertTrue((Path(root) / 'compat/pfx/drive_c/users/steamuser/Documents/My Games/G').is_dir())
|
||||
|
||||
|
||||
class GogRegistry(unittest.TestCase):
|
||||
def test_patch_registration_uses_authentic_build_and_the_prefix_registry_executable(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
|
||||
@@ -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"):
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
[Desktop Entry]
|
||||
Name=Return to Gaming Mode
|
||||
Comment=Log out of the desktop and go back to Steam
|
||||
Exec=dbus-send --session --type=method_call --dest=org.kde.Shutdown /Shutdown org.kde.Shutdown.logout
|
||||
Icon=steamdeck-gaming-return
|
||||
Terminal=false
|
||||
Type=Application
|
||||
StartupNotify=false
|
||||
NoDisplay=true
|
||||
Reference in new issue
Block a user