VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
GameDataTable.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
Host/GameData/GameDataDocument.hpp
"
4
#include "
Host/GameData/GameDataScanner.hpp
"
5
6
#include <
VoltMod/Engine/Memory/OriginalSlotLookup.hpp
>
7
#include <
VoltMod/Host/IPluginGameData.hpp
>
8
#include <memory>
9
#include <string>
10
#include <string_view>
11
12
namespace
VoltMod
13
{
14
15
/** The process's one gamedata resolution, made at host load and served to every plugin. What
16
* did not bind is logged here once; each plugin's services report it again as unavailable. */
17
class
GameDataTable
final
:
public
IPluginGameData
18
{
19
public
:
20
/** Read and resolve @p path. @p originalOf reads a slot another module already hooked. */
21
explicit
GameDataTable
(std::string_view path,
const
OriginalSlotLookup
&
originalOf
= {},
22
const
ScriptBindingLookup
&
scriptOf
= {});
23
24
/** False when the file could not be read. */
25
bool
Ready
()
const
{
return
_scanner !=
nullptr
; }
26
27
GameDataLocation
Lookup
(
GameDataSection
sections
, std::string_view
key
)
override
;
28
29
private
:
30
/** An entry that did not bind, keeping @p reason until the next lookup. */
31
GameDataLocation
NotBound(std::string
reason
);
32
33
// The scanner keeps a reference to the document, so the two live and die together.
34
std::unique_ptr<GameDataDocument> _file;
35
std::unique_ptr<GameDataScanner> _scanner;
36
OriginalSlotLookup
_originalOf;
37
ScriptBindingLookup
_scriptOf;
38
std::string _reason;
39
};
40
41
}
// namespace VoltMod
GameDataDocument.hpp
GameDataScanner.hpp
IPluginGameData.hpp
OriginalSlotLookup.hpp
VoltMod::GameDataTable
Definition
GameDataTable.hpp:18
VoltMod::GameDataTable::Lookup
GameDataLocation Lookup(GameDataSection sections, std::string_view key) override
Definition
GameDataTable.cpp:42
VoltMod::GameDataTable::Ready
bool Ready() const
Definition
GameDataTable.hpp:25
VoltMod
Definition
Options.hpp:13
VoltMod::ScriptBindingLookup
std::function< Result< ScriptTarget >(void *classTable, std::string_view name)> ScriptBindingLookup
Definition
ScriptBindings.hpp:19
VoltMod::ReadFile
static std::string ReadFile(const std::filesystem::path &path)
Definition
Loader.cpp:56
VoltMod::OriginalSlotLookup
std::function< const void *(void **vtable, int index)> OriginalSlotLookup
Definition
OriginalSlotLookup.hpp:13
VoltMod::GameDataSection
GameDataSection
Definition
GameDataLocation.hpp:11
VoltMod::GameDataLocation
Definition
GameDataLocation.hpp:25
VoltMod::IPluginGameData
Definition
IPluginGameData.hpp:11
src
Host
GameData
GameDataTable.hpp
Generated by
1.9.8