Fix macOS build -- native addon, mmap path, install path, manifest#563
Open
VamooseAddons wants to merge 2 commits intoKruithne:mainfrom
Open
Fix macOS build -- native addon, mmap path, install path, manifest#563VamooseAddons wants to merge 2 commits intoKruithne:mainfrom
VamooseAddons wants to merge 2 commits intoKruithne:mainfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Five fixes for building and running wow.export on macOS (including Apple Silicon ARM64):
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.Fix mmap.node path resolution (
src/js/mmap.js) -- Bun inlines__dirnameat bundle time as a hardcoded path from the build machine. Replaced withprocess.execPathwalk-up that finds the .app bundle at runtime from any process (main or helper).Fix INSTALL_PATH depth (
src/js/constants.js) --__dirnameissrc/js/, so one..givessrc/not the package root. Changed to../..to correctly reach the root. This was the root cause ofdefault_config.jsoncfailing 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).Ensure DBD manifest preload (
src/js/casc/dbd-manifest.js) --prepareManifest()now callspreload()if it hasn't been triggered, preventing empty manifest when called before app-level init.Fix M2 shader uniform overflow (
src/shaders/m2.vertex.shader) -- macOS WebGL2 capsGL_MAX_VERTEX_UNIFORM_VECTORSat 1024. The M2 vertex shader used 256 mat4 bone matrices (1024 vec4) plus ~25 other uniforms, exceeding the limit. ReducedMAX_BONESfrom 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:
Full model browser working with M2 and WMO 3D preview, local CASC source, DB2 resolution.
Related