mirror of
https://github.com/opa334/TrollStore.git
synced 2026-07-02 03:00:39 +08:00
Add option to open app with JIT
This commit is contained in:
+1
-1
@@ -14,6 +14,6 @@ trollstorehelper_CODESIGN_FLAGS = --entitlements entitlements.plist
|
||||
trollstorehelper_INSTALL_PATH = /usr/local/bin
|
||||
trollstorehelper_LIBRARIES = archive
|
||||
trollstorehelper_FRAMEWORKS = CoreTelephony
|
||||
trollstorehelper_PRIVATE_FRAMEWORKS = SpringBoardServices BackBoardServices MobileContainerManager FrontBoardServices
|
||||
trollstorehelper_PRIVATE_FRAMEWORKS = SpringBoardServices BackBoardServices MobileContainerManager FrontBoardServices RunningBoardServices
|
||||
|
||||
include $(THEOS_MAKE_PATH)/tool.mk
|
||||
|
||||
@@ -48,5 +48,7 @@
|
||||
<true/>
|
||||
<key>com.apple.frontboard.shutdown</key>
|
||||
<true/>
|
||||
<key>com.apple.runningboard.process-state</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
int enableJIT(NSString *bundleID);
|
||||
@@ -0,0 +1,45 @@
|
||||
@import Foundation;
|
||||
@import Darwin;
|
||||
|
||||
@interface RBSProcessPredicate
|
||||
+ (instancetype)predicateMatchingBundleIdentifier:(NSString *)bundleID;
|
||||
@end
|
||||
|
||||
@interface RBSProcessHandle
|
||||
+ (instancetype)handleForPredicate:(RBSProcessPredicate *)predicate error:(NSError **)error;
|
||||
- (int)rbs_pid;
|
||||
@end
|
||||
|
||||
#define PT_DETACH 11
|
||||
#define PT_ATTACHEXC 14
|
||||
int ptrace(int request, pid_t pid, caddr_t addr, int data);
|
||||
|
||||
int enableJIT(NSString *bundleID) {
|
||||
#ifdef EMBEDDED_ROOT_HELPER
|
||||
return -1;
|
||||
#else
|
||||
RBSProcessPredicate *predicate = [RBSProcessPredicate predicateMatchingBundleIdentifier:bundleID];
|
||||
RBSProcessHandle* process = [RBSProcessHandle handleForPredicate:predicate error:nil];
|
||||
int pid = process.rbs_pid;
|
||||
|
||||
if (!pid)
|
||||
{
|
||||
return ESRCH;
|
||||
}
|
||||
|
||||
int ret = ptrace(PT_ATTACHEXC, pid, 0, 0);
|
||||
if (ret == -1)
|
||||
{
|
||||
return errno;
|
||||
}
|
||||
|
||||
usleep(100000);
|
||||
ret = ptrace(PT_DETACH, pid, 0, 0);
|
||||
if (ret == -1)
|
||||
{
|
||||
return errno;
|
||||
}
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#import <mach-o/loader.h>
|
||||
#import <mach-o/fat.h>
|
||||
#import "devmode.h"
|
||||
#import "jit.h"
|
||||
#ifndef EMBEDDED_ROOT_HELPER
|
||||
#import "codesign.h"
|
||||
#import "coretrust_bug.h"
|
||||
@@ -1573,6 +1574,12 @@ int MAIN_NAME(int argc, char *argv[], char *envp[])
|
||||
// Give the system some time to reboot
|
||||
sleep(1);
|
||||
}
|
||||
else if([cmd isEqualToString:@"enable-jit"])
|
||||
{
|
||||
if(args.count < 2) return -3;
|
||||
NSString* userAppId = args.lastObject;
|
||||
ret = enableJIT(userAppId);
|
||||
}
|
||||
|
||||
NSLog(@"trollstorehelper returning %d", ret);
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user