Use RGBControllerInterface for plugin API

This commit is contained in:
Adam Honse
2026-05-16 16:54:49 -05:00
parent c11090a4cf
commit ce4d2b1d78
27 changed files with 1393 additions and 1031 deletions

View File

@@ -18,6 +18,11 @@
#include <Windows.h>
#endif
/*---------------------------------------------------------*\
| PluginManager name for log entries |
\*---------------------------------------------------------*/
const char* PLUGINMANAGER = "PluginManager";
void PluginManagerProfileManagerCallback(void * this_ptr, unsigned int update_reason)
{
PluginManager * this_obj = (PluginManager *)this_ptr;
@@ -88,35 +93,36 @@ void PluginManager::RegisterRemovePluginCallback(RemovePluginCallback new_callba
void PluginManager::ScanAndLoadPlugins()
{
/*---------------------------------------------------------*\
| Get the user plugins directory |
| |
| The user plugins directory is a directory named "plugins" |
| in the configuration directory |
\*---------------------------------------------------------*/
/*-----------------------------------------------------*\
| Get the user plugins directory |
| |
| The user plugins directory is a directory named |
| "plugins" in the configuration directory |
\*-----------------------------------------------------*/
filesystem::path plugins_dir = ResourceManager::get()->GetConfigurationDirectory() / plugins_path;
ScanAndLoadPluginsFrom(plugins_dir, false);
#ifdef OPENRGB_SYSTEM_PLUGIN_DIRECTORY
/*---------------------------------------------------------*\
| Get the system plugins directory |
| |
| The system plugin directory can be set during build time, |
| e.g. by the package maintainer to load plugins installed |
| via package manager |
\*---------------------------------------------------------*/
/*-----------------------------------------------------*\
| Get the system plugins directory |
| |
| The system plugin directory can be set during build |
| time, e.g. by the package maintainer to load plugins |
| installed via package manager |
\*-----------------------------------------------------*/
ScanAndLoadPluginsFrom(OPENRGB_SYSTEM_PLUGIN_DIRECTORY, true);
#endif
#ifdef _WIN32
/*---------------------------------------------------------*\
| Get the exe folder plugins directory (Windows) |
| |
| On Windows, system plugins are located in a folder called |
| "plugins" inside the folder where the OpenRGB.exe file is |
| installed. Typically, C:\Program Files\OpenRGB but other |
| install paths are allowed. |
\*---------------------------------------------------------*/
/*-----------------------------------------------------*\
| Get the exe folder plugins directory (Windows) |
| |
| On Windows, system plugins are located in a folder |
| called "plugins" inside the folder where the |
| OpenRGB.exe file is installed. Typically, |
| C:\Program Files\OpenRGB but other install paths are |
| allowed. |
\*-----------------------------------------------------*/
char path[MAX_PATH];
GetModuleFileName(NULL, path, MAX_PATH);
@@ -131,11 +137,11 @@ void PluginManager::ScanAndLoadPluginsFrom(const filesystem::path & plugins_dir,
{
if(is_system)
{
LOG_TRACE("[PluginManager] Scanning system plugin directory: %s", plugins_dir.generic_u8string().c_str());
LOG_TRACE("[%s] Scanning system plugin directory: %s", PLUGINMANAGER, plugins_dir.generic_u8string().c_str());
}
else
{
LOG_TRACE("[PluginManager] Scanning user plugin directory: %s", plugins_dir.generic_u8string().c_str());
LOG_TRACE("[%s] Scanning user plugin directory: %s", PLUGINMANAGER, plugins_dir.generic_u8string().c_str());
}
if(!filesystem::is_directory(plugins_dir))
@@ -143,10 +149,9 @@ void PluginManager::ScanAndLoadPluginsFrom(const filesystem::path & plugins_dir,
return;
}
/*---------------------------------------------------------*\
| Get a list of all files in the plugins directory |
\*---------------------------------------------------------*/
/*-----------------------------------------------------*\
| Get a list of all files in the plugins directory |
\*-----------------------------------------------------*/
for(const filesystem::directory_entry& entry: filesystem::directory_iterator(plugins_dir))
{
if(filesystem::is_directory(entry.path()))
@@ -155,42 +160,40 @@ void PluginManager::ScanAndLoadPluginsFrom(const filesystem::path & plugins_dir,
}
filesystem::path plugin_path = entry.path();
LOG_TRACE("[PluginManager] Found plugin file %s", plugin_path.filename().generic_u8string().c_str());
LOG_TRACE("[%s] Found plugin file %s", PLUGINMANAGER, plugin_path.filename().generic_u8string().c_str());
AddPlugin(plugin_path, is_system);
}
}
void PluginManager::AddPlugin(const filesystem::path& path, bool is_system)
{
OpenRGBPluginInterface* plugin = nullptr;
/*-----------------------------------------------------*\
| Prepare variables and open plugin settings |
\*-----------------------------------------------------*/
OpenRGBPluginInterface* plugin = nullptr;
unsigned int plugin_idx;
json plugin_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("Plugins");
unsigned int plugin_idx;
/*---------------------------------------------------------------------*\
| Open plugin settings |
\*---------------------------------------------------------------------*/
json plugin_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("Plugins");
/*---------------------------------------------------------------------*\
| Check if this plugin is on the remove list |
\*---------------------------------------------------------------------*/
/*-----------------------------------------------------*\
| Remove this plugin if it is on the remove list |
\*-----------------------------------------------------*/
if(plugin_settings.contains("plugins_remove"))
{
for(unsigned int plugin_remove_idx = 0; plugin_remove_idx < plugin_settings["plugins_remove"].size(); plugin_remove_idx++)
for(std::size_t plugin_remove_idx = 0; plugin_remove_idx < plugin_settings["plugins_remove"].size(); plugin_remove_idx++)
{
LOG_WARNING("[PluginManager] Checking remove %d, %s", plugin_remove_idx, to_string(plugin_settings["plugins_remove"][plugin_remove_idx]).c_str());
LOG_WARNING("[%s] Checking remove %d, %s", PLUGINMANAGER, plugin_remove_idx, to_string(plugin_settings["plugins_remove"][plugin_remove_idx]).c_str());
if(plugin_settings["plugins_remove"][plugin_remove_idx] == path.generic_u8string())
{
/*---------------------------------------------------------*\
| Delete the plugin file |
\*---------------------------------------------------------*/
/*-----------------------------------------*\
| Delete the plugin file |
\*-----------------------------------------*/
filesystem::remove(path);
}
/*-----------------------------------------------------------------*\
| Erase the plugin from the remove list |
\*-----------------------------------------------------------------*/
/*---------------------------------------------*\
| Erase the plugin from the remove list |
\*---------------------------------------------*/
plugin_settings["plugins_remove"].erase(plugin_remove_idx);
ResourceManager::get()->GetSettingsManager()->SetSettings("Plugins", plugin_settings);
@@ -198,183 +201,231 @@ void PluginManager::AddPlugin(const filesystem::path& path, bool is_system)
}
}
/*---------------------------------------------------------------------*\
| Search active plugins to see if this path already exists |
\*---------------------------------------------------------------------*/
/*-----------------------------------------------------*\
| Search active plugins to see if this path already |
| exists |
\*-----------------------------------------------------*/
for(plugin_idx = 0; plugin_idx < ActivePlugins.size(); plugin_idx++)
{
if(path == ActivePlugins[plugin_idx].path)
{
break;
LOG_WARNING("[%s] Plugin file %s already in list, skipping.", PLUGINMANAGER, path.c_str());
return;
}
}
/*---------------------------------------------------------------------*\
| If the path does not match an existing entry, create a new entry |
\*---------------------------------------------------------------------*/
if(plugin_idx == ActivePlugins.size())
/*-----------------------------------------------------*\
| Create a QPluginLoader and extract the metadata |
\*-----------------------------------------------------*/
std::string path_string = path.generic_u8string();
QPluginLoader* loader = new QPluginLoader(QString::fromStdString(path_string));
QJsonObject metadata = loader->metaData();
unsigned int plugin_api_version = 0;
QString plugin_commit;
QString plugin_id = "incompatible";
QString plugin_name = "Incompatible Plugin";
QString plugin_url;
QString plugin_version;
if(metadata.contains("MetaData"))
{
/*-----------------------------------------------------------------*\
| Create a QPluginLoader and load the plugin |
\*-----------------------------------------------------------------*/
std::string path_string = path.generic_u8string();
QPluginLoader* loader = new QPluginLoader(QString::fromStdString(path_string));
QObject* instance = loader->instance();
metadata = metadata.value("MetaData").toObject();
}
else
{
LOG_WARNING("[%s] Plugin %s does not have a MetaData field, skipping.", PLUGINMANAGER, path.c_str());
return;
}
if(metadata.contains("OpenRGBPluginAPIVersion"))
{
plugin_api_version = metadata.value("OpenRGBPluginAPIVersion").toInt();
}
else
{
LOG_WARNING("[%s] Plugin %s does not have an OpenRGBPluginAPIVersion field, skipping.", PLUGINMANAGER, path.c_str());
return;
}
if(metadata.contains("Id"))
{
plugin_id = metadata.value("Id").toString();
}
else
{
LOG_WARNING("[%s] Plugin %s does not have an Id field, skipping.", PLUGINMANAGER, path.c_str());
return;
}
if(metadata.contains("Commit"))
{
plugin_commit = metadata.value("Commit").toString();
}
if(metadata.contains("Name"))
{
plugin_name = metadata.value("Name").toString();
}
if(metadata.contains("Url"))
{
plugin_url = metadata.value("Url").toString();
}
if(metadata.contains("VersionStr"))
{
plugin_version = metadata.value("VersionStr").toString();
}
/*-----------------------------------------------------*\
| Create a new plugin entry to add to the list |
\*-----------------------------------------------------*/
OpenRGBPluginEntry entry;
entry.api = new OpenRGBPluginAPI();
entry.api_version = plugin_api_version;
entry.enabled = false;
entry.info.Commit = plugin_commit.toStdString();
entry.info.Description = "This plugin is not compatible with this version of OpenRGB.";
entry.info.Name = plugin_name.toStdString();
entry.info.URL = plugin_url.toStdString();
entry.info.Version = plugin_version.toStdString();
entry.id = plugin_id;
entry.incompatible = (plugin_api_version == OPENRGB_PLUGIN_API_VERSION);
entry.is_system = is_system;
entry.loader = loader;
entry.path = path_string;
entry.plugin = plugin;
entry.widget = nullptr;
/*-----------------------------------------------------*\
| Check to see if this plugin's ID already exists |
\*-----------------------------------------------------*/
for(plugin_idx = 0; plugin_idx < ActivePlugins.size(); plugin_idx++)
{
if(plugin_id == ActivePlugins[plugin_idx].id)
{
entry.info.Description = "This plugin has a duplicate ID as an already loaded plugin and cannot be loaded.";
LOG_WARNING("[%s] Plugin ID %s already in list.", PLUGINMANAGER, plugin_id.toStdString().c_str());
goto add_plugin_entry;
}
}
/*-----------------------------------------------------*\
| If metadata indicates a matching API version, |
| continue loading |
\*-----------------------------------------------------*/
if(plugin_api_version == OPENRGB_PLUGIN_API_VERSION)
{
QObject* instance = loader->instance();
if(!loader->isLoaded())
{
LOG_WARNING("[PluginManager] Plugin %s cannot be loaded: %s", path.c_str(), loader->errorString().toStdString().c_str());
LOG_WARNING("[%s] Plugin %s cannot be loaded: %s", PLUGINMANAGER, path.c_str(), loader->errorString().toStdString().c_str());
goto add_plugin_entry;
}
/*-----------------------------------------------------------------*\
| Check that the plugin is valid, then check the API version |
\*-----------------------------------------------------------------*/
if(instance)
if(!instance)
{
plugin = qobject_cast<OpenRGBPluginInterface*>(instance);
LOG_WARNING("[%s] Plugin %s cannot be instantiated.", PLUGINMANAGER, path.c_str());
goto add_plugin_entry;
}
if(plugin)
/*-------------------------------------------------*\
| Initialize the plugin pointer |
\*-------------------------------------------------*/
plugin = qobject_cast<OpenRGBPluginInterface*>(instance);
if(!plugin)
{
LOG_WARNING("[%s] Plugin %s cannot be casted to OpenRGBPluginInterface", PLUGINMANAGER, path.c_str());
goto add_plugin_entry;
}
if(plugin->GetPluginAPIVersion() != OPENRGB_PLUGIN_API_VERSION)
{
LOG_WARNING("[%s] Plugin %s has a compatible API version", PLUGINMANAGER, path.c_str());
goto add_plugin_entry;
}
/*-------------------------------------------------*\
| Get the plugin information |
\*-------------------------------------------------*/
OpenRGBPluginInfo info = plugin->GetPluginInfo();
/*-------------------------------------------------*\
| Search the settings to see if it is enabled |
\*-------------------------------------------------*/
std::string name = "";
std::string description = "";
bool enabled = true;
bool found = false;
unsigned int plugin_ct = 0;
if(plugin_settings.contains("plugins"))
{
plugin_ct = (unsigned int)plugin_settings["plugins"].size();
for(unsigned int plugin_settings_idx = 0; plugin_settings_idx < plugin_settings["plugins"].size(); plugin_settings_idx++)
{
if(plugin->GetPluginAPIVersion() == OPENRGB_PLUGIN_API_VERSION)
if(plugin_settings["plugins"][plugin_settings_idx].contains("name"))
{
LOG_TRACE("[PluginManager] Plugin %s has a compatible API version", path.c_str());
/*-----------------------------------------------------*\
| Get the plugin information |
\*-----------------------------------------------------*/
OpenRGBPluginInfo info = plugin->GetPluginInfo();
/*-----------------------------------------------------*\
| Search the settings to see if it is enabled |
\*-----------------------------------------------------*/
std::string name = "";
std::string description = "";
bool enabled = true;
bool found = false;
unsigned int plugin_ct = 0;
if(plugin_settings.contains("plugins"))
{
plugin_ct = (unsigned int)plugin_settings["plugins"].size();
for(unsigned int plugin_settings_idx = 0; plugin_settings_idx < plugin_settings["plugins"].size(); plugin_settings_idx++)
{
if(plugin_settings["plugins"][plugin_settings_idx].contains("name"))
{
name = plugin_settings["plugins"][plugin_settings_idx]["name"];
}
if(plugin_settings["plugins"][plugin_settings_idx].contains("description"))
{
description = plugin_settings["plugins"][plugin_settings_idx]["description"];
}
if(plugin_settings["plugins"][plugin_settings_idx].contains("enabled"))
{
enabled = plugin_settings["plugins"][plugin_settings_idx]["enabled"];
}
if((info.Name == name)
&&(info.Description == description))
{
found = true;
break;
}
}
}
/*-----------------------------------------------------*\
| If the plugin was not in the list, add it to the list |
| and default it to enabled, then save the settings |
\*-----------------------------------------------------*/
if(!found)
{
plugin_settings["plugins"][plugin_ct]["name"] = info.Name;
plugin_settings["plugins"][plugin_ct]["description"] = info.Description;
plugin_settings["plugins"][plugin_ct]["enabled"] = enabled;
ResourceManager::get()->GetSettingsManager()->SetSettings("Plugins", plugin_settings);
ResourceManager::get()->GetSettingsManager()->SaveSettings();
}
LOG_VERBOSE("[PluginManager] Loaded plugin %s", info.Name.c_str());
/*-----------------------------------------------------*\
| Add the plugin to the PluginManager active plugins |
\*-----------------------------------------------------*/
OpenRGBPluginEntry entry;
entry.info = info;
entry.plugin = plugin;
entry.api = new OpenRGBPluginAPI();
entry.loader = loader;
entry.path = path_string;
entry.enabled = enabled;
entry.widget = nullptr;
entry.incompatible = false;
entry.api_version = plugin->GetPluginAPIVersion();
entry.is_system = is_system;
loader->unload();
ActivePlugins.push_back(entry);
if(entry.enabled)
{
LoadPlugin(&ActivePlugins.back());
}
name = plugin_settings["plugins"][plugin_settings_idx]["name"];
}
else
if(plugin_settings["plugins"][plugin_settings_idx].contains("description"))
{
/*-----------------------------------------------------*\
| Fill in a plugin information object with text showing |
| the plugin is incompatible |
\*-----------------------------------------------------*/
OpenRGBPluginInfo info;
description = plugin_settings["plugins"][plugin_settings_idx]["description"];
}
info.Name = "Incompatible Plugin";
info.Description = "This plugin is not compatible with this version of OpenRGB.";
if(plugin_settings["plugins"][plugin_settings_idx].contains("enabled"))
{
enabled = plugin_settings["plugins"][plugin_settings_idx]["enabled"];
}
/*-----------------------------------------------------*\
| Add the plugin to the PluginManager active plugins |
| but mark it as incompatible |
\*-----------------------------------------------------*/
OpenRGBPluginEntry entry;
entry.info = info;
entry.plugin = plugin;
entry.api = new OpenRGBPluginAPI();
entry.loader = loader;
entry.path = path_string;
entry.enabled = false;
entry.widget = nullptr;
entry.incompatible = true;
entry.api_version = plugin->GetPluginAPIVersion();
entry.is_system = is_system;
loader->unload();
PluginManager::ActivePlugins.push_back(entry);
bool unloaded = loader->unload();
LOG_WARNING("[PluginManager] Plugin %s has an incompatible API version", path.c_str());
if(!unloaded)
{
LOG_WARNING("[PluginManager] Plugin %s cannot be unloaded", path.c_str());
}
if((info.Name == name)
&&(info.Description == description))
{
found = true;
break;
}
}
else
{
LOG_WARNING("[PluginManager] Plugin %s cannot be casted to OpenRGBPluginInterface", path.c_str());
}
}
else
/*-------------------------------------------------*\
| If the plugin was not in the list, add it to the |
| list and default it to enabled, then save the |
| settings |
\*-------------------------------------------------*/
if(!found)
{
LOG_WARNING("[PluginManager] Plugin %s cannot be instantiated.", path.c_str());
plugin_settings["plugins"][plugin_ct]["name"] = info.Name;
plugin_settings["plugins"][plugin_ct]["description"] = info.Description;
plugin_settings["plugins"][plugin_ct]["enabled"] = enabled;
ResourceManager::get()->GetSettingsManager()->SetSettings("Plugins", plugin_settings);
ResourceManager::get()->GetSettingsManager()->SaveSettings();
}
LOG_VERBOSE("[%s] Loaded plugin %s", PLUGINMANAGER, info.Name.c_str());
/*-----------------------------------------------------*\
| Add the plugin to the PluginManager active plugins |
\*-----------------------------------------------------*/
entry.enabled = enabled;
entry.info = info;
entry.incompatible = false;
entry.api_version = plugin->GetPluginAPIVersion();
}
add_plugin_entry:
loader->unload();
ActivePlugins.push_back(entry);
if(entry.enabled)
{
LoadPlugin(&ActivePlugins.back());
}
}
@@ -382,11 +433,12 @@ void PluginManager::RemovePlugin(const filesystem::path& path)
{
unsigned int plugin_idx;
LOG_TRACE("[PluginManager] Attempting to remove plugin %s", path.c_str());
LOG_TRACE("[%s] Attempting to remove plugin %s", PLUGINMANAGER, path.c_str());
/*---------------------------------------------------------------------*\
| Search active plugins to see if this path already exists |
\*---------------------------------------------------------------------*/
/*-----------------------------------------------------*\
| Search active plugins to see if this path already |
| exists |
\*-----------------------------------------------------*/
for(plugin_idx = 0; plugin_idx < ActivePlugins.size(); plugin_idx++)
{
if(path == ActivePlugins[plugin_idx].path)
@@ -395,27 +447,29 @@ void PluginManager::RemovePlugin(const filesystem::path& path)
}
}
/*---------------------------------------------------------------------*\
| If the plugin path does not exist in the active plugins list, return |
\*---------------------------------------------------------------------*/
/*-----------------------------------------------------*\
| If the plugin path does not exist in the active |
| plugins list, return |
\*-----------------------------------------------------*/
if(plugin_idx == ActivePlugins.size())
{
LOG_TRACE("[PluginManager] Plugin %s not active", path.c_str());
LOG_TRACE("[%s] Plugin %s not active", PLUGINMANAGER, path.c_str());
return;
}
/*---------------------------------------------------------------------*\
| If the selected plugin is in the list and loaded, unload it |
\*---------------------------------------------------------------------*/
/*-----------------------------------------------------*\
| If the selected plugin is in the list and loaded, |
| unload it |
\*-----------------------------------------------------*/
if(ActivePlugins[plugin_idx].loader->isLoaded())
{
LOG_TRACE("[PluginManager] Plugin %s is active, unloading", path.c_str());
LOG_TRACE("[%s] Plugin %s is active, unloading", PLUGINMANAGER, path.c_str());
UnloadPlugin(&ActivePlugins[plugin_idx]);
}
/*---------------------------------------------------------------------*\
| Remove the plugin from the active plugins list |
\*---------------------------------------------------------------------*/
/*-----------------------------------------------------*\
| Remove the plugin from the active plugins list |
\*-----------------------------------------------------*/
ActivePlugins.erase(ActivePlugins.begin() + plugin_idx);
}
@@ -423,9 +477,10 @@ void PluginManager::EnablePlugin(const filesystem::path& path)
{
unsigned int plugin_idx;
/*---------------------------------------------------------------------*\
| Search active plugins to see if this path already exists |
\*---------------------------------------------------------------------*/
/*-----------------------------------------------------*\
| Search active plugins to see if this path already |
| exists |
\*-----------------------------------------------------*/
for(plugin_idx = 0; plugin_idx < ActivePlugins.size(); plugin_idx++)
{
if(path == ActivePlugins[plugin_idx].path)
@@ -434,9 +489,10 @@ void PluginManager::EnablePlugin(const filesystem::path& path)
}
}
/*---------------------------------------------------------------------*\
| If the plugin path does not exist in the active plugins list, return |
\*---------------------------------------------------------------------*/
/*-----------------------------------------------------*\
| If the plugin path does not exist in the active |
| plugins list, return |
\*-----------------------------------------------------*/
if(plugin_idx == ActivePlugins.size())
{
return;
@@ -448,17 +504,19 @@ void PluginManager::EnablePlugin(const filesystem::path& path)
void PluginManager::LoadPlugin(OpenRGBPluginEntry* plugin_entry)
{
/*---------------------------------------------------------------------*\
| If the plugin is in the list but is incompatible, return |
\*---------------------------------------------------------------------*/
/*-----------------------------------------------------*\
| If the plugin is in the list but is incompatible, |
| return |
\*-----------------------------------------------------*/
if(plugin_entry->incompatible)
{
return;
}
/*---------------------------------------------------------------------*\
| If the selected plugin is in the list but not loaded, load it |
\*---------------------------------------------------------------------*/
/*-----------------------------------------------------*\
| If the selected plugin is in the list but not loaded, |
| load it |
\*-----------------------------------------------------*/
if(!plugin_entry->loader->isLoaded())
{
plugin_entry->loader->load();
@@ -477,9 +535,9 @@ void PluginManager::LoadPlugin(OpenRGBPluginEntry* plugin_entry)
plugin->Load(plugin_entry->api);
/*-------------------------------------------------*\
| Call the Add Plugin callback |
\*-------------------------------------------------*/
/*-------------------------------------*\
| Call the Add Plugin callback |
\*-------------------------------------*/
if(AddPluginCallbackArg != nullptr)
{
AddPluginCallbackVal(AddPluginCallbackArg, plugin_entry);
@@ -494,9 +552,10 @@ void PluginManager::DisablePlugin(const filesystem::path& path)
{
unsigned int plugin_idx;
/*---------------------------------------------------------------------*\
| Search active plugins to see if this path already exists |
\*---------------------------------------------------------------------*/
/*-----------------------------------------------------*\
| Search active plugins to see if this path already |
| exists |
\*-----------------------------------------------------*/
for(plugin_idx = 0; plugin_idx < ActivePlugins.size(); plugin_idx++)
{
if(path == ActivePlugins[plugin_idx].path)
@@ -505,9 +564,10 @@ void PluginManager::DisablePlugin(const filesystem::path& path)
}
}
/*---------------------------------------------------------------------*\
| If the plugin path does not exist in the active plugins list, return |
\*---------------------------------------------------------------------*/
/*-----------------------------------------------------*\
| If the plugin path does not exist in the active |
| plugins list, return |
\*-----------------------------------------------------*/
if(plugin_idx == ActivePlugins.size())
{
return;
@@ -519,9 +579,10 @@ void PluginManager::DisablePlugin(const filesystem::path& path)
void PluginManager::UnloadPlugin(OpenRGBPluginEntry* plugin_entry)
{
/*---------------------------------------------------------------------*\
| If the selected plugin is in the list and loaded, unload it |
\*---------------------------------------------------------------------*/
/*-----------------------------------------------------*\
| If the selected plugin is in the list and loaded, |
| unload it |
\*-----------------------------------------------------*/
if(plugin_entry->loader->isLoaded())
{
/*-------------------------------------------------*\
@@ -541,16 +602,16 @@ void PluginManager::UnloadPlugin(OpenRGBPluginEntry* plugin_entry)
if(!unloaded)
{
LOG_WARNING("[PluginManager] Plugin %s cannot be unloaded", plugin_entry->path.c_str());
LOG_WARNING("[%s] Plugin %s cannot be unloaded", PLUGINMANAGER, plugin_entry->path.c_str());
}
else
{
LOG_TRACE("[PluginManager] Plugin %s successfully unloaded", plugin_entry->path.c_str());
LOG_TRACE("[%s] Plugin %s successfully unloaded", PLUGINMANAGER, plugin_entry->path.c_str());
}
}
else
{
LOG_TRACE("[PluginManager] Plugin %s was already unloaded", plugin_entry->path.c_str());
LOG_TRACE("[%s] Plugin %s was already unloaded", PLUGINMANAGER, plugin_entry->path.c_str());
}
}