Skip to content

Commit

Permalink
move plugin communication handler init to dllmain
Browse files Browse the repository at this point in the history
  • Loading branch information
ASpoonPlaysGames committed Oct 15, 2023
1 parent fb7b538 commit 1675185
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 9 deletions.
2 changes: 2 additions & 0 deletions NorthstarDLL/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "config/profile.h"
#include "plugins/plugin_abi.h"
#include "plugins/plugins.h"
#include "plugins/pluginbackend.h"
#include "util/version.h"
#include "squirrel/squirrel.h"
#include "shared/gamepresence.h"
Expand Down Expand Up @@ -62,6 +63,7 @@ bool InitialiseNorthstar()

g_pGameStatePresence = new GameStatePresence();
g_pPluginManager = new PluginManager();
g_pPluginCommunicationhandler = new PluginCommunicationHandler();
g_pPluginManager->LoadPlugins();

InitialiseSquirrelManagers();
Expand Down
6 changes: 0 additions & 6 deletions NorthstarDLL/plugins/pluginbackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ PluginCommunicationHandler* g_pPluginCommunicationhandler;

static PluginDataRequest storedRequest {PluginDataRequestType::END, (PluginRespondDataCallable) nullptr};

void init_plugincommunicationhandler()
{
g_pPluginCommunicationhandler = new PluginCommunicationHandler;
g_pPluginCommunicationhandler->requestQueue = {};
}

void PluginCommunicationHandler::RunFrame()
{
std::lock_guard<std::mutex> lock(requestMutex);
Expand Down
2 changes: 1 addition & 1 deletion NorthstarDLL/plugins/pluginbackend.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PluginCommunicationHandler
void GeneratePresenceObjects();

public:
std::queue<PluginDataRequest> requestQueue;
std::queue<PluginDataRequest> requestQueue = {};
std::mutex requestMutex;

PluginEngineData m_sEngineData {};
Expand Down
2 changes: 0 additions & 2 deletions NorthstarDLL/plugins/plugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,6 @@ bool PluginManager::LoadPlugins()
funcs.relayInviteFunc = nullptr;
funcs.createObject = CreateObject;

init_plugincommunicationhandler();

data.version = ns_version.c_str();
data.northstarModule = g_NorthstarModule;

Expand Down

0 comments on commit 1675185

Please sign in to comment.