[ox/preloader] Fix Vector preloading

This commit is contained in:
Gary Talent 2022-12-04 22:31:51 -06:00
parent fe42702e88
commit cd4a9300a5

View File

@ -188,7 +188,7 @@ constexpr ox::Error Preloader<PlatSpec>::field(CRStringView, const ox::BasicStri
} else { } else {
a = restore; a = restore;
} }
vecVal.items = sz ? PlatSpec::correctEndianness(static_cast<typename PlatSpec::size_t>(a) + PlatSpec::RomStart) : 0; vecVal.items = PlatSpec::correctEndianness(static_cast<typename PlatSpec::size_t>(a) + PlatSpec::RomStart);
oxReturnError(m_writer.seekp(a)); oxReturnError(m_writer.seekp(a));
oxReturnError(m_writer.write(val->data(), sz)); oxReturnError(m_writer.write(val->data(), sz));
oxReturnError(m_writer.seekp(restore)); oxReturnError(m_writer.seekp(restore));
@ -306,7 +306,7 @@ constexpr ox::Error Preloader<PlatSpec>::fieldVector(CRStringView, const auto *v
} }
// serialize the Vector // serialize the Vector
oxReturnError(serialize(&m_writer, vecVal)); oxReturnError(serialize(&m_writer, vecVal));
m_ptrs.emplace_back(vecValPt + offsetof(ox::VectorMemMap<PlatSpec>, items), vecVal.items); m_ptrs.emplace_back(m_writer.tellp() - PlatSpec::PtrSize, vecVal.items);
return {}; return {};
} }