ObjFW  Diff

Differences From Artifact [c35ba635a9]:

To Artifact [98e64f1a03]:


51
52
53
54
55
56
57
58






59
60
61
62
63
64
65
51
52
53
54
55
56
57

58
59
60
61
62
63
64
65
66
67
68
69
70







-
+
+
+
+
+
+







@interface OHEvdevGameControllerAxis: OHGameControllerAxis
{
@public
	int32_t _minValue, _maxValue;
}
@end

@interface OHEvdevGameControllerProfile: OHGameControllerProfile
@interface OHEvdevGameControllerProfile: OFObject <OHGameControllerProfile>
{
	OFDictionary OF_GENERIC(OFString *, OHGameControllerButton *) *_buttons;
	OFDictionary OF_GENERIC(OFString *, OHGameControllerAxis *) *_axes;
}

- (instancetype)oh_initWithButtons: (OFDictionary *)buttons
			      axes: (OFDictionary *)axes OF_METHOD_FAMILY(init);
@end

static const uint16_t buttonIDs[] = {
	BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, BTN_TL, BTN_TR, BTN_TL2,
	BTN_TR2, BTN_SELECT, BTN_START, BTN_MODE, BTN_THUMBL, BTN_THUMBR,
725
726
727
728
729
730
731
732

733
734
735
736
737

738
739
740
741
742
743
744
730
731
732
733
734
735
736

737
738
739
740
741

742
743
744
745
746
747
748
749







-
+




-
+







			   axis->_minValue, axis->_maxValue);

			break;
		}
	}
}

- (OHGamepad *)gamepad
- (id <OHGamepad>)gamepad
{
	return self.extendedGamepad;
}

- (OHExtendedGamepad *)extendedGamepad
- (id <OHExtendedGamepad>)extendedGamepad
{
	@try {
		if (_vendorID == OHVendorIDSony &&
		    _productID == OHProductIDDualSense)
			return [[[OHEvdevDualSense alloc]
			    initWithController: self] autorelease];
		else if (_vendorID == OHVendorIDSony &&
777
778
779
780
781
782
783


784
785
786
787
788
789
790
791
792
793
794
795
796
797
798














799
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820







+
+















+
+
+
+
+
+
+
+
+
+
+
+
+
+

}
@end

@implementation OHEvdevGameControllerAxis
@end

@implementation OHEvdevGameControllerProfile
@synthesize buttons = _buttons, axes = _axes;

- (instancetype)oh_initWithButtons: (OFDictionary *)buttons
			      axes: (OFDictionary *)axes
{
	self = [super init];

	@try {
		_buttons = [buttons retain];
		_axes = [axes retain];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (void)dealloc
{
	[_buttons release];
	[_axes release];

	[super dealloc];
}

- (OFDictionary OF_GENERIC(OFString *, OHGameControllerDirectionalPad *) *)
    directionalPads
{
	return [OFDictionary dictionary];
}
@end