controller navigation fixes

This commit is contained in:
True Zhuanjia
2026-08-04 15:14:21 +08:00
parent 949a0e0bfb
commit 11dd542cb3
6 changed files with 56 additions and 41 deletions
@@ -108,13 +108,13 @@ final class GamepadNavigationIllustrationHud: UIView {
}
}
@objc static func updateHud() {
@objc static func updateHud(forceDisplay: Bool = false) {
let elements = ControllerNavigator.uiNavigationDelegate?.getNavigationElements() ?? []
/*
for element in elements {
print("element \(element.action)")
} */
updateNavigationElements(elements)
updateNavigationElements(elements, forceDisplay: forceDisplay)
}
static func updateActionState(for control: ControllerElement, isInAction: Bool) {
@@ -157,7 +157,7 @@ final class GamepadNavigationIllustrationHud: UIView {
backgroundColor = isDark
? UIColor(red: 28.0 / 255.0, green: 28.0 / 255.0, blue: 30.0 / 255.0, alpha: 0.62)
: UIColor.white.withAlphaComponent(0.6)
: (PublicUtils.isIPhone ? UIColor.white.withAlphaComponent(0.75) : UIColor.white.withAlphaComponent(0.6))
layer.borderColor = (isDark ? UIColor.white.withAlphaComponent(0.10) : UIColor.black.withAlphaComponent(0.06)).cgColor
layer.shadowColor = UIColor.black.cgColor
layer.shadowOpacity = isDark ? 0.34 : 0.12
@@ -419,7 +419,7 @@ final class GamepadNavigationIllustrationHud: UIView {
keyLabel.translatesAutoresizingMaskIntoConstraints = false
keyLabel.text = text
keyLabel.textAlignment = .center
keyLabel.font = UIFont.roundedSystemFont(ofSize: 12, weight: .medium)
keyLabel.font = UIFont.roundedSystemFont(ofSize: 12, weight: PublicUtils.isIPhone ? .semibold : .medium)
keyLabel.adjustsFontSizeToFitWidth = true
keyLabel.minimumScaleFactor = 0.2
keyLabel.numberOfLines = 1
+11 -5
View File
@@ -603,8 +603,9 @@ final class ControllerNavigator: NSObject {
ControllerUtil.stopListeningPrimaryController()
if let mainFrameVC = radialMenuDelegate as? MainFrameViewController {
let streamFrameVC = StreamFrameViewController.sharedInstance()
let showRadiaMenu = mainFrameVC.isStreaming() ? streamFrameVC?.hasNoPresentedVC == true : mainFrameVC.hasNoPresentedVC
if showRadiaMenu {
let showRadialMenu = mainFrameVC.isStreaming() ? streamFrameVC?.hasNoPresentedVC == true : (mainFrameVC.hasNoPresentedVC || mainFrameVC.presentedViewController is LoadingFrameViewController)
if showRadialMenu {
radialMenuView?.removeFromSuperview()
RadialMenuOverlayView.menuSectors.removeAll()
@@ -685,9 +686,10 @@ final class ControllerNavigator: NSObject {
}
}
private static var radialMenuButtonPressed: Bool = false
@objc static var radialMenuButtonPressed: Bool = false
private static var radialMenuDelayTimer: SafeTimer?
private static var radialMenuState: RadialMenuState = .main
private static var radialMenuPressDownTimestamp: TimeInterval = 0.0
@objc static func listenToRadialMenuButton() {
guard enabled else {return}
guard let mainFrameVC = radialMenuDelegate as? MainFrameViewController else {return}
@@ -696,9 +698,10 @@ final class ControllerNavigator: NSObject {
ControllerUtil.listenPrimaryControllerButton(radialMenuButton) { pressed in
GamepadNavigationIllustrationHud.updateActionState(for: radialMenuButton, isInAction: pressed)
if pressed {
radialMenuPressDownTimestamp = CACurrentMediaTime()
radialMenuDelayTimer?.clean()
radialMenuButtonPressed = true
let delayRadialMenu = (mainFrameVC.isStreaming() && !mainFrameVC.settingsExpandedInStreamView) ||
streamingRadialMenuDelay < 0.03
let delayRadialMenu = (mainFrameVC.isStreaming() && !mainFrameVC.settingsExpandedInStreamView) || streamingRadialMenuDelay < 0.03
streamingRadialMenuDelay = max(streamingRadialMenuDelay, 0.032)
if delayRadialMenu {
@@ -718,6 +721,9 @@ final class ControllerNavigator: NSObject {
}
}
else {
guard CACurrentMediaTime() - radialMenuPressDownTimestamp > 0.035 else {
return
}
radialMenuButtonPressed = false
radialMenuDelayTimer?.clean()
stickReleasedInRadialMenu = false
+34 -28
View File
@@ -14636,29 +14636,6 @@
}
}
},
"Press the same or a different button for controller navigation during streaming." : {
"extractionState" : "manual",
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "请按下相同或不同的按键,作为串流时的手柄导航键。"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "請按下相同或不同的按鍵,作為串流時的手把導覽鍵。"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "請按下相同或不同的按鍵,作為串流時的手掣導覽鍵。"
}
}
}
},
"Pressed for %dms" : {
"extractionState" : "manual",
"localizations" : {
@@ -15293,25 +15270,25 @@
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Please choose and press one of [Select, Start, bumpers, triggers, the Home button, or Xbox back paddles] as the radial menu button.\n\nNote: if you want to designate the Home button, double tap to pass it through to VoidLink app on iOS 26+."
"value" : "Please choose and press one of [Select, Start, bumpers, triggers, Xbox back paddles] as the radial menu button."
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "请在 [Select, Start, 肩键, 板机, Home键, Xbox背键] 之中,选择并按下作为手柄导航键。\n\n注意:如果需要指定 Home 键,在 iOS 26+ 系统上需要双击将该按键透传至 VoidLink。"
"value" : "请在 [Select, Start, 肩键, 板机, Xbox背键] 之中,选择并按下作为手柄导航键。"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "needs_review",
"value" : "請在 [Select、Start、LB/RB、LT/RT、Home 鍵、Xbox 背鍵] 之中,選擇並按下作為手把導覽鍵。\n\n注意:如果需要指定 Home 鍵,在 iOS 26+ 系統上需要雙擊將該按鍵透傳至 VoidLink。"
"state" : "translated",
"value" : "請在 [Select、Start、LB/RB、LT/RT、Xbox 背鍵] 之中,選擇並按下作為手把導覽鍵。"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "請在 [Select、Start、LB/RB、LT/RT、Home 鍵、Xbox 背鍵] 之中,選擇並按下作為手把導覽鍵。\n\n注意:如果需要指定 Home 鍵,在 iOS 26+ 系統上需要雙擊將該按鍵透傳至 VoidLink。"
"value" : "請在 [Select、Start、LB/RB、LT/RT、Xbox 背鍵] 之中,選擇並按下作為手把導覽鍵。"
}
}
}
@@ -17631,6 +17608,35 @@
}
}
},
"streamingRadialMenuButtonTip" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Press the same or a different button for controller navigation during streaming. [Home] button is also available.\n\nNote: if you want to designate the Home button, double tap to pass it through to VoidLink app on iOS 26+."
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "请按下相同或不同的按键,作为串流时的手柄导航键。\n您也可以指定 [Home] 鍵。\n\n注意:iOS 26+ 系统中,需要双击Home键才能将该按键透传至 VoidLink。"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "請按下相同或不同的按鍵,作為串流時的手把導覽鍵。 \n您也可以指定 [Home] 鍵。\n\n注意:在 iOS 26 以上系統中,需要雙擊 Home 鍵才能將該按鍵透傳至 VoidLink。"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "請按下相同或不同的按鍵,作為串流時的手把導覽鍵。 \n您也可以指定 [Home] 鍵。\n\n注意:在 iOS 26 以上系統中,需要雙擊 Home 鍵才能將該按鍵透傳至 VoidLink。"
}
}
}
},
"Stroke start equalization depth: " : {
"extractionState" : "manual",
"localizations" : {
@@ -1933,7 +1933,7 @@ BOOL isCustomResolution(int resolutionSelected) {
dispatch_async(dispatch_get_main_queue(), ^{
if (@available(iOS 13.0, *)) {
if(ControllerNavigator.radialMenuView.superview) [ControllerNavigator updateRadialMenu];
[GamepadNavigationIllustrationHud updateHud];
[GamepadNavigationIllustrationHud updateHudWithForceDisplay:false];
if(ControllerUtil.primaryGCController){
[ControllerNavigator restoreSettingsModeSwitchHighlight];
};
@@ -1957,7 +1957,7 @@ BOOL isCustomResolution(int resolutionSelected) {
dispatch_async(dispatch_get_main_queue(), ^{
if (@available(iOS 13.0, *)){
if(ControllerNavigator.radialMenuView.superview) [ControllerNavigator updateRadialMenu];
[GamepadNavigationIllustrationHud updateHud];
[GamepadNavigationIllustrationHud updateHudWithForceDisplay:false];
if(ControllerUtil.primaryGCController){
[ControllerNavigator restoreSettingsModeSwitchHighlight];
};
@@ -2968,7 +2968,7 @@ BOOL isCustomResolution(int resolutionSelected) {
if (@available(iOS 13.0, *)) [ControllerNavigator updateHudForCustomRadialMenuButtonPosition];
return;
}
AlertControllerUtil.alertController.message = [LocalizationHelper localizedStringForKey:@"Press the same or a different button for controller navigation during streaming."];
AlertControllerUtil.alertController.message = [LocalizationHelper localizedStringForKey:@"streamingRadialMenuButtonTip"];
return;
}
@@ -3001,7 +3001,7 @@ BOOL isCustomResolution(int resolutionSelected) {
if(!metRadialButtonWithUndefinedPosition){
if (@available(iOS 13.0, *)) [GamepadNavigationIllustrationHud clearHud];
AlertControllerUtil.alertController.message = [LocalizationHelper localizedStringForKey:@"Press the same or a different button for controller navigation during streaming."];
AlertControllerUtil.alertController.message = [LocalizationHelper localizedStringForKey:@"streamingRadialMenuButtonTip"];
return;
}
}
@@ -1376,6 +1376,8 @@ static __weak StreamFrameViewController *VLSharedStreamFrameViewController = nil
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[ControllerNavigator restoreUINavigationHighlight];
// ControllerNavigator.radialMenuButtonPressed = false;
if(ControllerNavigator.streamingRadialMenuButton == ControllerElementSpecial) [GamepadNavigationIllustrationHud updateHudWithForceDisplay:true];
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[ControllerNavigator restoreUINavigationHighlight];
+1
View File
@@ -5,6 +5,7 @@
#include <Limelight.h>
#import "SettingsViewController.h"
#import "MainFrameViewController.h"
#import "LoadingFrameViewController.h"
#import "StreamFrameViewController.h"
#import "ControllerSupport.h"
#import "OnScreenControls.h"