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.

Removing Steam no longer stops when its bottle has no Wine server (a failed install); a failed Steam install shows its installer output and downloads the installer again next time; play counts stop at once when sharing is turned off and see Steam games installed since the last library refresh; 1.14.33 (#159)

Mikek23705beecdf0
diff --git a/README.ko.md b/README.ko.md
index 800a88a7f22..00cdf48469c 100644
--- a/README.ko.md
+++ b/README.ko.md
@@ -8,7 +8,7 @@ Soju는 M1 이후 맥에 **Battle.net·Steam·Epic Games·GOG GALAXY·EA 앱·Ro
![Soju 통합 게임 라이브러리](docs/assets/soju-library.png)
-**[Soju 1.14.32 맥 앱 받기](https://github.com/BCD1210/soju/releases/download/v1.14.32/Soju-1.14.32-macos-arm64.zip)**, 또는 터미널에서 설치:
+**[Soju 1.14.33 맥 앱 받기](https://github.com/BCD1210/soju/releases/download/v1.14.33/Soju-1.14.33-macos-arm64.zip)**, 또는 터미널에서 설치:
```bash
brew install BCD1210/soju/soju
@@ -83,7 +83,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.14.32/Soju-1.14.32-macos-arm64.zip): 네이티브 앱 프리뷰에서 설치된 게임과 보유 게임, 스토어 검색, 즐겨찾기, 게임 실행, 플랫폼 관리를 한 화면에서 다룰 수 있습니다. [설치 안내와 요구 사항](docs/DESKTOP.md)을 확인해 주세요.
+[Soju 맥 앱 다운로드](https://github.com/BCD1210/soju/releases/download/v1.14.33/Soju-1.14.33-macos-arm64.zip): 네이티브 앱 프리뷰에서 설치된 게임과 보유 게임, 스토어 검색, 즐겨찾기, 게임 실행, 플랫폼 관리를 한 화면에서 다룰 수 있습니다. [설치 안내와 요구 사항](docs/DESKTOP.md)을 확인해 주세요.
## 일상 명령
diff --git a/README.md b/README.md
index 3a0d76c6c82..9f8a86cf0d8 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ Soju installs the official Windows launchers for **Battle.net, Steam, Epic Games
![Soju unified game library](docs/assets/soju-library.png)
-**[Download Soju 1.14.32 for Mac](https://github.com/BCD1210/soju/releases/download/v1.14.32/Soju-1.14.32-macos-arm64.zip)**, or install from the terminal:
+**[Download Soju 1.14.33 for Mac](https://github.com/BCD1210/soju/releases/download/v1.14.33/Soju-1.14.33-macos-arm64.zip)**, or install from the terminal:
```bash
brew install BCD1210/soju/soju
@@ -85,7 +85,7 @@ soju install # then: soju battlenet / soju d2r / soju steam / soju epic / so
The 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.14.32/Soju-1.14.32-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.14.33/Soju-1.14.33-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 commands
diff --git a/README.zh.md b/README.zh.md
index 5eb186e1a97..b9346e36f77 100644
--- a/README.zh.md
+++ b/README.zh.md
@@ -8,7 +8,7 @@ Soju 在 M1 及更新的 Mac 上安装 **Battle.net、Steam、Epic Games、GOG G
![Soju 统一游戏库](docs/assets/soju-library.png)
-**[下载 Soju 1.14.32(Mac)](https://github.com/BCD1210/soju/releases/download/v1.14.32/Soju-1.14.32-macos-arm64.zip)**,或在终端安装:
+**[下载 Soju 1.14.33(Mac)](https://github.com/BCD1210/soju/releases/download/v1.14.33/Soju-1.14.33-macos-arm64.zip)**,或在终端安装:
```bash
brew install BCD1210/soju/soju
@@ -83,7 +83,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.14.32/Soju-1.14.32-macos-arm64.zip):原生桌面预览版在一个窗口中管理已安装和已拥有的游戏、商店搜索、收藏、游戏启动和平台管理。[安装说明与要求](docs/DESKTOP.md)。
+[下载 Soju Mac 应用](https://github.com/BCD1210/soju/releases/download/v1.14.33/Soju-1.14.33-macos-arm64.zip):原生桌面预览版在一个窗口中管理已安装和已拥有的游戏、商店搜索、收藏、游戏启动和平台管理。[安装说明与要求](docs/DESKTOP.md)。
## 日常维护
diff --git a/VERSION b/VERSION
index d613550671f..34b2208ad37 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.14.32
+1.14.33
diff --git a/docs/DESKTOP.md b/docs/DESKTOP.md
index 558f28785ff..f9116da3e3d 100644
--- a/docs/DESKTOP.md
+++ b/docs/DESKTOP.md
@@ -1,6 +1,6 @@
# Soju for Mac
-[Download v1.14.32](https://github.com/BCD1210/soju/releases/download/v1.14.32/Soju-1.14.32-macos-arm64.zip)
+[Download v1.14.33](https://github.com/BCD1210/soju/releases/download/v1.14.33/Soju-1.14.33-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/scripts/create-steam-bottle.sh b/scripts/create-steam-bottle.sh
index 6dac1c15975..40d0d8965bb 100755
--- a/scripts/create-steam-bottle.sh
+++ b/scripts/create-steam-bottle.sh
@@ -41,9 +41,19 @@ echo "==> Initializing the prefix: $WINEPREFIX"
SETUP="$WORK/SteamSetup.exe"
[ -f "$SETUP" ] || { curl -fL "https://cdn.cloudflare.steamstatic.com/client/installer/SteamSetup.exe" -o "$SETUP.part" && mv -f "$SETUP.part" "$SETUP"; }
echo "==> Installing Steam silently"
-"$WINE" "$SETUP" /S >/dev/null 2>&1 || true
+LOG="$BASE/logs/steam-install.log"; mkdir -p "$BASE/logs"
+{ echo "== $(date) macOS $(sw_vers -productVersion 2>/dev/null) $(uname -m) Rosetta: $(/usr/bin/arch -x86_64 /usr/bin/true 2>/dev/null && echo yes || echo no)"
+ echo "== installer $(shasum -a 256 "$SETUP" | cut -c1-16) $(stat -f%z "$SETUP") bytes"; } > "$LOG"
+WINEDEBUG=err+all "$WINE" "$SETUP" /S >>"$LOG" 2>&1 || echo "== installer exit $?" >>"$LOG"
"$STEAM_WINE_ROOT/bin/wineserver" -w 2>/dev/null || true
-[ -f "$WINEPREFIX/drive_c/Program Files (x86)/Steam/steam.exe" ] || { echo "Install failed"; exit 1; }
+if [ ! -f "$WINEPREFIX/drive_c/Program Files (x86)/Steam/steam.exe" ]; then
+ # A cut-off download is the usual cause: fetch the installer again on the next try.
+ rm -f "$SETUP"
+ echo "Install failed. The installer's output is in $LOG; these are its last lines:"
+ tail -n 15 "$LOG" | sed 's/^/ /'
+ echo "Press Install again to retry with a fresh download. If it fails the same way, post $LOG on Discord or GitHub."
+ exit 1
+fi
# ---------- 4. Full client before configuring the renderer ----------
python3 "$REPO_ROOT/scripts/bootstrap-steam.py" "$WINE"
diff --git a/scripts/play-stats.py b/scripts/play-stats.py
index 06541eccbf1..d43ec27e443 100755
--- a/scripts/play-stats.py
+++ b/scripts/play-stats.py
@@ -133,7 +133,9 @@ def track_run(found, pid=None, clock=time.monotonic, sleep=time.sleep, poll=POLL
def report(game, title, launcher, started, minutes, how):
- """One start: its outcome always, and the minutes when there were any."""
+ """One start: its outcome always, and the minutes when there were any. Nothing once sharing is off."""
+ if not enabled():
+ return
item = {"game": game[:120], "title": title[:120], "launcher": launcher[:20]}
send({"kind": "launch", "games": [dict(item, result=outcome(started, minutes), how=how)]})
if minutes >= 1:
@@ -157,6 +159,19 @@ def steam_games(snapshot):
def load_snapshot():
+ """Steam games as installed now: read from Steam's own records, so a game installed after the
+ library's last refresh is counted too. Falls back to that refresh's list."""
+ try:
+ import importlib.util
+ sys.path.insert(0, str(ROOT / "scripts"))
+ spec = importlib.util.spec_from_file_location("soju_game_library", ROOT / "scripts/game-library.py")
+ module = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(module)
+ lib = module.Library(BASE)
+ lib.steam()
+ return {"games": list(lib.games.values())}
+ except Exception:
+ pass
try:
return json.loads((BASE / "logs/library-scan.log").read_text())
except (OSError, ValueError):
@@ -165,7 +180,8 @@ def load_snapshot():
def watch(clock=time.monotonic, sleep=time.sleep, poll=POLL, table=None, snapshot=load_snapshot, deliver=report):
"""While Steam runs, count the games started from Steam's own window. A game that the
- library's Play button is already counting (its lock is held) is left to that count."""
+ library's Play button is already counting (its lock is held) is left to that count.
+ Turning sharing off stops the watch at once and drops what it was counting."""
table = table or (lambda: run("ps", "-axww", "-o", "command=").lower())
begun = clock()
games, seen, missing, polls = {}, {}, 0, 0
@@ -176,6 +192,10 @@ def watch(clock=time.monotonic, sleep=time.sleep, poll=POLL, table=None, snapsho
polls += 1
sleep(poll)
now = clock()
+ if not enabled():
+ for gid in list(seen):
+ seen.pop(gid)["lock"].unlink(missing_ok=True)
+ return
lines = table().splitlines()
missing = 0 if any(STEAM_PROCESS in line for line in lines) else missing + 1
for gid, (title, found) in games.items():
diff --git a/scripts/steam-session.py b/scripts/steam-session.py
index 7ce66f0335d..1ea76e80d82 100644
--- a/scripts/steam-session.py
+++ b/scripts/steam-session.py
@@ -40,9 +40,14 @@ def stop(prefix, runtime, timeout=30):
env = {key: value for key, value in os.environ.items()
if not key.startswith(("DYLD_", "WINE", "CX_", "ROSETTA_"))}
env.update(WINEPREFIX=str(prefix.resolve()), WINEDEBUG="-all")
- for flag in ("-k", "-w"):
- subprocess.run([str(server), flag], env=env, check=True,
- capture_output=True, text=True, timeout=timeout)
+ # -k also exits 1 when this prefix has no Wine server at all (nothing ran, or a failed install).
+ # That is only safe to pass over when no Steam Wine server is running anywhere; -w must succeed.
+ killed = subprocess.run([str(server), "-k"], env=env, check=False,
+ capture_output=True, text=True, timeout=timeout)
+ if killed.returncode != 0 and any(is_steam_server(path, runtime) for path in server_paths()):
+ raise RuntimeError("Could not stop Windows Steam. Quit Steam and its games, then retry.")
+ subprocess.run([str(server), "-w"], env=env, check=True,
+ capture_output=True, text=True, timeout=timeout)
if __name__ == "__main__":
diff --git a/tests/test_play_stats.py b/tests/test_play_stats.py
index 06e408dadeb..348a29fe1b6 100644
--- a/tests/test_play_stats.py
+++ b/tests/test_play_stats.py
@@ -145,6 +145,40 @@ class PlayStats(unittest.TestCase):
ps.watch(clock=clock.now, sleep=clock.sleep, poll=20, table=lambda: '', snapshot=lambda: {}, deliver=None)
self.assertLess(clock.t, 200)
+ def test_turning_sharing_off_stops_the_watch_and_sends_nothing(self):
+ snap = {'games': [{'id': 'steam:1', 'platform': 'steam', 'title': 'A',
+ 'install_path': '/b/drive_c/Program Files (x86)/Steam/steamapps/common/A'}]}
+ line = 'c:\\program files (x86)\\steam\\steam.exe\nc:\\program files (x86)\\steam\\steamapps\\common\\a\\a.exe'
+ clock, got, polls = Clock(), [], []
+ with tempfile.TemporaryDirectory() as d, mock.patch.object(ps, 'BASE', Path(d)), \
+ mock.patch.object(ps, 'OFF', Path(d) / 'stats-off'):
+ def table():
+ polls.append(1)
+ if len(polls) == 5:
+ (Path(d) / 'stats-off').touch() # the user turns sharing off mid-game
+ return line
+ ps.watch(clock=clock.now, sleep=clock.sleep, poll=20, table=table,
+ snapshot=lambda: snap, deliver=lambda *x: got.append(x))
+ self.assertEqual(list((Path(d) / 'stats-running').glob('*.pid')), [])
+ self.assertEqual(got, [])
+ self.assertLess(len(polls), 8)
+ with mock.patch.object(ps, 'enabled', lambda: False), \
+ mock.patch.object(ps, 'send', side_effect=AssertionError('sent while off')):
+ ps.report('steam:1', 'A', 'steam', True, 9, 'soju')
+
+ def test_the_watch_reads_steam_itself_for_games_installed_after_the_last_refresh(self):
+ with tempfile.TemporaryDirectory() as d:
+ base = Path(d)
+ client = base / 'steam-bottle/drive_c/Program Files (x86)/Steam'
+ (client / 'steamapps/common/New Game').mkdir(parents=True)
+ (client / 'steam.exe').write_text('')
+ (client / 'steamapps/appmanifest_42.acf').write_text(
+ '"AppState" { "appid" "42" "name" "New Game" "StateFlags" "4" "installdir" "New Game" }')
+ with mock.patch.object(ps, 'BASE', base):
+ games = ps.steam_games(ps.load_snapshot())
+ self.assertIn('steam:42', games)
+ self.assertTrue(any('steamapps\\common\\new game' in n for n in games['steam:42'][1]))
+
if __name__ == '__main__':
unittest.main()
diff --git a/tests/test_steam_lifecycle.py b/tests/test_steam_lifecycle.py
index 4cc2a7166ff..10d936560fc 100644
--- a/tests/test_steam_lifecycle.py
+++ b/tests/test_steam_lifecycle.py
@@ -49,6 +49,7 @@ class SteamSessionTests(unittest.TestCase):
with patch.dict(os.environ, {"WINEPREFIX": "/unrelated", "WINESERVER": "/wrong",
"DYLD_FALLBACK_LIBRARY_PATH": "/wrong", "CX_TEST": "bad"}), \
patch.object(session.subprocess, "run") as run:
+ run.return_value.returncode = 0
session.stop(prefix, runtime)
self.assertEqual([c.args[0][-1] for c in run.call_args_list], ["-k", "-w"])
for call in run.call_args_list:
@@ -57,7 +58,8 @@ class SteamSessionTests(unittest.TestCase):
self.assertNotIn("WINESERVER", env)
self.assertNotIn("DYLD_FALLBACK_LIBRARY_PATH", env)
self.assertNotIn("CX_TEST", env)
- self.assertTrue(call.kwargs["check"])
+ # -k may fail when nothing runs; -w has to succeed
+ self.assertEqual(call.kwargs["check"], call.args[0][-1] == "-w")
self.assertEqual(call.kwargs["timeout"], 30)
def test_timeout_propagates_instead_of_allowing_delete(self):
@@ -193,13 +195,20 @@ if [ "$1" = -w ]; then echo final > "$WINEPREFIX/shutdown-write"; fi
self.assertEqual([line.rsplit(" ", 1)[1] for line in (d / "events").read_text().splitlines()], ["-k", "-w"])
def test_failed_kill_or_wait_preserves_game_and_runtime(self):
- for failure in ("-k", "-w"):
- with self.subTest(failure=failure):
- d, base, result = self.scenario(failure=failure)
+ # A failed wait, or a failed kill while a Steam Wine server is still running (or ps fails).
+ for kwargs in ({"failure": "-w"}, {"failure": "-k", "live": True}, {"failure": "-k", "ps_failure": True}):
+ with self.subTest(**kwargs):
+ d, base, result = self.scenario(**kwargs)
self.assertNotEqual(result.returncode, 0)
self.assertTrue((base / "steam-bottle/saved-game").exists())
self.assertTrue((base / "steam-runtime/bin/wine").exists())
+ def test_kill_failing_because_nothing_runs_still_removes(self):
+ # wineserver -k exits 1 when the bottle has no server, e.g. after a failed Steam install (Discord, 2026-11-19).
+ d, base, result = self.scenario(failure="-k")
+ self.assertEqual(result.returncode, 0, result.stderr)
+ self.assertFalse((base / "steam-bottle").exists())
+
def test_declining_all_does_not_stop_or_remove_anything(self):
d, base, result = self.scenario(answers="n\nn\n")
self.assertEqual(result.returncode, 0, result.stderr)