gamepad live feedback overlay

This commit is contained in:
True Zhuanjia
2026-04-06 01:19:44 +08:00
parent 7f4108c4e3
commit 5af39e8fb6
19 changed files with 1583 additions and 382 deletions
@@ -507,7 +507,7 @@
NSLog(@"pausing...");
nil;
});
// check to see if external screen is connected/disconnected
[[NSNotificationCenter defaultCenter] addObserver: self
@@ -1766,6 +1766,35 @@
dispatch_after(delayTime, dispatch_get_main_queue(), block);
}
- (void)toggleGamepadOverlayWithOverlayEnabled:(BOOL)overlayEnabled API_AVAILABLE(ios(13.0)){
if(overlayEnabled) [self loadAbstractGamepadOverlayIfNeeded];
else {
[_virtualGamepadOverlay removeFromSuperview];
_virtualGamepadOverlay = nil;
}
}
- (void)loadAbstractGamepadOverlayIfNeeded API_AVAILABLE(ios(13.0)){
if (_virtualGamepadOverlay != nil || self.view.window == nil) {
return;
}
BOOL usesXboxFaceButtons = _settings.emulatedControllerType.intValue == LI_CTYPE_XBOX;
CGFloat maxWidth = MIN(CGRectGetWidth(self.view.bounds) * 0.72, 620);
CGFloat width = MAX(420, maxWidth);
CGFloat height = width / 1.82;
CGRect overlayFrame = CGRectMake(0, 0, width, height);
AbstractGamepadOverlayView *overlayView = [[AbstractGamepadOverlayView alloc] initWithFrame:overlayFrame usesPlayStationFaceButtons:!usesXboxFaceButtons];
overlayView.center = CGPointMake(CGRectGetMidX(self.view.bounds), CGRectGetMidY(self.view.bounds));
overlayView.userInteractionEnabled = YES;
[self.view addSubview:overlayView];
_virtualGamepadOverlay = overlayView;
}
- (void)dealloc {
NSLog(@"dealloc StreamFrameViewController %f", CACurrentMediaTime());
}