hid: add list_connected_devices getter

This commit is contained in:
DH 2025-03-04 04:55:59 +03:00
parent 30c440699b
commit ee1b5c5340
2 changed files with 20 additions and 0 deletions

View file

@ -180,6 +180,25 @@ std::vector<pad_list_entry> hid_pad_handler<Device>::list_devices()
return pads_list;
}
template <class Device>
std::vector<pad_list_entry> hid_pad_handler<Device>::list_connected_devices()
{
std::vector<pad_list_entry> pads_list;
if (!Init())
return pads_list;
for (const auto& controller : m_controllers) // Controllers 1-n in GUI
{
if (controller.second != nullptr && controller.second->hidDevice != nullptr)
{
pads_list.emplace_back(controller.first, false);
}
}
return pads_list;
}
template <class Device>
void hid_pad_handler<Device>::enumerate_devices()
{

View file

@ -86,6 +86,7 @@ public:
bool Init() override;
void process() override;
std::vector<pad_list_entry> list_devices() override;
std::vector<pad_list_entry> list_connected_devices();
protected:
enum class DataStatus