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.
HTML apple-siliconbattle-netcrossover-alternatived3dmetaldiablo-ii-resurrecteddxmtea-appepic-gamesgame-porting-toolkitgogmac-gamingmacosmacos-gamingrockstar-gamessteamubisoft-connectwhisky-alternativewindows-gameswinewine-wrapper
Check D2R macOS requirements before launch and diagnosis (#45)
Mikek36ef1adda49d
diff --git a/README.ko.md b/README.ko.mdindex 728e9415049..632713d1bfb 100644--- a/README.ko.md+++ b/README.ko.md@@ -80,7 +80,7 @@ soju install # 이후: soju battlenet / soju d2r / soju steam / soju epic /설치기는 **다운로드 전에 원하는 런처부터 선택**합니다. Steam만 선택하면 CX 엔진과 애플 GPTK를 받지 않습니다. Steam 그래픽 구성요소는 SHA-256으로 검증한 뒤 Soju 전용 Wine 11.0 환경에 자동으로 설치합니다. Battle.net·Epic·GOG는 공통 CX 엔진과 사용자가 별도로 받은 애플 GPTK를 사용합니다. 각 런처의 보틀·로그인·게임은 독립적으로 유지합니다.-[Soju 맥 앱 다운로드](https://github.com/BCD1210/soju/releases/download/v1.6.5/Soju-1.6.5-macos-arm64.zip): 네이티브 앱 프리뷰에서 설치된 게임과 보유 게임, 스토어 검색, 즐겨찾기, 게임 실행, 플랫폼 관리를 한 화면에서 다룰 수 있습니다. [설치 안내와 요구 사항](docs/DESKTOP.md)을 확인해 주세요.+[Soju 맥 앱 다운로드](https://github.com/BCD1210/soju/releases/download/v1.6.6/Soju-1.6.6-macos-arm64.zip): 네이티브 앱 프리뷰에서 설치된 게임과 보유 게임, 스토어 검색, 즐겨찾기, 게임 실행, 플랫폼 관리를 한 화면에서 다룰 수 있습니다. [설치 안내와 요구 사항](docs/DESKTOP.md)을 확인해 주세요.## 일상 명령diff --git a/README.md b/README.mdindex 61f930f69a0..a9c607711f1 100644--- a/README.md+++ b/README.md@@ -24,7 +24,7 @@ CodeWeavers' published sources; Steam uses a separate private Wine 11 setup.Apple's proprietary GPTK/D3DMetal is downloaded separately. Games and storeclients are not included.-**Current release: [v1.6.5](https://github.com/BCD1210/soju/releases/tag/v1.6.5).**+**Current release: [v1.6.6](https://github.com/BCD1210/soju/releases/tag/v1.6.6).**The compatibility examples below were verified on M4 Pro / macOS 26.5.D2R and Hogwarts Legacy are examples of supported games, not the scope of the project.@@ -94,7 +94,7 @@ soju install # then: soju battlenet / soju d2r / soju steam / soju epic / soThe installer asks which launchers you want **before downloading anything**. Steam-only installs skip the CX engine and Apple GPTK. Steam rendering components are downloaded with SHA-256 verification and installed in a Soju-owned Wine 11.0 runtime. Battle.net, Epic and GOG use the shared CX engine and your separately downloaded Apple GPTK. Each official client keeps its own bottle and shortcut in `~/Applications`.-[Download Soju for Mac](https://github.com/BCD1210/soju/releases/download/v1.6.5/Soju-1.6.5-macos-arm64.zip): the native desktop preview includes installed and owned games, store search, favorites, game launching and platform management. See [desktop setup and requirements](docs/DESKTOP.md).+[Download Soju for Mac](https://github.com/BCD1210/soju/releases/download/v1.6.6/Soju-1.6.6-macos-arm64.zip): the native desktop preview includes installed and owned games, store search, favorites, game launching and platform management. See [desktop setup and requirements](docs/DESKTOP.md).## Everyday commandsdiff --git a/README.zh.md b/README.zh.mdindex 984400a14cb..ce9d084e871 100644--- a/README.zh.md+++ b/README.zh.md@@ -84,7 +84,7 @@ soju install # 然后:soju battlenet / soju d2r / soju steam / soju epic /安装器会**先询问要安装哪些启动器,再下载对应组件**。仅选择 Steam 时,不会下载 CX 引擎或 Apple GPTK。Steam 图形组件经过 SHA-256 校验后,自动安装到 Soju 专用的 Wine 11.0 环境中。战网、Epic 和 GOG 使用共享 CX 引擎及用户单独下载的 Apple GPTK。各客户端的 bottle、账户和游戏分别保留。-[下载 Soju Mac 应用](https://github.com/BCD1210/soju/releases/download/v1.6.5/Soju-1.6.5-macos-arm64.zip):原生桌面预览版在一个窗口中管理已安装和已拥有的游戏、商店搜索、收藏、游戏启动和平台管理。[安装说明与要求](docs/DESKTOP.md)。+[下载 Soju Mac 应用](https://github.com/BCD1210/soju/releases/download/v1.6.6/Soju-1.6.6-macos-arm64.zip):原生桌面预览版在一个窗口中管理已安装和已拥有的游戏、商店搜索、收藏、游戏启动和平台管理。[安装说明与要求](docs/DESKTOP.md)。## 日常维护diff --git a/VERSION b/VERSIONindex 9f05f9f2ce1..ec70f755607 100644--- a/VERSION+++ b/VERSION@@ -1 +1 @@-1.6.5+1.6.6diff --git a/docs/DESKTOP.md b/docs/DESKTOP.mdindex 4413e69e2e3..6db43f7951c 100644--- a/docs/DESKTOP.md+++ b/docs/DESKTOP.md@@ -1,6 +1,6 @@# Soju for Mac-[Download v1.6.5](https://github.com/BCD1210/soju/releases/download/v1.6.5/Soju-1.6.5-macos-arm64.zip)+[Download v1.6.6](https://github.com/BCD1210/soju/releases/download/v1.6.6/Soju-1.6.6-macos-arm64.zip)1. Unzip and move **Soju.app** into Applications or ~/Applications.2. Open **Platforms** to install or open Battle.net, Steam, Epic Games or GOG GALAXY.diff --git a/docs/index.html b/docs/index.htmlindex b55338a8519..3dd64c2fa4c 100644--- a/docs/index.html+++ b/docs/index.html@@ -102,7 +102,7 @@ its own login, purchases, downloads and game updates.</p><section id="install" aria-labelledby="install-title"><h2 id="install-title">Choose your launchers. Get set up.</h2>-<p><a class="btn" href="https://github.com/BCD1210/soju/releases/download/v1.6.5/Soju-1.6.5-macos-arm64.zip">Download Soju for Mac</a></p>+<p><a class="btn" href="https://github.com/BCD1210/soju/releases/download/v1.6.6/Soju-1.6.6-macos-arm64.zip">Download Soju for Mac</a></p><p>The native desktop preview combines installed and imported owned games, searches stores and manages all four launchers.Apple Silicon · app UI: macOS 14+ · Steam component build: macOS 26+.<a href="https://github.com/BCD1210/soju/blob/main/docs/DESKTOP.md">Setup and signing notes</a>.</p>diff --git a/scripts/d2r-macos.sh b/scripts/d2r-macos.shnew file mode 100644index 00000000000..733c9e22f3b--- /dev/null+++ b/scripts/d2r-macos.sh@@ -0,0 +1,18 @@+#!/usr/bin/env bash+# Shared read-only requirement check. This does not test game compatibility.+# D2R needs OS-side Rosetta fixes, independently of ROSETTA_ADVERTISE_AVX.+soju_d2r_macos_check() {+ local version major minor+ if ! version=$(sw_vers -productVersion 2>/dev/null) ||+ [[ ! "$version" =~ ^([0-9]+)\.([0-9]+)(\.[0-9]+)?$ ]]; then+ echo "D2R: could not determine the macOS version. Check About This Mac; macOS 26.4 or later is required."+ return 2+ fi+ major=$((10#${BASH_REMATCH[1]}))+ minor=$((10#${BASH_REMATCH[2]}))+ if (( major < 26 || (major == 26 && minor < 4) )); then+ echo "D2R requires macOS 26.4 or later for Rosetta fixes; this Mac runs $version. Update macOS in System Settings > General > Software Update, restart, then retry your existing game installation. ROSETTA_ADVERTISE_AVX does not replace these OS fixes."+ return 1+ fi+ echo "D2R macOS requirement met ($version); game compatibility is not verified by this check."+}diff --git a/scripts/doctor.sh b/scripts/doctor.shindex 3d0f0eb3cfe..2e35d5b2f6e 100755--- a/scripts/doctor.sh+++ b/scripts/doctor.sh@@ -9,6 +9,7 @@ REPO="BCD1210/soju"ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"SOJU="$ROOT/scripts/soju"source "$ROOT/scripts/steam-runtime.sh"+source "$ROOT/scripts/d2r-macos.sh"WINESTABLE="$STEAM_WINE_ROOT/bin/wine"nok=0; nwarn=0; nfail=0@@ -18,10 +19,10 @@ fail(){ printf ' FAIL %s\n' "$*"; nfail=$((nfail+1)); }info(){ printf ' - %s\n' "$*"; }SCOPE="${1:-installed}"-case "$SCOPE" in installed|all|steam|battlenet|epic|gog) ;; *) echo "Usage: soju doctor [steam|battlenet|epic|gog|all]"; exit 64 ;; esac+case "$SCOPE" in installed|all|steam|battlenet|d2r|epic|gog) ;; *) echo "Usage: soju doctor [steam|battlenet|d2r|epic|gog|all]"; exit 64 ;; esacNEEDS_CX=0case "$SCOPE" in- all|battlenet|epic|gog) NEEDS_CX=1 ;;+ all|battlenet|d2r|epic|gog) NEEDS_CX=1 ;;installed)if [ -x "$ENGINE/bin/wine" ] || [ -d "$BASE/bottle" ] || [ -d "$BASE/epic-bottle" ] || [ -d "$BASE/gog-bottle" ]; then NEEDS_CX=1; fi ;;esac@@ -38,6 +39,21 @@ if [ "${free_gb:-0}" -lt 20 ]; then warn "only ${free_gb}GB free on the home volechoif [ "$NEEDS_CX" = 1 ]; then+# Battle.net can run on an OS where D2R cannot. Make that distinction visible.+CHECK_D2R=0+case "$SCOPE" in+ all|battlenet|d2r) CHECK_D2R=1 ;;+ installed) [ ! -d "$BASE/bottle" ] || CHECK_D2R=1 ;;+esac+if [ "$CHECK_D2R" = 1 ]; then+ if macos_check=$(soju_d2r_macos_check); then+ pass "$macos_check"+ elif [ "$SCOPE" = d2r ]; then+ fail "$macos_check"+ else+ warn "$macos_check"+ fi+fiecho "Engine ($ENGINE)"if [ -x "$ENGINE/bin/wine" ]; thenv=$(DYLD_FALLBACK_LIBRARY_PATH="$ENGINE/lib:/usr/lib" "$ENGINE/bin/wine" --version 2>/dev/null || true)@@ -122,7 +138,9 @@ echoecho "Summary: $nok ok, $nwarn warn, $nfail fail"if [ "$nfail" -gt 0 ]; thenecho "Paste this whole output in a new issue: https://github.com/$REPO/issues/new"+elif [ "$nwarn" -gt 0 ]; then+ echo "No failed environment checks, but review the warnings above before playing."else- echo "All good. If Soju works for you, a star helps other Mac gamers find it: https://github.com/$REPO"+ echo "Environment checks passed; game compatibility is not verified. If Soju works for you, a star helps other Mac gamers find it: https://github.com/$REPO"fi[ "$nfail" -eq 0 ]diff --git a/scripts/play.sh b/scripts/play.shindex 977b15f4136..db1eef46676 100755--- a/scripts/play.sh+++ b/scripts/play.sh@@ -16,6 +16,25 @@ set -euo pipefailENGINE="${ENGINE:-${SOJU_BASE:-$HOME/.battlenet-macos}/cx26-engine}"MODE="${1:-battlenet}"++# Check before copying launcher files, changing input sources or starting Wine.+# The unified library launches D2R through Battle.net's OSI product code.+source "$(dirname "${BASH_SOURCE[0]}")/d2r-macos.sh"+D2R_REQUEST=0+case "$MODE" in+ d2r) D2R_REQUEST=1 ;;+ battlenet)+ for argument in "${@:2}"; do+ case "$argument" in '--exec=launch '[Oo][Ss][Ii]) D2R_REQUEST=1 ;; esac+ done ;;+esac+if [ "$MODE" = battlenet ] || [ "$D2R_REQUEST" = 1 ]; then+ if ! macos_check=$(soju_d2r_macos_check); then+ echo "soju: $macos_check" >&2+ [ "$D2R_REQUEST" = 0 ] || exit 1+ echo " Battle.net can still open for other games. D2R started inside Battle.net has the same macOS requirement." >&2+ fi+fisource "$(dirname "${BASH_SOURCE[0]}")/steam-runtime.sh"# Bottle (virtual C: drive) path: per-mode default (Battle.net and Steam use separate bottles)diff --git a/tests/test_d2r_macos.py b/tests/test_d2r_macos.pynew file mode 100644index 00000000000..993250016ff--- /dev/null+++ b/tests/test_d2r_macos.py@@ -0,0 +1,148 @@+"""D2R preflight with fake OS, Wine and prefixes; never launch real games."""+import os+from pathlib import Path+import shutil+import subprocess+import tempfile+import unittest++ROOT = Path(__file__).resolve().parents[1]+++class D2RMacOSTests(unittest.TestCase):+ def setUp(self):+ self.temp = tempfile.TemporaryDirectory(prefix='soju-d2r-test-')+ self.addCleanup(self.temp.cleanup)+ self.root = Path(self.temp.name)+ self.scripts = self.root / 'scripts'+ self.scripts.mkdir()+ for name in ('doctor.sh', 'play.sh', 'steam-runtime.sh', 'd2r-macos.sh'):+ source = ROOT / 'scripts' / name+ if source.exists(): shutil.copy(source, self.scripts / name)+ # The production doctor uses an absolute read-only process query.+ doctor = self.scripts / 'doctor.sh'+ doctor.write_text(doctor.read_text().replace('/usr/bin/pgrep', 'pgrep'))+ self.bin = self.root / 'bin'+ self.bin.mkdir()+ for name, body in {+ 'sw_vers': 'printf "%s\\n" "$TEST_MACOS"; exit "${TEST_SWVERS_EXIT:-0}"',+ 'uname': 'echo arm64', 'sysctl': 'echo TestCPU',+ 'pgrep': '[ "$*" = "-q oahd" ]', 'xcode-select': 'exit 0',+ 'df': 'printf "Filesystem Blocks Used Available\\ntest 200 50 150\\n"',+ 'defaults': 'exit 1', 'curl': 'echo \'[{"tag_name":"engine-v1.5"}]\'',+ 'python3': 'echo python >> "$TEST_CALLS"',+ }.items(): self.executable(self.bin / name, body)+ self.base = self.root / 'base'+ self.prefix = self.base / 'bottle'+ self.game = self.prefix / 'drive_c/Program Files (x86)/Diablo II Resurrected'+ self.game.mkdir(parents=True)+ bn = self.prefix / 'drive_c/Program Files (x86)/Battle.net'+ bn.mkdir()+ (bn / 'Battle.net.exe').touch()+ self.engine = self.base / 'cx26-engine'+ (self.engine / 'bin').mkdir(parents=True)+ self.executable(self.engine / 'bin/wine',+ 'if [ "$1" = --version ]; then echo wine-11.0; else printf "%s\\n" "$*" >> "$TEST_CALLS"; fi')+ (self.engine / '.soju-engine-release').write_text('engine-v1.5')+ ext = self.engine / 'lib/external'+ (ext / 'D3DMetal.framework').mkdir(parents=True)+ (ext / 'libd3dshared.dylib').touch()+ for arch in ('x86_64-windows', 'x86_64-unix'):+ (self.engine / 'lib/wine' / arch).mkdir(parents=True)+ for name in ('d3d11', 'd3d12', 'dxgi'):+ (self.engine / 'lib/wine/x86_64-windows' / (name + '.dll')).write_text('D3DMetalDLLsBase')+ (self.engine / 'lib/wine/x86_64-unix' / (name + '.so')).symlink_to('../../external/libd3dshared.dylib')+ self.calls = self.root / 'calls'++ def executable(self, path, body):+ path.write_text('#!/bin/bash\n' + body + '\n')+ path.chmod(0o755)++ def run_script(self, name, version, *args, swvers_exit=0):+ self.calls.unlink(missing_ok=True)+ env = dict(os.environ, SOJU_BASE=str(self.base), ENGINE=str(self.engine),+ WINEPREFIX=str(self.prefix), PATH=str(self.bin) + ':/usr/bin:/bin',+ TEST_MACOS=version, TEST_SWVERS_EXIT=str(swvers_exit),+ TEST_CALLS=str(self.calls), SOJU_KEYLOG='0')+ return subprocess.run(['/bin/bash', str(self.scripts / name), *args],+ env=env, capture_output=True, text=True, timeout=10)++ def test_old_macos_stops_direct_game_before_side_effects(self):+ for version in ('15.7', '26.0.1', '26.3.9'):+ with self.subTest(version=version):+ result = self.run_script('play.sh', version, 'd2r')+ self.assertNotEqual(result.returncode, 0)+ self.assertIn('macOS 26.4', result.stderr)+ self.assertFalse(self.calls.exists())++ def test_library_play_cannot_bypass_check(self):+ result = self.run_script('play.sh', '26.0.1', 'battlenet', '--exec=launch OSI')+ self.assertNotEqual(result.returncode, 0)+ self.assertIn('macOS 26.4', result.stderr)+ self.assertFalse(self.calls.exists())++ def test_supported_versions_launch_and_keep_arguments(self):+ for version in ('26.4', '26.4.1', '26.10', '27.0'):+ with self.subTest(version=version):+ result = self.run_script('play.sh', version, 'd2r', '-test')+ self.assertEqual(result.returncode, 0, result.stderr)+ self.assertIn('D2R.exe -test', self.calls.read_text())++ def test_unknown_or_failed_version_query_stops_direct_game(self):+ for version, code in (('', 0), ('unknown', 0), ('26', 0), ('26.5', 1)):+ with self.subTest(version=version, code=code):+ result = self.run_script('play.sh', version, 'd2r', swvers_exit=code)+ self.assertNotEqual(result.returncode, 0)+ self.assertIn('could not determine', result.stderr)+ self.assertFalse(self.calls.exists())++ def test_battlenet_warns_but_other_games_remain_available(self):+ result = self.run_script('play.sh', '26.0.1', 'battlenet', '--exec=launch WoW')+ self.assertEqual(result.returncode, 0, result.stderr)+ self.assertIn('macOS 26.4', result.stderr)+ self.assertIn('--exec=launch WoW', self.calls.read_text())++ def test_other_platform_does_not_inherit_d2r_requirement(self):+ exe = self.prefix / 'drive_c/Program Files/Epic Games/Launcher/Portal/Binaries/Win64/EpicGamesLauncher.exe'+ exe.parent.mkdir(parents=True)+ exe.touch()+ self.executable(self.scripts / 'soju-reaper.sh', 'exit 0')+ result = self.run_script('play.sh', '15.7', 'epic')+ self.assertEqual(result.returncode, 0, result.stderr)+ self.assertNotIn('D2R', result.stderr)++ def test_doctor_warns_in_installed_battlenet_and_all_scopes(self):+ for scope in ('installed', 'battlenet', 'all'):+ with self.subTest(scope=scope):+ result = self.run_script('doctor.sh', '26.0.1', scope)+ self.assertEqual(result.returncode, 0, result.stderr)+ self.assertIn('warn D2R', result.stdout)+ self.assertNotIn('All good', result.stdout)+ self.assertIn('review the warnings', result.stdout)++ def test_explicit_d2r_diagnosis_fails_on_old_os(self):+ result = self.run_script('doctor.sh', '26.0.1', 'd2r')+ self.assertEqual(result.returncode, 1, result.stderr)+ self.assertIn('FAIL D2R', result.stdout)++ def test_doctor_unknown_version_is_not_green(self):+ result = self.run_script('doctor.sh', '', 'battlenet')+ self.assertIn('warn D2R', result.stdout)+ self.assertNotIn('All good', result.stdout)++ def test_doctor_supported_os_does_not_claim_game_was_tested(self):+ result = self.run_script('doctor.sh', '26.5', 'd2r')+ self.assertEqual(result.returncode, 0, result.stderr)+ self.assertIn('macOS requirement met', result.stdout)+ self.assertIn('game compatibility is not verified', result.stdout)++ def test_steam_epic_gog_doctor_do_not_warn_about_d2r(self):+ for scope in ('steam', 'epic', 'gog'):+ with self.subTest(scope=scope):+ result = self.run_script('doctor.sh', '26.0.1', scope)+ self.assertNotIn('D2R', result.stdout)++ def test_empty_install_does_not_warn_about_d2r(self):+ shutil.rmtree(self.prefix)+ result = self.run_script('doctor.sh', '26.0.1')+ self.assertNotIn('D2R', result.stdout)