Skip to content

Commit

Permalink
[BT] Add support for 8bitdo Gbros GC adapter via XInput
Browse files Browse the repository at this point in the history
Fixes #105
  • Loading branch information
darthcloud committed Jan 7, 2022
1 parent 377baa0 commit aa3054f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions main/adapter/adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enum {
BT_SW_N64,
BT_SW_MD_GEN,
BT_SW_POWERA,
BT_8BITDO_GBROS,
BT_SUBTYPE_MAX,
};

Expand Down
15 changes: 15 additions & 0 deletions main/adapter/wireless/xbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,17 @@ static const uint32_t xbox_xs_btns_mask[32] = {
0, BIT(XBOX_XS_RB), 0, BIT(XBOX_XS_RJ),
};

static const uint32_t gbros_btns_mask[32] = {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
BIT(XB1_X), BIT(XB1_B), BIT(XB1_A), BIT(XB1_Y),
BIT(XB1_MENU), 0, 0, 0,
0, 0, BIT(XB1_LB), BIT(XB1_LJ),
0, BIT(XB1_VIEW), BIT(XB1_RB), BIT(XB1_RJ),
};

int32_t xbox_to_generic(struct bt_data *bt_data, struct generic_ctrl *ctrl_data) {
struct xb1_map *map = (struct xb1_map *)bt_data->input;

Expand Down Expand Up @@ -192,6 +203,10 @@ int32_t xbox_to_generic(struct bt_data *bt_data, struct generic_ctrl *ctrl_data)
ctrl_data->mask = (uint32_t *)xbox_xs_mask;
btns_mask = xbox_xs_btns_mask;
}
else if (bt_data->dev_subtype == BT_8BITDO_GBROS) {
ctrl_data->mask = (uint32_t *)xb1_mask;
btns_mask = gbros_btns_mask;
}
else {
ctrl_data->mask = (uint32_t *)xb1_mask;
btns_mask = xb1_dinput_btns_mask;
Expand Down
1 change: 1 addition & 0 deletions main/bluetooth/hci.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ static const struct bt_name_type bt_name_type[] = {
{"N64 Controller", BT_SW, BT_SW_N64, 0},
{"MD/Gen Control Pad", BT_SW, BT_SW_MD_GEN, BIT(BT_QUIRK_FACE_BTNS_INVERT)},
{"8Bitdo SF30", BT_HID_GENERIC, BT_SUBTYPE_DEFAULT, BIT(BT_QUIRK_FACE_BTNS_INVERT)},
{"8BitDo GBros Adapter", BT_XBOX, BT_8BITDO_GBROS, 0},
};

static const struct bt_hci_cp_set_event_filter clr_evt_filter = {
Expand Down

0 comments on commit aa3054f

Please sign in to comment.