mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-12-24 17:01:48 +01:00
Service serialization framework; done AC
This commit is contained in:
parent
ac0337d8df
commit
3fd5c431f1
2
TODO
2
TODO
@ -61,7 +61,7 @@
|
|||||||
Just need to figure out backing_mem (a u8*)
|
Just need to figure out backing_mem (a u8*)
|
||||||
✔ Wait object @done(19-08-13 16:46)
|
✔ Wait object @done(19-08-13 16:46)
|
||||||
☐ Service @started(19-12-23 12:49)
|
☐ Service @started(19-12-23 12:49)
|
||||||
☐ AC @started(19-12-23 12:48)
|
✔ AC @started(19-12-23 12:48) @done(19-12-24 22:38) @lasted(1d9h50m3s)
|
||||||
☐ ACT
|
☐ ACT
|
||||||
☐ AM
|
☐ AM
|
||||||
☐ APT
|
☐ APT
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
#include <boost/serialization/serialization.hpp>
|
#include <boost/serialization/serialization.hpp>
|
||||||
|
|
||||||
#define BOOST_SERIALIZATION_FRIENDS \
|
|
||||||
friend class boost::serialization::access; \
|
|
||||||
friend class construct_access;
|
|
||||||
|
|
||||||
class construct_access {
|
class construct_access {
|
||||||
public:
|
public:
|
||||||
template<class Archive, class T>
|
template<class Archive, class T>
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
#include "core/hle/service/ac/ac_u.h"
|
#include "core/hle/service/ac/ac_u.h"
|
||||||
#include "core/memory.h"
|
#include "core/memory.h"
|
||||||
|
|
||||||
SERIALIZE_EXPORT_IMPL(Service::AC::Module::Interface)
|
|
||||||
|
|
||||||
namespace Service::AC {
|
namespace Service::AC {
|
||||||
void Module::Interface::CreateDefaultConfig(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::CreateDefaultConfig(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp(ctx, 0x1, 0, 0);
|
IPC::RequestParser rp(ctx, 0x1, 0, 0);
|
||||||
@ -182,4 +180,16 @@ void InstallInterfaces(Core::System& system) {
|
|||||||
std::make_shared<AC_U>(ac)->InstallAsService(service_manager);
|
std::make_shared<AC_U>(ac)->InstallAsService(service_manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class Archive>
|
||||||
|
void Module::serialize(Archive& ar, const unsigned int)
|
||||||
|
{
|
||||||
|
ar & ac_connected;
|
||||||
|
ar & close_event;
|
||||||
|
ar & connect_event;
|
||||||
|
ar & disconnect_event;
|
||||||
|
// default_config is never written to
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Service::AC
|
} // namespace Service::AC
|
||||||
|
|
||||||
|
SERIALIZE_IMPL(Service::AC::Module)
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <boost/serialization/base_object.hpp>
|
#include <boost/serialization/base_object.hpp>
|
||||||
#include <boost/serialization/shared_ptr.hpp>
|
#include <boost/serialization/shared_ptr.hpp>
|
||||||
#include "common/construct.h"
|
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
@ -19,6 +18,8 @@ namespace Kernel {
|
|||||||
class Event;
|
class Event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_SERIALIZATION_ASSUME_ABSTRACT(Service::AC::Module::Interface)
|
||||||
|
|
||||||
namespace Service::AC {
|
namespace Service::AC {
|
||||||
class Module final {
|
class Module final {
|
||||||
public:
|
public:
|
||||||
@ -142,34 +143,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<Module> ac;
|
std::shared_ptr<Module> ac;
|
||||||
|
|
||||||
private:
|
|
||||||
template <class Archive>
|
|
||||||
void save_construct(Archive& ar, const unsigned int file_version) const
|
|
||||||
{
|
|
||||||
ar << ac;
|
|
||||||
ar << GetServiceName();
|
|
||||||
ar << GetMaxSessions();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Archive>
|
|
||||||
static void load_construct(Archive& ar, Interface* t, const unsigned int file_version)
|
|
||||||
{
|
|
||||||
std::shared_ptr<Module> ac;
|
|
||||||
std::string name;
|
|
||||||
u32 max_sessions;
|
|
||||||
ar >> ac;
|
|
||||||
ar >> name;
|
|
||||||
ar >> max_sessions;
|
|
||||||
::new(t)Interface(ac, name.c_str(), max_sessions);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Archive>
|
|
||||||
void serialize(Archive& ar, const unsigned int file_version)
|
|
||||||
{
|
|
||||||
ar & boost::serialization::base_object<Kernel::SessionRequestHandler>(*this);
|
|
||||||
}
|
|
||||||
BOOST_SERIALIZATION_FRIENDS
|
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -187,20 +160,10 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
template <class Archive>
|
template <class Archive>
|
||||||
void serialize(Archive& ar, const unsigned int file_version)
|
void serialize(Archive& ar, const unsigned int file_version);
|
||||||
{
|
|
||||||
ar & ac_connected;
|
|
||||||
ar & close_event;
|
|
||||||
ar & connect_event;
|
|
||||||
ar & disconnect_event;
|
|
||||||
// default_config is never written to
|
|
||||||
}
|
|
||||||
friend class boost::serialization::access;
|
friend class boost::serialization::access;
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(Core::System& system);
|
void InstallInterfaces(Core::System& system);
|
||||||
|
|
||||||
} // namespace Service::AC
|
} // namespace Service::AC
|
||||||
|
|
||||||
BOOST_SERIALIZATION_CONSTRUCT(Service::AC::Module::Interface)
|
|
||||||
BOOST_CLASS_EXPORT_KEY(Service::AC::Module::Interface)
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "core/hle/service/ac/ac_i.h"
|
#include "core/hle/service/ac/ac_i.h"
|
||||||
|
#include "common/archives.h"
|
||||||
|
|
||||||
namespace Service::AC {
|
namespace Service::AC {
|
||||||
|
|
||||||
@ -33,3 +34,5 @@ AC_I::AC_I(std::shared_ptr<Module> ac) : Module::Interface(std::move(ac), "ac:i"
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::AC
|
} // namespace Service::AC
|
||||||
|
|
||||||
|
SERIALIZE_EXPORT_IMPL(Service::AC::AC_I)
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <boost/serialization/base_object.hpp>
|
||||||
#include "core/hle/service/ac/ac.h"
|
#include "core/hle/service/ac/ac.h"
|
||||||
|
|
||||||
namespace Service::AC {
|
namespace Service::AC {
|
||||||
@ -12,6 +13,12 @@ namespace Service::AC {
|
|||||||
class AC_I final : public Module::Interface {
|
class AC_I final : public Module::Interface {
|
||||||
public:
|
public:
|
||||||
explicit AC_I(std::shared_ptr<Module> ac);
|
explicit AC_I(std::shared_ptr<Module> ac);
|
||||||
|
|
||||||
|
private:
|
||||||
|
SERVICE_SERIALIZATION(AC_I, ac)
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::AC
|
} // namespace Service::AC
|
||||||
|
|
||||||
|
BOOST_CLASS_EXPORT_KEY(Service::AC::AC_I)
|
||||||
|
BOOST_SERIALIZATION_CONSTRUCT(Service::AC::AC_I)
|
||||||
|
@ -10,7 +10,9 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <boost/container/flat_map.hpp>
|
#include <boost/container/flat_map.hpp>
|
||||||
|
#include <boost/serialization/assume_abstract.hpp>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
#include "common/construct.h"
|
||||||
#include "core/hle/kernel/hle_ipc.h"
|
#include "core/hle/kernel/hle_ipc.h"
|
||||||
#include "core/hle/kernel/object.h"
|
#include "core/hle/kernel/object.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
#include "core/hle/service/sm/sm.h"
|
||||||
@ -194,3 +196,26 @@ struct ServiceModuleInfo {
|
|||||||
extern const std::array<ServiceModuleInfo, 40> service_module_map;
|
extern const std::array<ServiceModuleInfo, 40> service_module_map;
|
||||||
|
|
||||||
} // namespace Service
|
} // namespace Service
|
||||||
|
|
||||||
|
#define SERVICE_SERIALIZATION(T, MFIELD) \
|
||||||
|
template <class Archive> \
|
||||||
|
void save_construct(Archive& ar, const unsigned int file_version) const \
|
||||||
|
{ \
|
||||||
|
ar << MFIELD; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
template <class Archive> \
|
||||||
|
static void load_construct(Archive& ar, T* t, const unsigned int file_version) \
|
||||||
|
{ \
|
||||||
|
std::shared_ptr<Module> MFIELD; \
|
||||||
|
ar >> MFIELD; \
|
||||||
|
::new(t)T(MFIELD); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
template <class Archive> \
|
||||||
|
void serialize(Archive& ar, const unsigned int) \
|
||||||
|
{ \
|
||||||
|
ar & boost::serialization::base_object<Kernel::SessionRequestHandler>(*this); \
|
||||||
|
} \
|
||||||
|
friend class boost::serialization::access; \
|
||||||
|
friend class construct_access;
|
||||||
|
Loading…
Reference in New Issue
Block a user