[macOS] Bundle app artifacts with runtime data discovery#2090
Open
TmLev wants to merge 3 commits into
Open
Conversation
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.
Description
This adds macOS
.appbundle packaging for OpenXRay and CI artifact generation for Release macOS builds.The bundle includes the engine executable, bundled dynamic libraries, open-source engine resources from
res/, and a small startup resolver for proprietary game data. On first launch, the app tries to discover existing game data locations, offers the user a native macOS folder selection flow when needed, and prepares the expected runtime layout under Application Support using symlinks.Should resolve #1780.
Supersedes #2050.
What changed
misc/macos/make_app_bundle.shto create:OpenXRay.appopenxray-<config>-<arch>.app.zipopenxray-<config>-<arch>.dmgdylibbundler.LC_RPATHentries and ad-hoc signs the app bundle.OpenXRay.appand anApplicationssymlink.$HOME/.local/share/GSC Game World/...-fsltxis provided.Runtime fixes found during validation
While testing the packaged app, two startup issues were found and fixed.
More on this down below.
Validation
Tested locally with:
cmake -S . -B build-local cmake --build build-local --target xrEngine --parallel 4 cmake --build build-local --target xrRender_GL xrGame --parallel 4 bash -n misc/macos/make_app_bundle.sh OPENXRAY_SKIP_DMG=1 misc/macos/make_app_bundle.sh arm64 Release misc/macos/make_app_bundle.sh arm64 Release codesign --verify --deep --strict --verbose=2 build/artifacts/OpenXRay.appAlso manually verified that the packaged app launches, reaches the menu, starts a new game, plays/skips the intro, and enters gameplay.
macOS Gatekeeper note
The generated
.appis ad-hoc signed so bundled libraries and modified install names/rpaths validate locally, but it is not Developer ID signed or notarized.Because CI artifacts are downloaded from the browser and keep the
com.apple.quarantineattribute, macOS Gatekeeper may block the app with:For now, testers can remove quarantine manually:
or after copying the app:
cp -R "/Volumes/OpenXRay Release arm64/OpenXRay.app" /Applications/ xattr -dr com.apple.quarantine /Applications/OpenXRay.app open /Applications/OpenXRay.appDeveloper ID signing and notarization are intentionally left for a follow-up because they require Apple Developer credentials and CI secrets.
Suggested next steps on signing:
READMEor release note for macOS users explaining the quarantine workaround until notarization exists.Let me know what you think is best here.
Notes on
xrRenderGLandxrGamechangesThis PR also contains two runtime fixes found while validating the packaged macOS app:
Issue 1: new game appeared to hang during loading
After the app bundle could launch, show title videos, and reach the main menu, starting a new game did not reliably enter gameplay. It looked like the game was stuck on the loading screen.
Debugging showed the process was not blocked in the bundle/data-path setup. Sampling the process pointed at a stack protector failure around
CSE_ALifeObject::spawn_supplies, which runs during ALife object creation while loading a level.The affected code parsed spawn/loadout config strings with
_GetItem(...)into fixed-size local buffers:Those buffers are too small for some real gamedata values.
_GetItemwrites the parsed token into the provided output buffer, so long spawn options can overwrite the stack. On macOS Release builds this surfaced as__stack_chk_fail, which from the user side looked like loading never completed.The fix changes those temporary buffers to
xr_stringin the three parsing sites:This keeps the parsing behavior the same but removes the arbitrary stack-buffer limit. It is intentionally narrow: no spawn logic, probabilities, addon handling, ammo selection, or ALife behavior was changed.
Issue 2: intro cutscene had audio but rendered solid green
After the loading issue was fixed, starting a new game reached the intro sequence, but the video frame was solid green while audio played correctly. Pressing Escape skipped the video and gameplay worked, so the failure was isolated to video texture setup/update rather than game state or level loading.
The log showed:
0x502isGL_INVALID_OPERATION. The error was observed in the OpenGL Theora/OGM texture path inCTexture::Load().The previous OGM path allocated immutable storage with:
Then video frames are uploaded later with:
glTexSubImage2D(..., GL_BGRA, GL_UNSIGNED_BYTE, ...);For this use case the texture is dynamic single-level video storage, updated through a PBO each frame. Immutable storage is not needed here, and on macOS OpenGL this path was producing an invalid video texture state. There was also a second problem: the code checked
glGetError()at the end of video texture creation, so a stale pending GL error from earlier texture work could falsely invalidate the video stream.The fix does two things in the OGM path only:
This matches the later frame upload format and avoids requiring mip levels. The texture still stores as
GL_RGBA8;GL_BGRAis only the external upload format. The Windows AVI path was left unchanged.Why these issue fixes are in this PR
These fixes are not packaging mechanics, but they are required for the packaged macOS app to be practically usable – without them the user can launch the bundle, but new-game startup either fails during loading or shows a broken intro video.