More merge fixes
This commit is contained in:
parent
da3ab3d56e
commit
5604613642
2
TODO
2
TODO
|
@ -1,7 +1,7 @@
|
||||||
☐ Save/load UI
|
☐ Save/load UI
|
||||||
✔ Basic version @done(20-01-03 15:27)
|
✔ Basic version @done(20-01-03 15:27)
|
||||||
☐ Multiple slots etc.
|
☐ 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
|
☐ Custom texture cache
|
||||||
☐ Review constructor/initialization code
|
☐ Review constructor/initialization code
|
||||||
✔ Core timing events @done(20-01-12 15:14)
|
✔ Core timing events @done(20-01-12 15:14)
|
||||||
|
|
BIN
save0.citrasave
BIN
save0.citrasave
Binary file not shown.
|
@ -530,6 +530,9 @@ void System::Reset() {
|
||||||
template <class Archive>
|
template <class Archive>
|
||||||
void System::serialize(Archive& ar, const unsigned int file_version) {
|
void System::serialize(Archive& ar, const unsigned int file_version) {
|
||||||
u32 num_cores;
|
u32 num_cores;
|
||||||
|
if (Archive::is_saving::value) {
|
||||||
|
num_cores = this->GetNumCores();
|
||||||
|
}
|
||||||
ar& num_cores;
|
ar& num_cores;
|
||||||
if (num_cores != this->GetNumCores()) {
|
if (num_cores != this->GetNumCores()) {
|
||||||
throw std::runtime_error("Wrong N3DS mode");
|
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) {
|
if (Archive::is_loading::value) {
|
||||||
dsp_core.reset();
|
dsp_core.reset();
|
||||||
}
|
}
|
||||||
|
if (dsp_core) {
|
||||||
|
throw "BLEH";
|
||||||
|
}
|
||||||
ar& dsp_core;
|
ar& dsp_core;
|
||||||
ar&* memory.get();
|
ar&* memory.get();
|
||||||
ar&* kernel.get();
|
ar&* kernel.get();
|
||||||
|
|
|
@ -223,10 +223,12 @@ public:
|
||||||
template <class Archive>
|
template <class Archive>
|
||||||
void serialize(Archive& ar, const unsigned int) {
|
void serialize(Archive& ar, const unsigned int) {
|
||||||
MoveEvents();
|
MoveEvents();
|
||||||
ar& slice_length;
|
// NOTE: ts_queue should be empty now
|
||||||
ar& downcount;
|
|
||||||
ar& event_queue;
|
ar& event_queue;
|
||||||
ar& event_fifo_id;
|
ar& event_fifo_id;
|
||||||
|
ar& slice_length;
|
||||||
|
ar& downcount;
|
||||||
|
ar& executed_ticks;
|
||||||
ar& idled_cycles;
|
ar& idled_cycles;
|
||||||
}
|
}
|
||||||
friend class boost::serialization::access;
|
friend class boost::serialization::access;
|
||||||
|
@ -283,7 +285,6 @@ private:
|
||||||
deserializing = nullptr;
|
deserializing = nullptr;
|
||||||
}
|
}
|
||||||
friend class boost::serialization::access;
|
friend class boost::serialization::access;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "common/alignment.h"
|
#include "common/alignment.h"
|
||||||
|
#include "common/archives.h"
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/common_paths.h"
|
#include "common/common_paths.h"
|
||||||
#include "common/file_util.h"
|
#include "common/file_util.h"
|
||||||
|
@ -13,6 +14,8 @@
|
||||||
#include "core/file_sys/layered_fs.h"
|
#include "core/file_sys/layered_fs.h"
|
||||||
#include "core/file_sys/patch.h"
|
#include "core/file_sys/patch.h"
|
||||||
|
|
||||||
|
SERIALIZE_EXPORT_IMPL(FileSys::LayeredFS)
|
||||||
|
|
||||||
namespace FileSys {
|
namespace FileSys {
|
||||||
|
|
||||||
struct FileRelocationInfo {
|
struct FileRelocationInfo {
|
||||||
|
@ -51,11 +54,16 @@ struct FileMetadata {
|
||||||
};
|
};
|
||||||
static_assert(sizeof(FileMetadata) == 0x20, "Size of FileMetadata is not correct");
|
static_assert(sizeof(FileMetadata) == 0x20, "Size of FileMetadata is not correct");
|
||||||
|
|
||||||
LayeredFS::LayeredFS(std::shared_ptr<RomFSReader> romfs_, std::string patch_path_,
|
LayeredFS::LayeredFS() = default;
|
||||||
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(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));
|
romfs->ReadFile(0, sizeof(header), reinterpret_cast<u8*>(&header));
|
||||||
|
|
||||||
ASSERT_MSG(header.header_length == sizeof(header), "Header size is incorrect");
|
ASSERT_MSG(header.header_length == sizeof(header), "Header size is incorrect");
|
||||||
|
|
|
@ -9,6 +9,10 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#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/common_types.h"
|
||||||
#include "common/swap.h"
|
#include "common/swap.h"
|
||||||
#include "core/file_sys/romfs_reader.h"
|
#include "core/file_sys/romfs_reader.h"
|
||||||
|
@ -19,6 +23,14 @@ struct RomFSHeader {
|
||||||
struct Descriptor {
|
struct Descriptor {
|
||||||
u32_le offset;
|
u32_le offset;
|
||||||
u32_le length;
|
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;
|
u32_le header_length;
|
||||||
Descriptor directory_hash_table;
|
Descriptor directory_hash_table;
|
||||||
|
@ -92,9 +104,12 @@ private:
|
||||||
|
|
||||||
void RebuildMetadata();
|
void RebuildMetadata();
|
||||||
|
|
||||||
|
void Load();
|
||||||
|
|
||||||
std::shared_ptr<RomFSReader> romfs;
|
std::shared_ptr<RomFSReader> romfs;
|
||||||
std::string patch_path;
|
std::string patch_path;
|
||||||
std::string patch_ext_path;
|
std::string patch_ext_path;
|
||||||
|
bool load_relocations;
|
||||||
|
|
||||||
RomFSHeader header;
|
RomFSHeader header;
|
||||||
Directory root;
|
Directory root;
|
||||||
|
@ -118,6 +133,23 @@ private:
|
||||||
u64 current_file_offset{}; // current file metadata offset
|
u64 current_file_offset{}; // current file metadata offset
|
||||||
std::vector<u8> file_metadata_table; // rebuilt file metadata table
|
std::vector<u8> file_metadata_table; // rebuilt file metadata table
|
||||||
u64 current_data_offset{}; // current assigned data offset
|
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
|
} // namespace FileSys
|
||||||
|
|
||||||
|
BOOST_CLASS_EXPORT_KEY(FileSys::LayeredFS)
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cryptopp/aes.h>
|
#include <cryptopp/aes.h>
|
||||||
#include <cryptopp/modes.h>
|
#include <cryptopp/modes.h>
|
||||||
|
#include "common/archives.h"
|
||||||
#include "core/file_sys/romfs_reader.h"
|
#include "core/file_sys/romfs_reader.h"
|
||||||
|
|
||||||
|
SERIALIZE_EXPORT_IMPL(FileSys::DirectRomFSReader)
|
||||||
|
|
||||||
namespace FileSys {
|
namespace FileSys {
|
||||||
|
|
||||||
std::size_t DirectRomFSReader::ReadFile(std::size_t offset, std::size_t length, u8* buffer) {
|
std::size_t DirectRomFSReader::ReadFile(std::size_t offset, std::size_t length, u8* buffer) {
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <boost/serialization/array.hpp>
|
#include <boost/serialization/array.hpp>
|
||||||
|
#include <boost/serialization/base_object.hpp>
|
||||||
|
#include <boost/serialization/export.hpp>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/file_util.h"
|
#include "common/file_util.h"
|
||||||
|
|
||||||
|
@ -16,6 +18,11 @@ public:
|
||||||
|
|
||||||
virtual std::size_t GetSize() const = 0;
|
virtual std::size_t GetSize() const = 0;
|
||||||
virtual std::size_t ReadFile(std::size_t offset, std::size_t length, u8* buffer) = 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>
|
template <class Archive>
|
||||||
void serialize(Archive& ar, const unsigned int) {
|
void serialize(Archive& ar, const unsigned int) {
|
||||||
|
ar& boost::serialization::base_object<RomFSReader>(*this);
|
||||||
ar& is_encrypted;
|
ar& is_encrypted;
|
||||||
ar& file;
|
ar& file;
|
||||||
ar& key;
|
ar& key;
|
||||||
|
@ -66,3 +74,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace FileSys
|
} // namespace FileSys
|
||||||
|
|
||||||
|
BOOST_CLASS_EXPORT_KEY(FileSys::DirectRomFSReader)
|
||||||
|
|
|
@ -258,7 +258,7 @@ public:
|
||||||
ar& data_path_type;
|
ar& data_path_type;
|
||||||
ar& open_mode.raw;
|
ar& open_mode.raw;
|
||||||
ar& path;
|
ar& path;
|
||||||
ar& file;
|
// ar& file;
|
||||||
}
|
}
|
||||||
friend class boost::serialization::access;
|
friend class boost::serialization::access;
|
||||||
};
|
};
|
||||||
|
|
Reference in New Issue