|
VoltMod
C++23 framework for CS2 server plugins
|
Finds the installed plugins and loads the ones their dependencies allow. More...
#include <PluginLoader.hpp>
Public Types | |
| enum class | ActionKind { Load , Unload , Reload } |
Public Member Functions | |
| PluginLoader (PluginRegistry ®istry, ServerAssets &assets) | |
| ~PluginLoader () | |
| PluginLoader (const PluginLoader &)=delete | |
| PluginLoader & | operator= (const PluginLoader &)=delete |
| void | LoadAll () |
| void | UnloadAll () |
| void | Defer (ActionKind kind, std::string_view name) |
| void | RunPending () |
| const std::vector< LoadedPlugin > & | LoadedPlugins () const |
| LoadedPlugin * | RequireLoaded (std::string_view name) |
| const std::map< std::string, std::string > & | Refused () const |
Finds the installed plugins and loads the ones their dependencies allow.
Console load and unload requests wait for RunPending on the next frame: freeing a library inside the command dispatch would pull the code out from under the call in flight.
Definition at line 34 of file PluginLoader.hpp.
| Enumerator | |
|---|---|
| Load | |
| Unload | |
| Reload | |
Definition at line 37 of file PluginLoader.hpp.
| VoltMod::PluginLoader::PluginLoader | ( | PluginRegistry & | registry, |
| ServerAssets & | assets | ||
| ) |
Definition at line 50 of file PluginLoader.cpp.
| VoltMod::PluginLoader::~PluginLoader | ( | ) |
Definition at line 52 of file PluginLoader.cpp.
References UnloadAll().
|
delete |
| void VoltMod::PluginLoader::Defer | ( | ActionKind | kind, |
| std::string_view | name | ||
| ) |
Take kind on name at the start of the next frame.
Definition at line 74 of file PluginLoader.cpp.
References VoltMod::Log::Info(), VoltMod::Name, VoltMod::ReadFile(), and VoltMod::Strings::ToLower().
| void VoltMod::PluginLoader::LoadAll | ( | ) |
Load every installed plugin whose required dependencies are there.
Definition at line 57 of file PluginLoader.cpp.
References VoltMod::Log::Info(), VoltMod::Installed(), and VoltMod::ReadFile().
|
inline |
In load order; unload runs it backwards.
Definition at line 63 of file PluginLoader.hpp.
|
delete |
|
inline |
Each plugin the last load attempt refused, by name, with the reason; a later load clears it.
Definition at line 69 of file PluginLoader.hpp.
| LoadedPlugin * VoltMod::PluginLoader::RequireLoaded | ( | std::string_view | name | ) |
The loaded plugin name, or nullptr after logging that it is not loaded.
Definition at line 225 of file PluginLoader.cpp.
References VoltMod::ReadFile(), and VoltMod::Log::Warn().
| void VoltMod::PluginLoader::RunPending | ( | ) |
Act on what was deferred. The frame hook calls this before the frame reaches plugins.
Definition at line 80 of file PluginLoader.cpp.
References Load, VoltMod::ReadFile(), Reload, and Unload.
| void VoltMod::PluginLoader::UnloadAll | ( | ) |
Unload every loaded plugin, newest first.
Definition at line 65 of file PluginLoader.cpp.
Referenced by ~PluginLoader().