From fd597b046286b2d3d02ea032e60780da3dce29c3 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Sun, 8 Feb 2026 15:58:40 -0600 Subject: [PATCH] Rework API interface passed into plugins from ResourceManagerInterface to OpenRGBPluginAPIInterface --- LogManager.cpp | 7 +- LogManager.h | 4 +- OpenRGB.pro | 1 + OpenRGBPluginAPI.cpp | 134 +++++++++++++++++++++++++++++++++++++++ OpenRGBPluginAPI.h | 66 +++++++++++++++++++ OpenRGBPluginInterface.h | 68 ++++++++++++++++---- PluginManager.cpp | 93 ++++++++++++++++++++++++--- PluginManager.h | 40 ++++++++++-- PluginManagerInterface.h | 40 ++++++++---- ResourceManager.cpp | 13 ++++ 10 files changed, 424 insertions(+), 42 deletions(-) create mode 100644 OpenRGBPluginAPI.cpp create mode 100644 OpenRGBPluginAPI.h diff --git a/LogManager.cpp b/LogManager.cpp index 8542e07c8..fbef70015 100644 --- a/LogManager.cpp +++ b/LogManager.cpp @@ -239,8 +239,10 @@ void LogManager::flush() _flush(); } -void LogManager::_append(const char* filename, int line, unsigned int level, const char* fmt, va_list va) +void LogManager::append_va(const char* filename, int line, unsigned int level, const char* fmt, va_list va) { + std::lock_guard grd(entry_mutex); + /*-----------------------------------------------------*\ | If a critical message occurs, enable source | | printing and set loglevel and verbosity to highest | @@ -333,8 +335,7 @@ void LogManager::append(const char* filename, int line, unsigned int level, cons va_list va; va_start(va, fmt); - std::lock_guard grd(entry_mutex); - _append(filename, line, level, fmt, va); + append_va(filename, line, level, fmt, va); va_end(va); } diff --git a/LogManager.h b/LogManager.h index 13a6410e5..1f37f08e8 100644 --- a/LogManager.h +++ b/LogManager.h @@ -85,9 +85,6 @@ private: //Clock from LogManager creation std::chrono::time_point base_clock; - // A non-guarded append() - void _append(const char* filename, int line, unsigned int level, const char* fmt, va_list va); - // A non-guarded flush() void _flush(); @@ -98,6 +95,7 @@ public: void configure(json config, const filesystem::path & defaultDir); void flush(); void append(const char* filename, int line, unsigned int level, const char* fmt, ...); + void append_va(const char* filename, int line, unsigned int level, const char* fmt, va_list va); void setLoglevel(unsigned int); void setVerbosity(unsigned int); void setPrintSource(bool); diff --git a/OpenRGB.pro b/OpenRGB.pro index 2cdaaf4b7..0909daa9c 100644 --- a/OpenRGB.pro +++ b/OpenRGB.pro @@ -242,6 +242,7 @@ SOURCES += NetworkClient.cpp \ NetworkProtocol.cpp \ NetworkServer.cpp \ + OpenRGBPluginAPI.cpp \ PluginManager.cpp \ ProfileManager.cpp \ ResourceManager.cpp \ diff --git a/OpenRGBPluginAPI.cpp b/OpenRGBPluginAPI.cpp new file mode 100644 index 000000000..b789ac3a6 --- /dev/null +++ b/OpenRGBPluginAPI.cpp @@ -0,0 +1,134 @@ +/*---------------------------------------------------------*\ +| OpenRGBPluginAPI.cpp | +| | +| Interface for OpenRGB plugins to call OpenRGB functions | +| | +| Adam Honse (CalcProgrammer1) 08 Feb 2026 | +| | +| This file is part of the OpenRGB project | +| SPDX-License-Identifier: GPL-2.0-or-later | +\*---------------------------------------------------------*/ + +#include "OpenRGBPluginAPI.h" + +OpenRGBPluginAPI::OpenRGBPluginAPI(std::vector & rgb_controllers_ref) : rgb_controllers(rgb_controllers_ref) +{ + log_manager = ResourceManager::get()->GetLogManager(); + plugin_manager = ResourceManager::get()->GetPluginManager(); + profile_manager = ResourceManager::get()->GetProfileManager(); + resource_manager = ResourceManager::get(); + settings_manager = ResourceManager::get()->GetSettingsManager(); +} + +/*---------------------------------------------------------*\ +| LogManager APIs | +\*---------------------------------------------------------*/ +void OpenRGBPluginAPI::append(const char* filename, int line, unsigned int level, const char* fmt, ...) +{ + va_list va; + va_start(va, fmt); + + log_manager->append_va(filename, line, level, fmt, va); + + va_end(va); +} + +/*---------------------------------------------------------*\ +| PluginManager APIs | +\*---------------------------------------------------------*/ +void OpenRGBPluginAPI::RegisterRGBController(RGBController * rgb_controller) +{ + LOG_INFO("[PluginManager] Registering RGB controller %s", rgb_controller->GetName().c_str()); + + /*-----------------------------------------------------*\ + | Mark this controller as locally owned | + \*-----------------------------------------------------*/ + rgb_controller->flags &= ~CONTROLLER_FLAG_REMOTE; + rgb_controller->flags |= CONTROLLER_FLAG_LOCAL; + + /*-----------------------------------------------------*\ + | Add the new controller to the list | + \*-----------------------------------------------------*/ + rgb_controllers.push_back(rgb_controller); + +} + +void OpenRGBPluginAPI::UnregisterRGBController(RGBController * rgb_controller) +{ + LOG_INFO("[PluginManager] Unregistering RGB controller %s", rgb_controller->GetName().c_str()); + + /*-----------------------------------------------------*\ + | Clear callbacks from the controller before removal | + \*-----------------------------------------------------*/ + rgb_controller->ClearCallbacks(); + + /*-----------------------------------------------------*\ + | Find the controller to remove and remove it from the | + | master list | + \*-----------------------------------------------------*/ + std::vector::iterator rgb_it = std::find(rgb_controllers.begin(), rgb_controllers.end(), rgb_controller); + + if(rgb_it != rgb_controllers.end()) + { + rgb_controllers.erase(rgb_it); + } +} + +/*---------------------------------------------------------*\ +| ProfileManager APIs | +\*---------------------------------------------------------*/ +void OpenRGBPluginAPI::ClearActiveProfile() +{ + profile_manager->ClearActiveProfile(); +} + +/*---------------------------------------------------------*\ +| ResourceManager APIs | +\*---------------------------------------------------------*/ +filesystem::path OpenRGBPluginAPI::GetConfigurationDirectory() +{ + return(resource_manager->GetConfigurationDirectory()); +} + +bool OpenRGBPluginAPI::GetDetectionEnabled() +{ + return(resource_manager->GetDetectionEnabled()); +} + +unsigned int OpenRGBPluginAPI::GetDetectionPercent() +{ + return(resource_manager->GetDetectionPercent()); +} + +std::string OpenRGBPluginAPI::GetDetectionString() +{ + return(resource_manager->GetDetectionString()); +} + +void OpenRGBPluginAPI::WaitForDetection() +{ + resource_manager->WaitForDetection(); +} + +std::vector & OpenRGBPluginAPI::GetRGBControllers() +{ + return(resource_manager->GetRGBControllers()); +} + +/*---------------------------------------------------------*\ +| SettingsManager APIs | +\*---------------------------------------------------------*/ +nlohmann::json OpenRGBPluginAPI::GetSettings(std::string settings_key) +{ + return(settings_manager->GetSettings(settings_key)); +} + +void OpenRGBPluginAPI::SaveSettings() +{ + settings_manager->SaveSettings(); +} + +void OpenRGBPluginAPI::SetSettings(std::string settings_key, nlohmann::json new_settings) +{ + settings_manager->SetSettings(settings_key, new_settings); +} diff --git a/OpenRGBPluginAPI.h b/OpenRGBPluginAPI.h new file mode 100644 index 000000000..eeb3f06d6 --- /dev/null +++ b/OpenRGBPluginAPI.h @@ -0,0 +1,66 @@ +/*---------------------------------------------------------*\ +| OpenRGBPluginAPI.h | +| | +| Interface for OpenRGB plugins to call OpenRGB functions | +| | +| Adam Honse (CalcProgrammer1) 08 Feb 2026 | +| | +| This file is part of the OpenRGB project | +| SPDX-License-Identifier: GPL-2.0-or-later | +\*---------------------------------------------------------*/ + +#pragma once + +#include "LogManager.h" +#include "OpenRGBPluginInterface.h" +#include "PluginManagerInterface.h" +#include "ProfileManager.h" +#include "ResourceManager.h" +#include "SettingsManager.h" + +class OpenRGBPluginAPI : public OpenRGBPluginAPIInterface +{ +public: + OpenRGBPluginAPI(std::vector & rgb_controllers_ref); + + /*-----------------------------------------------------*\ + | LogManager APIs | + \*-----------------------------------------------------*/ + void append(const char* filename, int line, unsigned int level, const char* fmt, ...); + + /*-----------------------------------------------------*\ + | PluginManager APIs | + \*-----------------------------------------------------*/ + void RegisterRGBController(RGBController * rgb_controller); + void UnregisterRGBController(RGBController * rgb_controller); + + /*-----------------------------------------------------*\ + | ProfileManager APIs | + \*-----------------------------------------------------*/ + void ClearActiveProfile(); + + /*-----------------------------------------------------*\ + | ResourceManager APIs | + \*-----------------------------------------------------*/ + filesystem::path GetConfigurationDirectory(); + bool GetDetectionEnabled(); + unsigned int GetDetectionPercent(); + std::string GetDetectionString(); + void WaitForDetection(); + std::vector & GetRGBControllers(); + + /*-----------------------------------------------------*\ + | SettingsManager APIs | + \*-----------------------------------------------------*/ + nlohmann::json GetSettings(std::string settings_key); + void SaveSettings(); + void SetSettings(std::string settings_key, nlohmann::json new_settings); + +private: + std::vector & rgb_controllers; + LogManager * log_manager; + PluginManagerInterface * plugin_manager; + ProfileManager * profile_manager; + ResourceManager * resource_manager; + SettingsManager * settings_manager; +}; diff --git a/OpenRGBPluginInterface.h b/OpenRGBPluginInterface.h index a32084ac7..419f9b6c1 100644 --- a/OpenRGBPluginInterface.h +++ b/OpenRGBPluginInterface.h @@ -16,7 +16,8 @@ #include #include #include "nlohmann/json.hpp" -#include "ResourceManagerInterface.h" +#include "filesystem.h" +#include "RGBController.h" #define OpenRGBPluginInterface_IID "com.OpenRGBPluginInterface" @@ -70,28 +71,71 @@ struct OpenRGBPluginInfo unsigned int ProtocolVersion;/* Plugin SDK protocol version */ }; +class OpenRGBPluginAPIInterface +{ +public: + /*-----------------------------------------------------*\ + | LogManager APIs | + \*-----------------------------------------------------*/ + virtual void append(const char* filename, int line, unsigned int level, const char* fmt, ...) = 0; + + /*-----------------------------------------------------*\ + | PluginManager APIs | + \*-----------------------------------------------------*/ + virtual void RegisterRGBController(RGBController * controller) = 0; + virtual void UnregisterRGBController(RGBController * controller) = 0; + + /*-----------------------------------------------------*\ + | ProfileManager APIs | + \*-----------------------------------------------------*/ + virtual void ClearActiveProfile() = 0; + + /*-----------------------------------------------------*\ + | ResourceManager APIs | + \*-----------------------------------------------------*/ + virtual filesystem::path GetConfigurationDirectory() = 0; + virtual bool GetDetectionEnabled() = 0; + virtual unsigned int GetDetectionPercent() = 0; + virtual std::string GetDetectionString() = 0; + virtual void WaitForDetection() = 0; + virtual std::vector & GetRGBControllers() = 0; + + /*-----------------------------------------------------*\ + | SettingsManager APIs | + \*-----------------------------------------------------*/ + virtual nlohmann::json GetSettings(std::string settings_key) = 0; + virtual void SaveSettings() = 0; + virtual void SetSettings(std::string settings_key, nlohmann::json new_settings) = 0; +}; + class OpenRGBPluginInterface { public: - virtual ~OpenRGBPluginInterface() {} + virtual ~OpenRGBPluginInterface() {} /*-----------------------------------------------------*\ | Plugin Information | \*-----------------------------------------------------*/ - virtual OpenRGBPluginInfo GetPluginInfo() = 0; - virtual unsigned int GetPluginAPIVersion() = 0; + virtual OpenRGBPluginInfo GetPluginInfo() = 0; + virtual unsigned int GetPluginAPIVersion() = 0; /*-----------------------------------------------------*\ | Plugin Functionality | \*-----------------------------------------------------*/ - virtual void Load(ResourceManagerInterface* resource_manager_ptr) = 0; - virtual QWidget* GetWidget() = 0; - virtual QMenu* GetTrayMenu() = 0; - virtual void Unload() = 0; - virtual void OnProfileAboutToLoad() = 0; - virtual void OnProfileLoad(nlohmann::json profile_data) = 0; - virtual nlohmann::json OnProfileSave() = 0; - virtual unsigned char* OnSDKCommand(unsigned int pkt_id, unsigned char * pkt_data, unsigned int *pkt_size) = 0; + virtual void Load(OpenRGBPluginAPIInterface* plugin_api_ptr) = 0; + virtual QWidget* GetWidget() = 0; + virtual QMenu* GetTrayMenu() = 0; + virtual void Unload() = 0; + virtual void OnProfileAboutToLoad() = 0; + virtual void OnProfileLoad(nlohmann::json profile_data) = 0; + virtual nlohmann::json OnProfileSave() = 0; + virtual unsigned char* OnSDKCommand(unsigned int pkt_id, unsigned char * pkt_data, unsigned int *pkt_size) = 0; + + /*-----------------------------------------------------*\ + | Update Signals | + \*-----------------------------------------------------*/ + virtual void ProfileManagerUpdated(unsigned int update_reason) = 0; + virtual void ResourceManagerUpdated(unsigned int update_reason) = 0; }; Q_DECLARE_INTERFACE(OpenRGBPluginInterface, OpenRGBPluginInterface_IID) diff --git a/PluginManager.cpp b/PluginManager.cpp index 950085c29..9eb48870c 100644 --- a/PluginManager.cpp +++ b/PluginManager.cpp @@ -10,7 +10,7 @@ #include "LogManager.h" #include "filesystem.h" #include "PluginManager.h" -#include "OpenRGBThemeManager.h" +#include "OpenRGBPluginAPI.h" #include "SettingsManager.h" #include "ResourceManager.h" @@ -18,22 +18,51 @@ #include #endif +void PluginManagerProfileManagerCallback(void * this_ptr, unsigned int update_reason) +{ + PluginManager * this_obj = (PluginManager *)this_ptr; + + this_obj->ProfileManagerCallback(update_reason); +} + +void PluginManagerResourceManagerCallback(void * this_ptr, unsigned int update_reason) +{ + PluginManager * this_obj = (PluginManager *)this_ptr; + + this_obj->ResourceManagerCallback(update_reason); +} + PluginManager::PluginManager() { - /*---------------------------------------------------------*\ - | Initialize plugin manager class variables | - \*---------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Initialize plugin manager class variables | + \*-----------------------------------------------------*/ AddPluginCallbackVal = nullptr; AddPluginCallbackArg = nullptr; RemovePluginCallbackVal = nullptr; RemovePluginCallbackArg = nullptr; - /*-------------------------------------------------------------------------*\ - | Create OpenRGB plugins directory | - \*-------------------------------------------------------------------------*/ + /*-----------------------------------------------------*\ + | Create OpenRGB plugins directory | + \*-----------------------------------------------------*/ filesystem::path plugins_dir = ResourceManager::get()->GetConfigurationDirectory() / plugins_path; filesystem::create_directories(plugins_dir); + + /*-----------------------------------------------------*\ + | Register callbacks | + \*-----------------------------------------------------*/ + ResourceManager::get()->GetProfileManager()->RegisterProfileManagerCallback(PluginManagerProfileManagerCallback, this); + ResourceManager::get()->RegisterResourceManagerCallback(PluginManagerResourceManagerCallback, this); +} + +PluginManager::~PluginManager() +{ + /*-----------------------------------------------------*\ + | Unegister callbacks | + \*-----------------------------------------------------*/ + ResourceManager::get()->GetProfileManager()->RegisterProfileManagerCallback(PluginManagerProfileManagerCallback, this); + ResourceManager::get()->RegisterResourceManagerCallback(PluginManagerResourceManagerCallback, this); } void PluginManager::RegisterAddPluginCallback(AddPluginCallback new_callback, void * new_callback_arg) @@ -268,6 +297,7 @@ void PluginManager::AddPlugin(const filesystem::path& path, bool is_system) entry.info = info; entry.plugin = plugin; + entry.api = new OpenRGBPluginAPI(entry.controllers); entry.loader = loader; entry.path = path_string; entry.enabled = enabled; @@ -304,6 +334,7 @@ void PluginManager::AddPlugin(const filesystem::path& path, bool is_system) entry.info = info; entry.plugin = plugin; + entry.api = new OpenRGBPluginAPI(entry.controllers); entry.loader = loader; entry.path = path_string; entry.enabled = false; @@ -435,7 +466,7 @@ void PluginManager::LoadPlugin(OpenRGBPluginEntry* plugin_entry) { plugin_entry->plugin = plugin; - plugin->Load(ResourceManager::get()); + plugin->Load(plugin_entry->api); /*-------------------------------------------------*\ | Call the Add Plugin callback | @@ -600,6 +631,34 @@ unsigned char * PluginManager::OnSDKCommand(unsigned int plugin_idx, unsigned in return(out_data); } +/*---------------------------------------------------------*\ +| Callback functions | +\*---------------------------------------------------------*/ +void PluginManager::ProfileManagerCallback(unsigned int update_reason) +{ + for(std::size_t plugin_idx = 0; plugin_idx < ActivePlugins.size(); plugin_idx++) + { + if(ActivePlugins[plugin_idx].enabled && ActivePlugins[plugin_idx].loader->isLoaded()) + { + ActivePlugins[plugin_idx].plugin->ProfileManagerUpdated(update_reason); + } + } +} + +void PluginManager::ResourceManagerCallback(unsigned int update_reason) +{ + for(std::size_t plugin_idx = 0; plugin_idx < ActivePlugins.size(); plugin_idx++) + { + if(ActivePlugins[plugin_idx].enabled && ActivePlugins[plugin_idx].loader->isLoaded()) + { + ActivePlugins[plugin_idx].plugin->ResourceManagerUpdated(update_reason); + } + } +} + +/*---------------------------------------------------------*\ +| Plugin Information | +\*---------------------------------------------------------*/ unsigned int PluginManager::GetPluginCount() { return(ActivePlugins.size()); @@ -656,3 +715,21 @@ std::string PluginManager::GetPluginVersion(unsigned int plugin_idx) return(""); } + +/*---------------------------------------------------------*\ +| Plugin-Created RGBControllers | +\*---------------------------------------------------------*/ +std::vector PluginManager::GetRGBControllers() +{ + std::vector plugin_controllers; + + for(std::size_t plugin_idx = 0; plugin_idx < ActivePlugins.size(); plugin_idx++) + { + if(ActivePlugins[plugin_idx].enabled && ActivePlugins[plugin_idx].loader->isLoaded()) + { + // build list of plugin-provided controllers here + } + } + + return(plugin_controllers); +} diff --git a/PluginManager.h b/PluginManager.h index 081938637..659a5261b 100644 --- a/PluginManager.h +++ b/PluginManager.h @@ -22,6 +22,8 @@ struct OpenRGBPluginEntry { OpenRGBPluginInfo info; OpenRGBPluginInterface* plugin; + OpenRGBPluginAPIInterface* api; + std::vector controllers; QPluginLoader* loader; QWidget* widget; QMenu* traymenu; @@ -39,18 +41,33 @@ class PluginManager : public PluginManagerInterface { public: PluginManager(); + ~PluginManager(); - unsigned int GetPluginCount(); - std::string GetPluginDescription(unsigned int plugin_idx); - std::string GetPluginName(unsigned int plugin_idx); - unsigned int GetPluginProtocolVersion(unsigned int plugin_idx); - std::string GetPluginVersion(unsigned int plugin_idx); + /*-----------------------------------------------------*\ + | Plugin Information | + \*-----------------------------------------------------*/ + unsigned int GetPluginCount(); + std::string GetPluginDescription(unsigned int plugin_idx); + std::string GetPluginName(unsigned int plugin_idx); + unsigned int GetPluginProtocolVersion(unsigned int plugin_idx); + std::string GetPluginVersion(unsigned int plugin_idx); + /*-----------------------------------------------------*\ + | Plugin-Created RGBControllers | + \*-----------------------------------------------------*/ + std::vector GetRGBControllers(); + + /*-----------------------------------------------------*\ + | PluginManager Callback Registration | + \*-----------------------------------------------------*/ void RegisterAddPluginCallback(AddPluginCallback new_callback, void * new_callback_arg); void RegisterRemovePluginCallback(RemovePluginCallback new_callback, void * new_callback_arg); void ScanAndLoadPlugins(); + /*-----------------------------------------------------*\ + | Plugin Management | + \*-----------------------------------------------------*/ void AddPlugin(const filesystem::path& path, bool is_system); void RemovePlugin(const filesystem::path& path); @@ -60,11 +77,24 @@ public: void LoadPlugins(); void UnloadPlugins(); + /*-----------------------------------------------------*\ + | Plugin Profile Integration | + \*-----------------------------------------------------*/ void OnProfileAboutToLoad(); void OnProfileLoad(nlohmann::json profile_data); nlohmann::json OnProfileSave(); + + /*-----------------------------------------------------*\ + | Plugin SDK Integration | + \*-----------------------------------------------------*/ unsigned char * OnSDKCommand(unsigned int plugin_idx, unsigned int pkt_id, unsigned char * pkt_data, unsigned int * pkt_size); + /*-----------------------------------------------------*\ + | Callback functions | + \*-----------------------------------------------------*/ + void ProfileManagerCallback(unsigned int update_reason); + void ResourceManagerCallback(unsigned int update_reason); + std::vector ActivePlugins; private: diff --git a/PluginManagerInterface.h b/PluginManagerInterface.h index f61858cb5..416479b50 100644 --- a/PluginManagerInterface.h +++ b/PluginManagerInterface.h @@ -17,17 +17,35 @@ class PluginManagerInterface { public: - virtual unsigned int GetPluginCount() = 0; - virtual std::string GetPluginDescription(unsigned int plugin_idx) = 0; - virtual std::string GetPluginName(unsigned int plugin_idx) = 0; - virtual unsigned int GetPluginProtocolVersion(unsigned int plugin_idx) = 0; - virtual std::string GetPluginVersion(unsigned int plugin_idx) = 0; + /*-----------------------------------------------------*\ + | Plugin Information | + \*-----------------------------------------------------*/ + virtual unsigned int GetPluginCount() = 0; + virtual std::string GetPluginDescription(unsigned int plugin_idx) = 0; + virtual std::string GetPluginName(unsigned int plugin_idx) = 0; + virtual unsigned int GetPluginProtocolVersion(unsigned int plugin_idx) = 0; + virtual std::string GetPluginVersion(unsigned int plugin_idx) = 0; - virtual void LoadPlugins() = 0; - virtual void UnloadPlugins() = 0; + /*-----------------------------------------------------*\ + | Plugin-Created RGBControllers | + \*-----------------------------------------------------*/ + virtual std::vector GetRGBControllers() = 0; - virtual void OnProfileAboutToLoad() = 0; - virtual void OnProfileLoad(nlohmann::json profile_data) = 0; - virtual nlohmann::json OnProfileSave() = 0; - virtual unsigned char * OnSDKCommand(unsigned int plugin_idx, unsigned int pkt_id, unsigned char * pkt_data, unsigned int * pkt_size) = 0; + /*-----------------------------------------------------*\ + | Plugin Management | + \*-----------------------------------------------------*/ + virtual void LoadPlugins() = 0; + virtual void UnloadPlugins() = 0; + + /*-----------------------------------------------------*\ + | Plugin Profile Integration | + \*-----------------------------------------------------*/ + virtual void OnProfileAboutToLoad() = 0; + virtual void OnProfileLoad(nlohmann::json profile_data) = 0; + virtual nlohmann::json OnProfileSave() = 0; + + /*-----------------------------------------------------*\ + | Plugin SDK Integration | + \*-----------------------------------------------------*/ + virtual unsigned char * OnSDKCommand(unsigned int plugin_idx, unsigned int pkt_id, unsigned char * pkt_data, unsigned int * pkt_size) = 0; }; diff --git a/ResourceManager.cpp b/ResourceManager.cpp index b2bb1f9fa..4c917dee2 100644 --- a/ResourceManager.cpp +++ b/ResourceManager.cpp @@ -465,6 +465,19 @@ void ResourceManager::UpdateDeviceList() rgb_controllers.push_back(rgb_controllers_hw[rgb_controller_idx]); } + /*-----------------------------------------------------*\ + | Insert plugin controllers into controller list | + \*-----------------------------------------------------*/ + if(plugin_manager) + { + std::vector rgb_controllers_plugins = plugin_manager->GetRGBControllers(); + + for(std::size_t rgb_controller_idx = 0; rgb_controller_idx < rgb_controllers_hw.size(); rgb_controller_idx++) + { + rgb_controllers.push_back(rgb_controllers_plugins[rgb_controller_idx]); + } + } + /*-----------------------------------------------------*\ | Insert client controllers into controller list | \*-----------------------------------------------------*/