@@ -120,8 +120,12 @@ static void rarch_draw_observer(CFRunLoopObserverRef observer,
120120#endif
121121
122122 runloop_flags = runloop_get_flags ();
123- if (!( runloop_flags & RUNLOOP_FLAG_IDLE) )
123+ if (runloop_flags & RUNLOOP_FLAG_FASTMOTION )
124124 CFRunLoopWakeUp (CFRunLoopGetMain ());
125+ #if TARGET_OS_IPHONE
126+ else
127+ rarch_stop_draw_observer ();
128+ #endif
125129}
126130
127131void rarch_start_draw_observer (void )
@@ -173,8 +177,12 @@ -(void)step:(CADisplayLink*)target API_AVAILABLE(macos(14.0), ios(3.1), tvos(3.1
173177 }
174178
175179 uint32_t runloop_flags = runloop_get_flags ();
176- if (!(runloop_flags & RUNLOOP_FLAG_IDLE))
180+ if (runloop_flags & RUNLOOP_FLAG_FASTMOTION)
181+ {
182+ /* Fast-forward: observer handles all iterations */
183+ rarch_start_draw_observer ();
177184 CFRunLoopWakeUp (CFRunLoopGetMain ());
185+ }
178186#endif
179187}
180188#endif
@@ -195,14 +203,22 @@ + (CocoaView*)get
195203 * the display server will set the exact rate when needed */
196204 [view.displayLink setPreferredFrameRateRange: CAFrameRateRangeMake (60 , 120 , 120 )];
197205 }
206+ else
207+ {
208+ /* iOS 9-14: Use preferredFramesPerSecond as fallback */
209+ view.displayLink .preferredFramesPerSecond = 120 ;
210+ }
211+ #else
212+ /* Building with SDK < iOS 15: Use preferredFramesPerSecond */
213+ view.displayLink .preferredFramesPerSecond = 120 ;
198214#endif
199- [view.displayLink addToRunLoop: [NSRunLoop currentRunLoop ] forMode: NSDefaultRunLoopMode ];
215+ [view.displayLink addToRunLoop: [NSRunLoop currentRunLoop ] forMode: NSRunLoopCommonModes ];
200216#elif defined(OSX) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 140000
201217 if (@available (macOS 14.0 , *))
202218 {
203219 view.displayLink = [view displayLinkWithTarget: view selector: @selector (step: )];
204220 view.displayLink .preferredFrameRateRange = CAFrameRateRangeMake (60 , 120 , 120 );
205- [view.displayLink addToRunLoop: [NSRunLoop currentRunLoop ] forMode: NSDefaultRunLoopMode ];
221+ [view.displayLink addToRunLoop: [NSRunLoop currentRunLoop ] forMode: NSRunLoopCommonModes ];
206222 }
207223#endif
208224 }
@@ -757,22 +773,26 @@ - (void)webServerDidCompleteBonjourRegistration:(GCDWebServer*)server
757773 UIAlertController *alert = [UIAlertController alertControllerWithTitle: @" Welcome to RetroArch" message: [NSString stringWithFormat: @" To transfer files from your computer, go to one of these addresses on your web browser:\n\n %@ " ,servers] preferredStyle: UIAlertControllerStyleAlert];
758774 [alert addAction: [UIAlertAction actionWithTitle: @" OK"
759775 style: UIAlertActionStyleDefault handler: ^(UIAlertAction * _Nonnull action) {
760- rarch_start_draw_observer ();
776+ struct menu_state *menu_st = menu_state_get_ptr ();
777+ menu_st->flags &= ~MENU_ST_FLAG_BLOCK_ALL_INPUT;;
761778 }]];
762779 [alert addAction: [UIAlertAction actionWithTitle: @" Don't Show Again"
763780 style: UIAlertActionStyleDefault handler: ^(UIAlertAction * _Nonnull action) {
764- rarch_start_draw_observer ();
781+ struct menu_state *menu_st = menu_state_get_ptr ();
782+ menu_st->flags &= ~MENU_ST_FLAG_BLOCK_ALL_INPUT;
765783 configuration_set_bool (settings, settings->bools .gcdwebserver_alert , false );
766784 }]];
767785#if TARGET_OS_IOS
768786 [alert addAction: [UIAlertAction actionWithTitle: @" Stop Server" style: UIAlertActionStyleDefault handler: ^(UIAlertAction * _Nonnull action) {
769787 [[WebServer sharedInstance ] webUploader ].delegate = nil ;
770788 [[WebServer sharedInstance ] stopServers ];
771- rarch_start_draw_observer ();
789+ struct menu_state *menu_st = menu_state_get_ptr ();
790+ menu_st->flags &= ~MENU_ST_FLAG_BLOCK_ALL_INPUT;;
772791 }]];
773792#endif
774793 [self presentViewController: alert animated: YES completion: ^{
775- rarch_stop_draw_observer ();
794+ struct menu_state *menu_st = menu_state_get_ptr ();
795+ menu_st->flags |= MENU_ST_FLAG_BLOCK_ALL_INPUT;
776796 }];
777797 });
778798#endif
0 commit comments