VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
View.hpp
Go to the documentation of this file.
1#pragma once
2
4#include <cstdint>
5
6namespace VoltMod::Schema
7{
8
9/**
10 * @brief Base of every generated schema view: a frame-local pointer into engine memory, never stored.
11 *
12 * The owner is the entity a write notifies, at the owner offset: an entity owns itself at 0, a struct
13 * embedded by value adds its offset, and a sub-object behind a pointer has no owner and notifies
14 * through its own `__m_pChainEntity` link.
15 */
16class View
17{
18public:
19 View() = default;
20
21 /** A standalone object with no known replication route. */
22 explicit View(void* base) noexcept : _base(base) {}
23
24 /** An object at @p ownerOffset inside @p owner. */
25 View(void* base, ::CEntityInstance* owner, int32_t ownerOffset) noexcept
27 {}
28
29 /** The only validity check, as on Entity and Pawn. */
30 explicit operator bool() const noexcept { return _base != nullptr; }
31
32 /** The object this view points at. */
33 void* Base() const noexcept { return _base; }
34
35protected:
36 void* _base = nullptr;
37 ::CEntityInstance* _owner = nullptr;
39};
40
41} // namespace VoltMod::Schema
Base of every generated schema view: a frame-local pointer into engine memory, never stored.
Definition View.hpp:17
View(void *base) noexcept
Definition View.hpp:22
int32_t _ownerOffset
Definition View.hpp:38
void * Base() const noexcept
Definition View.hpp:33
::CEntityInstance * _owner
Definition View.hpp:37
View(void *base, ::CEntityInstance *owner, int32_t ownerOffset) noexcept
Definition View.hpp:25
static std::string ReadFile(const std::filesystem::path &path)
Definition Loader.cpp:56