From e6190ec2756fe99971f057621efc234680db79ec Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Wed, 6 Aug 2025 11:31:48 -0500 Subject: [PATCH] Store name in DreamCheekyController to avoid setting it in detector --- .../DreamCheekyController/DreamCheekyController.cpp | 8 +++++++- Controllers/DreamCheekyController/DreamCheekyController.h | 4 +++- .../DreamCheekyController/DreamCheekyControllerDetect.cpp | 3 +-- .../DreamCheekyController/RGBController_DreamCheeky.cpp | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Controllers/DreamCheekyController/DreamCheekyController.cpp b/Controllers/DreamCheekyController/DreamCheekyController.cpp index 203c4ed0..c7dea61c 100644 --- a/Controllers/DreamCheekyController/DreamCheekyController.cpp +++ b/Controllers/DreamCheekyController/DreamCheekyController.cpp @@ -13,10 +13,11 @@ #include "DreamCheekyController.h" #include "StringUtils.h" -DreamCheekyController::DreamCheekyController(hid_device* dev_handle, const char* path) +DreamCheekyController::DreamCheekyController(hid_device* dev_handle, const char* path, std::string dev_name) { dev = dev_handle; location = path; + name = dev_name; /*-----------------------------------------------------*\ | The Dream Cheeky Webmail Notifier requires four | @@ -43,6 +44,11 @@ std::string DreamCheekyController::GetDeviceLocation() return("HID: " + location); } +std::string DreamCheekyController::GetNameString() +{ + return(name); +} + std::string DreamCheekyController::GetSerialString() { wchar_t serial_string[128]; diff --git a/Controllers/DreamCheekyController/DreamCheekyController.h b/Controllers/DreamCheekyController/DreamCheekyController.h index b3ac4852..840da757 100644 --- a/Controllers/DreamCheekyController/DreamCheekyController.h +++ b/Controllers/DreamCheekyController/DreamCheekyController.h @@ -17,10 +17,11 @@ class DreamCheekyController { public: - DreamCheekyController(hid_device* dev_handle, const char* path); + DreamCheekyController(hid_device* dev_handle, const char* path, std::string dev_name); ~DreamCheekyController(); std::string GetDeviceLocation(); + std::string GetNameString(); std::string GetSerialString(); void SetColor(unsigned char red, unsigned char grn, unsigned char blu); @@ -28,4 +29,5 @@ public: private: hid_device* dev; std::string location; + std::string name; }; diff --git a/Controllers/DreamCheekyController/DreamCheekyControllerDetect.cpp b/Controllers/DreamCheekyController/DreamCheekyControllerDetect.cpp index 122e9de2..71f175e1 100644 --- a/Controllers/DreamCheekyController/DreamCheekyControllerDetect.cpp +++ b/Controllers/DreamCheekyController/DreamCheekyControllerDetect.cpp @@ -29,9 +29,8 @@ void DetectDreamCheekyControllers(hid_device_info* info, const std::string& name if(dev) { - DreamCheekyController* controller = new DreamCheekyController(dev, info->path); + DreamCheekyController* controller = new DreamCheekyController(dev, info->path, name); RGBController_DreamCheeky* rgb_controller = new RGBController_DreamCheeky(controller); - rgb_controller->name = name; ResourceManager::get()->RegisterRGBController(rgb_controller); } diff --git a/Controllers/DreamCheekyController/RGBController_DreamCheeky.cpp b/Controllers/DreamCheekyController/RGBController_DreamCheeky.cpp index b4e72897..cdb86fb7 100644 --- a/Controllers/DreamCheekyController/RGBController_DreamCheeky.cpp +++ b/Controllers/DreamCheekyController/RGBController_DreamCheeky.cpp @@ -15,7 +15,7 @@ RGBController_DreamCheeky::RGBController_DreamCheeky(DreamCheekyController* cont { controller = controller_ptr; - name = "Dream Cheeky Device"; + name = controller->GetNameString(); type = DEVICE_TYPE_ACCESSORY; vendor = "Dream Cheeky"; description = "Dream Cheeky Device";