11#include " UIKit/UIKit.h"
22#include " support/support.h"
33
4+ #ifdef __cplusplus
5+ extern " C" {
6+ #endif // __cplusplus
7+
8+ extern void * SecTaskCreateFromSelf (void *);
9+ extern void * SecTaskCopySigningIdentifier (void *, void *);
10+ extern CFDictionaryRef SecTaskCopyValuesForEntitlements (void *, CFArrayRef, CFErrorRef _Nullable *);
11+ extern CFTypeRef SecTaskCopyValueForEntitlement (void *, CFStringRef, CFErrorRef *);
12+
13+ #ifdef __cplusplus
14+ }
15+ #endif // __cplusplus
16+
417BOOL (*orig_didFinishLaunchingWithOptions)(id self, SEL selector, UIApplication* application, NSDictionary * launchOptions);
518BOOL new_didFinishLaunchingWithOptions (id self, SEL selector, UIApplication* application, NSDictionary * launchOptions)
619{
@@ -24,6 +37,16 @@ void new_applicationDidBecomeActive(id self, SEL selector, id arg0)
2437
2538SUPPORT_CTOR
2639{
40+ NSString * teamIdentifier = CFBridgingRelease (SecTaskCopyValueForEntitlement (SecTaskCreateFromSelf (NULL ), CFSTR (" com.apple.developer.team-identifier" ), NULL ));
41+ NSString * bundleIdentifier = [[NSBundle mainBundle ] bundleIdentifier ];
42+
43+ // original bundleIdentifier after removing teamIdentifier
44+ const char * cBundleIdentifier = [bundleIdentifier hasPrefix: teamIdentifier] ?
45+ [[bundleIdentifier stringByReplacingOccurrencesOfString: [NSString stringWithFormat: @" .%@ " , teamIdentifier]
46+ withString: @" " ] UTF8String ] : [bundleIdentifier UTF8String ];
47+
48+ // DLOG(@"libSupport(%s) by Rednick16 Injected.", SupportGeVersion());
49+
2750 /* Create the structure
2851 .teamIdentifier -> (Currently paused)
2952 .bundleIdentifier -> "com.rednick16.myApp"
@@ -37,7 +60,7 @@ void new_applicationDidBecomeActive(id self, SEL selector, id arg0)
3760 */
3861 SupportEntryInfo entry_info = {
3962 .teamIdentifier = NULL ,
40- .bundleIdentifier = NULL ,
63+ .bundleIdentifier = cBundleIdentifier ,
4164 .files = {
4265 " CydiaSubstrate" ,
4366 " libsubstrate" ,
@@ -60,15 +83,18 @@ void new_applicationDidBecomeActive(id self, SEL selector, id arg0)
6083
6184 SupportHookInstanceMessage (" UnityAppController" ,
6285 " application:didFinishLaunchingWithOptions:" ,
63- new_didFinishLaunchingWithOptions,
64- orig_didFinishLaunchingWithOptions);
86+ & new_didFinishLaunchingWithOptions,
87+ & orig_didFinishLaunchingWithOptions);
6588
6689 SupportHookInstanceMessage (" UnityAppController" ,
6790 " applicationDidBecomeActive:" ,
68- new_applicationDidBecomeActive,
69- orig_applicationDidBecomeActive);
91+ & new_applicationDidBecomeActive,
92+ & orig_applicationDidBecomeActive);
7093
7194 SupportHookSymbolEx (" dyld_get_image_name" ,
7295 (void *)(new_dyld_get_image_name),
7396 (void **)(&orig_dyld_get_image_name));
97+
98+ SupportHookClassMessage (" APMAEU" , " isFAS" , WRAPPER_OBJC_HOOK_TRUE, NULL );
99+ SupportHookClassMessage (" GULAppEnvironmentUtil" , " isFromAppStore" , WRAPPER_OBJC_HOOK_TRUE, NULL );
74100}
0 commit comments