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

Classes

class  ClientLanguage
 
struct  HostCallback
 
struct  HostCallback< Member >
 
class  HostPlayerLanguages
 
class  InstalledHook
 
class  PluginModule
 
struct  SteamLanguage
 

Concepts

concept  PluginType
 

Typedefs

using PluginFactory = std::unique_ptr< Plugin >(*)(Runtime &)
 
using InterfaceLookup = void *(IPluginContext::*)(const char *version) const
 

Functions

template<PluginType T>
PluginModule MakePluginModule ()
 
MenuItem ChoiceItem (std::string label, std::vector< std::string > choices, std::function< void(int slot, int index)> commit, std::optional< ChoiceIndex > bind, int index, EnabledCondition enabled, ChoiceApply apply)
 
KHook::Action ToKHookAction (HookAction action)
 
template<class Ret >
KHook::Return< Ret > ToKHook (HookResult< Ret > result)
 
KHook::Return< void > ToKHook (HookResult< void > result)
 
template<class Hook >
Subscription ToSubscription (std::unique_ptr< Hook > hook)
 
static std::string_view CodeFor (std::string_view steamLanguage)
 
Subscription HostSubscription (IPluginEvents &events, uint64_t token)
 
template<class T >
static Status Resolve (T *&field, const IPluginContext &host, InterfaceLookup lookup, const char *version)
 
static Result< std::unique_ptr< UnsafeServices > > OpenUnsafe (IPluginContext &host)
 
static Status CheckSchema (const IPluginContext &host)
 

Variables

static constexpr std::array SteamLanguages
 

Typedef Documentation

◆ InterfaceLookup

Definition at line 60 of file Plugin.cpp.

◆ PluginFactory

Definition at line 21 of file PluginModule.hpp.

Function Documentation

◆ CheckSchema()

static Status VoltMod::Internal::CheckSchema ( const IPluginContext &  host)
static

The host's one schema check covers this plugin only when both baked the same layout.

Definition at line 120 of file Plugin.cpp.

References VoltMod::Schema::GeneratedLayoutStamp(), VoltMod::Error::Invalid(), VoltMod::IPluginContext::SchemaLayoutStamp(), and VoltMod::IPluginContext::SchemaVerified().

◆ ChoiceItem()

MenuItem VoltMod::Internal::ChoiceItem ( std::string  label,
std::vector< std::string >  choices,
std::function< void(int slot, int index)>  commit,
std::optional< ChoiceIndex >  bind,
int  index,
EnabledCondition  enabled,
ChoiceApply  apply 
)

◆ CodeFor()

static std::string_view VoltMod::Internal::CodeFor ( std::string_view  steamLanguage)
static

◆ HostSubscription()

Subscription VoltMod::Internal::HostSubscription ( IPluginEvents &  events,
uint64_t  token 
)
inline

Unsubscribes host event token when dropped; events must outlive it.

Definition at line 40 of file HostCallback.hpp.

References VoltMod::ReadFile().

Referenced by VoltMod::ListenForCommands(), and VoltMod::ListenForPresses().

◆ MakePluginModule()

template<PluginType T>
PluginModule VoltMod::Internal::MakePluginModule ( )

Definition at line 68 of file PluginModule.hpp.

References VoltMod::ReadFile().

◆ OpenUnsafe()

static Result< std::unique_ptr< UnsafeServices > > VoltMod::Internal::OpenUnsafe ( IPluginContext &  host)
static

Resolve the engine interfaces and bind the host's gamedata. Fails when an interface is missing; a gamedata failure is kept in GameData, and the services that need it say so.

Definition at line 75 of file Plugin.cpp.

References VoltMod::Error::Engine(), VoltMod::IPluginContext::EngineInterface(), VoltMod::IPluginContext::GameData(), VoltMod::ReadFile(), Resolve(), and VoltMod::IPluginContext::ServerInterface().

◆ Resolve()

template<class T >
static Status VoltMod::Internal::Resolve ( T *&  field,
const IPluginContext &  host,
InterfaceLookup  lookup,
const char *  version 
)
static

Definition at line 63 of file Plugin.cpp.

References VoltMod::Error::NotReady(), VoltMod::ReadFile(), and VoltMod::T.

Referenced by OpenUnsafe().

◆ ToKHook() [1/2]

template<class Ret >
KHook::Return< Ret > VoltMod::Internal::ToKHook ( HookResult< Ret >  result)

KHook ignores the default value carried by an Allow result.

Definition at line 36 of file Hook.hpp.

References VoltMod::ReadFile(), and ToKHookAction().

◆ ToKHook() [2/2]

KHook::Return< void > VoltMod::Internal::ToKHook ( HookResult< void >  result)
inline

Definition at line 41 of file Hook.hpp.

References VoltMod::ReadFile(), and ToKHookAction().

◆ ToKHookAction()

KHook::Action VoltMod::Internal::ToKHookAction ( HookAction  action)
inline

Definition at line 21 of file Hook.hpp.

References VoltMod::Block, VoltMod::ReadFile(), and VoltMod::Replace.

Referenced by ToKHook(), and ToKHook().

◆ ToSubscription()

template<class Hook >
Subscription VoltMod::Internal::ToSubscription ( std::unique_ptr< Hook >  hook)

Return a subscription that removes the hook when destroyed.

Definition at line 123 of file Hook.hpp.

References VoltMod::ReadFile().

Referenced by VoltMod::HookFunction(), VoltMod::HookInterface(), and VoltMod::HookVirtual().

Variable Documentation

◆ SteamLanguages

constexpr std::array VoltMod::Internal::SteamLanguages
staticconstexpr
Initial value:
{
SteamLanguage{.Steam = "english", .Code = "en"}, SteamLanguage{.Steam = "russian", .Code = "ru"},
SteamLanguage{.Steam = "ukrainian", .Code = "uk"}, SteamLanguage{.Steam = "german", .Code = "de"},
SteamLanguage{.Steam = "french", .Code = "fr"}, SteamLanguage{.Steam = "spanish", .Code = "es"},
SteamLanguage{.Steam = "portuguese", .Code = "pt"}, SteamLanguage{.Steam = "polish", .Code = "pl"},
SteamLanguage{.Steam = "turkish", .Code = "tr"},
}

Steam's language names; a code no plugin translates falls back to the server language.

Definition at line 16 of file ClientLanguage.cpp.

Referenced by CodeFor().