X-Git-Url: https://git.saurik.com/cydia.git/blobdiff_plain/a09f7a4894d2dde0ac8820993f3d51ba0fe36810..e65eba85e36a518ccad605c715a88b4ee59ce439:/Substrate.hpp diff --git a/Substrate.hpp b/Substrate.hpp index 9826b567..57e89fbb 100644 --- a/Substrate.hpp +++ b/Substrate.hpp @@ -31,8 +31,21 @@ static inline Type_ &MSHookIvar(id self, const char *name) { return *reinterpret_cast(pointer); } +#define MSClassHook(name) \ + @class name; \ + static Class $ ## name = objc_getClass(#name); + #define MSHook(type, name, args...) \ static type (*_ ## name)(args); \ static type $ ## name(args) +#define CYHook(Type, Code, Name) \ +static struct Type ## $ ## Code { Type ## $ ## Code() { \ + Method Type ## $ ## Code(class_getInstanceMethod($ ## Type, @selector(Name))); \ + if (Type ## $ ## Code != NULL) { \ + _ ## Type ## $ ## Code = reinterpret_cast(method_getImplementation(Type ## $ ## Code)); \ + method_setImplementation(Type ## $ ## Code, reinterpret_cast(&$ ## Type ## $ ## Code)); \ + } \ +} } Type ## $ ## Code; + #endif//Substrate_HPP