- update default Templates

- make RsWheel available
This commit is contained in:
True Zhuanjia committed 2026-04-08 11:56:05 +08:00
1 parent 55a2bb7576
commit fcecae3a87
8 files changed
+95 -11

No files matched your search

+9 -6
View File
@@ -84,7 +84,7 @@ enum GamepadWidget: Hashable {
case a, b, x, y
case select, start, home
case dPad, up, down, left, right
case ls, lsPad, lswheel, rs, rsPad, rsvPad
case ls, lsPad, lswheel, rs, rsPad, rsvPad, rsWheel
case leftShoulder, rightShoulder
case leftTrigger, ltPad, rightTrigger, rtPad
case ds4Touchpad
@@ -110,6 +110,7 @@ enum GamepadWidget: Hashable {
case .rs: return "RS"
case .rsPad: return "RSPAD"
case .rsvPad: return "RSVPAD"
case .rsWheel: return "RSWHEEL"
case .leftShoulder: return "LB"
case .rightShoulder: return "RB"
case .leftTrigger: return "LT"
@@ -141,6 +142,7 @@ enum GamepadWidget: Hashable {
case .rs: return SwiftLocalizationHelper.localizedString(forKey: "RS/R3 button")
case .rsPad: return SwiftLocalizationHelper.localizedString(forKey: "Displacement-based right stick pad")
case .rsvPad: return SwiftLocalizationHelper.localizedString(forKey: "Velocity-based right stick pad")
case .rsWheel: return SwiftLocalizationHelper.localizedString(forKey: "Right stick wheel")
case .leftShoulder: return SwiftLocalizationHelper.localizedString(forKey: "LB/L1")
case .rightShoulder: return SwiftLocalizationHelper.localizedString(forKey: "RB/R1")
case .leftTrigger: return SwiftLocalizationHelper.localizedString(forKey: "LT/L2 button")
@@ -466,12 +468,12 @@ struct AbstractGamepadView: View {
thumbWidgets: [.lsPad, .lswheel]
)
case .rs, .rsPad, .rsvPad:
case .rs, .rsPad, .rsvPad, .rsWheel:
rightStickHighlight = nextStickHighlightMode(
current: rightStickHighlight,
selected: widget,
outerWidget: .rs,
thumbWidgets: [.rsPad, .rsvPad]
thumbWidgets: [.rsPad, .rsvPad, .rsWheel]
)
if widget == .rs,
isCommandSelected?(GamepadWidget.rsPad.cmd) == true || isCommandSelected?(GamepadWidget.rsvPad.cmd) == true {
@@ -1050,7 +1052,7 @@ struct AbstractGamepadView: View {
.frame(width: rightStickSize, height: rightStickSize)
.offset(x: rightStickCenterX, y: sharedLowerControlCenterY)
.onTapGesture {
handleTappedWidgets([.rs, .rsPad, .rsvPad], sourceIsDPad: false)
handleTappedWidgets([.rs, .rsPad, .rsvPad, .rsWheel], sourceIsDPad: false)
}
HomeButtonView(
@@ -1160,7 +1162,8 @@ struct AbstractGamepadView: View {
if isCommandSelected(GamepadWidget.rs.cmd) {
rightStickHighlight = .outerOnly
}
if isCommandSelected(GamepadWidget.rsPad.cmd) || isCommandSelected(GamepadWidget.rsvPad.cmd) {
if isCommandSelected(GamepadWidget.rsPad.cmd) || isCommandSelected(GamepadWidget.rsvPad.cmd) ||
isCommandSelected(GamepadWidget.rsWheel.cmd) {
rightStickHighlight = rightStickHighlight == .outerOnly ? .both : .thumbOnly
}
@@ -1223,7 +1226,7 @@ struct AbstractGamepadView: View {
} else if rightStickHighlight == .outerOnly {
rightStickHighlight = .none
}
case GamepadWidget.rsPad.cmd, GamepadWidget.rsvPad.cmd:
case GamepadWidget.rsPad.cmd, GamepadWidget.rsvPad.cmd, GamepadWidget.rsWheel.cmd:
if rightStickHighlight == .both {
rightStickHighlight = .outerOnly
} else if rightStickHighlight == .thumbOnly {
+13 -1
View File
@@ -1073,6 +1073,7 @@ struct WidgetPickerView: View {
"LSPAD",
"RSPAD",
"RSVPAD",
"RSWHEEL",
"LTPAD",
"RTPAD",
"DS4TOUCH"
@@ -1146,6 +1147,7 @@ struct WidgetPickerView: View {
guard isPad(item) else { return false }
if directionPadPriorityCommands.contains(item.cmd) { return false }
if item.cmd == "LSWHEEL" { return false }
if item.cmd == "RSWHEEL" { return false }
return true
}
@@ -1317,6 +1319,16 @@ struct WidgetPickerView: View {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "LsWheel cannot be combined with other widgets"), type: .error)
return false
}
if cmd == "RSWHEEL", !poolItems.isEmpty {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "RS wheel must be placed alone"), type: .error)
return false
}
if !poolItems.isEmpty, poolItems.contains(where: { $0.cmd == "RSWHEEL" }) {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "RsWheel cannot be combined with other widgets"), type: .error)
return false
}
if source == .functional, !gyroCommands.contains(cmd) {
guard let option = functionalButtonOption(for: cmd) else {
@@ -1925,7 +1937,7 @@ struct WidgetPickerView: View {
"DPAD",
"OSCUP", "OSCDOWN", "OSCLEFT", "OSCRIGHT",
"LS", "LSWHEEL", "LSPAD",
"RS", "RSPAD", "RSVPAD",
"RS", "RSPAD", "RSVPAD", "RSWHEEL",
"LB", "RB",
"LT", "LTPAD",
"RT", "RTPAD",