Temp commit. Need to store all sh... Changes

This commit is contained in:
korenkonder
2022-06-13 02:18:05 +03:00
parent 913c874c01
commit 82da8a484d
261 changed files with 23706 additions and 17661 deletions
+64
View File
@@ -0,0 +1,64 @@
/*
by korenkonder
GitHub/GitLab: korenkonder
*/
#include "header.hpp"
void f2_header_read(stream& s, f2_header* h) {
memset(h, 0, sizeof(f2_header));
switch (s.type) {
case STREAM_FILE:
if (!s.io.stream)
return;
break;
case STREAM_MEMORY:
if (!s.io.data.vec.size())
return;
break;
default:
return;
}
s.read(h, 0x20);
if (h->length == 0x40)
s.read((uint8_t*)h + 0x20, 0x20);
}
void f2_header_write(stream& s, f2_header* h, bool extended) {
switch (s.type) {
case STREAM_FILE:
if (!s.io.stream)
return;
break;
case STREAM_MEMORY:
break;
default:
return;
}
h->length = extended ? 0x40 : 0x20;
s.write(h, h->length);
}
void f2_header_write_end_of_container(stream& s, uint32_t depth) {
switch (s.type) {
case STREAM_FILE:
if (!s.io.stream)
return;
break;
case STREAM_MEMORY:
break;
default:
return;
}
f2_header h;
memset(&h, 0, sizeof(f2_header));
h.signature = reverse_endianness_uint32_t('EOFC');
h.length = 0x20;
h.depth = depth;
h.use_section_size = true;
f2_header_write(s, &h, false);
}