Skip to content

Instantly share code, notes, and snippets.

@pixelomer
Last active June 22, 2024 15:44
Show Gist options
  • Save pixelomer/3c9ac9b7e8b3f77615dc2fcbd800ec7c to your computer and use it in GitHub Desktop.
Save pixelomer/3c9ac9b7e8b3f77615dc2fcbd800ec7c to your computer and use it in GitHub Desktop.
// Works on iOS 16 and later. Works by hooking backboardd.
// { Filter = { Executables = ( "backboardd" ); }; }
#import <UIKit/UIKit.h>
@interface BKTouchContact : NSObject {
CGPoint _normalLocation;
}
@end
@interface BKTouchContactSet : NSObject {
NSMutableArray<BKTouchContact *> *_contacts;
}
- (long long)count;
@end
%hook BKTouchContactSet
- (long long)count {
NSMutableArray *array = MSHookIvar<NSMutableArray *>(self, "_contacts");
if (array.count > 0) {
// _normalLocation components range from 0 to 1
BKTouchContact *contact = array[0];
CGPoint point = MSHookIvar<CGPoint>(contact, "_normalLocation");
// Use point here ...
}
return %orig;
}
%end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment