aboutsummaryrefslogtreecommitdiff
path: root/primedev/plugins/plugins.cpp
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2024-11-12 17:11:31 +0100
committerGitHub <noreply@github.com>2024-11-12 17:11:31 +0100
commit6509283abd620038bf48f0d90ba23b8fa17feec7 (patch)
treea4186aef12d8c44e3bc71868f2e1556068e4a6dd /primedev/plugins/plugins.cpp
parenta4b09bc42d5f79ef86697c893efc9e3b7d966502 (diff)
parent13344f3910befa2cd15bfd306ba2c5e42e6c80ec (diff)
downloadNorthstarLauncher-6509283abd620038bf48f0d90ba23b8fa17feec7.tar.gz
NorthstarLauncher-6509283abd620038bf48f0d90ba23b8fa17feec7.zip
Merge branch 'main' into feat/overhaul-mod-loading-locationsfeat/overhaul-mod-loading-locations
Diffstat (limited to 'primedev/plugins/plugins.cpp')
-rw-r--r--primedev/plugins/plugins.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/primedev/plugins/plugins.cpp b/primedev/plugins/plugins.cpp
index 92be9d5c..3e623167 100644
--- a/primedev/plugins/plugins.cpp
+++ b/primedev/plugins/plugins.cpp
@@ -2,7 +2,6 @@
#include "pluginmanager.h"
#include "squirrel/squirrel.h"
#include "util/wininfo.h"
-#include "core/sourceinterface.h"
#include "logging/logging.h"
#include "dedicated/dedicated.h"
@@ -24,6 +23,7 @@ bool isValidSquirrelIdentifier(std::string s)
Plugin::Plugin(std::string path)
: m_location(path)
+ , m_logColor(NS::Colors::PLUGIN)
{
HMODULE pluginModule = GetModuleHandleA(path.c_str());
@@ -70,6 +70,13 @@ Plugin::Plugin(std::string path)
m_runOnServer = context & PluginContext::DEDICATED;
m_runOnClient = context & PluginContext::CLIENT;
+ int64_t logColor = m_pluginId->GetField(PluginField::COLOR);
+ // Apply custom colour if plugin has specified one
+ if ((logColor & 0xFFFFFF) != 0)
+ {
+ m_logColor = Color((int)(logColor & 0xFF), (int)((logColor >> 8) & 0xFF), (int)((logColor >> 16) & 0xFF));
+ }
+
if (!name)
{
NS::log::PLUGINSYS->error("Could not load name of plugin at '{}'", path);
@@ -106,7 +113,7 @@ Plugin::Plugin(std::string path)
return;
}
- m_logger = std::make_shared<ColoredLogger>(m_logName, NS::Colors::PLUGIN);
+ m_logger = std::make_shared<ColoredLogger>(m_logName, m_logColor);
RegisterLogger(m_logger);
if (IsDedicatedServer() && !m_runOnServer)