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

23
TODO
View File

@ -7,8 +7,22 @@
Memory only
✔ Service manager @started(19-12-23 00:36) @done(19-12-23 11:38) @lasted(11h2m3s)
✔ Fix or ignore inverse map @done(19-12-23 12:46)
☐ App loader
☐ Archive manager
✘ App loader @cancelled(20-01-01 22:59)
No relevant state
☐ Archive manager @started(20-01-01 23:03)
☐ NCCH
☐ Normal
☐ Self
☐ SaveData
☐ Normal
☐ Ext
☐ Other
☐ Source SD
☐ System
☐ SDMC
☐ Normal
☐ Write-only
☐ File refs
☐ Custom texture cache
✘ MMIO @cancelled(20-01-01 01:06)
Seems that this whole subsystem is only used in tests
@ -76,9 +90,8 @@
✔ BOSS @started(19-12-25 21:48) @done(19-12-25 23:18) @lasted(1h30m14s)
☐ CAM @started(19-12-26 10:37)
Need to check capture_result
☐ CECD
☐ Archive backend / file handles
☐ CFG
✔ CECD @done(20-01-01 23:58)
✔ CFG @done(20-01-02 00:44)
Also needs archive backend..
✔ CSND @started(19-12-26 17:51) @done(19-12-26 17:56) @lasted(5m30s)
✔ DLP @done(19-12-26 18:02)

View File

@ -1,3 +1,4 @@
#pragma once
#include <boost/serialization/serialization.hpp>
class construct_access {

View File

@ -168,7 +168,12 @@ public:
}
protected:
std::unique_ptr<DelayGenerator> delay_generator;
std::unique_ptr<DelayGenerator> delay_generator; // TODO: Replace with virtual GetOpenDelayNs
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {}
friend class boost::serialization::access;
};
class ArchiveFactory : NonCopyable {
@ -205,6 +210,10 @@ public:
* @return Format information about the archive or error code
*/
virtual ResultVal<ArchiveFormatInfo> GetFormatInfo(const Path& path, u64 program_id) const = 0;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {}
friend class boost::serialization::access;
};
} // namespace FileSys

View File

@ -105,13 +105,6 @@ private:
std::chrono::seconds init_time;
SharedPageDef shared_page;
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int file_version) {
auto o_shared_page = boost::serialization::binary_object(&shared_page, sizeof(shared_page));
ar& o_shared_page;
}
};
} // namespace SharedPage

View File

@ -5,6 +5,7 @@
#include <cryptopp/base64.h>
#include <cryptopp/hmac.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,19 @@
#include "core/hle/service/cfg/cfg.h"
#include "fmt/format.h"
SERVICE_CONSTRUCT_IMPL(Service::CECD::Module)
SERIALIZE_EXPORT_IMPL(Service::CECD::Module)
namespace Service::CECD {
template <class Archive>
void Module::serialize(Archive& ar, const unsigned int) {
ar& cecd_system_save_data_archive;
ar& cecinfo_event;
ar& change_state_event;
}
SERIALIZE_IMPL(Module)
using CecDataPathType = Module::CecDataPathType;
using CecOpenMode = Module::CecOpenMode;
using CecSystemInfoType = Module::CecSystemInfoType;
@ -1340,7 +1352,8 @@ void Module::CheckAndUpdateFile(const CecDataPathType path_type, const u32 ncch_
case CecDataPathType::MboxData:
case CecDataPathType::MboxIcon:
case CecDataPathType::MboxTitle:
default: {}
default: {
}
}
}

View File

@ -584,7 +584,7 @@ public:
*/
void GetCecInfoEventHandleSys(Kernel::HLERequestContext& ctx);
private:
protected:
std::shared_ptr<Module> cecd;
};
@ -613,9 +613,16 @@ private:
std::shared_ptr<Kernel::Event> change_state_event;
Core::System& system;
template <class Archive>
void serialize(Archive& ar, const unsigned int);
friend class boost::serialization::access;
};
/// Initialize CECD service(s)
void InstallInterfaces(Core::System& system);
} // namespace Service::CECD
SERVICE_CONSTRUCT(Service::CECD::Module)
BOOST_CLASS_EXPORT_KEY(Service::CECD::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/cecd/cecd_ndm.h"
SERIALIZE_EXPORT_IMPL(Service::CECD::CECD_NDM)
namespace Service::CECD {
CECD_NDM::CECD_NDM(std::shared_ptr<Module> cecd)

View File

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

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/cecd/cecd_s.h"
SERIALIZE_EXPORT_IMPL(Service::CECD::CECD_S)
namespace Service::CECD {
CECD_S::CECD_S(std::shared_ptr<Module> cecd)

View File

@ -11,6 +11,12 @@ namespace Service::CECD {
class CECD_S final : public Module::Interface {
public:
explicit CECD_S(std::shared_ptr<Module> cecd);
private:
SERVICE_SERIALIZATION(CECD_S, cecd, Module)
};
} // namespace Service::CECD
BOOST_CLASS_EXPORT_KEY(Service::CECD::CECD_S)
BOOST_SERIALIZATION_CONSTRUCT(Service::CECD::CECD_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/cecd/cecd_u.h"
SERIALIZE_EXPORT_IMPL(Service::CECD::CECD_U)
namespace Service::CECD {
CECD_U::CECD_U(std::shared_ptr<Module> cecd)

View File

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

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)

View File

@ -260,6 +260,13 @@ private:
*/
std::unordered_map<ArchiveHandle, std::unique_ptr<ArchiveBackend>> handle_map;
ArchiveHandle next_handle = 1;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& id_code_map;
ar& handle_map;
ar& next_handle;
}
};
} // namespace Service::FS