9 std::vector<flash_payload_header>
parse_payloads(
const std::vector<uint8_t>& flash_buffer,
size_t number_of_payloads)
11 std::vector<flash_payload_header> rv;
13 for (
int i = 0;
i < number_of_payloads;
i++)
16 memcpy(&fph, flash_buffer.data() +
i *
sizeof(fph),
sizeof(fph));
25 std::vector<flash_table> rv;
28 std::vector<uint32_t>
offsets(num_of_tables);
29 for (
int i = 0;
i < num_of_tables;
i++)
34 for (
auto&& o : offsets)
37 memcpy(&
h, flash_buffer.data() + o,
sizeof(
h));
39 std::vector<uint8_t>
d;
40 if (
h.type == 0 ||
h.size == 0 ||
h.size > 0x1000)
44 memcpy(d.data(), flash_buffer.data() + o +
sizeof(
h), d.size());
47 auto it = std::find_if(types.begin(), types.end(), [
h](
uint16_t t) {
return t ==
h.type; });
48 bool read_only =
it != types.end();
59 std::vector<uint8_t> rv(image);
84 memcpy(&rv.
header, flash_buffer.data() + toc_offset,
sizeof(rv.
header));
86 memcpy(rv.
data.data(), flash_buffer.data() + toc_offset +
sizeof(rv.
header), rv.
data.size());
flash_section parse_flash_section(const std::vector< uint8_t > &flash_buffer, flash_table toc, flash_structure s)
std::vector< flash_payload_header > payloads
flash_table_header header
std::vector< uint16_t > read_only_sections_types
GLfloat GLfloat GLfloat GLfloat h
GLenum GLenum GLsizei void * image
std::vector< flash_table > parse_tables(const std::vector< uint8_t > &flash_buffer, flash_table toc, flash_structure structure)
flash_table table_of_content
GLsizei GLenum GLenum * types
std::vector< flash_payload_header > parse_payloads(const std::vector< uint8_t > &flash_buffer, size_t number_of_payloads)
flash_section read_write_section
std::vector< uint8_t > data
unsigned __int64 uint64_t
std::vector< uint8_t > merge_images(flash_info from, flash_info to, const std::vector< uint8_t > image)
flash_table parse_table_of_contents(const std::vector< uint8_t > &flash_buffer, uint32_t toc_offset)
GLuint GLsizei const GLuint const GLintptr * offsets
GLenum GLenum GLsizei void * table
std::vector< flash_table > tables
flash_section read_only_section