File tree Expand file tree Collapse file tree
PlayTools/Controls/PTFakeTouch Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,21 +54,9 @@ + (void) load
5454 [objc_getClass (" FBSSceneSettings" ) swizzleInstanceMethod: @selector (bounds ) withMethod: @selector (hook_bounds )];
5555 [objc_getClass (" FBSDisplayMode" ) swizzleInstanceMethod: @selector (size ) withMethod: @selector (hook_size )];
5656 }
57-
58- [objc_getClass (" _UIMenuBuilder" ) swizzleInstanceMethod: sel_getUid (" initWithRootMenu:" ) withMethod: @selector (initWithRootMenuHook: )];
5957
6058 [objc_getClass (" IOSViewController" ) swizzleInstanceMethod: @selector (prefersPointerLocked ) withMethod: @selector (hook_prefersPointerLocked )];
61- }
62-
63- bool menuWasCreated = false ;
64- - (id ) initWithRootMenuHook : (id )rootMenu {
65- self = [self initWithRootMenuHook: rootMenu];
66- if (!menuWasCreated) {
67- [PlayCover initMenuWithMenu: self ];
68- menuWasCreated = TRUE ;
69- }
70-
71- return self;
59+ [self swizzleInstanceMethod: @selector (init ) withMethod: @selector (hook_init )];
7260}
7361
7462- (BOOL ) hook_prefersPointerLocked {
@@ -87,4 +75,16 @@ - (CGSize) hook_size {
8775 return [PlayScreen sizeAspectRatio: [self hook_size ]];
8876}
8977
78+ bool menuWasCreated = false ;
79+
80+ -(id ) hook_init {
81+ if (!menuWasCreated) {
82+ if ([[self class ] isEqual: NSClassFromString (@" _UIMenuBuilder" )]) {
83+ [PlayCover initMenuWithMenu: self ];
84+ menuWasCreated = TRUE ;
85+ }
86+ }
87+
88+ return self;
89+ }
9090@end
You can’t perform that action at this time.
0 commit comments