GAMEPAD: add 8Bitdo support
@@ -14,6 +14,7 @@ int xbox_count = 0;
int ds4_count = 0;
int ds5_count = 0;
int switch_count = 0;
+int bitdo_count = 0;
std::string xbox_paths [2]{"gip","xpadneo"};
bool operator<(const gamepad& a, const gamepad& b)
@@ -29,6 +30,7 @@ void gamepad_update(){
ds4_count = 0;
ds5_count = 0;
switch_count = 0;
+ bitdo_count = 0;
for (auto &p : fs::directory_iterator(path)) {
string fileName = p.path().filename();
//CHECK XONE AND XPADNEO DEVICES
@@ -56,6 +58,12 @@ void gamepad_update(){
gamepad_found = true;
switch_count += 1;
}
+ //CHECK * BITDO DEVICES
+ if (fileName.find("hid-e4") != std::string::npos) {
+ list.push_back(p.path());
+ gamepad_found = true;
+ bitdo_count += 1;
+ }
}
}
@@ -67,6 +75,7 @@ void gamepad_info () {
int ds4_counter = 0;
int ds5_counter = 0;
int switch_counter = 0;
+ int bitdo_counter = 0;
for (auto &path : list ) {
//Set devices paths
@@ -80,7 +89,7 @@ void gamepad_info () {
gamepad_data.push_back(gamepad());
- //Xone nad xpadneo devices
+ //Xone and xpadneo devices
if (path.find("gip") != std::string::npos || path.find("xpadneo") != std::string::npos) {
if (xbox_count == 1 )
gamepad_data[gamepad_count].name = "XBOX PAD";
@@ -112,6 +121,14 @@ void gamepad_info () {
gamepad_data[gamepad_count].name = "SWITCH PAD-" + to_string(switch_counter + 1);
switch_counter++;
}
+ //8bitdo devices
+ if (path.find("hid-e4") != std::string::npos) {
+ if (switch_count == 1)
+ gamepad_data[gamepad_count].name = "8BITDO PAD";
+ else
+ gamepad_data[gamepad_count].name = "8BITDO PAD-" + to_string(switch_counter + 1);
+ bitdo_counter++;
+ }
//Get device status
if (std::getline(input_status, line))
gamepad_data[gamepad_count].state = line;
