mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 21:06:09 +00:00
fix(game-env): repair foreign-architecture system DLLs in ARM64 prefixes (#2318)
Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>
This commit is contained in:
1 parent
1ec2b696b7
commit
13c8edb3d5
6 files changed
+579
-24
No files matched your search
@@ -708,6 +708,54 @@ class ReadConfigMappingTest(unittest.TestCase):
|
||||
|
||||
|
||||
class GameEnvironmentTest(unittest.TestCase):
|
||||
def test_component_filter_and_prefix_repair_use_per_game_proton_architecture(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
home = Path(tmp)
|
||||
config = home / ".config/droiddeck/game-environment.json"
|
||||
config.parent.mkdir(parents=True)
|
||||
config.write_text(json.dumps({"version": 1, "shared": {"PROTON_USE_ARM64": "1"},
|
||||
"games": {"42": {"PROTON_USE_ARM64": "0"}}}))
|
||||
seen_components, seen_repair, seen_start = [], [], []
|
||||
globals = MODULE["main"].__globals__
|
||||
stubs = {
|
||||
"game_gpu": lambda env: env,
|
||||
"mark_install_scripts": lambda command, env: [],
|
||||
"install_scripts_done": lambda scripts, env: False,
|
||||
"scripts_digest": lambda scripts: None,
|
||||
"win_components": lambda *args: seen_components.append(args[3]) or "",
|
||||
"repair_foreign_system_dlls": lambda *args: seen_repair.append(args[2]) or [],
|
||||
"gl_vsync": lambda env: False,
|
||||
"game_images": lambda env: None,
|
||||
"skip_red_launcher": lambda command: command,
|
||||
"ubisoft_overlay_off": lambda env: None,
|
||||
"project_zomboid_jvm": lambda command: None,
|
||||
"engine_fixes": lambda *args: ({}, [], []),
|
||||
"dirt_ws2_wanted": lambda *args: None,
|
||||
"apply_game_debug_logs": lambda env, config, debug_dir: env,
|
||||
"offline_without_anticheat": lambda command, env: command,
|
||||
"game_logs": lambda command, env, app_id: env,
|
||||
"directaudio_settings": lambda env: env,
|
||||
"vram_cap": lambda env: env,
|
||||
"render_path_defaults": lambda *args: None,
|
||||
"bridge_feature_level": lambda env: None,
|
||||
"force_ssbs": lambda command, env: env,
|
||||
"game_cores": lambda env: None,
|
||||
"cpu_topology": lambda env, command: None,
|
||||
"ego_core_plan": lambda *args: None,
|
||||
"runpy": mock.Mock(run_path=lambda *args: {"launch": lambda command, env: None}),
|
||||
"load_sync": lambda: {},
|
||||
"select_sync": lambda command, env, sync: (command, env),
|
||||
"start": lambda command, env, *args: seen_start.append(env) or 7,
|
||||
}
|
||||
environment = {"HOME": tmp, "STEAM_COMPAT_DATA_PATH": "/compatdata/42", "PROTON_USE_ARM64": "1"}
|
||||
command = ["/stock/proton", "waitforexitandrun", "/game/game.exe"]
|
||||
with patch.dict(os.environ, environment, clear=True), patch.object(sys, "argv", ["game-env", *command]), \
|
||||
patch.dict(globals, stubs):
|
||||
self.assertEqual(MODULE["main"](), 7)
|
||||
self.assertEqual(["0"], [env["PROTON_USE_ARM64"] for env in seen_components])
|
||||
self.assertEqual(["0"], [env["PROTON_USE_ARM64"] for env in seen_repair])
|
||||
self.assertEqual(["0"], [env["PROTON_USE_ARM64"] for env in seen_start])
|
||||
|
||||
def test_optional_xbox_loader_failure_keeps_stock_launch(self):
|
||||
from unittest.mock import patch
|
||||
for error in (FileNotFoundError('missing'), RuntimeError('module initialization failed')):
|
||||
@@ -2585,6 +2633,167 @@ class UbisoftCompositionTest(unittest.TestCase):
|
||||
self.assertEqual(list(prefix.glob(".ubisoft-*.reg")), [])
|
||||
|
||||
|
||||
|
||||
def pe_image(machine):
|
||||
head = bytearray(64)
|
||||
head[:2] = b"MZ"
|
||||
head[60:64] = (64).to_bytes(4, "little")
|
||||
return bytes(head) + b"PE\0\0" + machine.to_bytes(2, "little") + b"\0" * 32
|
||||
|
||||
|
||||
def arm64ec_pe_image():
|
||||
image = bytearray(0x400)
|
||||
image[:2] = b"MZ"
|
||||
image[60:64] = (64).to_bytes(4, "little")
|
||||
image[64:68] = b"PE\0\0"
|
||||
coff = 68
|
||||
image[coff:coff + 2] = (0x8664).to_bytes(2, "little")
|
||||
image[coff + 2:coff + 4] = (1).to_bytes(2, "little")
|
||||
image[coff + 16:coff + 18] = (240).to_bytes(2, "little")
|
||||
optional = coff + 20
|
||||
image[optional:optional + 2] = (0x20B).to_bytes(2, "little")
|
||||
image[optional + 108:optional + 112] = (16).to_bytes(4, "little")
|
||||
directory = optional + 112 + 10 * 8
|
||||
image[directory:directory + 4] = (0x1000).to_bytes(4, "little")
|
||||
image[directory + 4:directory + 8] = (0xD0).to_bytes(4, "little")
|
||||
section = optional + 240
|
||||
image[section + 8:section + 12] = (0x200).to_bytes(4, "little")
|
||||
image[section + 12:section + 16] = (0x1000).to_bytes(4, "little")
|
||||
image[section + 16:section + 20] = (0x200).to_bytes(4, "little")
|
||||
image[section + 20:section + 24] = (0x200).to_bytes(4, "little")
|
||||
image[0x200:0x204] = (0xD0).to_bytes(4, "little")
|
||||
image[0x2C8:0x2D0] = (0x10000000).to_bytes(8, "little")
|
||||
return bytes(image)
|
||||
|
||||
|
||||
class ForeignSystemDllTest(unittest.TestCase):
|
||||
def prefix(self, tmp, arm=True):
|
||||
proton = Path(tmp) / "Proton"
|
||||
dist = proton / "files/lib/wine"
|
||||
if arm:
|
||||
(dist / "aarch64-unix").mkdir(parents=True)
|
||||
else:
|
||||
(dist / "x86_64-unix").mkdir(parents=True)
|
||||
for libdir, machine in (("aarch64-windows", 0xAA64), ("i386-windows", 0x14C)):
|
||||
(dist / libdir).mkdir(parents=True)
|
||||
for name in ("ucrtbase.dll", "rpcrt4.dll"):
|
||||
(dist / libdir / name).write_bytes(pe_image(machine))
|
||||
windows = Path(tmp) / "compat/pfx/drive_c/windows"
|
||||
for folder in ("system32", "syswow64"):
|
||||
(windows / folder).mkdir(parents=True)
|
||||
return proton / "proton", Path(tmp) / "compat", windows
|
||||
|
||||
def run_repair(self, compat, proton):
|
||||
return MODULE["repair_foreign_system_dlls"](str(compat), str(proton))
|
||||
|
||||
def test_x64_dll_in_arm64_system32_is_replaced_by_the_builtin(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
proton, compat, windows = self.prefix(tmp)
|
||||
(windows / "system32/UCRTBASE.DLL").write_bytes(pe_image(0x8664))
|
||||
(windows / "system32/rpcrt4.dll").write_bytes(pe_image(0xAA64))
|
||||
fixed = self.run_repair(compat, proton)
|
||||
self.assertEqual(["system32/UCRTBASE.DLL (machine 0x8664)"], fixed)
|
||||
self.assertTrue((windows / "system32/UCRTBASE.DLL").is_symlink())
|
||||
self.assertEqual(0xAA64, MODULE["pe_machine"](windows / "system32/UCRTBASE.DLL"))
|
||||
self.assertEqual(0x8664, MODULE["pe_machine"](windows / "system32/UCRTBASE.DLL.foreign-arch"))
|
||||
self.assertFalse((windows / "system32/rpcrt4.dll").is_symlink())
|
||||
self.assertEqual([], self.run_repair(compat, proton))
|
||||
|
||||
def test_64_bit_dll_in_syswow64_is_replaced(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
proton, compat, windows = self.prefix(tmp)
|
||||
(windows / "syswow64/ucrtbase.dll").write_bytes(pe_image(0xAA64))
|
||||
self.assertEqual(["syswow64/ucrtbase.dll (machine 0xaa64)"], self.run_repair(compat, proton))
|
||||
self.assertEqual(0x14C, MODULE["pe_machine"](windows / "syswow64/ucrtbase.dll"))
|
||||
|
||||
def test_matching_ec_symlinked_unknown_and_non_pe_files_are_left_alone(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
proton, compat, windows = self.prefix(tmp)
|
||||
system32 = windows / "system32"
|
||||
(system32 / "ucrtbase.dll").write_bytes(pe_image(0xA641))
|
||||
(system32 / "userlib.dll").write_bytes(pe_image(0x8664))
|
||||
(system32 / "rpcrt4.dll").write_bytes(b"not a pe file")
|
||||
self.assertEqual([], self.run_repair(compat, proton))
|
||||
self.assertFalse((system32 / "ucrtbase.dll").is_symlink())
|
||||
self.assertEqual(0x8664, MODULE["pe_machine"](system32 / "userlib.dll"))
|
||||
|
||||
def test_final_arm64ec_image_is_not_repaired_as_a_foreign_x64_dll(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
proton, compat, windows = self.prefix(tmp)
|
||||
dll = windows / "system32/ucrtbase.dll"
|
||||
dll.write_bytes(arm64ec_pe_image())
|
||||
self.assertEqual(0x8664, MODULE["pe_machine"](dll))
|
||||
self.assertTrue(MODULE["PE"]["machine_compatible"](dll, frozenset((0xAA64, 0xA641))))
|
||||
self.assertFalse(MODULE["PE"]["machine_compatible"](dll, frozenset((0x8664,))))
|
||||
self.assertEqual([], self.run_repair(compat, proton))
|
||||
self.assertFalse(dll.is_symlink())
|
||||
|
||||
def test_component_owned_and_native_first_foreign_dlls_are_still_replaced(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
proton, compat, windows = self.prefix(tmp)
|
||||
(windows / "system32/ucrtbase.dll").write_bytes(pe_image(0x8664))
|
||||
(windows / "system32/rpcrt4.dll").write_bytes(pe_image(0x8664))
|
||||
state = {"files": {"drive_c/windows/system32/ucrtbase.dll": {}}}
|
||||
(compat / ".droiddeck-wincomponents.json").write_text(json.dumps(state))
|
||||
reg = 'WINE REGISTRY Version 2\n\n[Software\\\\Wine\\\\DllOverrides] 1\n"RPCRT4.DLL"="native,builtin"\n'
|
||||
(compat / "pfx/user.reg").write_text(reg)
|
||||
env = {"WINEDLLOVERRIDES": "ucrtbase=n,b"}
|
||||
self.assertEqual(["system32/rpcrt4.dll (machine 0x8664)", "system32/ucrtbase.dll (machine 0x8664)"],
|
||||
sorted(MODULE["repair_foreign_system_dlls"](str(compat), str(proton), env)))
|
||||
self.assertEqual(0xAA64, MODULE["pe_machine"](windows / "system32/ucrtbase.dll"))
|
||||
self.assertEqual(0xAA64, MODULE["pe_machine"](windows / "system32/rpcrt4.dll"))
|
||||
|
||||
def test_newest_foreign_copy_is_the_only_backup_and_failed_final_replace_restores_it(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
proton, compat, windows = self.prefix(tmp)
|
||||
dll = windows / "system32/ucrtbase.dll"
|
||||
dll.write_bytes(pe_image(0x8664))
|
||||
backup = windows / "system32/ucrtbase.dll.foreign-arch"
|
||||
backup.write_bytes(pe_image(0x1234))
|
||||
self.assertEqual(["system32/ucrtbase.dll (machine 0x8664)"], self.run_repair(compat, proton))
|
||||
self.assertEqual(0x1234, MODULE["pe_machine"](backup))
|
||||
self.assertEqual(0x8664, MODULE["pe_machine"](backup.with_name(backup.name + ".1")))
|
||||
self.assertEqual(0xAA64, MODULE["pe_machine"](dll))
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
proton, compat, windows = self.prefix(tmp)
|
||||
dll = windows / "system32/ucrtbase.dll"
|
||||
dll.write_bytes(pe_image(0x8664))
|
||||
backup = windows / "system32/ucrtbase.dll.foreign-arch"
|
||||
backup.write_bytes(pe_image(0x1234))
|
||||
real = os.replace
|
||||
def flaky_with_backup(src, dst):
|
||||
if str(src).endswith(".bl-new"):
|
||||
raise OSError("boom")
|
||||
return real(src, dst)
|
||||
with mock.patch("os.replace", side_effect=flaky_with_backup):
|
||||
self.assertEqual([], self.run_repair(compat, proton))
|
||||
self.assertEqual(0x8664, MODULE["pe_machine"](dll))
|
||||
self.assertFalse((windows / "system32/ucrtbase.dll.foreign-arch.1").exists())
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
proton, compat, windows = self.prefix(tmp)
|
||||
dll = windows / "system32/ucrtbase.dll"
|
||||
dll.write_bytes(pe_image(0x8664))
|
||||
real = os.replace
|
||||
def flaky(src, dst):
|
||||
if str(src).endswith(".bl-new"):
|
||||
raise OSError("boom")
|
||||
return real(src, dst)
|
||||
with mock.patch("os.replace", side_effect=flaky):
|
||||
self.assertEqual([], self.run_repair(compat, proton))
|
||||
self.assertEqual(0x8664, MODULE["pe_machine"](dll))
|
||||
self.assertFalse(dll.is_symlink())
|
||||
self.assertFalse((windows / "system32/ucrtbase.dll.foreign-arch").exists())
|
||||
self.assertFalse((windows / "system32/ucrtbase.dll.bl-new").is_symlink())
|
||||
|
||||
def test_non_arm64_proton_and_missing_prefix_are_untouched(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
proton, compat, windows = self.prefix(tmp, arm=False)
|
||||
(windows / "system32/ucrtbase.dll").write_bytes(pe_image(0x8664))
|
||||
self.assertEqual([], self.run_repair(compat, proton))
|
||||
self.assertEqual(0x8664, MODULE["pe_machine"](windows / "system32/ucrtbase.dll"))
|
||||
self.assertEqual([], self.run_repair(Path(tmp) / "missing", proton))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
|
||||
@@ -35,8 +35,134 @@ class WinComponentsTest(unittest.TestCase):
|
||||
def pick(self, *ids):
|
||||
self.selection.write_text(json.dumps({"version": 1, "games": {"2571976725": list(ids)}}))
|
||||
|
||||
def apply(self):
|
||||
return MODULE["apply"](self.compat, "2571976725", self.selection, self.store)
|
||||
def apply(self, proton=None, env=None):
|
||||
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")
|
||||
(root / "files/lib/wine" / ("aarch64-unix" if arm else "x86_64-unix")).mkdir(parents=True)
|
||||
return root / "proton"
|
||||
|
||||
def pe_image(self, machine):
|
||||
head = bytearray(64)
|
||||
head[:2] = b"MZ"
|
||||
head[60:64] = (64).to_bytes(4, "little")
|
||||
return bytes(head) + b"PE\0\0" + machine.to_bytes(2, "little") + b"\0" * 32
|
||||
|
||||
def arm64ec_pe_image(self):
|
||||
image = bytearray(0x400)
|
||||
image[:2] = b"MZ"
|
||||
image[60:64] = (64).to_bytes(4, "little")
|
||||
image[64:68] = b"PE\0\0"
|
||||
coff = 68
|
||||
image[coff:coff + 2] = (0x8664).to_bytes(2, "little")
|
||||
image[coff + 2:coff + 4] = (1).to_bytes(2, "little")
|
||||
image[coff + 16:coff + 18] = (240).to_bytes(2, "little")
|
||||
optional = coff + 20
|
||||
image[optional:optional + 2] = (0x20B).to_bytes(2, "little")
|
||||
image[optional + 108:optional + 112] = (16).to_bytes(4, "little")
|
||||
directory = optional + 112 + 10 * 8
|
||||
image[directory:directory + 4] = (0x1000).to_bytes(4, "little")
|
||||
image[directory + 4:directory + 8] = (0xD0).to_bytes(4, "little")
|
||||
section = optional + 240
|
||||
image[section + 8:section + 12] = (0x200).to_bytes(4, "little")
|
||||
image[section + 12:section + 16] = (0x1000).to_bytes(4, "little")
|
||||
image[section + 16:section + 20] = (0x200).to_bytes(4, "little")
|
||||
image[section + 20:section + 24] = (0x200).to_bytes(4, "little")
|
||||
image[0x200:0x204] = (0xD0).to_bytes(4, "little")
|
||||
image[0x2C8:0x2D0] = (0x10000000).to_bytes(8, "little")
|
||||
return bytes(image)
|
||||
|
||||
def test_foreign_component_dll_is_skipped_and_override_dropped(self):
|
||||
proton = self.proton()
|
||||
self.component("vc", ["ucrtbase"], {"system32/ucrtbase.dll": self.pe_image(0x8664)})
|
||||
self.pick("vc")
|
||||
names, _ = self.apply(proton)
|
||||
self.assertEqual(names, [])
|
||||
self.assertFalse((self.pfx / "system32/ucrtbase.dll").exists())
|
||||
names, notes = self.apply(proton)
|
||||
self.assertEqual(names, [])
|
||||
self.assertEqual(notes, [])
|
||||
|
||||
def test_component_final_arm64ec_dll_is_placed_and_keeps_its_override(self):
|
||||
proton = self.proton()
|
||||
self.component("vc", ["ucrtbase"], {"system32/ucrtbase.dll": self.arm64ec_pe_image()})
|
||||
self.pick("vc")
|
||||
names, _ = self.apply(proton)
|
||||
self.assertEqual(names, ["ucrtbase"])
|
||||
self.assertEqual(MODULE["pe_machine"](self.pfx / "system32/ucrtbase.dll"), 0x8664)
|
||||
|
||||
def test_compatible_copy_keeps_override_when_other_architecture_copy_is_skipped(self):
|
||||
proton = self.proton()
|
||||
self.component("vc", ["ucrtbase"], {
|
||||
"system32/ucrtbase.dll": self.pe_image(0x8664),
|
||||
"syswow64/ucrtbase.dll": self.pe_image(0x14C),
|
||||
})
|
||||
self.pick("vc")
|
||||
names, _ = self.apply(proton)
|
||||
self.assertEqual(names, ["ucrtbase"])
|
||||
self.assertFalse((self.pfx / "system32/ucrtbase.dll").exists())
|
||||
self.assertEqual(MODULE["pe_machine"](self.pfx / "syswow64/ucrtbase.dll"), 0x14C)
|
||||
|
||||
def test_existing_foreign_component_dll_is_removed_for_repair(self):
|
||||
proton = self.proton()
|
||||
self.component("vc", ["ucrtbase"], {"system32/ucrtbase.dll": self.pe_image(0x8664)})
|
||||
self.pick("vc")
|
||||
self.pfx.joinpath("system32").mkdir(parents=True)
|
||||
self.pfx.joinpath("system32/ucrtbase.dll").write_bytes(self.pe_image(0x8664))
|
||||
self.compat.joinpath(".droiddeck-wincomponents.json").write_text(json.dumps({
|
||||
"files": {"drive_c/windows/system32/ucrtbase.dll": "vc"}, "components": ["vc"]}))
|
||||
self.apply(proton)
|
||||
self.assertFalse((self.pfx / "system32/ucrtbase.dll").exists())
|
||||
self.assertEqual([], GAME_ENV["repair_foreign_system_dlls"](str(self.compat), str(proton)))
|
||||
self.assertEqual([], GAME_ENV["repair_foreign_system_dlls"](str(self.compat), str(proton)))
|
||||
|
||||
def test_foreign_component_restore_does_not_override_repair_with_native_override(self):
|
||||
proton = self.proton()
|
||||
builtin = Path(self.tmp.name) / "arm-proton/files/lib/wine/aarch64-windows/ucrtbase.dll"
|
||||
builtin.parent.mkdir(parents=True, exist_ok=True)
|
||||
builtin.write_bytes(self.pe_image(0xAA64))
|
||||
system32 = self.pfx / "system32"
|
||||
system32.mkdir(parents=True)
|
||||
dll = system32 / "ucrtbase.dll"
|
||||
dll.write_bytes(self.pe_image(0x8664))
|
||||
backup = self.compat / ".droiddeck-wincomponents-backup/drive_c/windows/system32/ucrtbase.dll"
|
||||
backup.parent.mkdir(parents=True)
|
||||
backup.write_bytes(self.pe_image(0x8664))
|
||||
self.compat.joinpath(".droiddeck-wincomponents.json").write_text(json.dumps({
|
||||
"files": {"drive_c/windows/system32/ucrtbase.dll": "vc"}, "components": ["vc"]}))
|
||||
self.compat.joinpath("pfx/user.reg").parent.mkdir(parents=True, exist_ok=True)
|
||||
self.compat.joinpath("pfx/user.reg").write_text(
|
||||
'WINE REGISTRY Version 2\n\n[Software\\\\Wine\\\\DllOverrides] 1\n"ucrtbase"="native,builtin"\n')
|
||||
fixed = GAME_ENV["repair_foreign_system_dlls"](str(self.compat), str(proton))
|
||||
self.assertEqual(["system32/ucrtbase.dll (machine 0x8664)"], fixed)
|
||||
self.apply(proton)
|
||||
self.assertTrue(dll.is_symlink())
|
||||
self.assertEqual(0xAA64, MODULE["pe_machine"](dll))
|
||||
|
||||
def test_matching_component_dll_is_placed(self):
|
||||
proton = self.proton()
|
||||
self.component("vc", ["ucrtbase"], {"system32/ucrtbase.dll": self.pe_image(0xAA64)})
|
||||
self.pick("vc")
|
||||
names, _ = self.apply(proton)
|
||||
self.assertEqual(names, ["ucrtbase"])
|
||||
self.assertEqual(MODULE["pe_machine"](self.pfx / "system32/ucrtbase.dll"), 0xAA64)
|
||||
|
||||
def test_x64_proton_places_x64_component_dll(self):
|
||||
proton = self.proton(arm=False)
|
||||
self.component("vc", ["ucrtbase"], {"system32/ucrtbase.dll": self.pe_image(0x8664)})
|
||||
self.pick("vc")
|
||||
names, _ = self.apply(proton)
|
||||
self.assertEqual(names, ["ucrtbase"])
|
||||
self.assertEqual(MODULE["pe_machine"](self.pfx / "system32/ucrtbase.dll"), 0x8664)
|
||||
|
||||
def test_arm_proton_with_x64_selection_places_x64_component_dll(self):
|
||||
proton = self.proton()
|
||||
self.component("vc", ["ucrtbase"], {"system32/ucrtbase.dll": self.pe_image(0x8664)})
|
||||
self.pick("vc")
|
||||
names, _ = self.apply(proton, {"PROTON_USE_ARM64": "0"})
|
||||
self.assertEqual(names, ["ucrtbase"])
|
||||
self.assertEqual(MODULE["pe_machine"](self.pfx / "system32/ucrtbase.dll"), 0x8664)
|
||||
|
||||
def test_places_files_before_the_prefix_exists_and_returns_overrides(self):
|
||||
self.component("openal", ["openal32"], {"syswow64/OpenAL32.dll": b"x86", "system32/OpenAL32.dll": b"x64"})
|
||||
@@ -235,7 +361,7 @@ class WinComponentsTest(unittest.TestCase):
|
||||
self.pick("openal")
|
||||
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)
|
||||
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"), "openal32=n,b")
|
||||
self.assertEqual(GAME_ENV["win_components"]("", "2571976725"), "")
|
||||
|
||||
Reference in new issue
Block a user