aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/plugins/pluginbackend.cpp
diff options
context:
space:
mode:
authorcat_or_not <41955154+catornot@users.noreply.github.com>2023-11-05 20:21:50 -0500
committerGitHub <noreply@github.com>2023-11-06 02:21:50 +0100
commitbb822b7638d5ae9bc4499ff76edc74f3741e6518 (patch)
tree558886bd28dc53d1004e235be1c1543c5ec2fd9f /NorthstarDLL/plugins/pluginbackend.cpp
parent583bae6e1a7e35eec2c5cb4383bc0089f6ee6781 (diff)
downloadNorthstarLauncher-bb822b7638d5ae9bc4499ff76edc74f3741e6518.tar.gz
NorthstarLauncher-bb822b7638d5ae9bc4499ff76edc74f3741e6518.zip
- nuked presence logic ( moved to the discord rpc plugin ) - more exposed sq functions - exposed dll addresses - `g_pCVar` is exposed - added "userdata" to plugin's async call - added runframe to plugins
Diffstat (limited to 'NorthstarDLL/plugins/pluginbackend.cpp')
-rw-r--r--NorthstarDLL/plugins/pluginbackend.cpp53
1 files changed, 8 insertions, 45 deletions
diff --git a/NorthstarDLL/plugins/pluginbackend.cpp b/NorthstarDLL/plugins/pluginbackend.cpp
index f9766235..850394ac 100644
--- a/NorthstarDLL/plugins/pluginbackend.cpp
+++ b/NorthstarDLL/plugins/pluginbackend.cpp
@@ -7,6 +7,8 @@
#include "core/convar/concommand.h"
+#include <filesystem>
+
#define EXPORT extern "C" __declspec(dllexport)
AUTOHOOK_INIT()
@@ -36,52 +38,13 @@ void PluginCommunicationHandler::PushRequest(PluginDataRequestType type, PluginR
requestQueue.push(PluginDataRequest {type, func});
}
-void PluginCommunicationHandler::GeneratePresenceObjects()
+void InformPluginsDLLLoad(fs::path dllPath, void* address)
{
- PluginGameStatePresence presence {};
-
- presence.id = g_pGameStatePresence->id.c_str();
- presence.name = g_pGameStatePresence->name.c_str();
- presence.description = g_pGameStatePresence->description.c_str();
- presence.password = g_pGameStatePresence->password.c_str();
-
- presence.isServer = g_pGameStatePresence->isServer;
- presence.isLocal = g_pGameStatePresence->isLocal;
-
- if (g_pGameStatePresence->isLoading)
- presence.state = GameState::LOADING;
- else if (g_pGameStatePresence->uiMap == "")
- presence.state = GameState::MAINMENU;
- else if (g_pGameStatePresence->map == "mp_lobby" && g_pGameStatePresence->isLocal && g_pGameStatePresence->isLobby)
- presence.state = GameState::LOBBY;
- else
- presence.state = GameState::INGAME;
+ std::string dllName = dllPath.filename().string();
- presence.map = g_pGameStatePresence->map.c_str();
- presence.mapDisplayname = g_pGameStatePresence->mapDisplayname.c_str();
- presence.playlist = g_pGameStatePresence->playlist.c_str();
- presence.playlistDisplayname = g_pGameStatePresence->playlistDisplayname.c_str();
+ void* data = NULL;
+ if (strncmp(dllName.c_str(), "engine.dll", 10) == 0)
+ data = &g_pPluginCommunicationhandler->m_sEngineData;
- presence.currentPlayers = g_pGameStatePresence->currentPlayers;
- presence.maxPlayers = g_pGameStatePresence->maxPlayers;
- presence.ownScore = g_pGameStatePresence->ownScore;
- presence.otherHighestScore = g_pGameStatePresence->otherHighestScore;
- presence.maxScore = g_pGameStatePresence->maxScore;
- presence.timestampEnd = g_pGameStatePresence->timestampEnd;
- g_pPluginManager->PushPresence(&presence);
-}
-
-ON_DLL_LOAD_RELIESON("engine.dll", PluginBackendEngine, ConCommand, (CModule module))
-{
- g_pPluginManager->InformDLLLoad(PluginLoadDLL::ENGINE, &g_pPluginCommunicationhandler->m_sEngineData);
-}
-
-ON_DLL_LOAD_RELIESON("client.dll", PluginBackendClient, ConCommand, (CModule module))
-{
- g_pPluginManager->InformDLLLoad(PluginLoadDLL::CLIENT, nullptr);
-}
-
-ON_DLL_LOAD_RELIESON("server.dll", PluginBackendServer, ConCommand, (CModule module))
-{
- g_pPluginManager->InformDLLLoad(PluginLoadDLL::SERVER, nullptr);
+ g_pPluginManager->InformDLLLoad(dllName.c_str(), data, address);
}