VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
ButtonPressMessage.hpp
Go to the documentation of this file.
1#pragma once
2
4#include <string>
5#include <string_view>
6
7namespace VoltMod
8{
9
10/**
11 * @brief The button id a custom HUD Button press carries, read out of a user message's `msg_data`.
12 *
13 * Hand-parsed: the body is not a registered message and the SDK's protos do not declare it, so
14 * there is nothing to reflect on. Every other field is skipped, so a field CS2 adds later does not
15 * stop the id from being read. SDK-free for its tests.
16 */
18{
19 /** Error::Invalid when the bytes are not well-formed protobuf, a length runs past the end, or the
20 * button id is missing or carries the wrong wire type. */
21 static Result<ButtonPressMessage> Parse(std::string_view bytes);
22
23 std::string ButtonId; ///< field 2, length-delimited: the Button's `id` attribute
24};
25
26} // namespace VoltMod
static std::string ReadFile(const std::filesystem::path &path)
Definition Loader.cpp:56
std::expected< T, Error > Result
Definition Result.hpp:64
The button id a custom HUD Button press carries, read out of a user message's msg_data.
static Result< ButtonPressMessage > Parse(std::string_view bytes)
std::string ButtonId
field 2, length-delimited: the Button's id attribute