button-combo available for folder

This commit is contained in:
True Zhuanjia committed 2026-04-27 23:15:08 +08:00
1 parent ce67aefc3b
commit b0224d502a
6 files changed
+36 -19

No files matched your search

+14 -5
View File
@@ -162,11 +162,15 @@ import UIKit
// @objc public static let specialGameWidgets: [String] = ["YSRSV", "YSLT", "YSRT", "YSRB", "YSB", "YSRT2", "YSRB2", "YSB2", "YSEM", "YSML", "YSMR", "YSWASD"] // @objc public static let specialGameWidgets: [String] = ["YSRSV", "YSLT", "YSRT", "YSRB", "YSB", "YSRT2", "YSRB2", "YSB2", "YSEM", "YSML", "YSMR", "YSWASD"]
@objc public static let shortcutAllowedFunctionalButtonMappings: [String: Int16] = [
"BRUSH": 0xFF,
"ERASER": 0xFF,
"FOLDER": 0xFF,
]
@objc public static let keyboardButtonMappings: [String: Int16] = [ @objc public static let keyboardButtonMappings: [String: Int16] = [
// Windows Key Codes // Windows Key Codes
"NULL": 0xFF, "NULL": 0xFF,
"BRUSH": 0xFF,
"ERASER": 0xFF,
"CTRL": 0x11, // VK_CONTROL "CTRL": 0x11, // VK_CONTROL
"RCTRL": 0xA3, // VK_RCONTROL "RCTRL": 0xA3, // VK_RCONTROL
"SHIFT": 0x10, // VK_SHIFT "SHIFT": 0x10, // VK_SHIFT
@@ -478,7 +482,8 @@ import UIKit
@objc public func extractAutoReleaseButtonStrings(from cmd: String) -> [String]? { @objc public func extractAutoReleaseButtonStrings(from cmd: String) -> [String]? {
let cmd = cmd.uppercased() let cmd = cmd.uppercased()
let mergedKeys = (Set(CommandManager.keyboardButtonMappings.keys) let mergedKeys = (Set(CommandManager.keyboardButtonMappings.keys)
.union(Set(CommandManager.mouseButtonMappings.keys))) .union(Set(CommandManager.mouseButtonMappings.keys))
.union(Set(CommandManager.shortcutAllowedFunctionalButtonMappings.keys)))
let keys = mergedKeys.joined(separator: "|") let keys = mergedKeys.joined(separator: "|")
let pattern = "^(?:(\(keys))(?:\\+(\(keys))*)*)$" let pattern = "^(?:(\(keys))(?:\\+(\(keys))*)*)$"
@@ -505,7 +510,9 @@ import UIKit
for key in keyStrings { for key in keyStrings {
if (CommandManager.keyboardButtonMappings.keys.contains(key) if (CommandManager.keyboardButtonMappings.keys.contains(key)
|| CommandManager.mouseButtonMappings.keys.contains(key)) { || CommandManager.mouseButtonMappings.keys.contains(key)
|| CommandManager.shortcutAllowedFunctionalButtonMappings.keys.contains(key)
) {
validKeyStrings.append(key) validKeyStrings.append(key)
} else { } else {
print(" '\(key)' is not defined in key mappings") print(" '\(key)' is not defined in key mappings")
@@ -631,7 +638,9 @@ import UIKit
@objc public func sendAutoReleaseComboCommand(cmdStrings: [String]?, delay: TimeInterval = 0.2, index: Int = 0, pressOnly: Bool = false, releaseOnly:Bool = false) { // we need a large delay for WAN streaming @objc public func sendAutoReleaseComboCommand(cmdStrings: [String]?, delay: TimeInterval = 0.2, index: Int = 0, pressOnly: Bool = false, releaseOnly:Bool = false) { // we need a large delay for WAN streaming
// 如果已处理完所有按键,则开始释放按键 // 如果已处理完所有按键,则开始释放按键
guard let cmdStrings = cmdStrings else { return } guard var cmdStrings = cmdStrings else { return }
cmdStrings = cmdStrings.filter { !CommandManager.shortcutAllowedFunctionalButtonMappings.keys.contains($0)}
if releaseOnly { if releaseOnly {
for keyStr in cmdStrings.reversed() { for keyStr in cmdStrings.reversed() {
+7 -1
View File
@@ -181,6 +181,7 @@ import ObjectiveC.runtime
@objc public var isStickWheel: Bool = false @objc public var isStickWheel: Bool = false
@objc public var isFolder: Bool = false @objc public var isFolder: Bool = false
@objc public var containsShortcutAction: Bool = false
@objc public var hasNonEditableLabel: Bool = false @objc public var hasNonEditableLabel: Bool = false
// for all stick pads // for all stick pads
@@ -438,6 +439,9 @@ import ObjectiveC.runtime
if self.cmdString.contains("ERASER"){ if self.cmdString.contains("ERASER"){
self.functionalButtonString = "ERASER" self.functionalButtonString = "ERASER"
} }
if self.cmdString.contains("FOLDER") {
self.functionalButtonString = "FOLDER"
}
if self.isFunctionalButton { if self.isFunctionalButton {
self.buttonMode = .movable self.buttonMode = .movable
if self.functionalButtonString == "PENCILHOVER" {self.buttonMode = .regular} if self.functionalButtonString == "PENCILHOVER" {self.buttonMode = .regular}
@@ -517,7 +521,8 @@ import ObjectiveC.runtime
self.hasWalkSprintKeys = self.isDirectionPad && (self.touchPadString == "WASDPAD" self.hasWalkSprintKeys = self.isDirectionPad && (self.touchPadString == "WASDPAD"
|| self.touchPadString == "ARROWPAD") || self.touchPadString == "ARROWPAD")
self.isStickWheel = self.widgetType == WidgetTypeEnum.touchPad && CommandManager.stickWheels.contains(self.touchPadString) self.isStickWheel = self.widgetType == WidgetTypeEnum.touchPad && CommandManager.stickWheels.contains(self.touchPadString)
self.isFolder = self.cmdString == "FOLDER" self.isFolder = self.cmdString.contains("FOLDER")
self.containsShortcutAction = self.cmdString.contains("+")
self.hasComponent = self.isStickWheel self.hasComponent = self.isStickWheel
self.hasL3R3Indicator = !self.isStickWheel && !self.isDirectionPad && self.widgetType == WidgetTypeEnum.touchPad self.hasL3R3Indicator = !self.isStickWheel && !self.isDirectionPad && self.widgetType == WidgetTypeEnum.touchPad
@@ -2643,6 +2648,7 @@ import ObjectiveC.runtime
break break
} }
} }
switch self.functionalButtonString { switch self.functionalButtonString {
case "FOLDER": case "FOLDER":
self.folded = !self.folded self.folded = !self.folded
+4 -4
View File
@@ -2608,25 +2608,25 @@
} }
} }
}, },
"Collect, fold & unfold other widgets or subfolders" : { "Collect other widgets or subfolders. Button-combo available." : {
"extractionState" : "manual", "extractionState" : "manual",
"localizations" : { "localizations" : {
"zh-Hans" : { "zh-Hans" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "收纳、折叠和展开其他控件或子控件夹" "value" : "收纳其他控件或子控件夹。允许组合其他按键。"
} }
}, },
"zh-Hant" : { "zh-Hant" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "收納、摺疊和展開其他控制項或子控制項夾" "value" : "收納、摺疊其他控制項或子控制項夾。允許組合其他按鍵。"
} }
}, },
"zh-HK" : { "zh-HK" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "收納、摺疊和展開其他控制項或子控制項夾" "value" : "收納、摺疊其他控制項或子控制項夾。允許組合其他按鍵。"
} }
} }
} }
@@ -948,8 +948,10 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg
buttonModeStack.isHidden = widgetView.widgetType != .button buttonModeStack.isHidden = widgetView.widgetType != .button
buttonModeSelector.setEnabled(!widgetView.isFunctionalButton, forSegmentAt: Int(ButtonMode.slideToToggle.rawValue)) buttonModeSelector.setEnabled(!widgetView.isFunctionalButton, forSegmentAt: Int(ButtonMode.slideToToggle.rawValue))
buttonModeSelector.setEnabled(!widgetView.isFunctionalButton || widgetView.isFolder, forSegmentAt: Int(ButtonMode.slideAndHold.rawValue)) buttonModeSelector.setEnabled((!widgetView.isFunctionalButton || widgetView.isFolder)
buttonModeSelector.setEnabled(!widgetView.isFolder, forSegmentAt: Int(ButtonMode.regular.rawValue)) && !widgetView.containsShortcutAction
, forSegmentAt: Int(ButtonMode.slideAndHold.rawValue))
// buttonModeSelector.setEnabled(!widgetView.isFolder, forSegmentAt: Int(ButtonMode.regular.rawValue))
buttonModeSelector.setEnabled(!widgetView.isFunctionalButton || widgetView.isTapToToggleException, forSegmentAt: Int(ButtonMode.tapToToggle.rawValue)) buttonModeSelector.setEnabled(!widgetView.isFunctionalButton || widgetView.isTapToToggleException, forSegmentAt: Int(ButtonMode.tapToToggle.rawValue))
buttonModeSelector.selectedSegmentIndex = Int(widgetView.buttonMode.rawValue) buttonModeSelector.selectedSegmentIndex = Int(widgetView.buttonMode.rawValue)
@@ -1717,7 +1717,7 @@ static NSMutableSet* hostList;
settings.sdrPerformanceWorkaround = true; settings.sdrPerformanceWorkaround = true;
settings.framePacingMode = @(FramePacingModeQueue); settings.framePacingMode = @(FramePacingModeQueue);
settings.asyncFrameDequeue = false; settings.asyncFrameDequeue = false;
settings.touchMoveEventInterval = @(45); settings.touchMoveEventInterval = @(0);
break; break;
case UIUserInterfaceIdiomPad: case UIUserInterfaceIdiomPad:
default: default:
+6 -6
View File
@@ -521,11 +521,11 @@ struct WidgetPickerView: View {
FunctionalButtonOption( FunctionalButtonOption(
label: SwiftLocalizationHelper.localizedString(forKey: "Folder"), label: SwiftLocalizationHelper.localizedString(forKey: "Folder"),
cmd: "FOLDER", cmd: "FOLDER",
tip: SwiftLocalizationHelper.localizedString(forKey: "Collect, fold & unfold other widgets or subfolders"), tip: SwiftLocalizationHelper.localizedString(forKey: "Collect other widgets or subfolders. Button-combo available."),
allowsKeyboardCombination: false, allowsKeyboardCombination: true,
allowsGamepadCombination: false, allowsGamepadCombination: true,
allowsSkillCombo: false, allowsSkillCombo: true,
allowsShortcutCombo: false, allowsShortcutCombo: true,
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
@@ -2049,7 +2049,7 @@ struct WidgetPickerView: View {
} }
private func submitWidgetPayload() { private func submitWidgetPayload() {
var payload = makeWidgetPayload() let payload = makeWidgetPayload()
persistCurrentTabSelection() persistCurrentTabSelection()
lastCreatedWidgetPayload = payload lastCreatedWidgetPayload = payload
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "Widget config generated")) setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "Widget config generated"))