Skip to content

Commit 8b43a97

Browse files
nastysMegamouse
authored andcommitted
Add Sixaxis init for Monterey
1 parent 9c712bb commit 8b43a97

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

hidapi/hidapi.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,14 @@ extern "C" {
622622
*/
623623
int HID_API_EXPORT HID_API_CALL hid_write_control(hid_device *device, const unsigned char *data, size_t length);
624624

625+
#ifdef __APPLE__
626+
/** RPCS3 EDIT: Initializes a USB Sixaxis/DualShock 3 controller,
627+
* which requires report_id to be separate from the data packet.
628+
* Required on macOS Monterey.
629+
*/
630+
int HID_API_EXPORT hid_init_sixaxis_usb(hid_device *dev);
631+
#endif
632+
625633
#ifdef __cplusplus
626634
}
627635
#endif

mac/hid.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,3 +1555,16 @@ HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev)
15551555
return L"Success";
15561556
return last_global_error_str;
15571557
}
1558+
1559+
int HID_API_EXPORT hid_init_sixaxis_usb(hid_device *dev)
1560+
{
1561+
const char data[] = { 0x42, 0x0C, 0x00, 0x00 };
1562+
size_t length = sizeof(data);
1563+
const unsigned char report_id = 0xF4;
1564+
1565+
if (IOHIDDeviceSetReport(dev->device_handle, kIOHIDReportTypeFeature, report_id, data, length) == kIOReturnSuccess) {
1566+
return length;
1567+
}
1568+
1569+
return -1;
1570+
}

0 commit comments

Comments
 (0)