From 6760ea18b6a63ae9e0afecffcecd081890991b88 Mon Sep 17 00:00:00 2001 From: Hamish Milne Date: Sun, 29 Mar 2020 18:56:25 +0100 Subject: [PATCH] Serialize ArchiveManager and other code review actions --- src/core/core.cpp | 2 ++ src/core/file_sys/archive_backend.h | 22 ++++++++++------------ src/core/file_sys/archive_extsavedata.cpp | 9 +++++++++ src/core/file_sys/archive_other_savedata.h | 1 + src/core/file_sys/archive_savedata.h | 1 + src/core/file_sys/archive_selfncch.h | 3 ++- src/core/file_sys/file_backend.h | 1 - src/core/file_sys/layered_fs.h | 9 +-------- src/core/file_sys/savedata_archive.h | 5 +++-- src/core/hle/kernel/hle_ipc.h | 3 --- src/core/hle/kernel/process.cpp | 2 +- src/core/hle/kernel/process.h | 1 + src/core/hle/service/ac/ac.h | 2 -- src/core/hle/service/act/act.h | 2 +- src/core/hle/service/am/am.h | 21 ++++++++++++++------- src/core/hle/service/apt/applet_manager.h | 1 + src/core/hle/service/apt/apt.cpp | 2 ++ src/core/hle/service/apt/apt.h | 7 +------ src/core/hle/service/boss/boss.h | 2 +- src/core/hle/service/cam/cam.h | 7 ++++++- src/core/hle/service/cecd/cecd.cpp | 2 ++ src/core/hle/service/cecd/cecd.h | 2 +- src/core/hle/service/cfg/cfg.cpp | 2 ++ src/core/hle/service/csnd/csnd_snd.h | 6 +----- src/core/hle/service/dsp/dsp_dsp.h | 9 ++++----- src/core/hle/service/fs/archive.h | 6 ++++-- src/core/hle/service/fs/directory.cpp | 2 ++ src/core/hle/service/fs/file.cpp | 1 + src/core/hle/service/fs/file.h | 1 + src/core/hle/service/fs/fs_user.h | 1 + src/core/hle/service/gsp/gsp_gpu.h | 2 ++ src/core/hle/service/hid/hid.cpp | 7 +++++-- src/core/hle/service/ir/extra_hid.h | 1 - src/core/hle/service/ir/ir_rst.cpp | 2 ++ src/core/hle/service/ir/ir_user.cpp | 1 + src/core/hle/service/ndm/ndm_u.h | 1 + src/core/hle/service/nfc/nfc.cpp | 2 ++ src/core/hle/service/nfc/nfc.h | 8 ++++++++ src/core/hle/service/nwm/nwm_uds.cpp | 2 +- src/core/hle/service/service.h | 1 - src/core/hle/service/sm/srv.cpp | 3 ++- src/network/CMakeLists.txt | 2 +- src/network/room_member.h | 2 +- 43 files changed, 102 insertions(+), 67 deletions(-) diff --git a/src/core/core.cpp b/src/core/core.cpp index 589744367..2928d50e7 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -1,3 +1,4 @@ +#pragma optimize("", off) // Copyright 2014 Citra Emulator Project // Licensed under GPLv2 or any later version // Refer to the license.txt file included. @@ -544,6 +545,7 @@ void System::serialize(Archive& ar, const unsigned int file_version) { ar&* cpu_cores[i].get(); } ar&* service_manager.get(); + ar&* archive_manager.get(); ar& GPU::g_regs; ar& LCD::g_regs; diff --git a/src/core/file_sys/archive_backend.h b/src/core/file_sys/archive_backend.h index 87a42b028..0c5b14dc5 100644 --- a/src/core/file_sys/archive_backend.h +++ b/src/core/file_sys/archive_backend.h @@ -65,7 +65,7 @@ private: LowPathType type; std::vector binary; std::string string; - std::u16string u16str{}; + std::u16string u16str; template void serialize(Archive& ar, const unsigned int) { @@ -77,18 +77,16 @@ private: case LowPathType::Char: ar& string; break; -#ifdef _WIN32 - case LowPathType::Wchar: - static_assert(sizeof(wchar_t) == sizeof(char16_t)); - { - std::wstring wstring(reinterpret_cast(u16str.data())); - ar& wstring; - if (!Archive::is_saving::value) { - u16str = std::u16string(reinterpret_cast(wstring.data())); - } + case LowPathType::Wchar: { + std::vector data; + if (Archive::is_saving::value) { + std::copy(u16str.begin(), u16str.end(), std::back_inserter(data)); } - break; -#endif + ar& data; + if (Archive::is_loading::value) { + u16str = std::u16string(data.data(), data.size()); + } + } break; default: break; } diff --git a/src/core/file_sys/archive_extsavedata.cpp b/src/core/file_sys/archive_extsavedata.cpp index 59973b8c5..8326122f5 100644 --- a/src/core/file_sys/archive_extsavedata.cpp +++ b/src/core/file_sys/archive_extsavedata.cpp @@ -167,6 +167,14 @@ public: } return SaveDataArchive::CreateFile(path, size); } + +private: + ExtSaveDataArchive() = default; + template + void serialize(Archive& ar, const unsigned int) { + ar& boost::serialization::base_object(*this); + } + friend class boost::serialization::access; }; struct ExtSaveDataArchivePath { @@ -304,3 +312,4 @@ void ArchiveFactory_ExtSaveData::WriteIcon(const Path& path, const u8* icon_data } // namespace FileSys SERIALIZE_EXPORT_IMPL(FileSys::ExtSaveDataDelayGenerator) +SERIALIZE_EXPORT_IMPL(FileSys::ExtSaveDataArchive) diff --git a/src/core/file_sys/archive_other_savedata.h b/src/core/file_sys/archive_other_savedata.h index cc0cfe404..f002fec7f 100644 --- a/src/core/file_sys/archive_other_savedata.h +++ b/src/core/file_sys/archive_other_savedata.h @@ -4,6 +4,7 @@ #pragma once +#include #include #include #include "core/file_sys/archive_source_sd_savedata.h" diff --git a/src/core/file_sys/archive_savedata.h b/src/core/file_sys/archive_savedata.h index 3f73adba3..5bc4b8ecd 100644 --- a/src/core/file_sys/archive_savedata.h +++ b/src/core/file_sys/archive_savedata.h @@ -4,6 +4,7 @@ #pragma once +#include #include #include "core/file_sys/archive_source_sd_savedata.h" diff --git a/src/core/file_sys/archive_selfncch.h b/src/core/file_sys/archive_selfncch.h index 68b48074f..9f5b353b3 100644 --- a/src/core/file_sys/archive_selfncch.h +++ b/src/core/file_sys/archive_selfncch.h @@ -10,6 +10,7 @@ #include #include #include +#include #include #include "common/common_types.h" #include "core/file_sys/archive_backend.h" @@ -63,7 +64,7 @@ private: template void serialize(Archive& ar, const unsigned int) { ar& boost::serialization::base_object(*this); - // NOTE: ncch_data is never written to, so we don't serialize it here + ar& ncch_data; } friend class boost::serialization::access; }; diff --git a/src/core/file_sys/file_backend.h b/src/core/file_sys/file_backend.h index 04f03a77d..d56fc4c1c 100644 --- a/src/core/file_sys/file_backend.h +++ b/src/core/file_sys/file_backend.h @@ -7,7 +7,6 @@ #include #include #include -#include #include #include "common/common_types.h" #include "core/hle/result.h" diff --git a/src/core/file_sys/layered_fs.h b/src/core/file_sys/layered_fs.h index dc71d052f..2a494bd8e 100644 --- a/src/core/file_sys/layered_fs.h +++ b/src/core/file_sys/layered_fs.h @@ -23,14 +23,6 @@ struct RomFSHeader { struct Descriptor { u32_le offset; u32_le length; - - private: - template - void serialize(Archive& ar, const unsigned int) { - ar& offset; - ar& length; - } - friend class boost::serialization::access; }; u32_le header_length; Descriptor directory_hash_table; @@ -146,6 +138,7 @@ private: if (Archive::is_loading::value) { Load(); } + // NOTE: Everything else is essentially cached, updated when we call Load } friend class boost::serialization::access; }; diff --git a/src/core/file_sys/savedata_archive.h b/src/core/file_sys/savedata_archive.h index c9956e135..38b9653d7 100644 --- a/src/core/file_sys/savedata_archive.h +++ b/src/core/file_sys/savedata_archive.h @@ -38,10 +38,9 @@ public: protected: std::string mount_point; - -private: SaveDataArchive() = default; +private: template void serialize(Archive& ar, const unsigned int) { ar& boost::serialization::base_object(*this); @@ -51,8 +50,10 @@ private: }; class SaveDataDelayGenerator; +class ExtSaveDataArchive; } // namespace FileSys BOOST_CLASS_EXPORT_KEY(FileSys::SaveDataArchive) BOOST_CLASS_EXPORT_KEY(FileSys::SaveDataDelayGenerator) +BOOST_CLASS_EXPORT_KEY(FileSys::ExtSaveDataArchive) diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index 000486825..47d98af2c 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h @@ -22,8 +22,6 @@ #include "core/hle/kernel/object.h" #include "core/hle/kernel/server_session.h" -BOOST_SERIALIZATION_ASSUME_ABSTRACT(Kernel::SessionRequestHandler) - namespace Service { class ServiceFrameworkBase; } @@ -320,5 +318,4 @@ private: } // namespace Kernel -BOOST_CLASS_EXPORT_KEY(Kernel::SessionRequestHandler::SessionDataBase) BOOST_CLASS_EXPORT_KEY(Kernel::HLERequestContext::ThreadCallback) diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index b72081ad5..9b03f30f9 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp @@ -6,12 +6,12 @@ #include #include #include +#include #include "common/archives.h" #include "common/assert.h" #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" diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h index 6eb79d227..d9af80cd0 100644 --- a/src/core/hle/kernel/process.h +++ b/src/core/hle/kernel/process.h @@ -13,6 +13,7 @@ #include #include #include +#include #include "common/bit_field.h" #include "common/common_types.h" #include "core/hle/kernel/handle_table.h" diff --git a/src/core/hle/service/ac/ac.h b/src/core/hle/service/ac/ac.h index 0f31ca1b4..e4342bde9 100644 --- a/src/core/hle/service/ac/ac.h +++ b/src/core/hle/service/ac/ac.h @@ -16,8 +16,6 @@ namespace Kernel { class Event; } -BOOST_SERIALIZATION_ASSUME_ABSTRACT(Service::AC::Module::Interface) - namespace Service::AC { class Module final { public: diff --git a/src/core/hle/service/act/act.h b/src/core/hle/service/act/act.h index 11812bcfe..e5c2cf7ae 100644 --- a/src/core/hle/service/act/act.h +++ b/src/core/hle/service/act/act.h @@ -26,7 +26,7 @@ public: private: template - inline void serialize(Archive& ar, const unsigned int file_version) {} + void serialize(Archive& ar, const unsigned int file_version) {} friend class boost::serialization::access; }; diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 22481179e..deff326b7 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h @@ -13,6 +13,7 @@ #include #include #include "common/common_types.h" +#include "common/construct.h" #include "core/file_sys/cia_container.h" #include "core/file_sys/file_backend.h" #include "core/global.h" @@ -154,7 +155,6 @@ std::string GetMediaTitlePath(Service::FS::MediaType media_type); class Module final { public: explicit Module(Core::System& system); - explicit Module(Kernel::KernelSystem& kernel); Module() = default; ~Module(); @@ -568,6 +568,8 @@ public: }; private: + explicit Module(Kernel::KernelSystem& kernel); + /** * Scans the for titles in a storage medium for listing. * @param media_type the storage medium to scan @@ -590,6 +592,16 @@ private: ar& am_title_list; ar& system_updater_mutex; } + + template + static void load_construct(Archive& ar, Module* t, const unsigned int file_version) { + ::new (t) Module(Core::Global()); + } + + template + void save_construct(Archive& ar, const unsigned int file_version) const {} + + friend class ::construct_access; friend class boost::serialization::access; }; @@ -597,9 +609,4 @@ 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()); -} -} // namespace boost::serialization +BOOST_SERIALIZATION_CONSTRUCT(Service::AM::Module); diff --git a/src/core/hle/service/apt/applet_manager.h b/src/core/hle/service/apt/applet_manager.h index 7260fb2d3..0f1a46a8b 100644 --- a/src/core/hle/service/apt/applet_manager.h +++ b/src/core/hle/service/apt/applet_manager.h @@ -10,6 +10,7 @@ #include #include #include +#include #include "core/global.h" #include "core/hle/kernel/event.h" #include "core/hle/result.h" diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index 8780f67e0..d93b4bcb2 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include +#include #include "common/archives.h" #include "common/common_paths.h" #include "common/file_util.h" diff --git a/src/core/hle/service/apt/apt.h b/src/core/hle/service/apt/apt.h index aa480331c..8b01d3b8e 100644 --- a/src/core/hle/service/apt/apt.h +++ b/src/core/hle/service/apt/apt.h @@ -6,8 +6,6 @@ #include #include -#include -#include #include "common/archives.h" #include "common/common_funcs.h" #include "common/common_types.h" @@ -651,7 +649,4 @@ 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); -} +SERVICE_CONSTRUCT(Service::APT::Module) diff --git a/src/core/hle/service/boss/boss.h b/src/core/hle/service/boss/boss.h index 4dae148f9..e4000e851 100644 --- a/src/core/hle/service/boss/boss.h +++ b/src/core/hle/service/boss/boss.h @@ -989,7 +989,7 @@ void InstallInterfaces(Core::System& system); namespace boost::serialization { template -inline void load_construct_data(Archive& ar, Service::BOSS::Module* t, const unsigned int) { +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/cam/cam.h b/src/core/hle/service/cam/cam.h index 85501e8de..375df2b20 100644 --- a/src/core/hle/service/cam/cam.h +++ b/src/core/hle/service/cam/cam.h @@ -9,6 +9,10 @@ #include #include #include +#include +#include +#include +#include #include "common/common_types.h" #include "common/swap.h" #include "core/global.h" @@ -849,6 +853,7 @@ private: ar& completion_event; ar& buffer_error_interrupt_event; ar& vsync_interrupt_event; + ar& vsync_timings; // Ignore capture_result. In-progress captures might be affected but this is OK. ar& dest_process; ar& dest; @@ -879,7 +884,7 @@ void InstallInterfaces(Core::System& system); namespace boost::serialization { template -inline void load_construct_data(Archive& ar, Service::CAM::Module* t, const unsigned int) { +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/cecd/cecd.cpp b/src/core/hle/service/cecd/cecd.cpp index 8db49fc82..31ecd990b 100644 --- a/src/core/hle/service/cecd/cecd.cpp +++ b/src/core/hle/service/cecd/cecd.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include +#include #include #include #include diff --git a/src/core/hle/service/cecd/cecd.h b/src/core/hle/service/cecd/cecd.h index b752701fe..0870f31bf 100644 --- a/src/core/hle/service/cecd/cecd.h +++ b/src/core/hle/service/cecd/cecd.h @@ -258,7 +258,7 @@ public: ar& data_path_type; ar& open_mode.raw; ar& path; - // ar& file; + ar& file; } friend class boost::serialization::access; }; diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp index 98feea8f7..fc285f662 100644 --- a/src/core/hle/service/cfg/cfg.cpp +++ b/src/core/hle/service/cfg/cfg.cpp @@ -4,6 +4,8 @@ #include #include +#include +#include #include #include #include "common/archives.h" diff --git a/src/core/hle/service/csnd/csnd_snd.h b/src/core/hle/service/csnd/csnd_snd.h index 6ac5d6876..0b4cd4331 100644 --- a/src/core/hle/service/csnd/csnd_snd.h +++ b/src/core/hle/service/csnd/csnd_snd.h @@ -277,8 +277,4 @@ void InstallInterfaces(Core::System& system); } // namespace Service::CSND 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); -} +SERVICE_CONSTRUCT(Service::CSND::CSND_SND) diff --git a/src/core/hle/service/dsp/dsp_dsp.h b/src/core/hle/service/dsp/dsp_dsp.h index 90dd17f65..d580b3d00 100644 --- a/src/core/hle/service/dsp/dsp_dsp.h +++ b/src/core/hle/service/dsp/dsp_dsp.h @@ -5,6 +5,9 @@ #pragma once #include +#include +#include +#include #include "audio_core/dsp_interface.h" #include "core/hle/kernel/event.h" #include "core/hle/result.h" @@ -282,8 +285,4 @@ void InstallInterfaces(Core::System& system); } // namespace Service::DSP 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); -} +SERVICE_CONSTRUCT(Service::DSP::DSP_DSP) diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h index 29965491b..aba06ac6f 100644 --- a/src/core/hle/service/fs/archive.h +++ b/src/core/hle/service/fs/archive.h @@ -8,7 +8,8 @@ #include #include #include -#include +#include +#include #include "common/common_types.h" #include "core/file_sys/archive_backend.h" #include "core/hle/result.h" @@ -253,7 +254,7 @@ private: * Map of registered archives, identified by id code. Once an archive is registered here, it is * never removed until UnregisterArchiveTypes is called. */ - boost::container::flat_map> id_code_map; + std::unordered_map> id_code_map; /** * Map of active archive handles to archive objects @@ -267,6 +268,7 @@ private: ar& handle_map; ar& next_handle; } + friend class boost::serialization::access; }; } // namespace Service::FS diff --git a/src/core/hle/service/fs/directory.cpp b/src/core/hle/service/fs/directory.cpp index c7fb085ea..655c5602e 100644 --- a/src/core/hle/service/fs/directory.cpp +++ b/src/core/hle/service/fs/directory.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include +#include #include "common/archives.h" #include "common/logging/log.h" #include "core/file_sys/directory_backend.h" diff --git a/src/core/hle/service/fs/file.cpp b/src/core/hle/service/fs/file.cpp index 3664f238d..3d9eee594 100644 --- a/src/core/hle/service/fs/file.cpp +++ b/src/core/hle/service/fs/file.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include #include "common/archives.h" #include "common/logging/log.h" #include "core/core.h" diff --git a/src/core/hle/service/fs/file.h b/src/core/hle/service/fs/file.h index 6aa301a7b..a6ef69304 100644 --- a/src/core/hle/service/fs/file.h +++ b/src/core/hle/service/fs/file.h @@ -5,6 +5,7 @@ #pragma once #include +#include #include "core/file_sys/archive_backend.h" #include "core/global.h" #include "core/hle/service/service.h" diff --git a/src/core/hle/service/fs/fs_user.h b/src/core/hle/service/fs/fs_user.h index 83183ecf6..e972d0dae 100644 --- a/src/core/hle/service/fs/fs_user.h +++ b/src/core/hle/service/fs/fs_user.h @@ -4,6 +4,7 @@ #pragma once +#include #include "common/common_types.h" #include "core/hle/service/service.h" diff --git a/src/core/hle/service/gsp/gsp_gpu.h b/src/core/hle/service/gsp/gsp_gpu.h index 82ecf2480..c8914ef72 100644 --- a/src/core/hle/service/gsp/gsp_gpu.h +++ b/src/core/hle/service/gsp/gsp_gpu.h @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include "common/bit_field.h" #include "common/common_types.h" #include "core/hle/kernel/event.h" diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 6898c1024..845319f62 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -4,6 +4,9 @@ #include #include +#include +#include +#include #include "common/archives.h" #include "common/logging/log.h" #include "core/3ds.h" @@ -208,7 +211,7 @@ void Module::UpdateAccelerometerCallback(u64 userdata, s64 cycles_late) { Common::Vec3 accel; if (!motion_device) { - is_device_reload_pending.exchange(true); + is_device_reload_pending.store(true); return; } std::tie(accel, std::ignore) = motion_device->GetStatus(); @@ -259,7 +262,7 @@ void Module::UpdateGyroscopeCallback(u64 userdata, s64 cycles_late) { Common::Vec3 gyro; if (!motion_device) { - is_device_reload_pending.exchange(true); + is_device_reload_pending.store(true); return; } std::tie(std::ignore, gyro) = motion_device->GetStatus(); diff --git a/src/core/hle/service/ir/extra_hid.h b/src/core/hle/service/ir/extra_hid.h index 1be403167..46c0fdca4 100644 --- a/src/core/hle/service/ir/extra_hid.h +++ b/src/core/hle/service/ir/extra_hid.h @@ -7,7 +7,6 @@ #include #include #include -#include #include "common/bit_field.h" #include "common/swap.h" #include "core/frontend/input.h" diff --git a/src/core/hle/service/ir/ir_rst.cpp b/src/core/hle/service/ir/ir_rst.cpp index 751460a04..bd6c64af3 100644 --- a/src/core/hle/service/ir/ir_rst.cpp +++ b/src/core/hle/service/ir/ir_rst.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include +#include #include "common/archives.h" #include "core/core.h" #include "core/core_timing.h" diff --git a/src/core/hle/service/ir/ir_user.cpp b/src/core/hle/service/ir/ir_user.cpp index 4bf6e7499..0cc77c928 100644 --- a/src/core/hle/service/ir/ir_user.cpp +++ b/src/core/hle/service/ir/ir_user.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include #include "common/string_util.h" diff --git a/src/core/hle/service/ndm/ndm_u.h b/src/core/hle/service/ndm/ndm_u.h index 3339478d1..aebc6fa8b 100644 --- a/src/core/hle/service/ndm/ndm_u.h +++ b/src/core/hle/service/ndm/ndm_u.h @@ -5,6 +5,7 @@ #pragma once #include +#include #include "core/hle/service/service.h" namespace Core { diff --git a/src/core/hle/service/nfc/nfc.cpp b/src/core/hle/service/nfc/nfc.cpp index 0bd6121a2..7213b79a7 100644 --- a/src/core/hle/service/nfc/nfc.cpp +++ b/src/core/hle/service/nfc/nfc.cpp @@ -22,6 +22,8 @@ void Module::serialize(Archive& ar, const unsigned int) { ar& tag_out_of_range_event; ar& nfc_tag_state; ar& nfc_status; + ar& amiibo_data; + ar& amiibo_in_range; } SERIALIZE_IMPL(Module) diff --git a/src/core/hle/service/nfc/nfc.h b/src/core/hle/service/nfc/nfc.h index 2d6b26d83..51fe20b76 100644 --- a/src/core/hle/service/nfc/nfc.h +++ b/src/core/hle/service/nfc/nfc.h @@ -6,6 +6,7 @@ #include #include +#include #include "common/common_types.h" #include "core/hle/service/service.h" @@ -35,6 +36,13 @@ struct AmiiboData { u16_be model_number; u8 series; INSERT_PADDING_BYTES(0x1C1); + +private: + template + void serialize(Archive& ar, const unsigned int) { + ar& boost::serialization::make_binary_object(this, sizeof(AmiiboData)); + } + friend class boost::serialization::access; }; static_assert(sizeof(AmiiboData) == 0x21C, "AmiiboData is an invalid size"); diff --git a/src/core/hle/service/nwm/nwm_uds.cpp b/src/core/hle/service/nwm/nwm_uds.cpp index b2793285f..1a95d2295 100644 --- a/src/core/hle/service/nwm/nwm_uds.cpp +++ b/src/core/hle/service/nwm/nwm_uds.cpp @@ -1175,7 +1175,7 @@ void NWM_UDS::GetChannel(Kernel::HLERequestContext& ctx) { class NWM_UDS::ThreadCallback : public Kernel::HLERequestContext::WakeupCallback { public: - ThreadCallback(u16 command_id_) : command_id(command_id_) {} + explicit ThreadCallback(u16 command_id_) : command_id(command_id_) {} void WakeUp(std::shared_ptr thread, Kernel::HLERequestContext& ctx, Kernel::ThreadWakeupReason reason) { diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 0261d061f..83b0a5fb1 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include "common/common_types.h" diff --git a/src/core/hle/service/sm/srv.cpp b/src/core/hle/service/sm/srv.cpp index f9c62e9ad..da6d57df7 100644 --- a/src/core/hle/service/sm/srv.cpp +++ b/src/core/hle/service/sm/srv.cpp @@ -88,7 +88,8 @@ void SRV::EnableNotification(Kernel::HLERequestContext& ctx) { class SRV::ThreadCallback : public Kernel::HLERequestContext::WakeupCallback { public: - ThreadCallback(Core::System& system_, std::string name_) : system(system_), name(name_) {} + explicit ThreadCallback(Core::System& system_, std::string name_) + : system(system_), name(name_) {} void WakeUp(std::shared_ptr thread, Kernel::HLERequestContext& ctx, Kernel::ThreadWakeupReason reason) { diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt index 382a69e2f..1e0eb4bc9 100644 --- a/src/network/CMakeLists.txt +++ b/src/network/CMakeLists.txt @@ -13,4 +13,4 @@ add_library(network STATIC create_target_directory_groups(network) -target_link_libraries(network PRIVATE common enet Boost::boost) +target_link_libraries(network PRIVATE common enet Boost::serialization) diff --git a/src/network/room_member.h b/src/network/room_member.h index d582a8552..ee1c921d4 100644 --- a/src/network/room_member.h +++ b/src/network/room_member.h @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include "common/common_types.h" #include "network/room.h"