mirror of
https://github.com/ndeadly/MissionControl
synced 2025-02-16 21:28:25 +00:00
btdrv-mitm: update xbox one controller handling to work with latest controller firmware
This commit is contained in:
parent
87735d5876
commit
d6cc6e9465
2 changed files with 39 additions and 9 deletions
|
@ -34,9 +34,11 @@ namespace ams::controller {
|
|||
case 0x01:
|
||||
this->handleInputReport0x01(xboxReport, switchReport);
|
||||
break;
|
||||
/*
|
||||
case 0x02:
|
||||
this->handleInputReport0x02(xboxReport, switchReport);
|
||||
break;
|
||||
*/
|
||||
case 0x04:
|
||||
this->handleInputReport0x04(xboxReport, switchReport);
|
||||
break;
|
||||
|
@ -91,23 +93,25 @@ namespace ams::controller {
|
|||
dst->input0x30.buttons.lstick_press = src->input0x01.buttons.lstick_press;
|
||||
dst->input0x30.buttons.rstick_press = src->input0x01.buttons.rstick_press;
|
||||
|
||||
dst->input0x30.buttons.capture = 0;
|
||||
dst->input0x30.buttons.capture = 0;
|
||||
dst->input0x30.buttons.home = src->input0x01.buttons.guide;
|
||||
}
|
||||
|
||||
/*
|
||||
void XboxOneController::handleInputReport0x02(const XboxOneReportData *src, SwitchReportData *dst) {
|
||||
packStickData(&dst->input0x30.left_stick, STICK_ZERO, STICK_ZERO);
|
||||
packStickData(&dst->input0x30.right_stick, STICK_ZERO, STICK_ZERO);
|
||||
std::memset(&dst->input0x30.buttons, 0, sizeof(SwitchButtonData));
|
||||
//std::memset(&dst->input0x30.buttons, 0, sizeof(SwitchButtonData));
|
||||
|
||||
dst->input0x30.buttons.home = src->input0x02.guide;
|
||||
}
|
||||
*/
|
||||
|
||||
void XboxOneController::handleInputReport0x04(const XboxOneReportData *src, SwitchReportData *dst) {
|
||||
m_battery = src->input0x04.capacity;
|
||||
|
||||
packStickData(&dst->input0x30.left_stick, STICK_ZERO, STICK_ZERO);
|
||||
packStickData(&dst->input0x30.right_stick, STICK_ZERO, STICK_ZERO);
|
||||
std::memset(&dst->input0x30.buttons, 0, sizeof(SwitchButtonData));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace ams::controller {
|
|||
uint16_t y;
|
||||
} __attribute__ ((__packed__));
|
||||
|
||||
// Used on older firmware
|
||||
struct XboxOneButtonData {
|
||||
uint8_t dpad;
|
||||
|
||||
|
@ -37,12 +38,37 @@ namespace ams::controller {
|
|||
uint8_t : 0;
|
||||
} __attribute__ ((__packed__));
|
||||
|
||||
// Used on latest firmwares
|
||||
struct XboxOneButtonDataNew {
|
||||
uint8_t dpad;
|
||||
|
||||
uint8_t A : 1;
|
||||
uint8_t B : 1;
|
||||
uint8_t : 1;
|
||||
uint8_t X : 1;
|
||||
uint8_t Y : 1;
|
||||
uint8_t : 1;
|
||||
uint8_t LB : 1;
|
||||
uint8_t RB : 1;
|
||||
|
||||
uint8_t : 3;
|
||||
uint8_t menu : 1;
|
||||
uint8_t guide : 1;
|
||||
uint8_t lstick_press : 1;
|
||||
uint8_t rstick_press : 1;
|
||||
uint8_t : 0;
|
||||
|
||||
uint8_t view : 1;
|
||||
uint8_t : 0;
|
||||
|
||||
} __attribute__ ((__packed__));
|
||||
|
||||
struct XboxOneInputReport0x01 {
|
||||
XboxOneStickData left_stick;
|
||||
XboxOneStickData right_stick;
|
||||
uint16_t left_trigger;
|
||||
uint16_t right_trigger;
|
||||
XboxOneButtonData buttons;
|
||||
XboxOneStickData left_stick;
|
||||
XboxOneStickData right_stick;
|
||||
uint16_t left_trigger;
|
||||
uint16_t right_trigger;
|
||||
XboxOneButtonDataNew buttons;
|
||||
} __attribute__ ((__packed__));
|
||||
|
||||
struct XboxOneInputReport0x02{
|
||||
|
@ -83,7 +109,7 @@ namespace ams::controller {
|
|||
|
||||
private:
|
||||
void handleInputReport0x01(const XboxOneReportData *src, SwitchReportData *dst);
|
||||
void handleInputReport0x02(const XboxOneReportData *src, SwitchReportData *dst);
|
||||
//void handleInputReport0x02(const XboxOneReportData *src, SwitchReportData *dst);
|
||||
void handleInputReport0x04(const XboxOneReportData *src, SwitchReportData *dst);
|
||||
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue