12#include <inetchannel.h>
13#include <networksystem/inetworkmessages.h>
14#include <networksystem/netmessage.h>
29 if (!
engine.NetworkMessages)
43 return std::unexpected(
Error::Unsupported(
"the FilterMessage client offset did not bind"));
47 _messageId =
message->GetNetMessageInfo()->m_MessageId;
59 return std::unexpected(
hook.error());
61 _hook = std::move(*
hook);
68 for (
const Press&
press : std::exchange(_queued, {}))
74const ButtonPresses::MessageFields& ButtonPresses::FieldsOf(
const ProtoMessage&
proto)
76 static const MessageFields fields = [&
proto] {
91 if (!
info ||
info->GetNetMessageInfo()->m_MessageId != _messageId)
101 const MessageFields& fields = FieldsOf(*
proto);
126 if (
payload->ButtonId.find(
'\0') != std::string::npos)
131 _queued.push_back({.Slot =
slot, .ButtonId = std::move(
payload->ButtonId)});
134void ButtonPresses::WarnMalformed(
int slot, std::string_view
detail)
bool TryStart(const TKey &key, int64_t nowSec, int64_t seconds)
The loaded plugins and the engine events raised on them, one per process.
void RaiseButtonPress(int slot, std::string_view buttonId)
static double MonotonicSeconds()
void Warn(std::format_string< Args... > fmt, Args &&... args)
Result< Subscription > HookVirtual(std::string_view name, const VirtualFn< Ret(Object *, Args...)> &function, Before &&before, After &&after=nullptr)
Hook a gamedata-bound virtual function on objects sharing its class vtable.
static constexpr int32_t CustomHudClickType
google::protobuf::Message ProtoMessage
int ClientSlot(const Bindings &bindings, const void *client)
static std::string ReadFile(const std::filesystem::path &path)
constexpr bool IsValidSlot(int slot)
static constexpr std::string_view UserMessageName
std::expected< void, Error > Status
const void * FilterClient(const Bindings &bindings, const INetworkMessageProcessingPreFilter &filter)
static constexpr int64_t WarningIntervalSeconds
const ProtoFieldDescriptor * ProtoField(const ProtoMessage &message, std::string_view name)
VirtualFn< bool(INetworkMessageProcessingPreFilter *, const CNetMessage *, INetChannel *)> FilterMessage
Offset< void > ClientMessageFilter
static Error Engine(std::string detail)
static Error Unsupported(std::string detail)