This converts Xbox original controller report into Xbox360 form See https://github.com/Grumbel/xboxdrv/blob/master/src/controller/xbox_controller.cpp
| 345 | // This converts Xbox original controller report into Xbox360 form |
| 346 | // See https://github.com/Grumbel/xboxdrv/blob/master/src/controller/xbox_controller.cpp |
| 347 | static void convertFromXboxOriginal(UInt8 *data) { |
| 348 | if (data[0] != 0x00 || data[1] != 0x14) { |
| 349 | IOLog("Unknown report command %d, length %d\n", (int)data[0], (int)data[1]); |
| 350 | return; |
| 351 | } |
| 352 | XBOX360_IN_REPORT report; |
| 353 | Xbox360_Prepare (report, 0); |
| 354 | XBOX_IN_REPORT *in = (XBOX_IN_REPORT*)data; |
| 355 | Xbox360_Short buttons = in->buttons; |
| 356 | if (in->a) buttons |= 1 << 12; // a |
| 357 | if (in->b) buttons |= 1 << 13; // b |
| 358 | if (in->x) buttons |= 1 << 14; // x |
| 359 | if (in->y) buttons |= 1 << 15; // y |
| 360 | if (in->black) buttons |= 1 << 9; // black mapped to shoulder right |
| 361 | if (in->white) buttons |= 1 << 8; // white mapped to shoulder left |
| 362 | report.buttons = buttons; |
| 363 | report.trigL = in->trigL; |
| 364 | report.trigR = in->trigR; |
| 365 | report.left.x = in->xL; |
| 366 | report.left.y = in->yL; |
| 367 | report.right.x = in->xR; |
| 368 | report.right.y = in->yR; |
| 369 | *((XBOX360_IN_REPORT *)data) = report; |
| 370 | } |
| 371 | |
| 372 | IOReturn XboxOriginalControllerClass::handleReport(IOMemoryDescriptor * descriptor, IOHIDReportType reportType, IOOptionBits options) { |
| 373 | // IOLog("%s\n", __FUNCTION__); |