mirror of
https://github.com/StikDebug/StikDebug.git
synced 2026-10-15 20:10:30 +00:00
Heartbeat Rework + Mini Tool (#299)
* Heartbeat rework * remove some debug loggings * stik mini tool poc * Saperate JITEnableContext into extensions and put each feature into their own files. Fix local pairing file is removed after switched to external device by directly loading the remote device's pairing file in place. * custom origin & xmlhttprequest * Fix some memory leak * allow background script access idevice (codes are from the old JSSupport branch) Tests are not carried out but most of the js api should work. Do we need to obfuscate some functions' name? * Fix JITEnableContext singleton initializer race condition * Fix instprox callback --------- Co-authored-by: Stephen B <158498287+StephenDev0@users.noreply.github.com>
This commit is contained in:
parent
f5f3d3e09b
commit
dca36d5c00
51 changed files with 4955 additions and 1114 deletions
44
StikJIT/MiniToolSupport/JSSupport/NSInvocation.m
Normal file
44
StikJIT/MiniToolSupport/JSSupport/NSInvocation.m
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
//
|
||||
// NSInvocation.m
|
||||
// StikJIT
|
||||
// Source: http://blog.jayway.com/2010/03/30/performing-any-selector-on-the-main-thread/
|
||||
// Created by s s on 2025/4/24.
|
||||
//
|
||||
@import Foundation;
|
||||
|
||||
@implementation NSInvocation(MCUtilities)
|
||||
-(void)invokeOnMainThreadWaitUntilDone:(BOOL)wait
|
||||
{
|
||||
[self performSelectorOnMainThread:@selector(invoke)
|
||||
withObject:nil
|
||||
waitUntilDone:wait];
|
||||
}
|
||||
+(NSInvocation*)invocationWithTarget:(id)target
|
||||
selector:(SEL)aSelector
|
||||
retainArguments:(BOOL)retainArguments, ...
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, retainArguments);
|
||||
char* args = (char*)ap;
|
||||
NSMethodSignature* signature = [target methodSignatureForSelector:aSelector];
|
||||
NSInvocation* invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
if (retainArguments) {
|
||||
[invocation retainArguments];
|
||||
}
|
||||
[invocation setTarget:target];
|
||||
[invocation setSelector:aSelector];
|
||||
for (int index = 2; index < [signature numberOfArguments]; index++) {
|
||||
const char *type = [signature getArgumentTypeAtIndex:index];
|
||||
NSUInteger size, align;
|
||||
NSGetSizeAndAlignment(type, &size, &align);
|
||||
NSUInteger mod = (NSUInteger)args % align;
|
||||
if (mod != 0) {
|
||||
args += (align - mod);
|
||||
}
|
||||
[invocation setArgument:args atIndex:index];
|
||||
args += size;
|
||||
}
|
||||
va_end(ap);
|
||||
return invocation;
|
||||
}
|
||||
@end
|
||||
Loading…
Add table
Add a link
Reference in a new issue