6 #define STB_IMAGE_WRITE_IMPLEMENTATION 7 #include "../../third-party/stb_image_write.h" 15 sscanf(str.c_str(),
"%8" SCNx32
"-%4" SCNx16
"-%4" SCNx16
"-%2" SCNx8
"%2" SCNx8
"-%2" 16 SCNx8
"%2" SCNx8
"%2" SCNx8
"%2" SCNx8
"%2" SCNx8
"%2" SCNx8,
28 std::vector<uint8_t>
data = std::vector<uint8_t>())
30 std::vector<uint8_t> raw_data;
31 auto cmd_op_code =
static_cast<uint32_t>(opcode);
33 const uint16_t pre_header_data = 0xcdab;
35 auto write_ptr = raw_data.data();
36 size_t header_size = 4;
39 *
reinterpret_cast<uint16_t *
>(write_ptr + cur_index) = pre_header_data;
41 *
reinterpret_cast<unsigned int *
>(write_ptr + cur_index) = cmd_op_code;
42 cur_index +=
sizeof(
unsigned int);
45 *
reinterpret_cast<unsigned*
>(write_ptr + cur_index) =
p1;
46 cur_index +=
sizeof(unsigned);
47 *
reinterpret_cast<unsigned*
>(write_ptr + cur_index) =
p2;
48 cur_index +=
sizeof(unsigned);
49 *
reinterpret_cast<unsigned*
>(write_ptr + cur_index) = p3;
50 cur_index +=
sizeof(unsigned);
51 *
reinterpret_cast<unsigned*
>(write_ptr + cur_index) = p4;
52 cur_index +=
sizeof(unsigned);
56 cur_index +=
data.size();
58 *
reinterpret_cast<uint16_t*
>(raw_data.data()) = static_cast<uint16_t>(cur_index - header_size);
59 raw_data.resize(cur_index);
platform::guid stoguid(std::string str)
std::vector< uint8_t > encode_command(command opcode, uint32_t p1=0, uint32_t p2=0, uint32_t p3=0, uint32_t p4=0, std::vector< uint8_t > data=std::vector< uint8_t >())
GLsizei const GLchar *const * string
const uint16_t HW_MONITOR_BUFFER_SIZE
void copy(void *dst, void const *src, size_t size)