diff --git a/TODO b/TODO index 30b51a68c..5ea46f2e8 100644 --- a/TODO +++ b/TODO @@ -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) diff --git a/src/common/construct.h b/src/common/construct.h index 6b2b3ceeb..aba4c7e89 100644 --- a/src/common/construct.h +++ b/src/common/construct.h @@ -1,3 +1,4 @@ +#pragma once #include class construct_access { diff --git a/src/core/file_sys/archive_backend.h b/src/core/file_sys/archive_backend.h index 2df4f98c4..05aa877a3 100644 --- a/src/core/file_sys/archive_backend.h +++ b/src/core/file_sys/archive_backend.h @@ -168,7 +168,12 @@ public: } protected: - std::unique_ptr delay_generator; + std::unique_ptr delay_generator; // TODO: Replace with virtual GetOpenDelayNs + +private: + template + 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 GetFormatInfo(const Path& path, u64 program_id) const = 0; + + template + void serialize(Archive& ar, const unsigned int) {} + friend class boost::serialization::access; }; } // namespace FileSys diff --git a/src/core/hle/kernel/shared_page.h b/src/core/hle/kernel/shared_page.h index b3e1a48b6..45f9cd348 100644 --- a/src/core/hle/kernel/shared_page.h +++ b/src/core/hle/kernel/shared_page.h @@ -105,13 +105,6 @@ private: std::chrono::seconds init_time; SharedPageDef shared_page; - - friend class boost::serialization::access; - template - 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 diff --git a/src/core/hle/service/cecd/cecd.cpp b/src/core/hle/service/cecd/cecd.cpp index 281f48026..42ac76946 100644 --- a/src/core/hle/service/cecd/cecd.cpp +++ b/src/core/hle/service/cecd/cecd.cpp @@ -5,6 +5,7 @@ #include #include #include +#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 +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: { + } } } diff --git a/src/core/hle/service/cecd/cecd.h b/src/core/hle/service/cecd/cecd.h index 004ef33e7..dd7fff7cb 100644 --- a/src/core/hle/service/cecd/cecd.h +++ b/src/core/hle/service/cecd/cecd.h @@ -584,7 +584,7 @@ public: */ void GetCecInfoEventHandleSys(Kernel::HLERequestContext& ctx); - private: + protected: std::shared_ptr cecd; }; @@ -613,9 +613,16 @@ private: std::shared_ptr change_state_event; Core::System& system; + + template + 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) diff --git a/src/core/hle/service/cecd/cecd_ndm.cpp b/src/core/hle/service/cecd/cecd_ndm.cpp index e4366e9c6..4b571283d 100644 --- a/src/core/hle/service/cecd/cecd_ndm.cpp +++ b/src/core/hle/service/cecd/cecd_ndm.cpp @@ -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 cecd) diff --git a/src/core/hle/service/cecd/cecd_ndm.h b/src/core/hle/service/cecd/cecd_ndm.h index a9fabb1a1..9fd282585 100644 --- a/src/core/hle/service/cecd/cecd_ndm.h +++ b/src/core/hle/service/cecd/cecd_ndm.h @@ -11,6 +11,12 @@ namespace Service::CECD { class CECD_NDM final : public Module::Interface { public: explicit CECD_NDM(std::shared_ptr 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) diff --git a/src/core/hle/service/cecd/cecd_s.cpp b/src/core/hle/service/cecd/cecd_s.cpp index 3395c405d..fa838d2af 100644 --- a/src/core/hle/service/cecd/cecd_s.cpp +++ b/src/core/hle/service/cecd/cecd_s.cpp @@ -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 cecd) diff --git a/src/core/hle/service/cecd/cecd_s.h b/src/core/hle/service/cecd/cecd_s.h index 6c50b13ba..9c6a7afec 100644 --- a/src/core/hle/service/cecd/cecd_s.h +++ b/src/core/hle/service/cecd/cecd_s.h @@ -11,6 +11,12 @@ namespace Service::CECD { class CECD_S final : public Module::Interface { public: explicit CECD_S(std::shared_ptr 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) diff --git a/src/core/hle/service/cecd/cecd_u.cpp b/src/core/hle/service/cecd/cecd_u.cpp index 81fcd1019..e8cd7d1c9 100644 --- a/src/core/hle/service/cecd/cecd_u.cpp +++ b/src/core/hle/service/cecd/cecd_u.cpp @@ -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 cecd) diff --git a/src/core/hle/service/cecd/cecd_u.h b/src/core/hle/service/cecd/cecd_u.h index 49ddadb69..31e7a2367 100644 --- a/src/core/hle/service/cecd/cecd_u.h +++ b/src/core/hle/service/cecd/cecd_u.h @@ -11,6 +11,12 @@ namespace Service::CECD { class CECD_U final : public Module::Interface { public: explicit CECD_U(std::shared_ptr 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) diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp index df6fd2e76..655405e77 100644 --- a/src/core/hle/service/cfg/cfg.cpp +++ b/src/core/hle/service/cfg/cfg.cpp @@ -6,6 +6,7 @@ #include #include #include +#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 +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; diff --git a/src/core/hle/service/cfg/cfg.h b/src/core/hle/service/cfg/cfg.h index 6886d513b..58e914583 100644 --- a/src/core/hle/service/cfg/cfg.h +++ b/src/core/hle/service/cfg/cfg.h @@ -244,7 +244,7 @@ public: (this->*function)(ctx, id); } - private: + protected: std::shared_ptr cfg; }; @@ -426,6 +426,10 @@ private: std::array cfg_config_file_buffer; std::unique_ptr cfg_system_save_data_archive; u32 preferred_region_code = 0; + + template + void serialize(Archive& ar, const unsigned int); + friend class boost::serialization::access; }; std::shared_ptr 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) diff --git a/src/core/hle/service/cfg/cfg_i.cpp b/src/core/hle/service/cfg/cfg_i.cpp index 624299076..4d3d298a2 100644 --- a/src/core/hle/service/cfg/cfg_i.cpp +++ b/src/core/hle/service/cfg/cfg_i.cpp @@ -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 cfg) : Module::Interface(std::move(cfg), "cfg:i", 23) { diff --git a/src/core/hle/service/cfg/cfg_i.h b/src/core/hle/service/cfg/cfg_i.h index 704eb4a71..ac8ffb990 100644 --- a/src/core/hle/service/cfg/cfg_i.h +++ b/src/core/hle/service/cfg/cfg_i.h @@ -11,6 +11,12 @@ namespace Service::CFG { class CFG_I final : public Module::Interface { public: explicit CFG_I(std::shared_ptr 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) diff --git a/src/core/hle/service/cfg/cfg_nor.cpp b/src/core/hle/service/cfg/cfg_nor.cpp index 413548313..0dd21076d 100644 --- a/src/core/hle/service/cfg/cfg_nor.cpp +++ b/src/core/hle/service/cfg/cfg_nor.cpp @@ -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) { diff --git a/src/core/hle/service/cfg/cfg_nor.h b/src/core/hle/service/cfg/cfg_nor.h index 3dace92bd..1eca85a05 100644 --- a/src/core/hle/service/cfg/cfg_nor.h +++ b/src/core/hle/service/cfg/cfg_nor.h @@ -14,3 +14,5 @@ public: }; } // namespace Service::CFG + +BOOST_CLASS_EXPORT_KEY(Service::CFG::CFG_NOR) diff --git a/src/core/hle/service/cfg/cfg_s.cpp b/src/core/hle/service/cfg/cfg_s.cpp index a211dae05..773a412f7 100644 --- a/src/core/hle/service/cfg/cfg_s.cpp +++ b/src/core/hle/service/cfg/cfg_s.cpp @@ -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 cfg) : Module::Interface(std::move(cfg), "cfg:s", 23) { diff --git a/src/core/hle/service/cfg/cfg_s.h b/src/core/hle/service/cfg/cfg_s.h index 7f135b357..d0cbc7a18 100644 --- a/src/core/hle/service/cfg/cfg_s.h +++ b/src/core/hle/service/cfg/cfg_s.h @@ -11,6 +11,12 @@ namespace Service::CFG { class CFG_S final : public Module::Interface { public: explicit CFG_S(std::shared_ptr 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) diff --git a/src/core/hle/service/cfg/cfg_u.cpp b/src/core/hle/service/cfg/cfg_u.cpp index 6aa862f82..bcc590bf8 100644 --- a/src/core/hle/service/cfg/cfg_u.cpp +++ b/src/core/hle/service/cfg/cfg_u.cpp @@ -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 cfg) : Module::Interface(std::move(cfg), "cfg:u", 23) { diff --git a/src/core/hle/service/cfg/cfg_u.h b/src/core/hle/service/cfg/cfg_u.h index 8b48e963e..906377124 100644 --- a/src/core/hle/service/cfg/cfg_u.h +++ b/src/core/hle/service/cfg/cfg_u.h @@ -11,6 +11,12 @@ namespace Service::CFG { class CFG_U final : public Module::Interface { public: explicit CFG_U(std::shared_ptr 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) diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h index 862e74980..29965491b 100644 --- a/src/core/hle/service/fs/archive.h +++ b/src/core/hle/service/fs/archive.h @@ -260,6 +260,13 @@ private: */ std::unordered_map> handle_map; ArchiveHandle next_handle = 1; + + template + void serialize(Archive& ar, const unsigned int) { + ar& id_code_map; + ar& handle_map; + ar& next_handle; + } }; } // namespace Service::FS