29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
+
+
|
#import "OHDualSenseGamepad+Private.h"
#import "OHGCFGameControllerProfile.h"
#import "OHGameController.h"
#import "OHGameController+Private.h"
#import "OHGameControllerAxis.h"
#import "OHGameControllerButton.h"
#import "OHGameControllerDirectionalPad.h"
#import "OHJoyConPair.h"
#import "OHJoyConPair+Private.h"
@implementation OHGCFGameController
@synthesize name = _name;
+ (void)initialize
{
if (self != OHGCFGameController.class)
|
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
|
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
|
+
-
-
-
+
+
+
-
-
-
+
+
+
+
|
- (instancetype)oh_initWithGCController: (GCController *)controller
{
self = [super oh_init];
@try {
void *pool = objc_autoreleasePoolPush();
Class profileClass;
_controller = [controller retain];
_name = [_controller.vendorName.OFObject copy];
if ([_name isEqual: @"DualSense Wireless Controller"])
_profile = [[OHDualSenseGamepad alloc]
oh_initWithLiveInput:
_controller.input.unmappedInput];
profileClass = [OHDualSenseGamepad class];
else if ([_name isEqual: @"Joy-Con (L/R)"])
profileClass = [OHJoyConPair class];
else
_profile = [[OHGCFGameControllerProfile alloc]
oh_initWithLiveInput:
_controller.input.unmappedInput];
profileClass = [OHGCFGameControllerProfile class];
_profile = [[profileClass alloc]
oh_initWithLiveInput: _controller.input.unmappedInput];
objc_autoreleasePoolPop(pool);
} @catch (id e) {
[self release];
@throw e;
}
|