More merge fixes

This commit is contained in:
Hamish Milne 2020-03-27 21:48:58 +00:00
parent da3ab3d56e
commit 5604613642
9 changed files with 69 additions and 9 deletions

2
TODO
View file

@ -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)

Binary file not shown.

View file

@ -530,6 +530,9 @@ void System::Reset() {
template <class Archive>
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();

View file

@ -223,10 +223,12 @@ public:
template <class Archive>
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

View file

@ -5,6 +5,7 @@
#include <algorithm>
#include <cstring>
#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<RomFSReader> 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<RomFSReader> 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<u8*>(&header));
ASSERT_MSG(header.header_length == sizeof(header), "Header size is incorrect");

View file

@ -9,6 +9,10 @@
#include <string>
#include <unordered_map>
#include <vector>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/string.hpp>
#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 <class Archive>
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<RomFSReader> 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<u8> file_metadata_table; // rebuilt file metadata table
u64 current_data_offset{}; // current assigned data offset
LayeredFS();
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<RomFSReader>(*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)

View file

@ -1,8 +1,11 @@
#include <algorithm>
#include <cryptopp/aes.h>
#include <cryptopp/modes.h>
#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) {

View file

@ -2,6 +2,8 @@
#include <array>
#include <boost/serialization/array.hpp>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp>
#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 <class Archive>
void serialize(Archive& ar, const unsigned int file_version) {}
friend class boost::serialization::access;
};
/**
@ -54,6 +61,7 @@ private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<RomFSReader>(*this);
ar& is_encrypted;
ar& file;
ar& key;
@ -66,3 +74,5 @@ private:
};
} // namespace FileSys
BOOST_CLASS_EXPORT_KEY(FileSys::DirectRomFSReader)

View file

@ -258,7 +258,7 @@ public:
ar& data_path_type;
ar& open_mode.raw;
ar& path;
ar& file;
// ar& file;
}
friend class boost::serialization::access;
};