Fixed writing of Modern Object Set (and Modern files in general)

This commit is contained in:
korenkonder
2025-06-15 20:48:02 +03:00
parent 357fdf7386
commit 68185aa02b
3 changed files with 5 additions and 6 deletions
+1 -1
View File
@@ -174,7 +174,7 @@ bool f2_header::validate_crc(int32_t not_ignore_crc) {
}
void f2_header::write(stream& s) {
if (s.check_null())
if (s.check_null() && !reinterpret_cast<struct memory_stream*>(&s))
return;
s.write(this, get_length());
+1 -1
View File
@@ -120,7 +120,7 @@ void f2_struct::write(void** data, size_t* size, bool use_depth, bool shift_x) {
}
void f2_struct::write(stream& s, bool use_depth, bool shift_x) {
if (s.check_null())
if (s.check_null() && !reinterpret_cast<memory_stream*>(&s))
return;
f2_struct_get_length(this, shift_x);
+3 -4
View File
@@ -4270,9 +4270,8 @@ static void obj_set_modern_write_inner(obj_set* set, stream& s) {
s_omdl.big_endian = big_endian;
if (obj->skin) {
st.sub_structs.push_back({});
omdl = &st.sub_structs.end()[-2];
f2_struct* oskn = &st.sub_structs.back();
omdl->sub_structs.push_back({});
f2_struct* oskn = &omdl->sub_structs.back();
memory_stream s_oskn;
s_oskn.open();
@@ -4285,7 +4284,7 @@ static void obj_set_modern_write_inner(obj_set* set, stream& s) {
s_oskn.close();
new (&oskn->header) f2_header('OSKN');
oskn->header.attrib.set_big_endian(big_endian);
omdl->header.attrib.set_big_endian(big_endian);
}
obj_modern_write_model(obj, s_omdl, 0, is_x, omdl);