-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhookengine.h
More file actions
27 lines (25 loc) · 1.14 KB
/
Copy pathhookengine.h
File metadata and controls
27 lines (25 loc) · 1.14 KB
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
#pragma once
// ===========================================================================
// hookengine.h — MSHookFunction <-> Dobby shim.
//
// JB / rootless builds (default): MobileSubstrate's MSHookFunction is live
// in libsubstrate, linked at runtime.
// Jailed (sideload-injected) builds: Dobby, statically linked from
// vendor/dobby/lib/libdobby.a so the .dylib
// has zero external hook-engine dependency.
//
// The shim below maps MSHookFunction(...) onto DobbyHook(...) when IPA_JAILED
// is defined at compile time, so every Hook_*.m stays untouched between the
// two distribution modes.
//
// Each tweak's Makefile sets -DIPA_JAILED=1 via `make JAILED=1`.
// ===========================================================================
#if IPA_JAILED
#import "dobby.h"
// MSHookFunction returns void; DobbyHook returns int. Cast the result away so
// the call site keeps the original void-expression shape.
#define MSHookFunction(sym, repl, orig) \
((void)DobbyHook((void *)(sym), (void *)(repl), (void **)(orig)))
#else
#import <substrate.h>
#endif