forked from k3a/AssistantExtensions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.h
59 lines (32 loc) · 1.46 KB
/
main.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once
#include "shared.h"
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include "SiriObjects.h"
// sends immediately without additional processing
id SessionSendToClient(NSDictionary* dict, id ctx=nil);
// sends immediately without additional processing
id SessionSendToServer(NSDictionary* dict, id ctx=nil);
bool InSpringBoard();
#define EXTENSIONS_PATH "/Library/AssistantExtensions/"
#pragma mark - K3A's MS HELPER MACROS ------------------------------------------
#define CALL_ORIG(args...) \
return __orig_fn(self, sel, ## args)
#define ORIG(args...) \
__orig_fn(self, sel, ## args)
#define GET_CLASS(class) \
Class $ ## class = objc_getClass(#class); \
if (! $ ## class ) Info("AE WARN: Failed to get class %s!", #class);
#define GET_METACLASS(class) \
Class $ ## class = objc_getMetaClass(#class); \
if (! $ ## class ) Info("AE WARN: Failed to get metaclass %s!", #class);
#define HOOK(className, name, type, args...) \
@class className; \
static type (*_ ## className ## $ ## name)(className *self, SEL sel, ## args) = NULL; \
static type $ ## className ## $ ## name(className *self, SEL sel, ## args) { \
type (*__orig_fn)(className *self, SEL sel, ## args) = _ ## className ## $ ## name ; __orig_fn=__orig_fn;
#define END }
#define LOAD_HOOK(class, sel, imp) \
if ($ ## class) { MSHookMessage($ ## class, @selector(sel), MSHake(class ## $ ## imp)); \
if (! _ ## class ## $ ## imp ) Info("AE WARN: " #class "-" #sel " not found!" ); }