Xbox 360 Wired Controller - up/down reversed #885
-
I am using an Xbox 360 wired controller and it works fine on other applications however in vAmiga the up/down (left stick and right stick) are reversed. The d pad is also not working. Is there anyway to fix this? These are the values: 030000005e0400008e02000014010000, |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 3 replies
-
Beta Was this translation helpful? Give feedback.
-
I just checked the code. Unfortunately, the dpad is not customizable yet. Here is the descriptor parsing code (it's in Swift as all HID stuff is managed by the GUI). func query(descriptor: String) -> HIDMapping {
var result: HIDMapping = [
.AXIS: [:],
.BUTTON: [:],
.DPAD_UP: [0:[:]],
.DPAD_DOWN: [0:[:]],
.DPAD_RIGHT: [0:[:]],
.DPAD_LEFT: [0:[:]],
.HATSWITCH: [0:[:]]
]
// Add default values for the directional pad
result[.DPAD_UP]![0] = [0:[.RELEASE_Y], 1:[.PULL_UP]]
result[.DPAD_DOWN]![0] = [0:[.RELEASE_Y], 1:[.PULL_DOWN]]
result[.DPAD_RIGHT]![0] = [0:[.RELEASE_X,], 1:[.PULL_RIGHT]]
result[.DPAD_LEFT]![0] = [0:[.RELEASE_X,], 1:[.PULL_LEFT]]
// Add default values for the hat switch
result[.HATSWITCH]![0]![0] = [.RELEASE_XY]
result[.HATSWITCH]![0]![1] = [.PULL_UP]
result[.HATSWITCH]![0]![3] = [.PULL_UP,.PULL_RIGHT]
result[.HATSWITCH]![0]![2] = [.PULL_RIGHT]
result[.HATSWITCH]![0]![6] = [.PULL_DOWN,.PULL_RIGHT]
result[.HATSWITCH]![0]![4] = [.PULL_DOWN]
result[.HATSWITCH]![0]![12] = [.PULL_DOWN,.PULL_LEFT]
result[.HATSWITCH]![0]![8] = [.PULL_LEFT]
result[.HATSWITCH]![0]![9] = [.PULL_UP,.PULL_LEFT]
// Iterate through all key value pairs
for assignment in descriptor.split(separator: ",") {
let pair = assignment.split(separator: ":").map { String($0) }
if pair.count != 2 { continue }
switch (pair[1]) {
case "a0": result[.AXIS]![0] = mapAxis(key: pair[0])
case "a1": result[.AXIS]![1] = mapAxis(key: pair[0])
case "a2": result[.AXIS]![2] = mapAxis(key: pair[0])
case "a3": result[.AXIS]![3] = mapAxis(key: pair[0])
case "a4": result[.AXIS]![4] = mapAxis(key: pair[0])
case "a5": result[.AXIS]![5] = mapAxis(key: pair[0])
case "a0~": result[.AXIS]![0] = mapAxisRev(key: pair[0])
case "a1~": result[.AXIS]![1] = mapAxisRev(key: pair[0])
case "a2~": result[.AXIS]![2] = mapAxisRev(key: pair[0])
case "a3~": result[.AXIS]![3] = mapAxisRev(key: pair[0])
case "a4~": result[.AXIS]![4] = mapAxisRev(key: pair[0])
case "a5~": result[.AXIS]![5] = mapAxisRev(key: pair[0])
case "b0": result[.BUTTON]![1] = mapButton(key: pair[0])
case "b1": result[.BUTTON]![2] = mapButton(key: pair[0])
case "b2": result[.BUTTON]![3] = mapButton(key: pair[0])
case "b3": result[.BUTTON]![4] = mapButton(key: pair[0])
case "b4": result[.BUTTON]![5] = mapButton(key: pair[0])
case "b5": result[.BUTTON]![6] = mapButton(key: pair[0])
case "b6": result[.BUTTON]![7] = mapButton(key: pair[0])
case "b7": result[.BUTTON]![8] = mapButton(key: pair[0])
case "b8": result[.BUTTON]![9] = mapButton(key: pair[0])
case "b9": result[.BUTTON]![10] = mapButton(key: pair[0])
case "b10": result[.BUTTON]![11] = mapButton(key: pair[0])
case "b11": result[.BUTTON]![12] = mapButton(key: pair[0])
case "b12": result[.BUTTON]![13] = mapButton(key: pair[0])
case "b13": result[.BUTTON]![14] = mapButton(key: pair[0])
case "b14": result[.BUTTON]![15] = mapButton(key: pair[0])
case "b15": result[.BUTTON]![16] = mapButton(key: pair[0])
case "b16": result[.BUTTON]![17] = mapButton(key: pair[0])
default:
break
}
}
return result
}
private func mapAxis(key: String) -> [Int: [GamePadAction]] {
switch (key) {
case "leftx", "rightx":
return [-1: [.PULL_LEFT], 0: [.RELEASE_X], 1: [.PULL_RIGHT]]
case "lefty", "righty":
return [-1: [.PULL_UP], 0: [.RELEASE_Y], 1: [.PULL_DOWN]]
default:
return [:]
}
}
private func mapAxisRev(key: String) -> [Int: [GamePadAction]] {
switch (key) {
case "leftx", "rightx":
return [-1: [.PULL_RIGHT], 0: [.RELEASE_X], 1: [.PULL_LEFT]]
case "lefty", "righty":
return [-1: [.PULL_DOWN], 0: [.RELEASE_Y], 1: [.PULL_UP]]
default:
return [:]
}
}
private func mapButton(key: String) -> [Int: [GamePadAction]] {
switch (key) {
case "a", "b", "leftshoulder", "rightshoulder":
return [0: [.RELEASE_FIRE], 1: [.PRESS_FIRE]]
case "dpdown":
return [0: [.RELEASE_Y], 1: [.PULL_DOWN]]
case "dpup":
return [0: [.RELEASE_Y], 1: [.PULL_UP]]
case "dpleft":
return [0: [.RELEASE_X], 1: [.PULL_LEFT]]
case "dpright":
return [0: [.RELEASE_X], 1: [.PULL_RIGHT]]
default:
return [:]
}
} |
Beta Was this translation helpful? Give feedback.
-
One more thing... as can be seen in your post, vAmiga selects the "Linux" setting for your device. In the database, there are a couple of Mac OS X settings that differ. I.e.:
Can you try to replace the device description manually by one of these and check if it works? As you can see, the dp mappings differ. |
Beta Was this translation helpful? Give feedback.
-
The first setting fixed it!! I replaced it with: Thank you very much for all your assistance in fixing my issues so quickly. |
Beta Was this translation helpful? Give feedback.
-
Can you do me a favor and post a screenshot of the "Devices" preferences panel with your controller attached (like the one I posted above)? I'd like to see the exact parameters of your device (Vendor ID, version, etc.). It thinking about reworking my filter algorithm (based on your example, it might be better to prioritize the platform key over the version key if no perfect match in the database is found). |
Beta Was this translation helpful? Give feedback.
The device description is editable. E.g., when adding a tilde at the marked position, the up / down direction on my Competition Pro is reversed:
Thus, the first step is, by editing the device description, which of the keys corresponds to the up/down direction on your Xbox controller. Maybe vAmiga maps it wrong, but we need to find the relevant key first.