mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-30 21:30:04 +00:00 
			
		
		
		
	Correct exports; add some file serialization; fix service base object serialization
This commit is contained in:
		
							parent
							
								
									f2de70c3fb
								
							
						
					
					
						commit
						996aba39fe
					
				
					 52 changed files with 197 additions and 33 deletions
				
			
		
							
								
								
									
										1
									
								
								TODO
									
										
									
									
									
								
							
							
						
						
									
										1
									
								
								TODO
									
										
									
									
									
								
							|  | @ -5,6 +5,7 @@ | ||||||
| ☐ Review constructor/initialization code | ☐ Review constructor/initialization code | ||||||
| ☐ Review core timing events | ☐ Review core timing events | ||||||
| ☐ Review base class serialization everywhere | ☐ Review base class serialization everywhere | ||||||
|  |     Make sure that all base/derived relationships are registered | ||||||
| ☐ Serialize codeset with an apploader reference instead | ☐ Serialize codeset with an apploader reference instead | ||||||
| ✔ CPU @done(19-08-13 15:41) | ✔ CPU @done(19-08-13 15:41) | ||||||
| ✔ Memory @done(19-08-13 15:41) | ✔ Memory @done(19-08-13 15:41) | ||||||
|  |  | ||||||
|  | @ -10,5 +10,6 @@ using oarchive = boost::archive::binary_oarchive; | ||||||
|     template void A::serialize<oarchive>(oarchive & ar, const unsigned int file_version); |     template void A::serialize<oarchive>(oarchive & ar, const unsigned int file_version); | ||||||
| 
 | 
 | ||||||
| #define SERIALIZE_EXPORT_IMPL(A)                                                                   \ | #define SERIALIZE_EXPORT_IMPL(A)                                                                   \ | ||||||
|  |     BOOST_CLASS_EXPORT_IMPLEMENT(A)                                                                \ | ||||||
|     BOOST_SERIALIZATION_REGISTER_ARCHIVE(iarchive)                                                 \ |     BOOST_SERIALIZATION_REGISTER_ARCHIVE(iarchive)                                                 \ | ||||||
|     BOOST_SERIALIZATION_REGISTER_ARCHIVE(oarchive) |     BOOST_SERIALIZATION_REGISTER_ARCHIVE(oarchive) | ||||||
|  |  | ||||||
|  | @ -901,10 +901,18 @@ IOFile& IOFile::operator=(IOFile&& other) { | ||||||
| void IOFile::Swap(IOFile& other) { | void IOFile::Swap(IOFile& other) { | ||||||
|     std::swap(m_file, other.m_file); |     std::swap(m_file, other.m_file); | ||||||
|     std::swap(m_good, other.m_good); |     std::swap(m_good, other.m_good); | ||||||
|  |     std::swap(filename, other.filename); | ||||||
|  |     std::swap(openmode, other.openmode); | ||||||
|  |     std::swap(flags, other.flags); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool IOFile::Open(const std::string& filename, const char openmode[], int flags) { | bool IOFile::Open(const std::string& filename, const char openmode[], int flags) { | ||||||
|     Close(); |     Close(); | ||||||
|  | 
 | ||||||
|  |     this->filename = filename; | ||||||
|  |     this->openmode = openmode; | ||||||
|  |     this->flags = flags; | ||||||
|  | 
 | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
|     if (flags != 0) { |     if (flags != 0) { | ||||||
|         m_file = _wfsopen(Common::UTF8ToUTF16W(filename).c_str(), |         m_file = _wfsopen(Common::UTF8ToUTF16W(filename).c_str(), | ||||||
|  |  | ||||||
|  | @ -14,6 +14,8 @@ | ||||||
| #include <string_view> | #include <string_view> | ||||||
| #include <type_traits> | #include <type_traits> | ||||||
| #include <vector> | #include <vector> | ||||||
|  | #include <boost/serialization/split_member.hpp> | ||||||
|  | #include <boost/serialization/string.hpp> | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #ifdef _MSC_VER | #ifdef _MSC_VER | ||||||
| #include "common/string_util.h" | #include "common/string_util.h" | ||||||
|  | @ -221,7 +223,6 @@ public: | ||||||
| 
 | 
 | ||||||
|     void Swap(IOFile& other); |     void Swap(IOFile& other); | ||||||
| 
 | 
 | ||||||
|     bool Open(const std::string& filename, const char openmode[], int flags = 0); |  | ||||||
|     bool Close(); |     bool Close(); | ||||||
| 
 | 
 | ||||||
|     template <typename T> |     template <typename T> | ||||||
|  | @ -305,8 +306,34 @@ public: | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|  |     bool Open(const std::string& filename, const char openmode[], int flags = 0); | ||||||
|  | 
 | ||||||
|     std::FILE* m_file = nullptr; |     std::FILE* m_file = nullptr; | ||||||
|     bool m_good = true; |     bool m_good = true; | ||||||
|  | 
 | ||||||
|  |     std::string filename; | ||||||
|  |     std::string openmode; | ||||||
|  |     u32 flags; | ||||||
|  | 
 | ||||||
|  |     template <class Archive> | ||||||
|  |     void save(Archive& ar, const unsigned int) const { | ||||||
|  |         ar << filename; | ||||||
|  |         ar << openmode; | ||||||
|  |         ar << flags; | ||||||
|  |         ar << Tell(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     template <class Archive> | ||||||
|  |     void load(Archive& ar, const unsigned int) { | ||||||
|  |         ar >> filename; | ||||||
|  |         ar >> openmode; | ||||||
|  |         ar >> flags; | ||||||
|  |         u64 pos; | ||||||
|  |         ar >> pos; | ||||||
|  |         Seek(pos, SEEK_SET); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     BOOST_SERIALIZATION_SPLIT_MEMBER() | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace FileUtil
 | } // namespace FileUtil
 | ||||||
|  |  | ||||||
|  | @ -14,6 +14,11 @@ public: | ||||||
|     virtual ~BackingMem() = default; |     virtual ~BackingMem() = default; | ||||||
|     virtual u8* GetPtr() = 0; |     virtual u8* GetPtr() = 0; | ||||||
|     virtual u32 GetSize() const = 0; |     virtual u32 GetSize() const = 0; | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     template <class Archive> | ||||||
|  |     void serialize(Archive& ar, const unsigned int) {} | ||||||
|  |     friend class boost::serialization::access; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| /// Backing memory implemented by a local buffer
 | /// Backing memory implemented by a local buffer
 | ||||||
|  | @ -39,6 +44,7 @@ private: | ||||||
| 
 | 
 | ||||||
|     template <class Archive> |     template <class Archive> | ||||||
|     void serialize(Archive& ar, const unsigned int) { |     void serialize(Archive& ar, const unsigned int) { | ||||||
|  |         ar& boost::serialization::base_object<BackingMem>(*this); | ||||||
|         ar& data; |         ar& data; | ||||||
|     } |     } | ||||||
|     friend class boost::serialization::access; |     friend class boost::serialization::access; | ||||||
|  |  | ||||||
|  | @ -80,6 +80,8 @@ public: | ||||||
|         static constexpr u64 IPCDelayNanoseconds(3085068); |         static constexpr u64 IPCDelayNanoseconds(3085068); | ||||||
|         return IPCDelayNanoseconds; |         return IPCDelayNanoseconds; | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     SERIALIZE_DELAY_GENERATOR | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  | @ -300,3 +302,5 @@ void ArchiveFactory_ExtSaveData::WriteIcon(const Path& path, const u8* icon_data | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| } // namespace FileSys
 | } // namespace FileSys
 | ||||||
|  | 
 | ||||||
|  | SERIALIZE_EXPORT_IMPL(FileSys::ExtSaveDataDelayGenerator) | ||||||
|  |  | ||||||
|  | @ -103,6 +103,9 @@ std::string GetExtDataContainerPath(const std::string& mount_point, bool shared) | ||||||
|  */ |  */ | ||||||
| Path ConstructExtDataBinaryPath(u32 media_type, u32 high, u32 low); | Path ConstructExtDataBinaryPath(u32 media_type, u32 high, u32 low); | ||||||
| 
 | 
 | ||||||
|  | class ExtSaveDataDelayGenerator; | ||||||
|  | 
 | ||||||
| } // namespace FileSys
 | } // namespace FileSys
 | ||||||
| 
 | 
 | ||||||
| BOOST_CLASS_EXPORT_KEY(FileSys::ArchiveFactory_ExtSaveData) | BOOST_CLASS_EXPORT_KEY(FileSys::ArchiveFactory_ExtSaveData) | ||||||
|  | BOOST_CLASS_EXPORT_KEY(FileSys::ExtSaveDataDelayGenerator) | ||||||
|  |  | ||||||
|  | @ -41,6 +41,8 @@ public: | ||||||
|         static constexpr u64 IPCDelayNanoseconds(269082); |         static constexpr u64 IPCDelayNanoseconds(269082); | ||||||
|         return IPCDelayNanoseconds; |         return IPCDelayNanoseconds; | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     SERIALIZE_DELAY_GENERATOR | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFile(const Path& path, | ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFile(const Path& path, | ||||||
|  | @ -409,3 +411,5 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_SDMC::GetFormatInfo(const Path& path | ||||||
|     return ResultCode(-1); |     return ResultCode(-1); | ||||||
| } | } | ||||||
| } // namespace FileSys
 | } // namespace FileSys
 | ||||||
|  | 
 | ||||||
|  | SERIALIZE_EXPORT_IMPL(FileSys::SDMCDelayGenerator) | ||||||
|  |  | ||||||
|  | @ -86,7 +86,10 @@ private: | ||||||
|     friend class boost::serialization::access; |     friend class boost::serialization::access; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | class SDMCDelayGenerator; | ||||||
|  | 
 | ||||||
| } // namespace FileSys
 | } // namespace FileSys
 | ||||||
| 
 | 
 | ||||||
| BOOST_CLASS_EXPORT_KEY(FileSys::SDMCArchive) | BOOST_CLASS_EXPORT_KEY(FileSys::SDMCArchive) | ||||||
| BOOST_CLASS_EXPORT_KEY(FileSys::ArchiveFactory_SDMC) | BOOST_CLASS_EXPORT_KEY(FileSys::ArchiveFactory_SDMC) | ||||||
|  | BOOST_CLASS_EXPORT_KEY(FileSys::SDMCDelayGenerator) | ||||||
|  |  | ||||||
|  | @ -39,6 +39,8 @@ public: | ||||||
|         static constexpr u64 IPCDelayNanoseconds(269082); |         static constexpr u64 IPCDelayNanoseconds(269082); | ||||||
|         return IPCDelayNanoseconds; |         return IPCDelayNanoseconds; | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     SERIALIZE_DELAY_GENERATOR | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| ResultVal<std::unique_ptr<FileBackend>> SDMCWriteOnlyArchive::OpenFile(const Path& path, | ResultVal<std::unique_ptr<FileBackend>> SDMCWriteOnlyArchive::OpenFile(const Path& path, | ||||||
|  | @ -100,3 +102,5 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_SDMCWriteOnly::GetFormatInfo(const P | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| } // namespace FileSys
 | } // namespace FileSys
 | ||||||
|  | 
 | ||||||
|  | SERIALIZE_EXPORT_IMPL(FileSys::SDMCWriteOnlyDelayGenerator) | ||||||
|  |  | ||||||
|  | @ -72,7 +72,10 @@ private: | ||||||
|     friend class boost::serialization::access; |     friend class boost::serialization::access; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | class SDMCWriteOnlyDelayGenerator; | ||||||
|  | 
 | ||||||
| } // namespace FileSys
 | } // namespace FileSys
 | ||||||
| 
 | 
 | ||||||
| BOOST_CLASS_EXPORT_KEY(FileSys::SDMCWriteOnlyArchive) | BOOST_CLASS_EXPORT_KEY(FileSys::SDMCWriteOnlyArchive) | ||||||
| BOOST_CLASS_EXPORT_KEY(FileSys::ArchiveFactory_SDMCWriteOnly) | BOOST_CLASS_EXPORT_KEY(FileSys::ArchiveFactory_SDMCWriteOnly) | ||||||
|  | BOOST_CLASS_EXPORT_KEY(FileSys::SDMCWriteOnlyDelayGenerator) | ||||||
|  |  | ||||||
|  | @ -5,10 +5,18 @@ | ||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
| #include <cstddef> | #include <cstddef> | ||||||
| #include <boost/serialization/access.hpp> | #include <boost/serialization/base_object.hpp> | ||||||
| #include <boost/serialization/export.hpp> | #include <boost/serialization/export.hpp> | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| 
 | 
 | ||||||
|  | #define SERIALIZE_DELAY_GENERATOR                                                                  \ | ||||||
|  | private:                                                                                           \ | ||||||
|  |     template <class Archive>                                                                       \ | ||||||
|  |     void serialize(Archive& ar, const unsigned int) {                                              \ | ||||||
|  |         ar& boost::serialization::base_object<DelayGenerator>(*this);                              \ | ||||||
|  |     }                                                                                              \ | ||||||
|  |     friend class boost::serialization::access; | ||||||
|  | 
 | ||||||
| namespace FileSys { | namespace FileSys { | ||||||
| 
 | 
 | ||||||
| class DelayGenerator { | class DelayGenerator { | ||||||
|  | @ -28,6 +36,8 @@ class DefaultDelayGenerator : public DelayGenerator { | ||||||
| public: | public: | ||||||
|     u64 GetReadDelayNs(std::size_t length) override; |     u64 GetReadDelayNs(std::size_t length) override; | ||||||
|     u64 GetOpenDelayNs() override; |     u64 GetOpenDelayNs() override; | ||||||
|  | 
 | ||||||
|  |     SERIALIZE_DELAY_GENERATOR | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace FileSys
 | } // namespace FileSys
 | ||||||
|  |  | ||||||
|  | @ -8,6 +8,8 @@ | ||||||
| #include <memory> | #include <memory> | ||||||
| #include <string> | #include <string> | ||||||
| #include <vector> | #include <vector> | ||||||
|  | #include <boost/serialization/base_object.hpp> | ||||||
|  | #include <boost/serialization/unique_ptr.hpp> | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "common/file_util.h" | #include "common/file_util.h" | ||||||
| #include "core/file_sys/archive_backend.h" | #include "core/file_sys/archive_backend.h" | ||||||
|  | @ -43,6 +45,13 @@ public: | ||||||
| protected: | protected: | ||||||
|     Mode mode; |     Mode mode; | ||||||
|     std::unique_ptr<FileUtil::IOFile> file; |     std::unique_ptr<FileUtil::IOFile> file; | ||||||
|  | 
 | ||||||
|  |     template <class Archive> | ||||||
|  |     void serialize(Archive& ar, const unsigned int) { | ||||||
|  |         ar& boost::serialization::base_object<FileBackend>(*this); | ||||||
|  |         ar& mode; | ||||||
|  |         ar& file; | ||||||
|  |     } | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| class DiskDirectory : public DirectoryBackend { | class DiskDirectory : public DirectoryBackend { | ||||||
|  |  | ||||||
|  | @ -7,6 +7,8 @@ | ||||||
| #include <algorithm> | #include <algorithm> | ||||||
| #include <cstddef> | #include <cstddef> | ||||||
| #include <memory> | #include <memory> | ||||||
|  | #include <boost/serialization/base_object.hpp> | ||||||
|  | #include <boost/serialization/unique_ptr.hpp> | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "core/hle/result.h" | #include "core/hle/result.h" | ||||||
| #include "delay_generator.h" | #include "delay_generator.h" | ||||||
|  | @ -90,6 +92,12 @@ public: | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     std::unique_ptr<DelayGenerator> delay_generator; |     std::unique_ptr<DelayGenerator> delay_generator; | ||||||
|  | 
 | ||||||
|  |     template <class Archive> | ||||||
|  |     void serialize(Archive& ar, const unsigned int) { | ||||||
|  |         ar& delay_generator; | ||||||
|  |     } | ||||||
|  |     friend class boost::serialization::access; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace FileSys
 | } // namespace FileSys
 | ||||||
|  |  | ||||||
|  | @ -2,6 +2,7 @@ | ||||||
| // Licensed under GPLv2 or any later version
 | // Licensed under GPLv2 or any later version
 | ||||||
| // Refer to the license.txt file included.
 | // Refer to the license.txt file included.
 | ||||||
| 
 | 
 | ||||||
|  | #include "common/archives.h" | ||||||
| #include "common/file_util.h" | #include "common/file_util.h" | ||||||
| #include "core/file_sys/disk_archive.h" | #include "core/file_sys/disk_archive.h" | ||||||
| #include "core/file_sys/errors.h" | #include "core/file_sys/errors.h" | ||||||
|  | @ -33,6 +34,8 @@ public: | ||||||
|         static constexpr u64 IPCDelayNanoseconds(269082); |         static constexpr u64 IPCDelayNanoseconds(269082); | ||||||
|         return IPCDelayNanoseconds; |         return IPCDelayNanoseconds; | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     SERIALIZE_DELAY_GENERATOR | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| ResultVal<std::unique_ptr<FileBackend>> SaveDataArchive::OpenFile(const Path& path, | ResultVal<std::unique_ptr<FileBackend>> SaveDataArchive::OpenFile(const Path& path, | ||||||
|  | @ -353,3 +356,5 @@ u64 SaveDataArchive::GetFreeBytes() const { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| } // namespace FileSys
 | } // namespace FileSys
 | ||||||
|  | 
 | ||||||
|  | SERIALIZE_EXPORT_IMPL(FileSys::SaveDataDelayGenerator) | ||||||
|  |  | ||||||
|  | @ -40,4 +40,8 @@ protected: | ||||||
|     std::string mount_point; |     std::string mount_point; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | class SaveDataDelayGenerator; | ||||||
|  | 
 | ||||||
| } // namespace FileSys
 | } // namespace FileSys
 | ||||||
|  | 
 | ||||||
|  | BOOST_CLASS_EXPORT_KEY(FileSys::SaveDataDelayGenerator) | ||||||
|  |  | ||||||
|  | @ -13,11 +13,7 @@ public: | ||||||
|     CAM_Q(); |     CAM_Q(); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     template <class Archive> |     SERVICE_SERIALIZATION_SIMPLE | ||||||
|     void serialize(Archive& ar, const unsigned int) { |  | ||||||
|         ar& boost::serialization::base_object<Kernel::SessionRequestHandler>(*this); |  | ||||||
|     } |  | ||||||
|     friend class boost::serialization::access; |  | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::CAM
 | } // namespace Service::CAM
 | ||||||
|  |  | ||||||
|  | @ -11,6 +11,9 @@ namespace Service::CFG { | ||||||
| class CFG_NOR final : public ServiceFramework<CFG_NOR> { | class CFG_NOR final : public ServiceFramework<CFG_NOR> { | ||||||
| public: | public: | ||||||
|     CFG_NOR(); |     CFG_NOR(); | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     SERVICE_SERIALIZATION_SIMPLE | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::CFG
 | } // namespace Service::CFG
 | ||||||
|  |  | ||||||
|  | @ -14,11 +14,7 @@ public: | ||||||
|     ~DLP_CLNT() = default; |     ~DLP_CLNT() = default; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     template <class Archive> |     SERVICE_SERIALIZATION_SIMPLE | ||||||
|     void serialize(Archive& ar, const unsigned int) { |  | ||||||
|         ar& boost::serialization::base_object<Kernel::SessionRequestHandler>(*this); |  | ||||||
|     } |  | ||||||
|     friend class boost::serialization::access; |  | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::DLP
 | } // namespace Service::DLP
 | ||||||
|  |  | ||||||
|  | @ -14,11 +14,7 @@ public: | ||||||
|     ~DLP_FKCL() = default; |     ~DLP_FKCL() = default; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     template <class Archive> |     SERVICE_SERIALIZATION_SIMPLE | ||||||
|     void serialize(Archive& ar, const unsigned int) { |  | ||||||
|         ar& boost::serialization::base_object<Kernel::SessionRequestHandler>(*this); |  | ||||||
|     } |  | ||||||
|     friend class boost::serialization::access; |  | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::DLP
 | } // namespace Service::DLP
 | ||||||
|  |  | ||||||
|  | @ -16,11 +16,7 @@ public: | ||||||
| private: | private: | ||||||
|     void IsChild(Kernel::HLERequestContext& ctx); |     void IsChild(Kernel::HLERequestContext& ctx); | ||||||
| 
 | 
 | ||||||
|     template <class Archive> |     SERVICE_SERIALIZATION_SIMPLE | ||||||
|     void serialize(Archive& ar, const unsigned int) { |  | ||||||
|         ar& boost::serialization::base_object<Kernel::SessionRequestHandler>(*this); |  | ||||||
|     } |  | ||||||
|     friend class boost::serialization::access; |  | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::DLP
 | } // namespace Service::DLP
 | ||||||
|  |  | ||||||
|  | @ -35,11 +35,7 @@ private: | ||||||
| 
 | 
 | ||||||
|     Core::System& system; |     Core::System& system; | ||||||
| 
 | 
 | ||||||
|     template <class Archive> |     SERVICE_SERIALIZATION_SIMPLE | ||||||
|     void serialize(Archive& ar, const unsigned int) { |  | ||||||
|         ar& boost::serialization::base_object<Kernel::SessionRequestHandler>(*this); |  | ||||||
|     } |  | ||||||
|     friend class boost::serialization::access; |  | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| void InstallInterfaces(Core::System& system); | void InstallInterfaces(Core::System& system); | ||||||
|  |  | ||||||
|  | @ -19,6 +19,17 @@ struct FileSessionSlot : public Kernel::SessionRequestHandler::SessionDataBase { | ||||||
|     u64 offset;   ///< Offset that this session will start reading from.
 |     u64 offset;   ///< Offset that this session will start reading from.
 | ||||||
|     u64 size;     ///< Max size of the file that this session is allowed to access
 |     u64 size;     ///< Max size of the file that this session is allowed to access
 | ||||||
|     bool subfile; ///< Whether this file was opened via OpenSubFile or not.
 |     bool subfile; ///< Whether this file was opened via OpenSubFile or not.
 | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     template <class Archive> | ||||||
|  |     void serialize(Archive& ar, const unsigned int) { | ||||||
|  |         ar& boost::serialization::base_object<Kernel::SessionRequestHandler::SessionDataBase>( | ||||||
|  |             *this); | ||||||
|  |         ar& priority; | ||||||
|  |         ar& offset; | ||||||
|  |         ar& size; | ||||||
|  |         ar& subfile; | ||||||
|  |     } | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| // TODO: File is not a real service, but it can still utilize ServiceFramework::RegisterHandlers.
 | // TODO: File is not a real service, but it can still utilize ServiceFramework::RegisterHandlers.
 | ||||||
|  |  | ||||||
|  | @ -26,6 +26,8 @@ struct ClientSlot : public Kernel::SessionRequestHandler::SessionDataBase { | ||||||
| private: | private: | ||||||
|     template <class Archive> |     template <class Archive> | ||||||
|     void serialize(Archive& ar, const unsigned int) { |     void serialize(Archive& ar, const unsigned int) { | ||||||
|  |         ar& boost::serialization::base_object<Kernel::SessionRequestHandler::SessionDataBase>( | ||||||
|  |             *this); | ||||||
|         ar& program_id; |         ar& program_id; | ||||||
|     } |     } | ||||||
|     friend class boost::serialization::access; |     friend class boost::serialization::access; | ||||||
|  |  | ||||||
|  | @ -203,6 +203,8 @@ public: | ||||||
| private: | private: | ||||||
|     template <class Archive> |     template <class Archive> | ||||||
|     void serialize(Archive& ar, const unsigned int) { |     void serialize(Archive& ar, const unsigned int) { | ||||||
|  |         ar& boost::serialization::base_object<Kernel::SessionRequestHandler::SessionDataBase>( | ||||||
|  |             *this); | ||||||
|         ar& gsp; |         ar& gsp; | ||||||
|         ar& interrupt_event; |         ar& interrupt_event; | ||||||
|         ar& thread_id; |         ar& thread_id; | ||||||
|  |  | ||||||
|  | @ -240,6 +240,8 @@ struct SessionData : public Kernel::SessionRequestHandler::SessionDataBase { | ||||||
| private: | private: | ||||||
|     template <class Archive> |     template <class Archive> | ||||||
|     void serialize(Archive& ar, const unsigned int) { |     void serialize(Archive& ar, const unsigned int) { | ||||||
|  |         ar& boost::serialization::base_object<Kernel::SessionRequestHandler::SessionDataBase>( | ||||||
|  |             *this); | ||||||
|         ar& current_http_context; |         ar& current_http_context; | ||||||
|         ar& session_id; |         ar& session_id; | ||||||
|         ar& num_http_contexts; |         ar& num_http_contexts; | ||||||
|  |  | ||||||
|  | @ -18,6 +18,8 @@ struct ClientSlot : public Kernel::SessionRequestHandler::SessionDataBase { | ||||||
| private: | private: | ||||||
|     template <class Archive> |     template <class Archive> | ||||||
|     void serialize(Archive& ar, const unsigned int) { |     void serialize(Archive& ar, const unsigned int) { | ||||||
|  |         ar& boost::serialization::base_object<Kernel::SessionRequestHandler::SessionDataBase>( | ||||||
|  |             *this); | ||||||
|         ar& loaded_crs; |         ar& loaded_crs; | ||||||
|     } |     } | ||||||
|     friend class boost::serialization::access; |     friend class boost::serialization::access; | ||||||
|  |  | ||||||
|  | @ -25,6 +25,7 @@ namespace Service::MIC { | ||||||
| 
 | 
 | ||||||
| template <class Archive> | template <class Archive> | ||||||
| void MIC_U::serialize(Archive& ar, const unsigned int) { | void MIC_U::serialize(Archive& ar, const unsigned int) { | ||||||
|  |     ar& boost::serialization::base_object<Kernel::SessionRequestHandler>(*this); | ||||||
|     ar&* impl.get(); |     ar&* impl.get(); | ||||||
| } | } | ||||||
| SERIALIZE_IMPL(MIC_U) | SERIALIZE_IMPL(MIC_U) | ||||||
|  |  | ||||||
|  | @ -14,11 +14,7 @@ public: | ||||||
|     ~MVD_STD() = default; |     ~MVD_STD() = default; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     template <class Archive> |     SERVICE_SERIALIZATION_SIMPLE | ||||||
|     void serialize(Archive& ar, const unsigned int) { |  | ||||||
|         ar& boost::serialization::base_object<Kernel::SessionRequestHandler>(*this); |  | ||||||
|     } |  | ||||||
|     friend class boost::serialization::access; |  | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::MVD
 | } // namespace Service::MVD
 | ||||||
|  |  | ||||||
|  | @ -24,6 +24,8 @@ private: | ||||||
|      *      2 : Number of notifications |      *      2 : Number of notifications | ||||||
|      */ |      */ | ||||||
|     void GetTotalNotifications(Kernel::HLERequestContext& ctx); |     void GetTotalNotifications(Kernel::HLERequestContext& ctx); | ||||||
|  | 
 | ||||||
|  |     SERVICE_SERIALIZATION_SIMPLE | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::NEWS
 | } // namespace Service::NEWS
 | ||||||
|  |  | ||||||
|  | @ -12,6 +12,9 @@ namespace Service::NEWS { | ||||||
| class NEWS_U final : public ServiceFramework<NEWS_U> { | class NEWS_U final : public ServiceFramework<NEWS_U> { | ||||||
| public: | public: | ||||||
|     NEWS_U(); |     NEWS_U(); | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     SERVICE_SERIALIZATION_SIMPLE | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::NEWS
 | } // namespace Service::NEWS
 | ||||||
|  |  | ||||||
|  | @ -12,6 +12,9 @@ class NIM_AOC final : public ServiceFramework<NIM_AOC> { | ||||||
| public: | public: | ||||||
|     NIM_AOC(); |     NIM_AOC(); | ||||||
|     ~NIM_AOC(); |     ~NIM_AOC(); | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     SERVICE_SERIALIZATION_SIMPLE | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::NIM
 | } // namespace Service::NIM
 | ||||||
|  |  | ||||||
|  | @ -12,6 +12,9 @@ class NIM_S final : public ServiceFramework<NIM_S> { | ||||||
| public: | public: | ||||||
|     NIM_S(); |     NIM_S(); | ||||||
|     ~NIM_S(); |     ~NIM_S(); | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     SERVICE_SERIALIZATION_SIMPLE | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::NIM
 | } // namespace Service::NIM
 | ||||||
|  |  | ||||||
|  | @ -11,6 +11,9 @@ namespace Service::NWM { | ||||||
| class NWM_CEC final : public ServiceFramework<NWM_CEC> { | class NWM_CEC final : public ServiceFramework<NWM_CEC> { | ||||||
| public: | public: | ||||||
|     NWM_CEC(); |     NWM_CEC(); | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     SERVICE_SERIALIZATION_SIMPLE | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::NWM
 | } // namespace Service::NWM
 | ||||||
|  |  | ||||||
|  | @ -11,6 +11,9 @@ namespace Service::NWM { | ||||||
| class NWM_EXT final : public ServiceFramework<NWM_EXT> { | class NWM_EXT final : public ServiceFramework<NWM_EXT> { | ||||||
| public: | public: | ||||||
|     NWM_EXT(); |     NWM_EXT(); | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     SERVICE_SERIALIZATION_SIMPLE | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::NWM
 | } // namespace Service::NWM
 | ||||||
|  |  | ||||||
|  | @ -11,6 +11,9 @@ namespace Service::NWM { | ||||||
| class NWM_INF final : public ServiceFramework<NWM_INF> { | class NWM_INF final : public ServiceFramework<NWM_INF> { | ||||||
| public: | public: | ||||||
|     NWM_INF(); |     NWM_INF(); | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     SERVICE_SERIALIZATION_SIMPLE | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::NWM
 | } // namespace Service::NWM
 | ||||||
|  |  | ||||||
|  | @ -11,6 +11,9 @@ namespace Service::NWM { | ||||||
| class NWM_SAP final : public ServiceFramework<NWM_SAP> { | class NWM_SAP final : public ServiceFramework<NWM_SAP> { | ||||||
| public: | public: | ||||||
|     NWM_SAP(); |     NWM_SAP(); | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     SERVICE_SERIALIZATION_SIMPLE | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::NWM
 | } // namespace Service::NWM
 | ||||||
|  |  | ||||||
|  | @ -11,6 +11,9 @@ namespace Service::NWM { | ||||||
| class NWM_SOC final : public ServiceFramework<NWM_SOC> { | class NWM_SOC final : public ServiceFramework<NWM_SOC> { | ||||||
| public: | public: | ||||||
|     NWM_SOC(); |     NWM_SOC(); | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     SERVICE_SERIALIZATION_SIMPLE | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::NWM
 | } // namespace Service::NWM
 | ||||||
|  |  | ||||||
|  | @ -11,6 +11,9 @@ namespace Service::NWM { | ||||||
| class NWM_TST final : public ServiceFramework<NWM_TST> { | class NWM_TST final : public ServiceFramework<NWM_TST> { | ||||||
| public: | public: | ||||||
|     NWM_TST(); |     NWM_TST(); | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     SERVICE_SERIALIZATION_SIMPLE | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::NWM
 | } // namespace Service::NWM
 | ||||||
|  |  | ||||||
|  | @ -28,6 +28,7 @@ namespace Service::NWM { | ||||||
| 
 | 
 | ||||||
| template <class Archive> | template <class Archive> | ||||||
| void NWM_UDS::serialize(Archive& ar, const unsigned int) { | void NWM_UDS::serialize(Archive& ar, const unsigned int) { | ||||||
|  |     ar& boost::serialization::base_object<Kernel::SessionRequestHandler>(*this); | ||||||
|     ar& node_map; |     ar& node_map; | ||||||
|     ar& connection_event; |     ar& connection_event; | ||||||
|     ar& received_beacons; |     ar& received_beacons; | ||||||
|  |  | ||||||
|  | @ -12,6 +12,9 @@ class PM_APP final : public ServiceFramework<PM_APP> { | ||||||
| public: | public: | ||||||
|     PM_APP(); |     PM_APP(); | ||||||
|     ~PM_APP() = default; |     ~PM_APP() = default; | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     SERVICE_SERIALIZATION_SIMPLE | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::PM
 | } // namespace Service::PM
 | ||||||
|  |  | ||||||
|  | @ -12,6 +12,9 @@ class PM_DBG final : public ServiceFramework<PM_DBG> { | ||||||
| public: | public: | ||||||
|     PM_DBG(); |     PM_DBG(); | ||||||
|     ~PM_DBG() = default; |     ~PM_DBG() = default; | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     SERVICE_SERIALIZATION_SIMPLE | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::PM
 | } // namespace Service::PM
 | ||||||
|  |  | ||||||
|  | @ -18,6 +18,8 @@ public: | ||||||
|     ~PS_PS() = default; |     ~PS_PS() = default; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|  |     SERVICE_SERIALIZATION_SIMPLE | ||||||
|  | 
 | ||||||
|     /**
 |     /**
 | ||||||
|      * PS_PS::SignRsaSha256 service function |      * PS_PS::SignRsaSha256 service function | ||||||
|      *  Inputs: |      *  Inputs: | ||||||
|  |  | ||||||
|  | @ -13,6 +13,9 @@ class DEV final : public ServiceFramework<DEV> { | ||||||
| public: | public: | ||||||
|     DEV(); |     DEV(); | ||||||
|     ~DEV(); |     ~DEV(); | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     SERVICE_SERIALIZATION_SIMPLE | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::PXI
 | } // namespace Service::PXI
 | ||||||
|  |  | ||||||
|  | @ -12,6 +12,9 @@ class QTM_C final : public ServiceFramework<QTM_C> { | ||||||
| public: | public: | ||||||
|     QTM_C(); |     QTM_C(); | ||||||
|     ~QTM_C() = default; |     ~QTM_C() = default; | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     SERVICE_SERIALIZATION_SIMPLE | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::QTM
 | } // namespace Service::QTM
 | ||||||
|  |  | ||||||
|  | @ -12,6 +12,9 @@ class QTM_S final : public ServiceFramework<QTM_S> { | ||||||
| public: | public: | ||||||
|     QTM_S(); |     QTM_S(); | ||||||
|     ~QTM_S() = default; |     ~QTM_S() = default; | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     SERVICE_SERIALIZATION_SIMPLE | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::QTM
 | } // namespace Service::QTM
 | ||||||
|  |  | ||||||
|  | @ -12,6 +12,9 @@ class QTM_SP final : public ServiceFramework<QTM_SP> { | ||||||
| public: | public: | ||||||
|     QTM_SP(); |     QTM_SP(); | ||||||
|     ~QTM_SP() = default; |     ~QTM_SP() = default; | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     SERVICE_SERIALIZATION_SIMPLE | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::QTM
 | } // namespace Service::QTM
 | ||||||
|  |  | ||||||
|  | @ -12,6 +12,9 @@ class QTM_U final : public ServiceFramework<QTM_U> { | ||||||
| public: | public: | ||||||
|     QTM_U(); |     QTM_U(); | ||||||
|     ~QTM_U() = default; |     ~QTM_U() = default; | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     SERVICE_SERIALIZATION_SIMPLE | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Service::QTM
 | } // namespace Service::QTM
 | ||||||
|  |  | ||||||
|  | @ -219,6 +219,13 @@ extern const std::array<ServiceModuleInfo, 40> service_module_map; | ||||||
|     friend class boost::serialization::access;                                                     \ |     friend class boost::serialization::access;                                                     \ | ||||||
|     friend class ::construct_access; |     friend class ::construct_access; | ||||||
| 
 | 
 | ||||||
|  | #define SERVICE_SERIALIZATION_SIMPLE                                                               \ | ||||||
|  |     template <class Archive>                                                                       \ | ||||||
|  |     void serialize(Archive& ar, const unsigned int) {                                              \ | ||||||
|  |         ar& boost::serialization::base_object<Kernel::SessionRequestHandler>(*this);               \ | ||||||
|  |     }                                                                                              \ | ||||||
|  |     friend class boost::serialization::access; | ||||||
|  | 
 | ||||||
| #define SERVICE_CONSTRUCT(T)                                                                       \ | #define SERVICE_CONSTRUCT(T)                                                                       \ | ||||||
|     namespace boost::serialization {                                                               \ |     namespace boost::serialization {                                                               \ | ||||||
|     template <class Archive>                                                                       \ |     template <class Archive>                                                                       \ | ||||||
|  |  | ||||||
|  | @ -23,6 +23,8 @@ private: | ||||||
| 
 | 
 | ||||||
|     // TODO: Implement a proper CSPRNG in the future when actual security is needed
 |     // TODO: Implement a proper CSPRNG in the future when actual security is needed
 | ||||||
|     std::mt19937 rand_gen; |     std::mt19937 rand_gen; | ||||||
|  | 
 | ||||||
|  |     SERVICE_SERIALIZATION_SIMPLE | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| void InstallInterfaces(Core::System& system); | void InstallInterfaces(Core::System& system); | ||||||
|  |  | ||||||
|  | @ -20,6 +20,7 @@ namespace Service::Y2R { | ||||||
| 
 | 
 | ||||||
| template <class Archive> | template <class Archive> | ||||||
| void Y2R_U::serialize(Archive& ar, const unsigned int) { | void Y2R_U::serialize(Archive& ar, const unsigned int) { | ||||||
|  |     ar& boost::serialization::base_object<Kernel::SessionRequestHandler>(*this); | ||||||
|     ar& completion_event; |     ar& completion_event; | ||||||
|     ar& conversion; |     ar& conversion; | ||||||
|     ar& dithering_weight_params; |     ar& dithering_weight_params; | ||||||
|  |  | ||||||
|  | @ -170,7 +170,9 @@ private: | ||||||
|     MemorySystem::Impl& impl; |     MemorySystem::Impl& impl; | ||||||
| 
 | 
 | ||||||
|     template <class Archive> |     template <class Archive> | ||||||
|     void serialize(Archive& ar, const unsigned int) {} |     void serialize(Archive& ar, const unsigned int) { | ||||||
|  |         ar& boost::serialization::base_object<BackingMem>(*this); | ||||||
|  |     } | ||||||
|     friend class boost::serialization::access; |     friend class boost::serialization::access; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue