74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
for (int32_t i = 0; i < WPAD_MAX_WIIMOTES; i++) {
uint32_t type;
if (WPAD_Probe(i, &type) == WPAD_ERR_NONE &&
(type == WPAD_EXP_NONE || type == WPAD_EXP_NUNCHUK ||
type == WPAD_EXP_CLASSIC))
[controllers addObject: [[[OHWiiGameController alloc]
oh_initWithIndex: i
type: type] autorelease]];
}
[controllers makeImmutable];
objc_autoreleasePoolPop(pool);
return controllers;
|
|
>
|
|
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
for (int32_t i = 0; i < WPAD_MAX_WIIMOTES; i++) {
uint32_t type;
if (WPAD_Probe(i, &type) == WPAD_ERR_NONE &&
(type == WPAD_EXP_NONE || type == WPAD_EXP_NUNCHUK ||
type == WPAD_EXP_CLASSIC))
[controllers addObject: objc_autorelease(
[[OHWiiGameController alloc]
oh_initWithIndex: i
type: type])];
}
[controllers makeImmutable];
objc_autoreleasePoolPop(pool);
return controllers;
|
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
else if (type == WPAD_EXP_NUNCHUK)
_profile = [[OHWiimoteWithNunchuk alloc] oh_init];
else
_profile = [[OHWiimote alloc] oh_init];
[self updateState];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- (void)dealloc
{
[_profile release];
[super dealloc];
}
- (void)updateState
{
OFDictionary *buttons = _profile.buttons;
|
|
|
|
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
else if (type == WPAD_EXP_NUNCHUK)
_profile = [[OHWiimoteWithNunchuk alloc] oh_init];
else
_profile = [[OHWiimote alloc] oh_init];
[self updateState];
} @catch (id e) {
objc_release(self);
@throw e;
}
return self;
}
- (void)dealloc
{
objc_release(_profile);
[super dealloc];
}
- (void)updateState
{
OFDictionary *buttons = _profile.buttons;
|