VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
Detours.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
VoltMod/Engine/EngineTypes.hpp
>
4
#include <khook.hpp>
5
6
// KHook's dispatch pointer, declared for every translation unit that installs a hook.
7
//
8
// Each module carries its own copy, because KHook's header forwards every call through it. The
9
// host fills its own from the loader; a plugin defines one in its generated entry point and seeds it from
10
// IPluginContext::HookDispatcher(). It lives in Engine because vtable hooks must not depend on the
11
// composition root.
12
namespace
KHook
13
{
14
extern
KHook::IKHook*
__exported__khook
;
15
}
16
17
namespace
VoltMod
18
{
19
20
/** What @p vtable's @p index held before a hook patched it, or nullptr. */
21
inline
const
void
*
ReadOriginalSlot
(
void
**
vtable
,
int
index)
22
{
23
// The pointer arrives at load; before then there is nothing to query.
24
return
KHook::__exported__khook
? KHook::FindOriginalVirtual(
vtable
, index) :
nullptr
;
25
}
26
27
}
// namespace VoltMod
EngineTypes.hpp
KHook
Definition
Detours.hpp:13
KHook::__exported__khook
KHook::IKHook * __exported__khook
Definition
Host.cpp:30
VoltMod
Definition
Options.hpp:13
VoltMod::ReadFile
static std::string ReadFile(const std::filesystem::path &path)
Definition
Loader.cpp:56
VoltMod::ReadOriginalSlot
const void * ReadOriginalSlot(void **vtable, int index)
Definition
Detours.hpp:21
include
VoltMod
Engine
Detours.hpp
Generated by
1.9.8