Skip to content

Commit 6bfdcf7

Browse files
nastysMegamouse
authored andcommitted
Add Sixaxis init for Monterey
1 parent d3013f0 commit 6bfdcf7

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
@@ -617,6 +617,14 @@ extern "C" {
617617
*/
618618
HID_API_EXPORT const char* HID_API_CALL hid_version_str(void);
619619

620+
#ifdef __APPLE__
621+
/** RPCS3 EDIT: Initializes a USB Sixaxis/DualShock 3 controller,
622+
* which requires report_id to be separate from the data packet.
623+
* Required on macOS Monterey.
624+
*/
625+
int HID_API_EXPORT hid_init_sixaxis_usb(hid_device *dev);
626+
#endif
627+
620628
#ifdef __cplusplus
621629
}
622630
#endif

mac/hid.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,3 +1549,16 @@ HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev)
15491549
return L"Success";
15501550
return last_global_error_str;
15511551
}
1552+
1553+
int HID_API_EXPORT hid_init_sixaxis_usb(hid_device *dev)
1554+
{
1555+
const char data[] = { 0x42, 0x0C, 0x00, 0x00 };
1556+
size_t length = sizeof(data);
1557+
const unsigned char report_id = 0xF4;
1558+
1559+
if (IOHIDDeviceSetReport(dev->device_handle, kIOHIDReportTypeFeature, report_id, data, length) == kIOReturnSuccess) {
1560+
return length;
1561+
}
1562+
1563+
return -1;
1564+
}

0 commit comments

Comments
 (0)