VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
SchemaCheck.hpp
Go to the documentation of this file.
1#pragma once
2
4
8
9namespace VoltMod
10{
11
12/**
13 * Compares the baked schema offsets with the live game once per process. The answer is recorded on
14 * @ref PluginRegistry and covers only plugins carrying the same layout stamp.
15 */
17{
18public:
19 /** Compare the layout once and record the answer on @p registry. Null interfaces check and dump nothing. */
21
22 /** Write the dump once a map's entities exist: at most once per process, never over a dump of this build. */
23 void OnServerStartup();
24
25private:
26 void Check();
27
28 /** The entity system the engine caches in the resource service, null before the first map. */
29 CGameEntitySystem* Entities() const;
30
31 PluginRegistry& _registry;
32 ISchemaSystem* _schema = nullptr;
33 IGameResourceService* _resources = nullptr;
34 int _entitySystemOffset = -1;
35 bool _schemaLoaded = false; ///< false while the schema scope did not exist to compare against
36};
37
38namespace Schema
39{
40
41/**
42 * Compare @ref GeneratedLayout with the live schema. Stale offsets hit wrong addresses, so a plugin
43 * built from this layout refuses to load when it fails.
44 * @return Every mismatch in one message, or ErrorCode::NotReady before the server scope exists.
45 */
47
48/**
49 * Write `addons/voltmod/gamedata/dumps/schema.json` for `voltmod framework schemagen` unless it matches this build.
50 * Null @p entities (before the first map) writes nothing: the networked flags need its serializers.
51 */
53
54} // namespace Schema
55} // namespace VoltMod
The loaded plugins and the engine events raised on them, one per process.
Status VerifySchemaLayout(ISchemaSystem *schema)
void WriteSchemaDump(ISchemaSystem *schema, CGameEntitySystem *entities)
static std::string ReadFile(const std::filesystem::path &path)
Definition Loader.cpp:56
std::expected< void, Error > Status
Definition Result.hpp:67