steam-min-cpp
Loading...
Searching...
No Matches
msg_utils.hpp
1
3// GPT
4
5#pragma once
6#include <cstddef>
7#include <cstdint>
8#include <iostream>
9#include <steamclient/types/generated/SteamLanguage.hpp>
10#include <string>
11#include <vector>
12
13namespace Steam::Utils::MsgUtil {
14static constexpr uint32_t PROTO_MASK = 0x80000000;
15
16inline uint32_t make_msg(Steam::Internal::Enums::EMsg msg, bool isProto) {
17 uint32_t value = static_cast<uint32_t>(msg);
18 return isProto ? (value | PROTO_MASK) : value;
19}
20
21inline Steam::Internal::Enums::EMsg get_msg(uint32_t raw) {
22 return static_cast<Steam::Internal::Enums::EMsg>(raw & ~PROTO_MASK);
23}
24
25inline uint32_t make_gc_msg(uint32_t msg, bool isProto) {
26 return isProto ? (msg | PROTO_MASK) : msg;
27}
28
29inline uint32_t get_gc_msg(uint32_t raw) { return raw & ~PROTO_MASK; }
30
31inline static bool is_protobuf_msg(uint32_t emsg) {
32 return (emsg & PROTO_MASK) > 0;
33}
34} // namespace Steam::Utils::MsgUtil