Skip to content

armgit / soju

Public Imported from GitHub
0

Play Windows games on Apple Silicon Macs. Free, open-source app that installs the official Battle.net, Steam, Epic and GOG launchers and lists your games in one library.

M6 Macs go back to GPTK 3.0; a Battle.net start that was never seen reports the toolkit version (#229)

Mikekea653c5fb378
diff --git a/docs/privacy.html b/docs/privacy.html
index f301bd1bb4a..2fbc27124f2 100644
--- a/docs/privacy.html
+++ b/docs/privacy.html
@@ -29,7 +29,7 @@
<a href="sponsor.html">Advertise</a>
</div></nav>
<main id="main">
-<header class="hero"><h1>Privacy</h1><p class="lead">Soju is a Mac app made by Didim Labs. It keeps your game library on your Mac. This page lists everything that leaves it.</p></header><section id="signin" aria-labelledby="signin-title"><h2 id="signin-title">Signing in with Apple or Google</h2><ul><li>We ask Apple or Google only for your email address. We don&#x27;t ask for contacts, files or anything else.</li><li>Soju asks you to sign in before buying a game or getting a demo in the Didim Labs Store. We use that email to find games you bought from us through Polar, and hand the license keys back to your copy of Soju.</li><li>Our server keeps the sign-in result for at most 10 minutes, then deletes it. Soju keeps your email and keys on your Mac (keys in the macOS Keychain).</li><li>Your Didim Labs account is that email, the provider (Apple or Google) and the days you first and last signed in. We keep it so your games and demos stay with you; a purchase made from Soju uses the same email. Write to us to delete it.</li><li>If you use Apple&#x27;s Hide My Email, we only see the relay address, so purchases made with your real email won&#x27;t be found.</li></ul></section><section id="purchases" aria-labelledby="purchases-title"><h2 id="purchases-title">Buying games</h2><p>Payments go through <a href="https://polar.sh/legal/privacy">Polar</a>, which acts as the seller of record and handles card details, receipts and taxes. We see your email, name, country and what you bought. We never see card numbers.</p></section><section id="app" aria-labelledby="app-title"><h2 id="app-title">What the Soju app sends</h2><ul><li>Soju downloads the store list and the sponsor card from didimlabs.com, and game files from Polar or GitHub.</li><li>When it opens, Soju asks GitHub for the list of Soju releases to tell you if a newer version is out. The request says nothing about you or your games.</li><li>Account connections you add (Steam, GOG and others) talk to those services directly from your Mac.</li><li>If you turn on TV &amp; iPad streaming, Soju installs Sunshine (open source, LizardByte) on your Mac. It streams only to devices you pair with a PIN on your own network, keeps its settings page on your Mac, and only contacts GitHub to check for new versions.</li><li>Play counts (on unless you turn them off): Soju sends which games are installed (once a day) and how many minutes a game stayed open, with your Mac model, chip, macOS and Soju version and a random id made on your Mac. When a game closes within a minute or does not start, it also sends a short reason read on your Mac from Soju&#x27;s launch log: one word (such as crash or missing file), the name of the missing file or the error number, and which anti-cheat the game uses. The log itself stays on your Mac. No account, email, name or file path. We use it only to see which games run, and publish no one&#x27;s data. Turn it off under Stores (Share which games I play) or with soju stats off.</li><li>Soju has no ads tracking or crash reporting.</li></ul></section><section id="site" aria-labelledby="site-title"><h2 id="site-title">This website</h2><p>didimlabs.com runs on Cloudflare, which keeps standard request logs. Pages load Cloudflare Web Analytics, which counts page views and load times without cookies and without identifying you. The site sets no cookies. If you send the advertising form, we get what you type and reply by email.</p></section><section id="news" aria-labelledby="news-title"><h2 id="news-title">Release news emails</h2><p>If you type your email to hear about our next game, we keep that address only for that. We send an email when a new game comes out and nothing else. Write to [email protected] to be removed.</p></section><section id="contact" aria-labelledby="contact-title"><h2 id="contact-title">Questions or deletion</h2><p>Email <a href="mailto:[email protected]">[email protected]</a>. We can tell you what we hold and delete it, except records Polar must keep for tax law. To remove everything from your Mac, sign out in Soju and delete the app.</p></section><section id="ko" aria-labelledby="ko-title"><h2 id="ko-title">개인정보 처리 (요약)</h2><p>디딤랩스 스토어에서 게임을 사거나 데모를 받을 때 애플·구글 로그인을 합니다. 이메일 주소만 받아, Polar에서 그 이메일로 산 게임의 라이선스 키를 찾는 데 한 번 씁니다. 로그인 결과는 서버에 최대 10분만 남고, 디딤랩스 계정으로 이메일·로그인 방식·처음과 마지막 로그인 날짜를 보관합니다. 소주에서 결제할 때도 같은 이메일을 씁니다. 결제 정보는 Polar가 처리하며 우리는 카드 번호를 보지 않습니다. 소주 앱은 설치한 게임 목록(하루 한 번)과 게임별 플레이 시간을 맥 기종·macOS·소주 버전, 맥에서 만든 무작위 번호와 함께 보냅니다. 계정, 이메일, 이름, 파일 경로는 보내지 않고, 어떤 게임이 되는지 보는 데만 쓰고 개인별 기록은 공개하지 않습니다. Platforms의 Share which games I play나 soju stats off로 끌 수 있습니다. 웹사이트는 쿠키 없이 방문 수와 로딩 속도만 세는 Cloudflare Web Analytics를 씁니다. 출시 알림을 신청한 이메일은 새 게임 소식에만 씁니다. 문의와 삭제 요청: [email protected]</p></section>
+<header class="hero"><h1>Privacy</h1><p class="lead">Soju is a Mac app made by Didim Labs. It keeps your game library on your Mac. This page lists everything that leaves it.</p></header><section id="signin" aria-labelledby="signin-title"><h2 id="signin-title">Signing in with Apple or Google</h2><ul><li>We ask Apple or Google only for your email address. We don&#x27;t ask for contacts, files or anything else.</li><li>Soju asks you to sign in before buying a game or getting a demo in the Didim Labs Store. We use that email to find games you bought from us through Polar, and hand the license keys back to your copy of Soju.</li><li>Our server keeps the sign-in result for at most 10 minutes, then deletes it. Soju keeps your email and keys on your Mac (keys in the macOS Keychain).</li><li>Your Didim Labs account is that email, the provider (Apple or Google) and the days you first and last signed in. We keep it so your games and demos stay with you; a purchase made from Soju uses the same email. Write to us to delete it.</li><li>If you use Apple&#x27;s Hide My Email, we only see the relay address, so purchases made with your real email won&#x27;t be found.</li></ul></section><section id="purchases" aria-labelledby="purchases-title"><h2 id="purchases-title">Buying games</h2><p>Payments go through <a href="https://polar.sh/legal/privacy">Polar</a>, which acts as the seller of record and handles card details, receipts and taxes. We see your email, name, country and what you bought. We never see card numbers.</p></section><section id="app" aria-labelledby="app-title"><h2 id="app-title">What the Soju app sends</h2><ul><li>Soju downloads the store list and the sponsor card from didimlabs.com, and game files from Polar or GitHub.</li><li>When it opens, Soju asks GitHub for the list of Soju releases to tell you if a newer version is out. The request says nothing about you or your games.</li><li>Account connections you add (Steam, GOG and others) talk to those services directly from your Mac.</li><li>If you turn on TV &amp; iPad streaming, Soju installs Sunshine (open source, LizardByte) on your Mac. It streams only to devices you pair with a PIN on your own network, keeps its settings page on your Mac, and only contacts GitHub to check for new versions.</li><li>Play counts (on unless you turn them off): Soju sends which games are installed (once a day) and how many minutes a game stayed open, with your Mac model, chip, macOS and Soju version and a random id made on your Mac. When a game closes within a minute or does not start, it also sends a short reason read on your Mac from Soju&#x27;s launch log: one word (such as crash or missing file), the name of the missing file or the error number, which anti-cheat the game uses, and for a Battle.net game that never appeared, the version of Apple&#x27;s toolkit in Soju&#x27;s engine. The log itself stays on your Mac. No account, email, name or file path. We use it only to see which games run, and publish no one&#x27;s data. Turn it off under Stores (Share which games I play) or with soju stats off.</li><li>Soju has no ads tracking or crash reporting.</li></ul></section><section id="site" aria-labelledby="site-title"><h2 id="site-title">This website</h2><p>didimlabs.com runs on Cloudflare, which keeps standard request logs. Pages load Cloudflare Web Analytics, which counts page views and load times without cookies and without identifying you. The site sets no cookies. If you send the advertising form, we get what you type and reply by email.</p></section><section id="news" aria-labelledby="news-title"><h2 id="news-title">Release news emails</h2><p>If you type your email to hear about our next game, we keep that address only for that. We send an email when a new game comes out and nothing else. Write to [email protected] to be removed.</p></section><section id="contact" aria-labelledby="contact-title"><h2 id="contact-title">Questions or deletion</h2><p>Email <a href="mailto:[email protected]">[email protected]</a>. We can tell you what we hold and delete it, except records Polar must keep for tax law. To remove everything from your Mac, sign out in Soju and delete the app.</p></section><section id="ko" aria-labelledby="ko-title"><h2 id="ko-title">개인정보 처리 (요약)</h2><p>디딤랩스 스토어에서 게임을 사거나 데모를 받을 때 애플·구글 로그인을 합니다. 이메일 주소만 받아, Polar에서 그 이메일로 산 게임의 라이선스 키를 찾는 데 한 번 씁니다. 로그인 결과는 서버에 최대 10분만 남고, 디딤랩스 계정으로 이메일·로그인 방식·처음과 마지막 로그인 날짜를 보관합니다. 소주에서 결제할 때도 같은 이메일을 씁니다. 결제 정보는 Polar가 처리하며 우리는 카드 번호를 보지 않습니다. 소주 앱은 설치한 게임 목록(하루 한 번)과 게임별 플레이 시간을 맥 기종·macOS·소주 버전, 맥에서 만든 무작위 번호와 함께 보냅니다. 계정, 이메일, 이름, 파일 경로는 보내지 않고, 어떤 게임이 되는지 보는 데만 쓰고 개인별 기록은 공개하지 않습니다. Platforms의 Share which games I play나 soju stats off로 끌 수 있습니다. 웹사이트는 쿠키 없이 방문 수와 로딩 속도만 세는 Cloudflare Web Analytics를 씁니다. 출시 알림을 신청한 이메일은 새 게임 소식에만 씁니다. 문의와 삭제 요청: [email protected]</p></section>
</main>
<footer><div class="inner">
<p><span>Didim Labs · <a href="mailto:[email protected]">[email protected]</a> · <a href="https://github.com/BCD1210/soju">GitHub</a></span></p>
diff --git a/resources/gptk.json b/resources/gptk.json
index 7b987448ee3..efa000b6e09 100644
--- a/resources/gptk.json
+++ b/resources/gptk.json
@@ -14,23 +14,7 @@
"nvapi64.dll",
"nvngx-on-metalfx.dll"
],
- "newer_chips": {
- "min_chip": 6,
- "why": "D3DMetal 3.0 does not start Diablo II: Resurrected on M6 Macs (macOS 27); 4.0 beta 3 does",
- "version": "4.0 beta 3",
- "source": "Apple's Evaluation environment for Windows games 4.0 beta 3, /redist folder unchanged (Soju component release gptk-4.0b3)",
- "url": "https://github.com/BCD1210/soju/releases/download/gptk-4.0b3/soju-gptk-4.0b3.tar.xz",
- "sha256": "55e6877bfbea1756d6f8d0a6af944d633a869f3d60ac0d7bc10ff763c31835d6",
- "size": 16545788,
- "prefix": "lib",
- "shims": [
- "d3d10.dll",
- "d3d11.dll",
- "d3d12.dll",
- "d3d12core.dll",
- "dxgi.dll",
- "nvapi64.dll",
- "nvngx-on-metalfx.dll"
- ]
- }
+ "retired_shims": [
+ "d3d12core.dll"
+ ]
}
diff --git a/scripts/fetch-gptk.py b/scripts/fetch-gptk.py
index 4738287df16..15d6dc3d803 100755
--- a/scripts/fetch-gptk.py
+++ b/scripts/fetch-gptk.py
@@ -12,8 +12,10 @@ or a known Apple build (the PE shims).
scripts/fetch-gptk.py --check exit 0 when $ENGINE already has every shim of the build this Mac uses
SOJU_GPTK_DOWNLOAD=0 callers skip this and ask for a dmg instead
-Macs with an M6 or newer chip get the build under "newer_chips" (4.0 beta 3): D3DMetal 3.0
-does not start Diablo II: Resurrected there.
+From 1.14.47 to 1.14.52 Macs with an M6 chip were given 4.0 beta 3 instead, on the belief that
+D3DMetal 3.0 did not start Diablo II: Resurrected there. Play counts then showed an M6 running it
+on 3.0, and the one M6 that could not start it kept failing after the change. Engines that got the
+beta are put back on the pinned build ("retired_shims" names what only the beta installed).
"""
import hashlib
import json
@@ -35,36 +37,38 @@ def digest(path):
for block in iter(lambda: f.read(1024 * 1024), b""): h.update(block)
return h.hexdigest()
-def chip_generation(brand=None):
- """6 for "Apple M6 Pro", 0 when unknown (Intel, or sysctl missing)."""
- if brand is None:
- try:
- brand = subprocess.run(["/usr/sbin/sysctl", "-n", "machdep.cpu.brand_string"],
- capture_output=True, text=True).stdout
- except OSError:
- brand = ""
- m = re.search(r"\bApple M(\d+)\b", brand or "")
- return int(m.group(1)) if m else 0
+APPLE = b"D3DMetalDLLsBase" # every PE shim of Apple's names it
-def choose(manifest, generation):
- """The build for this Mac: the newer one on chips it names, else the default."""
- newer = manifest.get("newer_chips")
- if newer and generation >= newer["min_chip"]:
- return newer
- return manifest
+def apple_shim(path):
+ try:
+ return APPLE in Path(path).read_bytes()
+ except OSError:
+ return False
def installed(engine, build):
- """Every shim of the build is in the engine and is one of Apple's (they all name D3DMetalDLLsBase)."""
+ """The engine has every shim of the build, and none that only a retired build installed."""
pe = Path(engine) / "lib/wine/x86_64-windows"
if not (Path(engine) / "lib/external/libd3dshared.dylib").is_file():
return False
- for shim in build["shims"]:
- try:
- if b"D3DMetalDLLsBase" not in (pe / shim).read_bytes():
- return False
- except OSError:
- return False
- return True
+ if any(apple_shim(pe / shim) for shim in build.get("retired_shims", [])):
+ return False
+ return all(apple_shim(pe / shim) for shim in build["shims"])
+
+def retire(engine, build):
+ """Take out the shims a retired build left: Wine's own DLL comes back where get-gptk.sh kept it."""
+ lib = Path(engine) / "lib/wine"
+ for shim in build.get("retired_shims", []):
+ dll = lib / "x86_64-windows" / shim
+ if not apple_shim(dll):
+ continue
+ kept = dll.with_name(dll.name + ".wine")
+ if kept.is_file():
+ os.replace(kept, dll)
+ else:
+ dll.unlink()
+ link = lib / "x86_64-unix" / (dll.stem + ".so")
+ if link.is_symlink() and os.readlink(link).endswith("libd3dshared.dylib"):
+ link.unlink()
def wanted(name, manifest):
"""Path under the stage for an archive member Soju takes, else None."""
@@ -112,7 +116,7 @@ def unpack(archive, stage, manifest):
raise ValueError("The archive is missing " + shim)
def main():
- manifest = choose(json.loads(MANIFEST.read_text()), chip_generation())
+ manifest = json.loads(MANIFEST.read_text())
base = Path(os.environ.get("SOJU_BASE", Path.home() / ".battlenet-macos"))
engine = Path(os.environ.get("ENGINE", base / "cx26-engine"))
if not (engine / "lib").is_dir():
@@ -145,6 +149,7 @@ def main():
env = dict(os.environ, ENGINE=str(engine))
if subprocess.run(["/bin/bash", str(ROOT / "scripts/get-gptk.sh"), str(stage)], env=env).returncode != 0:
return 1
+ retire(engine, manifest)
return 0
if __name__ == "__main__":
diff --git a/scripts/play-stats.py b/scripts/play-stats.py
index 1afefd9c681..a853d1248dd 100755
--- a/scripts/play-stats.py
+++ b/scripts/play-stats.py
@@ -244,6 +244,18 @@ def launcher_state(launcher, table=None):
return "launcher_open" if exe in text else "launcher_closed"
+def engine_gptk(base=None):
+ """Which Apple toolkit the engine has, e.g. gptk3.0: read from D3DMetal.framework's own Info.plist."""
+ import plistlib
+ plist = Path(base or BASE) / "cx26-engine/lib/external/D3DMetal.framework/Versions/A/Resources/Info.plist"
+ try:
+ with open(plist, "rb") as f:
+ version = str(plistlib.load(f).get("CFBundleShortVersionString") or "")
+ except Exception:
+ return "gptk_none"
+ return "gptk" + SAFE.sub("", version)[:12] if version else "gptk_none"
+
+
def blizzard_crash(path, since):
"""(word, name) from the crash report a Blizzard game writes itself (errors/<time>/Crash.txt in its
folder) when it caught its own crash: the exception and the module it happened in, nothing else.
@@ -295,8 +307,9 @@ def reason(started, minutes, marks, found, path, launcher="", game=""):
except Exception:
word = ""
# Battle.net started it and the game was never seen: what Wine said, if anything, goes along.
+ # The engine's toolkit version goes too: a game that dies before it writes anything leaves no other clue.
if word == "bnet_launched":
- name = "_".join(x for x in why(text, found) if x)[:40]
+ name = "_".join(x for x in (*why(text, found), engine_gptk()) if x)[:40]
if launcher == "battlenet" and isinstance(marks, dict) and marks.get("_t"):
# The game caught its own crash and wrote a report: that says more than anything above.
crash = blizzard_crash(path, marks["_t"])
diff --git a/scripts/update.sh b/scripts/update.sh
index c891dc53926..d71784c480d 100755
--- a/scripts/update.sh
+++ b/scripts/update.sh
@@ -102,15 +102,15 @@ fi
# Engines set up from an older toolkit, or by an older Soju, can have only
# d3d11/d3d12/dxgi of Apple's shims. Games that look for the AMD and NVIDIA
# driver shims (Overwatch 2: "General Error 0xE0010110" without atidxx64.dll)
-# then stop at start. Macs with an M6 or newer chip need the 4.0 beta 3 build
-# (D3DMetal 3.0 does not start D2R there). fetch-gptk.py --check knows which
-# build this Mac uses; fill in or replace from the pinned download.
+# then stop at start. Engines that were given 4.0 beta 3 (M6 Macs, 1.14.47 to
+# 1.14.52) go back to the pinned build. fetch-gptk.py --check says whether the
+# engine has it; fill in or replace from the pinned download.
complete_gptk(){
[ -f "$ENGINE/lib/external/libd3dshared.dylib" ] || return 0
[ "${SOJU_GPTK_DOWNLOAD:-1}" = 1 ] || return 0
ENGINE="$ENGINE" SOJU_BASE="$BASE" python3 "$ROOT/scripts/fetch-gptk.py" --check && return 0
if pgrep -x wineserver >/dev/null 2>&1; then
- echo " Apple GPTK in the engine is incomplete or too old for this Mac; close launchers and games and run soju update again"
+ echo " Apple GPTK in the engine is incomplete or not the pinned build; close launchers and games and run soju update again"
return 0
fi
echo " updating Apple's GPTK in the engine"
diff --git a/site/content/privacy.json b/site/content/privacy.json
index 171ec4897eb..882f4c683b0 100644
--- a/site/content/privacy.json
+++ b/site/content/privacy.json
@@ -82,7 +82,7 @@
"When it opens, Soju asks GitHub for the list of Soju releases to tell you if a newer version is out. The request says nothing about you or your games.",
"Account connections you add (Steam, GOG and others) talk to those services directly from your Mac.",
"If you turn on TV & iPad streaming, Soju installs Sunshine (open source, LizardByte) on your Mac. It streams only to devices you pair with a PIN on your own network, keeps its settings page on your Mac, and only contacts GitHub to check for new versions.",
- "Play counts (on unless you turn them off): Soju sends which games are installed (once a day) and how many minutes a game stayed open, with your Mac model, chip, macOS and Soju version and a random id made on your Mac. When a game closes within a minute or does not start, it also sends a short reason read on your Mac from Soju's launch log: one word (such as crash or missing file), the name of the missing file or the error number, and which anti-cheat the game uses. The log itself stays on your Mac. No account, email, name or file path. We use it only to see which games run, and publish no one's data. Turn it off under Stores (Share which games I play) or with soju stats off.",
+ "Play counts (on unless you turn them off): Soju sends which games are installed (once a day) and how many minutes a game stayed open, with your Mac model, chip, macOS and Soju version and a random id made on your Mac. When a game closes within a minute or does not start, it also sends a short reason read on your Mac from Soju's launch log: one word (such as crash or missing file), the name of the missing file or the error number, which anti-cheat the game uses, and for a Battle.net game that never appeared, the version of Apple's toolkit in Soju's engine. The log itself stays on your Mac. No account, email, name or file path. We use it only to see which games run, and publish no one's data. Turn it off under Stores (Share which games I play) or with soju stats off.",
"Soju has no ads tracking or crash reporting."
]
}
diff --git a/tests/test_fetch_gptk.py b/tests/test_fetch_gptk.py
index a3afb7fc49a..9ec5fd091aa 100644
--- a/tests/test_fetch_gptk.py
+++ b/tests/test_fetch_gptk.py
@@ -1,4 +1,5 @@
import importlib.util
+import os
import io
import tarfile
import tempfile
@@ -87,49 +88,57 @@ class FetchGptkTests(unittest.TestCase):
self.unpack([e for e in payload() if not e[0].endswith("dxgi.dll")])
-class BuildChoiceTests(unittest.TestCase):
+class PinnedBuildTests(unittest.TestCase):
def setUp(self):
import json
self.manifest = json.loads((ROOT / "resources/gptk.json").read_text())
-
- def test_reads_the_chip_generation(self):
- self.assertEqual(fetch_gptk.chip_generation("Apple M6 Pro"), 6)
- self.assertEqual(fetch_gptk.chip_generation("Apple M4"), 4)
- self.assertEqual(fetch_gptk.chip_generation("Apple M10 Max"), 10)
- self.assertEqual(fetch_gptk.chip_generation("Intel(R) Core(TM) i9"), 0)
- self.assertEqual(fetch_gptk.chip_generation(""), 0)
-
- def test_m6_and_newer_get_the_beta_others_keep_3_0(self):
- self.assertEqual(fetch_gptk.choose(self.manifest, 6)["version"], "4.0 beta 3")
- self.assertEqual(fetch_gptk.choose(self.manifest, 7)["version"], "4.0 beta 3")
- for gen in (0, 1, 4, 5):
- self.assertEqual(fetch_gptk.choose(self.manifest, gen)["version"], "3.0")
-
- def test_the_beta_build_is_pinned_like_the_default(self):
- newer = self.manifest["newer_chips"]
- self.assertTrue(newer["url"].startswith("https://github.com/BCD1210/soju/releases/download/"))
- self.assertRegex(newer["sha256"], "^[0-9a-f]{64}$")
- self.assertIn("d3d12core.dll", newer["shims"])
- for shim in ("d3d11.dll", "d3d12.dll", "dxgi.dll"):
- self.assertIn(shim, newer["shims"])
- known = (ROOT / "scripts/get-gptk.sh").read_text()
- self.assertIn("4.0 beta 3", known)
-
- def test_installed_needs_every_shim_of_the_build(self):
tmp = tempfile.TemporaryDirectory(); self.addCleanup(tmp.cleanup)
- engine = Path(tmp.name)
- pe = engine / "lib/wine/x86_64-windows"; pe.mkdir(parents=True)
- (engine / "lib/external").mkdir(parents=True)
- (engine / "lib/external/libd3dshared.dylib").write_bytes(b"x")
- build = {"shims": ["d3d12.dll", "d3d12core.dll"]}
- (pe / "d3d12.dll").write_bytes(b"..D3DMetalDLLsBase..")
- self.assertFalse(fetch_gptk.installed(engine, build))
- (pe / "d3d12core.dll").write_bytes(b"wine's own")
- self.assertFalse(fetch_gptk.installed(engine, build))
- (pe / "d3d12core.dll").write_bytes(b"..D3DMetalDLLsBase..")
- self.assertTrue(fetch_gptk.installed(engine, build))
- (engine / "lib/external/libd3dshared.dylib").unlink()
- self.assertFalse(fetch_gptk.installed(engine, build))
+ self.engine = Path(tmp.name)
+ self.pe = self.engine / "lib/wine/x86_64-windows"; self.pe.mkdir(parents=True)
+ self.unix = self.engine / "lib/wine/x86_64-unix"; self.unix.mkdir(parents=True)
+ (self.engine / "lib/external").mkdir(parents=True)
+ (self.engine / "lib/external/libd3dshared.dylib").write_bytes(b"x")
+ for shim in self.manifest["shims"]:
+ (self.pe / shim).write_bytes(b"..D3DMetalDLLsBase..")
+
+ def test_every_mac_gets_the_one_pinned_build(self):
+ self.assertEqual(self.manifest["version"], "3.0")
+ self.assertNotIn("newer_chips", self.manifest)
+ self.assertFalse(hasattr(fetch_gptk, "chip_generation"))
+
+ def test_installed_needs_every_shim(self):
+ self.assertTrue(fetch_gptk.installed(self.engine, self.manifest))
+ (self.pe / "nvapi64.dll").write_bytes(b"wine's own")
+ self.assertFalse(fetch_gptk.installed(self.engine, self.manifest))
+ (self.pe / "nvapi64.dll").write_bytes(b"..D3DMetalDLLsBase..")
+ (self.engine / "lib/external/libd3dshared.dylib").unlink()
+ self.assertFalse(fetch_gptk.installed(self.engine, self.manifest))
+
+ def test_an_engine_given_the_beta_is_not_installed_and_wines_own_dll_alone_is(self):
+ (self.pe / "d3d12core.dll").write_bytes(b"wine's own d3d12core")
+ self.assertTrue(fetch_gptk.installed(self.engine, self.manifest))
+ (self.pe / "d3d12core.dll").write_bytes(b"..D3DMetalDLLsBase..")
+ self.assertFalse(fetch_gptk.installed(self.engine, self.manifest))
+
+ def test_retire_brings_wines_dll_back_and_drops_the_link(self):
+ (self.pe / "d3d12core.dll").write_bytes(b"..D3DMetalDLLsBase..")
+ (self.pe / "d3d12core.dll.wine").write_bytes(b"wine's own d3d12core")
+ os.symlink("../../external/libd3dshared.dylib", self.unix / "d3d12core.so")
+ os.symlink("../../external/libd3dshared.dylib", self.unix / "d3d12.so")
+ fetch_gptk.retire(self.engine, self.manifest)
+ self.assertEqual((self.pe / "d3d12core.dll").read_bytes(), b"wine's own d3d12core")
+ self.assertFalse((self.pe / "d3d12core.dll.wine").exists())
+ self.assertFalse((self.unix / "d3d12core.so").is_symlink())
+ self.assertTrue((self.unix / "d3d12.so").is_symlink())
+ self.assertTrue(fetch_gptk.installed(self.engine, self.manifest))
+
+ def test_retire_without_a_kept_copy_removes_the_shim_and_leaves_wines_alone(self):
+ (self.pe / "d3d12core.dll").write_bytes(b"..D3DMetalDLLsBase..")
+ fetch_gptk.retire(self.engine, self.manifest)
+ self.assertFalse((self.pe / "d3d12core.dll").exists())
+ (self.pe / "d3d12core.dll").write_bytes(b"wine's own d3d12core")
+ fetch_gptk.retire(self.engine, self.manifest)
+ self.assertTrue((self.pe / "d3d12core.dll").exists())
if __name__ == "__main__":