Store name in SonyDualSenseController to avoid setting it in detector
This commit is contained in:
parent
517287117b
commit
840512751c
4 changed files with 47 additions and 37 deletions
|
|
@ -27,7 +27,7 @@ RGBController_SonyDualSense::RGBController_SonyDualSense(SonyDualSenseController
|
|||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "Sony DualSense";
|
||||
name = controller->GetName();
|
||||
|
||||
if(controller->IsBluetooth())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,10 +15,11 @@
|
|||
#include "SonyDualSenseController.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
SonyDualSenseController::SonyDualSenseController(hid_device * device_handle, const char * device_path, bool is_bluetooth)
|
||||
SonyDualSenseController::SonyDualSenseController(hid_device * device_handle, const char * device_path, bool is_bluetooth, std::string dev_name)
|
||||
{
|
||||
dev = device_handle;
|
||||
location = device_path;
|
||||
name = dev_name;
|
||||
this->is_bluetooth = is_bluetooth;
|
||||
}
|
||||
|
||||
|
|
@ -32,6 +33,11 @@ std::string SonyDualSenseController::GetLocation()
|
|||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string SonyDualSenseController::GetName()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string SonyDualSenseController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
|
|
|
|||
|
|
@ -34,10 +34,11 @@ enum
|
|||
class SonyDualSenseController
|
||||
{
|
||||
public:
|
||||
SonyDualSenseController(hid_device * device_handle, const char * device_path, bool is_bluetooth);
|
||||
SonyDualSenseController(hid_device * device_handle, const char * device_path, bool is_bluetooth, std::string dev_name);
|
||||
~SonyDualSenseController();
|
||||
|
||||
std::string GetLocation();
|
||||
std::string GetName();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SetColors(std::vector<RGBColor> colors, unsigned char brightness, unsigned char mode_value);
|
||||
|
|
@ -46,5 +47,6 @@ public:
|
|||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
bool is_bluetooth;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,11 +28,12 @@
|
|||
void DetectSonyDS4Controllers(hid_device_info* info, const std::string&)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
SonyDS4Controller* controller = new SonyDS4Controller(dev, info->path);
|
||||
RGBController_SonyDS4* rgb_controller = new RGBController_SonyDS4(controller);
|
||||
// Constructor sets the name
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
|
@ -40,12 +41,13 @@ void DetectSonyDS4Controllers(hid_device_info* info, const std::string&)
|
|||
void DetectSonyDualSenseControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
bool is_bluetooth = info->interface_number == -1;
|
||||
SonyDualSenseController* controller = new SonyDualSenseController(dev, info->path, is_bluetooth);
|
||||
SonyDualSenseController* controller = new SonyDualSenseController(dev, info->path, is_bluetooth, name);
|
||||
RGBController_SonyDualSense* rgb_controller = new RGBController_SonyDualSense(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue