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

Classes

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

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 ToLanguageCode (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 ResolveSchema (const IPluginContext &host)

Variables

static constexpr std::array SteamLanguages

Typedef Documentation

◆ InterfaceLookup

using VoltMod::Internal::InterfaceLookup = void* (IPluginContext::*)(const char* version) const

Definition at line 61 of file Plugin.cpp.

◆ PluginFactory

using VoltMod::Internal::PluginFactory = std::unique_ptr<Plugin> (*)(Runtime&)

Definition at line 21 of file PluginModule.hpp.

Function Documentation

◆ 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 )

ChoiceRow's row with its values reduced to indices; build rows with ChoiceRow instead.

Definition at line 178 of file MenuBuilder.cpp.

References VoltMod::AfterStep, VoltMod::Choice, VoltMod::DescribeRow(), VoltMod::MenuRow::Steppable, VoltMod::MenuRow::Value, and VoltMod::WhenEnabled().

Referenced by VoltMod::ChoiceRow< T >::ToItem().

◆ 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::IPluginEvents::Unsubscribe().

Referenced by VoltMod::WatchCommands(), and VoltMod::WatchPresses().

◆ MakePluginModule()

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

◆ OpenUnsafe()

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 76 of file Plugin.cpp.

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

◆ Resolve()

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

Definition at line 64 of file Plugin.cpp.

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

Referenced by OpenUnsafe().

◆ ResolveSchema()

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

Fill this module's generated offsets from the running server before any accessor runs.

Definition at line 123 of file Plugin.cpp.

References VoltMod::IPluginContext::FindSchemaField(), VoltMod::Schema::GeneratedLayout(), and VoltMod::Schema::ResolveLayout().

◆ 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::HookResult< Ret >::Action(), 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::HookResult< Ret >::Action(), and ToKHookAction().

◆ ToKHookAction()

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

Definition at line 21 of file Hook.hpp.

References VoltMod::Block, and VoltMod::Replace.

Referenced by ToKHook(), and ToKHook().

◆ ToLanguageCode()

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

Definition at line 24 of file ClientLanguage.cpp.

References SteamLanguages.

Referenced by VoltMod::Internal::ClientLanguage::ClientLanguage().

◆ 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.

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

Variable Documentation

◆ SteamLanguages

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 ToLanguageCode().