Started IPC services serialization

This commit is contained in:
Hamish Milne
2019-12-24 17:49:56 +00:00
committed by zhupengfei
parent 7a5bde0b44
commit ac0337d8df
8 changed files with 112 additions and 7 deletions

View File

@@ -11,6 +11,7 @@
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/string.hpp>
#include <boost/serialization/unordered_map.hpp>
#include <boost/serialization/split_member.hpp>
#include "core/hle/kernel/client_port.h"
#include "core/hle/kernel/object.h"
#include "core/hle/kernel/server_port.h"
@@ -85,11 +86,23 @@ private:
std::unordered_map<u32, std::string> registered_services_inverse;
template <class Archive>
void serialize(Archive& ar, const unsigned int file_version)
void save(Archive& ar, const unsigned int file_version) const
{
ar & registered_services;
ar & registered_services_inverse; // TODO: Instead, compute this from registered_services
ar << registered_services;
}
template <class Archive>
void load(Archive& ar, const unsigned int file_version)
{
ar >> registered_services;
registered_services_inverse.clear();
for (const auto& pair : registered_services) {
registered_services_inverse.emplace(pair.second->GetObjectId(), pair.first);
}
}
BOOST_SERIALIZATION_SPLIT_MEMBER()
friend class boost::serialization::access;
};