Files
Tick11/.theos/obj/debug/arm64/Tweak.x.m
ShyMemoriees 848e30d228 1.1
2019-12-13 15:45:49 +01:00

234 lines
16 KiB
Objective-C

#line 1 "Tweak.x"
#import "Tick.h"
void playSound() {
int loudness = [loudnessLevel intValue];
SystemSoundID sound = 0;
AudioServicesDisposeSystemSoundID(sound);
if (loudness == 0) {
AudioServicesCreateSystemSoundID((CFURLRef) CFBridgingRetain([NSURL fileURLWithPath:@"/Library/Application Support/Tick/tick.caf"]), &sound);
} else if (loudness == 1) {
AudioServicesCreateSystemSoundID((CFURLRef) CFBridgingRetain([NSURL fileURLWithPath:@"/Library/Application Support/Tick/tick2.caf"]), &sound);
} else if (loudness == 2) {
AudioServicesCreateSystemSoundID((CFURLRef) CFBridgingRetain([NSURL fileURLWithPath:@"/Library/Application Support/Tick/tick3.caf"]), &sound);
}
AudioServicesPlaySystemSound((SystemSoundID)sound);
}
#include <substrate.h>
#if defined(__clang__)
#if __has_feature(objc_arc)
#define _LOGOS_SELF_TYPE_NORMAL __unsafe_unretained
#define _LOGOS_SELF_TYPE_INIT __attribute__((ns_consumed))
#define _LOGOS_SELF_CONST const
#define _LOGOS_RETURN_RETAINED __attribute__((ns_returns_retained))
#else
#define _LOGOS_SELF_TYPE_NORMAL
#define _LOGOS_SELF_TYPE_INIT
#define _LOGOS_SELF_CONST
#define _LOGOS_RETURN_RETAINED
#endif
#else
#define _LOGOS_SELF_TYPE_NORMAL
#define _LOGOS_SELF_TYPE_INIT
#define _LOGOS_SELF_CONST
#define _LOGOS_RETURN_RETAINED
#endif
@class SBUIIconForceTouchViewController; @class SBIconController; @class UIPreviewInteractionController;
#line 25 "Tweak.x"
static BOOL (*_logos_orig$Tick$SBUIIconForceTouchViewController$presentAnimated$withCompletionHandler$)(_LOGOS_SELF_TYPE_NORMAL SBUIIconForceTouchViewController* _LOGOS_SELF_CONST, SEL, BOOL, id); static BOOL _logos_method$Tick$SBUIIconForceTouchViewController$presentAnimated$withCompletionHandler$(_LOGOS_SELF_TYPE_NORMAL SBUIIconForceTouchViewController* _LOGOS_SELF_CONST, SEL, BOOL, id); static void (*_logos_orig$Tick$SBIconController$_forceTouchControllerWillPresent$)(_LOGOS_SELF_TYPE_NORMAL SBIconController* _LOGOS_SELF_CONST, SEL, id); static void _logos_method$Tick$SBIconController$_forceTouchControllerWillPresent$(_LOGOS_SELF_TYPE_NORMAL SBIconController* _LOGOS_SELF_CONST, SEL, id); static void (*_logos_orig$Tick$SBIconController$_iconForceTouchControllerWillPresent$)(_LOGOS_SELF_TYPE_NORMAL SBIconController* _LOGOS_SELF_CONST, SEL, id); static void _logos_method$Tick$SBIconController$_iconForceTouchControllerWillPresent$(_LOGOS_SELF_TYPE_NORMAL SBIconController* _LOGOS_SELF_CONST, SEL, id); static void (*_logos_orig$Tick$UIPreviewInteractionController$previewInteraction$didUpdatePreviewTransition$ended$)(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, id, double, BOOL); static void _logos_method$Tick$UIPreviewInteractionController$previewInteraction$didUpdatePreviewTransition$ended$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, id, double, BOOL); static void (*_logos_orig$Tick$UIPreviewInteractionController$setPreviewInteraction$)(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, UIPreviewInteraction *); static void _logos_method$Tick$UIPreviewInteractionController$setPreviewInteraction$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, UIPreviewInteraction *); static void (*_logos_orig$Tick$UIPreviewInteractionController$setPresentingViewController$)(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, UIViewController *); static void _logos_method$Tick$UIPreviewInteractionController$setPresentingViewController$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, UIViewController *); static BOOL (*_logos_orig$Tick$UIPreviewInteractionController$_usesPreviewInteraction)(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL); static BOOL _logos_method$Tick$UIPreviewInteractionController$_usesPreviewInteraction(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL); static void (*_logos_orig$Tick$UIPreviewInteractionController$setCurrentPreviewViewController$)(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, UIViewController *); static void _logos_method$Tick$UIPreviewInteractionController$setCurrentPreviewViewController$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, UIViewController *); static BOOL (*_logos_orig$Tick$UIPreviewInteractionController$_usesPreviewPresentationController)(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL); static BOOL _logos_method$Tick$UIPreviewInteractionController$_usesPreviewPresentationController(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL); static void (*_logos_orig$Tick$UIPreviewInteractionController$setWindowForPreviewPresentation$)(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, UIWindow *); static void _logos_method$Tick$UIPreviewInteractionController$setWindowForPreviewPresentation$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, UIWindow *); static BOOL (*_logos_orig$Tick$UIPreviewInteractionController$startInteractivePreviewAtLocation$inView$)(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, CGPoint, id); static BOOL _logos_method$Tick$UIPreviewInteractionController$startInteractivePreviewAtLocation$inView$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, CGPoint, id); static void (*_logos_orig$Tick$UIPreviewInteractionController$commitInteractivePreview)(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL); static void _logos_method$Tick$UIPreviewInteractionController$commitInteractivePreview(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL); static void (*_logos_orig$Tick$UIPreviewInteractionController$forcePresentationController$didSelectMenuItem$)(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, id, id); static void _logos_method$Tick$UIPreviewInteractionController$forcePresentationController$didSelectMenuItem$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, id, id); static void (*_logos_orig$Tick$UIPreviewInteractionController$forcePresentationControllerWantsToCommit$)(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, id); static void _logos_method$Tick$UIPreviewInteractionController$forcePresentationControllerWantsToCommit$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, id);
static BOOL _logos_method$Tick$SBUIIconForceTouchViewController$presentAnimated$withCompletionHandler$(_LOGOS_SELF_TYPE_NORMAL SBUIIconForceTouchViewController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, BOOL arg1, id arg2) {
if (enabled) {
playSound();
}
return _logos_orig$Tick$SBUIIconForceTouchViewController$presentAnimated$withCompletionHandler$(self, _cmd, arg1, arg2);
}
static void _logos_method$Tick$SBIconController$_forceTouchControllerWillPresent$(_LOGOS_SELF_TYPE_NORMAL SBIconController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, id arg1) {
_logos_orig$Tick$SBIconController$_forceTouchControllerWillPresent$(self, _cmd, arg1);
if (enabled) {
playSound();
}
}
static void _logos_method$Tick$SBIconController$_iconForceTouchControllerWillPresent$(_LOGOS_SELF_TYPE_NORMAL SBIconController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, id arg1) {
_logos_orig$Tick$SBIconController$_iconForceTouchControllerWillPresent$(self, _cmd, arg1);
if (enabled) {
playSound();
}
}
static void _logos_method$Tick$UIPreviewInteractionController$previewInteraction$didUpdatePreviewTransition$ended$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, id arg1, double arg2, BOOL arg3) {
_logos_orig$Tick$UIPreviewInteractionController$previewInteraction$didUpdatePreviewTransition$ended$(self, _cmd, arg1, arg2, arg3);
if (enabled) {
playSound();
}
}
static void _logos_method$Tick$UIPreviewInteractionController$setPreviewInteraction$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, UIPreviewInteraction * arg1) {
_logos_orig$Tick$UIPreviewInteractionController$setPreviewInteraction$(self, _cmd, arg1);
if (enabled) {
playSound();
}
}
static void _logos_method$Tick$UIPreviewInteractionController$setPresentingViewController$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, UIViewController * arg1) {
_logos_orig$Tick$UIPreviewInteractionController$setPresentingViewController$(self, _cmd, arg1);
if (enabled) {
playSound();
}
}
static BOOL _logos_method$Tick$UIPreviewInteractionController$_usesPreviewInteraction(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd) {
if (enabled) {
playSound();
}
return _logos_orig$Tick$UIPreviewInteractionController$_usesPreviewInteraction(self, _cmd);
}
static void _logos_method$Tick$UIPreviewInteractionController$setCurrentPreviewViewController$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, UIViewController * arg1) {
_logos_orig$Tick$UIPreviewInteractionController$setCurrentPreviewViewController$(self, _cmd, arg1);
if (enabled) {
playSound();
}
}
static BOOL _logos_method$Tick$UIPreviewInteractionController$_usesPreviewPresentationController(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd) {
if (enabled) {
playSound();
}
return _logos_orig$Tick$UIPreviewInteractionController$_usesPreviewPresentationController(self, _cmd);
}
static void _logos_method$Tick$UIPreviewInteractionController$setWindowForPreviewPresentation$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, UIWindow * arg1) {
_logos_orig$Tick$UIPreviewInteractionController$setWindowForPreviewPresentation$(self, _cmd, arg1);
if (enabled) {
playSound();
}
}
static BOOL _logos_method$Tick$UIPreviewInteractionController$startInteractivePreviewAtLocation$inView$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, CGPoint arg1, id arg2) {
if (enabled) {
playSound();
}
return _logos_orig$Tick$UIPreviewInteractionController$startInteractivePreviewAtLocation$inView$(self, _cmd, arg1, arg2);
}
static void _logos_method$Tick$UIPreviewInteractionController$commitInteractivePreview(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd) {
_logos_orig$Tick$UIPreviewInteractionController$commitInteractivePreview(self, _cmd);
if (enabled) {
playSound();
}
}
static void _logos_method$Tick$UIPreviewInteractionController$forcePresentationController$didSelectMenuItem$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, id arg1, id arg2) {
_logos_orig$Tick$UIPreviewInteractionController$forcePresentationController$didSelectMenuItem$(self, _cmd, arg1, arg2);
if (enabled) {
playSound();
}
}
static void _logos_method$Tick$UIPreviewInteractionController$forcePresentationControllerWantsToCommit$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, id arg1) {
_logos_orig$Tick$UIPreviewInteractionController$forcePresentationControllerWantsToCommit$(self, _cmd, arg1);
if (enabled) {
playSound();
}
}
static __attribute__((constructor)) void _logosLocalCtor_f01702de(int __unused argc, char __unused **argv, char __unused **envp) {
pfs = [[HBPreferences alloc] initWithIdentifier:@"me.shymemoriees.tickpreferences"];
[pfs registerBool:&enabled default:YES forKey:@"Enabled"];
[pfs registerObject:&loudnessLevel default:@"0" forKey:@"Loudness"];
if(enabled)
{Class _logos_class$Tick$SBUIIconForceTouchViewController = objc_getClass("SBUIIconForceTouchViewController"); MSHookMessageEx(_logos_class$Tick$SBUIIconForceTouchViewController, @selector(presentAnimated:withCompletionHandler:), (IMP)&_logos_method$Tick$SBUIIconForceTouchViewController$presentAnimated$withCompletionHandler$, (IMP*)&_logos_orig$Tick$SBUIIconForceTouchViewController$presentAnimated$withCompletionHandler$);Class _logos_class$Tick$SBIconController = objc_getClass("SBIconController"); MSHookMessageEx(_logos_class$Tick$SBIconController, @selector(_forceTouchControllerWillPresent:), (IMP)&_logos_method$Tick$SBIconController$_forceTouchControllerWillPresent$, (IMP*)&_logos_orig$Tick$SBIconController$_forceTouchControllerWillPresent$);MSHookMessageEx(_logos_class$Tick$SBIconController, @selector(_iconForceTouchControllerWillPresent:), (IMP)&_logos_method$Tick$SBIconController$_iconForceTouchControllerWillPresent$, (IMP*)&_logos_orig$Tick$SBIconController$_iconForceTouchControllerWillPresent$);Class _logos_class$Tick$UIPreviewInteractionController = objc_getClass("UIPreviewInteractionController"); MSHookMessageEx(_logos_class$Tick$UIPreviewInteractionController, @selector(previewInteraction:didUpdatePreviewTransition:ended:), (IMP)&_logos_method$Tick$UIPreviewInteractionController$previewInteraction$didUpdatePreviewTransition$ended$, (IMP*)&_logos_orig$Tick$UIPreviewInteractionController$previewInteraction$didUpdatePreviewTransition$ended$);MSHookMessageEx(_logos_class$Tick$UIPreviewInteractionController, @selector(setPreviewInteraction:), (IMP)&_logos_method$Tick$UIPreviewInteractionController$setPreviewInteraction$, (IMP*)&_logos_orig$Tick$UIPreviewInteractionController$setPreviewInteraction$);MSHookMessageEx(_logos_class$Tick$UIPreviewInteractionController, @selector(setPresentingViewController:), (IMP)&_logos_method$Tick$UIPreviewInteractionController$setPresentingViewController$, (IMP*)&_logos_orig$Tick$UIPreviewInteractionController$setPresentingViewController$);MSHookMessageEx(_logos_class$Tick$UIPreviewInteractionController, @selector(_usesPreviewInteraction), (IMP)&_logos_method$Tick$UIPreviewInteractionController$_usesPreviewInteraction, (IMP*)&_logos_orig$Tick$UIPreviewInteractionController$_usesPreviewInteraction);MSHookMessageEx(_logos_class$Tick$UIPreviewInteractionController, @selector(setCurrentPreviewViewController:), (IMP)&_logos_method$Tick$UIPreviewInteractionController$setCurrentPreviewViewController$, (IMP*)&_logos_orig$Tick$UIPreviewInteractionController$setCurrentPreviewViewController$);MSHookMessageEx(_logos_class$Tick$UIPreviewInteractionController, @selector(_usesPreviewPresentationController), (IMP)&_logos_method$Tick$UIPreviewInteractionController$_usesPreviewPresentationController, (IMP*)&_logos_orig$Tick$UIPreviewInteractionController$_usesPreviewPresentationController);MSHookMessageEx(_logos_class$Tick$UIPreviewInteractionController, @selector(setWindowForPreviewPresentation:), (IMP)&_logos_method$Tick$UIPreviewInteractionController$setWindowForPreviewPresentation$, (IMP*)&_logos_orig$Tick$UIPreviewInteractionController$setWindowForPreviewPresentation$);MSHookMessageEx(_logos_class$Tick$UIPreviewInteractionController, @selector(startInteractivePreviewAtLocation:inView:), (IMP)&_logos_method$Tick$UIPreviewInteractionController$startInteractivePreviewAtLocation$inView$, (IMP*)&_logos_orig$Tick$UIPreviewInteractionController$startInteractivePreviewAtLocation$inView$);MSHookMessageEx(_logos_class$Tick$UIPreviewInteractionController, @selector(commitInteractivePreview), (IMP)&_logos_method$Tick$UIPreviewInteractionController$commitInteractivePreview, (IMP*)&_logos_orig$Tick$UIPreviewInteractionController$commitInteractivePreview);MSHookMessageEx(_logos_class$Tick$UIPreviewInteractionController, @selector(forcePresentationController:didSelectMenuItem:), (IMP)&_logos_method$Tick$UIPreviewInteractionController$forcePresentationController$didSelectMenuItem$, (IMP*)&_logos_orig$Tick$UIPreviewInteractionController$forcePresentationController$didSelectMenuItem$);MSHookMessageEx(_logos_class$Tick$UIPreviewInteractionController, @selector(forcePresentationControllerWantsToCommit:), (IMP)&_logos_method$Tick$UIPreviewInteractionController$forcePresentationControllerWantsToCommit$, (IMP*)&_logos_orig$Tick$UIPreviewInteractionController$forcePresentationControllerWantsToCommit$);}
}