From 3d97f51ff1355095489d922c75359bde6a45c27f Mon Sep 17 00:00:00 2001 From: Sainan Date: Tue, 3 Dec 2024 11:33:38 +0100 Subject: [PATCH] Add optional 'include_generics' parameter to hwGamepad::getAll --- soup/hwGamepad.cpp | 8 ++------ soup/hwGamepad.hpp | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/soup/hwGamepad.cpp b/soup/hwGamepad.cpp index 0c8c6050..ab7c8029 100644 --- a/soup/hwGamepad.cpp +++ b/soup/hwGamepad.cpp @@ -36,7 +36,7 @@ NAMESPACE_SOUP return false; } - std::vector hwGamepad::getAll() + std::vector hwGamepad::getAll(bool include_generics) { std::vector res{}; for (auto& hid : hwHid::getAll()) @@ -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; @@ -450,7 +448,6 @@ NAMESPACE_SOUP #else if (false) { } #endif -#if false else { //std::cout << string::bin2hex(report_data.toString()) << std::endl; @@ -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; diff --git a/soup/hwGamepad.hpp b/soup/hwGamepad.hpp index 8846c040..5a469c1a 100644 --- a/soup/hwGamepad.hpp +++ b/soup/hwGamepad.hpp @@ -65,7 +65,7 @@ NAMESPACE_SOUP } public: - [[nodiscard]] static std::vector getAll(); + [[nodiscard]] static std::vector 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.