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
Engine v1.6: Battle.net game updates no longer stop at "Unable to fix permissions" (#69)
Mikek8a348f732dfe
diff --git a/README.ko.md b/README.ko.mdindex 90b6528d923..4a0b1490145 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.7.1/Soju-1.7.1-macos-arm64.zip): 네이티브 앱 프리뷰에서 설치된 게임과 보유 게임, 스토어 검색, 즐겨찾기, 게임 실행, 플랫폼 관리를 한 화면에서 다룰 수 있습니다. [설치 안내와 요구 사항](docs/DESKTOP.md)을 확인해 주세요.+[Soju 맥 앱 다운로드](https://github.com/BCD1210/soju/releases/download/v1.7.2/Soju-1.7.2-macos-arm64.zip): 네이티브 앱 프리뷰에서 설치된 게임과 보유 게임, 스토어 검색, 즐겨찾기, 게임 실행, 플랫폼 관리를 한 화면에서 다룰 수 있습니다. [설치 안내와 요구 사항](docs/DESKTOP.md)을 확인해 주세요.## 일상 명령diff --git a/README.md b/README.mdindex 86cb7ba5346..bf0af4b9870 100644--- a/README.md+++ b/README.md@@ -25,7 +25,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.7.1](https://github.com/BCD1210/soju/releases/tag/v1.7.1).**+**Current release: [v1.7.2](https://github.com/BCD1210/soju/releases/tag/v1.7.2).**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.@@ -100,7 +100,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.7.1/Soju-1.7.1-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.7.2/Soju-1.7.2-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 b322bea981b..f212f79aa8d 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.7.1/Soju-1.7.1-macos-arm64.zip):原生桌面预览版在一个窗口中管理已安装和已拥有的游戏、商店搜索、收藏、游戏启动和平台管理。[安装说明与要求](docs/DESKTOP.md)。+[下载 Soju Mac 应用](https://github.com/BCD1210/soju/releases/download/v1.7.2/Soju-1.7.2-macos-arm64.zip):原生桌面预览版在一个窗口中管理已安装和已拥有的游戏、商店搜索、收藏、游戏启动和平台管理。[安装说明与要求](docs/DESKTOP.md)。## 日常维护diff --git a/VERSION b/VERSIONindex 943f9cbc4ec..f8a696c8dc5 100644--- a/VERSION+++ b/VERSION@@ -1 +1 @@-1.7.1+1.7.2diff --git a/docs/DESKTOP.md b/docs/DESKTOP.mdindex 827a1709a98..7090ce44a43 100644--- a/docs/DESKTOP.md+++ b/docs/DESKTOP.md@@ -1,6 +1,6 @@# Soju for Mac-[Download v1.7.1](https://github.com/BCD1210/soju/releases/download/v1.7.1/Soju-1.7.1-macos-arm64.zip)+[Download v1.7.2](https://github.com/BCD1210/soju/releases/download/v1.7.2/Soju-1.7.2-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/DIAGNOSIS.md b/docs/DIAGNOSIS.mdindex 998f2226398..24400decae6 100644--- a/docs/DIAGNOSIS.md+++ b/docs/DIAGNOSIS.md@@ -539,3 +539,27 @@ Battle.net 보틀(`~/.battlenet-macos/bottle`)은 Whisky 컨테이너로 가는디렉토리를 만드니 절대 일치하지 않았다. 결과: 이 보틀의 reaper는 서버가 살아 있어도 두 주기 뒤에고아로 판정해 D2R과 Battle.net을 죽였다(v1.4 검증 중 "wineserver crashed"로 나타남). `pwd -P`로 해석한경로에 `stat -L`을 쓰도록 고쳤다. Epic 보틀(실제 디렉토리)은 영향이 없어서 스크래치 테스트도 통과했었다.++## D2R 업데이트 "Unable to fix permissions" (BLZBNTAGT00000846): Wine이 쓴 ACL을 그대로 돌려주지 않는다 (2026-11-02)++증상: Battle.net에서 D2R "업데이트"를 누르면 "파일을 쓰기 가능하게 만들지 못했다. 관리자로 로그인해+다시 시도하라"가 뜨고 업데이트가 멈춘다. Agent 로그에는 `Unable to fix permissions`(오류 2118).++원인: Agent는 패치 전에 게임 폴더 전체에 ACL을 쓴다(`SetNamedSecurityInfoW`, DACL만). 루트에는+Administrators 전체 권한, Users/Interactive 읽기, SYSTEM과 현재 사용자 전체 권한(상속 플래그 포함)을,+그 아래 파일에는 상속된 SYSTEM/사용자 항목을 쓴다. 쓰기는 성공한다(`set_security_object() = 0`).+그런데 Wine은 파일의 보안 설명자를 저장하지 않고 매번 Unix 권한(rwx)에서 다시 만든다+(`server/file.c`의 `mode_to_sd`). 다시 읽으면 상속 플래그도, Users/Administrators 항목도 없으니+Agent는 고치지 못했다고 판단하고 멈춘다. Wine-staging은 ACL을 xattr에 저장하는 패치가 있어서+같은 증상이 없다는 보고가 있다.++해결 (`patches/wineserver-stored-acls.patch`, engine-v1.6): 파일·폴더에 보안 설명자를 쓰면+`user.wine.sd` xattr에 그것과 쓸 때의 Unix 권한 비트를 함께 저장하고, 권한 비트가 그대로인 동안은+저장한 것을 돌려준다. macOS 쪽에서 chmod하면 예전처럼 권한 비트에서 만든 것으로 돌아간다. DACL로+Unix 권한을 정하는 기존 동작은 그대로다.++검증(M4 Pro, macOS 26.5, 실제 Battle.net 보틀의 APFS 복제본): engine-v1.5로는 Battle.net 앱의+업데이트 버튼이 2118로 멈췄다. 같은 wineserver에 이 패치만 넣으면 Agent의 `osi` 업데이트가 권한+단계를 지나 끝났고(`.patch.result` 0, 게임 폴더에 `user.wine.sd` 생성), 손대지 않은 원본 복제본에서도+engine-v1.6 tarball의 wineserver로 같은 결과였다. 그 wineserver로 Battle.net 로그인 상태 유지, D2R+온라인 접속(캐릭터 선택 화면)까지 확인했다.diff --git a/docs/index.html b/docs/index.htmlindex 5a2b30cf398..463e68b88d8 100644--- a/docs/index.html+++ b/docs/index.html@@ -124,7 +124,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.7.1/Soju-1.7.1-macos-arm64.zip">Download Soju for Mac</a></p>+<p><a class="btn" href="https://github.com/BCD1210/soju/releases/download/v1.7.2/Soju-1.7.2-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/install.sh b/install.shindex 67457bdc334..b0f09a714e2 100644--- a/install.sh+++ b/install.sh@@ -21,8 +21,8 @@ say(){ printf '\n\033[1m%s\033[0m\n' "$*"; }# The prebuilt engine is pinned: a new engine release only reaches users once# these two lines (here and in scripts/update.sh) name it.-ENGINE_TAG="engine-v1.5"-ENGINE_SHA256="7b96a4407308493ae92bebe96039bbc8d0bf3b86c22cb99c782f73cf7be3738e"+ENGINE_TAG="engine-v1.6"+ENGINE_SHA256="1d8eaa1db7279c7e4c2d321350bcd11a3658558bfee8a1a6f4c47e0542fd3f3f"ENGINE_URL="https://github.com/$REPO/releases/download/$ENGINE_TAG/wine-engine-x86_64.tar.xz"# Download to a .part file and keep it only when its SHA-256 matches.diff --git a/patches/wineserver-stored-acls.patch b/patches/wineserver-stored-acls.patchnew file mode 100644index 00000000000..a7083338834--- /dev/null+++ b/patches/wineserver-stored-acls.patch@@ -0,0 +1,159 @@+wineserver: keep the security descriptors programs write on files and folders++Wine derives a file's security descriptor from its Unix mode, so an ACL a+program sets reads back different (no inherited flags, no Users or+Administrators entries). The Battle.net Agent sets ACLs on a game folder+before patching, reads them back, and stops with "Unable to fix permissions"+(BLZBNTAGT00000846): Diablo II: Resurrected could not update.++Store the descriptor written in a "user.wine.sd" xattr with the Unix+permission bits it was written for, and return it while those bits are+unchanged. A chmod made from macOS falls back to the mode-derived descriptor.+The Unix mode is still set from the DACL as before.++--- a/server/change.c++++ b/server/change.c+@@ -349,9 +349,10 @@+ (st.st_uid == dir->uid))+ return obj->sd;++- sd = mode_to_sd( st.st_mode,+- security_unix_uid_to_sid( st.st_uid ),+- token_get_primary_group( current->process->token ));++ if (!(sd = xattr_sd_load( unix_fd, st.st_mode )))++ sd = mode_to_sd( st.st_mode,++ security_unix_uid_to_sid( st.st_uid ),++ token_get_primary_group( current->process->token ));+ if (!sd) return obj->sd;++ dir->mode = st.st_mode;+@@ -406,7 +407,8 @@+ return 0;+ }+ }+- return 1;++ if (!obj->sd) dir_get_sd( obj );++ return keep_written_sd( obj, unix_fd, sd, set_info, &dir->mode, &dir->uid );+ }++ static struct change_record *get_first_change_record( struct dir *dir )+--- a/server/file.c++++ b/server/file.c+@@ -385,6 +385,80 @@+ return sd;+ }+++++#ifdef HAVE_SYS_XATTR_H++#include <sys/xattr.h>++#endif++++#define WINE_XATTR_SD "user.wine.sd"++#define WINE_XATTR_SD_VERSION 1++#define WINE_SD_MODE_BITS (S_IRWXU|S_IRWXG|S_IRWXO)++++static data_size_t stored_sd_size( const struct security_descriptor *sd )++{++ return sizeof(*sd) + sd->owner_len + sd->group_len + sd->sacl_len + sd->dacl_len;++}++++/* Descriptor stored by xattr_sd_store, if it was written for these mode bits. */++struct security_descriptor *xattr_sd_load( int unix_fd, mode_t mode )++{++#ifdef HAVE_SYS_XATTR_H++ unsigned char buffer[65536];++ struct security_descriptor *sd;++ unsigned int stored_mode;++ ssize_t len;++++# ifdef XATTR_ADDITIONAL_OPTIONS++ len = fgetxattr( unix_fd, WINE_XATTR_SD, buffer, sizeof(buffer), 0, 0 );++# else++ len = fgetxattr( unix_fd, WINE_XATTR_SD, buffer, sizeof(buffer) );++# endif++ if (len < (ssize_t)(5 + sizeof(*sd)) || buffer[0] != WINE_XATTR_SD_VERSION) return NULL;++ memcpy( &stored_mode, buffer + 1, sizeof(stored_mode) );++ if ((stored_mode & WINE_SD_MODE_BITS) != (mode & WINE_SD_MODE_BITS)) return NULL;++ sd = (struct security_descriptor *)(buffer + 5);++ if (stored_sd_size( sd ) != (data_size_t)(len - 5) || !sd_is_valid( sd, len - 5 )) return NULL;++ return memdup( sd, len - 5 );++#else++ return NULL;++#endif++}++++void xattr_sd_store( int unix_fd, const struct security_descriptor *sd, mode_t mode )++{++#ifdef HAVE_SYS_XATTR_H++ data_size_t size = stored_sd_size( sd );++ unsigned int stored_mode = mode & WINE_SD_MODE_BITS;++ unsigned char *buffer;++++ if (size > 65536 - 5 || !(buffer = malloc( 5 + size ))) return;++ buffer[0] = WINE_XATTR_SD_VERSION;++ memcpy( buffer + 1, &stored_mode, sizeof(stored_mode) );++ memcpy( buffer + 5, sd, size );++# ifdef XATTR_ADDITIONAL_OPTIONS++ fsetxattr( unix_fd, WINE_XATTR_SD, buffer, 5 + size, 0, 0 );++# else++ fsetxattr( unix_fd, WINE_XATTR_SD, buffer, 5 + size, 0 );++# endif++ free( buffer );++#endif++}++++/* After a successful set_sd: merge what was written into obj->sd the way++ * default_set_sd does, and keep it with the file. */++int keep_written_sd( struct object *obj, int unix_fd, const struct security_descriptor *sd,++ unsigned int set_info, mode_t *cached_mode, uid_t *cached_uid )++{++ struct stat st;++++ if (!set_sd_defaults_from_token( obj, sd, set_info, current->process->token )) return 0;++ if (fstat( unix_fd, &st ) == -1) return 1;++ *cached_mode = st.st_mode;++ *cached_uid = st.st_uid;++ if (obj->sd) xattr_sd_store( unix_fd, obj->sd, st.st_mode );++ return 1;++}+++ static struct security_descriptor *file_get_sd( struct object *obj )+ {+ struct file *file = (struct file *)obj;+@@ -404,9 +478,10 @@+ (st.st_uid == file->uid))+ return obj->sd;++- sd = mode_to_sd( st.st_mode,+- security_unix_uid_to_sid( st.st_uid ),+- token_get_primary_group( current->process->token ));++ if (!(sd = xattr_sd_load( unix_fd, st.st_mode )))++ sd = mode_to_sd( st.st_mode,++ security_unix_uid_to_sid( st.st_uid ),++ token_get_primary_group( current->process->token ));+ if (!sd) return obj->sd;++ file->mode = st.st_mode;+@@ -542,7 +617,8 @@+ return 0;+ }+ }+- return 1;++ if (!obj->sd) file_get_sd( obj );++ return keep_written_sd( obj, unix_fd, sd, set_info, &file->mode, &file->uid );+ }++ static struct object *file_lookup_name( struct object *obj, struct unicode_str *name,+--- a/server/file.h++++ b/server/file.h+@@ -169,6 +169,10 @@+ extern struct file *create_file_for_fd_obj( struct fd *fd, unsigned int access, unsigned int sharing );+ extern void file_set_error(void);+ extern struct security_descriptor *mode_to_sd( mode_t mode, const struct sid *user, const struct sid *group );++extern struct security_descriptor *xattr_sd_load( int unix_fd, mode_t mode );++extern void xattr_sd_store( int unix_fd, const struct security_descriptor *sd, mode_t mode );++extern int keep_written_sd( struct object *obj, int unix_fd, const struct security_descriptor *sd,++ unsigned int set_info, mode_t *cached_mode, uid_t *cached_uid );+ extern mode_t sd_to_mode( const struct security_descriptor *sd, const struct sid *owner );+ extern int is_file_executable( const char *name );+diff --git a/scripts/build-engine.sh b/scripts/build-engine.shindex a373a017172..51adaeef0d0 100755--- a/scripts/build-engine.sh+++ b/scripts/build-engine.sh@@ -69,6 +69,10 @@ if ! grep -q "KEY_STORE_MAGIC" "$WINE/dlls/ncrypt/main.c"; thenecho "==> Applying patches/ncrypt-persisted-keys.patch (named CNG keys survive the process)"patch -p1 -d "$WINE" < "$SCRIPT_DIR/../patches/ncrypt-persisted-keys.patch"fi+if ! grep -q "WINE_XATTR_SD" "$WINE/server/file.c"; then+ echo "==> Applying patches/wineserver-stored-acls.patch (ACLs programs set read back as set)"+ patch -p1 -d "$WINE" < "$SCRIPT_DIR/../patches/wineserver-stored-acls.patch"+fiecho "==> Building x86_64 freetype (Rosetta)"fetch_checked "$FT_URL" "$WORK/ft.tar.gz" "$FT_SHA256"diff --git a/scripts/update.sh b/scripts/update.shindex 9cb1db6726a..66c205cef17 100755--- a/scripts/update.sh+++ b/scripts/update.sh@@ -12,8 +12,8 @@ TTY=/dev/ttysay(){ printf '\n\033[1m%s\033[0m\n' "$*"; }# Same pin and helpers as install.sh (tests/test_installation.py keeps them equal).-ENGINE_TAG="engine-v1.5"-ENGINE_SHA256="7b96a4407308493ae92bebe96039bbc8d0bf3b86c22cb99c782f73cf7be3738e"+ENGINE_TAG="engine-v1.6"+ENGINE_SHA256="1d8eaa1db7279c7e4c2d321350bcd11a3658558bfee8a1a6f4c47e0542fd3f3f"ENGINE_URL="https://github.com/$REPO/releases/download/$ENGINE_TAG/wine-engine-x86_64.tar.xz"fetch_verified(){ # url, dest, sha256diff --git a/tests/test_d2r_macos.py b/tests/test_d2r_macos.pyindex 993250016ff..68665766cfb 100644--- a/tests/test_d2r_macos.py+++ b/tests/test_d2r_macos.py@@ -29,7 +29,7 @@ class D2RMacOSTests(unittest.TestCase):'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"}]\'',+ 'defaults': 'exit 1', 'curl': 'echo \'[{"tag_name":"engine-v1.6"}]\'','python3': 'echo python >> "$TEST_CALLS"',}.items(): self.executable(self.bin / name, body)self.base = self.root / 'base'@@ -43,7 +43,7 @@ class D2RMacOSTests(unittest.TestCase):(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')+ (self.engine / '.soju-engine-release').write_text('engine-v1.6')ext = self.engine / 'lib/external'(ext / 'D3DMetal.framework').mkdir(parents=True)(ext / 'libd3dshared.dylib').touch()diff --git a/tests/test_installation.py b/tests/test_installation.pyindex f4fc0e8da07..b8a3207f4a9 100644--- a/tests/test_installation.py+++ b/tests/test_installation.py@@ -256,6 +256,17 @@ class SupportManifestTests(unittest.TestCase):self.assertIn('apply_once dxmt "$ROOT/patches/' + patch + '"', script)self.assertIn("d3d11.maxTessFactor", (ROOT/"patches/dxmt-max-tess-factor.patch").read_text())+class EnginePatchTests(unittest.TestCase):+ def test_stored_acls_patch_is_applied_once_by_the_engine_build(self):+ script = (ROOT/"scripts/build-engine.sh").read_text()+ patch = (ROOT/"patches/wineserver-stored-acls.patch").read_text()+ # The guard string the build checks for must be one the patch adds.+ self.assertIn('grep -q "WINE_XATTR_SD" "$WINE/server/file.c"', script)+ self.assertIn('patches/wineserver-stored-acls.patch', script)+ self.assertIn('+#define WINE_XATTR_SD "user.wine.sd"', patch)+ for path in ("server/file.c", "server/file.h", "server/change.c"):+ self.assertIn("+++ b/" + path, patch)+class DownloadCheckTests(unittest.TestCase):"""install.sh and update.sh run only checked downloads, never main."""SCRIPTS = ("install.sh", "scripts/update.sh")