aboutsummaryrefslogtreecommitdiff
path: root/primedev/plugins/plugins.h
diff options
context:
space:
mode:
authorJack <66967891+ASpoonPlaysGames@users.noreply.github.com>2023-12-27 00:32:01 +0000
committerGitHub <noreply@github.com>2023-12-27 01:32:01 +0100
commitf5ab6fb5e8be7b73e6003d4145081d5e0c0ce287 (patch)
tree90f2c6a4885dbd181799e2325cf33588697674e1 /primedev/plugins/plugins.h
parentbb8ed59f6891b1196c5f5bbe7346cd171c8215fa (diff)
downloadNorthstarLauncher-f5ab6fb5e8be7b73e6003d4145081d5e0c0ce287.tar.gz
NorthstarLauncher-f5ab6fb5e8be7b73e6003d4145081d5e0c0ce287.zip
Folder restructuring from primedev (#624)v1.21.2-rc3v1.21.2
Copies of over the primedev folder structure for easier cherry-picking of further changes Co-authored-by: F1F7Y <filip.bartos07@proton.me>
Diffstat (limited to 'primedev/plugins/plugins.h')
-rw-r--r--primedev/plugins/plugins.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/primedev/plugins/plugins.h b/primedev/plugins/plugins.h
new file mode 100644
index 00000000..4e841f27
--- /dev/null
+++ b/primedev/plugins/plugins.h
@@ -0,0 +1,59 @@
+#pragma once
+#include "plugin_abi.h"
+
+const int IDR_RCDATA1 = 101;
+
+class Plugin
+{
+public:
+ std::string name;
+ std::string displayName;
+ std::string dependencyName;
+ std::string description;
+
+ std::string api_version;
+ std::string version;
+
+ // For now this is just implemented as the index into the plugins array
+ // Maybe a bit shit but it works
+ int handle;
+
+ std::shared_ptr<ColoredLogger> logger;
+
+ bool run_on_client = false;
+ bool run_on_server = false;
+
+public:
+ PLUGIN_INIT_TYPE init;
+ PLUGIN_INIT_SQVM_TYPE init_sqvm_client;
+ PLUGIN_INIT_SQVM_TYPE init_sqvm_server;
+ PLUGIN_INFORM_SQVM_CREATED_TYPE inform_sqvm_created;
+ PLUGIN_INFORM_SQVM_DESTROYED_TYPE inform_sqvm_destroyed;
+
+ PLUGIN_INFORM_DLL_LOAD_TYPE inform_dll_load;
+
+ PLUGIN_RUNFRAME run_frame;
+};
+
+class PluginManager
+{
+public:
+ std::vector<Plugin> m_vLoadedPlugins;
+
+public:
+ bool LoadPlugins();
+ std::optional<Plugin> LoadPlugin(fs::path path, PluginInitFuncs* funcs, PluginNorthstarData* data);
+
+ void InformSQVMLoad(ScriptContext context, SquirrelFunctions* s);
+ void InformSQVMCreated(ScriptContext context, CSquirrelVM* sqvm);
+ void InformSQVMDestroyed(ScriptContext context);
+
+ void InformDLLLoad(const char* dll, void* data, void* dllPtr);
+
+ void RunFrame();
+
+private:
+ std::string pluginPath;
+};
+
+extern PluginManager* g_pPluginManager;