ObjFW  Diff

Differences From Artifact [00711b94af]:

To Artifact [fbbf92a317]:


38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
		_rawProfile = [controller.rawProfile retain];

		if (self.northButton == nil || self.southButton == nil ||
		    self.westButton == nil || self.eastButton == nil ||
		    self.leftShoulderButton == nil ||
		    self.rightShoulderButton == nil ||
		    self.leftTriggerButton == nil ||
		    self.rightTriggerButton == nil ||
		    self.leftThumbstickButton == nil ||
		    self.rightThumbstickButton == nil ||
		    self.menuButton == nil || self.optionsButton == nil ||
		    self.homeButton == nil || self.leftThumbstick == nil ||
		    self.rightThumbstick == nil || self.dPad == nil)
			@throw [OFInvalidArgumentException exception];

		objc_autoreleasePoolPop(pool);
	} @catch (id e) {
		[self release];
		@throw e;







|
<
<
<
|







38
39
40
41
42
43
44
45



46
47
48
49
50
51
52
53
		_rawProfile = [controller.rawProfile retain];

		if (self.northButton == nil || self.southButton == nil ||
		    self.westButton == nil || self.eastButton == nil ||
		    self.leftShoulderButton == nil ||
		    self.rightShoulderButton == nil ||
		    self.leftTriggerButton == nil ||
		    self.rightTriggerButton == nil || self.menuButton == nil ||



		    self.optionsButton == nil || self.leftThumbstick == nil ||
		    self.rightThumbstick == nil || self.dPad == nil)
			@throw [OFInvalidArgumentException exception];

		objc_autoreleasePoolPop(pool);
	} @catch (id e) {
		[self release];
		@throw e;
64
65
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
92
93
94
95
96
	[_rawProfile release];

	[super dealloc];
}

- (OFDictionary OF_GENERIC(OFString *, OHGameControllerButton *) *)buttons
{
	return [OFDictionary dictionaryWithKeysAndObjects:
	    @"North", self.northButton,
	    @"South", self.southButton,
	    @"West", self.westButton,
	    @"East", self.eastButton,
	    @"Left Shoulder", self.leftShoulderButton,

	    @"Right Shoulder", self.rightShoulderButton,

	    @"Left Trigger", self.leftTriggerButton,
	    @"Right Trigger", self.rightTriggerButton,

	    @"Left Thumbstick", self.leftThumbstickButton,
	    @"Right Thumbstick", self.rightThumbstickButton,
	    @"Menu", self.menuButton,
	    @"Options", self.optionsButton,
	    @"Home", self.homeButton, nil];
}

- (OFDictionary OF_GENERIC(OFString *, OHGameControllerAxis *) *)axes
{














	return [OFDictionary dictionary];
}

- (OFDictionary OF_GENERIC(OFString *, OHGameControllerDirectionalPad *) *)
    directionalPads
{
	return [OFDictionary dictionaryWithKeysAndObjects:
	    @"Left Thumbstick", self.leftThumbstick,







|
|
|
|
|
|
>
|
>
|
|
>
|
|
|
|
|




>
>
>
>
>
>
>
>
>
>
>
>
>
>
|







61
62
63
64
65
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
	[_rawProfile release];

	[super dealloc];
}

- (OFDictionary OF_GENERIC(OFString *, OHGameControllerButton *) *)buttons
{
	OFMutableDictionary *buttons =
	    [[_rawProfile.buttons mutableCopy] autorelease];

	[buttons removeObjectForKey: @"D-Pad Up"];
	[buttons removeObjectForKey: @"D-Pad Down"];
	[buttons removeObjectForKey: @"D-Pad Left"];
	[buttons removeObjectForKey: @"D-Pad Right"];

	if ([_rawProfile.axes objectForKey: @"Z"] != nil)
		[buttons setObject: self.leftTriggerButton forKey: @"TL2"];

	if ([_rawProfile.axes objectForKey: @"RZ"] != nil)
		[buttons setObject: self.rightTriggerButton forKey: @"TR2"];

	[buttons makeImmutable];

	return buttons;
}

- (OFDictionary OF_GENERIC(OFString *, OHGameControllerAxis *) *)axes
{
	OFMutableDictionary *axes =
	    [[_rawProfile.axes mutableCopy] autorelease];

	[axes removeObjectForKey: @"X"];
	[axes removeObjectForKey: @"Y"];
	[axes removeObjectForKey: @"RX"];
	[axes removeObjectForKey: @"RY"];
	[axes removeObjectForKey: @"Z"];
	[axes removeObjectForKey: @"RZ"];
	[axes removeObjectForKey: @"HAT0X"];
	[axes removeObjectForKey: @"HAT0Y"];

	[axes makeImmutable];

	return axes;
}

- (OFDictionary OF_GENERIC(OFString *, OHGameControllerDirectionalPad *) *)
    directionalPads
{
	return [OFDictionary dictionaryWithKeysAndObjects:
	    @"Left Thumbstick", self.leftThumbstick,