fix: prevent crash in apps that weak-link MarketplaceKit on macOS 27 - #238
Open
NickStrupat wants to merge 1 commit into
Open
NickStrupat wants to merge 1 commit into
NickStrupat wants to merge 1 commit into
Conversation
MarketplaceKit is only an empty stub for Mac Catalyst, so its symbols resolve to NULL in apps that weak-link it. On macOS 27 the `#available(iOS 17.4, *)` checks guarding those calls now pass, and apps such as Rocket League Sideswipe (via MarketplaceKitHelper) jump to a NULL AppDistributor function and crash with SIGSEGV on launch. Interpose _availability_version_check so that images weak-linking MarketplaceKit are told iOS 17.4+ is unavailable while MarketplaceKit is not loaded. All other availability checks are passed through unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
Have you looked at user plugins (#236) for PlayTools? These changes would be best if it was a plugin that can be installed for individual apps, as MarketplaceKit is unlikely to be used by most applications. Claude should be able to quickly create a custom plugin. |
Author
|
Thanks for the pointer to user plugins! I did look at that route, but I think this one belongs in core. Here's my reasoning:
If you'd still prefer it as a plugin, I'm happy to build and test one on Sideswipe. Just let me know. |
Member
|
Can you first test it was a user plugin? This would be a good test flight of user plugins, after all fixing specific games is one of its main purposes. |
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.
Problem
On macOS 27, Rocket League Sideswipe (1.12.5) opens for about a second, then closes without an error message. macOS writes no
.ipscrash report because Unreal's own crash handler catches the signal and calls_exit.The game's PLCrashReporter dumps (
Documents/Engine/Saved/Crashes/*/minidump.dmp) all show the same crash:SIGSEGVwithpc = 0x0lr = MarketplaceKitHelper +0x4300, on a Swift concurrency threadThe app bundles
MarketplaceKitHelper.framework, which weak-links/System/Library/Frameworks/MarketplaceKit.frameworkand callsAppDistributor.currentbehind#available(iOS 17.4, *)(__isPlatformVersionAtLeast(2, 17, 4, 0)).For Mac Catalyst,
MarketplaceKit.frameworkexists only as an empty stub in/System/iOSSupport. The binary entry is a dangling symlink, and the framework isn't in the dyld cache. So every weakAppDistributorsymbol resolves to NULL. On macOS 27 the iOS 17.4 availability check now passes, and the helper calls the NULL type metadata accessor ($s14MarketplaceKit14AppDistributorOMa) at+0x42fc. The same game build worked on macOS 15.Fix
Interpose
_availability_version_check(the OS function behind#available/__isPlatformVersionAtLeast) inPlayLoader.m:_dyld_register_func_for_add_imagecallback records the__TEXTrange of every image that has anLC_LOAD_WEAK_DYLIBfor MarketplaceKit.falseonly when all three of these hold:dlopen(..., RTLD_NOLOAD)).The fix doesn't depend on the bundle ID, so it should also cover other games that bundle the same helper (EU alternative-marketplace builds).
Testing
masterwith this change, converted to Mac Catalyst withvtooland installed in~/Library/Frameworks.FASTLANE=1because SwiftLint wasn't installed; this change doesn't touch any Swift code.🤖 Generated with Claude Code