serialzation.hpp: Fix add_padding

This commit is contained in:
Elad 2024-12-25 07:02:42 +02:00
parent a5ba96e991
commit 0cc655074d
5 changed files with 14 additions and 13 deletions

View File

@ -596,7 +596,7 @@ void fmt_class_string<std::source_location>::format(std::string& out, u64 arg)
} }
} }
func = func.substr(0, index); func = func.substr(0, index) + "()";
break; break;
} }

View File

@ -479,10 +479,6 @@ public:
gem_config_data(utils::serial& ar) gem_config_data(utils::serial& ar)
{ {
save(ar); save(ar);
if (ar.is_writing())
return;
load_configs(); load_configs();
} }

View File

@ -1749,8 +1749,7 @@ namespace vm
if (is_memory_compatible_for_copy_from_executable_optimization(addr, shm.first)) if (is_memory_compatible_for_copy_from_executable_optimization(addr, shm.first))
{ {
// Revert changes // Revert changes
ar.data.resize(ar.data.size() - (sizeof(u32) * 2 + sizeof(memory_page))); ar.trunc(sizeof(u32) * 2 + sizeof(memory_page));
ar.seek_end();
vm_log.success("Removed memory block matching the memory of the executable from savestate. (addr=0x%x, size=0x%x)", addr, shm.first); vm_log.success("Removed memory block matching the memory of the executable from savestate. (addr=0x%x, size=0x%x)", addr, shm.first);
continue; continue;
} }

View File

@ -393,7 +393,7 @@ namespace stx
if ((saved ^ tag) & data_mask) if ((saved ^ tag) & data_mask)
{ {
ensure(!ar.is_writing()); ensure(!ar.is_writing());
fmt::throw_exception("serial_breathe_and_tag(%u): %s, object: '%s', next-object: '%s', expected/tag: 0x%x != 0x%x,", s_tls_call_count, ar, s_tls_object_name, name, tag, saved); fmt::throw_exception("serial_breathe_and_tag(%u): %s\nobject: '%s', next-object: '%s', expected/tag: 0x%x != 0x%x,", s_tls_call_count, ar, s_tls_object_name, name, tag, saved);
} }
s_tls_object_name = name; s_tls_object_name = name;

View File

@ -108,10 +108,10 @@ public:
{ {
if (m_is_writing) return; if (m_is_writing) return;
const u32 offset1 = ::offset32(first) + sizeof(first); const u32 offset1 = ::offset32(first) + sizeof(T);
const u32 offset2 = ::offset32(second); const u32 offset2 = ::offset32(second);
AUDIT(offset2 >= offset1); AUDIT(::offset32(first) <= ::offset32(second));
if (offset2 > offset1) if (offset2 > offset1)
{ {
@ -459,10 +459,16 @@ public:
m_file_handler.reset(); m_file_handler.reset();
} }
usz seek_end(usz backwards = 0) usz seek_end()
{ {
ensure(data.size() + data_offset >= backwards); pos = data.size() + data_offset;
pos = data.size() + data_offset - backwards; return pos;
}
usz trunc(usz count)
{
data.resize(data.size() - count);
seek_end();
return pos; return pos;
} }