diff options
author | cat_or_not <41955154+catornot@users.noreply.github.com> | 2023-12-14 07:07:02 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-14 13:07:02 +0100 |
commit | 43f0bce0596ec60434e48d8037ffed373bc13852 (patch) | |
tree | 717f8728ad41369a9e8c6dfe928460e9163014c0 /NorthstarDLL/plugins/plugins.cpp | |
parent | 0976a3500e6774258322ab2bc80ebd515c175e77 (diff) | |
download | NorthstarLauncher-1.21.0-rc1.tar.gz NorthstarLauncher-1.21.0-rc1.zip |
Add plugin dependency constants (#458)v1.21.0-rc1
Adds dependency constants for plugins so mods can rely on plugins without always producing script errors when the plugin is missing
Diffstat (limited to 'NorthstarDLL/plugins/plugins.cpp')
-rw-r--r-- | NorthstarDLL/plugins/plugins.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/NorthstarDLL/plugins/plugins.cpp b/NorthstarDLL/plugins/plugins.cpp index d8087e5c..72b64566 100644 --- a/NorthstarDLL/plugins/plugins.cpp +++ b/NorthstarDLL/plugins/plugins.cpp @@ -170,6 +170,15 @@ std::optional<Plugin> PluginManager::LoadPlugin(fs::path path, PluginInitFuncs* plugin.dependencyName = plugin.name; } + if (std::find_if( + plugin.dependencyName.begin(), + plugin.dependencyName.end(), + [&](char c) -> bool { return !((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '_'); }) != + plugin.dependencyName.end()) + { + NS::log::PLUGINSYS->warn("Dependency string \"{}\" in {} is not valid a squirrel constant!", plugin.dependencyName, plugin.name); + } + plugin.init_sqvm_client = (PLUGIN_INIT_SQVM_TYPE)GetProcAddress(pluginLib, "PLUGIN_INIT_SQVM_CLIENT"); plugin.init_sqvm_server = (PLUGIN_INIT_SQVM_TYPE)GetProcAddress(pluginLib, "PLUGIN_INIT_SQVM_SERVER"); plugin.inform_sqvm_created = (PLUGIN_INFORM_SQVM_CREATED_TYPE)GetProcAddress(pluginLib, "PLUGIN_INFORM_SQVM_CREATED"); |