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#include <string_view>
9
10namespace VoltMod
11{
12
13/**
14 * Fills the host's own generated offsets from the live schema, and gives @ref PluginRegistry the
15 * lookup each plugin fills its own from.
16 */
18{
19public:
20 /** Resolve the host's layout and hand @p registry the lookup. A null @p schema resolves and dumps nothing. */
21 SchemaCheck(PluginRegistry& registry, ISchemaSystem* schema);
22
23 /** Write the dump once a map's entities exist: at most once per process, never over a dump of this build. */
24 void OnServerStartup();
25
26private:
27 void Check();
28
29 PluginRegistry& _registry;
30 ISchemaSystem* _schema = nullptr;
31 bool _schemaLoaded = false; ///< false while the schema scope did not exist to resolve against
32};
33
34namespace Schema
35{
36
37/** Where the live server schema lays out @p field of @p className or its bases; Offset -1 when gone. */
38LiveField FindLiveField(ISchemaSystem* schema, std::string_view className, std::string_view field);
39
40/**
41 * Write `addons/voltmod/gamedata/dumps/schema.json` for `voltmod framework schemagen` unless it matches this build.
42 * Null @p entities (before the first map) writes nothing: the networked flags need its serializers.
43 */
44void WriteSchemaDump(ISchemaSystem* schema, CGameEntitySystem* entities);
45
46} // namespace Schema
47} // namespace VoltMod
The loaded plugins and the engine events raised on them, one per process.
SchemaCheck(PluginRegistry &registry, ISchemaSystem *schema)
LiveField FindLiveField(ISchemaSystem *schema, std::string_view className, std::string_view field)
void WriteSchemaDump(ISchemaSystem *schema, CGameEntitySystem *entities)