Comment: | OFGameController: Use different subclasses |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | gamecontroller |
Files: | files | file ages | folders |
SHA3-256: |
4ecdef74917586572418ec429865367a |
User & Date: | js on 2024-05-15 22:50:43 |
Other Links: | branch diff | manifest | tags |
2024-05-18
| ||
11:37 | OFGameController: More code reuse check-in: 764fe0bac3 user: js tags: gamecontroller | |
2024-05-15
| ||
22:50 | OFGameController: Use different subclasses check-in: 4ecdef7491 user: js tags: gamecontroller | |
21:34 | OFGameController: Add mapping for DualShock 4 check-in: 13c7749eed user: js tags: gamecontroller | |
Added src/hid/OFEvdevGameController.h version [8ab70e7289].
|
Renamed and modified src/hid/platform/Linux/OFGameController.m [9e75f36cc8] to src/hid/OFEvdevGameController.m [7d8e2879a0].
︙ | |||
19 20 21 22 23 24 25 | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | - + | #include "config.h" #include <errno.h> #include <fcntl.h> #include <unistd.h> |
︙ | |||
68 69 70 71 72 73 74 | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | - - - - | /* Sony controllers */ static const uint16_t productIDDualSense = 0x0CE6; static const uint16_t productIDDualShock4 = 0x09CC; /* Google controllers */ static const uint16_t productIDStadia = 0x9400; |
︙ | |||
199 200 201 202 203 204 205 | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | - + | value = min; if (value > max) value = max; return ((value - min) / (max - min) * 2) - 1; } |
︙ | |||
222 223 224 225 226 227 228 | 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | - + | if (![device hasPrefix: @"event"]) continue; path = [@"/dev/input" stringByAppendingPathComponent: device]; @try { |
︙ | |||
567 568 569 570 571 572 573 | 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | - + - + | OFGameControllerRightTriggerButton]; } break; } } } |
︙ |
Modified src/hid/OFGameController.h from [e199114848] to [76e31b3ce8].
︙ | |||
255 256 257 258 259 260 261 | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | #ifdef __cplusplus } #endif /** * @brief A class for reading state from a game controller. */ |
︙ | |||
353 354 355 356 357 358 359 | 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | - - | /** * @brief Returns the available controllers. * * @return The available controllers */ + (OFArray OF_GENERIC(OFGameController *) *)controllers; |
︙ |
Modified src/hid/OFGameController.m from [680cfba800] to [c04fc09244].
︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | + + + + + + + + + + + + + | * <https://www.gnu.org/licenses/>. */ #include "config.h" #import "OFGameController.h" #import "OFArray.h" #if defined(OF_LINUX) && defined(OF_HAVE_FILES) # include "OFEvdevGameController.h" #endif #ifdef OF_WINDOWS # include "OFXInputGameController.h" #endif #ifdef OF_NINTENDO_DS # include "OFNintendoDSGameController.h" #endif #ifdef OF_NINTENDO_3DS # include "OFNintendo3DSGameController.h" #endif const OFGameControllerButton OFGameControllerNorthButton = @"North"; const OFGameControllerButton OFGameControllerSouthButton = @"South"; const OFGameControllerButton OFGameControllerWestButton = @"West"; const OFGameControllerButton OFGameControllerEastButton = @"East"; const OFGameControllerButton OFGameControllerLeftTriggerButton = @"Left Trigger"; |
︙ | |||
57 58 59 60 61 62 63 | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | - - - - - - - - - + + + + + + + + + + + + + + + + + - + + + + + + - + + + + + + + + + + + + + | const OFGameControllerButton OFGameControllerPlusButton = @"+"; const OFGameControllerButton OFGameControllerMinusButton = @"-"; const OFGameControllerButton OFGameControllerSLButton = @"SL"; const OFGameControllerButton OFGameControllerSRButton = @"SR"; const OFGameControllerButton OFGameControllerModeButton = @"Mode"; const OFGameControllerButton OFGameControllerAssistantButton = @"Assistant"; |
Added src/hid/OFNintendo3DSGameController.h version [54f724ec89].
|
Renamed and modified src/hid/platform/Nintendo3DS/OFGameController.m [f3681e2d31] to src/hid/OFNintendo3DSGameController.m [a67f0beecf].
︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 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 | - + - - - - - + - + - - - - - - | * You should have received a copy of the GNU Lesser General Public License * version 3.0 along with this program. If not, see * <https://www.gnu.org/licenses/>. */ #include "config.h" |
︙ | |||
143 144 145 146 147 148 149 | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | - - - - - - - - - - | } - (OFString *)name { return @"Nintendo 3DS"; } |
︙ |
Added src/hid/OFNintendoDSGameController.h version [b8a00a7023].
|
Renamed and modified src/hid/platform/NintendoDS/OFGameController.m [4b910e9db0] to src/hid/OFNintendoDSGameController.m [9294d80bc8].
︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 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 | - + - - - - - + - + - - - - - - - | * You should have received a copy of the GNU Lesser General Public License * version 3.0 along with this program. If not, see * <https://www.gnu.org/licenses/>. */ #include "config.h" |
︙ | |||
123 124 125 126 127 128 129 | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | - - - - - - - - - - | } - (OFString *)name { return @"Nintendo DS"; } |
︙ |
Added src/hid/OFXInputGameController.h version [523c04abd7].
|
Renamed and modified src/hid/platform/Windows/OFGameController.m [b049972691] to src/hid/OFXInputGameController.m [ba31cb5921].
︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 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 | - + - - - - - + - + | * You should have received a copy of the GNU Lesser General Public License * version 3.0 along with this program. If not, see * <https://www.gnu.org/licenses/>. */ #include "config.h" |
︙ | |||
87 88 89 90 91 92 93 | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | - + | if (XInputGetStateFuncPtr != NULL) { void *pool = objc_autoreleasePoolPush(); for (DWORD i = 0; i < XUSER_MAX_COUNT; i++) { OFGameController *controller; @try { |
︙ |