ObjFW  Diff

Differences From Artifact [c9d2d02f2c]:

To Artifact [9e74768eff]:


336
337
338
339
340
341
342


343
344
345
346
347
348
349
			    OFBitSetIsSet(_keyBits, BTN_C) &&
			    OFBitSetIsSet(_keyBits, BTN_SELECT) &&
			    OFBitSetIsSet(_keyBits, BTN_X))
				_hasRightAnalogStick = true;

			if (OFBitSetIsSet(absBits, ABS_HAT0X) &&
			    OFBitSetIsSet(absBits, ABS_HAT0Y)) {


				[_buttons addObject:
				    OFGameControllerDPadLeftButton];
				[_buttons addObject:
				    OFGameControllerDPadRightButton];
				[_buttons addObject:
				    OFGameControllerDPadUpButton];
				[_buttons addObject:







>
>







336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
			    OFBitSetIsSet(_keyBits, BTN_C) &&
			    OFBitSetIsSet(_keyBits, BTN_SELECT) &&
			    OFBitSetIsSet(_keyBits, BTN_X))
				_hasRightAnalogStick = true;

			if (OFBitSetIsSet(absBits, ABS_HAT0X) &&
			    OFBitSetIsSet(absBits, ABS_HAT0Y)) {
				_DPadIsHAT0 = true;

				[_buttons addObject:
				    OFGameControllerDPadLeftButton];
				[_buttons addObject:
				    OFGameControllerDPadRightButton];
				[_buttons addObject:
				    OFGameControllerDPadUpButton];
				[_buttons addObject:
424
425
426
427
428
429
430






























431
432
433
434
435
436
437
			OFGameControllerButton button = buttonToName(
			    buttons[i], _vendorID, _productID);

			if (button != nil)
				[_pressedButtons addObject: button];
		}
	}































	if (_hasLeftAnalogStick) {
		struct input_absinfo infoX, infoY;

		if (ioctl(_fd, EVIOCGABS(ABS_X), &infoX) == -1)
			@throw [OFReadFailedException
			    exceptionWithObject: self







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







426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
			OFGameControllerButton button = buttonToName(
			    buttons[i], _vendorID, _productID);

			if (button != nil)
				[_pressedButtons addObject: button];
		}
	}

	if (_DPadIsHAT0) {
		struct input_absinfo infoX, infoY;

		if (ioctl(_fd, EVIOCGABS(ABS_HAT0X), &infoX) == -1)
			@throw [OFReadFailedException
			    exceptionWithObject: self
				requestedLength: sizeof(infoX)
					  errNo: errno];

		if (ioctl(_fd, EVIOCGABS(ABS_HAT0Y), &infoY) == -1)
			@throw [OFReadFailedException
			    exceptionWithObject: self
				requestedLength: sizeof(infoY)
					  errNo: errno];

		if (infoX.value < 0)
			[_pressedButtons addObject:
			    OFGameControllerDPadLeftButton];
		else if (infoX.value > 0)
			[_pressedButtons addObject:
			    OFGameControllerDPadRightButton];

		if (infoY.value < 0)
			[_pressedButtons addObject:
			    OFGameControllerDPadUpButton];
		else if (infoY.value > 0)
			[_pressedButtons addObject:
			    OFGameControllerDPadDownButton];
	}

	if (_hasLeftAnalogStick) {
		struct input_absinfo infoX, infoY;

		if (ioctl(_fd, EVIOCGABS(ABS_X), &infoX) == -1)
			@throw [OFReadFailedException
			    exceptionWithObject: self