VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
VoltMod::PluginLoader Class Reference

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 &registry, 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

Detailed Description

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.

Member Enumeration Documentation

◆ ActionKind

Enumerator
Load 
Unload 
Reload 

Definition at line 37 of file PluginLoader.hpp.

Constructor & Destructor Documentation

◆ PluginLoader() [1/2]

VoltMod::PluginLoader::PluginLoader ( PluginRegistry & registry,
ServerAssets & assets )

Definition at line 50 of file PluginLoader.cpp.

Referenced by operator=(), and PluginLoader().

◆ ~PluginLoader()

VoltMod::PluginLoader::~PluginLoader ( )

Definition at line 52 of file PluginLoader.cpp.

References UnloadAll().

◆ PluginLoader() [2/2]

VoltMod::PluginLoader::PluginLoader ( const PluginLoader & )
delete

References PluginLoader().

Member Function Documentation

◆ Defer()

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(), and VoltMod::Strings::ToLower().

◆ LoadAll()

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(), VoltMod::InstalledScan::Plugins, and VoltMod::InstalledScan::Refused.

◆ LoadedPlugins()

const std::vector< LoadedPlugin > & VoltMod::PluginLoader::LoadedPlugins ( ) const
inline

In load order; unload runs it backwards.

Definition at line 63 of file PluginLoader.hpp.

◆ operator=()

PluginLoader & VoltMod::PluginLoader::operator= ( const PluginLoader & )
delete

References PluginLoader().

◆ Refused()

const std::map< std::string, std::string > & VoltMod::PluginLoader::Refused ( ) const
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.

◆ RequireLoaded()

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::Log::Warn().

◆ RunPending()

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, Reload, and Unload.

◆ UnloadAll()

void VoltMod::PluginLoader::UnloadAll ( )

Unload every loaded plugin, newest first.

Definition at line 65 of file PluginLoader.cpp.

Referenced by ~PluginLoader().


The documentation for this class was generated from the following files: