Overview
Comment: | OFXInputGameController: Support for Home button |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | gamecontroller |
Files: | files | file ages | folders |
SHA3-256: |
f609457ac5fb45368ce06c2f7d7afd3f |
User & Date: | js on 2024-05-20 03:13:37 |
Other Links: | branch diff | manifest | tags |
Context
2024-05-20
| ||
03:37 | OFStdIOStream: Add two methods for game consoles check-in: d693276d79 user: js tags: gamecontroller | |
03:13 | OFXInputGameController: Support for Home button check-in: f609457ac5 user: js tags: gamecontroller | |
02:43 | OFGameController: Support Wii Classic Controller check-in: 7f0017a058 user: js tags: gamecontroller | |
Changes
Modified src/hid/OFXInputGameController.m from [18e5d09447] to [965b558ea8].
︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | + + + + - + - + - + - - + + - + | #import "OFNumber.h" #import "OFSet.h" #import "OFInitializationFailedException.h" #import "OFReadFailedException.h" #include <xinput.h> #ifndef XINPUT_GAMEPAD_GUIDE # define XINPUT_GAMEPAD_GUIDE 0x400 #endif struct XInputCapabilitiesEx { XINPUT_CAPABILITIES capabilities; WORD vendorID; WORD productID; WORD versionNumber; WORD unknown1; DWORD unknown2; }; static WINAPI DWORD (*XInputGetStateFuncPtr)(DWORD, XINPUT_STATE *); static WINAPI DWORD (*XInputGetCapabilitiesExFuncPtr)(DWORD, DWORD, DWORD, struct XInputCapabilitiesEx *); |
︙ | |||
129 130 131 132 133 134 135 | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | - + | capabilities.vendorID]; _productID = [[OFNumber alloc] initWithUnsignedShort: capabilities.productID]; } } |
︙ | |||
189 190 191 192 193 194 195 196 197 198 199 200 201 202 | 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | + + + | [_pressedButtons addObject: OFGameControllerDPadLeftButton]; if (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT) [_pressedButtons addObject: OFGameControllerDPadRightButton]; if (state.Gamepad.wButtons & XINPUT_GAMEPAD_START) [_pressedButtons addObject: OFGameControllerStartButton]; if (state.Gamepad.wButtons & XINPUT_GAMEPAD_BACK) [_pressedButtons addObject: OFGameControllerSelectButton]; if (XInputVersion != 910 && state.Gamepad.wButtons & XINPUT_GAMEPAD_GUIDE) [_pressedButtons addObject: OFGameControllerHomeButton]; _leftTriggerPressure = (float)state.Gamepad.bLeftTrigger / 255; _rightTriggerPressure = (float)state.Gamepad.bRightTrigger / 255; if (_leftTriggerPressure > 0) [_pressedButtons addObject: OFGameControllerLeftTriggerButton]; if (_rightTriggerPressure > 0) |
︙ | |||
212 213 214 215 216 217 218 | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | + + + + + + + + - + + - + + | (state.Gamepad.sThumbRX < 0 ? -INT16_MIN : INT16_MAX), -(float)state.Gamepad.sThumbRY / (state.Gamepad.sThumbRY < 0 ? -INT16_MIN : INT16_MAX)); } - (OFString *)name { switch (XInputVersion) { case 14: return @"XInput 1.4 device"; case 13: return @"XInput 1.3 device"; case 910: return @"XInput 9.1.0 device"; } |
︙ |
Modified tests/gamecontroller/GameControllerTests.m from [7ca50085d6] to [a9aab44f99].
︙ | |||
58 59 60 61 62 63 64 | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | - + | # define red maroon # define yellow olive # define gray silver #endif @interface GameControllerTests: OFObject <OFApplicationDelegate> { |
︙ |