VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
LoaderHandoff.hpp
Go to the documentation of this file.
1#pragma once
2
4#include <cstddef>
5
6namespace VoltMod
7{
8
9/** A module's exported `CreateInterface`. */
10using InterfaceFactory = void* (*)(const char* name, int* returnCode);
11
12/** What the loader hands the host. They ship together, so no version; every pointer lives for the process. */
14{
16 InterfaceFactory ServerFactory = nullptr; ///< the game's own server library, never a loader in front of it
17 KHook::IKHook* HookDispatcher = nullptr; ///< the loader's KHook, which every module's hooks go through
18 const char* GameDir = nullptr; ///< the absolute `csgo` directory
19};
20
21/** Start the host. On false, it wrote why into @p error, which holds @p errorSize bytes. */
22using HostStartFn = bool (*)(const LoaderHandoff* start, char* error, size_t errorSize);
23/** Unload every plugin and remove the host's hooks. */
24using HostStopFn = void (*)();
25
26inline constexpr const char* HostStartName = "VoltMod_HostStart";
27inline constexpr const char* HostStopName = "VoltMod_HostStop";
28
29} // namespace VoltMod
static std::string ReadFile(const std::filesystem::path &path)
Definition Loader.cpp:56
void *(*)(const char *name, int *returnCode) InterfaceFactory
constexpr const char * HostStopName
constexpr const char * HostStartName
void(*)() HostStopFn
bool(*)(const LoaderHandoff *start, char *error, size_t errorSize) HostStartFn
InterfaceFactory EngineFactory
const char * GameDir
the absolute csgo directory
InterfaceFactory ServerFactory
the game's own server library, never a loader in front of it
KHook::IKHook * HookDispatcher
the loader's KHook, which every module's hooks go through