ObjFW  Diff

Differences From Artifact [453f7a0173]:

To Artifact [a742844fc7]:


30
31
32
33
34
35
36

37
38
39
40
41
42
43
#import "OFFileManager.h"
#import "OFLocale.h"
#import "OFNumber.h"

#import "OHEvdevDualSense.h"
#import "OHEvdevDualShock4.h"
#import "OHEvdevGamepad.h"

#import "OHGameControllerAxis.h"
#import "OHGameControllerButton.h"
#import "OHGameControllerProfile.h"

#include <sys/ioctl.h>
#include <linux/input.h>








>







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#import "OFFileManager.h"
#import "OFLocale.h"
#import "OFNumber.h"

#import "OHEvdevDualSense.h"
#import "OHEvdevDualShock4.h"
#import "OHEvdevGamepad.h"
#import "OHEvdevStadiaGamepad.h"
#import "OHGameControllerAxis.h"
#import "OHGameControllerButton.h"
#import "OHGameControllerProfile.h"

#include <sys/ioctl.h>
#include <linux/input.h>

119
120
121
122
123
124
125




























126
127
128
129
130
131
132

	if (vendorID == OHVendorIDSony && productID == OHProductIDDualSense)
		if (button == BTN_SELECT)
			return @"Create";
	if (vendorID == OHVendorIDSony && productID == OHProductIDDualShock4)
		if (button == BTN_SELECT)
			return @"Share";





























	switch (button) {
	case BTN_A:
		return @"A";
	case BTN_B:
		return @"B";
	case BTN_C:







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161

	if (vendorID == OHVendorIDSony && productID == OHProductIDDualSense)
		if (button == BTN_SELECT)
			return @"Create";
	if (vendorID == OHVendorIDSony && productID == OHProductIDDualShock4)
		if (button == BTN_SELECT)
			return @"Share";

	if (vendorID == OHVendorIDGoogle &&
	    productID == OHProductIDStadiaController) {
		switch (button) {
		case BTN_TL:
			return @"L1";
		case BTN_TR:
			return @"R1";
		case BTN_TRIGGER_HAPPY4:
			return @"L2";
		case BTN_TRIGGER_HAPPY3:
			return @"R2";
		case BTN_THUMBL:
			return @"L3";
		case BTN_THUMBR:
			return @"R3";
		case BTN_START:
			return @"Menu";
		case BTN_SELECT:
			return @"Options";
		case BTN_MODE:
			return @"Stadia";
		case BTN_TRIGGER_HAPPY1:
			return @"Assistant";
		case BTN_TRIGGER_HAPPY2:
			return @"Capture";
		}
	}

	switch (button) {
	case BTN_A:
		return @"A";
	case BTN_B:
		return @"B";
	case BTN_C:
642
643
644
645
646
647
648




649
650
651
652
653
654
655
		if (_vendorID == OHVendorIDSony &&
		    _productID == OHProductIDDualSense)
			return [[[OHEvdevDualSense alloc]
			    initWithController: self] autorelease];
		else if (_vendorID == OHVendorIDSony &&
		    _productID == OHProductIDDualShock4)
			return [[[OHEvdevDualShock4 alloc]




			    initWithController: self] autorelease];
		else
			return [[[OHEvdevGamepad alloc]
			    initWithController: self] autorelease];
	} @catch (OFInvalidArgumentException *e) {
		return nil;
	}







>
>
>
>







671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
		if (_vendorID == OHVendorIDSony &&
		    _productID == OHProductIDDualSense)
			return [[[OHEvdevDualSense alloc]
			    initWithController: self] autorelease];
		else if (_vendorID == OHVendorIDSony &&
		    _productID == OHProductIDDualShock4)
			return [[[OHEvdevDualShock4 alloc]
			    initWithController: self] autorelease];
		else if (_vendorID == OHVendorIDGoogle &&
		    _productID == OHProductIDStadiaController)
			return [[[OHEvdevStadiaGamepad alloc]
			    initWithController: self] autorelease];
		else
			return [[[OHEvdevGamepad alloc]
			    initWithController: self] autorelease];
	} @catch (OFInvalidArgumentException *e) {
		return nil;
	}