diff --git a/src/common/archives.h b/src/common/archives.h index 74cd9e08f..29f23865b 100644 --- a/src/common/archives.h +++ b/src/common/archives.h @@ -5,16 +5,11 @@ using iarchive = boost::archive::binary_iarchive; using oarchive = boost::archive::binary_oarchive; -#define SERIALIZE_IMPL(A) template void A::serialize( \ - iarchive & ar, \ - const unsigned int file_version \ -); \ -template void A::serialize( \ - oarchive & ar, \ - const unsigned int file_version \ -); +#define SERIALIZE_IMPL(A) \ + template void A::serialize(iarchive & ar, const unsigned int file_version); \ + template void A::serialize(oarchive & ar, const unsigned int file_version); -#define SERIALIZE_EXPORT_IMPL(A) \ -BOOST_SERIALIZATION_REGISTER_ARCHIVE(iarchive) \ -BOOST_SERIALIZATION_REGISTER_ARCHIVE(oarchive) \ -BOOST_CLASS_EXPORT_IMPLEMENT(A) +#define SERIALIZE_EXPORT_IMPL(A) \ + BOOST_SERIALIZATION_REGISTER_ARCHIVE(iarchive) \ + BOOST_SERIALIZATION_REGISTER_ARCHIVE(oarchive) \ + BOOST_CLASS_EXPORT_IMPLEMENT(A) diff --git a/src/common/construct.h b/src/common/construct.h index 4e230ca43..6b2b3ceeb 100644 --- a/src/common/construct.h +++ b/src/common/construct.h @@ -2,28 +2,26 @@ class construct_access { public: - template - static inline void save_construct(Archive & ar, const T * t, const unsigned int file_version) { + template + static inline void save_construct(Archive& ar, const T* t, const unsigned int file_version) { t->save_construct(ar, file_version); } - template - static inline void load_construct(Archive & ar, T * t, const unsigned int file_version) { + template + static inline void load_construct(Archive& ar, T* t, const unsigned int file_version) { T::load_construct(ar, t, file_version); } }; -#define BOOST_SERIALIZATION_CONSTRUCT(T) \ -namespace boost { namespace serialization { \ -template \ -inline void save_construct_data( \ - Archive & ar, const T * t, const unsigned int file_version \ -){ \ - construct_access::save_construct(ar, t, file_version); \ -} \ -template \ -inline void load_construct_data( \ - Archive & ar, T * t, const unsigned int file_version \ -){ \ - construct_access::load_construct(ar, t, file_version); \ -} \ -}} +#define BOOST_SERIALIZATION_CONSTRUCT(T) \ + namespace boost { \ + namespace serialization { \ + template \ + inline void save_construct_data(Archive& ar, const T* t, const unsigned int file_version) { \ + construct_access::save_construct(ar, t, file_version); \ + } \ + template \ + inline void load_construct_data(Archive& ar, T* t, const unsigned int file_version) { \ + construct_access::load_construct(ar, t, file_version); \ + } \ + } \ + } diff --git a/src/common/pod.h b/src/common/pod.h index e7224644a..bb7095417 100644 --- a/src/common/pod.h +++ b/src/common/pod.h @@ -1,20 +1,17 @@ #include "boost/serialization/split_member.hpp" -#define SERIALIZE_AS_POD \ - private: \ - friend class boost::serialization::access; \ - template \ - void save(Archive & ar, const unsigned int file_version) const { \ - ar.save_binary(this, sizeof(*this)); \ - } \ - template \ - void load(Archive & ar, const unsigned int file_version) { \ - ar.load_binary(this, sizeof(*this)); \ - } \ - template \ - void serialize( \ - Archive &ar, \ - const unsigned int file_version \ - ){ \ - boost::serialization::split_member(ar, *this, file_version); \ +#define SERIALIZE_AS_POD \ +private: \ + friend class boost::serialization::access; \ + template \ + void save(Archive& ar, const unsigned int file_version) const { \ + ar.save_binary(this, sizeof(*this)); \ + } \ + template \ + void load(Archive& ar, const unsigned int file_version) { \ + ar.load_binary(this, sizeof(*this)); \ + } \ + template \ + void serialize(Archive& ar, const unsigned int file_version) { \ + boost::serialization::split_member(ar, *this, file_version); \ } diff --git a/src/common/serialization/atomic.h b/src/common/serialization/atomic.h index 665914df3..dbc4c0dec 100644 --- a/src/common/serialization/atomic.h +++ b/src/common/serialization/atomic.h @@ -6,20 +6,17 @@ namespace boost::serialization { template -void serialize(Archive& ar, std::atomic& value, const unsigned int file_version) -{ +void serialize(Archive& ar, std::atomic& value, const unsigned int file_version) { boost::serialization::split_free(ar, value, file_version); } template -void save(Archive& ar, const std::atomic& value, const unsigned int file_version) -{ +void save(Archive& ar, const std::atomic& value, const unsigned int file_version) { ar << value.load(); } template -void load(Archive& ar, std::atomic& value, const unsigned int file_version) -{ +void load(Archive& ar, std::atomic& value, const unsigned int file_version) { T tmp; ar >> tmp; value.store(tmp); diff --git a/src/common/serialization/boost_flat_set.h b/src/common/serialization/boost_flat_set.h index 9a0ae77b0..7fe0fe097 100644 --- a/src/common/serialization/boost_flat_set.h +++ b/src/common/serialization/boost_flat_set.h @@ -1,23 +1,21 @@ #pragma once -#include "common/common_types.h" #include #include +#include "common/common_types.h" namespace boost::serialization { template -void save(Archive& ar, const boost::container::flat_set& set, const unsigned int file_version) -{ +void save(Archive& ar, const boost::container::flat_set& set, const unsigned int file_version) { ar << static_cast(set.size()); - for (auto &v : set) { + for (auto& v : set) { ar << v; } } template -void load(Archive& ar, boost::container::flat_set& set, const unsigned int file_version) -{ +void load(Archive& ar, boost::container::flat_set& set, const unsigned int file_version) { u64 count{}; ar >> count; set.clear(); @@ -29,9 +27,8 @@ void load(Archive& ar, boost::container::flat_set& set, const unsigned int fi } template -void serialize(Archive& ar, boost::container::flat_set& set, const unsigned int file_version) -{ +void serialize(Archive& ar, boost::container::flat_set& set, const unsigned int file_version) { boost::serialization::split_free(ar, set, file_version); } -} +} // namespace boost::serialization diff --git a/src/common/serialization/optional.h b/src/common/serialization/optional.h index 5ab6af9b8..4e794058e 100644 --- a/src/common/serialization/optional.h +++ b/src/common/serialization/optional.h @@ -7,85 +7,70 @@ #include #include +#include +#include +#include #include -#include #include #include +#include #include #include -#include -#include -#include // function specializations must be defined in the appropriate // namespace - boost::serialization namespace boost { namespace serialization { -template -void save( - Archive & ar, - const std::optional< T > & t, - const unsigned int /*version*/ -){ - // It is an inherent limitation to the serialization of optional.hpp - // that the underlying type must be either a pointer or must have a - // default constructor. It's possible that this could change sometime - // in the future, but for now, one will have to work around it. This can - // be done by serialization the optional as optional - #if ! defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) - BOOST_STATIC_ASSERT( - boost::serialization::detail::is_default_constructible::value - || boost::is_pointer::value - ); - #endif +template +void save(Archive& ar, const std::optional& t, const unsigned int /*version*/ +) { +// It is an inherent limitation to the serialization of optional.hpp +// that the underlying type must be either a pointer or must have a +// default constructor. It's possible that this could change sometime +// in the future, but for now, one will have to work around it. This can +// be done by serialization the optional as optional +#if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) + BOOST_STATIC_ASSERT(boost::serialization::detail::is_default_constructible::value || + boost::is_pointer::value); +#endif const bool tflag = t.has_value(); ar << boost::serialization::make_nvp("initialized", tflag); - if (tflag){ + if (tflag) { ar << boost::serialization::make_nvp("value", *t); } } -template -void load( - Archive & ar, - std::optional< T > & t, - const unsigned int version -){ +template +void load(Archive& ar, std::optional& t, const unsigned int version) { bool tflag; ar >> boost::serialization::make_nvp("initialized", tflag); - if(! tflag){ + if (!tflag) { t.reset(); return; } - if(0 == version){ + if (0 == version) { boost::serialization::item_version_type item_version(0); - boost::archive::library_version_type library_version( - ar.get_library_version() - ); - if(boost::archive::library_version_type(3) < library_version){ + boost::archive::library_version_type library_version(ar.get_library_version()); + if (boost::archive::library_version_type(3) < library_version) { ar >> BOOST_SERIALIZATION_NVP(item_version); } } - if(! t.has_value()) + if (!t.has_value()) t = T(); ar >> boost::serialization::make_nvp("value", *t); } -template -void serialize( - Archive & ar, - std::optional< T > & t, - const unsigned int version -){ +template +void serialize(Archive& ar, std::optional& t, const unsigned int version) { boost::serialization::split_free(ar, t, version); } -template -struct version > { +template +struct version> { BOOST_STATIC_CONSTANT(int, value = 1); }; -} // serialization -} // boost +} // namespace serialization +} // namespace boost diff --git a/src/common/thread_queue_list.h b/src/common/thread_queue_list.h index ce57c01e9..093d86781 100644 --- a/src/common/thread_queue_list.h +++ b/src/common/thread_queue_list.h @@ -162,20 +162,20 @@ private: friend class boost::serialization::access; template - void save(Archive& ar, const unsigned int file_version) const - { + void save(Archive& ar, const unsigned int file_version) const { s32 idx = first == UnlinkedTag() ? -1 : static_cast(first - &queues[0]); ar << idx; for (auto i = 0; i < NUM_QUEUES; i++) { - s32 idx1 = first == UnlinkedTag() ? -1 : static_cast(queues[i].next_nonempty - &queues[0]); + s32 idx1 = first == UnlinkedTag() + ? -1 + : static_cast(queues[i].next_nonempty - &queues[0]); ar << idx1; ar << queues[i].data; } } template - void load(Archive& ar, const unsigned int file_version) - { + void load(Archive& ar, const unsigned int file_version) { s32 idx; ar >> idx; first = idx < 0 ? UnlinkedTag() : &queues[idx]; diff --git a/src/common/vector_math.h b/src/common/vector_math.h index 171d4ebfd..ba7bd1aa7 100644 --- a/src/common/vector_math.h +++ b/src/common/vector_math.h @@ -46,11 +46,10 @@ class Vec4; template class Vec2 { friend class boost::serialization::access; - template - void serialize(Archive & ar, const unsigned int file_version) - { - ar & x; - ar & y; + template + void serialize(Archive& ar, const unsigned int file_version) { + ar& x; + ar& y; } public: @@ -201,12 +200,11 @@ inline float Vec2::Normalize() { template class Vec3 { friend class boost::serialization::access; - template - void serialize(Archive & ar, const unsigned int file_version) - { - ar & x; - ar & y; - ar & z; + template + void serialize(Archive& ar, const unsigned int file_version) { + ar& x; + ar& y; + ar& z; } public: @@ -418,13 +416,12 @@ using Vec3f = Vec3; template class Vec4 { friend class boost::serialization::access; - template - void serialize(Archive & ar, const unsigned int file_version) - { - ar & x; - ar & y; - ar & z; - ar & w; + template + void serialize(Archive& ar, const unsigned int file_version) { + ar& x; + ar& y; + ar& z; + ar& w; } public: diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h index 483ba4371..be30499d1 100644 --- a/src/core/arm/arm_interface.h +++ b/src/core/arm/arm_interface.h @@ -20,8 +20,7 @@ public: friend class boost::serialization::access; template - void save(Archive& ar, const unsigned int file_version) const - { + void save(Archive& ar, const unsigned int file_version) const { for (auto i = 0; i < 16; i++) { auto r = GetCpuRegister(i); ar << r; @@ -39,8 +38,7 @@ public: } template - void load(Archive& ar, const unsigned int file_version) - { + void load(Archive& ar, const unsigned int file_version) { u32 r; for (auto i = 0; i < 16; i++) { ar >> r; @@ -220,8 +218,7 @@ private: friend class boost::serialization::access; template - void save(Archive& ar, const unsigned int file_version) const - { + void save(Archive& ar, const unsigned int file_version) const { for (auto i = 0; i < 15; i++) { auto r = GetReg(i); ar << r; @@ -245,8 +242,7 @@ private: } template - void load(Archive& ar, const unsigned int file_version) - { + void load(Archive& ar, const unsigned int file_version) { u32 r; for (auto i = 0; i < 15; i++) { ar >> r; diff --git a/src/core/core.cpp b/src/core/core.cpp index 2df38f3ed..6812a9474 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -48,10 +48,14 @@ namespace Core { /*static*/ System System::s_instance; template <> -Core::System& Global() { return System::GetInstance(); } +Core::System& Global() { + return System::GetInstance(); +} template <> -Kernel::KernelSystem& Global() { return System::GetInstance().Kernel(); } +Kernel::KernelSystem& Global() { + return System::GetInstance().Kernel(); +} System::ResultStatus System::RunLoop(bool tight_loop) { status = ResultStatus::Success; @@ -209,8 +213,8 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, u32 system_mo timing = std::make_unique(); - kernel = std::make_unique(*memory, *timing, - [this] { PrepareReschedule(); }, system_mode); + kernel = std::make_unique( + *memory, *timing, [this] { PrepareReschedule(); }, system_mode); if (Settings::values.use_cpu_jit) { #ifdef ARCHITECTURE_x86_64 @@ -400,32 +404,29 @@ void System::Reset() { Load(*m_emu_window, m_filepath); } -template -void System::serialize(Archive & ar, const unsigned int file_version) -{ - ar & *cpu_core.get(); - ar & *service_manager.get(); - ar & GPU::g_regs; - ar & LCD::g_regs; +template +void System::serialize(Archive& ar, const unsigned int file_version) { + ar&* cpu_core.get(); + ar&* service_manager.get(); + ar& GPU::g_regs; + ar& LCD::g_regs; ar & dsp_core->GetDspMemory(); - ar & *memory.get(); - ar & *kernel.get(); + ar&* memory.get(); + ar&* kernel.get(); } -void System::Save(std::ostream &stream) const -{ +void System::Save(std::ostream& stream) const { { oarchive oa{stream}; - oa & *this; + oa&* this; } VideoCore::Save(stream); } -void System::Load(std::istream &stream) -{ +void System::Load(std::istream& stream) { { iarchive ia{stream}; - ia & *this; + ia&* this; } VideoCore::Load(stream); } diff --git a/src/core/core.h b/src/core/core.h index 8bf04d365..75e0e1a54 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -272,9 +272,9 @@ public: return registered_image_interface; } - void Save(std::ostream &stream) const; + void Save(std::ostream& stream) const; - void Load(std::istream &stream); + void Load(std::istream& stream); private: /** @@ -345,8 +345,8 @@ private: std::atomic shutdown_requested; friend class boost::serialization::access; - template - void serialize(Archive & ar, const unsigned int file_version); + template + void serialize(Archive& ar, const unsigned int file_version); }; inline ARM_Interface& CPU() { diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp index e5e017daa..7b8329c4d 100644 --- a/src/core/hle/kernel/address_arbiter.cpp +++ b/src/core/hle/kernel/address_arbiter.cpp @@ -6,12 +6,12 @@ #include "common/archives.h" #include "common/common_types.h" #include "common/logging/log.h" +#include "core/global.h" #include "core/hle/kernel/address_arbiter.h" #include "core/hle/kernel/errors.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/thread.h" #include "core/memory.h" -#include "core/global.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // Kernel namespace diff --git a/src/core/hle/kernel/address_arbiter.h b/src/core/hle/kernel/address_arbiter.h index 793d274ca..19b80315f 100644 --- a/src/core/hle/kernel/address_arbiter.h +++ b/src/core/hle/kernel/address_arbiter.h @@ -74,11 +74,10 @@ private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & boost::serialization::base_object(*this); - ar & name; - ar & waiting_threads; + void serialize(Archive& ar, const unsigned int file_version) { + ar& boost::serialization::base_object(*this); + ar& name; + ar& waiting_threads; } }; diff --git a/src/core/hle/kernel/client_port.cpp b/src/core/hle/kernel/client_port.cpp index 618c7d0d7..e7e8a8014 100644 --- a/src/core/hle/kernel/client_port.cpp +++ b/src/core/hle/kernel/client_port.cpp @@ -4,6 +4,7 @@ #include "common/archives.h" #include "common/assert.h" +#include "core/global.h" #include "core/hle/kernel/client_port.h" #include "core/hle/kernel/client_session.h" #include "core/hle/kernel/errors.h" @@ -11,7 +12,6 @@ #include "core/hle/kernel/object.h" #include "core/hle/kernel/server_port.h" #include "core/hle/kernel/server_session.h" -#include "core/global.h" SERIALIZE_EXPORT_IMPL(Kernel::ClientPort) diff --git a/src/core/hle/kernel/client_port.h b/src/core/hle/kernel/client_port.h index c5b032f1f..1d0f5c024 100644 --- a/src/core/hle/kernel/client_port.h +++ b/src/core/hle/kernel/client_port.h @@ -61,17 +61,15 @@ private: friend class KernelSystem; - private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & boost::serialization::base_object(*this); - ar & server_port; - ar & max_sessions; - ar & active_sessions; - ar & name; + void serialize(Archive& ar, const unsigned int file_version) { + ar& boost::serialization::base_object(*this); + ar& server_port; + ar& max_sessions; + ar& active_sessions; + ar& name; } }; diff --git a/src/core/hle/kernel/client_session.cpp b/src/core/hle/kernel/client_session.cpp index 0b00576d3..a47e6411b 100644 --- a/src/core/hle/kernel/client_session.cpp +++ b/src/core/hle/kernel/client_session.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/assert.h" #include "common/archives.h" +#include "common/assert.h" #include "core/hle/kernel/client_session.h" #include "core/hle/kernel/errors.h" #include "core/hle/kernel/hle_ipc.h" diff --git a/src/core/hle/kernel/client_session.h b/src/core/hle/kernel/client_session.h index 1ddbfb348..38f39c299 100644 --- a/src/core/hle/kernel/client_session.h +++ b/src/core/hle/kernel/client_session.h @@ -53,11 +53,10 @@ public: private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & boost::serialization::base_object(*this); - ar & name; - ar & parent; + void serialize(Archive& ar, const unsigned int file_version) { + ar& boost::serialization::base_object(*this); + ar& name; + ar& parent; } }; diff --git a/src/core/hle/kernel/config_mem.h b/src/core/hle/kernel/config_mem.h index 26fc0bccb..e4e895516 100644 --- a/src/core/hle/kernel/config_mem.h +++ b/src/core/hle/kernel/config_mem.h @@ -60,10 +60,9 @@ private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { + void serialize(Archive& ar, const unsigned int file_version) { auto o_config_mem = boost::serialization::binary_object(&config_mem, sizeof(config_mem)); - ar & o_config_mem; + ar& o_config_mem; } }; diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp index 2375d6733..9f26847b0 100644 --- a/src/core/hle/kernel/event.cpp +++ b/src/core/hle/kernel/event.cpp @@ -5,8 +5,8 @@ #include #include #include -#include "common/assert.h" #include "common/archives.h" +#include "common/assert.h" #include "core/hle/kernel/event.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/thread.h" diff --git a/src/core/hle/kernel/event.h b/src/core/hle/kernel/event.h index 509ab5c6c..892718533 100644 --- a/src/core/hle/kernel/event.h +++ b/src/core/hle/kernel/event.h @@ -53,12 +53,11 @@ private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & boost::serialization::base_object(*this); - ar & reset_type; - ar & signaled; - ar & name; + void serialize(Archive& ar, const unsigned int file_version) { + ar& boost::serialization::base_object(*this); + ar& reset_type; + ar& signaled; + ar& name; } }; diff --git a/src/core/hle/kernel/handle_table.h b/src/core/hle/kernel/handle_table.h index eabf06c26..728ab5fa3 100644 --- a/src/core/hle/kernel/handle_table.h +++ b/src/core/hle/kernel/handle_table.h @@ -121,12 +121,11 @@ private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & objects; - ar & generations; - ar & next_generation; - ar & next_free_slot; + void serialize(Archive& ar, const unsigned int file_version) { + ar& objects; + ar& generations; + ar& next_generation; + ar& next_free_slot; } }; diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index 162a2eb39..2177b733e 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h @@ -11,10 +11,10 @@ #include #include #include -#include -#include -#include #include +#include +#include +#include #include "common/common_types.h" #include "common/swap.h" #include "core/hle/ipc.h" @@ -74,9 +74,10 @@ public: /// in each service must inherit from this. struct SessionDataBase { virtual ~SessionDataBase() = default; + private: template - void serialize(Archive& ar, const unsigned int file_version) { } + void serialize(Archive& ar, const unsigned int file_version) {} friend class boost::serialization::access; }; @@ -104,10 +105,9 @@ protected: private: template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & session; - ar & data; + void serialize(Archive& ar, const unsigned int file_version) { + ar& session; + ar& data; } friend class boost::serialization::access; }; @@ -117,9 +117,8 @@ protected: private: template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & connected_sessions; + void serialize(Archive& ar, const unsigned int file_version) { + ar& connected_sessions; } friend class boost::serialization::access; }; diff --git a/src/core/hle/kernel/ipc.h b/src/core/hle/kernel/ipc.h index 46d86a528..2c69617d4 100644 --- a/src/core/hle/kernel/ipc.h +++ b/src/core/hle/kernel/ipc.h @@ -30,15 +30,15 @@ struct MappedBufferContext { private: template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & permissions; - ar & size; - ar & source_address; - ar & target_address; - // TODO: Check whether we need these. If we do, add a field for the size and/or change to a 'vector' - //ar & buffer; - //ar & reserve_buffer; + void serialize(Archive& ar, const unsigned int file_version) { + ar& permissions; + ar& size; + ar& source_address; + ar& target_address; + // TODO: Check whether we need these. If we do, add a field for the size and/or change to a + // 'vector' + // ar & buffer; + // ar & reserve_buffer; } friend class boost::serialization::access; }; diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index a45973968..7edef2505 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -104,20 +104,19 @@ void KernelSystem::AddNamedPort(std::string name, std::shared_ptr po } template -void KernelSystem::serialize(Archive& ar, const unsigned int file_version) -{ - ar & memory_regions; - ar & named_ports; - ar & *current_cpu.get(); +void KernelSystem::serialize(Archive& ar, const unsigned int file_version) { + ar& memory_regions; + ar& named_ports; + ar&* current_cpu.get(); // NB: subsystem references and prepare_reschedule_callback are constant - ar & *resource_limits.get(); - ar & next_object_id; - ar & *timer_manager.get(); - ar & next_process_id; - ar & process_list; - ar & current_process; - ar & *thread_manager.get(); - ar & *config_mem_handler.get(); + ar&* resource_limits.get(); + ar& next_object_id; + ar&* timer_manager.get(); + ar& next_process_id; + ar& process_list; + ar& current_process; + ar&* thread_manager.get(); + ar&* config_mem_handler.get(); // Shared page data is read-only at the moment, so doesn't need serializing // Deliberately don't include debugger info to allow debugging through loads } diff --git a/src/core/hle/kernel/memory.h b/src/core/hle/kernel/memory.h index ed4ea1296..f4b0a6d98 100644 --- a/src/core/hle/kernel/memory.h +++ b/src/core/hle/kernel/memory.h @@ -7,8 +7,8 @@ #include #include #include -#include "common/serialization/boost_discrete_interval.hpp" #include "common/common_types.h" +#include "common/serialization/boost_discrete_interval.hpp" namespace Kernel { @@ -66,13 +66,12 @@ struct MemoryRegionInfo { private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & base; - ar & size; - ar & used; + void serialize(Archive& ar, const unsigned int file_version) { + ar& base; + ar& size; + ar& used; // This works because interval_set has exactly one member of type ImplSetT - ar & *(reinterpret_cast(&free_blocks)); + ar&*(reinterpret_cast(&free_blocks)); } }; diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index 4badd88ce..6aff80224 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -7,12 +7,12 @@ #include "common/archives.h" #include "common/assert.h" #include "core/core.h" +#include "core/global.h" #include "core/hle/kernel/errors.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/mutex.h" #include "core/hle/kernel/object.h" #include "core/hle/kernel/thread.h" -#include "core/global.h" SERIALIZE_EXPORT_IMPL(Kernel::Mutex) diff --git a/src/core/hle/kernel/mutex.h b/src/core/hle/kernel/mutex.h index a164b70da..4adf674c3 100644 --- a/src/core/hle/kernel/mutex.h +++ b/src/core/hle/kernel/mutex.h @@ -62,13 +62,12 @@ private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & boost::serialization::base_object(*this); - ar & lock_count; - ar & priority; - ar & name; - ar & holding_thread; + void serialize(Archive& ar, const unsigned int file_version) { + ar& boost::serialization::base_object(*this); + ar& lock_count; + ar& priority; + ar& name; + ar& holding_thread; } }; diff --git a/src/core/hle/kernel/object.h b/src/core/hle/kernel/object.h index a61e47c17..57b208dc1 100644 --- a/src/core/hle/kernel/object.h +++ b/src/core/hle/kernel/object.h @@ -10,10 +10,10 @@ #include #include #include -#include "common/serialization/atomic.h" #include "common/common_types.h" -#include "core/hle/kernel/kernel.h" +#include "common/serialization/atomic.h" #include "core/global.h" +#include "core/hle/kernel/kernel.h" namespace Kernel { @@ -72,9 +72,8 @@ private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & object_id; + void serialize(Archive& ar, const unsigned int file_version) { + ar& object_id; } }; @@ -102,11 +101,10 @@ inline std::shared_ptr DynamicObjectCast(std::shared_ptr object) { BOOST_SERIALIZATION_ASSUME_ABSTRACT(Kernel::Object) -#define CONSTRUCT_KERNEL_OBJECT(T) \ -namespace boost::serialization { \ -template \ -inline void load_construct_data( \ - Archive & ar, T * t, const unsigned int file_version \ -){ \ - ::new(t)T(Core::Global()); \ -}} +#define CONSTRUCT_KERNEL_OBJECT(T) \ + namespace boost::serialization { \ + template \ + inline void load_construct_data(Archive& ar, T* t, const unsigned int file_version) { \ + ::new (t) T(Core::Global()); \ + } \ + } diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index 12afe1f89..78b695e97 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp @@ -11,6 +11,7 @@ #include "common/common_funcs.h" #include "common/logging/log.h" #include "common/serialization/boost_vector.hpp" +#include "core/global.h" #include "core/hle/kernel/errors.h" #include "core/hle/kernel/memory.h" #include "core/hle/kernel/process.h" @@ -18,7 +19,6 @@ #include "core/hle/kernel/thread.h" #include "core/hle/kernel/vm_manager.h" #include "core/memory.h" -#include "core/global.h" SERIALIZE_EXPORT_IMPL(Kernel::Process) SERIALIZE_EXPORT_IMPL(Kernel::CodeSet) @@ -26,24 +26,25 @@ SERIALIZE_EXPORT_IMPL(Kernel::CodeSet) namespace Kernel { template -void Process::serialize(Archive& ar, const unsigned int file_version) -{ - ar & boost::serialization::base_object(*this); - ar & handle_table; - ar & codeset; - ar & resource_limit; - ar & svc_access_mask; - ar & handle_table_size; - ar & (boost::container::vector >&)address_mappings; - ar & flags.raw; - ar & kernel_version; - ar & ideal_processor; - ar & status; - ar & process_id; - ar & vm_manager; - ar & memory_used; - ar & memory_region; - ar & tls_slots; +void Process::serialize(Archive& ar, const unsigned int file_version) { + ar& boost::serialization::base_object(*this); + ar& handle_table; + ar& codeset; + ar& resource_limit; + ar& svc_access_mask; + ar& handle_table_size; + ar&(boost::container::vector< + AddressMapping, boost::container::dtl::static_storage_allocator>&) + address_mappings; + ar& flags.raw; + ar& kernel_version; + ar& ideal_processor; + ar& status; + ar& process_id; + ar& vm_manager; + ar& memory_used; + ar& memory_region; + ar& tls_slots; } SERIALIZE_IMPL(Process) diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h index 5746a1c6a..f9aa76c67 100644 --- a/src/core/hle/kernel/process.h +++ b/src/core/hle/kernel/process.h @@ -11,8 +11,8 @@ #include #include #include -#include #include +#include #include "common/bit_field.h" #include "common/common_types.h" #include "core/hle/kernel/handle_table.h" @@ -31,12 +31,11 @@ struct AddressMapping { private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & address; - ar & size; - ar & read_only; - ar & unk_flag; + void serialize(Archive& ar, const unsigned int file_version) { + ar& address; + ar& size; + ar& read_only; + ar& unk_flag; } }; @@ -76,11 +75,10 @@ public: private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & offset; - ar & addr; - ar & size; + void serialize(Archive& ar, const unsigned int file_version) { + ar& offset; + ar& addr; + ar& size; } }; @@ -133,14 +131,13 @@ public: private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & boost::serialization::base_object(*this); + void serialize(Archive& ar, const unsigned int file_version) { + ar& boost::serialization::base_object(*this); // TODO: memory reference - ar & segments; - ar & entrypoint; - ar & name; - ar & program_id; + ar& segments; + ar& entrypoint; + ar& name; + ar& program_id; } }; diff --git a/src/core/hle/kernel/resource_limit.h b/src/core/hle/kernel/resource_limit.h index 0d64f1216..8593a03a3 100644 --- a/src/core/hle/kernel/resource_limit.h +++ b/src/core/hle/kernel/resource_limit.h @@ -116,30 +116,30 @@ public: private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & boost::serialization::base_object(*this); - // NB most of these aren't used at all currently, but we're adding them here for forwards compatibility - ar & name; - ar & max_priority; - ar & max_commit; - ar & max_threads; - ar & max_events; - ar & max_mutexes; - ar & max_semaphores; - ar & max_timers; - ar & max_shared_mems; - ar & max_address_arbiters; - ar & max_cpu_time; - ar & current_commit; - ar & current_threads; - ar & current_events; - ar & current_mutexes; - ar & current_semaphores; - ar & current_timers; - ar & current_shared_mems; - ar & current_address_arbiters; - ar & current_cpu_time; + void serialize(Archive& ar, const unsigned int file_version) { + ar& boost::serialization::base_object(*this); + // NB most of these aren't used at all currently, but we're adding them here for forwards + // compatibility + ar& name; + ar& max_priority; + ar& max_commit; + ar& max_threads; + ar& max_events; + ar& max_mutexes; + ar& max_semaphores; + ar& max_timers; + ar& max_shared_mems; + ar& max_address_arbiters; + ar& max_cpu_time; + ar& current_commit; + ar& current_threads; + ar& current_events; + ar& current_mutexes; + ar& current_semaphores; + ar& current_timers; + ar& current_shared_mems; + ar& current_address_arbiters; + ar& current_cpu_time; } }; @@ -160,9 +160,8 @@ private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & resource_limits; + void serialize(Archive& ar, const unsigned int file_version) { + ar& resource_limits; } }; diff --git a/src/core/hle/kernel/semaphore.cpp b/src/core/hle/kernel/semaphore.cpp index c637f5f4d..7aefc8605 100644 --- a/src/core/hle/kernel/semaphore.cpp +++ b/src/core/hle/kernel/semaphore.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/assert.h" #include "common/archives.h" +#include "common/assert.h" #include "core/hle/kernel/errors.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/semaphore.h" diff --git a/src/core/hle/kernel/semaphore.h b/src/core/hle/kernel/semaphore.h index f28c30ec7..a7ab192a6 100644 --- a/src/core/hle/kernel/semaphore.h +++ b/src/core/hle/kernel/semaphore.h @@ -5,8 +5,8 @@ #pragma once #include -#include #include +#include #include "common/common_types.h" #include "core/hle/kernel/object.h" #include "core/hle/kernel/wait_object.h" @@ -48,12 +48,11 @@ public: private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & boost::serialization::base_object(*this); - ar & max_count; - ar & available_count; - ar & name; + void serialize(Archive& ar, const unsigned int file_version) { + ar& boost::serialization::base_object(*this); + ar& max_count; + ar& available_count; + ar& name; } }; diff --git a/src/core/hle/kernel/server_port.cpp b/src/core/hle/kernel/server_port.cpp index 46aa8f758..077150222 100644 --- a/src/core/hle/kernel/server_port.cpp +++ b/src/core/hle/kernel/server_port.cpp @@ -7,11 +7,11 @@ #include "common/assert.h" #include "core/hle/kernel/client_port.h" #include "core/hle/kernel/errors.h" +#include "core/hle/kernel/hle_ipc.h" #include "core/hle/kernel/object.h" #include "core/hle/kernel/server_port.h" #include "core/hle/kernel/server_session.h" #include "core/hle/kernel/thread.h" -#include "core/hle/kernel/hle_ipc.h" SERIALIZE_EXPORT_IMPL(Kernel::ServerPort) @@ -53,12 +53,11 @@ KernelSystem::PortPair KernelSystem::CreatePortPair(u32 max_sessions, std::strin } template -void ServerPort::serialize(Archive& ar, const unsigned int file_version) -{ - ar & boost::serialization::base_object(*this); - ar & name; - ar & pending_sessions; - ar & hle_handler; +void ServerPort::serialize(Archive& ar, const unsigned int file_version) { + ar& boost::serialization::base_object(*this); + ar& name; + ar& pending_sessions; + ar& hle_handler; } SERIALIZE_IMPL(ServerPort) diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp index e0c4087f1..4b393b63d 100644 --- a/src/core/hle/kernel/server_session.cpp +++ b/src/core/hle/kernel/server_session.cpp @@ -4,13 +4,13 @@ #include #include "common/archives.h" +#include "core/global.h" #include "core/hle/kernel/client_port.h" #include "core/hle/kernel/client_session.h" #include "core/hle/kernel/hle_ipc.h" #include "core/hle/kernel/server_session.h" #include "core/hle/kernel/session.h" #include "core/hle/kernel/thread.h" -#include "core/global.h" SERIALIZE_EXPORT_IMPL(Kernel::ServerSession) diff --git a/src/core/hle/kernel/server_session.h b/src/core/hle/kernel/server_session.h index 6eb5673f6..331ac8397 100644 --- a/src/core/hle/kernel/server_session.h +++ b/src/core/hle/kernel/server_session.h @@ -110,15 +110,14 @@ private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & boost::serialization::base_object(*this); - ar & name; - ar & parent; - ar & hle_handler; - ar & pending_requesting_threads; - ar & currently_handling; - ar & mapped_buffer_context; + void serialize(Archive& ar, const unsigned int file_version) { + ar& boost::serialization::base_object(*this); + ar& name; + ar& parent; + ar& hle_handler; + ar& pending_requesting_threads; + ar& currently_handling; + ar& mapped_buffer_context; } }; diff --git a/src/core/hle/kernel/session.cpp b/src/core/hle/kernel/session.cpp index a2a1f90f9..1ec1039dc 100644 --- a/src/core/hle/kernel/session.cpp +++ b/src/core/hle/kernel/session.cpp @@ -4,22 +4,21 @@ #include #include "common/archives.h" -#include "core/hle/kernel/session.h" -#include "core/hle/kernel/client_session.h" -#include "core/hle/kernel/server_session.h" #include "core/hle/kernel/client_port.h" +#include "core/hle/kernel/client_session.h" #include "core/hle/kernel/hle_ipc.h" +#include "core/hle/kernel/server_session.h" +#include "core/hle/kernel/session.h" SERIALIZE_IMPL(Kernel::Session) namespace Kernel { template -void Session::serialize(Archive& ar, const unsigned int file_version) -{ - ar & client; - ar & server; - ar & port; +void Session::serialize(Archive& ar, const unsigned int file_version) { + ar& client; + ar& server; + ar& port; } } // namespace Kernel diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp index 14c9751e8..55c374dc5 100644 --- a/src/core/hle/kernel/shared_memory.cpp +++ b/src/core/hle/kernel/shared_memory.cpp @@ -5,11 +5,11 @@ #include #include "common/archives.h" #include "common/logging/log.h" +#include "core/global.h" #include "core/hle/kernel/errors.h" #include "core/hle/kernel/memory.h" #include "core/hle/kernel/shared_memory.h" #include "core/memory.h" -#include "core/global.h" SERIALIZE_EXPORT_IMPL(Kernel::SharedMemory) diff --git a/src/core/hle/kernel/shared_memory.h b/src/core/hle/kernel/shared_memory.h index 88727be6d..f2fa1a728 100644 --- a/src/core/hle/kernel/shared_memory.h +++ b/src/core/hle/kernel/shared_memory.h @@ -107,17 +107,16 @@ private: KernelSystem& kernel; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & linear_heap_phys_offset; + void serialize(Archive& ar, const unsigned int file_version) { + ar& linear_heap_phys_offset; // TODO: backing blocks u8* (this is always FCRAM I think) - ar & size; - ar & permissions; - ar & other_permissions; - ar & owner_process; - ar & base_address; - ar & name; - ar & *(reinterpret_cast(&holding_memory)); + ar& size; + ar& permissions; + ar& other_permissions; + ar& owner_process; + ar& base_address; + ar& name; + ar&*(reinterpret_cast(&holding_memory)); } friend class boost::serialization::access; }; diff --git a/src/core/hle/kernel/shared_page.h b/src/core/hle/kernel/shared_page.h index 58cd46334..b3e1a48b6 100644 --- a/src/core/hle/kernel/shared_page.h +++ b/src/core/hle/kernel/shared_page.h @@ -108,10 +108,9 @@ private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { + void serialize(Archive& ar, const unsigned int file_version) { auto o_shared_page = boost::serialization::binary_object(&shared_page, sizeof(shared_page)); - ar & o_shared_page; + ar& o_shared_page; } }; diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index c824b58a6..c3c5da7d4 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -15,6 +15,7 @@ #include "core/arm/arm_interface.h" #include "core/arm/skyeye_common/armstate.h" #include "core/core.h" +#include "core/global.h" #include "core/hle/kernel/errors.h" #include "core/hle/kernel/handle_table.h" #include "core/hle/kernel/kernel.h" @@ -24,31 +25,29 @@ #include "core/hle/kernel/thread.h" #include "core/hle/result.h" #include "core/memory.h" -#include "core/global.h" SERIALIZE_EXPORT_IMPL(Kernel::Thread) namespace Kernel { template -void Thread::serialize(Archive& ar, const unsigned int file_version) -{ - ar & *context.get(); - ar & thread_id; - ar & status; - ar & entry_point; - ar & stack_top; - ar & nominal_priority; - ar & current_priority; - ar & last_running_ticks; - ar & processor_id; - ar & tls_address; - ar & held_mutexes; - ar & pending_mutexes; - ar & owner_process; - ar & wait_objects; - ar & wait_address; - ar & name; +void Thread::serialize(Archive& ar, const unsigned int file_version) { + ar&* context.get(); + ar& thread_id; + ar& status; + ar& entry_point; + ar& stack_top; + ar& nominal_priority; + ar& current_priority; + ar& last_running_ticks; + ar& processor_id; + ar& tls_address; + ar& held_mutexes; + ar& pending_mutexes; + ar& owner_process; + ar& wait_objects; + ar& wait_address; + ar& name; // TODO: How the hell to do wakeup_callback } diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index 09341560a..219db9f2d 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h @@ -9,10 +9,10 @@ #include #include #include +#include #include #include #include -#include #include "common/common_types.h" #include "common/thread_queue_list.h" #include "core/arm/arm_interface.h" @@ -152,13 +152,12 @@ private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & next_thread_id; - ar & current_thread; - ar & ready_queue; - ar & wakeup_callback_table; - ar & thread_list; + void serialize(Archive& ar, const unsigned int file_version) { + ar& next_thread_id; + ar& current_thread; + ar& ready_queue; + ar& wakeup_callback_table; + ar& thread_list; } }; diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp index f1a31cdf9..d29b25986 100644 --- a/src/core/hle/kernel/timer.cpp +++ b/src/core/hle/kernel/timer.cpp @@ -8,11 +8,11 @@ #include "common/assert.h" #include "common/logging/log.h" #include "core/core.h" +#include "core/global.h" #include "core/hle/kernel/handle_table.h" #include "core/hle/kernel/object.h" #include "core/hle/kernel/thread.h" #include "core/hle/kernel/timer.h" -#include "core/global.h" SERIALIZE_EXPORT_IMPL(Kernel::Timer) diff --git a/src/core/hle/kernel/timer.h b/src/core/hle/kernel/timer.h index f61ec1c11..d2c513024 100644 --- a/src/core/hle/kernel/timer.h +++ b/src/core/hle/kernel/timer.h @@ -37,10 +37,9 @@ private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & next_timer_callback_id; - ar & timer_callback_table; + void serialize(Archive& ar, const unsigned int file_version) { + ar& next_timer_callback_id; + ar& timer_callback_table; } }; @@ -115,14 +114,13 @@ private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & reset_type; - ar & initial_delay; - ar & interval_delay; - ar & signaled; - ar & name; - ar & callback_id; + void serialize(Archive& ar, const unsigned int file_version) { + ar& reset_type; + ar& initial_delay; + ar& interval_delay; + ar& signaled; + ar& name; + ar& callback_id; } }; diff --git a/src/core/hle/kernel/vm_manager.h b/src/core/hle/kernel/vm_manager.h index e930fc64a..5fd6d8740 100644 --- a/src/core/hle/kernel/vm_manager.h +++ b/src/core/hle/kernel/vm_manager.h @@ -86,17 +86,16 @@ struct VirtualMemoryArea { private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & base; - ar & size; - ar & type; - ar & permissions; - ar & meminfo_state; + void serialize(Archive& ar, const unsigned int file_version) { + ar& base; + ar& size; + ar& type; + ar& permissions; + ar& meminfo_state; // TODO: backing memory ref // backing memory can be: Physical/FCRAM pointer, config mem, shared page - ar & paddr; - ar & mmio_handler; + ar& paddr; + ar& mmio_handler; } }; @@ -213,27 +212,25 @@ public: private: friend class boost::serialization::access; template - void save(Archive& ar, const unsigned int file_version) const - { - ar & vma_map; + void save(Archive& ar, const unsigned int file_version) const { + ar& vma_map; for (int i = 0; i < page_table.pointers.size(); i++) { ar << memory.GetFCRAMOffset(page_table.pointers[i]); } - ar & page_table.special_regions; - ar & page_table.attributes; + ar& page_table.special_regions; + ar& page_table.attributes; } template - void load(Archive& ar, const unsigned int file_version) - { - ar & vma_map; + void load(Archive& ar, const unsigned int file_version) { + ar& vma_map; for (int i = 0; i < page_table.pointers.size(); i++) { u32 offset{}; ar >> offset; page_table.pointers[i] = memory.GetFCRAMPointer(offset); } - ar & page_table.special_regions; - ar & page_table.attributes; + ar& page_table.special_regions; + ar& page_table.attributes; } BOOST_SERIALIZATION_SPLIT_MEMBER() diff --git a/src/core/hle/kernel/wait_object.h b/src/core/hle/kernel/wait_object.h index e08997721..c07290e8a 100644 --- a/src/core/hle/kernel/wait_object.h +++ b/src/core/hle/kernel/wait_object.h @@ -69,10 +69,9 @@ private: private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & boost::serialization::base_object(*this); - ar & waiting_threads; + void serialize(Archive& ar, const unsigned int file_version) { + ar& boost::serialization::base_object(*this); + ar& waiting_threads; // NB: hle_notifier *not* serialized since it's a callback! // Fortunately it's only used in one place (DSP) so we can reconstruct it there } diff --git a/src/core/hle/service/ac/ac.cpp b/src/core/hle/service/ac/ac.cpp index 356df5a63..d9f1085c8 100644 --- a/src/core/hle/service/ac/ac.cpp +++ b/src/core/hle/service/ac/ac.cpp @@ -3,9 +3,9 @@ // Refer to the license.txt file included. #include +#include "common/archives.h" #include "common/common_types.h" #include "common/logging/log.h" -#include "common/archives.h" #include "core/core.h" #include "core/hle/ipc.h" #include "core/hle/ipc_helpers.h" @@ -181,12 +181,11 @@ void InstallInterfaces(Core::System& system) { } template -void Module::serialize(Archive& ar, const unsigned int) -{ - ar & ac_connected; - ar & close_event; - ar & connect_event; - ar & disconnect_event; +void Module::serialize(Archive& ar, const unsigned int) { + ar& ac_connected; + ar& close_event; + ar& connect_event; + ar& disconnect_event; // default_config is never written to } diff --git a/src/core/hle/service/ac/ac_i.cpp b/src/core/hle/service/ac/ac_i.cpp index e4cc4c1f1..ff4fb954c 100644 --- a/src/core/hle/service/ac/ac_i.cpp +++ b/src/core/hle/service/ac/ac_i.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/ac/ac_i.h" #include "common/archives.h" +#include "core/hle/service/ac/ac_i.h" namespace Service::AC { diff --git a/src/core/hle/service/ac/ac_u.cpp b/src/core/hle/service/ac/ac_u.cpp index 429942f7d..e88cdd164 100644 --- a/src/core/hle/service/ac/ac_u.cpp +++ b/src/core/hle/service/ac/ac_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/ac/ac_u.h" #include "common/archives.h" +#include "core/hle/service/ac/ac_u.h" namespace Service::AC { diff --git a/src/core/hle/service/act/act.h b/src/core/hle/service/act/act.h index c327cdaef..11812bcfe 100644 --- a/src/core/hle/service/act/act.h +++ b/src/core/hle/service/act/act.h @@ -23,9 +23,10 @@ public: protected: std::shared_ptr act; }; + private: template - inline void serialize(Archive& ar, const unsigned int file_version) { } + inline void serialize(Archive& ar, const unsigned int file_version) {} friend class boost::serialization::access; }; diff --git a/src/core/hle/service/act/act_a.cpp b/src/core/hle/service/act/act_a.cpp index b4bf750f7..b85a17183 100644 --- a/src/core/hle/service/act/act_a.cpp +++ b/src/core/hle/service/act/act_a.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/act/act_a.h" #include "common/archives.h" +#include "core/hle/service/act/act_a.h" namespace Service::ACT { diff --git a/src/core/hle/service/act/act_a.h b/src/core/hle/service/act/act_a.h index 1e37c9bde..1454441d5 100644 --- a/src/core/hle/service/act/act_a.h +++ b/src/core/hle/service/act/act_a.h @@ -11,6 +11,7 @@ namespace Service::ACT { class ACT_A final : public Module::Interface { public: explicit ACT_A(std::shared_ptr act); + private: SERVICE_SERIALIZATION(ACT_A, act, Module) }; diff --git a/src/core/hle/service/act/act_u.cpp b/src/core/hle/service/act/act_u.cpp index 599bec18a..a0058d573 100644 --- a/src/core/hle/service/act/act_u.cpp +++ b/src/core/hle/service/act/act_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/act/act_u.h" #include "common/archives.h" +#include "core/hle/service/act/act_u.h" namespace Service::ACT { diff --git a/src/core/hle/service/act/act_u.h b/src/core/hle/service/act/act_u.h index 820aa862a..bcd2d653e 100644 --- a/src/core/hle/service/act/act_u.h +++ b/src/core/hle/service/act/act_u.h @@ -11,6 +11,7 @@ namespace Service::ACT { class ACT_U final : public Module::Interface { public: explicit ACT_U(std::shared_ptr act); + private: SERVICE_SERIALIZATION(ACT_U, act, Module) }; diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 45ed29e6c..b3bd037ea 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -1455,7 +1455,7 @@ Module::Module(Core::System& system) : kernel(system.Kernel()) { system_updater_mutex = system.Kernel().CreateMutex(false, "AM::SystemUpdaterMutex"); } -Module::Module(Kernel::KernelSystem& kernel) : kernel(kernel) { } +Module::Module(Kernel::KernelSystem& kernel) : kernel(kernel) {} Module::~Module() = default; diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 771bbfb53..22481179e 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h @@ -10,15 +10,15 @@ #include #include #include -#include #include +#include #include "common/common_types.h" #include "core/file_sys/cia_container.h" #include "core/file_sys/file_backend.h" +#include "core/global.h" #include "core/hle/kernel/mutex.h" #include "core/hle/result.h" #include "core/hle/service/service.h" -#include "core/global.h" namespace Core { class System; @@ -585,11 +585,10 @@ private: std::shared_ptr system_updater_mutex; template - void serialize(Archive& ar, const unsigned int) - { - ar & cia_installing; - ar & am_title_list; - ar & system_updater_mutex; + void serialize(Archive& ar, const unsigned int) { + ar& cia_installing; + ar& am_title_list; + ar& system_updater_mutex; } friend class boost::serialization::access; }; @@ -599,9 +598,8 @@ void InstallInterfaces(Core::System& system); } // namespace Service::AM namespace boost::serialization { - template - inline void load_construct_data(Archive& ar, Service::AM::Module* t, const unsigned int) - { - ::new(t)Service::AM::Module(Core::Global()); - } +template +inline void load_construct_data(Archive& ar, Service::AM::Module* t, const unsigned int) { + ::new (t) Service::AM::Module(Core::Global()); } +} // namespace boost::serialization diff --git a/src/core/hle/service/am/am_app.cpp b/src/core/hle/service/am/am_app.cpp index 52d256ca2..788ee090c 100644 --- a/src/core/hle/service/am/am_app.cpp +++ b/src/core/hle/service/am/am_app.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/am/am_app.h" #include "common/archives.h" +#include "core/hle/service/am/am_app.h" namespace Service::AM { diff --git a/src/core/hle/service/am/am_app.h b/src/core/hle/service/am/am_app.h index fae22d96f..b8e858cb4 100644 --- a/src/core/hle/service/am/am_app.h +++ b/src/core/hle/service/am/am_app.h @@ -11,6 +11,7 @@ namespace Service::AM { class AM_APP final : public Module::Interface { public: explicit AM_APP(std::shared_ptr am); + private: SERVICE_SERIALIZATION(AM_APP, am, Module) }; diff --git a/src/core/hle/service/am/am_net.cpp b/src/core/hle/service/am/am_net.cpp index 44c852c19..cd88965af 100644 --- a/src/core/hle/service/am/am_net.cpp +++ b/src/core/hle/service/am/am_net.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/am/am_net.h" #include "common/archives.h" +#include "core/hle/service/am/am_net.h" namespace Service::AM { diff --git a/src/core/hle/service/am/am_net.h b/src/core/hle/service/am/am_net.h index 4a50c6c07..b73610df9 100644 --- a/src/core/hle/service/am/am_net.h +++ b/src/core/hle/service/am/am_net.h @@ -11,6 +11,7 @@ namespace Service::AM { class AM_NET final : public Module::Interface { public: explicit AM_NET(std::shared_ptr am); + private: SERVICE_SERIALIZATION(AM_NET, am, Module) }; diff --git a/src/core/hle/service/am/am_sys.cpp b/src/core/hle/service/am/am_sys.cpp index c6817fe87..6c7e99235 100644 --- a/src/core/hle/service/am/am_sys.cpp +++ b/src/core/hle/service/am/am_sys.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/am/am_sys.h" #include "common/archives.h" +#include "core/hle/service/am/am_sys.h" namespace Service::AM { diff --git a/src/core/hle/service/am/am_sys.h b/src/core/hle/service/am/am_sys.h index c67052302..fdee63b13 100644 --- a/src/core/hle/service/am/am_sys.h +++ b/src/core/hle/service/am/am_sys.h @@ -11,6 +11,7 @@ namespace Service::AM { class AM_SYS final : public Module::Interface { public: explicit AM_SYS(std::shared_ptr am); + private: SERVICE_SERIALIZATION(AM_SYS, am, Module) }; diff --git a/src/core/hle/service/am/am_u.cpp b/src/core/hle/service/am/am_u.cpp index c9b80bf06..cffb88388 100644 --- a/src/core/hle/service/am/am_u.cpp +++ b/src/core/hle/service/am/am_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/am/am_u.h" #include "common/archives.h" +#include "core/hle/service/am/am_u.h" namespace Service::AM { diff --git a/src/core/hle/service/am/am_u.h b/src/core/hle/service/am/am_u.h index c09e27c09..d71bf722c 100644 --- a/src/core/hle/service/am/am_u.h +++ b/src/core/hle/service/am/am_u.h @@ -11,6 +11,7 @@ namespace Service::AM { class AM_U final : public Module::Interface { public: explicit AM_U(std::shared_ptr am); + private: SERVICE_SERIALIZATION(AM_U, am, Module) }; diff --git a/src/core/hle/service/apt/applet_manager.h b/src/core/hle/service/apt/applet_manager.h index 9410b6b54..e799c92d2 100644 --- a/src/core/hle/service/apt/applet_manager.h +++ b/src/core/hle/service/apt/applet_manager.h @@ -10,10 +10,10 @@ #include #include #include "common/serialization/optional.h" +#include "core/global.h" #include "core/hle/kernel/event.h" #include "core/hle/result.h" #include "core/hle/service/fs/archive.h" -#include "core/global.h" namespace Core { class System; @@ -90,13 +90,12 @@ struct MessageParameter { private: template - void serialize(Archive& ar, const unsigned int) - { - ar & sender_id; - ar & destination_id; - ar & signal; - ar & object; - ar & buffer; + void serialize(Archive& ar, const unsigned int) { + ar& sender_id; + ar& destination_id; + ar& signal; + ar& object; + ar& buffer; } friend class boost::serialization::access; }; @@ -179,12 +178,11 @@ public: private: template - void serialize(Archive& ar, const unsigned int) - { - ar & next_title_id; - ar & next_media_type; - ar & current_title_id; - ar & current_media_type; + void serialize(Archive& ar, const unsigned int) { + ar& next_title_id; + ar& next_media_type; + ar& current_title_id; + ar& current_media_type; } friend class boost::serialization::access; }; @@ -228,16 +226,15 @@ private: private: template - void serialize(Archive& ar, const unsigned int) - { - ar & applet_id; - ar & slot; - ar & title_id; - ar & registered; - ar & loaded; - ar & attributes.raw; - ar & notification_event; - ar & parameter_event; + void serialize(Archive& ar, const unsigned int) { + ar& applet_id; + ar& slot; + ar& title_id; + ar& registered; + ar& loaded; + ar& attributes.raw; + ar& notification_event; + ar& parameter_event; } friend class boost::serialization::access; }; @@ -260,12 +257,11 @@ private: private: template - void serialize(Archive& ar, const unsigned int) - { - ar & next_parameter; - ar & app_jump_parameters; - ar & applet_slots; - ar & library_applet_closing_command; + void serialize(Archive& ar, const unsigned int) { + ar& next_parameter; + ar& app_jump_parameters; + ar& applet_slots; + ar& library_applet_closing_command; } friend class boost::serialization::access; }; @@ -273,9 +269,8 @@ private: } // namespace Service::APT namespace boost::serialization { - template - inline void load_construct_data(Archive& ar, Service::APT::AppletManager* t, const unsigned int) - { - ::new(t)Service::APT::AppletManager(Core::Global()); - } +template +inline void load_construct_data(Archive& ar, Service::APT::AppletManager* t, const unsigned int) { + ::new (t) Service::APT::AppletManager(Core::Global()); } +} // namespace boost::serialization diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index d5a7fb001..8780f67e0 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp @@ -2,10 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/archives.h" #include "common/common_paths.h" #include "common/file_util.h" #include "common/logging/log.h" -#include "common/archives.h" #include "core/core.h" #include "core/file_sys/archive_ncch.h" #include "core/file_sys/file_backend.h" @@ -32,17 +32,16 @@ SERVICE_CONSTRUCT_IMPL(Service::APT::Module) namespace Service::APT { template -void Module::serialize(Archive& ar, const unsigned int) -{ - ar & shared_font_mem; - ar & shared_font_loaded; - ar & shared_font_relocated; - ar & lock; - ar & cpu_percent; - ar & unknown_ns_state_field; - ar & screen_capture_buffer; - ar & screen_capture_post_permission; - ar & applet_manager; +void Module::serialize(Archive& ar, const unsigned int) { + ar& shared_font_mem; + ar& shared_font_loaded; + ar& shared_font_relocated; + ar& lock; + ar& cpu_percent; + ar& unknown_ns_state_field; + ar& screen_capture_buffer; + ar& screen_capture_post_permission; + ar& applet_manager; } SERIALIZE_IMPL(Module) diff --git a/src/core/hle/service/apt/apt.h b/src/core/hle/service/apt/apt.h index 14c07feb3..aa480331c 100644 --- a/src/core/hle/service/apt/apt.h +++ b/src/core/hle/service/apt/apt.h @@ -12,10 +12,9 @@ #include "common/common_funcs.h" #include "common/common_types.h" #include "common/swap.h" -#include "core/hle/kernel/kernel.h" -#include "core/hle/service/apt/applet_manager.h" -#include "core/hle/service/service.h" #include "core/global.h" +#include "core/hle/kernel/kernel.h" +#include "core/hle/service/service.h" namespace Core { class System; @@ -612,9 +611,8 @@ public: private: template - void serialize(Archive& ar, const unsigned int) - { - ar & application_reset_prepared; + void serialize(Archive& ar, const unsigned int) { + ar& application_reset_prepared; } friend class boost::serialization::access; }; @@ -654,6 +652,6 @@ void InstallInterfaces(Core::System& system); } // namespace Service::APT namespace boost::serialization { - template - void load_construct_data(Archive& ar, Service::APT::Module* t, const unsigned int); +template +void load_construct_data(Archive& ar, Service::APT::Module* t, const unsigned int); } diff --git a/src/core/hle/service/apt/apt_a.cpp b/src/core/hle/service/apt/apt_a.cpp index db49c57d8..0d6e64d30 100644 --- a/src/core/hle/service/apt/apt_a.cpp +++ b/src/core/hle/service/apt/apt_a.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/apt/apt_a.h" #include "common/archives.h" +#include "core/hle/service/apt/apt_a.h" namespace Service::APT { diff --git a/src/core/hle/service/apt/apt_a.h b/src/core/hle/service/apt/apt_a.h index 1b81022df..e17e2f323 100644 --- a/src/core/hle/service/apt/apt_a.h +++ b/src/core/hle/service/apt/apt_a.h @@ -11,6 +11,7 @@ namespace Service::APT { class APT_A final : public Module::APTInterface { public: explicit APT_A(std::shared_ptr apt); + private: SERVICE_SERIALIZATION(APT_A, apt, Module) }; diff --git a/src/core/hle/service/apt/apt_s.cpp b/src/core/hle/service/apt/apt_s.cpp index 4d151fb3d..d0e5f5526 100644 --- a/src/core/hle/service/apt/apt_s.cpp +++ b/src/core/hle/service/apt/apt_s.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/apt/apt_s.h" #include "common/archives.h" +#include "core/hle/service/apt/apt_s.h" namespace Service::APT { diff --git a/src/core/hle/service/apt/apt_s.h b/src/core/hle/service/apt/apt_s.h index ef1c235b0..d1dd27ff1 100644 --- a/src/core/hle/service/apt/apt_s.h +++ b/src/core/hle/service/apt/apt_s.h @@ -18,6 +18,7 @@ namespace Service::APT { class APT_S final : public Module::APTInterface { public: explicit APT_S(std::shared_ptr apt); + private: SERVICE_SERIALIZATION(APT_S, apt, Module) }; diff --git a/src/core/hle/service/apt/apt_u.cpp b/src/core/hle/service/apt/apt_u.cpp index 7ebaf86e3..05f531a83 100644 --- a/src/core/hle/service/apt/apt_u.cpp +++ b/src/core/hle/service/apt/apt_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/apt/apt_u.h" #include "common/archives.h" +#include "core/hle/service/apt/apt_u.h" namespace Service::APT { diff --git a/src/core/hle/service/apt/apt_u.h b/src/core/hle/service/apt/apt_u.h index 79d2df651..b8a8fe205 100644 --- a/src/core/hle/service/apt/apt_u.h +++ b/src/core/hle/service/apt/apt_u.h @@ -18,6 +18,7 @@ namespace Service::APT { class APT_U final : public Module::APTInterface { public: explicit APT_U(std::shared_ptr apt); + private: SERVICE_SERIALIZATION(APT_U, apt, Module) }; diff --git a/src/core/hle/service/apt/ns_s.cpp b/src/core/hle/service/apt/ns_s.cpp index b556845d3..1f86b9a61 100644 --- a/src/core/hle/service/apt/ns_s.cpp +++ b/src/core/hle/service/apt/ns_s.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/apt/ns_s.h" #include "common/archives.h" +#include "core/hle/service/apt/ns_s.h" namespace Service::NS { diff --git a/src/core/hle/service/apt/ns_s.h b/src/core/hle/service/apt/ns_s.h index 8f023e204..eaa0ad9d3 100644 --- a/src/core/hle/service/apt/ns_s.h +++ b/src/core/hle/service/apt/ns_s.h @@ -14,6 +14,7 @@ namespace Service::NS { class NS_S final : public Service::APT::Module::NSInterface { public: explicit NS_S(std::shared_ptr apt); + private: SERVICE_SERIALIZATION(NS_S, apt, Service::APT::Module) }; diff --git a/src/core/hle/service/boss/boss.h b/src/core/hle/service/boss/boss.h index 7017ce2b6..4dae148f9 100644 --- a/src/core/hle/service/boss/boss.h +++ b/src/core/hle/service/boss/boss.h @@ -6,9 +6,9 @@ #include #include +#include "core/global.h" #include "core/hle/kernel/event.h" #include "core/hle/service/service.h" -#include "core/global.h" namespace Core { class System; @@ -964,12 +964,11 @@ public: u8 output_flag; template - void serialize(Archive& ar, const unsigned int) - { - ar & new_arrival_flag; - ar & ns_data_new_flag; - ar & ns_data_new_flag_privileged; - ar & output_flag; + void serialize(Archive& ar, const unsigned int) { + ar& new_arrival_flag; + ar& ns_data_new_flag; + ar& ns_data_new_flag_privileged; + ar& output_flag; } friend class boost::serialization::access; }; @@ -978,9 +977,8 @@ private: std::shared_ptr task_finish_event; template - void serialize(Archive& ar, const unsigned int) - { - ar & task_finish_event; + void serialize(Archive& ar, const unsigned int) { + ar& task_finish_event; } friend class boost::serialization::access; }; @@ -990,9 +988,8 @@ void InstallInterfaces(Core::System& system); } // namespace Service::BOSS namespace boost::serialization { - template - inline void load_construct_data(Archive& ar, Service::BOSS::Module* t, const unsigned int) - { - ::new(t)Service::BOSS::Module(Core::Global()); - } +template +inline void load_construct_data(Archive& ar, Service::BOSS::Module* t, const unsigned int) { + ::new (t) Service::BOSS::Module(Core::Global()); } +} // namespace boost::serialization diff --git a/src/core/hle/service/boss/boss_p.cpp b/src/core/hle/service/boss/boss_p.cpp index 4e48fe8f3..802f2643a 100644 --- a/src/core/hle/service/boss/boss_p.cpp +++ b/src/core/hle/service/boss/boss_p.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/boss/boss_p.h" #include "common/archives.h" +#include "core/hle/service/boss/boss_p.h" namespace Service::BOSS { diff --git a/src/core/hle/service/boss/boss_u.cpp b/src/core/hle/service/boss/boss_u.cpp index f839e9292..68a30510d 100644 --- a/src/core/hle/service/boss/boss_u.cpp +++ b/src/core/hle/service/boss/boss_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/boss/boss_u.h" #include "common/archives.h" +#include "core/hle/service/boss/boss_u.h" namespace Service::BOSS { diff --git a/src/core/hle/service/cam/cam.cpp b/src/core/hle/service/cam/cam.cpp index b7acd307c..6f9a81e75 100644 --- a/src/core/hle/service/cam/cam.cpp +++ b/src/core/hle/service/cam/cam.cpp @@ -24,11 +24,10 @@ namespace Service::CAM { template -void Module::serialize(Archive& ar, const unsigned int) -{ - ar & cameras; - ar & ports; - ar & is_camera_reload_pending; +void Module::serialize(Archive& ar, const unsigned int) { + ar& cameras; + ar& ports; + ar& is_camera_reload_pending; } SERIALIZE_IMPL(Module) diff --git a/src/core/hle/service/cam/cam.h b/src/core/hle/service/cam/cam.h index 229c882b5..876e2e185 100644 --- a/src/core/hle/service/cam/cam.h +++ b/src/core/hle/service/cam/cam.h @@ -10,9 +10,9 @@ #include #include "common/common_types.h" #include "common/swap.h" +#include "core/global.h" #include "core/hle/result.h" #include "core/hle/service/service.h" -#include "core/global.h" namespace Core { class System; @@ -183,14 +183,13 @@ struct Resolution { private: template - void serialize(Archive& ar, const unsigned int) - { - ar & width; - ar & height; - ar & crop_x0; - ar & crop_y0; - ar & crop_x1; - ar & crop_y1; + void serialize(Archive& ar, const unsigned int) { + ar& width; + ar& height; + ar& crop_x0; + ar& crop_y0; + ar& crop_x1; + ar& crop_y1; } friend class boost::serialization::access; }; @@ -755,12 +754,11 @@ private: private: template - void serialize(Archive& ar, const unsigned int) - { - ar & flip; - ar & effect; - ar & format; - ar & resolution; + void serialize(Archive& ar, const unsigned int) { + ar& flip; + ar& effect; + ar& format; + ar& resolution; } friend class boost::serialization::access; }; @@ -773,12 +771,11 @@ private: private: template - void serialize(Archive& ar, const unsigned int) - { - ar & impl; - ar & contexts; - ar & current_context; - ar & frame_rate; + void serialize(Archive& ar, const unsigned int) { + ar& impl; + ar& contexts; + ar& current_context; + ar& frame_rate; } friend class boost::serialization::access; }; @@ -818,27 +815,26 @@ private: private: template - void serialize(Archive& ar, const unsigned int) - { - ar & camera_id; - ar & is_active; - ar & is_pending_receiving; - ar & is_busy; - ar & is_receiving; - ar & is_trimming; - ar & x0; - ar & y0; - ar & x1; - ar & y1; - ar & transfer_bytes; - ar & completion_event; - ar & buffer_error_interrupt_event; - ar & vsync_interrupt_event; + void serialize(Archive& ar, const unsigned int) { + ar& camera_id; + ar& is_active; + ar& is_pending_receiving; + ar& is_busy; + ar& is_receiving; + ar& is_trimming; + ar& x0; + ar& y0; + ar& x1; + ar& y1; + ar& transfer_bytes; + ar& completion_event; + ar& buffer_error_interrupt_event; + ar& vsync_interrupt_event; // TODO: Check if this is ever needed: - //ar & capture_result; - ar & dest_process; - ar & dest; - ar & dest_size; + // ar & capture_result; + ar& dest_process; + ar& dest; + ar& dest_size; } friend class boost::serialization::access; }; @@ -864,9 +860,8 @@ void InstallInterfaces(Core::System& system); } // namespace Service::CAM namespace boost::serialization { - template - inline void load_construct_data(Archive& ar, Service::CAM::Module* t, const unsigned int) - { - ::new(t)Service::CAM::Module(Core::Global()); - } +template +inline void load_construct_data(Archive& ar, Service::CAM::Module* t, const unsigned int) { + ::new (t) Service::CAM::Module(Core::Global()); } +} // namespace boost::serialization diff --git a/src/core/hle/service/cam/cam_c.cpp b/src/core/hle/service/cam/cam_c.cpp index a29e9db3e..e86d33115 100644 --- a/src/core/hle/service/cam/cam_c.cpp +++ b/src/core/hle/service/cam/cam_c.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/archives.h" #include "core/hle/service/cam/cam.h" #include "core/hle/service/cam/cam_c.h" -#include "common/archives.h" namespace Service::CAM { diff --git a/src/core/hle/service/cam/cam_q.cpp b/src/core/hle/service/cam/cam_q.cpp index ac477bf04..6f0c04598 100644 --- a/src/core/hle/service/cam/cam_q.cpp +++ b/src/core/hle/service/cam/cam_q.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/cam/cam_q.h" #include "common/archives.h" +#include "core/hle/service/cam/cam_q.h" namespace Service::CAM { diff --git a/src/core/hle/service/cam/cam_q.h b/src/core/hle/service/cam/cam_q.h index 33943ca21..ab901cf85 100644 --- a/src/core/hle/service/cam/cam_q.h +++ b/src/core/hle/service/cam/cam_q.h @@ -11,11 +11,11 @@ namespace Service::CAM { class CAM_Q : public ServiceFramework { public: CAM_Q(); + private: template - void serialize(Archive& ar, const unsigned int) - { - ar & boost::serialization::base_object(*this); + void serialize(Archive& ar, const unsigned int) { + ar& boost::serialization::base_object(*this); } friend class boost::serialization::access; }; diff --git a/src/core/hle/service/cam/cam_s.cpp b/src/core/hle/service/cam/cam_s.cpp index 0797ed4e1..8cfd3c1d7 100644 --- a/src/core/hle/service/cam/cam_s.cpp +++ b/src/core/hle/service/cam/cam_s.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/archives.h" #include "core/hle/service/cam/cam.h" #include "core/hle/service/cam/cam_s.h" -#include "common/archives.h" namespace Service::CAM { diff --git a/src/core/hle/service/cam/cam_u.cpp b/src/core/hle/service/cam/cam_u.cpp index 16c652a26..72a62c04e 100644 --- a/src/core/hle/service/cam/cam_u.cpp +++ b/src/core/hle/service/cam/cam_u.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/archives.h" #include "core/hle/service/cam/cam.h" #include "core/hle/service/cam/cam_u.h" -#include "common/archives.h" namespace Service::CAM { diff --git a/src/core/hle/service/csnd/csnd_snd.h b/src/core/hle/service/csnd/csnd_snd.h index 44e4c030c..6ac5d6876 100644 --- a/src/core/hle/service/csnd/csnd_snd.h +++ b/src/core/hle/service/csnd/csnd_snd.h @@ -38,10 +38,9 @@ struct AdpcmState { private: template - void serialize(Archive& ar, const unsigned int) - { - ar & predictor; - ar & step_index; + void serialize(Archive& ar, const unsigned int) { + ar& predictor; + ar& step_index; } friend class boost::serialization::access; }; @@ -66,24 +65,23 @@ struct Channel { private: template - void serialize(Archive& ar, const unsigned int) - { - ar & block1_address; - ar & block2_address; - ar & block1_size; - ar & block2_size; - ar & block1_adpcm_state; - ar & block2_adpcm_state; - ar & block2_adpcm_reload; - ar & left_channel_volume; - ar & right_channel_volume; - ar & left_capture_volume; - ar & right_capture_volume; - ar & sample_rate; - ar & linear_interpolation; - ar & loop_mode; - ar & encoding; - ar & psg_duty; + void serialize(Archive& ar, const unsigned int) { + ar& block1_address; + ar& block2_address; + ar& block1_size; + ar& block2_size; + ar& block1_adpcm_state; + ar& block2_adpcm_state; + ar& block2_adpcm_reload; + ar& left_channel_volume; + ar& right_channel_volume; + ar& left_capture_volume; + ar& right_capture_volume; + ar& sample_rate; + ar& linear_interpolation; + ar& loop_mode; + ar& encoding; + ar& psg_duty; } friend class boost::serialization::access; }; @@ -258,18 +256,17 @@ private: u32 acquired_channel_mask = 0; template - void serialize(Archive& ar, const unsigned int) - { - ar & boost::serialization::base_object(*this); - ar & mutex; - ar & shared_memory; - ar & capture_units; - ar & channels; - ar & master_state_offset; - ar & channel_state_offset; - ar & capture_state_offset; - ar & type1_command_offset; - ar & acquired_channel_mask; + void serialize(Archive& ar, const unsigned int) { + ar& boost::serialization::base_object(*this); + ar& mutex; + ar& shared_memory; + ar& capture_units; + ar& channels; + ar& master_state_offset; + ar& channel_state_offset; + ar& capture_state_offset; + ar& type1_command_offset; + ar& acquired_channel_mask; } friend class boost::serialization::access; }; @@ -282,6 +279,6 @@ void InstallInterfaces(Core::System& system); BOOST_CLASS_EXPORT_KEY(Service::CSND::CSND_SND) namespace boost::serialization { - template - void load_construct_data(Archive& ar, Service::CSND::CSND_SND* t, const unsigned int); +template +void load_construct_data(Archive& ar, Service::CSND::CSND_SND* t, const unsigned int); } diff --git a/src/core/hle/service/dlp/dlp_clnt.cpp b/src/core/hle/service/dlp/dlp_clnt.cpp index df5b755e1..f8b315c00 100644 --- a/src/core/hle/service/dlp/dlp_clnt.cpp +++ b/src/core/hle/service/dlp/dlp_clnt.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/archives.h" #include "core/hle/ipc_helpers.h" #include "core/hle/service/dlp/dlp_clnt.h" -#include "common/archives.h" SERIALIZE_EXPORT_IMPL(Service::DLP::DLP_CLNT) diff --git a/src/core/hle/service/dlp/dlp_clnt.h b/src/core/hle/service/dlp/dlp_clnt.h index 3f9020863..835d01748 100644 --- a/src/core/hle/service/dlp/dlp_clnt.h +++ b/src/core/hle/service/dlp/dlp_clnt.h @@ -12,11 +12,11 @@ class DLP_CLNT final : public ServiceFramework { public: DLP_CLNT(); ~DLP_CLNT() = default; + private: template - void serialize(Archive& ar, const unsigned int) - { - ar & boost::serialization::base_object(*this); + void serialize(Archive& ar, const unsigned int) { + ar& boost::serialization::base_object(*this); } friend class boost::serialization::access; }; diff --git a/src/core/hle/service/dlp/dlp_fkcl.cpp b/src/core/hle/service/dlp/dlp_fkcl.cpp index 607c211d4..948b25b67 100644 --- a/src/core/hle/service/dlp/dlp_fkcl.cpp +++ b/src/core/hle/service/dlp/dlp_fkcl.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/archives.h" #include "core/hle/ipc_helpers.h" #include "core/hle/service/dlp/dlp_fkcl.h" -#include "common/archives.h" SERIALIZE_EXPORT_IMPL(Service::DLP::DLP_FKCL) diff --git a/src/core/hle/service/dlp/dlp_fkcl.h b/src/core/hle/service/dlp/dlp_fkcl.h index ae26b6220..d778ace8b 100644 --- a/src/core/hle/service/dlp/dlp_fkcl.h +++ b/src/core/hle/service/dlp/dlp_fkcl.h @@ -12,11 +12,11 @@ class DLP_FKCL final : public ServiceFramework { public: DLP_FKCL(); ~DLP_FKCL() = default; + private: template - void serialize(Archive& ar, const unsigned int) - { - ar & boost::serialization::base_object(*this); + void serialize(Archive& ar, const unsigned int) { + ar& boost::serialization::base_object(*this); } friend class boost::serialization::access; }; diff --git a/src/core/hle/service/dlp/dlp_srvr.cpp b/src/core/hle/service/dlp/dlp_srvr.cpp index 0cff2e2bc..87733b71f 100644 --- a/src/core/hle/service/dlp/dlp_srvr.cpp +++ b/src/core/hle/service/dlp/dlp_srvr.cpp @@ -2,12 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/archives.h" #include "common/common_types.h" #include "common/logging/log.h" #include "core/hle/ipc_helpers.h" #include "core/hle/result.h" #include "core/hle/service/dlp/dlp_srvr.h" -#include "common/archives.h" SERIALIZE_EXPORT_IMPL(Service::DLP::DLP_SRVR) diff --git a/src/core/hle/service/dlp/dlp_srvr.h b/src/core/hle/service/dlp/dlp_srvr.h index 6af350c8e..1f171f950 100644 --- a/src/core/hle/service/dlp/dlp_srvr.h +++ b/src/core/hle/service/dlp/dlp_srvr.h @@ -17,9 +17,8 @@ private: void IsChild(Kernel::HLERequestContext& ctx); template - void serialize(Archive& ar, const unsigned int) - { - ar & boost::serialization::base_object(*this); + void serialize(Archive& ar, const unsigned int) { + ar& boost::serialization::base_object(*this); } friend class boost::serialization::access; }; diff --git a/src/core/hle/service/dsp/dsp_dsp.h b/src/core/hle/service/dsp/dsp_dsp.h index b4c727091..90dd17f65 100644 --- a/src/core/hle/service/dsp/dsp_dsp.h +++ b/src/core/hle/service/dsp/dsp_dsp.h @@ -266,14 +266,13 @@ private: std::array, AudioCore::num_dsp_pipe> pipes = {{}}; template - void serialize(Archive& ar, const unsigned int) - { - ar & boost::serialization::base_object(*this); - ar & semaphore_event; - ar & preset_semaphore; - ar & interrupt_zero; - ar & interrupt_one; - ar & pipes; + void serialize(Archive& ar, const unsigned int) { + ar& boost::serialization::base_object(*this); + ar& semaphore_event; + ar& preset_semaphore; + ar& interrupt_zero; + ar& interrupt_one; + ar& pipes; } friend class boost::serialization::access; }; @@ -285,6 +284,6 @@ void InstallInterfaces(Core::System& system); BOOST_CLASS_EXPORT_KEY(Service::DSP::DSP_DSP) namespace boost::serialization { - template - void load_construct_data(Archive& ar, Service::DSP::DSP_DSP* t, const unsigned int); +template +void load_construct_data(Archive& ar, Service::DSP::DSP_DSP* t, const unsigned int); } diff --git a/src/core/hle/service/err_f.cpp b/src/core/hle/service/err_f.cpp index 0efc600e8..f88ffef19 100644 --- a/src/core/hle/service/err_f.cpp +++ b/src/core/hle/service/err_f.cpp @@ -20,16 +20,15 @@ SERIALIZE_EXPORT_IMPL(Service::ERR::ERR_F) namespace boost::serialization { - template - void load_construct_data(Archive& ar, Service::ERR::ERR_F* t, const unsigned int) - { - ::new(t)Service::ERR::ERR_F(Core::Global()); - } - - template - void load_construct_data(iarchive& ar, Service::ERR::ERR_F* t, const unsigned int); +template +void load_construct_data(Archive& ar, Service::ERR::ERR_F* t, const unsigned int) { + ::new (t) Service::ERR::ERR_F(Core::Global()); } +template void load_construct_data(iarchive& ar, Service::ERR::ERR_F* t, + const unsigned int); +} // namespace boost::serialization + namespace Service::ERR { enum class FatalErrType : u32 { diff --git a/src/core/hle/service/err_f.h b/src/core/hle/service/err_f.h index a3d0cf11e..de92fed05 100644 --- a/src/core/hle/service/err_f.h +++ b/src/core/hle/service/err_f.h @@ -36,9 +36,8 @@ private: Core::System& system; template - void serialize(Archive& ar, const unsigned int) - { - ar & boost::serialization::base_object(*this); + void serialize(Archive& ar, const unsigned int) { + ar& boost::serialization::base_object(*this); } friend class boost::serialization::access; }; @@ -50,6 +49,6 @@ void InstallInterfaces(Core::System& system); BOOST_CLASS_EXPORT_KEY(Service::ERR::ERR_F) namespace boost::serialization { - template - void load_construct_data(Archive& ar, Service::ERR::ERR_F* t, const unsigned int); +template +void load_construct_data(Archive& ar, Service::ERR::ERR_F* t, const unsigned int); } diff --git a/src/core/hle/service/frd/frd.h b/src/core/hle/service/frd/frd.h index 46dc96cad..1f34e61fa 100644 --- a/src/core/hle/service/frd/frd.h +++ b/src/core/hle/service/frd/frd.h @@ -21,11 +21,10 @@ struct FriendKey { private: template - void serialize(Archive& ar, const unsigned int) - { - ar & friend_id; - ar & unknown; - ar & friend_code; + void serialize(Archive& ar, const unsigned int) { + ar& friend_id; + ar& unknown; + ar& friend_code; } friend class boost::serialization::access; }; @@ -35,9 +34,8 @@ struct MyPresence { private: template - void serialize(Archive& ar, const unsigned int) - { - ar & unknown; + void serialize(Archive& ar, const unsigned int) { + ar& unknown; } friend class boost::serialization::access; }; @@ -157,10 +155,9 @@ private: MyPresence my_presence = {}; template - void serialize(Archive& ar, const unsigned int) - { - ar & my_friend_key; - ar & my_presence; + void serialize(Archive& ar, const unsigned int) { + ar& my_friend_key; + ar& my_presence; } friend class boost::serialization::access; }; diff --git a/src/core/hle/service/frd/frd_a.cpp b/src/core/hle/service/frd/frd_a.cpp index 6248891af..23a83a55e 100644 --- a/src/core/hle/service/frd/frd_a.cpp +++ b/src/core/hle/service/frd/frd_a.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/frd/frd_a.h" #include "common/archives.h" +#include "core/hle/service/frd/frd_a.h" SERIALIZE_EXPORT_IMPL(Service::FRD::FRD_A) diff --git a/src/core/hle/service/frd/frd_a.h b/src/core/hle/service/frd/frd_a.h index 133d40dc1..0bdd87525 100644 --- a/src/core/hle/service/frd/frd_a.h +++ b/src/core/hle/service/frd/frd_a.h @@ -11,6 +11,7 @@ namespace Service::FRD { class FRD_A final : public Module::Interface { public: explicit FRD_A(std::shared_ptr frd); + private: SERVICE_SERIALIZATION(FRD_A, frd, Module) }; diff --git a/src/core/hle/service/frd/frd_u.cpp b/src/core/hle/service/frd/frd_u.cpp index ba499dd2b..d83c8ac8c 100644 --- a/src/core/hle/service/frd/frd_u.cpp +++ b/src/core/hle/service/frd/frd_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/frd/frd_u.h" #include "common/archives.h" +#include "core/hle/service/frd/frd_u.h" SERIALIZE_EXPORT_IMPL(Service::FRD::FRD_U) diff --git a/src/core/hle/service/frd/frd_u.h b/src/core/hle/service/frd/frd_u.h index 281334f51..e6adc37fb 100644 --- a/src/core/hle/service/frd/frd_u.h +++ b/src/core/hle/service/frd/frd_u.h @@ -11,6 +11,7 @@ namespace Service::FRD { class FRD_U final : public Module::Interface { public: explicit FRD_U(std::shared_ptr frd); + private: SERVICE_SERIALIZATION(FRD_U, frd, Module) }; diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 90dfad62f..767faf167 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -13,6 +13,7 @@ #include "common/common_types.h" #include "common/file_util.h" #include "common/logging/log.h" +#include "core/core.h" #include "core/file_sys/archive_backend.h" #include "core/file_sys/archive_extsavedata.h" #include "core/file_sys/archive_ncch.h" @@ -27,7 +28,6 @@ #include "core/file_sys/file_backend.h" #include "core/hle/result.h" #include "core/hle/service/fs/archive.h" -#include "core/core.h" namespace Service::FS { diff --git a/src/core/hle/service/fs/fs_user.h b/src/core/hle/service/fs/fs_user.h index c001be0c5..29b47a99c 100644 --- a/src/core/hle/service/fs/fs_user.h +++ b/src/core/hle/service/fs/fs_user.h @@ -25,9 +25,8 @@ struct ClientSlot : public Kernel::SessionRequestHandler::SessionDataBase { private: template - void serialize(Archive& ar, const unsigned int) - { - ar & program_id; + void serialize(Archive& ar, const unsigned int) { + ar& program_id; } friend class boost::serialization::access; }; @@ -555,10 +554,9 @@ private: ArchiveManager& archives; template - void serialize(Archive& ar, const unsigned int) - { - ar & boost::serialization::base_object(*this); - ar & priority; + void serialize(Archive& ar, const unsigned int) { + ar& boost::serialization::base_object(*this); + ar& priority; } friend class boost::serialization::access; }; diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index b16a4065f..d39e72aca 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -11,8 +11,8 @@ #include #include #include -#include #include +#include #include "common/common_types.h" #include "common/construct.h" #include "core/hle/kernel/hle_ipc.h" @@ -199,42 +199,37 @@ extern const std::array service_module_map; } // namespace Service -#define SERVICE_SERIALIZATION(T, MFIELD, TMODULE) \ - template \ - void save_construct(Archive& ar, const unsigned int file_version) const \ - { \ - ar << MFIELD; \ - } \ - \ - template \ - static void load_construct(Archive& ar, T* t, const unsigned int file_version) \ - { \ - std::shared_ptr MFIELD; \ - ar >> MFIELD; \ - ::new(t)T(MFIELD); \ - } \ - \ - template \ - void serialize(Archive& ar, const unsigned int) \ - { \ - ar & boost::serialization::base_object(*this); \ - } \ - friend class boost::serialization::access; \ +#define SERVICE_SERIALIZATION(T, MFIELD, TMODULE) \ + template \ + void save_construct(Archive& ar, const unsigned int file_version) const { \ + ar << MFIELD; \ + } \ + \ + template \ + static void load_construct(Archive& ar, T* t, const unsigned int file_version) { \ + std::shared_ptr MFIELD; \ + ar >> MFIELD; \ + ::new (t) T(MFIELD); \ + } \ + \ + template \ + void serialize(Archive& ar, const unsigned int) { \ + ar& boost::serialization::base_object(*this); \ + } \ + friend class boost::serialization::access; \ friend class ::construct_access; -#define SERVICE_CONSTRUCT(T) \ -namespace boost::serialization { \ - template \ - void load_construct_data(Archive& ar, T* t, const unsigned int); \ -} +#define SERVICE_CONSTRUCT(T) \ + namespace boost::serialization { \ + template \ + void load_construct_data(Archive& ar, T* t, const unsigned int); \ + } -#define SERVICE_CONSTRUCT_IMPL(T) \ -namespace boost::serialization { \ - template \ - void load_construct_data(Archive& ar, T* t, const unsigned int) \ - { \ - ::new(t)T(Core::Global()); \ - } \ - template \ - void load_construct_data(iarchive& ar, T* t, const unsigned int); \ -} +#define SERVICE_CONSTRUCT_IMPL(T) \ + namespace boost::serialization { \ + template \ + void load_construct_data(Archive& ar, T* t, const unsigned int) { \ + ::new (t) T(Core::Global()); \ + } \ + template void load_construct_data(iarchive & ar, T* t, const unsigned int); \ + } diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h index d91732da9..659e14afb 100644 --- a/src/core/hle/service/sm/sm.h +++ b/src/core/hle/service/sm/sm.h @@ -9,9 +9,9 @@ #include #include #include +#include #include #include -#include #include "core/hle/kernel/client_port.h" #include "core/hle/kernel/object.h" #include "core/hle/kernel/server_port.h" @@ -86,14 +86,12 @@ private: std::unordered_map registered_services_inverse; template - void save(Archive& ar, const unsigned int file_version) const - { + void save(Archive& ar, const unsigned int file_version) const { ar << registered_services; } template - void load(Archive& ar, const unsigned int file_version) - { + void load(Archive& ar, const unsigned int file_version) { ar >> registered_services; registered_services_inverse.clear(); for (const auto& pair : registered_services) { diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 7264e1ec4..6a41ca957 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -4,9 +4,9 @@ #include #include +#include "audio_core/dsp_interface.h" #include "boost/serialization/array.hpp" #include "boost/serialization/binary_object.hpp" -#include "audio_core/dsp_interface.h" #include "common/archives.h" #include "common/assert.h" #include "common/common_types.h" @@ -58,12 +58,11 @@ private: static_assert(sizeof(bool) == 1); friend class boost::serialization::access; - template - void serialize(Archive & ar, const unsigned int file_version) - { - ar & vram; - ar & linear_heap; - ar & new_linear_heap; + template + void serialize(Archive& ar, const unsigned int file_version) { + ar& vram; + ar& linear_heap; + ar& new_linear_heap; } }; @@ -82,19 +81,18 @@ public: AudioCore::DspInterface* dsp = nullptr; private: - friend class boost::serialization::access; - template - void serialize(Archive & ar, const unsigned int file_version) - { + template + void serialize(Archive& ar, const unsigned int file_version) { // TODO: Skip n3ds ram when not used? auto s_fcram = boost::serialization::binary_object(fcram.get(), Memory::FCRAM_N3DS_SIZE); auto s_vram = boost::serialization::binary_object(vram.get(), Memory::VRAM_SIZE); - auto s_extra = boost::serialization::binary_object(n3ds_extra_ram.get(), Memory::N3DS_EXTRA_RAM_SIZE); - ar & s_fcram; - ar & s_vram; - ar & s_extra; - ar & cache_marker; + auto s_extra = + boost::serialization::binary_object(n3ds_extra_ram.get(), Memory::N3DS_EXTRA_RAM_SIZE); + ar& s_fcram; + ar& s_vram; + ar& s_extra; + ar& cache_marker; // TODO: How the hell to do page tables.. // ar & page_table_list; // ar & current_page_table; @@ -104,10 +102,9 @@ private: MemorySystem::MemorySystem() : impl(std::make_unique()) {} MemorySystem::~MemorySystem() = default; -template -void MemorySystem::serialize(Archive & ar, const unsigned int file_version) -{ - ar & *impl.get(); +template +void MemorySystem::serialize(Archive& ar, const unsigned int file_version) { + ar&* impl.get(); } SERIALIZE_IMPL(MemorySystem) diff --git a/src/core/memory.h b/src/core/memory.h index 9c1455a80..aac57af26 100644 --- a/src/core/memory.h +++ b/src/core/memory.h @@ -54,12 +54,11 @@ struct SpecialRegion { u32 size; MMIORegionPointer handler; - template - void serialize(Archive & ar, const unsigned int file_version) - { - ar & base; - ar & size; - ar & handler; + template + void serialize(Archive& ar, const unsigned int file_version) { + ar& base; + ar& size; + ar& handler; } }; @@ -326,8 +325,8 @@ private: std::unique_ptr impl; friend class boost::serialization::access; - template - void serialize(Archive & ar, const unsigned int file_version); + template + void serialize(Archive& ar, const unsigned int file_version); }; /// Determines if the given VAddr is valid for the specified process. diff --git a/src/core/mmio.h b/src/core/mmio.h index 0a8249c9a..2e6323b49 100644 --- a/src/core/mmio.h +++ b/src/core/mmio.h @@ -36,9 +36,7 @@ public: private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - } + void serialize(Archive& ar, const unsigned int file_version) {} }; using MMIORegionPointer = std::shared_ptr; diff --git a/src/tests/core/hle/kernel/hle_ipc.cpp b/src/tests/core/hle/kernel/hle_ipc.cpp index e405f6729..62cad0e35 100644 --- a/src/tests/core/hle/kernel/hle_ipc.cpp +++ b/src/tests/core/hle/kernel/hle_ipc.cpp @@ -26,7 +26,8 @@ static std::shared_ptr MakeObject(Kernel::KernelSystem& kernel) { TEST_CASE("HLERequestContext::PopulateFromIncomingCommandBuffer", "[core][kernel]") { Core::Timing timing; Memory::MemorySystem memory; - Kernel::KernelSystem kernel(memory, timing, [] {}, 0); + Kernel::KernelSystem kernel( + memory, timing, [] {}, 0); auto [server, client] = kernel.CreateSessionPair(); HLERequestContext context(kernel, std::move(server), nullptr); @@ -238,7 +239,8 @@ TEST_CASE("HLERequestContext::PopulateFromIncomingCommandBuffer", "[core][kernel TEST_CASE("HLERequestContext::WriteToOutgoingCommandBuffer", "[core][kernel]") { Core::Timing timing; Memory::MemorySystem memory; - Kernel::KernelSystem kernel(memory, timing, [] {}, 0); + Kernel::KernelSystem kernel( + memory, timing, [] {}, 0); auto [server, client] = kernel.CreateSessionPair(); HLERequestContext context(kernel, std::move(server), nullptr); diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index 3a5b35236..1c633cf5c 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp @@ -645,8 +645,7 @@ void ProcessCommandList(PAddr list, u32 size) { u32* buffer = (u32*)VideoCore::g_memory->GetPhysicalPointer(list); if (Pica::g_debug_context && Pica::g_debug_context->recorder) { - Pica::g_debug_context->recorder->MemoryAccessed((u8*)buffer, size, - list); + Pica::g_debug_context->recorder->MemoryAccessed((u8*)buffer, size, list); } g_state.cmd_list.addr = list; diff --git a/src/video_core/geometry_pipeline.cpp b/src/video_core/geometry_pipeline.cpp index 44a2fd6da..159f1df0b 100644 --- a/src/video_core/geometry_pipeline.cpp +++ b/src/video_core/geometry_pipeline.cpp @@ -37,9 +37,7 @@ public: private: template - void serialize(Archive& ar, const unsigned int file_version) - { - } + void serialize(Archive& ar, const unsigned int file_version) {} friend class boost::serialization::access; }; @@ -92,16 +90,14 @@ private: unsigned int vs_output_num; template - static void serialize_common(Class* self, Archive& ar, const unsigned int version) - { - ar & boost::serialization::base_object(*self); + static void serialize_common(Class* self, Archive& ar, const unsigned int version) { + ar& boost::serialization::base_object(*self); ar & self->attribute_buffer; ar & self->vs_output_num; } - template - void save(Archive & ar, const unsigned int version) const - { + template + void save(Archive& ar, const unsigned int version) const { serialize_common(this, ar, version); auto buffer_idx = static_cast(buffer_cur - attribute_buffer.attr); auto buffer_size = static_cast(buffer_end - attribute_buffer.attr); @@ -109,9 +105,8 @@ private: ar << buffer_size; } - template - void load(Archive & ar, const unsigned int version) - { + template + void load(Archive& ar, const unsigned int version) { serialize_common(this, ar, version); u32 buffer_idx, buffer_size; ar >> buffer_idx; @@ -130,8 +125,7 @@ private: // value in the batch. This mode is usually used for subdivision. class GeometryPipeline_VariablePrimitive : public GeometryPipelineBackend { public: - GeometryPipeline_VariablePrimitive() - : regs(g_state.regs), setup(g_state.gs) { + GeometryPipeline_VariablePrimitive() : regs(g_state.regs), setup(g_state.gs) { ASSERT(regs.pipeline.variable_primitive == 1); ASSERT(regs.gs.input_to_uniform == 1); vs_output_num = regs.pipeline.vs_outmap_total_minus_1_a + 1; @@ -190,26 +184,23 @@ private: unsigned int vs_output_num; template - static void serialize_common(Class* self, Archive& ar, const unsigned int version) - { - ar & boost::serialization::base_object(*self); + static void serialize_common(Class* self, Archive& ar, const unsigned int version) { + ar& boost::serialization::base_object(*self); ar & self->need_index; ar & self->main_vertex_num; ar & self->total_vertex_num; ar & self->vs_output_num; } - template - void save(Archive & ar, const unsigned int version) const - { + template + void save(Archive& ar, const unsigned int version) const { serialize_common(this, ar, version); auto buffer_idx = static_cast(buffer_cur - setup.uniforms.f); ar << buffer_idx; } - template - void load(Archive & ar, const unsigned int version) - { + template + void load(Archive& ar, const unsigned int version) { serialize_common(this, ar, version); u32 buffer_idx; ar >> buffer_idx; @@ -226,8 +217,7 @@ private: // particle system. class GeometryPipeline_FixedPrimitive : public GeometryPipelineBackend { public: - GeometryPipeline_FixedPrimitive() - : regs(g_state.regs), setup(g_state.gs) { + GeometryPipeline_FixedPrimitive() : regs(g_state.regs), setup(g_state.gs) { ASSERT(regs.pipeline.variable_primitive == 0); ASSERT(regs.gs.input_to_uniform == 1); vs_output_num = regs.pipeline.vs_outmap_total_minus_1_a + 1; @@ -267,15 +257,13 @@ private: unsigned int vs_output_num; template - static void serialize_common(Class* self, Archive& ar, const unsigned int version) - { - ar & boost::serialization::base_object(*self); + static void serialize_common(Class* self, Archive& ar, const unsigned int version) { + ar& boost::serialization::base_object(*self); ar & self->vs_output_num; } - template - void save(Archive & ar, const unsigned int version) const - { + template + void save(Archive& ar, const unsigned int version) const { serialize_common(this, ar, version); auto buffer_offset = static_cast(buffer_begin - setup.uniforms.f); auto buffer_idx = static_cast(buffer_cur - setup.uniforms.f); @@ -285,9 +273,8 @@ private: ar << buffer_size; } - template - void load(Archive & ar, const unsigned int version) - { + template + void load(Archive& ar, const unsigned int version) { serialize_common(this, ar, version); u32 buffer_offset, buffer_idx, buffer_size; ar >> buffer_offset; @@ -385,7 +372,7 @@ void GeometryPipeline::SubmitVertex(const Shader::AttributeBuffer& input) { template void GeometryPipeline::serialize(Archive& ar, const unsigned int version) { // vertex_handler and shader_engine are always set to the same value - ar & backend; + ar& backend; } } // namespace Pica diff --git a/src/video_core/pica.cpp b/src/video_core/pica.cpp index 0b5aaa682..5e0c2d480 100644 --- a/src/video_core/pica.cpp +++ b/src/video_core/pica.cpp @@ -3,17 +3,19 @@ // Refer to the license.txt file included. #include +#include "core/global.h" #include "video_core/geometry_pipeline.h" #include "video_core/pica.h" #include "video_core/pica_state.h" #include "video_core/renderer_base.h" #include "video_core/video_core.h" -#include "core/global.h" namespace Core { - template <> - Pica::State& Global() { return Pica::g_state; } +template <> +Pica::State& Global() { + return Pica::g_state; } +} // namespace Core namespace Pica { diff --git a/src/video_core/pica_state.h b/src/video_core/pica_state.h index 30cef3496..4e5a5f16b 100644 --- a/src/video_core/pica_state.h +++ b/src/video_core/pica_state.h @@ -9,23 +9,21 @@ #include "common/bit_field.h" #include "common/common_types.h" #include "common/vector_math.h" -#include "video_core/video_core.h" #include "video_core/geometry_pipeline.h" #include "video_core/primitive_assembly.h" #include "video_core/regs.h" #include "video_core/shader/shader.h" +#include "video_core/video_core.h" // Boost::serialization doesn't like union types for some reason, // so we need to mark arrays of union values with a special serialization method -template -struct UnionArray : public std::array -{ +template +struct UnionArray : public std::array { private: - template - void serialize(Archive& ar, const unsigned int) - { + template + void serialize(Archive& ar, const unsigned int) { static_assert(sizeof(Value) == sizeof(u32)); - ar & *static_cast(static_cast(this->data())); + ar&* static_cast(static_cast(this->data())); } friend class boost::serialization::access; }; @@ -99,14 +97,13 @@ struct State { private: friend class boost::serialization::access; - template - void serialize(Archive & ar, const unsigned int file_version) - { - ar & noise_table; - ar & color_map_table; - ar & alpha_map_table; - ar & color_table; - ar & color_diff_table; + template + void serialize(Archive& ar, const unsigned int file_version) { + ar& noise_table; + ar& color_map_table; + ar& alpha_map_table; + ar& color_table; + ar& color_diff_table; } } proctex; @@ -131,10 +128,9 @@ struct State { return neg_difference ? -diff : diff; } - template - void serialize(Archive & ar, const unsigned int file_version) - { - ar & raw; + template + void serialize(Archive& ar, const unsigned int file_version) { + ar& raw; } }; @@ -180,12 +176,11 @@ struct State { private: friend class boost::serialization::access; - template - void serialize(Archive & ar, const unsigned int file_version) - { - ar & input_vertex; - ar & current_attribute; - ar & reset_geometry_pipeline; + template + void serialize(Archive& ar, const unsigned int file_version) { + ar& input_vertex; + ar& current_attribute; + ar& reset_geometry_pipeline; } } immediate; @@ -210,42 +205,38 @@ struct State { u32 default_attr_write_buffer[3]{}; private: - friend class boost::serialization::access; - template - void serialize(Archive & ar, const unsigned int file_version) - { - ar & regs.reg_array; - ar & vs; - ar & gs; - ar & input_default_attributes; - ar & proctex; - ar & lighting.luts; - ar & fog.lut; - ar & cmd_list.addr; - ar & cmd_list.length; - ar & immediate; - ar & gs_unit; - ar & geometry_pipeline; - ar & primitive_assembler; - ar & vs_float_regs_counter; - ar & vs_uniform_write_buffer; - ar & gs_float_regs_counter; - ar & gs_uniform_write_buffer; - ar & default_attr_counter; - ar & default_attr_write_buffer; + template + void serialize(Archive& ar, const unsigned int file_version) { + ar& regs.reg_array; + ar& vs; + ar& gs; + ar& input_default_attributes; + ar& proctex; + ar& lighting.luts; + ar& fog.lut; + ar& cmd_list.addr; + ar& cmd_list.length; + ar& immediate; + ar& gs_unit; + ar& geometry_pipeline; + ar& primitive_assembler; + ar& vs_float_regs_counter; + ar& vs_uniform_write_buffer; + ar& gs_float_regs_counter; + ar& gs_uniform_write_buffer; + ar& default_attr_counter; + ar& default_attr_write_buffer; boost::serialization::split_member(ar, *this, file_version); } - template - void save(Archive & ar, const unsigned int file_version) const - { + template + void save(Archive& ar, const unsigned int file_version) const { ar << static_cast(cmd_list.current_ptr - cmd_list.head_ptr); } - template - void load(Archive & ar, const unsigned int file_version) - { + template + void load(Archive& ar, const unsigned int file_version) { u32 offset{}; ar >> offset; cmd_list.head_ptr = (u32*)VideoCore::g_memory->GetPhysicalPointer(cmd_list.addr); diff --git a/src/video_core/pica_types.h b/src/video_core/pica_types.h index bef256e13..33012c259 100644 --- a/src/video_core/pica_types.h +++ b/src/video_core/pica_types.h @@ -143,10 +143,9 @@ private: float value; friend class boost::serialization::access; - template - void serialize(Archive & ar, const unsigned int file_version) - { - ar & value; + template + void serialize(Archive& ar, const unsigned int file_version) { + ar& value; } }; diff --git a/src/video_core/primitive_assembly.h b/src/video_core/primitive_assembly.h index 1545a6b4c..d6547dddd 100644 --- a/src/video_core/primitive_assembly.h +++ b/src/video_core/primitive_assembly.h @@ -6,7 +6,9 @@ #include #include "video_core/regs_pipeline.h" -namespace boost::serialization { class access; } +namespace boost::serialization { +class access; +} namespace Pica { @@ -65,13 +67,12 @@ private: bool winding = false; template - void serialize(Archive& ar, const unsigned int version) - { - ar & topology; - ar & buffer_index; - ar & buffer; - ar & strip_ready; - ar & winding; + void serialize(Archive& ar, const unsigned int version) { + ar& topology; + ar& buffer_index; + ar& buffer; + ar& strip_ready; + ar& winding; } friend class boost::serialization::access; }; diff --git a/src/video_core/shader/shader.h b/src/video_core/shader/shader.h index f20e08d98..a6e42b3bf 100644 --- a/src/video_core/shader/shader.h +++ b/src/video_core/shader/shader.h @@ -8,15 +8,15 @@ #include #include #include -#include #include #include +#include #include "common/assert.h" #include "common/common_funcs.h" #include "common/common_types.h" #include "common/hash.h" -#include "common/vector_math.h" #include "common/pod.h" +#include "common/vector_math.h" #include "video_core/pica_types.h" #include "video_core/regs_rasterizer.h" #include "video_core/regs_shader.h" @@ -38,9 +38,8 @@ struct AttributeBuffer { private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & attr; + void serialize(Archive& ar, const unsigned int file_version) { + ar& attr; } }; @@ -107,13 +106,12 @@ struct GSEmitter { private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & buffer; - ar & vertex_id; - ar & prim_emit; - ar & winding; - ar & output_mask; + void serialize(Archive& ar, const unsigned int file_version) { + ar& buffer; + ar& vertex_id; + ar& prim_emit; + ar& winding; + ar& output_mask; // Handlers are ignored because they're constant } }; @@ -137,11 +135,10 @@ struct UnitState { private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & input; - ar & temporary; - ar & output; + void serialize(Archive& ar, const unsigned int file_version) { + ar& input; + ar& temporary; + ar& output; } } registers; static_assert(std::is_pod::value, "Structure is not POD"); @@ -199,11 +196,10 @@ struct UnitState { private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & registers; - ar & conditional_code; - ar & address_registers; + void serialize(Archive& ar, const unsigned int file_version) { + ar& registers; + ar& conditional_code; + ar& address_registers; // emitter_ptr is only set by GSUnitState and is serialized there } }; @@ -223,10 +219,9 @@ struct GSUnitState : public UnitState { private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int file_version) - { - ar & boost::serialization::base_object(*this); - ar & emitter; + void serialize(Archive& ar, const unsigned int file_version) { + ar& boost::serialization::base_object(*this); + ar& emitter; } }; @@ -252,12 +247,11 @@ struct Uniforms { private: friend class boost::serialization::access; - template - void serialize(Archive & ar, const unsigned int file_version) - { - ar & f; - ar & b; - ar & i; + template + void serialize(Archive& ar, const unsigned int file_version) { + ar& f; + ar& b; + ar& i; } }; @@ -305,16 +299,15 @@ private: u64 swizzle_data_hash = 0xDEADC0DE; friend class boost::serialization::access; - template - void serialize(Archive & ar, const unsigned int file_version) - { - ar & uniforms; - ar & program_code; - ar & swizzle_data; - ar & program_code_hash_dirty; - ar & swizzle_data_hash_dirty; - ar & program_code_hash; - ar & swizzle_data_hash; + template + void serialize(Archive& ar, const unsigned int file_version) { + ar& uniforms; + ar& program_code; + ar& swizzle_data; + ar& program_code_hash_dirty; + ar& swizzle_data_hash_dirty; + ar& program_code_hash; + ar& swizzle_data_hash; } }; diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index 5bc1e8702..a89b41e96 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp @@ -87,18 +87,15 @@ u16 GetResolutionScaleFactor() { } } -void Save(std::ostream &stream) -{ +void Save(std::ostream& stream) { oarchive oa{stream}; - oa & Pica::g_state; + oa& Pica::g_state; } -void Load(std::istream &stream) -{ +void Load(std::istream& stream) { iarchive ia{stream}; - ia & Pica::g_state; + ia& Pica::g_state; // TODO: Flush/reset things - } } // namespace VideoCore diff --git a/src/video_core/video_core.h b/src/video_core/video_core.h index 1ec69f802..10b0d39b6 100644 --- a/src/video_core/video_core.h +++ b/src/video_core/video_core.h @@ -4,8 +4,8 @@ #pragma once -#include #include +#include #include #include "core/frontend/emu_window.h" @@ -62,7 +62,7 @@ void RequestScreenshot(void* data, std::function callback, u16 GetResolutionScaleFactor(); -void Save(std::ostream &stream); -void Load(std::istream &stream); +void Save(std::ostream& stream); +void Load(std::istream& stream); } // namespace VideoCore