ObjFW  Diff

Differences From 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)

To Artifact [7ce0cd61b1]:

  • File src/hid/OHGCFGameController.m — part of check-in [75b6fa6ead] at 2024-12-26 23:55:30 on branch trunk — ObjFWHID: Filter broken buttons with GCF (user: js size: 4336)

21
22
23
24
25
26
27

28
29
30
31
32
33
34

#import <GameController/GameController.h>

#import "OHGCFGameController.h"
#import "NSString+OFObject.h"
#import "OFArray.h"
#import "OFDictionary.h"

#import "OHDualSenseGamepad.h"
#import "OHDualSenseGamepad+Private.h"
#import "OHGCFGameControllerProfile.h"
#import "OHGameController.h"
#import "OHGameController+Private.h"
#import "OHGameControllerAxis.h"
#import "OHGameControllerButton.h"







>







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

#import <GameController/GameController.h>

#import "OHGCFGameController.h"
#import "NSString+OFObject.h"
#import "OFArray.h"
#import "OFDictionary.h"
#import "OFSet.h"
#import "OHDualSenseGamepad.h"
#import "OHDualSenseGamepad+Private.h"
#import "OHGCFGameControllerProfile.h"
#import "OHGameController.h"
#import "OHGameController+Private.h"
#import "OHGameControllerAxis.h"
#import "OHGameControllerButton.h"
105
106
107
108
109
110
111



112
113
114

115
116
117
118
119
120
121
}

- (void)updateState
{
	void *pool = objc_autoreleasePoolPush();
	id <GCDevicePhysicalInputState> snapshot =
	    [_controller.input.unmappedInput capture];




	for (id <GCPhysicalInputElement> element in snapshot.elements) {
		if ([element conformsToProtocol: @protocol(GCButtonElement)]) {

			OHGameControllerButton *button =
			    _profile.oh_buttonsMap[element.localizedName];

			OFAssert(button != nil);

			button.value = ((id <GCButtonElement>)element)
			    .pressedInput.value;







>
>
>


|
>







106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
}

- (void)updateState
{
	void *pool = objc_autoreleasePoolPush();
	id <GCDevicePhysicalInputState> snapshot =
	    [_controller.input.unmappedInput capture];
	OFSet *filteredButtons =
	    ([_profile respondsToSelector: @selector(oh_filteredButtons)]
	    ? _profile.oh_filteredButtons : [OFSet set]);

	for (id <GCPhysicalInputElement> element in snapshot.elements) {
		if ([element conformsToProtocol: @protocol(GCButtonElement)] &&
		    ![filteredButtons containsObject: element.localizedName]) {
			OHGameControllerButton *button =
			    _profile.oh_buttonsMap[element.localizedName];

			OFAssert(button != nil);

			button.value = ((id <GCButtonElement>)element)
			    .pressedInput.value;