mirror of
https://github.com/ndeadly/MissionControl
synced 2024-11-26 14:20:21 +00:00
bluetooth-mitm: map 8bitdo zero dpad and home button combo
This commit is contained in:
parent
4d6384d0be
commit
89ac65c7eb
2 changed files with 35 additions and 2 deletions
|
@ -43,6 +43,18 @@ namespace ams::controller {
|
|||
}
|
||||
|
||||
void EightBitDoController::HandleInputReport0x01(const EightBitDoReportData *src, SwitchReportData *dst) {
|
||||
dst->input0x30.buttons.dpad_down = (src->input0x01.dpad == EightBitDoDPad_S) ||
|
||||
(src->input0x01.dpad == EightBitDoDPad_SE) ||
|
||||
(src->input0x01.dpad == EightBitDoDPad_SW);
|
||||
dst->input0x30.buttons.dpad_up = (src->input0x01.dpad == EightBitDoDPad_N) ||
|
||||
(src->input0x01.dpad == EightBitDoDPad_NE) ||
|
||||
(src->input0x01.dpad == EightBitDoDPad_NW);
|
||||
dst->input0x30.buttons.dpad_right = (src->input0x01.dpad == EightBitDoDPad_E) ||
|
||||
(src->input0x01.dpad == EightBitDoDPad_NE) ||
|
||||
(src->input0x01.dpad == EightBitDoDPad_SE);
|
||||
dst->input0x30.buttons.dpad_left = (src->input0x01.dpad == EightBitDoDPad_W) ||
|
||||
(src->input0x01.dpad == EightBitDoDPad_NW) ||
|
||||
(src->input0x01.dpad == EightBitDoDPad_SW);
|
||||
|
||||
}
|
||||
|
||||
|
@ -57,6 +69,15 @@ namespace ams::controller {
|
|||
|
||||
dst->input0x30.buttons.minus = src->input0x03.buttons.select;
|
||||
dst->input0x30.buttons.plus = src->input0x03.buttons.start;
|
||||
|
||||
// Home combo
|
||||
dst->input0x30.buttons.home = dst->input0x30.buttons.R && dst->input0x30.buttons.L && dst->input0x30.buttons.minus && dst->input0x30.buttons.plus;
|
||||
if (dst->input0x30.buttons.home) {
|
||||
dst->input0x30.buttons.R = 0;
|
||||
dst->input0x30.buttons.L = 0;
|
||||
dst->input0x30.buttons.minus = 0;
|
||||
dst->input0x30.buttons.plus = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,18 @@
|
|||
|
||||
namespace ams::controller {
|
||||
|
||||
enum EightBitDoDPadDirection : uint16_t {
|
||||
EightBitDoDPad_Released = 0x0000,
|
||||
EightBitDoDPad_N = 0x0052,
|
||||
EightBitDoDPad_NE = 0x524f,
|
||||
EightBitDoDPad_E = 0x004f,
|
||||
EightBitDoDPad_SE = 0x4f51,
|
||||
EightBitDoDPad_S = 0x0051,
|
||||
EightBitDoDPad_SW = 0x5150,
|
||||
EightBitDoDPad_W = 0x0050,
|
||||
EightBitDoDPad_NW = 0x5250,
|
||||
};
|
||||
|
||||
struct EightBitDoStickData {
|
||||
uint8_t x;
|
||||
uint8_t y;
|
||||
|
@ -42,8 +54,8 @@ namespace ams::controller {
|
|||
|
||||
struct EightBitDoInputReport0x01 {
|
||||
uint8_t _unk0[2];
|
||||
uint8_t dpad;
|
||||
uint8_t _unk1[5];
|
||||
uint16_t dpad;
|
||||
uint8_t _unk1[4];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct EightBitDoInputReport0x03 {
|
||||
|
|
Loading…
Reference in a new issue