Skip to content

Commit

Permalink
Add optional 'include_generics' parameter to hwGamepad::getAll
Browse files Browse the repository at this point in the history
  • Loading branch information
Sainan committed Dec 3, 2024
1 parent 1568eae commit 3d97f51
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 2 additions & 6 deletions soup/hwGamepad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ NAMESPACE_SOUP
return false;
}

std::vector<hwGamepad> hwGamepad::getAll()
std::vector<hwGamepad> hwGamepad::getAll(bool include_generics)
{
std::vector<hwGamepad> res{};
for (auto& hid : hwHid::getAll())
Expand Down Expand Up @@ -72,12 +72,10 @@ NAMESPACE_SOUP
bool is_bluetooth = !hid.sendReport(std::move(buf));
res.emplace_back("Stadia Controller", std::move(hid)).stadia.is_bluetooth = is_bluetooth;
}
#if false // Generic HID Gamepad support is pretty bad right now.
else
else if (include_generics)
{
res.emplace_back(nullptr, std::move(hid));
}
#endif
}
}
return res;
Expand Down Expand Up @@ -450,7 +448,6 @@ NAMESPACE_SOUP
#else
if (false) { }
#endif
#if false
else
{
//std::cout << string::bin2hex(report_data.toString()) << std::endl;
Expand Down Expand Up @@ -517,7 +514,6 @@ NAMESPACE_SOUP
status.buttons[BTN_RTRIGGER] = report.active_selectors.count({ 9, 0x13 }) != 0;
status.buttons[BTN_LTRIGGER] = report.active_selectors.count({ 9, 0x14 }) != 0;
}
#endif
}

return status;
Expand Down
2 changes: 1 addition & 1 deletion soup/hwGamepad.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ NAMESPACE_SOUP
}

public:
[[nodiscard]] static std::vector<hwGamepad> getAll();
[[nodiscard]] static std::vector<hwGamepad> getAll(bool include_generics = false);

// Some gamepads pretty much always have something to report,
// but the assumption should be that receiveStatus will block until the user causes a status update.
Expand Down

0 comments on commit 3d97f51

Please sign in to comment.