citra-emu
/
citra-canary
Archived
1
0
Fork 0

Serialize FS service; some compiler fixes

This commit is contained in:
Hamish Milne 2019-12-27 11:46:10 +00:00 committed by zhupengfei
parent d1096de245
commit 3ed8d95866
10 changed files with 62 additions and 45 deletions

View File

@ -22,7 +22,6 @@
#include "core/hle/kernel/server_session.h"
BOOST_SERIALIZATION_ASSUME_ABSTRACT(Kernel::SessionRequestHandler)
BOOST_SERIALIZATION_ASSUME_ABSTRACT(Kernel::SessionRequestHandler::SessionDataBase)
namespace Service {
class ServiceFrameworkBase;
@ -282,3 +281,5 @@ private:
};
} // namespace Kernel
BOOST_CLASS_EXPORT_KEY(Kernel::SessionRequestHandler::SessionDataBase)

View File

@ -27,16 +27,7 @@
#include "core/hw/aes/ccm.h"
#include "core/hw/aes/key.h"
namespace boost::serialization {
template <class Archive>
void load_construct_data(Archive& ar, Service::APT::Module* t, const unsigned int)
{
::new(t)Service::APT::Module(Core::Global<Core::System>());
}
template
void load_construct_data<iarchive>(iarchive& ar, Service::APT::Module* t, const unsigned int);
}
SERVICE_CONSTRUCT_IMPL(Service::APT::Module)
namespace Service::APT {

View File

@ -9,17 +9,7 @@
#include "core/hle/result.h"
#include "core/hle/service/csnd/csnd_snd.h"
namespace boost::serialization {
template <class Archive>
void load_construct_data(Archive& ar, Service::CSND::CSND_SND* t, const unsigned int)
{
::new(t)Service::CSND::CSND_SND(Core::Global<Core::System>());
}
template
void load_construct_data<iarchive>(iarchive& ar, Service::CSND::CSND_SND* t, const unsigned int);
}
SERVICE_CONSTRUCT_IMPL(Service::CSND::CSND_SND)
SERIALIZE_EXPORT_IMPL(Service::CSND::CSND_SND)
namespace Service::CSND {

View File

@ -260,6 +260,7 @@ private:
template <class Archive>
void serialize(Archive& ar, const unsigned int)
{
ar & boost::serialization::base_object<Kernel::SessionRequestHandler>(*this);
ar & mutex;
ar & shared_memory;
ar & capture_units;

View File

@ -15,17 +15,7 @@ using DspPipe = AudioCore::DspPipe;
using InterruptType = Service::DSP::DSP_DSP::InterruptType;
SERIALIZE_EXPORT_IMPL(Service::DSP::DSP_DSP)
namespace boost::serialization {
template <class Archive>
void load_construct_data(Archive& ar, Service::DSP::DSP_DSP* t, const unsigned int)
{
::new(t)Service::DSP::DSP_DSP(Core::Global<Core::System>());
}
template
void load_construct_data<iarchive>(iarchive& ar, Service::DSP::DSP_DSP* t, const unsigned int);
}
SERVICE_CONSTRUCT_IMPL(Service::DSP::DSP_DSP)
namespace AudioCore {
enum class DspPipe;

View File

@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include <cinttypes>
#include "common/archives.h"
#include "common/assert.h"
#include "common/common_types.h"
#include "common/file_util.h"
@ -25,6 +26,10 @@
#include "core/hle/service/fs/fs_user.h"
#include "core/settings.h"
SERVICE_CONSTRUCT_IMPL(Service::FS::FS_USER)
SERIALIZE_EXPORT_IMPL(Service::FS::FS_USER)
SERIALIZE_EXPORT_IMPL(Service::FS::ClientSlot)
////////////////////////////////////////////////////////////////////////////////////////////////////
// Namespace FS_User

View File

@ -22,6 +22,14 @@ struct ClientSlot : public Kernel::SessionRequestHandler::SessionDataBase {
// behaviour is modified. Since we don't emulate fs:REG mechanism, we assume the program ID is
// the same as codeset ID and fetch from there directly.
u64 program_id = 0;
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int)
{
ar & program_id;
}
friend class boost::serialization::access;
};
class FS_USER final : public ServiceFramework<FS_USER, ClientSlot> {
@ -545,8 +553,20 @@ private:
Core::System& system;
ArchiveManager& archives;
template <class Archive>
void serialize(Archive& ar, const unsigned int)
{
ar & boost::serialization::base_object<Kernel::SessionRequestHandler>(*this);
ar & priority;
}
friend class boost::serialization::access;
};
void InstallInterfaces(Core::System& system);
} // namespace Service::FS
SERVICE_CONSTRUCT(Service::FS::FS_USER)
BOOST_CLASS_EXPORT_KEY(Service::FS::FS_USER)
BOOST_CLASS_EXPORT_KEY(Service::FS::ClientSlot)

View File

@ -220,4 +220,21 @@ extern const std::array<ServiceModuleInfo, 40> service_module_map;
ar & boost::serialization::base_object<Kernel::SessionRequestHandler>(*this); \
} \
friend class boost::serialization::access; \
friend class construct_access;
friend class ::construct_access;
#define SERVICE_CONSTRUCT(T) \
namespace boost::serialization { \
template <class Archive> \
void load_construct_data(Archive& ar, T* t, const unsigned int); \
}
#define SERVICE_CONSTRUCT_IMPL(T) \
namespace boost::serialization { \
template <class Archive> \
void load_construct_data(Archive& ar, T* t, const unsigned int) \
{ \
::new(t)T(Core::Global<Core::System>()); \
} \
template \
void load_construct_data<iarchive>(iarchive& ar, T* t, const unsigned int); \
}

View File

@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include <catch2/catch.hpp>
#include "common/archives.h"
#include "core/core.h"
#include "core/core_timing.h"
#include "core/hle/ipc.h"
@ -14,6 +15,8 @@
#include "core/hle/kernel/process.h"
#include "core/hle/kernel/server_session.h"
SERIALIZE_EXPORT_IMPL(Kernel::SessionRequestHandler::SessionDataBase)
namespace Kernel {
static std::shared_ptr<Object> MakeObject(Kernel::KernelSystem& kernel) {

View File

@ -18,18 +18,17 @@
// Boost::serialization doesn't like union types for some reason,
// so we need to mark arrays of union values with a special serialization method
template<typename Value, size_t Size>
struct UnionArray : public std::array<Value, Size> { };
namespace boost::serialization {
template<class Archive, typename Value, size_t Size>
void serialize(Archive& ar, UnionArray<Value, Size>& array, const unsigned int version)
struct UnionArray : public std::array<Value, Size>
{
private:
template<class Archive>
void serialize(Archive& ar, const unsigned int)
{
static_assert(sizeof(Value) == sizeof(u32));
ar & *static_cast<u32 (*)[Size]>(static_cast<void *>(array.data()));
}
}
ar & *static_cast<u32 (*)[Size]>(static_cast<void *>(this->data()));
}
friend class boost::serialization::access;
};
namespace Pica {