Skip to content

Fix macOS build -- native addon, mmap path, install path, manifest#563

Open
VamooseAddons wants to merge 2 commits intoKruithne:mainfrom
VamooseAddons:fix/macos-arm64-build
Open

Fix macOS build -- native addon, mmap path, install path, manifest#563
VamooseAddons wants to merge 2 commits intoKruithne:mainfrom
VamooseAddons:fix/macos-arm64-build

Conversation

@VamooseAddons
Copy link
Copy Markdown

@VamooseAddons VamooseAddons commented Apr 15, 2026

Summary

Five fixes for building and running wow.export on macOS (including Apple Silicon ARM64):

  1. Replace nw-gyp with node-gyp (build/build-native-addons.js) -- nw-gyp@3.6.8 requires Python 2 which is EOL. node-gyp@12+ works with Python 3 and compiles NAPI addons identically.

  2. Fix mmap.node path resolution (src/js/mmap.js) -- Bun inlines __dirname at bundle time as a hardcoded path from the build machine. Replaced with process.execPath walk-up that finds the .app bundle at runtime from any process (main or helper).

  3. Fix INSTALL_PATH depth (src/js/constants.js) -- __dirname is src/js/, so one .. gives src/ not the package root. Changed to ../.. to correctly reach the root. This was the root cause of default_config.jsonc failing to load, which left all config URLs undefined and broke manifest downloads, listfile loading, and DB2 file resolution (the "file not mapping in listfile: DBFilesClient/ModelFileData.db2" error).

  4. Ensure DBD manifest preload (src/js/casc/dbd-manifest.js) -- prepareManifest() now calls preload() if it hasn't been triggered, preventing empty manifest when called before app-level init.

  5. Fix M2 shader uniform overflow (src/shaders/m2.vertex.shader) -- macOS WebGL2 caps GL_MAX_VERTEX_UNIFORM_VECTORS at 1024. The M2 vertex shader used 256 mat4 bone matrices (1024 vec4) plus ~25 other uniforms, exceeding the limit. Reduced MAX_BONES from 256 to 220, bringing total to ~905 vec4. Most WoW models use far fewer than 220 bones.

Testing

Tested on macOS 15.x (Darwin 25.2.0) ARM64 with:

  • Bun 1.3.12
  • node-gyp 12.2.0
  • Python 3.14.3
  • nw.js 0.104.1 (ARM64)

Full model browser working with M2 and WMO 3D preview, local CASC source, DB2 resolution.

Related

Four fixes for building and running wow.export on macOS (including ARM64):

1. Replace nw-gyp with node-gyp (build/build-native-addons.js)
   nw-gyp@3.6.8 requires Python 2 which is EOL. node-gyp@12+ works
   with Python 3 and compiles NAPI addons identically.

2. Fix mmap.node path resolution (src/js/mmap.js)
   Bun inlines __dirname at bundle time as a hardcoded path from the
   build machine. Replaced with process.execPath walk-up that finds
   the .app bundle at runtime from any process (main or helper).

3. Fix INSTALL_PATH depth (src/js/constants.js)
   __dirname is src/js/, so one '..' gives src/ not the package root.
   Changed to '../..' to correctly reach the root. This was the cause
   of default_config.jsonc failing to load, which left all config URLs
   undefined and broke manifest downloads, listfile loading, and DB2
   file resolution.

4. Ensure DBD manifest preload (src/js/casc/dbd-manifest.js)
   prepareManifest() now calls preload() if it has not been triggered,
   preventing empty manifest when called before app-level init.

Tested on macOS 15 arm64: Bun 1.3.12, node-gyp 12.2.0, Python 3.14,
nw.js 0.104.1. Full model browser working with WMO preview.
macOS WebGL2 caps GL_MAX_VERTEX_UNIFORM_VECTORS at 1024. The M2 vertex
shader used 256 mat4 bone matrices (1024 vec4) plus ~25 other uniforms,
exceeding the limit. Reduced MAX_BONES from 256 to 220, bringing total
to ~905 vec4. Most WoW models use far fewer than 220 bones.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant