Differences From Artifact [fbbf92a317]:
- File
src/hid/OHEvdevGamepad.m
— part of check-in
[48e6a99f7b]
at
2024-06-08 22:16:16
on branch trunk
— OHEvdevGamepad: Filter buttons/axes
This is instead of replacing them altogether, which means the button
names are kept and extra buttons are not removed. (user: js, size: 6577) [annotate] [blame] [check-ins using]
To Artifact [f7c0aaf892]:
- File
src/hid/OHEvdevGamepad.m
— part of check-in
[6b3b47c1f4]
at
2024-06-08 22:47:11
on branch trunk
— OHEvdevGameController: Default to Xbox buttons
The vast majority of controllers out there are Xbox 360-compatible
controllers, so let's use those button names by default. (user: js, size: 6564) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
70 71 72 73 74 75 76 | [buttons removeObjectForKey: @"D-Pad Up"]; [buttons removeObjectForKey: @"D-Pad Down"]; [buttons removeObjectForKey: @"D-Pad Left"]; [buttons removeObjectForKey: @"D-Pad Right"]; if ([_rawProfile.axes objectForKey: @"Z"] != nil) | | | | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | [buttons removeObjectForKey: @"D-Pad Up"]; [buttons removeObjectForKey: @"D-Pad Down"]; [buttons removeObjectForKey: @"D-Pad Left"]; [buttons removeObjectForKey: @"D-Pad Right"]; if ([_rawProfile.axes objectForKey: @"Z"] != nil) [buttons setObject: self.leftTriggerButton forKey: @"LT"]; if ([_rawProfile.axes objectForKey: @"RZ"] != nil) [buttons setObject: self.rightTriggerButton forKey: @"RT"]; [buttons makeImmutable]; return buttons; } - (OFDictionary OF_GENERIC(OFString *, OHGameControllerAxis *) *)axes |
︙ | ︙ | |||
130 131 132 133 134 135 136 | - (OHGameControllerButton *)eastButton { return [_rawProfile.buttons objectForKey: @"B"]; } - (OHGameControllerButton *)leftShoulderButton { | | | | | | | | | | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | - (OHGameControllerButton *)eastButton { return [_rawProfile.buttons objectForKey: @"B"]; } - (OHGameControllerButton *)leftShoulderButton { return [_rawProfile.buttons objectForKey: @"LB"]; } - (OHGameControllerButton *)rightShoulderButton { return [_rawProfile.buttons objectForKey: @"RB"]; } - (OHGameControllerButton *)leftTriggerButton { OHGameControllerAxis *axis = [_rawProfile.axes objectForKey: @"Z"]; if (axis != nil) return [[[OHGameControllerEmulatedTriggerButton alloc] initWithAxis: axis] autorelease]; return [_rawProfile.buttons objectForKey: @"LT"]; } - (OHGameControllerButton *)rightTriggerButton { OHGameControllerAxis *axis = [_rawProfile.axes objectForKey: @"RZ"]; if (axis != nil) return [[[OHGameControllerEmulatedTriggerButton alloc] initWithAxis: axis] autorelease]; return [_rawProfile.buttons objectForKey: @"RT"]; } - (OHGameControllerButton *)leftThumbstickButton { return [_rawProfile.buttons objectForKey: @"LSB"]; } - (OHGameControllerButton *)rightThumbstickButton { return [_rawProfile.buttons objectForKey: @"RSB"]; } - (OHGameControllerButton *)menuButton { return [_rawProfile.buttons objectForKey: @"Start"]; } - (OHGameControllerButton *)optionsButton { return [_rawProfile.buttons objectForKey: @"Back"]; } - (OHGameControllerButton *)homeButton { return [_rawProfile.buttons objectForKey: @"Guide"]; } - (OHGameControllerDirectionalPad *)leftThumbstick { OHGameControllerAxis *xAxis = [_rawProfile.axes objectForKey: @"X"]; OHGameControllerAxis *yAxis = [_rawProfile.axes objectForKey: @"Y"]; |
︙ | ︙ |