Overview
Comment: | ObjFWHID: OHCombinedJoyCons -> OHJoyConPair |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
15ab9bba8213c25fd4d810f0686d6095 |
User & Date: | js on 2024-07-01 18:52:48 |
Other Links: | manifest | tags |
Context
2024-07-04
| ||
18:45 | Make conformance to OHEvdevMapping private check-in: 146b11b201 user: js tags: trunk | |
2024-07-01
| ||
18:52 | ObjFWHID: OHCombinedJoyCons -> OHJoyConPair check-in: 15ab9bba82 user: js tags: trunk | |
18:41 | ObjFWHID: Make most profiles public check-in: dfaf830200 user: js tags: trunk | |
Changes
Modified src/hid/Makefile from [70f9c3c1c0] to [27f78be24f].
1 2 3 4 5 6 7 8 9 10 11 | include ../../extra.mk DISTCLEAN = Info.plist SHARED_LIB = ${OBJFWHID_SHARED_LIB} STATIC_LIB = ${OBJFWHID_STATIC_LIB} FRAMEWORK = ${OBJFWHID_FRAMEWORK} LIB_MAJOR = ${OBJFWHID_LIB_MAJOR} LIB_MINOR = ${OBJFWHID_LIB_MINOR} LIB_PATCH = ${OBJFWHID_LIB_PATCH} | < | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | include ../../extra.mk DISTCLEAN = Info.plist SHARED_LIB = ${OBJFWHID_SHARED_LIB} STATIC_LIB = ${OBJFWHID_STATIC_LIB} FRAMEWORK = ${OBJFWHID_FRAMEWORK} LIB_MAJOR = ${OBJFWHID_LIB_MAJOR} LIB_MINOR = ${OBJFWHID_LIB_MINOR} LIB_PATCH = ${OBJFWHID_LIB_PATCH} SRCS = OHDualSenseGamepad.m \ OHDualShock4Gamepad.m \ OHExtendedN64Controller.m \ OHGameController.m \ OHGameControllerAxis.m \ OHGameControllerButton.m \ OHGameControllerDirectionalPad.m \ OHGameControllerElement.m \ OHJoyConPair.m \ OHLeftJoyCon.m \ OHN64Controller.m \ OHRightJoyCon.m \ OHStadiaGamepad.m \ OHXboxGamepad.m INCLUDES := ${SRCS:.m=.h} \ |
︙ | ︙ |
Renamed and modified src/hid/OHCombinedJoyCons.h [3ff7fc7f86] to src/hid/OHJoyConPair.h [343333c252].
︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 | #import "OHExtendedGamepad.h" OF_ASSUME_NONNULL_BEGIN @class OHGameController; @class OHGameControllerButton; @class OHGameControllerDirectionalPad; /** | > > | | | | | < | | | | | | | | | | | | | 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 66 67 68 69 | #import "OHExtendedGamepad.h" OF_ASSUME_NONNULL_BEGIN @class OHGameController; @class OHGameControllerButton; @class OHGameControllerDirectionalPad; @class OHLeftJoyCon; @class OHRightJoyCon; /** * @class OHJoyConPair OHJoyConPair.h ObjFWHID/ObjFWHID.h * * @brief Combines a left and a right Joy-Con into a gamepad. */ OF_SUBCLASSING_RESTRICTED @interface OHJoyConPair: OFObject <OHExtendedGamepad> { OHLeftJoyCon *_leftJoyCon; OHRightJoyCon *_rightJoyCon; OFDictionary OF_GENERIC(OFString *, OHGameControllerButton *) *_buttons; OFDictionary OF_GENERIC(OFString *, OHGameControllerDirectionalPad *) *_directionalPads; } /** * @brief Creates a new Joy-Con pair with the specified left and right Joy-Con. * * @param leftJoyCon The left Joy-Con for the pair * @param rightJoyCon The right Joy-Con for the pair * @return An new Joy-Con pair */ + (instancetype)gamepadWithLeftJoyCon: (OHLeftJoyCon *)leftJoyCon rightJoyCon: (OHRightJoyCon *)rightJoyCon; - (instancetype)init OF_UNAVAILABLE; /** * @brief Initializes an already allocated Joy-Con pair with the specified left * and right Joy-Con. * * @param leftJoyCon The left Joy-Con for the pair * @param rightJoyCon The right Joy-Con for the pair * @return An initialized Joy-Con pair */ - (instancetype)initWithLeftJoyCon: (OHLeftJoyCon *)leftJoyCon rightJoyCon: (OHRightJoyCon *)rightJoyCon; @end OF_ASSUME_NONNULL_END |
Renamed and modified src/hid/OHCombinedJoyCons.m [0639ff2a5d] to src/hid/OHJoyConPair.m [581b1be473].
︙ | ︙ | |||
15 16 17 18 19 20 21 | * 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" | | > > | | | | | < < < < < < < < < < < < < | | < < < | | | | 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 66 67 68 69 | * 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" #import "OHJoyConPair.h" #import "OFDictionary.h" #import "OFNumber.h" #import "OHGameController.h" #import "OHGameControllerDirectionalPad.h" #import "OHLeftJoyCon.h" #import "OHRightJoyCon.h" #import "OFInvalidArgumentException.h" @implementation OHJoyConPair @synthesize buttons = _buttons, directionalPads = _directionalPads; + (instancetype)gamepadWithLeftJoyCon: (OHLeftJoyCon *)leftJoyCon rightJoyCon: (OHRightJoyCon *)rightJoyCon { return [[[self alloc] initWithLeftJoyCon: leftJoyCon rightJoyCon: rightJoyCon] autorelease]; } - (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)initWithLeftJoyCon: (OHLeftJoyCon *)leftJoyCon rightJoyCon: (OHRightJoyCon *)rightJoyCon { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); OFMutableDictionary *buttons, *directionalPads; _leftJoyCon = [leftJoyCon retain]; _rightJoyCon = [rightJoyCon retain]; buttons = [OFMutableDictionary dictionaryWithCapacity: _leftJoyCon.buttons.count + _rightJoyCon.buttons.count]; [buttons addEntriesFromDictionary: _leftJoyCon.buttons]; [buttons addEntriesFromDictionary: _rightJoyCon.buttons]; [buttons removeObjectForKey: @"SL"]; [buttons removeObjectForKey: @"SR"]; [buttons makeImmutable]; _buttons = [buttons retain]; directionalPads = [OFMutableDictionary dictionaryWithCapacity: 3]; |
︙ | ︙ |
Modified src/hid/ObjFWHID.h from [72da477079] to [edb5eb74fe].
︙ | ︙ | |||
22 23 24 25 26 27 28 | #import "OHGameControllerAxis.h" #import "OHGameControllerButton.h" #import "OHGameControllerDirectionalPad.h" #import "OHGameControllerProfile.h" #import "OHGamepad.h" #import "OHExtendedGamepad.h" | < < > > | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | #import "OHGameControllerAxis.h" #import "OHGameControllerButton.h" #import "OHGameControllerDirectionalPad.h" #import "OHGameControllerProfile.h" #import "OHGamepad.h" #import "OHExtendedGamepad.h" #import "OHDualSenseGamepad.h" #import "OHDualShock4Gamepad.h" #import "OHExtendedN64Controller.h" #import "OHLeftJoyCon.h" #import "OHRightJoyCon.h" #import "OHJoyConPair.h" #import "OHN64Controller.h" #import "OHStadiaGamepad.h" #import "OHXboxGamepad.h" |
Modified tests/gamecontroller/GameControllerTests.m from [a4fbbbb68a] to [fd38b501b0].
︙ | ︙ | |||
24 25 26 27 28 29 30 | #import "OFColor.h" #import "OFDate.h" #import "OFDictionary.h" #import "OFNumber.h" #import "OFStdIOStream.h" #import "OFThread.h" | < > > > | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #import "OFColor.h" #import "OFDate.h" #import "OFDictionary.h" #import "OFNumber.h" #import "OFStdIOStream.h" #import "OFThread.h" #import "OHExtendedGamepad.h" #import "OHGameController.h" #import "OHGameControllerAxis.h" #import "OHGameControllerButton.h" #import "OHGameControllerDirectionalPad.h" #import "OHGameControllerProfile.h" #import "OHGamepad.h" #import "OHJoyConPair.h" #import "OHLeftJoyCon.h" #import "OHRightJoyCon.h" #import "OFReadFailedException.h" #if defined(OF_NINTENDO_DS) static size_t buttonsPerLine = 2; #elif defined(OF_NINTENDO_3DS) static size_t buttonsPerLine = 3; |
︙ | ︙ | |||
191 192 193 194 195 196 197 | consoleInit(NULL); while (appletMainLoop()) { #else for (;;) { #endif void *pool = objc_autoreleasePoolPush(); | > | | 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | consoleInit(NULL); while (appletMainLoop()) { #else for (;;) { #endif void *pool = objc_autoreleasePoolPush(); OHLeftJoyCon *leftJoyCon = nil; OHRightJoyCon *rightJoyCon = nil; if (_lastControllersUpdate == nil || -[_lastControllersUpdate timeIntervalSinceNow] > 1) { [_controllers release]; [_lastControllersUpdate release]; _controllers = [[OHGameController controllers] retain]; |
︙ | ︙ | |||
223 224 225 226 227 228 229 | [OFStdOut setForegroundColor: [OFColor red]]; [OFStdOut writeString: e.description]; continue; } printProfile(profile); | < < < | | < | | < | | | | 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 | [OFStdOut setForegroundColor: [OFColor red]]; [OFStdOut writeString: e.description]; continue; } printProfile(profile); if ([profile isKindOfClass: [OHLeftJoyCon class]]) leftJoyCon = (OHLeftJoyCon *)profile; else if ([profile isKindOfClass: [OHRightJoyCon class]]) rightJoyCon = (OHRightJoyCon *)profile; } if (leftJoyCon != nil && rightJoyCon != nil) { OHJoyConPair *joyConPair = [OHJoyConPair gamepadWithLeftJoyCon: leftJoyCon rightJoyCon: rightJoyCon]; [OFStdOut setForegroundColor: [OFColor green]]; [OFStdOut writeLine: @"Joy-Con Pair"]; printProfile(joyConPair); } #if defined(OF_WII) || defined(OF_NINTENDO_DS) || defined(OF_NINTENDO_3DS) [OFThread waitForVerticalBlank]; #elif defined(OF_NINTENDO_SWITCH) consoleUpdate(NULL); #else |
︙ | ︙ |