ObjFW  Diff

Differences From Artifact [645e1767b5]:

  • File src/hid/OHGCFGameController.m — part of check-in [3ca2f87974] at 2024-12-26 01:44:52 on branch trunk — ObjFWHID: Support DualSense via GCF (user: js size: 3976)

To Artifact [19f49e1ac4]:

  • File src/hid/OHGCFGameController.m — part of check-in [4b7ccfe0b6] at 2024-12-26 23:27:13 on branch trunk — ObjFWHID: Support Joy-Con pair via GCF (user: js size: 4108)

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;
	}