t8-mod/source/proxy-dll/demonware/protobuf.hpp
project-bo4 e00fdf473a Fix Release Build Environment
+ addressed every code safety demands compiler had in order to make it possible to build in release configuration without suppressing warning(warning C4244 still had to be suppressed because it was coming from external libraries xxhash and stb)

+ changed to proxying XInput9_1_0 instead of directx11 interface

+ recoded protocolbuffer helper

+ improved variable namings in fileshare

- removed ida_defs.h header as its not needed anymore
2024-08-16 07:36:41 +03:30

33 lines
870 B
C++

#include <cstdint>
#include <string>
enum eWireType
{
WIRETYPE_VARINT = 0,
WIRETYPE_64BIT = 1,
WIRETYPE_STRING = 2,
WIRETYPE_32BIT = 5,
WIRETYPE_INVALID = -1
};
class bdProtobufHelper {
public:
std::string buffer;
size_t length = 0;
bdProtobufHelper() = default;
~bdProtobufHelper() = default;
bool encodeString(const char* value, uint32_t len);
bool encodeTag(uint32_t tagId, eWireType wireType);
bool writeInt64(uint32_t tag, int64_t value);
bool writeUInt64(uint32_t tag, uint64_t value);
bool writeInt32(uint32_t tag, int32_t value);
bool writeUInt32(uint32_t tag, uint32_t value);
bool writeString(uint32_t tag, const char* value, uint32_t size);
bool writeBlob(uint32_t tag, void* data, uint32_t size);
private:
bool encodeVarInt(uint64_t value);
bool encodeVarInt(int64_t value);
};