diff --git a/main/adapter/adapter.h b/main/adapter/adapter.h index 1611ab27..73570156 100644 --- a/main/adapter/adapter.h +++ b/main/adapter/adapter.h @@ -286,6 +286,7 @@ enum { BT_QUIRK_8BITDO_M30, BT_QUIRK_BLUEN64_N64, BT_QUIRK_RF_WARRIOR, + BT_QUIRK_8BITDO_SATURN, }; /* Wired flags */ diff --git a/main/adapter/mapping_quirks.c b/main/adapter/mapping_quirks.c index a8747a2e..b8f20439 100644 --- a/main/adapter/mapping_quirks.c +++ b/main/adapter/mapping_quirks.c @@ -122,6 +122,16 @@ static void m30_8bitdo(struct raw_src_mapping *map) { map->axes_to_btns[TRIG_R] = PAD_RB_RIGHT; } +static void saturn_diy_8bitdo(struct raw_src_mapping *map) { + uint32_t tmp = map->btns_mask[PAD_LS]; + + map->btns_mask[PAD_LS] = map->btns_mask[PAD_RB_LEFT]; + map->btns_mask[PAD_RB_LEFT] = map->btns_mask[PAD_RB_DOWN]; + map->btns_mask[PAD_RB_DOWN] = map->btns_mask[PAD_RB_RIGHT]; + map->btns_mask[PAD_RB_RIGHT] = map->btns_mask[PAD_RS]; + map->btns_mask[PAD_RS] = tmp; +} + static void n64_bluen64(struct raw_src_mapping *map) { map->mask[0] = 0x23150FFF; map->desc[0] = 0x000000FF; @@ -171,6 +181,9 @@ void mapping_quirks_apply(struct bt_data *bt_data) { if (atomic_test_bit(&bt_data->base.flags[PAD], BT_QUIRK_8BITDO_M30)) { m30_8bitdo(&bt_data->raw_src_mappings[PAD]); } + if (atomic_test_bit(&bt_data->base.flags[PAD], BT_QUIRK_8BITDO_SATURN)) { + saturn_diy_8bitdo(&bt_data->raw_src_mappings[PAD]); + } if (atomic_test_bit(&bt_data->base.flags[PAD], BT_QUIRK_BLUEN64_N64)) { n64_bluen64(&bt_data->raw_src_mappings[PAD]); } diff --git a/main/bluetooth/hidp/hidp.c b/main/bluetooth/hidp/hidp.c index fea67154..504dd869 100644 --- a/main/bluetooth/hidp/hidp.c +++ b/main/bluetooth/hidp/hidp.c @@ -42,6 +42,7 @@ static const struct bt_name_type bt_name_type[] = { {"8BitDo GBros Adapter", BT_XBOX, BT_8BITDO_GBROS, 0}, {"8Bitdo N64 GamePad", BT_HID_GENERIC, BT_SUBTYPE_DEFAULT, BIT(BT_QUIRK_8BITDO_N64)}, {"8BitDo M30 gamepad", BT_XBOX, BT_XBOX_XINPUT, BIT(BT_QUIRK_8BITDO_M30)}, + {"8BitDo S30 Modkit", BT_XBOX, BT_XBOX_XINPUT, BIT(BT_QUIRK_8BITDO_SATURN)}, {"8Bitdo", BT_XBOX, BT_XBOX_XINPUT, 0}, /* 8bitdo catch all, tested with SF30 Pro */ {"Retro Bit Bluetooth Controller", BT_XBOX, BT_XBOX_XINPUT, BIT(BT_QUIRK_FACE_BTNS_TRIGGER_TO_6BUTTONS) | BIT(BT_QUIRK_TRIGGER_PRI_SEC_INVERT)}, {"Joy Controller", BT_XBOX, BT_XBOX_XINPUT, BIT(BT_QUIRK_RF_WARRIOR)},