From 56046136424be85c625cd622506c2aefee38d915 Mon Sep 17 00:00:00 2001 From: Hamish Milne Date: Fri, 27 Mar 2020 21:48:58 +0000 Subject: [PATCH] More merge fixes --- TODO | 2 +- save0.citrasave | Bin 776 -> 0 bytes src/core/core.cpp | 6 ++++++ src/core/core_timing.h | 7 ++++--- src/core/file_sys/layered_fs.cpp | 16 +++++++++++---- src/core/file_sys/layered_fs.h | 32 +++++++++++++++++++++++++++++ src/core/file_sys/romfs_reader.cpp | 3 +++ src/core/file_sys/romfs_reader.h | 10 +++++++++ src/core/hle/service/cecd/cecd.h | 2 +- 9 files changed, 69 insertions(+), 9 deletions(-) delete mode 100644 save0.citrasave diff --git a/TODO b/TODO index 9cc333d46..41fa8503a 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,7 @@ ☐ Save/load UI ✔ Basic version @done(20-01-03 15:27) ☐ Multiple slots etc. -☐ Add 'force flush all' to Rasterizer interface + impls +✔ Add 'force flush all' to Rasterizer interface + impls @done(20-03-07 21:54) ☐ Custom texture cache ☐ Review constructor/initialization code ✔ Core timing events @done(20-01-12 15:14) diff --git a/save0.citrasave b/save0.citrasave deleted file mode 100644 index 578174ec6b7489150da4ff634caacf0e34d2ddd8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 776 zcmWe*fPmuEqRhmc%&Nqa%=|nntHh$@jLfoBK?W8U77j+J8VJP9?L0*8h?10RqH1|V?|A17eUl4nX1q zlntb43brUPIsz>Kd4++2my6*Yh!z9_5UsL-A0!C@U@rjWfQ|zq29QTVfSFN%k%^f} zfI&eCB+MWP^p>C^gOH$rlAxiY0HY&Nw8DXvfgdC}gusXY|Nn!WyQGVg;ep2k7Zj)K z{eZ+8iXbT*ADCiTFv9qtbN~VcxmJk<1>lfo1CtP8ILQfOfdU*DXW(!L6CgooJb{=H X09FNMLyV0NPAw`+ErKZk({Muob(AbM diff --git a/src/core/core.cpp b/src/core/core.cpp index fea1705ed..ca2299920 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -530,6 +530,9 @@ void System::Reset() { template void System::serialize(Archive& ar, const unsigned int file_version) { u32 num_cores; + if (Archive::is_saving::value) { + num_cores = this->GetNumCores(); + } ar& num_cores; if (num_cores != this->GetNumCores()) { throw std::runtime_error("Wrong N3DS mode"); @@ -547,6 +550,9 @@ void System::serialize(Archive& ar, const unsigned int file_version) { if (Archive::is_loading::value) { dsp_core.reset(); } + if (dsp_core) { + throw "BLEH"; + } ar& dsp_core; ar&* memory.get(); ar&* kernel.get(); diff --git a/src/core/core_timing.h b/src/core/core_timing.h index a56a9097d..4e11b7bd2 100644 --- a/src/core/core_timing.h +++ b/src/core/core_timing.h @@ -223,10 +223,12 @@ public: template void serialize(Archive& ar, const unsigned int) { MoveEvents(); - ar& slice_length; - ar& downcount; + // NOTE: ts_queue should be empty now ar& event_queue; ar& event_fifo_id; + ar& slice_length; + ar& downcount; + ar& executed_ticks; ar& idled_cycles; } friend class boost::serialization::access; @@ -283,7 +285,6 @@ private: deserializing = nullptr; } friend class boost::serialization::access; - }; } // namespace Core diff --git a/src/core/file_sys/layered_fs.cpp b/src/core/file_sys/layered_fs.cpp index 9d5fbf7c2..c8af6b5b0 100644 --- a/src/core/file_sys/layered_fs.cpp +++ b/src/core/file_sys/layered_fs.cpp @@ -5,6 +5,7 @@ #include #include #include "common/alignment.h" +#include "common/archives.h" #include "common/assert.h" #include "common/common_paths.h" #include "common/file_util.h" @@ -13,6 +14,8 @@ #include "core/file_sys/layered_fs.h" #include "core/file_sys/patch.h" +SERIALIZE_EXPORT_IMPL(FileSys::LayeredFS) + namespace FileSys { struct FileRelocationInfo { @@ -51,11 +54,16 @@ struct FileMetadata { }; static_assert(sizeof(FileMetadata) == 0x20, "Size of FileMetadata is not correct"); -LayeredFS::LayeredFS(std::shared_ptr romfs_, std::string patch_path_, - std::string patch_ext_path_, bool load_relocations) - : romfs(std::move(romfs_)), patch_path(std::move(patch_path_)), - patch_ext_path(std::move(patch_ext_path_)) { +LayeredFS::LayeredFS() = default; +LayeredFS::LayeredFS(std::shared_ptr romfs_, std::string patch_path_, + std::string patch_ext_path_, bool load_relocations_) + : romfs(std::move(romfs_)), patch_path(std::move(patch_path_)), + patch_ext_path(std::move(patch_ext_path_)), load_relocations(load_relocations_) { + Load(); +} + +void LayeredFS::Load() { romfs->ReadFile(0, sizeof(header), reinterpret_cast(&header)); ASSERT_MSG(header.header_length == sizeof(header), "Header size is incorrect"); diff --git a/src/core/file_sys/layered_fs.h b/src/core/file_sys/layered_fs.h index 956eedcfa..dc71d052f 100644 --- a/src/core/file_sys/layered_fs.h +++ b/src/core/file_sys/layered_fs.h @@ -9,6 +9,10 @@ #include #include #include +#include +#include +#include +#include #include "common/common_types.h" #include "common/swap.h" #include "core/file_sys/romfs_reader.h" @@ -19,6 +23,14 @@ struct RomFSHeader { struct Descriptor { u32_le offset; u32_le length; + + private: + template + void serialize(Archive& ar, const unsigned int) { + ar& offset; + ar& length; + } + friend class boost::serialization::access; }; u32_le header_length; Descriptor directory_hash_table; @@ -92,9 +104,12 @@ private: void RebuildMetadata(); + void Load(); + std::shared_ptr romfs; std::string patch_path; std::string patch_ext_path; + bool load_relocations; RomFSHeader header; Directory root; @@ -118,6 +133,23 @@ private: u64 current_file_offset{}; // current file metadata offset std::vector file_metadata_table; // rebuilt file metadata table u64 current_data_offset{}; // current assigned data offset + + LayeredFS(); + + template + void serialize(Archive& ar, const unsigned int) { + ar& boost::serialization::base_object(*this); + ar& romfs; + ar& patch_path; + ar& patch_ext_path; + ar& load_relocations; + if (Archive::is_loading::value) { + Load(); + } + } + friend class boost::serialization::access; }; } // namespace FileSys + +BOOST_CLASS_EXPORT_KEY(FileSys::LayeredFS) diff --git a/src/core/file_sys/romfs_reader.cpp b/src/core/file_sys/romfs_reader.cpp index 64374684a..a1ff38945 100644 --- a/src/core/file_sys/romfs_reader.cpp +++ b/src/core/file_sys/romfs_reader.cpp @@ -1,8 +1,11 @@ #include #include #include +#include "common/archives.h" #include "core/file_sys/romfs_reader.h" +SERIALIZE_EXPORT_IMPL(FileSys::DirectRomFSReader) + namespace FileSys { std::size_t DirectRomFSReader::ReadFile(std::size_t offset, std::size_t length, u8* buffer) { diff --git a/src/core/file_sys/romfs_reader.h b/src/core/file_sys/romfs_reader.h index 1cfaa3b4f..26dcb9857 100644 --- a/src/core/file_sys/romfs_reader.h +++ b/src/core/file_sys/romfs_reader.h @@ -2,6 +2,8 @@ #include #include +#include +#include #include "common/common_types.h" #include "common/file_util.h" @@ -16,6 +18,11 @@ public: virtual std::size_t GetSize() const = 0; virtual std::size_t ReadFile(std::size_t offset, std::size_t length, u8* buffer) = 0; + +private: + template + void serialize(Archive& ar, const unsigned int file_version) {} + friend class boost::serialization::access; }; /** @@ -54,6 +61,7 @@ private: template void serialize(Archive& ar, const unsigned int) { + ar& boost::serialization::base_object(*this); ar& is_encrypted; ar& file; ar& key; @@ -66,3 +74,5 @@ private: }; } // namespace FileSys + +BOOST_CLASS_EXPORT_KEY(FileSys::DirectRomFSReader) diff --git a/src/core/hle/service/cecd/cecd.h b/src/core/hle/service/cecd/cecd.h index 0870f31bf..b752701fe 100644 --- a/src/core/hle/service/cecd/cecd.h +++ b/src/core/hle/service/cecd/cecd.h @@ -258,7 +258,7 @@ public: ar& data_path_type; ar& open_mode.raw; ar& path; - ar& file; + // ar& file; } friend class boost::serialization::access; };