Serialize CECD, CFG services

This commit is contained in:
Hamish Milne 2020-01-02 00:45:58 +00:00 committed by zhupengfei
parent ef2e503281
commit 2d2c7218ef
23 changed files with 135 additions and 16 deletions

View file

@ -6,6 +6,7 @@
#include <tuple>
#include <cryptopp/osrng.h>
#include <cryptopp/sha.h>
#include "common/archives.h"
#include "common/common_paths.h"
#include "common/file_util.h"
#include "common/logging/log.h"
@ -24,8 +25,18 @@
#include "core/hle/service/cfg/cfg_u.h"
#include "core/settings.h"
SERIALIZE_EXPORT_IMPL(Service::CFG::Module)
namespace Service::CFG {
template <class Archive>
void Module::serialize(Archive& ar, const unsigned int) {
ar& cfg_config_file_buffer;
ar& cfg_system_save_data_archive;
ar& preferred_region_code;
}
SERIALIZE_IMPL(Module)
/// The maximum number of block entries that can exist in the config file
static const u32 CONFIG_FILE_MAX_BLOCK_ENTRIES = 1479;

View file

@ -244,7 +244,7 @@ public:
(this->*function)(ctx, id);
}
private:
protected:
std::shared_ptr<Module> cfg;
};
@ -426,6 +426,10 @@ private:
std::array<u8, CONFIG_SAVEFILE_SIZE> cfg_config_file_buffer;
std::unique_ptr<FileSys::ArchiveBackend> cfg_system_save_data_archive;
u32 preferred_region_code = 0;
template <class Archive>
void serialize(Archive& ar, const unsigned int);
friend class boost::serialization::access;
};
std::shared_ptr<Module> GetModule(Core::System& system);
@ -436,3 +440,5 @@ void InstallInterfaces(Core::System& system);
std::string GetConsoleIdHash(Core::System& system);
} // namespace Service::CFG
BOOST_CLASS_EXPORT_KEY(Service::CFG::Module)

View file

@ -2,8 +2,11 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/service/cfg/cfg_i.h"
SERIALIZE_EXPORT_IMPL(Service::CFG::CFG_I)
namespace Service::CFG {
CFG_I::CFG_I(std::shared_ptr<Module> cfg) : Module::Interface(std::move(cfg), "cfg:i", 23) {

View file

@ -11,6 +11,12 @@ namespace Service::CFG {
class CFG_I final : public Module::Interface {
public:
explicit CFG_I(std::shared_ptr<Module> cfg);
private:
SERVICE_SERIALIZATION(CFG_I, cfg, Module)
};
} // namespace Service::CFG
BOOST_CLASS_EXPORT_KEY(Service::CFG::CFG_I)
BOOST_SERIALIZATION_CONSTRUCT(Service::CFG::CFG_I)

View file

@ -2,8 +2,11 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/service/cfg/cfg_nor.h"
SERIALIZE_EXPORT_IMPL(Service::CFG::CFG_NOR)
namespace Service::CFG {
CFG_NOR::CFG_NOR() : ServiceFramework("cfg:nor", 23) {

View file

@ -14,3 +14,5 @@ public:
};
} // namespace Service::CFG
BOOST_CLASS_EXPORT_KEY(Service::CFG::CFG_NOR)

View file

@ -2,8 +2,11 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/service/cfg/cfg_s.h"
SERIALIZE_EXPORT_IMPL(Service::CFG::CFG_S)
namespace Service::CFG {
CFG_S::CFG_S(std::shared_ptr<Module> cfg) : Module::Interface(std::move(cfg), "cfg:s", 23) {

View file

@ -11,6 +11,12 @@ namespace Service::CFG {
class CFG_S final : public Module::Interface {
public:
explicit CFG_S(std::shared_ptr<Module> cfg);
private:
SERVICE_SERIALIZATION(CFG_S, cfg, Module)
};
} // namespace Service::CFG
BOOST_CLASS_EXPORT_KEY(Service::CFG::CFG_S)
BOOST_SERIALIZATION_CONSTRUCT(Service::CFG::CFG_S)

View file

@ -2,8 +2,11 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/service/cfg/cfg_u.h"
SERIALIZE_EXPORT_IMPL(Service::CFG::CFG_U)
namespace Service::CFG {
CFG_U::CFG_U(std::shared_ptr<Module> cfg) : Module::Interface(std::move(cfg), "cfg:u", 23) {

View file

@ -11,6 +11,12 @@ namespace Service::CFG {
class CFG_U final : public Module::Interface {
public:
explicit CFG_U(std::shared_ptr<Module> cfg);
private:
SERVICE_SERIALIZATION(CFG_U, cfg, Module)
};
} // namespace Service::CFG
BOOST_CLASS_EXPORT_KEY(Service::CFG::CFG_U)
BOOST_SERIALIZATION_CONSTRUCT(Service::CFG::CFG_U)