Finished archives; remove pod.h

This commit is contained in:
Hamish Milne 2020-01-03 14:00:10 +00:00 committed by zhupengfei
parent 2bf5b46460
commit 558e710e17
14 changed files with 72 additions and 48 deletions

17
TODO
View file

@ -9,10 +9,11 @@
✔ Fix or ignore inverse map @done(19-12-23 12:46)
✘ App loader @cancelled(20-01-01 22:59)
No relevant state
☐ Archive manager @started(20-01-01 23:03)
☐ NCCH @started(20-01-02 22:50)
✔ Archive manager @started(20-01-01 23:03) @done(20-01-03 13:23) @lasted(1d14h20m40s)
NB that 'FileBackend' classes are not persistent
✔ NCCH @started(20-01-02 22:50) @done(20-01-03 12:35) @lasted(13h45m50s)
✔ Normal @done(20-01-02 22:50)
☐ Self
✔ Self @done(20-01-03 12:35)
✔ SaveData @started(20-01-02 23:03) @done(20-01-02 23:27) @lasted(25m)
✔ Normal @done(20-01-02 23:03)
✔ Ext @done(20-01-02 23:26)
@ -22,8 +23,12 @@
✔ SDMC @done(20-01-02 23:34)
✔ Normal @done(20-01-02 23:34)
✔ Write-only @done(20-01-02 23:34)
☐ File refs
☐ Replace delay generator with virtual fns
✘ IVFC @cancelled(20-01-03 13:22)
Seems IVFCArchive is never used.. which is good because it has a file reference!
✘ File refs @cancelled(20-01-03 13:22)
Not needed as nothing serializes file buffers
✘ Replace delay generator with virtual fns @cancelled(20-01-03 13:16)
While they have no state, the extra refactoring here is unneeded
☐ Custom texture cache
✘ MMIO @cancelled(20-01-01 01:06)
Seems that this whole subsystem is only used in tests
@ -35,7 +40,7 @@
For now, let the settings just be whatever they are
✘ Telemetry session @cancelled(20-01-01 01:12)
Doesn't need to be serialized here
Replace SERIALIZE_AS_POD with BOOST_IS_BITWISE_SERIALIZABLE
Replace SERIALIZE_AS_POD with BOOST_IS_BITWISE_SERIALIZABLE @started(20-01-03 13:47) @done(20-01-03 13:58) @lasted(11m22s)
☐ Review constructor/initialization code
✔ Fix CI @done(19-12-31 21:32)
✔ HW @done(19-08-13 15:41)

View file

@ -1,17 +0,0 @@
#include "boost/serialization/split_member.hpp"
#define SERIALIZE_AS_POD \
private: \
friend class boost::serialization::access; \
template <typename Archive> \
void save(Archive& ar, const unsigned int file_version) const { \
ar.save_binary(this, sizeof(*this)); \
} \
template <typename Archive> \
void load(Archive& ar, const unsigned int file_version) { \
ar.load_binary(this, sizeof(*this)); \
} \
template <class Archive> \
void serialize(Archive& ar, const unsigned int file_version) { \
boost::serialization::split_member(ar, *this, file_version); \
}

View file

@ -172,7 +172,9 @@ protected:
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {}
void serialize(Archive& ar, const unsigned int) {
ar& delay_generator;
}
friend class boost::serialization::access;
};

View file

@ -30,7 +30,6 @@
// FileSys namespace
SERIALIZE_EXPORT_IMPL(FileSys::NCCHArchive)
SERIALIZE_EXPORT_IMPL(FileSys::NCCHFile)
SERIALIZE_EXPORT_IMPL(FileSys::ArchiveFactory_NCCH)
namespace FileSys {

View file

@ -98,13 +98,6 @@ private:
NCCHFile() = default; // NOTE: If the public ctor has behaviour, need to replace this with
// *_construct_data
std::vector<u8> file_buffer; // TODO: Replace with file ref for serialization
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<FileBackend>(*this);
ar& file_buffer;
}
friend class boost::serialization::access;
};
/// File system interface to the NCCH archive
@ -130,5 +123,4 @@ private:
} // namespace FileSys
BOOST_CLASS_EXPORT_KEY(FileSys::NCCHArchive)
BOOST_CLASS_EXPORT_KEY(FileSys::NCCHFile)
BOOST_CLASS_EXPORT_KEY(FileSys::ArchiveFactory_NCCH)

View file

@ -4,6 +4,7 @@
#include <array>
#include <cinttypes>
#include "common/archives.h"
#include "common/common_types.h"
#include "common/logging/log.h"
#include "common/swap.h"
@ -16,6 +17,8 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
// FileSys namespace
SERIALIZE_EXPORT_IMPL(FileSys::ArchiveFactory_SelfNCCH)
namespace FileSys {
enum class SelfNCCHFilePathType : u32 {

View file

@ -8,6 +8,7 @@
#include <string>
#include <unordered_map>
#include <vector>
#include <boost/serialization/export.hpp>
#include "common/common_types.h"
#include "core/file_sys/archive_backend.h"
#include "core/hle/result.h"
@ -44,7 +45,10 @@ public:
private:
/// Mapping of ProgramId -> NCCHData
std::unordered_map<u64, NCCHData> ncch_data;
std::unordered_map<u64, NCCHData>
ncch_data; // TODO: Remove this, or actually set the values here
};
} // namespace FileSys
BOOST_CLASS_EXPORT_KEY(FileSys::ArchiveFactory_SelfNCCH)

View file

@ -3,8 +3,11 @@
// Refer to the license.txt file included.
#include <algorithm>
#include "common/archives.h"
#include "core/file_sys/delay_generator.h"
SERIALIZE_EXPORT_IMPL(FileSys::DefaultDelayGenerator)
namespace FileSys {
DelayGenerator::~DelayGenerator() = default;

View file

@ -5,6 +5,8 @@
#pragma once
#include <cstddef>
#include <boost/serialization/access.hpp>
#include <boost/serialization/export.hpp>
#include "common/common_types.h"
namespace FileSys {
@ -16,6 +18,10 @@ public:
virtual u64 GetOpenDelayNs() = 0;
// TODO (B3N30): Add getter for all other file/directory io operations
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {}
friend class boost::serialization::access;
};
class DefaultDelayGenerator : public DelayGenerator {
@ -25,3 +31,5 @@ public:
};
} // namespace FileSys
BOOST_CLASS_EXPORT_KEY(FileSys::DefaultDelayGenerator);

View file

@ -89,12 +89,7 @@ public:
virtual void Flush() const = 0;
protected:
std::unique_ptr<DelayGenerator> delay_generator; // TODO: replace with virtual Get*DelayNs
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {}
friend class boost::serialization::access;
std::unique_ptr<DelayGenerator> delay_generator;
};
} // namespace FileSys

View file

@ -6,11 +6,11 @@
#include <new>
#include <utility>
#include <boost/serialization/access.hpp>
#include "common/assert.h"
#include "common/bit_field.h"
#include "common/common_funcs.h"
#include "common/common_types.h"
#include "common/pod.h"
// All the constants in this file come from http://3dbrew.org/wiki/Error_codes
@ -227,7 +227,12 @@ union ResultCode {
return is_error.ExtractValue(raw) == 1;
}
SERIALIZE_AS_POD
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& raw;
}
friend class boost::serialization::access;
};
constexpr bool operator==(const ResultCode& a, const ResultCode& b) {

View file

@ -6,11 +6,12 @@
#include <cstddef>
#include <type_traits>
#include <boost/serialization/access.hpp>
#include <boost/serialization/binary_object.hpp>
#include "common/assert.h"
#include "common/bit_field.h"
#include "common/common_funcs.h"
#include "common/common_types.h"
#include "common/pod.h"
namespace Memory {
class MemorySystem;
@ -298,7 +299,12 @@ private:
return register_value * 8;
}
SERIALIZE_AS_POD
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
auto obj = boost::serialization::binary_object(this, sizeof(Regs));
ar& obj;
}
friend class boost::serialization::access;
};
static_assert(std::is_standard_layout<Regs>::value, "Structure does not use standard layout");

View file

@ -6,10 +6,10 @@
#include <cstddef>
#include <type_traits>
#include <boost/serialization/access.hpp>
#include "common/bit_field.h"
#include "common/common_funcs.h"
#include "common/common_types.h"
#include "common/pod.h"
#define LCD_REG_INDEX(field_name) (offsetof(LCD::Regs, field_name) / sizeof(u32))
@ -52,7 +52,15 @@ struct Regs {
return content[index];
}
SERIALIZE_AS_POD
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& color_fill_top.raw;
ar& backlight_top;
ar& color_fill_bottom.raw;
ar& backlight_bottom;
}
friend class boost::serialization::access;
};
static_assert(std::is_standard_layout<Regs>::value, "Structure does not use standard layout");

View file

@ -8,6 +8,7 @@
#include <cstddef>
#include <functional>
#include <type_traits>
#include <boost/serialization/access.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/base_object.hpp>
#include <nihstro/shader_bytecode.h>
@ -15,7 +16,6 @@
#include "common/common_funcs.h"
#include "common/common_types.h"
#include "common/hash.h"
#include "common/pod.h"
#include "common/vector_math.h"
#include "video_core/pica_types.h"
#include "video_core/regs_rasterizer.h"
@ -65,7 +65,18 @@ struct OutputVertex {
static OutputVertex FromAttributeBuffer(const RasterizerRegs& regs,
const AttributeBuffer& output);
SERIALIZE_AS_POD
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& pos;
ar& quat;
ar& tc0;
ar& tc1;
ar& tc0_w;
ar& view;
ar& tc2;
}
friend class boost::serialization::access;
};
#define ASSERT_POS(var, pos) \
static_assert(offsetof(OutputVertex, var) == pos * sizeof(float24), "Semantic at wrong " \