Overview
Comment: | ObjFWHID: Move Wiimote profile to separate files |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
be1b426a452ec77fc1f124cf212dac75 |
User & Date: | js on 2024-06-16 20:52:40 |
Other Links: | manifest | tags |
Context
2024-06-16
| ||
21:54 | OHXInputExtendedGamepad -> OHXbox360Gamepad check-in: 318e342850 user: js tags: trunk | |
20:52 | ObjFWHID: Move Wiimote profile to separate files check-in: be1b426a45 user: js tags: trunk | |
2024-06-09
| ||
23:39 | Various cleanups check-in: 01f1d066bc user: js tags: trunk | |
Changes
Modified src/hid/Makefile from [1c32c733a0] to [7120998aed].
︙ | ︙ | |||
30 31 32 33 34 35 36 | SRCS_NINTENDO_3DS = OHNintendo3DSExtendedGamepad.m \ OHNintendo3DSGameController.m SRCS_NINTENDO_DS = OHNintendoDSGamepad.m \ OHNintendoDSGameController.m SRCS_NINTENDO_SWITCH = OHNintendoSwitchExtendedGamepad.m \ OHNintendoSwitchGameController.m SRCS_WII = OHWiiClassicController.m \ | | > > | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | SRCS_NINTENDO_3DS = OHNintendo3DSExtendedGamepad.m \ OHNintendo3DSGameController.m SRCS_NINTENDO_DS = OHNintendoDSGamepad.m \ OHNintendoDSGameController.m SRCS_NINTENDO_SWITCH = OHNintendoSwitchExtendedGamepad.m \ OHNintendoSwitchGameController.m SRCS_WII = OHWiiClassicController.m \ OHWiiGameController.m \ OHWiimote.m \ OHWiimoteWithNunchuk.m SRCS_XINPUT = OHXInputExtendedGamepad.m \ OHXInputGameController.m INCLUDES := ${SRCS:.m=.h} \ OHExtendedGamepad.h \ OHGameControllerProfile.h \ OHGamepad.h \ |
︙ | ︙ |
Modified src/hid/OHWiiGameController.m from [38aa35cd32] to [b6f18a05d5].
︙ | ︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #import "OHWiiGameController.h" #import "OFArray.h" #import "OFDictionary.h" #import "OHGameControllerButton.h" #import "OHGameControllerDirectionalPad.h" #import "OHWiiClassicController.h" #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFReadFailedException.h" #define asm __asm__ #include <wiiuse/wpad.h> #undef asm | > > < < < < < < < < < < < < < < < < < < < < | 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 | #import "OHWiiGameController.h" #import "OFArray.h" #import "OFDictionary.h" #import "OHGameControllerButton.h" #import "OHGameControllerDirectionalPad.h" #import "OHWiiClassicController.h" #import "OHWiimote.h" #import "OHWiimoteWithNunchuk.h" #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFReadFailedException.h" #define asm __asm__ #include <wiiuse/wpad.h> #undef asm static float scale(float value, float min, float max, float center) { if (value < min) value = min; if (value > max) value = max; |
︙ | ︙ | |||
110 111 112 113 114 115 116 117 | @try { _index = index; _type = type; if (type == WPAD_EXP_CLASSIC) _rawProfile = [[OHWiiClassicController alloc] init]; else | > > | < | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | @try { _index = index; _type = type; if (type == WPAD_EXP_CLASSIC) _rawProfile = [[OHWiiClassicController alloc] init]; else if (type == WPAD_EXP_NUNCHUK) _rawProfile = [[OHWiimoteWithNunchuk alloc] init]; else _rawProfile = [[OHWiimote alloc] init]; [self retrieveState]; } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ | |||
266 267 268 269 270 271 272 273 | - (id <OHExtendedGamepad>)extendedGamepad { if (_type == WPAD_EXP_CLASSIC) return (id <OHExtendedGamepad>)_rawProfile; return nil; } @end | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 249 250 251 252 253 254 255 256 | - (id <OHExtendedGamepad>)extendedGamepad { if (_type == WPAD_EXP_CLASSIC) return (id <OHExtendedGamepad>)_rawProfile; return nil; } @end |
Added src/hid/OHWiimote.h version [776944f0bb].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 28 29 30 31 32 | /* * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License version 3.0 only, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * version 3.0 for more details. * * 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/>. */ #import "OHGameControllerProfile.h" OF_ASSUME_NONNULL_BEGIN @interface OHWiimote: OFObject <OHGameControllerProfile> { OFDictionary OF_GENERIC(OFString *, OHGameControllerButton *) *_buttons; OFDictionary OF_GENERIC(OFString *, OHGameControllerDirectionalPad *) *_directionalPads; } @end OF_ASSUME_NONNULL_END |
Added src/hid/OHWiimote.m version [46b6929ff6].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 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 87 88 89 90 91 92 93 94 95 96 97 | /* * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License version 3.0 only, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * version 3.0 for more details. * * 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 "OHWiimote.h" #import "OFDictionary.h" #import "OHGameControllerAxis.h" #import "OHGameControllerButton.h" #import "OHGameControllerDirectionalPad.h" static OFString *const buttonNames[] = { @"A", @"B", @"1", @"2", @"+", @"-", @"Home" }; static const size_t numButtons = sizeof(buttonNames) / sizeof(*buttonNames); @implementation OHWiimote @synthesize buttons = _buttons, directionalPads = _directionalPads; - (instancetype)init { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); OFMutableDictionary *buttons; OHGameControllerDirectionalPad *dPad; OHGameControllerButton *up, *down, *left, *right; buttons = [OFMutableDictionary dictionaryWithCapacity: numButtons]; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] initWithName: buttonNames[i]] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } [buttons makeImmutable]; _buttons = [buttons retain]; up = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Up"] autorelease]; down = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Down"] autorelease]; left = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Left"] autorelease]; right = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Right"] autorelease]; dPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" up: up down: down left: left right: right] autorelease]; _directionalPads = [[OFDictionary alloc] initWithObject: dPad forKey: @"D-Pad"]; objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [_buttons release]; [_directionalPads release]; [super dealloc]; } - (OFDictionary OF_GENERIC(OFString *, OHGameControllerAxis *) *)axes { return [OFDictionary dictionary]; } @end |
Added src/hid/OHWiimoteWithNunchuk.h version [be7add6deb].
> > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | /* * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License version 3.0 only, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * version 3.0 for more details. * * 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/>. */ #import "OHWiimote.h" OF_ASSUME_NONNULL_BEGIN @interface OHWiimoteWithNunchuk: OHWiimote @end OF_ASSUME_NONNULL_END |
Added src/hid/OHWiimoteWithNunchuk.m version [5d0d220aa4].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 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 | /* * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License version 3.0 only, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * version 3.0 for more details. * * 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 "OHWiimoteWithNunchuk.h" #import "OFDictionary.h" #import "OHGameControllerAxis.h" #import "OHGameControllerButton.h" #import "OHGameControllerDirectionalPad.h" static OFString *const buttonNames[] = { @"C", @"Z" }; static const size_t numButtons = sizeof(buttonNames) / sizeof(*buttonNames); @implementation OHWiimoteWithNunchuk - (instancetype)init { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); OFMutableDictionary *buttons = [[_buttons mutableCopy] autorelease]; OFMutableDictionary *directionalPads = [[_directionalPads mutableCopy] autorelease]; OHGameControllerAxis *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] initWithName: buttonNames[i]] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } xAxis = [[[OHGameControllerAxis alloc] initWithName: @"X"] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"Y"] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Analog Stick" xAxis: xAxis yAxis: yAxis] autorelease]; [directionalPads setObject: directionalPad forKey: @"Analog Stick"]; [buttons makeImmutable]; [_buttons release]; _buttons = [buttons retain]; [directionalPads makeImmutable]; [_directionalPads release]; _directionalPads = [directionalPads retain]; objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; } return self; } @end |