Created
June 10, 2021 04:33
-
-
Save zhuowei/acf4257d1b79c000affcb5954c2dc7f1 to your computer and use it in GitHub Desktop.
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
@import Darwin; | |
@import ObjectiveC; | |
@import CloudKit; | |
extern bool GEOConfigGetBOOL(int feature, void* something); | |
// Hooks feature flags in a resigned Maps.app to return true. | |
// Usage: | |
// clang -shared -fmodules -o libmaps_inject.dylib maps_inject.m \ | |
// "$(xcrun | |
// --show-sdk-path)/System/Library/PrivateFrameworks/GeoServices.framework/GeoServices.tbd" | |
// cp -a /System/Applications/Maps.app ./ | |
// codesign --remove Maps.app/Contents/MacOS/Maps | |
// DYLD_INSERT_LIBRARIES=./libmaps_inject.dylib Maps.app/Contents/MacOS/Maps | |
#define DYLD_INTERPOSE(_replacement, _replacee) \ | |
__attribute__((used)) static struct { \ | |
const void* replacement; \ | |
const void* replacee; \ | |
} _interpose_##_replacee __attribute__((section("__DATA,__interpose"))) = { \ | |
(const void*)(unsigned long)&_replacement, (const void*)(unsigned long)&_replacee} | |
bool wdb_GEOConfigGetBOOL(int feature, void* something) { | |
if (feature == 5) { | |
NSLog(@"config get VectorKitDebugConfig_AllowNonSupportedDeviceAdvancedMap"); | |
return true; | |
} | |
NSLog(@"config get bool %d", feature); | |
return GEOConfigGetBOOL(feature, something); | |
} | |
DYLD_INTERPOSE(wdb_GEOConfigGetBOOL, GEOConfigGetBOOL); | |
// Our resigned Maps app doesn't have iCloud access, so disable iCloud. | |
// (Not necessary if you're running with SIP off and injecting into the real | |
// Maps app) | |
id wdb_CKContainer_initWithContainerID_hook() { return nil; } | |
id wdb_CKContainer_initWithContainerID_options_hook() { return nil; } | |
__attribute__((constructor)) void wdb_hook_init() { | |
Class ckContainerClass = [CKContainer class]; | |
Method method1 = class_getInstanceMethod(ckContainerClass, @selector(initWithContainerID:)); | |
method_setImplementation(method1, (IMP)&wdb_CKContainer_initWithContainerID_hook); | |
Method method2 = class_getInstanceMethod(ckContainerClass, @selector(initWithContainerID: | |
options:)); | |
method_setImplementation(method2, (IMP)&wdb_CKContainer_initWithContainerID_options_hook); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for the solution.
On Ventura: 3D globe view is still fully functional, but 3D city maps seem to crash every time you zoom in to a city with that feature, i.e. San Francisco, Paris, London etc. Hopefully there is still a fix for this.