code: Nuke savestate support

This commit is contained in:
GPUCode 2024-03-24 11:54:55 +02:00
parent a442389a60
commit 8d0db9f2ab
348 changed files with 123 additions and 7083 deletions

View file

@ -404,7 +404,6 @@ add_subdirectory(externals)
if (NOT USE_SYSTEM_BOOST) if (NOT USE_SYSTEM_BOOST)
add_definitions( -DBOOST_ALL_NO_LIB ) add_definitions( -DBOOST_ALL_NO_LIB )
add_library(Boost::boost ALIAS boost) add_library(Boost::boost ALIAS boost)
add_library(Boost::serialization ALIAS boost_serialization)
add_library(Boost::iostreams ALIAS boost_iostreams) add_library(Boost::iostreams ALIAS boost_iostreams)
endif() endif()

View file

@ -20,11 +20,6 @@ if (NOT USE_SYSTEM_BOOST)
add_library(boost INTERFACE) add_library(boost INTERFACE)
target_include_directories(boost SYSTEM INTERFACE ${Boost_INCLUDE_DIR}) target_include_directories(boost SYSTEM INTERFACE ${Boost_INCLUDE_DIR})
# Boost::serialization
file(GLOB boost_serialization_SRC "${CMAKE_SOURCE_DIR}/externals/boost/libs/serialization/src/*.cpp")
add_library(boost_serialization STATIC ${boost_serialization_SRC})
target_link_libraries(boost_serialization PUBLIC boost)
# Boost::iostreams # Boost::iostreams
add_library( add_library(
boost_iostreams boost_iostreams

View file

@ -37,7 +37,6 @@
#include "core/hle/service/am/am.h" #include "core/hle/service/am/am.h"
#include "core/hle/service/nfc/nfc.h" #include "core/hle/service/nfc/nfc.h"
#include "core/loader/loader.h" #include "core/loader/loader.h"
#include "core/savestate.h"
#include "core/telemetry_session.h" #include "core/telemetry_session.h"
#include "jni/android_common/android_common.h" #include "jni/android_common/android_common.h"
#include "jni/applets/mii_selector.h" #include "jni/applets/mii_selector.h"
@ -430,7 +429,8 @@ jobject Java_org_citra_citra_1emu_NativeLibrary_downloadTitleFromNus([[maybe_unu
[[maybe_unused]] jobject obj, [[maybe_unused]] jobject obj,
jlong title) { jlong title) {
const auto title_id = static_cast<u64>(title); const auto title_id = static_cast<u64>(title);
Service::AM::InstallStatus status = Service::AM::InstallFromNus(title_id); auto& system = Core::System::GetInstance();
Service::AM::InstallStatus status = Service::AM::InstallFromNus(system, title_id);
if (status != Service::AM::InstallStatus::Success) { if (status != Service::AM::InstallStatus::Success) {
return IDCache::GetJavaCiaInstallStatus(status); return IDCache::GetJavaCiaInstallStatus(status);
} }
@ -690,12 +690,7 @@ JNIEXPORT jobject JNICALL Java_org_citra_citra_1emu_utils_CiaInstallWorker_insta
jobjectArray Java_org_citra_citra_1emu_NativeLibrary_getSavestateInfo( jobjectArray Java_org_citra_citra_1emu_NativeLibrary_getSavestateInfo(
JNIEnv* env, [[maybe_unused]] jobject obj) { JNIEnv* env, [[maybe_unused]] jobject obj) {
const jclass date_class = env->FindClass("java/util/Date");
const auto date_constructor = env->GetMethodID(date_class, "<init>", "(J)V");
const jclass savestate_info_class = IDCache::GetSavestateInfoClass(); const jclass savestate_info_class = IDCache::GetSavestateInfoClass();
const auto slot_field = env->GetFieldID(savestate_info_class, "slot", "I");
const auto date_field = env->GetFieldID(savestate_info_class, "time", "Ljava/util/Date;");
const Core::System& system{Core::System::GetInstance()}; const Core::System& system{Core::System::GetInstance()};
if (!system.IsPoweredOn()) { if (!system.IsPoweredOn()) {
@ -707,18 +702,7 @@ jobjectArray Java_org_citra_citra_1emu_NativeLibrary_getSavestateInfo(
return nullptr; return nullptr;
} }
const auto savestates = Core::ListSaveStates(title_id, system.Movie().GetCurrentMovieID()); const jobjectArray array = env->NewObjectArray(jsize(0), savestate_info_class, nullptr);
const jobjectArray array =
env->NewObjectArray(static_cast<jsize>(savestates.size()), savestate_info_class, nullptr);
for (std::size_t i = 0; i < savestates.size(); ++i) {
const jobject object = env->AllocObject(savestate_info_class);
env->SetIntField(object, slot_field, static_cast<jint>(savestates[i].slot));
env->SetObjectField(object, date_field,
env->NewObject(date_class, date_constructor,
static_cast<jlong>(savestates[i].time * 1000)));
env->SetObjectArrayElement(array, i, object);
}
return array; return array;
} }

View file

@ -4,9 +4,9 @@
#pragma once #pragma once
#include <functional>
#include <memory> #include <memory>
#include <span> #include <span>
#include <boost/serialization/access.hpp>
#include "audio_core/audio_types.h" #include "audio_core/audio_types.h"
#include "audio_core/time_stretch.h" #include "audio_core/time_stretch.h"
#include "common/common_types.h" #include "common/common_types.h"
@ -123,10 +123,6 @@ private:
std::array<s16, 2> last_frame{}; std::array<s16, 2> last_frame{};
TimeStretcher time_stretcher; TimeStretcher time_stretcher;
std::unique_ptr<Sink> sink; std::unique_ptr<Sink> sink;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {}
friend class boost::serialization::access;
}; };
} // namespace AudioCore } // namespace AudioCore

View file

@ -2,11 +2,6 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <boost/serialization/array.hpp>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/vector.hpp>
#include <boost/serialization/weak_ptr.hpp>
#include "audio_core/audio_types.h" #include "audio_core/audio_types.h"
#include "audio_core/hle/aac_decoder.h" #include "audio_core/hle/aac_decoder.h"
#include "audio_core/hle/common.h" #include "audio_core/hle/common.h"
@ -16,7 +11,6 @@
#include "audio_core/hle/shared_memory.h" #include "audio_core/hle/shared_memory.h"
#include "audio_core/hle/source.h" #include "audio_core/hle/source.h"
#include "audio_core/sink.h" #include "audio_core/sink.h"
#include "common/archives.h"
#include "common/assert.h" #include "common/assert.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/hash.h" #include "common/hash.h"
@ -30,13 +24,6 @@ namespace AudioCore {
DspHle::DspHle(Core::System& system) : DspHle(system, system.Memory(), system.CoreTiming()) {} DspHle::DspHle(Core::System& system) : DspHle(system, system.Memory(), system.CoreTiming()) {}
template <class Archive>
void DspHle::serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<DspInterface>(*this);
ar&* impl.get();
}
SERIALIZE_IMPL(DspHle)
// The value below is the "perfect" mathematical ratio of ARM11 cycles per audio frame, samples per // The value below is the "perfect" mathematical ratio of ARM11 cycles per audio frame, samples per
// frame * teaklite cycles per sample * 2 ARM11 cycles/teaklite cycle // frame * teaklite cycles per sample * 2 ARM11 cycles/teaklite cycle
// (160 * 4096 * 2) = (1310720) // (160 * 4096 * 2) = (1310720)
@ -95,17 +82,6 @@ private:
std::unique_ptr<HLE::DecoderBase> aac_decoder{}; std::unique_ptr<HLE::DecoderBase> aac_decoder{};
std::function<void(Service::DSP::InterruptType type, DspPipe pipe)> interrupt_handler{}; std::function<void(Service::DSP::InterruptType type, DspPipe pipe)> interrupt_handler{};
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& dsp_state;
ar& pipe_data;
ar& dsp_memory.raw_memory;
ar& sources;
ar& mixers;
// interrupt_handler is reregistered when loading state from DSP_DSP
}
friend class boost::serialization::access;
}; };
DspHle::Impl::Impl(DspHle& parent_, Memory::MemorySystem& memory, Core::Timing& timing) DspHle::Impl::Impl(DspHle& parent_, Memory::MemorySystem& memory, Core::Timing& timing)

View file

@ -7,7 +7,6 @@
#include <array> #include <array>
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <boost/serialization/export.hpp>
#include "audio_core/audio_types.h" #include "audio_core/audio_types.h"
#include "audio_core/dsp_interface.h" #include "audio_core/dsp_interface.h"
#include "common/common_types.h" #include "common/common_types.h"
@ -49,10 +48,6 @@ private:
struct Impl; struct Impl;
friend struct Impl; friend struct Impl;
std::unique_ptr<Impl> impl; std::unique_ptr<Impl> impl;
template <class Archive>
void serialize(Archive& ar, const unsigned int);
friend class boost::serialization::access;
}; };
} // namespace AudioCore } // namespace AudioCore

View file

@ -5,7 +5,6 @@
#pragma once #pragma once
#include <array> #include <array>
#include <boost/serialization/array.hpp>
#include "audio_core/audio_types.h" #include "audio_core/audio_types.h"
#include "audio_core/hle/shared_memory.h" #include "audio_core/hle/shared_memory.h"
@ -54,16 +53,6 @@ private:
void DownmixAndMixIntoCurrentFrame(float gain, const QuadFrame32& samples); void DownmixAndMixIntoCurrentFrame(float gain, const QuadFrame32& samples);
/// INTERNAL: Generate DspStatus based on internal state. /// INTERNAL: Generate DspStatus based on internal state.
DspStatus GetCurrentStatus() const; DspStatus GetCurrentStatus() const;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& current_frame;
ar& state.intermediate_mixer_volume;
ar& state.aux_bus_enable;
ar& state.intermediate_mix_buffer;
ar& state.output_format;
}
friend class boost::serialization::access;
}; };
} // namespace AudioCore::HLE } // namespace AudioCore::HLE

View file

@ -8,7 +8,6 @@
#include <cstddef> #include <cstddef>
#include <memory> #include <memory>
#include <type_traits> #include <type_traits>
#include <boost/serialization/access.hpp>
#include "audio_core/audio_types.h" #include "audio_core/audio_types.h"
#include "audio_core/hle/common.h" #include "audio_core/hle/common.h"
#include "common/bit_field.h" #include "common/bit_field.h"
@ -57,12 +56,6 @@ private:
return (value << 16) | (value >> 16); return (value << 16) | (value >> 16);
} }
u32_le storage; u32_le storage;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& storage;
}
friend class boost::serialization::access;
}; };
static_assert(std::is_trivially_copyable<u32_dsp>::value, "u32_dsp isn't trivially copyable"); static_assert(std::is_trivially_copyable<u32_dsp>::value, "u32_dsp isn't trivially copyable");

View file

@ -6,10 +6,6 @@
#include <array> #include <array>
#include <vector> #include <vector>
#include <boost/serialization/array.hpp>
#include <boost/serialization/deque.hpp>
#include <boost/serialization/priority_queue.hpp>
#include <boost/serialization/vector.hpp>
#include <queue> #include <queue>
#include "audio_core/audio_types.h" #include "audio_core/audio_types.h"
#include "audio_core/codec.h" #include "audio_core/codec.h"
@ -89,24 +85,6 @@ private:
bool from_queue; bool from_queue;
u32 play_position; // = 0; u32 play_position; // = 0;
bool has_played; // = false; bool has_played; // = false;
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& physical_address;
ar& length;
ar& adpcm_ps;
ar& adpcm_yn;
ar& adpcm_dirty;
ar& is_looping;
ar& buffer_id;
ar& mono_or_stereo;
ar& format;
ar& from_queue;
ar& play_position;
ar& has_played;
}
friend class boost::serialization::access;
}; };
struct BufferOrder { struct BufferOrder {
@ -159,27 +137,6 @@ private:
// Filter state // Filter state
SourceFilters filters = {}; SourceFilters filters = {};
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& enabled;
ar& sync_count;
ar& gain;
ar& input_queue;
ar& mono_or_stereo;
ar& format;
ar& current_sample_number;
ar& current_buffer_physical_address;
ar& current_buffer;
ar& buffer_update;
ar& current_buffer_id;
ar& adpcm_coeffs;
ar& rate_multiplier;
ar& interpolation_mode;
}
friend class boost::serialization::access;
} state; } state;
// Internal functions // Internal functions
@ -193,12 +150,6 @@ private:
bool DequeueBuffer(); bool DequeueBuffer();
/// INTERNAL: Generates a SourceStatus::Status based on our internal state. /// INTERNAL: Generates a SourceStatus::Status based on our internal state.
SourceStatus::Status GetCurrentStatus(); SourceStatus::Status GetCurrentStatus();
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& state;
}
friend class boost::serialization::access;
}; };
} // namespace AudioCore::HLE } // namespace AudioCore::HLE

View file

@ -684,8 +684,8 @@ void ConfigureSystem::DownloadFromNUS() {
&QProgressDialog::setValue); &QProgressDialog::setValue);
auto failed = false; auto failed = false;
const auto download_title = [&future_watcher, &failed](const u64& title_id) { const auto download_title = [&future_watcher, &failed, this](const u64& title_id) {
if (Service::AM::InstallFromNus(title_id) != Service::AM::InstallStatus::Success) { if (Service::AM::InstallFromNus(system, title_id) != Service::AM::InstallStatus::Success) {
failed = true; failed = true;
future_watcher.cancel(); future_watcher.cancel();
} }

View file

@ -4,7 +4,6 @@
#include <clocale> #include <clocale>
#include <memory> #include <memory>
#include <thread>
#include <QFileDialog> #include <QFileDialog>
#include <QFutureWatcher> #include <QFutureWatcher>
#include <QLabel> #include <QLabel>
@ -81,7 +80,6 @@
#endif #endif
#include "common/settings.h" #include "common/settings.h"
#include "core/core.h" #include "core/core.h"
#include "core/dumping/backend.h"
#include "core/file_sys/archive_extsavedata.h" #include "core/file_sys/archive_extsavedata.h"
#include "core/file_sys/archive_source_sd_savedata.h" #include "core/file_sys/archive_source_sd_savedata.h"
#include "core/frontend/applets/default_applets.h" #include "core/frontend/applets/default_applets.h"
@ -90,7 +88,6 @@
#include "core/hle/service/nfc/nfc.h" #include "core/hle/service/nfc/nfc.h"
#include "core/loader/loader.h" #include "core/loader/loader.h"
#include "core/movie.h" #include "core/movie.h"
#include "core/savestate.h"
#include "core/system_titles.h" #include "core/system_titles.h"
#include "input_common/main.h" #include "input_common/main.h"
#include "network/network_settings.h" #include "network/network_settings.h"
@ -581,7 +578,7 @@ void GMainWindow::InitializeRecentFileMenuActions() {
} }
void GMainWindow::InitializeSaveStateMenuActions() { void GMainWindow::InitializeSaveStateMenuActions() {
for (u32 i = 0; i < Core::SaveStateSlotCount; ++i) { for (u32 i = 0; i < SaveStateSlotCount; ++i) {
actions_load_state[i] = new QAction(this); actions_load_state[i] = new QAction(this);
actions_load_state[i]->setData(i + 1); actions_load_state[i]->setData(i + 1);
connect(actions_load_state[i], &QAction::triggered, this, &GMainWindow::OnLoadState); connect(actions_load_state[i], &QAction::triggered, this, &GMainWindow::OnLoadState);
@ -1523,47 +1520,6 @@ void GMainWindow::UpdateSaveStates() {
if (system.GetAppLoader().ReadProgramId(title_id) != Loader::ResultStatus::Success) { if (system.GetAppLoader().ReadProgramId(title_id) != Loader::ResultStatus::Success) {
return; return;
} }
auto savestates = Core::ListSaveStates(title_id, movie.GetCurrentMovieID());
for (u32 i = 0; i < Core::SaveStateSlotCount; ++i) {
actions_load_state[i]->setEnabled(false);
actions_load_state[i]->setText(tr("Slot %1").arg(i + 1));
actions_save_state[i]->setText(tr("Slot %1").arg(i + 1));
}
for (const auto& savestate : savestates) {
const bool display_name =
savestate.status == Core::SaveStateInfo::ValidationStatus::RevisionDismatch &&
!savestate.build_name.empty();
const auto text =
tr("Slot %1 - %2 %3")
.arg(savestate.slot)
.arg(QDateTime::fromSecsSinceEpoch(savestate.time)
.toString(QStringLiteral("yyyy-MM-dd hh:mm:ss")))
.arg(display_name ? QString::fromStdString(savestate.build_name) : QLatin1String())
.trimmed();
actions_load_state[savestate.slot - 1]->setEnabled(true);
actions_load_state[savestate.slot - 1]->setText(text);
actions_save_state[savestate.slot - 1]->setText(text);
ui->action_Load_from_Newest_Slot->setEnabled(true);
if (savestate.time > newest_slot_time) {
newest_slot = savestate.slot;
newest_slot_time = savestate.time;
}
if (savestate.time < oldest_slot_time) {
oldest_slot = savestate.slot;
oldest_slot_time = savestate.time;
}
}
for (u32 i = 0; i < Core::SaveStateSlotCount; ++i) {
if (!actions_load_state[i]->isEnabled()) {
// Prefer empty slot
oldest_slot = i + 1;
oldest_slot_time = 0;
break;
}
}
} }
void GMainWindow::OnGameListLoadFile(QString game_path) { void GMainWindow::OnGameListLoadFile(QString game_path) {

View file

@ -15,7 +15,6 @@
#include "citra_qt/compatibility_list.h" #include "citra_qt/compatibility_list.h"
#include "citra_qt/hotkeys.h" #include "citra_qt/hotkeys.h"
#include "core/core.h" #include "core/core.h"
#include "core/savestate.h"
#ifdef __unix__ #ifdef __unix__
#include <QDBusObjectPath> #include <QDBusObjectPath>
@ -367,8 +366,9 @@ private:
bool defer_update_prompt = false; bool defer_update_prompt = false;
QAction* actions_recent_files[max_recent_files_item]; QAction* actions_recent_files[max_recent_files_item];
std::array<QAction*, Core::SaveStateSlotCount> actions_load_state; static constexpr size_t SaveStateSlotCount = 8;
std::array<QAction*, Core::SaveStateSlotCount> actions_save_state; std::array<QAction*, SaveStateSlotCount> actions_load_state;
std::array<QAction*, SaveStateSlotCount> actions_save_state;
u32 oldest_slot; u32 oldest_slot;
u64 oldest_slot_time; u64 oldest_slot_time;

View file

@ -62,7 +62,6 @@ add_library(citra_common STATIC
android_storage.cpp android_storage.cpp
announce_multiplayer_room.h announce_multiplayer_room.h
arch.h arch.h
archives.h
assert.h assert.h
atomic_ops.h atomic_ops.h
detached_tasks.cpp detached_tasks.cpp
@ -77,7 +76,6 @@ add_library(citra_common STATIC
common_paths.h common_paths.h
common_precompiled_headers.h common_precompiled_headers.h
common_types.h common_types.h
construct.h
dynamic_library/dynamic_library.cpp dynamic_library/dynamic_library.cpp
dynamic_library/dynamic_library.h dynamic_library/dynamic_library.h
dynamic_library/ffmpeg.cpp dynamic_library/ffmpeg.cpp
@ -119,12 +117,6 @@ add_library(citra_common STATIC
settings.cpp settings.cpp
settings.h settings.h
slot_vector.h slot_vector.h
serialization/atomic.h
serialization/boost_discrete_interval.hpp
serialization/boost_flat_set.h
serialization/boost_small_vector.hpp
serialization/boost_std_variant.hpp
serialization/boost_vector.hpp
static_lru_cache.h static_lru_cache.h
string_literal.h string_literal.h
string_util.cpp string_util.cpp
@ -184,7 +176,7 @@ endif()
create_target_directory_groups(citra_common) create_target_directory_groups(citra_common)
target_link_libraries(citra_common PUBLIC fmt library-headers microprofile Boost::boost Boost::serialization Boost::iostreams) target_link_libraries(citra_common PUBLIC fmt library-headers microprofile Boost::iostreams)
target_link_libraries(citra_common PRIVATE zstd) target_link_libraries(citra_common PRIVATE zstd)
if ("x86_64" IN_LIST ARCHITECTURE) if ("x86_64" IN_LIST ARCHITECTURE)

View file

@ -1,21 +0,0 @@
// Copyright 2020 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/binary_oarchive.hpp>
#include <boost/serialization/export.hpp>
using iarchive = boost::archive::binary_iarchive;
using oarchive = boost::archive::binary_oarchive;
#define SERIALIZE_IMPL(A) \
template void A::serialize<iarchive>(iarchive & ar, const unsigned int file_version); \
template void A::serialize<oarchive>(oarchive & ar, const unsigned int file_version);
#define SERIALIZE_EXPORT_IMPL(A) \
BOOST_CLASS_EXPORT_IMPLEMENT(A) \
BOOST_SERIALIZATION_REGISTER_ARCHIVE(iarchive) \
BOOST_SERIALIZATION_REGISTER_ARCHIVE(oarchive)

View file

@ -1,34 +0,0 @@
// Copyright 2020 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <boost/serialization/serialization.hpp>
/// Allows classes to define `save_construct` and `load_construct` methods for serialization
/// This is used where we don't call the default constructor during deserialization, as a shortcut
/// instead of using load_construct_data directly
class construct_access {
public:
template <class Archive, class T>
static void save_construct(Archive& ar, const T* t, const unsigned int file_version) {
t->save_construct(ar, file_version);
}
template <class Archive, class T>
static 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::serialization { \
template <class Archive> \
void save_construct_data(Archive& ar, const T* t, const unsigned int file_version) { \
construct_access::save_construct(ar, t, file_version); \
} \
template <class Archive> \
void load_construct_data(Archive& ar, T* t, const unsigned int file_version) { \
construct_access::load_construct(ar, t, file_version); \
} \
}

View file

@ -849,13 +849,6 @@ bool StringReplace(std::string& haystack, const std::string& a, const std::strin
return true; return true;
} }
std::string SerializePath(const std::string& input, bool is_saving) {
auto result = input;
StringReplace(result, "%CITRA_ROM_FILE%", g_currentRomPath, is_saving);
StringReplace(result, "%CITRA_USER_DIR%", GetUserPath(UserPath::UserDir), is_saving);
return result;
}
const std::string& GetUserPath(UserPath path) { const std::string& GetUserPath(UserPath path) {
// Set up all paths and files on the first run // Set up all paths and files on the first run
if (g_paths.empty()) if (g_paths.empty())

View file

@ -14,9 +14,6 @@
#include <string_view> #include <string_view>
#include <type_traits> #include <type_traits>
#include <vector> #include <vector>
#include <boost/serialization/split_member.hpp>
#include <boost/serialization/string.hpp>
#include <boost/serialization/wrapper.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#ifdef _MSC_VER #ifdef _MSC_VER
#include "common/string_util.h" #include "common/string_util.h"
@ -42,34 +39,6 @@ enum class UserPath {
UserDir, UserDir,
}; };
// Replaces install-specific paths with standard placeholders, and back again
std::string SerializePath(const std::string& input, bool is_saving);
// A serializable path string
struct Path : public boost::serialization::wrapper_traits<const Path> {
std::string& str;
explicit Path(std::string& _str) : str(_str) {}
static const Path make(std::string& str) {
return Path(str);
}
template <class Archive>
void save(Archive& ar, const unsigned int) const {
auto s_path = SerializePath(str, true);
ar << s_path;
}
template <class Archive>
void load(Archive& ar, const unsigned int) const {
ar >> str;
str = SerializePath(str, false);
}
BOOST_SERIALIZATION_SPLIT_MEMBER();
friend class boost::serialization::access;
};
// FileSystem tree node/ // FileSystem tree node/
struct FSTEntry { struct FSTEntry {
bool isDirectory; bool isDirectory;
@ -77,17 +46,6 @@ struct FSTEntry {
std::string physicalName; // name on disk std::string physicalName; // name on disk
std::string virtualName; // name in FST names table std::string virtualName; // name in FST names table
std::vector<FSTEntry> children; std::vector<FSTEntry> children;
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& isDirectory;
ar& size;
ar& Path::make(physicalName);
ar& Path::make(virtualName);
ar& children;
}
friend class boost::serialization::access;
}; };
// Returns true if file filename exists // Returns true if file filename exists
@ -391,23 +349,6 @@ private:
std::string filename; std::string filename;
std::string openmode; std::string openmode;
u32 flags; u32 flags;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& Path::make(filename);
ar& openmode;
ar& flags;
u64 pos;
if (Archive::is_saving::value) {
pos = Tell();
}
ar& pos;
if (Archive::is_loading::value) {
Open();
Seek(pos, SEEK_SET);
}
}
friend class boost::serialization::access;
}; };
template <std::ios_base::openmode o, typename T> template <std::ios_base::openmode o, typename T>

View file

@ -2,7 +2,4 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/archives.h"
#include "common/memory_ref.h" #include "common/memory_ref.h"
SERIALIZE_EXPORT_IMPL(BufferMem)

View file

@ -7,9 +7,6 @@
#include <memory> #include <memory>
#include <span> #include <span>
#include <vector> #include <vector>
#include <boost/serialization/export.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/vector.hpp>
#include "common/assert.h" #include "common/assert.h"
#include "common/common_types.h" #include "common/common_types.h"
@ -20,11 +17,6 @@ public:
virtual u8* GetPtr() = 0; virtual u8* GetPtr() = 0;
virtual const u8* GetPtr() const = 0; virtual const u8* GetPtr() const = 0;
virtual std::size_t GetSize() const = 0; virtual std::size_t GetSize() const = 0;
private:
template <class Archive>
void serialize(Archive&, const unsigned int) {}
friend class boost::serialization::access;
}; };
/// Backing memory implemented by a local buffer /// Backing memory implemented by a local buffer
@ -55,17 +47,8 @@ public:
private: private:
std::vector<u8> data; std::vector<u8> data;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<BackingMem>(*this);
ar& data;
}
friend class boost::serialization::access;
}; };
BOOST_CLASS_EXPORT_KEY(BufferMem);
/** /**
* A managed reference to host-side memory. * A managed reference to host-side memory.
* Fast enough to be used everywhere instead of u8* * Fast enough to be used everywhere instead of u8*
@ -148,12 +131,4 @@ private:
csize = 0; csize = 0;
} }
} }
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& backing_mem;
ar& offset;
Init();
}
friend class boost::serialization::access;
}; };

View file

@ -1,29 +0,0 @@
// Copyright 2020 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <atomic>
#include <boost/serialization/split_free.hpp>
namespace boost::serialization {
template <class Archive, class T>
void serialize(Archive& ar, std::atomic<T>& value, const unsigned int file_version) {
boost::serialization::split_free(ar, value, file_version);
}
template <class Archive, class T>
void save(Archive& ar, const std::atomic<T>& value, const unsigned int file_version) {
ar << value.load();
}
template <class Archive, class T>
void load(Archive& ar, std::atomic<T>& value, const unsigned int file_version) {
T tmp;
ar >> tmp;
value.store(tmp);
}
} // namespace boost::serialization

View file

@ -1,38 +0,0 @@
// Copyright 2020 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <boost/icl/discrete_interval.hpp>
#include "common/common_types.h"
#include "common/logging/log.h"
namespace boost::serialization {
template <class Archive, class DomainT, ICL_COMPARE Compare>
void save(Archive& ar, const boost::icl::discrete_interval<DomainT, Compare>& obj,
const unsigned int file_version) {
ar << obj.lower();
ar << obj.upper();
ar << obj.bounds()._bits;
}
template <class Archive, class DomainT, ICL_COMPARE Compare>
void load(Archive& ar, boost::icl::discrete_interval<DomainT, Compare>& obj,
const unsigned int file_version) {
DomainT upper, lower;
boost::icl::bound_type bounds;
ar >> lower;
ar >> upper;
ar >> bounds;
obj = boost::icl::discrete_interval(lower, upper, boost::icl::interval_bounds(bounds));
}
template <class Archive, class DomainT, ICL_COMPARE Compare>
void serialize(Archive& ar, boost::icl::discrete_interval<DomainT, Compare>& obj,
const unsigned int file_version) {
boost::serialization::split_free(ar, obj, file_version);
}
} // namespace boost::serialization

View file

@ -1,38 +0,0 @@
// Copyright 2020 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <boost/container/flat_set.hpp>
#include <boost/serialization/split_free.hpp>
#include "common/common_types.h"
namespace boost::serialization {
template <class Archive, class T>
void save(Archive& ar, const boost::container::flat_set<T>& set, const unsigned int file_version) {
ar << static_cast<u64>(set.size());
for (auto& v : set) {
ar << v;
}
}
template <class Archive, class T>
void load(Archive& ar, boost::container::flat_set<T>& set, const unsigned int file_version) {
u64 count{};
ar >> count;
set.clear();
for (u64 i = 0; i < count; i++) {
T value{};
ar >> value;
set.insert(value);
}
}
template <class Archive, class T>
void serialize(Archive& ar, boost::container::flat_set<T>& set, const unsigned int file_version) {
boost::serialization::split_free(ar, set, file_version);
}
} // namespace boost::serialization

View file

@ -1,38 +0,0 @@
// Copyright 2020 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <boost/icl/interval_set.hpp>
#include <boost/serialization/split_free.hpp>
#include "common/serialization/boost_discrete_interval.hpp"
namespace boost::serialization {
template <class Archive, class T>
void save(Archive& ar, const boost::icl::interval_set<T>& set, const unsigned int file_version) {
ar << static_cast<u64>(set.iterative_size());
for (auto& v : set) {
ar << v;
}
}
template <class Archive, class T>
void load(Archive& ar, boost::icl::interval_set<T>& set, const unsigned int file_version) {
u64 count{};
ar >> count;
set.clear();
for (u64 i = 0; i < count; i++) {
typename boost::icl::interval_set<T>::interval_type value{};
ar >> value;
set += value;
}
}
template <class Archive, class T>
void serialize(Archive& ar, boost::icl::interval_set<T>& set, const unsigned int file_version) {
boost::serialization::split_free(ar, set, file_version);
}
} // namespace boost::serialization

View file

@ -1,144 +0,0 @@
#ifndef BOOST_SERIALIZATION_BOOST_SMALL_VECTOR_HPP
#define BOOST_SERIALIZATION_BOOST_SMALL_VECTOR_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
#pragma once
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// boost_vector.hpp: serialization for boost vector templates
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// fast array serialization (C) Copyright 2005 Matthias Troyer
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#include <boost/container/small_vector.hpp>
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/archive/detail/basic_iarchive.hpp>
#include <boost/serialization/access.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/item_version_type.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/mpl/bool_fwd.hpp>
#include <boost/mpl/if.hpp>
#include <boost/serialization/array_wrapper.hpp>
#include <boost/serialization/collections_load_imp.hpp>
#include <boost/serialization/collections_save_imp.hpp>
#include <boost/serialization/split_free.hpp>
// default is being compatible with version 1.34.1 files, not 1.35 files
#ifndef BOOST_SERIALIZATION_VECTOR_VERSIONED
#define BOOST_SERIALIZATION_VECTOR_VERSIONED(V) (V == 4 || V == 5)
#endif
namespace boost {
namespace serialization {
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// vector< T >
// the default versions
template <class Archive, class U, std::size_t N>
inline void save(Archive& ar, const boost::container::small_vector<U, N>& t,
const unsigned int /* file_version */, mpl::false_) {
boost::serialization::stl::save_collection<Archive, boost::container::small_vector<U, N>>(ar,
t);
}
template <class Archive, class U, std::size_t N>
inline void load(Archive& ar, boost::container::small_vector<U, N>& t,
const unsigned int /* file_version */, mpl::false_) {
const boost::archive::library_version_type library_version(ar.get_library_version());
// retrieve number of elements
item_version_type item_version(0);
collection_size_type count;
ar >> BOOST_SERIALIZATION_NVP(count);
if (boost::archive::library_version_type(3) < library_version) {
ar >> BOOST_SERIALIZATION_NVP(item_version);
}
t.reserve(count);
stl::collection_load_impl(ar, t, count, item_version);
}
// the optimized versions
template <class Archive, class U, std::size_t N>
inline void save(Archive& ar, const boost::container::small_vector<U, N>& t,
const unsigned int /* file_version */, mpl::true_) {
const collection_size_type count(t.size());
ar << BOOST_SERIALIZATION_NVP(count);
if (!t.empty())
// explict template arguments to pass intel C++ compiler
ar << serialization::make_array<const U, collection_size_type>(static_cast<const U*>(&t[0]),
count);
}
template <class Archive, class U, std::size_t N>
inline void load(Archive& ar, boost::container::small_vector<U, N>& t,
const unsigned int /* file_version */, mpl::true_) {
collection_size_type count(t.size());
ar >> BOOST_SERIALIZATION_NVP(count);
t.resize(count);
unsigned int item_version = 0;
if (BOOST_SERIALIZATION_VECTOR_VERSIONED(ar.get_library_version())) {
ar >> BOOST_SERIALIZATION_NVP(item_version);
}
if (!t.empty())
// explict template arguments to pass intel C++ compiler
ar >> serialization::make_array<U, collection_size_type>(static_cast<U*>(&t[0]), count);
}
// dispatch to either default or optimized versions
template <class Archive, class U, std::size_t N>
inline void save(Archive& ar, const boost::container::small_vector<U, N>& t,
const unsigned int file_version) {
typedef typename boost::serialization::use_array_optimization<Archive>::template apply<
typename remove_const<U>::type>::type use_optimized;
save(ar, t, file_version, use_optimized());
}
template <class Archive, class U, std::size_t N>
inline void load(Archive& ar, boost::container::small_vector<U, N>& t,
const unsigned int file_version) {
#ifdef BOOST_SERIALIZATION_VECTOR_135_HPP
if (ar.get_library_version() == boost::archive::library_version_type(5)) {
load(ar, t, file_version, boost::is_arithmetic<U>());
return;
}
#endif
typedef typename boost::serialization::use_array_optimization<Archive>::template apply<
typename remove_const<U>::type>::type use_optimized;
load(ar, t, file_version, use_optimized());
}
// split non-intrusive serialization function member into separate
// non intrusive save/load member functions
template <class Archive, class U, std::size_t N>
inline void serialize(Archive& ar, boost::container::small_vector<U, N>& t,
const unsigned int file_version) {
boost::serialization::split_free(ar, t, file_version);
}
// split non-intrusive serialization function member into separate
// non intrusive save/load member functions
template <class Archive, std::size_t N>
inline void serialize(Archive& ar, boost::container::small_vector<bool, N>& t,
const unsigned int file_version) {
boost::serialization::split_free(ar, t, file_version);
}
} // namespace serialization
} // namespace boost
#endif // BOOST_SERIALIZATION_BOOST_SMALL_VECTOR_HPP

View file

@ -1,204 +0,0 @@
#ifndef BOOST_SERIALIZATION_STD_VARIANT_HPP
#define BOOST_SERIALIZATION_STD_VARIANT_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// variant.hpp - non-intrusive serialization of variant types
//
// copyright (c) 2019 Samuel Debionne, ESRF
//
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org for updates, documentation, and revision history.
//
// Widely inspired form boost::variant serialization
//
#include <boost/serialization/throw_exception.hpp>
#include <variant>
#include <boost/archive/archive_exception.hpp>
#include <boost/serialization/split_free.hpp>
#include <boost/serialization/serialization.hpp>
#include <boost/serialization/nvp.hpp>
namespace boost {
namespace serialization {
template<class Archive>
struct std_variant_save_visitor
{
std_variant_save_visitor(Archive& ar) :
m_ar(ar)
{}
template<class T>
void operator()(T const & value) const
{
m_ar << BOOST_SERIALIZATION_NVP(value);
}
private:
Archive & m_ar;
};
template<class Archive>
struct std_variant_load_visitor
{
std_variant_load_visitor(Archive& ar) :
m_ar(ar)
{}
template<class T>
void operator()(T & value) const
{
m_ar >> BOOST_SERIALIZATION_NVP(value);
}
private:
Archive & m_ar;
};
template<class Archive, class ...Types>
void save(
Archive & ar,
std::variant<Types...> const & v,
unsigned int /*version*/
){
const std::size_t which = v.index();
ar << BOOST_SERIALIZATION_NVP(which);
std_variant_save_visitor<Archive> visitor(ar);
std::visit(visitor, v);
}
// Minimalist metaprogramming for handling parameter pack
namespace mp {
namespace detail {
template <typename Seq>
struct front_impl;
template <template <typename...> class Seq, typename T, typename... Ts>
struct front_impl<Seq<T, Ts...>> {
using type = T;
};
template <typename Seq>
struct pop_front_impl;
template <template <typename...> class Seq, typename T, typename... Ts>
struct pop_front_impl<Seq<T, Ts...>> {
using type = Seq<Ts...>;
};
} //namespace detail
template <typename... Ts>
struct typelist {};
template <typename Seq>
using front = typename detail::front_impl<Seq>::type;
template <typename Seq>
using pop_front = typename detail::pop_front_impl<Seq>::type;
} // namespace mp
template<std::size_t N, class Seq>
struct variant_impl
{
template<class Archive, class V>
static void load (
Archive & ar,
std::size_t which,
V & v,
const unsigned int version
){
if(which == 0){
// note: A non-intrusive implementation (such as this one)
// necessary has to copy the value. This wouldn't be necessary
// with an implementation that de-serialized to the address of the
// aligned storage included in the variant.
using type = mp::front<Seq>;
type value;
ar >> BOOST_SERIALIZATION_NVP(value);
v = std::move(value);
type * new_address = & std::get<type>(v);
ar.reset_object_address(new_address, & value);
return;
}
//typedef typename mpl::pop_front<S>::type type;
using types = mp::pop_front<Seq>;
variant_impl<N - 1, types>::load(ar, which - 1, v, version);
}
};
template<class Seq>
struct variant_impl<0, Seq>
{
template<class Archive, class V>
static void load (
Archive & /*ar*/,
std::size_t /*which*/,
V & /*v*/,
const unsigned int /*version*/
){}
};
template<class Archive, class... Types>
void load(
Archive & ar,
std::variant<Types...>& v,
const unsigned int version
){
std::size_t which;
ar >> BOOST_SERIALIZATION_NVP(which);
if(which >= sizeof...(Types))
// this might happen if a type was removed from the list of variant types
boost::serialization::throw_exception(
boost::archive::archive_exception(
boost::archive::archive_exception::unsupported_version
)
);
variant_impl<sizeof...(Types), mp::typelist<Types...>>::load(ar, which, v, version);
}
template<class Archive,class... Types>
inline void serialize(
Archive & ar,
std::variant<Types...> & v,
const unsigned int file_version
){
split_free(ar,v,file_version);
}
// Specialization for std::monostate
template<class Archive>
void serialize(Archive &ar, std::monostate &, const unsigned int /*version*/)
{}
} // namespace serialization
} // namespace boost
//template<typename T0_, BOOST_VARIANT_ENUM_SHIFTED_PARAMS(typename T)>
#include <boost/serialization/tracking.hpp>
namespace boost {
namespace serialization {
template<class... Types>
struct tracking_level<
std::variant<Types...>
>{
typedef mpl::integral_c_tag tag;
typedef mpl::int_< ::boost::serialization::track_always> type;
BOOST_STATIC_CONSTANT(int, value = type::value);
};
} // namespace serialization
} // namespace boost
#endif //BOOST_SERIALIZATION_VARIANT_HPP

View file

@ -1,149 +0,0 @@
#ifndef BOOST_SERIALIZATION_BOOST_VECTOR_HPP
#define BOOST_SERIALIZATION_BOOST_VECTOR_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
#pragma once
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// boost_vector.hpp: serialization for boost vector templates
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// fast array serialization (C) Copyright 2005 Matthias Troyer
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#include <boost/container/vector.hpp>
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/archive/detail/basic_iarchive.hpp>
#include <boost/serialization/access.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/item_version_type.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/mpl/bool_fwd.hpp>
#include <boost/mpl/if.hpp>
#include <boost/serialization/array_wrapper.hpp>
#include <boost/serialization/collections_load_imp.hpp>
#include <boost/serialization/collections_save_imp.hpp>
#include <boost/serialization/split_free.hpp>
// default is being compatible with version 1.34.1 files, not 1.35 files
#ifndef BOOST_SERIALIZATION_VECTOR_VERSIONED
#define BOOST_SERIALIZATION_VECTOR_VERSIONED(V) (V == 4 || V == 5)
#endif
namespace boost {
namespace serialization {
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// vector< T >
// the default versions
template <class Archive, class U, class Allocator, class Options>
inline void save(Archive& ar, const boost::container::vector<U, Allocator, Options>& t,
const unsigned int /* file_version */, mpl::false_) {
boost::serialization::stl::save_collection<Archive,
boost::container::vector<U, Allocator, Options>>(ar,
t);
}
template <class Archive, class U, class Allocator, class Options>
inline void load(Archive& ar, boost::container::vector<U, Allocator, Options>& t,
const unsigned int /* file_version */, mpl::false_) {
const boost::archive::library_version_type library_version(ar.get_library_version());
// retrieve number of elements
item_version_type item_version(0);
collection_size_type count;
ar >> BOOST_SERIALIZATION_NVP(count);
if (boost::archive::library_version_type(3) < library_version) {
ar >> BOOST_SERIALIZATION_NVP(item_version);
}
t.reserve(count);
stl::collection_load_impl(ar, t, count, item_version);
}
// the optimized versions
template <class Archive, class U, class Allocator, class Options>
inline void save(Archive& ar, const boost::container::vector<U, Allocator, Options>& t,
const unsigned int /* file_version */, mpl::true_) {
const collection_size_type count(t.size());
ar << BOOST_SERIALIZATION_NVP(count);
if (!t.empty())
// explict template arguments to pass intel C++ compiler
ar << serialization::make_array<const U, collection_size_type>(static_cast<const U*>(&t[0]),
count);
}
template <class Archive, class U, class Allocator, class Options>
inline void load(Archive& ar, boost::container::vector<U, Allocator, Options>& t,
const unsigned int /* file_version */, mpl::true_) {
collection_size_type count(t.size());
ar >> BOOST_SERIALIZATION_NVP(count);
t.resize(count);
unsigned int item_version = 0;
if (BOOST_SERIALIZATION_VECTOR_VERSIONED(ar.get_library_version())) {
ar >> BOOST_SERIALIZATION_NVP(item_version);
}
if (!t.empty())
// explict template arguments to pass intel C++ compiler
ar >> serialization::make_array<U, collection_size_type>(static_cast<U*>(&t[0]), count);
}
// dispatch to either default or optimized versions
template <class Archive, class U, class Allocator, class Options>
inline void save(Archive& ar, const boost::container::vector<U, Allocator, Options>& t,
const unsigned int file_version) {
typedef typename boost::serialization::use_array_optimization<Archive>::template apply<
typename remove_const<U>::type>::type use_optimized;
save(ar, t, file_version, use_optimized());
}
template <class Archive, class U, class Allocator, class Options>
inline void load(Archive& ar, boost::container::vector<U, Allocator, Options>& t,
const unsigned int file_version) {
#ifdef BOOST_SERIALIZATION_VECTOR_135_HPP
if (ar.get_library_version() == boost::archive::library_version_type(5)) {
load(ar, t, file_version, boost::is_arithmetic<U>());
return;
}
#endif
typedef typename boost::serialization::use_array_optimization<Archive>::template apply<
typename remove_const<U>::type>::type use_optimized;
load(ar, t, file_version, use_optimized());
}
// split non-intrusive serialization function member into separate
// non intrusive save/load member functions
template <class Archive, class U, class Allocator, class Options>
inline void serialize(Archive& ar, boost::container::vector<U, Allocator, Options>& t,
const unsigned int file_version) {
boost::serialization::split_free(ar, t, file_version);
}
// split non-intrusive serialization function member into separate
// non intrusive save/load member functions
template <class Archive, class Allocator, class Options>
inline void serialize(Archive& ar, boost::container::vector<bool, Allocator, Options>& t,
const unsigned int file_version) {
boost::serialization::split_free(ar, t, file_version);
}
} // namespace serialization
} // namespace boost
#include <boost/serialization/collection_traits.hpp>
BOOST_SERIALIZATION_COLLECTION_TRAITS(boost::container::vector)
#endif // BOOST_SERIALIZATION_BOOST_VECTOR_HPP

View file

@ -7,8 +7,6 @@
#include <algorithm> #include <algorithm>
#include <array> #include <array>
#include <deque> #include <deque>
#include <boost/serialization/deque.hpp>
#include <boost/serialization/split_member.hpp>
#include "common/common_types.h" #include "common/common_types.h"
namespace Common { namespace Common {
@ -180,32 +178,6 @@ private:
return &queues[idx]; return &queues[idx];
} }
} }
friend class boost::serialization::access;
template <class Archive>
void save(Archive& ar, const unsigned int file_version) const {
const s64 idx = ToIndex(first);
ar << idx;
for (std::size_t i = 0; i < NUM_QUEUES; i++) {
const s64 idx1 = ToIndex(queues[i].next_nonempty);
ar << idx1;
ar << queues[i].data;
}
}
template <class Archive>
void load(Archive& ar, const unsigned int file_version) {
s64 idx;
ar >> idx;
first = ToPointer(idx);
for (std::size_t i = 0; i < NUM_QUEUES; i++) {
ar >> idx;
queues[i].next_nonempty = ToPointer(idx);
ar >> queues[i].data;
}
}
BOOST_SERIALIZATION_SPLIT_MEMBER()
}; };
} // namespace Common } // namespace Common

View file

@ -33,7 +33,6 @@
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>
#include <type_traits> #include <type_traits>
#include <boost/serialization/access.hpp>
namespace Common { namespace Common {
@ -46,13 +45,6 @@ class Vec4;
template <typename T> template <typename T>
class Vec2 { class Vec2 {
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int file_version) {
ar& x;
ar& y;
}
public: public:
T x; T x;
T y; T y;
@ -214,14 +206,6 @@ inline float Vec2<float>::Normalize() {
template <typename T> template <typename T>
class Vec3 { class Vec3 {
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int file_version) {
ar& x;
ar& y;
ar& z;
}
public: public:
T x; T x;
T y; T y;
@ -442,15 +426,6 @@ using Vec3u = Vec3<unsigned int>;
template <typename T> template <typename T>
class Vec4 { class Vec4 {
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int file_version) {
ar& x;
ar& y;
ar& z;
ar& w;
}
public: public:
T x; T x;
T y; T y;

View file

@ -462,9 +462,6 @@ add_library(citra_core STATIC
perf_stats.cpp perf_stats.cpp
perf_stats.h perf_stats.h
precompiled_headers.h precompiled_headers.h
savestate.cpp
savestate.h
savestate_data.h
system_titles.cpp system_titles.cpp
system_titles.h system_titles.h
telemetry_session.cpp telemetry_session.cpp
@ -477,7 +474,7 @@ add_library(citra_core STATIC
create_target_directory_groups(citra_core) create_target_directory_groups(citra_core)
target_link_libraries(citra_core PUBLIC citra_common PRIVATE audio_core network video_core) target_link_libraries(citra_core PUBLIC citra_common PRIVATE audio_core network video_core)
target_link_libraries(citra_core PRIVATE Boost::boost Boost::serialization Boost::iostreams httplib) target_link_libraries(citra_core PRIVATE Boost::boost Boost::iostreams httplib)
target_link_libraries(citra_core PUBLIC dds-ktx PRIVATE cryptopp fmt lodepng open_source_archives) target_link_libraries(citra_core PUBLIC dds-ktx PRIVATE cryptopp fmt lodepng open_source_archives)
if (ENABLE_WEB_SERVICE) if (ENABLE_WEB_SERVICE)

View file

@ -6,9 +6,6 @@
#include <cstddef> #include <cstddef>
#include <memory> #include <memory>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/split_member.hpp>
#include <boost/serialization/version.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/arm/skyeye_common/arm_regformat.h" #include "core/arm/skyeye_common/arm_regformat.h"
#include "core/arm/skyeye_common/vfp/asm_vfp.h" #include "core/arm/skyeye_common/vfp/asm_vfp.h"
@ -55,18 +52,6 @@ public:
std::array<u32, 64> fpu_registers{}; std::array<u32, 64> fpu_registers{};
u32 fpscr{}; u32 fpscr{};
u32 fpexc{}; u32 fpexc{};
private:
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int file_version) {
ar& cpu_registers;
ar& fpu_registers;
ar& cpsr;
ar& fpscr;
ar& fpexc;
}
}; };
/// Runs the CPU until an event happens /// Runs the CPU until an event happens
@ -199,109 +184,8 @@ public:
} }
protected: protected:
// This us used for serialization. Returning nullptr is valid if page tables are not used.
virtual std::shared_ptr<Memory::PageTable> GetPageTable() const = 0;
std::shared_ptr<Core::Timing::Timer> timer; std::shared_ptr<Core::Timing::Timer> timer;
private:
u32 id; u32 id;
friend class boost::serialization::access;
template <class Archive>
void save(Archive& ar, const unsigned int file_version) const {
ar << timer;
ar << id;
const auto page_table = GetPageTable();
ar << page_table;
for (int i = 0; i < 15; i++) {
const auto r = GetReg(i);
ar << r;
}
const auto pc = GetPC();
ar << pc;
const auto cpsr = GetCPSR();
ar << cpsr;
for (int i = 0; i < 64; i++) {
const auto r = GetVFPReg(i);
ar << r;
}
for (std::size_t i = 0; i < VFPSystemRegister::VFP_SYSTEM_REGISTER_COUNT; i++) {
const auto reg = static_cast<VFPSystemRegister>(i);
u32 r = 0;
switch (reg) {
case VFP_FPSCR:
case VFP_FPEXC:
r = GetVFPSystemReg(reg);
default:
break;
}
ar << r;
}
for (std::size_t i = 0; i < CP15Register::CP15_REGISTER_COUNT; i++) {
const auto reg = static_cast<CP15Register>(i);
u32 r = 0;
switch (reg) {
case CP15_THREAD_UPRW:
case CP15_THREAD_URO:
r = GetCP15Register(reg);
default:
break;
}
ar << r;
}
}
template <class Archive>
void load(Archive& ar, const unsigned int file_version) {
ClearInstructionCache();
ar >> timer;
ar >> id;
std::shared_ptr<Memory::PageTable> page_table{};
ar >> page_table;
SetPageTable(page_table);
u32 r;
for (int i = 0; i < 15; i++) {
ar >> r;
SetReg(i, r);
}
ar >> r;
SetPC(r);
ar >> r;
SetCPSR(r);
for (int i = 0; i < 64; i++) {
ar >> r;
SetVFPReg(i, r);
}
for (std::size_t i = 0; i < VFPSystemRegister::VFP_SYSTEM_REGISTER_COUNT; i++) {
ar >> r;
const auto reg = static_cast<VFPSystemRegister>(i);
switch (reg) {
case VFP_FPSCR:
case VFP_FPEXC:
SetVFPSystemReg(reg, r);
default:
break;
}
}
for (std::size_t i = 0; i < CP15Register::CP15_REGISTER_COUNT; i++) {
ar >> r;
const auto reg = static_cast<CP15Register>(i);
switch (reg) {
case CP15_THREAD_UPRW:
case CP15_THREAD_URO:
SetCP15Register(reg, r);
default:
break;
}
}
}
BOOST_SERIALIZATION_SPLIT_MEMBER()
}; };
} // namespace Core } // namespace Core
BOOST_CLASS_VERSION(Core::ARM_Interface, 1)
BOOST_CLASS_VERSION(Core::ARM_Interface::ThreadContext, 1)

View file

@ -267,10 +267,6 @@ void ARM_Dynarmic::ClearExclusiveState() {
jit->ClearExclusiveState(); jit->ClearExclusiveState();
} }
std::shared_ptr<Memory::PageTable> ARM_Dynarmic::GetPageTable() const {
return current_page_table;
}
void ARM_Dynarmic::SetPageTable(const std::shared_ptr<Memory::PageTable>& page_table) { void ARM_Dynarmic::SetPageTable(const std::shared_ptr<Memory::PageTable>& page_table) {
current_page_table = page_table; current_page_table = page_table;
ThreadContext ctx{}; ThreadContext ctx{};

View file

@ -56,9 +56,6 @@ public:
void ClearExclusiveState() override; void ClearExclusiveState() override;
void SetPageTable(const std::shared_ptr<Memory::PageTable>& page_table) override; void SetPageTable(const std::shared_ptr<Memory::PageTable>& page_table) override;
protected:
std::shared_ptr<Memory::PageTable> GetPageTable() const override;
private: private:
void ServeBreak(); void ServeBreak();

View file

@ -44,10 +44,6 @@ void ARM_DynCom::SetPageTable(const std::shared_ptr<Memory::PageTable>& page_tab
ClearInstructionCache(); ClearInstructionCache();
} }
std::shared_ptr<Memory::PageTable> ARM_DynCom::GetPageTable() const {
return nullptr;
}
void ARM_DynCom::SetPC(u32 pc) { void ARM_DynCom::SetPC(u32 pc) {
state->Reg[15] = pc; state->Reg[15] = pc;
} }

View file

@ -51,9 +51,6 @@ public:
void SetPageTable(const std::shared_ptr<Memory::PageTable>& page_table) override; void SetPageTable(const std::shared_ptr<Memory::PageTable>& page_table) override;
void PrepareReschedule() override; void PrepareReschedule() override;
protected:
std::shared_ptr<Memory::PageTable> GetPageTable() const override;
private: private:
void ExecuteInstructions(u64 num_instructions); void ExecuteInstructions(u64 num_instructions);

View file

@ -2,9 +2,7 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <stdexcept>
#include <utility> #include <utility>
#include <boost/serialization/array.hpp>
#include "audio_core/dsp_interface.h" #include "audio_core/dsp_interface.h"
#include "audio_core/hle/hle.h" #include "audio_core/hle/hle.h"
#include "audio_core/lle/lle.h" #include "audio_core/lle/lle.h"
@ -26,7 +24,7 @@
#include "core/dumping/backend.h" #include "core/dumping/backend.h"
#include "core/frontend/image_interface.h" #include "core/frontend/image_interface.h"
#include "core/gdbstub/gdbstub.h" #include "core/gdbstub/gdbstub.h"
#include "core/global.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
@ -57,21 +55,6 @@ namespace Core {
/*static*/ System System::s_instance; /*static*/ System System::s_instance;
template <>
Core::System& Global() {
return System::GetInstance();
}
template <>
Kernel::KernelSystem& Global() {
return System::GetInstance().Kernel();
}
template <>
Core::Timing& Global() {
return System::GetInstance().CoreTiming();
}
System::System() : movie{*this}, cheat_engine{*this} {} System::System() : movie{*this}, cheat_engine{*this} {}
System::~System() = default; System::~System() = default;
@ -577,7 +560,7 @@ void System::RegisterImageInterface(std::shared_ptr<Frontend::ImageInterface> im
registered_image_interface = std::move(image_interface); registered_image_interface = std::move(image_interface);
} }
void System::Shutdown(bool is_deserializing) { void System::Shutdown() {
// Log last frame performance stats // Log last frame performance stats
const auto perf_results = GetAndResetPerfStats(); const auto perf_results = GetAndResetPerfStats();
constexpr auto performance = Common::Telemetry::FieldType::Performance; constexpr auto performance = Common::Telemetry::FieldType::Performance;
@ -593,11 +576,9 @@ void System::Shutdown(bool is_deserializing) {
is_powered_on = false; is_powered_on = false;
gpu.reset(); gpu.reset();
if (!is_deserializing) { GDBStub::Shutdown();
GDBStub::Shutdown(); perf_stats.reset();
perf_stats.reset(); app_loader.reset();
app_loader.reset();
}
custom_tex_manager.reset(); custom_tex_manager.reset();
telemetry_session.reset(); telemetry_session.reset();
#ifdef ENABLE_SCRIPTING #ifdef ENABLE_SCRIPTING
@ -706,66 +687,4 @@ void System::ApplySettings() {
} }
} }
template <class Archive>
void System::serialize(Archive& ar, const unsigned int file_version) {
u32 num_cores;
if (Archive::is_saving::value) {
num_cores = this->GetNumCores();
}
ar& num_cores;
if (Archive::is_loading::value) {
// When loading, we want to make sure any lingering state gets cleared out before we begin.
// Shutdown, but persist a few things between loads...
Shutdown(true);
// Re-initialize everything like it was before
auto memory_mode = this->app_loader->LoadKernelMemoryMode();
auto n3ds_hw_caps = this->app_loader->LoadNew3dsHwCapabilities();
[[maybe_unused]] const System::ResultStatus result = Init(
*m_emu_window, m_secondary_window, *memory_mode.first, *n3ds_hw_caps.first, num_cores);
}
// Flush on save, don't flush on load
const bool should_flush = !Archive::is_loading::value;
gpu->ClearAll(should_flush);
ar&* timing.get();
for (u32 i = 0; i < num_cores; i++) {
ar&* cpu_cores[i].get();
}
ar&* service_manager.get();
ar&* archive_manager.get();
// NOTE: DSP doesn't like being destroyed and recreated. So instead we do an inline
// serialization; this means that the DSP Settings need to match for loading to work.
auto dsp_hle = dynamic_cast<AudioCore::DspHle*>(dsp_core.get());
if (dsp_hle) {
ar&* dsp_hle;
} else {
throw std::runtime_error("LLE audio not supported for save states");
}
ar&* memory.get();
ar&* kernel.get();
ar&* gpu.get();
ar& movie;
// This needs to be set from somewhere - might as well be here!
if (Archive::is_loading::value) {
timing->UnlockEventQueue();
memory->SetDSP(*dsp_core);
cheat_engine.Connect();
gpu->Sync();
// Re-register gpu callback, because gsp service changed after service_manager got
// serialized
auto gsp = service_manager->GetService<Service::GSP::GSP_GPU>("gsp::Gpu");
gpu->SetInterruptHandler(
[gsp](Service::GSP::InterruptId interrupt_id) { gsp->SignalInterrupt(interrupt_id); });
}
}
SERIALIZE_IMPL(System)
} // namespace Core } // namespace Core

View file

@ -8,8 +8,6 @@
#include <memory> #include <memory>
#include <mutex> #include <mutex>
#include <string> #include <string>
#include <boost/optional.hpp>
#include <boost/serialization/version.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/arm/arm_interface.h" #include "core/arm/arm_interface.h"
#include "core/cheats/cheats.h" #include "core/cheats/cheats.h"
@ -126,7 +124,7 @@ public:
[[nodiscard]] ResultStatus SingleStep(); [[nodiscard]] ResultStatus SingleStep();
/// Shutdown the emulated system. /// Shutdown the emulated system.
void Shutdown(bool is_deserializing = false); void Shutdown();
/// Shutdown and then load again /// Shutdown and then load again
void Reset(); void Reset();
@ -339,9 +337,9 @@ public:
(mic_permission_granted = mic_permission_func()); (mic_permission_granted = mic_permission_func());
} }
void SaveState(u32 slot) const; void SaveState(u32 slot) const {}
void LoadState(u32 slot); void LoadState(u32 slot) {}
/// Self delete ncch /// Self delete ncch
bool SetSelfDelete(const std::string& file) { bool SetSelfDelete(const std::string& file) {
@ -447,12 +445,8 @@ private:
std::function<bool()> mic_permission_func; std::function<bool()> mic_permission_func;
bool mic_permission_granted = false; bool mic_permission_granted = false;
boost::optional<Service::APT::DeliverArg> restore_deliver_arg; std::optional<Service::APT::DeliverArg> restore_deliver_arg;
boost::optional<Service::PLGLDR::PLG_LDR::PluginLoaderContext> restore_plugin_context; std::optional<Service::PLGLDR::PLG_LDR::PluginLoaderContext> restore_plugin_context;
friend class boost::serialization::access;
template <typename Archive>
void serialize(Archive& ar, const unsigned int file_version);
}; };
[[nodiscard]] inline ARM_Interface& GetRunningCore() { [[nodiscard]] inline ARM_Interface& GetRunningCore() {
@ -468,5 +462,3 @@ private:
} }
} // namespace Core } // namespace Core
BOOST_CLASS_VERSION(Core::System, 1)

View file

@ -63,10 +63,6 @@ TimingEventType* Timing::RegisterEvent(const std::string& name, TimedCallback ca
void Timing::ScheduleEvent(s64 cycles_into_future, const TimingEventType* event_type, void Timing::ScheduleEvent(s64 cycles_into_future, const TimingEventType* event_type,
std::uintptr_t user_data, std::size_t core_id, bool thread_safe_mode) { std::uintptr_t user_data, std::size_t core_id, bool thread_safe_mode) {
if (event_queue_locked) {
return;
}
ASSERT(event_type != nullptr); ASSERT(event_type != nullptr);
Timing::Timer* timer = nullptr; Timing::Timer* timer = nullptr;
if (core_id == std::numeric_limits<std::size_t>::max()) { if (core_id == std::numeric_limits<std::size_t>::max()) {
@ -103,9 +99,6 @@ void Timing::ScheduleEvent(s64 cycles_into_future, const TimingEventType* event_
} }
void Timing::UnscheduleEvent(const TimingEventType* event_type, std::uintptr_t user_data) { void Timing::UnscheduleEvent(const TimingEventType* event_type, std::uintptr_t user_data) {
if (event_queue_locked) {
return;
}
for (auto timer : timers) { for (auto timer : timers) {
auto itr = std::remove_if( auto itr = std::remove_if(
timer->event_queue.begin(), timer->event_queue.end(), timer->event_queue.begin(), timer->event_queue.end(),
@ -121,9 +114,6 @@ void Timing::UnscheduleEvent(const TimingEventType* event_type, std::uintptr_t u
} }
void Timing::RemoveEvent(const TimingEventType* event_type) { void Timing::RemoveEvent(const TimingEventType* event_type) {
if (event_queue_locked) {
return;
}
for (auto timer : timers) { for (auto timer : timers) {
auto itr = std::remove_if(timer->event_queue.begin(), timer->event_queue.end(), auto itr = std::remove_if(timer->event_queue.begin(), timer->event_queue.end(),
[&](const Event& e) { return e.type == event_type; }); [&](const Event& e) { return e.type == event_type; });

View file

@ -23,12 +23,9 @@
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <boost/serialization/split_member.hpp>
#include <boost/serialization/vector.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/threadsafe_queue.h" #include "common/threadsafe_queue.h"
#include "core/global.h"
// The timing we get from the assembly is 268,111,855.956 Hz // The timing we get from the assembly is 268,111,855.956 Hz
// It is possible that this number isn't just an integer because the compiler could have // It is possible that this number isn't just an integer because the compiler could have
@ -150,29 +147,6 @@ public:
bool operator>(const Event& right) const; bool operator>(const Event& right) const;
bool operator<(const Event& right) const; bool operator<(const Event& right) const;
private:
template <class Archive>
void save(Archive& ar, const unsigned int) const {
ar& time;
ar& fifo_order;
ar& user_data;
std::string name = *(type->name);
ar << name;
}
template <class Archive>
void load(Archive& ar, const unsigned int) {
ar& time;
ar& fifo_order;
ar& user_data;
std::string name;
ar >> name;
type = Global<Timing>().RegisterEvent(name, nullptr);
}
friend class boost::serialization::access;
BOOST_SERIALIZATION_SPLIT_MEMBER()
}; };
// currently Service::HID::pad_update_ticks is the smallest interval for an event that gets // currently Service::HID::pad_update_ticks is the smallest interval for an event that gets
@ -235,18 +209,6 @@ public:
// Stores a scaling for the internal clockspeed. Changing this number results in // Stores a scaling for the internal clockspeed. Changing this number results in
// under/overclocking the guest cpu // under/overclocking the guest cpu
double cpu_clock_scale = 1.0; double cpu_clock_scale = 1.0;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
MoveEvents();
ar& event_queue;
ar& event_fifo_id;
ar& slice_length;
ar& downcount;
ar& executed_ticks;
ar& idled_cycles;
}
friend class boost::serialization::access;
}; };
explicit Timing(std::size_t num_cores, u32 cpu_clock_percentage, s64 override_base_ticks = -1); explicit Timing(std::size_t num_cores, u32 cpu_clock_percentage, s64 override_base_ticks = -1);
@ -285,11 +247,6 @@ public:
std::shared_ptr<Timer> GetTimer(std::size_t cpu_id); std::shared_ptr<Timer> GetTimer(std::size_t cpu_id);
// Used after deserializing to unprotect the event queue.
void UnlockEventQueue() {
event_queue_locked = false;
}
/// Generates a random tick count to seed the system tick timer with. /// Generates a random tick count to seed the system tick timer with.
static s64 GenerateBaseTicks(); static s64 GenerateBaseTicks();
@ -300,23 +257,6 @@ private:
std::vector<std::shared_ptr<Timer>> timers; std::vector<std::shared_ptr<Timer>> timers;
Timer* current_timer = nullptr; Timer* current_timer = nullptr;
// When true, the event queue can't be modified. Used while deserializing to workaround
// destructor side effects.
bool event_queue_locked = false;
template <class Archive>
void serialize(Archive& ar, const unsigned int file_version) {
// event_types set during initialization of other things
ar& timers;
ar& current_timer;
if (Archive::is_loading::value) {
event_queue_locked = true;
}
}
friend class boost::serialization::access;
}; };
} // namespace Core } // namespace Core
BOOST_CLASS_VERSION(Core::Timing, 1)

View file

@ -8,8 +8,6 @@
#include <string> #include <string>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <boost/serialization/string.hpp>
#include <boost/serialization/vector.hpp>
#include "common/bit_field.h" #include "common/bit_field.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/swap.h" #include "common/swap.h"
@ -67,32 +65,6 @@ private:
std::vector<u8> binary; std::vector<u8> binary;
std::string string; std::string string;
std::u16string u16str; std::u16string u16str;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& type;
switch (type) {
case LowPathType::Binary:
ar& binary;
break;
case LowPathType::Char:
ar& string;
break;
case LowPathType::Wchar: {
std::vector<char16_t> data;
if (Archive::is_saving::value) {
std::copy(u16str.begin(), u16str.end(), std::back_inserter(data));
}
ar& data;
if (Archive::is_loading::value) {
u16str = std::u16string(data.data(), data.size());
}
} break;
default:
break;
}
}
friend class boost::serialization::access;
}; };
/// Parameters of the archive, as specified in the Create or Format call. /// Parameters of the archive, as specified in the Create or Format call.
@ -198,13 +170,6 @@ public:
protected: protected:
std::unique_ptr<DelayGenerator> delay_generator; std::unique_ptr<DelayGenerator> delay_generator;
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& delay_generator;
}
friend class boost::serialization::access;
}; };
class ArchiveFactory : NonCopyable { class ArchiveFactory : NonCopyable {
@ -241,10 +206,6 @@ public:
* @return Format information about the archive or error code * @return Format information about the archive or error code
*/ */
virtual ResultVal<ArchiveFormatInfo> GetFormatInfo(const Path& path, u64 program_id) const = 0; virtual ResultVal<ArchiveFormatInfo> GetFormatInfo(const Path& path, u64 program_id) const = 0;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {}
friend class boost::serialization::access;
}; };
} // namespace FileSys } // namespace FileSys

View file

@ -6,7 +6,7 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <fmt/format.h> #include <fmt/format.h>
#include "common/archives.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "common/logging/log.h" #include "common/logging/log.h"
@ -17,8 +17,6 @@
#include "core/file_sys/savedata_archive.h" #include "core/file_sys/savedata_archive.h"
#include "core/hle/service/fs/archive.h" #include "core/hle/service/fs/archive.h"
SERIALIZE_EXPORT_IMPL(FileSys::ArchiveFactory_ExtSaveData)
namespace FileSys { namespace FileSys {
/** /**
@ -77,8 +75,6 @@ public:
static constexpr u64 IPCDelayNanoseconds(3085068); static constexpr u64 IPCDelayNanoseconds(3085068);
return IPCDelayNanoseconds; return IPCDelayNanoseconds;
} }
SERIALIZE_DELAY_GENERATOR
}; };
/** /**
@ -154,14 +150,6 @@ public:
return std::make_unique<FixSizeDiskFile>(std::move(file), rwmode, return std::make_unique<FixSizeDiskFile>(std::move(file), rwmode,
std::move(delay_generator)); std::move(delay_generator));
} }
private:
ExtSaveDataArchive() = default;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<SaveDataArchive>(*this);
}
friend class boost::serialization::access;
}; };
struct ExtSaveDataArchivePath { struct ExtSaveDataArchivePath {
@ -298,6 +286,3 @@ void ArchiveFactory_ExtSaveData::WriteIcon(const Path& path, std::span<const u8>
} }
} // namespace FileSys } // namespace FileSys
SERIALIZE_EXPORT_IMPL(FileSys::ExtSaveDataDelayGenerator)
SERIALIZE_EXPORT_IMPL(FileSys::ExtSaveDataArchive)

View file

@ -7,8 +7,6 @@
#include <memory> #include <memory>
#include <span> #include <span>
#include <string> #include <string>
#include <boost/serialization/export.hpp>
#include <boost/serialization/string.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/file_sys/archive_backend.h" #include "core/file_sys/archive_backend.h"
#include "core/hle/result.h" #include "core/hle/result.h"
@ -60,15 +58,6 @@ private:
/// Returns a path with the correct SaveIdHigh value for Shared extdata paths. /// Returns a path with the correct SaveIdHigh value for Shared extdata paths.
Path GetCorrectedPath(const Path& path); Path GetCorrectedPath(const Path& path);
ArchiveFactory_ExtSaveData() = default;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<ArchiveFactory>(*this);
ar& type;
ar& mount_point;
}
friend class boost::serialization::access;
}; };
/** /**
@ -111,6 +100,3 @@ Path ConstructExtDataBinaryPath(u32 media_type, u32 high, u32 low);
class ExtSaveDataDelayGenerator; class ExtSaveDataDelayGenerator;
} // namespace FileSys } // namespace FileSys
BOOST_CLASS_EXPORT_KEY(FileSys::ArchiveFactory_ExtSaveData)
BOOST_CLASS_EXPORT_KEY(FileSys::ExtSaveDataDelayGenerator)

View file

@ -7,7 +7,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "bad_word_list.app.romfs.h" #include "bad_word_list.app.romfs.h"
#include "common/archives.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "common/logging/log.h" #include "common/logging/log.h"
@ -26,10 +26,6 @@
#include "mii.app.romfs.h" #include "mii.app.romfs.h"
#include "shared_font.app.romfs.h" #include "shared_font.app.romfs.h"
SERIALIZE_EXPORT_IMPL(FileSys::NCCHArchive)
SERIALIZE_EXPORT_IMPL(FileSys::NCCHFile)
SERIALIZE_EXPORT_IMPL(FileSys::ArchiveFactory_NCCH)
namespace FileSys { namespace FileSys {
struct NCCHArchivePath { struct NCCHArchivePath {

View file

@ -7,9 +7,6 @@
#include <array> #include <array>
#include <memory> #include <memory>
#include <string> #include <string>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp>
#include <boost/serialization/vector.hpp>
#include "core/file_sys/archive_backend.h" #include "core/file_sys/archive_backend.h"
#include "core/file_sys/file_backend.h" #include "core/file_sys/file_backend.h"
#include "core/hle/result.h" #include "core/hle/result.h"
@ -63,17 +60,6 @@ public:
protected: protected:
u64 title_id; u64 title_id;
Service::FS::MediaType media_type; Service::FS::MediaType media_type;
private:
NCCHArchive() = default;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<ArchiveBackend>(*this);
ar& title_id;
ar& media_type;
}
friend class boost::serialization::access;
}; };
// File backend for NCCH files // File backend for NCCH files
@ -93,15 +79,6 @@ public:
private: private:
std::vector<u8> file_buffer; std::vector<u8> file_buffer;
NCCHFile() = default;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<FileBackend>(*this);
ar& file_buffer;
}
friend class boost::serialization::access;
}; };
/// File system interface to the NCCH archive /// File system interface to the NCCH archive
@ -117,17 +94,6 @@ public:
Result Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info, Result Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
u64 program_id) override; u64 program_id) override;
ResultVal<ArchiveFormatInfo> GetFormatInfo(const Path& path, u64 program_id) const override; ResultVal<ArchiveFormatInfo> GetFormatInfo(const Path& path, u64 program_id) const override;
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<ArchiveFactory>(*this);
}
friend class boost::serialization::access;
}; };
} // namespace FileSys } // namespace FileSys
BOOST_CLASS_EXPORT_KEY(FileSys::NCCHArchive)
BOOST_CLASS_EXPORT_KEY(FileSys::NCCHFile)
BOOST_CLASS_EXPORT_KEY(FileSys::ArchiveFactory_NCCH)

View file

@ -4,15 +4,12 @@
#include <tuple> #include <tuple>
#include <utility> #include <utility>
#include "common/archives.h"
#include "core/file_sys/archive_other_savedata.h" #include "core/file_sys/archive_other_savedata.h"
#include "core/file_sys/errors.h" #include "core/file_sys/errors.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
#include "core/hle/service/fs/archive.h" #include "core/hle/service/fs/archive.h"
SERIALIZE_EXPORT_IMPL(FileSys::ArchiveFactory_OtherSaveDataPermitted)
SERIALIZE_EXPORT_IMPL(FileSys::ArchiveFactory_OtherSaveDataGeneral)
namespace FileSys { namespace FileSys {
// TODO(wwylele): The storage info in exheader should be checked before accessing these archives // TODO(wwylele): The storage info in exheader should be checked before accessing these archives

View file

@ -4,9 +4,6 @@
#pragma once #pragma once
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include "core/file_sys/archive_source_sd_savedata.h" #include "core/file_sys/archive_source_sd_savedata.h"
namespace FileSys { namespace FileSys {
@ -28,14 +25,6 @@ public:
private: private:
std::shared_ptr<ArchiveSource_SDSaveData> sd_savedata_source; std::shared_ptr<ArchiveSource_SDSaveData> sd_savedata_source;
ArchiveFactory_OtherSaveDataPermitted() = default;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<ArchiveFactory>(*this);
ar& sd_savedata_source;
}
friend class boost::serialization::access;
}; };
/// File system interface to the OtherSaveDataGeneral archive /// File system interface to the OtherSaveDataGeneral archive
@ -55,17 +44,6 @@ public:
private: private:
std::shared_ptr<ArchiveSource_SDSaveData> sd_savedata_source; std::shared_ptr<ArchiveSource_SDSaveData> sd_savedata_source;
ArchiveFactory_OtherSaveDataGeneral() = default;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<ArchiveFactory>(*this);
ar& sd_savedata_source;
}
friend class boost::serialization::access;
}; };
} // namespace FileSys } // namespace FileSys
BOOST_CLASS_EXPORT_KEY(FileSys::ArchiveFactory_OtherSaveDataPermitted)
BOOST_CLASS_EXPORT_KEY(FileSys::ArchiveFactory_OtherSaveDataGeneral)

View file

@ -3,13 +3,11 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <utility> #include <utility>
#include "common/archives.h"
#include "core/core.h" #include "core/core.h"
#include "core/file_sys/archive_savedata.h" #include "core/file_sys/archive_savedata.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
SERIALIZE_EXPORT_IMPL(FileSys::ArchiveFactory_SaveData)
namespace FileSys { namespace FileSys {
ArchiveFactory_SaveData::ArchiveFactory_SaveData( ArchiveFactory_SaveData::ArchiveFactory_SaveData(

View file

@ -4,8 +4,6 @@
#pragma once #pragma once
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include "core/file_sys/archive_source_sd_savedata.h" #include "core/file_sys/archive_source_sd_savedata.h"
namespace FileSys { namespace FileSys {
@ -27,16 +25,6 @@ public:
private: private:
std::shared_ptr<ArchiveSource_SDSaveData> sd_savedata_source; std::shared_ptr<ArchiveSource_SDSaveData> sd_savedata_source;
ArchiveFactory_SaveData() = default;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<ArchiveFactory>(*this);
ar& sd_savedata_source;
}
friend class boost::serialization::access;
}; };
} // namespace FileSys } // namespace FileSys
BOOST_CLASS_EXPORT_KEY(FileSys::ArchiveFactory_SaveData)

View file

@ -4,7 +4,7 @@
#include <algorithm> #include <algorithm>
#include <memory> #include <memory>
#include "common/archives.h"
#include "common/error.h" #include "common/error.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "common/logging/log.h" #include "common/logging/log.h"
@ -14,9 +14,6 @@
#include "core/file_sys/errors.h" #include "core/file_sys/errors.h"
#include "core/file_sys/path_parser.h" #include "core/file_sys/path_parser.h"
SERIALIZE_EXPORT_IMPL(FileSys::SDMCArchive)
SERIALIZE_EXPORT_IMPL(FileSys::ArchiveFactory_SDMC)
namespace FileSys { namespace FileSys {
class SDMCDelayGenerator : public DelayGenerator { class SDMCDelayGenerator : public DelayGenerator {
@ -39,8 +36,6 @@ public:
static constexpr u64 IPCDelayNanoseconds(269082); static constexpr u64 IPCDelayNanoseconds(269082);
return IPCDelayNanoseconds; return IPCDelayNanoseconds;
} }
SERIALIZE_DELAY_GENERATOR
}; };
ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFile(const Path& path, ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFile(const Path& path,
@ -404,5 +399,3 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_SDMC::GetFormatInfo(const Path& path
return ResultUnknown; return ResultUnknown;
} }
} // namespace FileSys } // namespace FileSys
SERIALIZE_EXPORT_IMPL(FileSys::SDMCDelayGenerator)

View file

@ -6,9 +6,6 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp>
#include <boost/serialization/string.hpp>
#include "core/file_sys/archive_backend.h" #include "core/file_sys/archive_backend.h"
#include "core/hle/result.h" #include "core/hle/result.h"
@ -42,14 +39,6 @@ public:
protected: protected:
ResultVal<std::unique_ptr<FileBackend>> OpenFileBase(const Path& path, const Mode& mode) const; ResultVal<std::unique_ptr<FileBackend>> OpenFileBase(const Path& path, const Mode& mode) const;
std::string mount_point; std::string mount_point;
SDMCArchive() = default;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<ArchiveBackend>(*this);
ar& mount_point;
}
friend class boost::serialization::access;
}; };
/// File system interface to the SDMC archive /// File system interface to the SDMC archive
@ -74,20 +63,8 @@ public:
private: private:
std::string sdmc_directory; std::string sdmc_directory;
ArchiveFactory_SDMC() = default;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<ArchiveFactory>(*this);
ar& sdmc_directory;
}
friend class boost::serialization::access;
}; };
class SDMCDelayGenerator; class SDMCDelayGenerator;
} // namespace FileSys } // namespace FileSys
BOOST_CLASS_EXPORT_KEY(FileSys::SDMCArchive)
BOOST_CLASS_EXPORT_KEY(FileSys::ArchiveFactory_SDMC)
BOOST_CLASS_EXPORT_KEY(FileSys::SDMCDelayGenerator)

View file

@ -3,7 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <memory> #include <memory>
#include "common/archives.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "common/settings.h" #include "common/settings.h"
#include "core/file_sys/archive_sdmcwriteonly.h" #include "core/file_sys/archive_sdmcwriteonly.h"
@ -11,9 +11,6 @@
#include "core/file_sys/errors.h" #include "core/file_sys/errors.h"
#include "core/file_sys/file_backend.h" #include "core/file_sys/file_backend.h"
SERIALIZE_EXPORT_IMPL(FileSys::SDMCWriteOnlyArchive)
SERIALIZE_EXPORT_IMPL(FileSys::ArchiveFactory_SDMCWriteOnly)
namespace FileSys { namespace FileSys {
class SDMCWriteOnlyDelayGenerator : public DelayGenerator { class SDMCWriteOnlyDelayGenerator : public DelayGenerator {
@ -36,8 +33,6 @@ public:
static constexpr u64 IPCDelayNanoseconds(269082); static constexpr u64 IPCDelayNanoseconds(269082);
return IPCDelayNanoseconds; return IPCDelayNanoseconds;
} }
SERIALIZE_DELAY_GENERATOR
}; };
ResultVal<std::unique_ptr<FileBackend>> SDMCWriteOnlyArchive::OpenFile(const Path& path, ResultVal<std::unique_ptr<FileBackend>> SDMCWriteOnlyArchive::OpenFile(const Path& path,
@ -97,5 +92,3 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_SDMCWriteOnly::GetFormatInfo(const P
} }
} // namespace FileSys } // namespace FileSys
SERIALIZE_EXPORT_IMPL(FileSys::SDMCWriteOnlyDelayGenerator)

View file

@ -28,14 +28,6 @@ public:
const Mode& mode) const override; const Mode& mode) const override;
ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const override; ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const override;
private:
SDMCWriteOnlyArchive() = default;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<SDMCArchive>(*this);
}
friend class boost::serialization::access;
}; };
/// File system interface to the SDMC write-only archive /// File system interface to the SDMC write-only archive
@ -60,20 +52,8 @@ public:
private: private:
std::string sdmc_directory; std::string sdmc_directory;
ArchiveFactory_SDMCWriteOnly() = default;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<ArchiveFactory>(*this);
ar& sdmc_directory;
}
friend class boost::serialization::access;
}; };
class SDMCWriteOnlyDelayGenerator; class SDMCWriteOnlyDelayGenerator;
} // namespace FileSys } // namespace FileSys
BOOST_CLASS_EXPORT_KEY(FileSys::SDMCWriteOnlyArchive)
BOOST_CLASS_EXPORT_KEY(FileSys::ArchiveFactory_SDMCWriteOnly)
BOOST_CLASS_EXPORT_KEY(FileSys::SDMCWriteOnlyDelayGenerator)

View file

@ -3,7 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <array> #include <array>
#include "common/archives.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/swap.h" #include "common/swap.h"
@ -13,8 +13,6 @@
#include "core/file_sys/ivfc_archive.h" #include "core/file_sys/ivfc_archive.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
SERIALIZE_EXPORT_IMPL(FileSys::ArchiveFactory_SelfNCCH)
namespace FileSys { namespace FileSys {
enum class SelfNCCHFilePathType : u32 { enum class SelfNCCHFilePathType : u32 {
@ -73,15 +71,6 @@ public:
private: private:
std::shared_ptr<std::vector<u8>> data; std::shared_ptr<std::vector<u8>> data;
ExeFSSectionFile() = default;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<FileBackend>(*this);
ar& data;
}
friend class boost::serialization::access;
}; };
// SelfNCCHArchive represents the running application itself. From this archive the application can // SelfNCCHArchive represents the running application itself. From this archive the application can
@ -235,15 +224,6 @@ private:
} }
NCCHData ncch_data; NCCHData ncch_data;
SelfNCCHArchive() = default;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<ArchiveBackend>(*this);
ar& ncch_data;
}
friend class boost::serialization::access;
}; };
void ArchiveFactory_SelfNCCH::Register(Loader::AppLoader& app_loader) { void ArchiveFactory_SelfNCCH::Register(Loader::AppLoader& app_loader) {
@ -309,6 +289,3 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_SelfNCCH::GetFormatInfo(const Path&,
} }
} // namespace FileSys } // namespace FileSys
SERIALIZE_EXPORT_IMPL(FileSys::ExeFSSectionFile)
SERIALIZE_EXPORT_IMPL(FileSys::SelfNCCHArchive)

View file

@ -8,10 +8,6 @@
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <boost/serialization/export.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/unordered_map.hpp>
#include <boost/serialization/vector.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/file_sys/archive_backend.h" #include "core/file_sys/archive_backend.h"
#include "core/hle/result.h" #include "core/hle/result.h"
@ -25,17 +21,6 @@ struct NCCHData {
std::shared_ptr<std::vector<u8>> banner; std::shared_ptr<std::vector<u8>> banner;
std::shared_ptr<RomFSReader> romfs_file; std::shared_ptr<RomFSReader> romfs_file;
std::shared_ptr<RomFSReader> update_romfs_file; std::shared_ptr<RomFSReader> update_romfs_file;
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& icon;
ar& logo;
ar& banner;
ar& romfs_file;
ar& update_romfs_file;
}
friend class boost::serialization::access;
}; };
/// File system interface to the SelfNCCH archive /// File system interface to the SelfNCCH archive
@ -57,20 +42,9 @@ public:
private: private:
/// Mapping of ProgramId -> NCCHData /// Mapping of ProgramId -> NCCHData
std::unordered_map<u64, NCCHData> ncch_data; std::unordered_map<u64, NCCHData> ncch_data;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<ArchiveFactory>(*this);
ar& ncch_data;
}
friend class boost::serialization::access;
}; };
class ExeFSSectionFile; class ExeFSSectionFile;
class SelfNCCHArchive; class SelfNCCHArchive;
} // namespace FileSys } // namespace FileSys
BOOST_CLASS_EXPORT_KEY(FileSys::ArchiveFactory_SelfNCCH)
BOOST_CLASS_EXPORT_KEY(FileSys::ExeFSSectionFile)
BOOST_CLASS_EXPORT_KEY(FileSys::SelfNCCHArchive)

View file

@ -3,7 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <fmt/format.h> #include <fmt/format.h>
#include "common/archives.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/file_sys/archive_source_sd_savedata.h" #include "core/file_sys/archive_source_sd_savedata.h"
@ -11,8 +11,6 @@
#include "core/file_sys/savedata_archive.h" #include "core/file_sys/savedata_archive.h"
#include "core/hle/service/fs/archive.h" #include "core/hle/service/fs/archive.h"
SERIALIZE_EXPORT_IMPL(FileSys::ArchiveSource_SDSaveData)
namespace FileSys { namespace FileSys {
namespace { namespace {

View file

@ -6,8 +6,6 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <boost/serialization/export.hpp>
#include <boost/serialization/string.hpp>
#include "core/file_sys/archive_backend.h" #include "core/file_sys/archive_backend.h"
#include "core/hle/result.h" #include "core/hle/result.h"
@ -26,15 +24,6 @@ public:
private: private:
std::string mount_point; std::string mount_point;
ArchiveSource_SDSaveData() = default;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& mount_point;
}
friend class boost::serialization::access;
}; };
} // namespace FileSys } // namespace FileSys
BOOST_CLASS_EXPORT_KEY(FileSys::ArchiveSource_SDSaveData)

View file

@ -7,7 +7,7 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <fmt/format.h> #include <fmt/format.h>
#include "common/archives.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "core/file_sys/archive_systemsavedata.h" #include "core/file_sys/archive_systemsavedata.h"
@ -15,8 +15,6 @@
#include "core/file_sys/savedata_archive.h" #include "core/file_sys/savedata_archive.h"
#include "core/hle/service/fs/archive.h" #include "core/hle/service/fs/archive.h"
SERIALIZE_EXPORT_IMPL(FileSys::ArchiveFactory_SystemSaveData)
namespace FileSys { namespace FileSys {
std::string GetSystemSaveDataPath(std::string_view mount_point, const Path& path) { std::string GetSystemSaveDataPath(std::string_view mount_point, const Path& path) {

View file

@ -6,8 +6,6 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <boost/serialization/export.hpp>
#include <boost/serialization/string.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/file_sys/archive_backend.h" #include "core/file_sys/archive_backend.h"
#include "core/hle/result.h" #include "core/hle/result.h"
@ -30,14 +28,6 @@ public:
private: private:
std::string base_path; std::string base_path;
ArchiveFactory_SystemSaveData() = default;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<ArchiveFactory>(*this);
ar& base_path;
}
friend class boost::serialization::access;
}; };
/** /**
@ -67,5 +57,3 @@ std::string GetSystemSaveDataContainerPath(std::string_view mount_point);
Path ConstructSystemSaveDataBinaryPath(u32 high, u32 low); Path ConstructSystemSaveDataBinaryPath(u32 high, u32 low);
} // namespace FileSys } // namespace FileSys
BOOST_CLASS_EXPORT_KEY(FileSys::ArchiveFactory_SystemSaveData)

View file

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

View file

@ -5,18 +5,8 @@
#pragma once #pragma once
#include <cstddef> #include <cstddef>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#define SERIALIZE_DELAY_GENERATOR \
private: \
template <class Archive> \
void serialize(Archive& ar, const unsigned int) { \
ar& boost::serialization::base_object<DelayGenerator>(*this); \
} \
friend class boost::serialization::access;
namespace FileSys { namespace FileSys {
class DelayGenerator { class DelayGenerator {
@ -26,20 +16,12 @@ public:
virtual u64 GetOpenDelayNs() = 0; virtual u64 GetOpenDelayNs() = 0;
// TODO (B3N30): Add getter for all other file/directory io operations // TODO (B3N30): Add getter for all other file/directory io operations
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {}
friend class boost::serialization::access;
}; };
class DefaultDelayGenerator : public DelayGenerator { class DefaultDelayGenerator : public DelayGenerator {
public: public:
u64 GetReadDelayNs(std::size_t length) override; u64 GetReadDelayNs(std::size_t length) override;
u64 GetOpenDelayNs() override; u64 GetOpenDelayNs() override;
SERIALIZE_DELAY_GENERATOR
}; };
} // namespace FileSys } // namespace FileSys
BOOST_CLASS_EXPORT_KEY(FileSys::DefaultDelayGenerator);

View file

@ -50,11 +50,6 @@ public:
* @return true if the directory closed correctly * @return true if the directory closed correctly
*/ */
virtual bool Close() const = 0; virtual bool Close() const = 0;
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {}
friend class boost::serialization::access;
}; };
} // namespace FileSys } // namespace FileSys

View file

@ -4,16 +4,13 @@
#include <algorithm> #include <algorithm>
#include <memory> #include <memory>
#include "common/archives.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/file_sys/disk_archive.h" #include "core/file_sys/disk_archive.h"
#include "core/file_sys/errors.h" #include "core/file_sys/errors.h"
SERIALIZE_EXPORT_IMPL(FileSys::DiskFile)
SERIALIZE_EXPORT_IMPL(FileSys::DiskDirectory)
namespace FileSys { namespace FileSys {
ResultVal<std::size_t> DiskFile::Read(const u64 offset, const std::size_t length, ResultVal<std::size_t> DiskFile::Read(const u64 offset, const std::size_t length,

View file

@ -8,9 +8,6 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/unique_ptr.hpp>
#include <boost/serialization/vector.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "core/file_sys/archive_backend.h" #include "core/file_sys/archive_backend.h"
@ -43,17 +40,6 @@ public:
protected: protected:
Mode mode; Mode mode;
std::unique_ptr<FileUtil::IOFile> file; std::unique_ptr<FileUtil::IOFile> file;
private:
DiskFile() = default;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<FileBackend>(*this);
ar& mode.hex;
ar& file;
}
friend class boost::serialization::access;
}; };
class DiskDirectory : public DirectoryBackend { class DiskDirectory : public DirectoryBackend {
@ -76,27 +62,6 @@ protected:
// We need to remember the last entry we returned, so a subsequent call to Read will continue // We need to remember the last entry we returned, so a subsequent call to Read will continue
// from the next one. This iterator will always point to the next unread entry. // from the next one. This iterator will always point to the next unread entry.
std::vector<FileUtil::FSTEntry>::iterator children_iterator; std::vector<FileUtil::FSTEntry>::iterator children_iterator;
private:
DiskDirectory() = default;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<DirectoryBackend>(*this);
ar& directory;
u64 child_index;
if (Archive::is_saving::value) {
child_index = children_iterator - directory.children.begin();
}
ar& child_index;
if (Archive::is_loading::value) {
children_iterator = directory.children.begin() + child_index;
}
}
friend class boost::serialization::access;
}; };
} // namespace FileSys } // namespace FileSys
BOOST_CLASS_EXPORT_KEY(FileSys::DiskFile)
BOOST_CLASS_EXPORT_KEY(FileSys::DiskDirectory)

View file

@ -7,7 +7,6 @@
#include <algorithm> #include <algorithm>
#include <cstddef> #include <cstddef>
#include <memory> #include <memory>
#include <boost/serialization/unique_ptr.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/result.h" #include "core/hle/result.h"
#include "delay_generator.h" #include "delay_generator.h"
@ -102,12 +101,6 @@ public:
protected: protected:
std::unique_ptr<DelayGenerator> delay_generator; std::unique_ptr<DelayGenerator> delay_generator;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& delay_generator;
}
friend class boost::serialization::access;
}; };
} // namespace FileSys } // namespace FileSys

View file

@ -5,17 +5,11 @@
#include <cstring> #include <cstring>
#include <memory> #include <memory>
#include <utility> #include <utility>
#include "common/archives.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/file_sys/ivfc_archive.h" #include "core/file_sys/ivfc_archive.h"
SERIALIZE_EXPORT_IMPL(FileSys::IVFCFile)
SERIALIZE_EXPORT_IMPL(FileSys::IVFCFileInMemory)
SERIALIZE_EXPORT_IMPL(FileSys::IVFCDelayGenerator)
SERIALIZE_EXPORT_IMPL(FileSys::RomFSDelayGenerator)
SERIALIZE_EXPORT_IMPL(FileSys::ExeFSDelayGenerator)
namespace FileSys { namespace FileSys {
IVFCArchive::IVFCArchive(std::shared_ptr<RomFSReader> file, IVFCArchive::IVFCArchive(std::shared_ptr<RomFSReader> file,

View file

@ -8,8 +8,6 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include <boost/serialization/export.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "core/file_sys/archive_backend.h" #include "core/file_sys/archive_backend.h"
@ -37,8 +35,6 @@ class IVFCDelayGenerator : public DelayGenerator {
static constexpr u64 IPCDelayNanoseconds(9438006); static constexpr u64 IPCDelayNanoseconds(9438006);
return IPCDelayNanoseconds; return IPCDelayNanoseconds;
} }
SERIALIZE_DELAY_GENERATOR
}; };
class RomFSDelayGenerator : public DelayGenerator { class RomFSDelayGenerator : public DelayGenerator {
@ -61,8 +57,6 @@ public:
static constexpr u64 IPCDelayNanoseconds(9438006); static constexpr u64 IPCDelayNanoseconds(9438006);
return IPCDelayNanoseconds; return IPCDelayNanoseconds;
} }
SERIALIZE_DELAY_GENERATOR
}; };
class ExeFSDelayGenerator : public DelayGenerator { class ExeFSDelayGenerator : public DelayGenerator {
@ -85,8 +79,6 @@ public:
static constexpr u64 IPCDelayNanoseconds(9438006); static constexpr u64 IPCDelayNanoseconds(9438006);
return IPCDelayNanoseconds; return IPCDelayNanoseconds;
} }
SERIALIZE_DELAY_GENERATOR
}; };
/** /**
@ -141,15 +133,6 @@ public:
private: private:
std::shared_ptr<RomFSReader> romfs_file; std::shared_ptr<RomFSReader> romfs_file;
IVFCFile() = default;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<FileBackend>(*this);
ar& romfs_file;
}
friend class boost::serialization::access;
}; };
class IVFCDirectory : public DirectoryBackend { class IVFCDirectory : public DirectoryBackend {
@ -181,23 +164,6 @@ private:
std::vector<u8> romfs_file; std::vector<u8> romfs_file;
u64 data_offset; u64 data_offset;
u64 data_size; u64 data_size;
IVFCFileInMemory() = default;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<FileBackend>(*this);
ar& romfs_file;
ar& data_offset;
ar& data_size;
}
friend class boost::serialization::access;
}; };
} // namespace FileSys } // namespace FileSys
BOOST_CLASS_EXPORT_KEY(FileSys::IVFCFile)
BOOST_CLASS_EXPORT_KEY(FileSys::IVFCFileInMemory)
BOOST_CLASS_EXPORT_KEY(FileSys::IVFCDelayGenerator)
BOOST_CLASS_EXPORT_KEY(FileSys::RomFSDelayGenerator)
BOOST_CLASS_EXPORT_KEY(FileSys::ExeFSDelayGenerator)

View file

@ -5,7 +5,7 @@
#include <algorithm> #include <algorithm>
#include <cstring> #include <cstring>
#include "common/alignment.h" #include "common/alignment.h"
#include "common/archives.h"
#include "common/assert.h" #include "common/assert.h"
#include "common/common_paths.h" #include "common/common_paths.h"
#include "common/file_util.h" #include "common/file_util.h"
@ -14,8 +14,6 @@
#include "core/file_sys/layered_fs.h" #include "core/file_sys/layered_fs.h"
#include "core/file_sys/patch.h" #include "core/file_sys/patch.h"
SERIALIZE_EXPORT_IMPL(FileSys::LayeredFS)
namespace FileSys { namespace FileSys {
struct FileRelocationInfo { struct FileRelocationInfo {
@ -54,8 +52,6 @@ struct FileMetadata {
}; };
static_assert(sizeof(FileMetadata) == 0x20, "Size of FileMetadata is not correct"); static_assert(sizeof(FileMetadata) == 0x20, "Size of FileMetadata is not correct");
LayeredFS::LayeredFS() = default;
LayeredFS::LayeredFS(std::shared_ptr<RomFSReader> romfs_, std::string patch_path_, LayeredFS::LayeredFS(std::shared_ptr<RomFSReader> romfs_, std::string patch_path_,
std::string patch_ext_path_, bool load_relocations_) std::string patch_ext_path_, bool load_relocations_)
: romfs(std::move(romfs_)), patch_path(std::move(patch_path_)), : romfs(std::move(romfs_)), patch_path(std::move(patch_path_)),

View file

@ -9,10 +9,6 @@
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/string.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/swap.h" #include "common/swap.h"
#include "core/file_sys/romfs_reader.h" #include "core/file_sys/romfs_reader.h"
@ -135,24 +131,6 @@ private:
u64 current_file_offset{}; // current file metadata offset u64 current_file_offset{}; // current file metadata offset
std::vector<u8> file_metadata_table; // rebuilt file metadata table std::vector<u8> file_metadata_table; // rebuilt file metadata table
u64 current_data_offset{}; // current assigned data offset u64 current_data_offset{}; // current assigned data offset
LayeredFS();
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<RomFSReader>(*this);
ar& romfs;
ar& patch_path;
ar& patch_ext_path;
ar& load_relocations;
if (Archive::is_loading::value) {
Load();
}
// NOTE: Everything else is essentially cached, updated when we call Load
}
friend class boost::serialization::access;
}; };
} // namespace FileSys } // namespace FileSys
BOOST_CLASS_EXPORT_KEY(FileSys::LayeredFS)

View file

@ -2,12 +2,10 @@
#include <vector> #include <vector>
#include <cryptopp/aes.h> #include <cryptopp/aes.h>
#include <cryptopp/modes.h> #include <cryptopp/modes.h>
#include "common/archives.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/file_sys/romfs_reader.h" #include "core/file_sys/romfs_reader.h"
SERIALIZE_EXPORT_IMPL(FileSys::DirectRomFSReader)
namespace FileSys { namespace FileSys {
std::size_t DirectRomFSReader::ReadFile(std::size_t offset, std::size_t length, u8* buffer) { std::size_t DirectRomFSReader::ReadFile(std::size_t offset, std::size_t length, u8* buffer) {

View file

@ -2,9 +2,6 @@
#include <array> #include <array>
#include <shared_mutex> #include <shared_mutex>
#include <boost/serialization/array.hpp>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp>
#include "common/alignment.h" #include "common/alignment.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/file_util.h" #include "common/file_util.h"
@ -23,11 +20,6 @@ public:
virtual std::size_t ReadFile(std::size_t offset, std::size_t length, u8* buffer) = 0; virtual std::size_t ReadFile(std::size_t offset, std::size_t length, u8* buffer) = 0;
virtual bool AllowsCachedReads() const = 0; virtual bool AllowsCachedReads() const = 0;
virtual bool CacheReady(std::size_t file_offset, std::size_t length) = 0; virtual bool CacheReady(std::size_t file_offset, std::size_t length) = 0;
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int file_version) {}
friend class boost::serialization::access;
}; };
/** /**
@ -82,21 +74,6 @@ private:
std::vector<std::pair<std::size_t, std::size_t>> BreakupRead(std::size_t offset, std::vector<std::pair<std::size_t, std::size_t>> BreakupRead(std::size_t offset,
std::size_t length); std::size_t length);
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<RomFSReader>(*this);
ar& is_encrypted;
ar& file;
ar& key;
ar& ctr;
ar& file_offset;
ar& crypto_offset;
ar& data_size;
}
friend class boost::serialization::access;
}; };
} // namespace FileSys } // namespace FileSys
BOOST_CLASS_EXPORT_KEY(FileSys::DirectRomFSReader)

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/archives.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "core/file_sys/disk_archive.h" #include "core/file_sys/disk_archive.h"
#include "core/file_sys/errors.h" #include "core/file_sys/errors.h"
@ -31,8 +30,6 @@ public:
static constexpr u64 IPCDelayNanoseconds(269082); static constexpr u64 IPCDelayNanoseconds(269082);
return IPCDelayNanoseconds; return IPCDelayNanoseconds;
} }
SERIALIZE_DELAY_GENERATOR
}; };
ResultVal<std::unique_ptr<FileBackend>> SaveDataArchive::OpenFile(const Path& path, ResultVal<std::unique_ptr<FileBackend>> SaveDataArchive::OpenFile(const Path& path,
@ -355,6 +352,3 @@ u64 SaveDataArchive::GetFreeBytes() const {
} }
} // namespace FileSys } // namespace FileSys
SERIALIZE_EXPORT_IMPL(FileSys::SaveDataArchive)
SERIALIZE_EXPORT_IMPL(FileSys::SaveDataDelayGenerator)

View file

@ -37,23 +37,9 @@ public:
protected: protected:
std::string mount_point; std::string mount_point;
bool allow_zero_size_create; bool allow_zero_size_create;
SaveDataArchive() = default;
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<ArchiveBackend>(*this);
ar& mount_point;
ar& allow_zero_size_create;
}
friend class boost::serialization::access;
}; };
class SaveDataDelayGenerator; class SaveDataDelayGenerator;
class ExtSaveDataArchive; class ExtSaveDataArchive;
} // namespace FileSys } // namespace FileSys
BOOST_CLASS_EXPORT_KEY(FileSys::SaveDataArchive)
BOOST_CLASS_EXPORT_KEY(FileSys::SaveDataDelayGenerator)
BOOST_CLASS_EXPORT_KEY(FileSys::ExtSaveDataArchive)

View file

@ -1,21 +0,0 @@
// Copyright 2020 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
namespace Core {
template <class T>
T& Global();
// Declare explicit specialisation to prevent automatic instantiation
class System;
template <>
System& Global();
class Timing;
template <>
Timing& Global();
} // namespace Core

View file

@ -3,11 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <algorithm> #include <algorithm>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/string.hpp>
#include <boost/serialization/vector.hpp>
#include "common/archives.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/hle/kernel/address_arbiter.h" #include "core/hle/kernel/address_arbiter.h"
@ -17,9 +13,6 @@
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
#include "core/memory.h" #include "core/memory.h"
SERIALIZE_EXPORT_IMPL(Kernel::AddressArbiter)
SERIALIZE_EXPORT_IMPL(Kernel::AddressArbiter::Callback)
namespace Kernel { namespace Kernel {
void AddressArbiter::WaitThread(std::shared_ptr<Thread> thread, VAddr wait_address) { void AddressArbiter::WaitThread(std::shared_ptr<Thread> thread, VAddr wait_address) {
@ -98,13 +91,6 @@ public:
std::shared_ptr<WaitObject> object) override { std::shared_ptr<WaitObject> object) override {
parent.WakeUp(reason, std::move(thread), std::move(object)); parent.WakeUp(reason, std::move(thread), std::move(object));
} }
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<WakeupCallback>(*this);
}
friend class boost::serialization::access;
}; };
void AddressArbiter::WakeUp(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, void AddressArbiter::WakeUp(ThreadWakeupReason reason, std::shared_ptr<Thread> thread,
@ -190,31 +176,4 @@ Result AddressArbiter::ArbitrateAddress(std::shared_ptr<Thread> thread, Arbitrat
return ResultSuccess; return ResultSuccess;
} }
template <class Archive>
void AddressArbiter::serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<Object>(*this);
ar& name;
ar& waiting_threads;
ar& timeout_callback;
ar& resource_limit;
}
SERIALIZE_IMPL(AddressArbiter)
} // namespace Kernel } // namespace Kernel
namespace boost::serialization {
template <class Archive>
void save_construct_data(Archive& ar, const Kernel::AddressArbiter::Callback* t,
const unsigned int) {
ar << Kernel::SharedFrom(&t->parent);
}
template <class Archive>
void load_construct_data(Archive& ar, Kernel::AddressArbiter::Callback* t, const unsigned int) {
std::shared_ptr<Kernel::AddressArbiter> parent;
ar >> parent;
::new (t) Kernel::AddressArbiter::Callback(*parent);
}
} // namespace boost::serialization

View file

@ -6,7 +6,6 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <boost/serialization/export.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
@ -75,14 +74,6 @@ private:
void WakeUp(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, void WakeUp(ThreadWakeupReason reason, std::shared_ptr<Thread> thread,
std::shared_ptr<WaitObject> object) override; std::shared_ptr<WaitObject> object) override;
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int);
}; };
} // namespace Kernel } // namespace Kernel
BOOST_CLASS_EXPORT_KEY(Kernel::AddressArbiter)
BOOST_CLASS_EXPORT_KEY(Kernel::AddressArbiter::Callback)
CONSTRUCT_KERNEL_OBJECT(Kernel::AddressArbiter)

View file

@ -2,11 +2,8 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/string.hpp>
#include "common/archives.h"
#include "common/assert.h" #include "common/assert.h"
#include "core/global.h"
#include "core/hle/kernel/client_port.h" #include "core/hle/kernel/client_port.h"
#include "core/hle/kernel/client_session.h" #include "core/hle/kernel/client_session.h"
#include "core/hle/kernel/errors.h" #include "core/hle/kernel/errors.h"
@ -15,8 +12,6 @@
#include "core/hle/kernel/server_port.h" #include "core/hle/kernel/server_port.h"
#include "core/hle/kernel/server_session.h" #include "core/hle/kernel/server_session.h"
SERIALIZE_EXPORT_IMPL(Kernel::ClientPort)
namespace Kernel { namespace Kernel {
ClientPort::ClientPort(KernelSystem& kernel) : Object(kernel), kernel(kernel) {} ClientPort::ClientPort(KernelSystem& kernel) : Object(kernel), kernel(kernel) {}
@ -50,14 +45,4 @@ void ClientPort::ConnectionClosed() {
--active_sessions; --active_sessions;
} }
template <class Archive>
void ClientPort::serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<Object>(*this);
ar& server_port;
ar& max_sessions;
ar& active_sessions;
ar& name;
}
SERIALIZE_IMPL(ClientPort)
} // namespace Kernel } // namespace Kernel

View file

@ -6,7 +6,6 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <boost/serialization/export.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
#include "core/hle/kernel/server_port.h" #include "core/hle/kernel/server_port.h"
@ -60,14 +59,6 @@ private:
std::string name; ///< Name of client port (optional) std::string name; ///< Name of client port (optional)
friend class KernelSystem; friend class KernelSystem;
private:
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int);
}; };
} // namespace Kernel } // namespace Kernel
BOOST_CLASS_EXPORT_KEY(Kernel::ClientPort)
CONSTRUCT_KERNEL_OBJECT(Kernel::ClientPort)

View file

@ -2,10 +2,6 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/string.hpp>
#include "common/archives.h"
#include "common/assert.h" #include "common/assert.h"
#include "core/hle/kernel/client_session.h" #include "core/hle/kernel/client_session.h"
#include "core/hle/kernel/errors.h" #include "core/hle/kernel/errors.h"
@ -14,8 +10,6 @@
#include "core/hle/kernel/session.h" #include "core/hle/kernel/session.h"
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
SERIALIZE_EXPORT_IMPL(Kernel::ClientSession)
namespace Kernel { namespace Kernel {
ClientSession::ClientSession(KernelSystem& kernel) : Object(kernel) {} ClientSession::ClientSession(KernelSystem& kernel) : Object(kernel) {}
@ -56,12 +50,4 @@ Result ClientSession::SendSyncRequest(std::shared_ptr<Thread> thread) {
return server->HandleSyncRequest(std::move(thread)); return server->HandleSyncRequest(std::move(thread));
} }
template <class Archive>
void ClientSession::serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<Object>(*this);
ar& name;
ar& parent;
}
SERIALIZE_IMPL(ClientSession)
} // namespace Kernel } // namespace Kernel

View file

@ -6,7 +6,6 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <boost/serialization/export.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
#include "core/hle/result.h" #include "core/hle/result.h"
@ -47,14 +46,6 @@ public:
/// The parent session, which links to the server endpoint. /// The parent session, which links to the server endpoint.
std::shared_ptr<Session> parent; std::shared_ptr<Session> parent;
private:
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int);
}; };
} // namespace Kernel } // namespace Kernel
BOOST_CLASS_EXPORT_KEY(Kernel::ClientSession)
CONSTRUCT_KERNEL_OBJECT(Kernel::ClientSession)

View file

@ -3,11 +3,8 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <cstring> #include <cstring>
#include <boost/serialization/binary_object.hpp>
#include "common/archives.h"
#include "core/hle/kernel/config_mem.h"
SERIALIZE_EXPORT_IMPL(ConfigMem::Handler) #include "core/hle/kernel/config_mem.h"
namespace ConfigMem { namespace ConfigMem {
@ -32,11 +29,4 @@ ConfigMemDef& Handler::GetConfigMem() {
return config_mem; return config_mem;
} }
template <class Archive>
void Handler::serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<BackingMem>(*this);
ar& boost::serialization::make_binary_object(&config_mem, sizeof(config_mem));
}
SERIALIZE_IMPL(Handler)
} // namespace ConfigMem } // namespace ConfigMem

View file

@ -9,7 +9,6 @@
// bootrom. Because we're not emulating this, and essentially just "stubbing" the functionality, I'm // bootrom. Because we're not emulating this, and essentially just "stubbing" the functionality, I'm
// putting this as a subset of HLE for now. // putting this as a subset of HLE for now.
#include <boost/serialization/export.hpp>
#include "common/common_funcs.h" #include "common/common_funcs.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/memory_ref.h" #include "common/memory_ref.h"
@ -68,12 +67,6 @@ public:
private: private:
ConfigMemDef config_mem; ConfigMemDef config_mem;
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int);
}; };
} // namespace ConfigMem } // namespace ConfigMem
BOOST_CLASS_EXPORT_KEY(ConfigMem::Handler)

View file

@ -2,17 +2,12 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/string.hpp>
#include "common/archives.h"
#include "common/assert.h" #include "common/assert.h"
#include "core/hle/kernel/event.h" #include "core/hle/kernel/event.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/resource_limit.h" #include "core/hle/kernel/resource_limit.h"
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
SERIALIZE_EXPORT_IMPL(Kernel::Event)
namespace Kernel { namespace Kernel {
Event::Event(KernelSystem& kernel) : WaitObject(kernel) {} Event::Event(KernelSystem& kernel) : WaitObject(kernel) {}
@ -60,14 +55,4 @@ void Event::WakeupAllWaitingThreads() {
} }
} }
template <class Archive>
void Event::serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<WaitObject>(*this);
ar& reset_type;
ar& signaled;
ar& name;
ar& resource_limit;
}
SERIALIZE_IMPL(Event)
} // namespace Kernel } // namespace Kernel

View file

@ -4,7 +4,6 @@
#pragma once #pragma once
#include <boost/serialization/export.hpp>
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
#include "core/hle/kernel/resource_limit.h" #include "core/hle/kernel/resource_limit.h"
#include "core/hle/kernel/wait_object.h" #include "core/hle/kernel/wait_object.h"
@ -52,13 +51,6 @@ private:
std::string name; ///< Name of event (optional) std::string name; ///< Name of event (optional)
friend class KernelSystem; friend class KernelSystem;
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int);
}; };
} // namespace Kernel } // namespace Kernel
BOOST_CLASS_EXPORT_KEY(Kernel::Event)
CONSTRUCT_KERNEL_OBJECT(Kernel::Event)

View file

@ -3,9 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <utility> #include <utility>
#include <boost/serialization/array.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include "common/archives.h"
#include "common/assert.h" #include "common/assert.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/hle/kernel/errors.h" #include "core/hle/kernel/errors.h"
@ -13,8 +11,6 @@
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
SERIALIZE_EXPORT_IMPL(Kernel::HandleTable)
namespace Kernel { namespace Kernel {
namespace { namespace {
constexpr u16 GetSlot(Handle handle) { constexpr u16 GetSlot(Handle handle) {
@ -99,13 +95,4 @@ void HandleTable::Clear() {
next_free_slot = 0; next_free_slot = 0;
} }
template <class Archive>
void HandleTable::serialize(Archive& ar, const unsigned int) {
ar& objects;
ar& generations;
ar& next_generation;
ar& next_free_slot;
}
SERIALIZE_IMPL(HandleTable)
} // namespace Kernel } // namespace Kernel

View file

@ -7,7 +7,6 @@
#include <array> #include <array>
#include <cstddef> #include <cstddef>
#include <memory> #include <memory>
#include <boost/serialization/export.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
#include "core/hle/result.h" #include "core/hle/result.h"
@ -117,13 +116,6 @@ private:
u16 next_free_slot; u16 next_free_slot;
KernelSystem& kernel; KernelSystem& kernel;
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int);
}; };
} // namespace Kernel } // namespace Kernel
BOOST_CLASS_EXPORT_KEY(Kernel::HandleTable)
CONSTRUCT_KERNEL_OBJECT(Kernel::HandleTable)

View file

@ -4,11 +4,7 @@
#include <algorithm> #include <algorithm>
#include <vector> #include <vector>
#include <boost/serialization/assume_abstract.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/unique_ptr.hpp>
#include <boost/serialization/vector.hpp>
#include "common/archives.h"
#include "common/assert.h" #include "common/assert.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "core/core.h" #include "core/core.h"
@ -19,12 +15,6 @@
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
SERIALIZE_EXPORT_IMPL(Kernel::SessionRequestHandler)
SERIALIZE_EXPORT_IMPL(Kernel::SessionRequestHandler::SessionDataBase)
SERIALIZE_EXPORT_IMPL(Kernel::SessionRequestHandler::SessionInfo)
SERIALIZE_EXPORT_IMPL(Kernel::HLERequestContext)
SERIALIZE_EXPORT_IMPL(Kernel::HLERequestContext::ThreadCallback)
namespace Kernel { namespace Kernel {
class HLERequestContext::ThreadCallback : public Kernel::WakeupCallback { class HLERequestContext::ThreadCallback : public Kernel::WakeupCallback {
@ -57,17 +47,8 @@ public:
} }
private: private:
ThreadCallback() = default;
std::shared_ptr<HLERequestContext::WakeupCallback> callback{}; std::shared_ptr<HLERequestContext::WakeupCallback> callback{};
std::shared_ptr<HLERequestContext> context{}; std::shared_ptr<HLERequestContext> context{};
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<Kernel::WakeupCallback>(*this);
ar& callback;
ar& context;
}
friend class boost::serialization::access;
}; };
SessionRequestHandler::SessionInfo::SessionInfo(std::shared_ptr<ServerSession> session, SessionRequestHandler::SessionInfo::SessionInfo(std::shared_ptr<ServerSession> session,
@ -87,23 +68,6 @@ void SessionRequestHandler::ClientDisconnected(std::shared_ptr<ServerSession> se
connected_sessions.end()); connected_sessions.end());
} }
template <class Archive>
void SessionRequestHandler::serialize(Archive& ar, const unsigned int) {
ar& connected_sessions;
}
SERIALIZE_IMPL(SessionRequestHandler)
template <class Archive>
void SessionRequestHandler::SessionDataBase::serialize(Archive& ar, const unsigned int) {}
SERIALIZE_IMPL(SessionRequestHandler::SessionDataBase)
template <class Archive>
void SessionRequestHandler::SessionInfo::serialize(Archive& ar, const unsigned int) {
ar& session;
ar& data;
}
SERIALIZE_IMPL(SessionRequestHandler::SessionInfo)
std::shared_ptr<Event> HLERequestContext::SleepClientThread( std::shared_ptr<Event> HLERequestContext::SleepClientThread(
const std::string& reason, std::chrono::nanoseconds timeout, const std::string& reason, std::chrono::nanoseconds timeout,
std::shared_ptr<WakeupCallback> callback) { std::shared_ptr<WakeupCallback> callback) {
@ -121,8 +85,6 @@ std::shared_ptr<Event> HLERequestContext::SleepClientThread(
return event; return event;
} }
HLERequestContext::HLERequestContext() : kernel(Core::Global<KernelSystem>()) {}
HLERequestContext::HLERequestContext(KernelSystem& kernel, std::shared_ptr<ServerSession> session, HLERequestContext::HLERequestContext(KernelSystem& kernel, std::shared_ptr<ServerSession> session,
std::shared_ptr<Thread> thread) std::shared_ptr<Thread> thread)
: kernel(kernel), session(std::move(session)), thread(thread) { : kernel(kernel), session(std::move(session)), thread(thread) {
@ -322,19 +284,6 @@ void HLERequestContext::ReportUnimplemented() const {
} }
} }
template <class Archive>
void HLERequestContext::serialize(Archive& ar, const unsigned int) {
ar& cmd_buf;
ar& session;
ar& thread;
ar& request_handles;
ar& static_buffers;
ar& request_mapped_buffers;
}
SERIALIZE_IMPL(HLERequestContext)
MappedBuffer::MappedBuffer() : memory(&Core::Global<Core::System>().Memory()) {}
MappedBuffer::MappedBuffer(Memory::MemorySystem& memory, std::shared_ptr<Process> process, MappedBuffer::MappedBuffer(Memory::MemorySystem& memory, std::shared_ptr<Process> process,
u32 descriptor, VAddr address, u32 id) u32 descriptor, VAddr address, u32 id)
: memory(&memory), id(id), address(address), process(std::move(process)) { : memory(&memory), id(id), address(address), process(std::move(process)) {

View file

@ -12,9 +12,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <boost/container/small_vector.hpp> #include <boost/container/small_vector.hpp>
#include <boost/serialization/export.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/serialization/boost_small_vector.hpp"
#include "common/swap.h" #include "common/swap.h"
#include "core/hle/ipc.h" #include "core/hle/ipc.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
@ -71,11 +69,6 @@ public:
/// in each service must inherit from this. /// in each service must inherit from this.
struct SessionDataBase { struct SessionDataBase {
virtual ~SessionDataBase() = default; virtual ~SessionDataBase() = default;
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int);
friend class boost::serialization::access;
}; };
struct SessionInfo { struct SessionInfo {
@ -83,12 +76,6 @@ public:
std::shared_ptr<ServerSession> session; std::shared_ptr<ServerSession> session;
std::unique_ptr<SessionDataBase> data; std::unique_ptr<SessionDataBase> data;
private:
SessionInfo() = default;
template <class Archive>
void serialize(Archive& ar, const unsigned int);
friend class boost::serialization::access;
}; };
protected: protected:
@ -109,15 +96,8 @@ protected:
/// List of sessions that are connected to this handler. A ServerSession whose server endpoint /// List of sessions that are connected to this handler. A ServerSession whose server endpoint
/// is an HLE implementation is kept alive by this list for the duration of the connection. /// is an HLE implementation is kept alive by this list for the duration of the connection.
std::vector<SessionInfo> connected_sessions; std::vector<SessionInfo> connected_sessions;
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int);
friend class boost::serialization::access;
}; };
// NOTE: The below classes are ephemeral and don't need serialization
class MappedBuffer { class MappedBuffer {
public: public:
MappedBuffer(Memory::MemorySystem& memory, std::shared_ptr<Process> process, u32 descriptor, MappedBuffer(Memory::MemorySystem& memory, std::shared_ptr<Process> process, u32 descriptor,
@ -147,18 +127,6 @@ private:
std::shared_ptr<Process> process; std::shared_ptr<Process> process;
u32 size; u32 size;
IPC::MappedBufferPermissions perms; IPC::MappedBufferPermissions perms;
MappedBuffer();
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& id;
ar& address;
ar& process;
ar& size;
ar& perms;
}
friend class boost::serialization::access;
}; };
/** /**
@ -226,11 +194,6 @@ public:
virtual ~WakeupCallback() = default; virtual ~WakeupCallback() = default;
virtual void WakeUp(std::shared_ptr<Thread> thread, HLERequestContext& context, virtual void WakeUp(std::shared_ptr<Thread> thread, HLERequestContext& context,
ThreadWakeupReason reason) = 0; ThreadWakeupReason reason) = 0;
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {}
friend class boost::serialization::access;
}; };
/** /**
@ -265,15 +228,6 @@ private:
private: private:
ResultFunctor functor; ResultFunctor functor;
std::future<void> future; std::future<void> future;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
if (!Archive::is_loading::value && future.valid()) {
future.wait();
}
ar& functor;
}
friend class boost::serialization::access;
}; };
public: public:
@ -378,17 +332,6 @@ private:
std::array<std::vector<u8>, IPC::MAX_STATIC_BUFFERS> static_buffers; std::array<std::vector<u8>, IPC::MAX_STATIC_BUFFERS> static_buffers;
// The mapped buffers will be created when the IPC request is translated // The mapped buffers will be created when the IPC request is translated
boost::container::small_vector<MappedBuffer, 8> request_mapped_buffers; boost::container::small_vector<MappedBuffer, 8> request_mapped_buffers;
HLERequestContext();
template <class Archive>
void serialize(Archive& ar, const unsigned int);
friend class boost::serialization::access;
}; };
} // namespace Kernel } // namespace Kernel
BOOST_CLASS_EXPORT_KEY(Kernel::SessionRequestHandler)
BOOST_CLASS_EXPORT_KEY(Kernel::SessionRequestHandler::SessionDataBase)
BOOST_CLASS_EXPORT_KEY(Kernel::SessionRequestHandler::SessionInfo)
BOOST_CLASS_EXPORT_KEY(Kernel::HLERequestContext)
BOOST_CLASS_EXPORT_KEY(Kernel::HLERequestContext::ThreadCallback)

View file

@ -3,9 +3,8 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <algorithm> #include <algorithm>
#include <boost/serialization/shared_ptr.hpp>
#include "common/alignment.h" #include "common/alignment.h"
#include "common/archives.h"
#include "common/memory_ref.h" #include "common/memory_ref.h"
#include "core/core.h" #include "core/core.h"
#include "core/hle/ipc.h" #include "core/hle/ipc.h"
@ -18,8 +17,6 @@
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
#include "core/memory.h" #include "core/memory.h"
SERIALIZE_EXPORT_IMPL(Kernel::MappedBufferContext)
namespace Kernel { namespace Kernel {
Result TranslateCommandBuffer(Kernel::KernelSystem& kernel, Memory::MemorySystem& memory, Result TranslateCommandBuffer(Kernel::KernelSystem& kernel, Memory::MemorySystem& memory,
@ -255,14 +252,4 @@ Result TranslateCommandBuffer(Kernel::KernelSystem& kernel, Memory::MemorySystem
return ResultSuccess; return ResultSuccess;
} }
template <class Archive>
void MappedBufferContext::serialize(Archive& ar, const unsigned int) {
ar& permissions;
ar& size;
ar& source_address;
ar& target_address;
ar& buffer;
}
SERIALIZE_IMPL(MappedBufferContext)
} // namespace Kernel } // namespace Kernel

View file

@ -6,7 +6,6 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <boost/serialization/export.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/ipc.h" #include "core/hle/ipc.h"
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
@ -26,11 +25,6 @@ struct MappedBufferContext {
VAddr target_address; VAddr target_address;
std::shared_ptr<BackingMem> buffer; std::shared_ptr<BackingMem> buffer;
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int);
friend class boost::serialization::access;
}; };
/// Performs IPC command buffer translation from one process to another. /// Performs IPC command buffer translation from one process to another.
@ -40,5 +34,3 @@ Result TranslateCommandBuffer(KernelSystem& system, Memory::MemorySystem& memory
VAddr dst_address, VAddr dst_address,
std::vector<MappedBufferContext>& mapped_buffer_context, bool reply); std::vector<MappedBufferContext>& mapped_buffer_context, bool reply);
} // namespace Kernel } // namespace Kernel
BOOST_CLASS_EXPORT_KEY(Kernel::MappedBufferContext)

View file

@ -2,11 +2,6 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/unordered_map.hpp>
#include <boost/serialization/vector.hpp>
#include "common/archives.h"
#include "common/serialization/atomic.h"
#include "core/hle/kernel/client_port.h" #include "core/hle/kernel/client_port.h"
#include "core/hle/kernel/config_mem.h" #include "core/hle/kernel/config_mem.h"
#include "core/hle/kernel/handle_table.h" #include "core/hle/kernel/handle_table.h"
@ -19,8 +14,6 @@
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
#include "core/hle/kernel/timer.h" #include "core/hle/kernel/timer.h"
SERIALIZE_EXPORT_IMPL(Kernel::New3dsHwCapabilities)
namespace Kernel { namespace Kernel {
/// Initialize the kernel /// Initialize the kernel
@ -163,48 +156,4 @@ void KernelSystem::ResetThreadIDs() {
next_thread_id = 0; next_thread_id = 0;
} }
template <class Archive>
void KernelSystem::serialize(Archive& ar, const unsigned int) {
ar& memory_regions;
ar& named_ports;
// current_cpu set externally
// 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;
// NB: core count checked in 'core'
for (auto& thread_manager : thread_managers) {
ar&* thread_manager.get();
}
ar& config_mem_handler;
ar& shared_page_handler;
ar& stored_processes;
ar& next_thread_id;
ar& memory_mode;
ar& n3ds_hw_caps;
ar& main_thread_extended_sleep;
// Deliberately don't include debugger info to allow debugging through loads
if (Archive::is_loading::value) {
for (auto& memory_region : memory_regions) {
memory_region->Unlock();
}
for (auto& process : process_list) {
process->vm_manager.Unlock();
}
}
}
SERIALIZE_IMPL(KernelSystem)
template <class Archive>
void New3dsHwCapabilities::serialize(Archive& ar, const unsigned int) {
ar& enable_l2_cache;
ar& enable_804MHz_cpu;
ar& memory_mode;
}
SERIALIZE_IMPL(New3dsHwCapabilities)
} // namespace Kernel } // namespace Kernel

View file

@ -13,7 +13,6 @@
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <boost/serialization/export.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/memory.h" #include "core/hle/kernel/memory.h"
#include "core/hle/result.h" #include "core/hle/result.h"
@ -122,11 +121,6 @@ struct New3dsHwCapabilities {
bool enable_l2_cache; ///< Whether extra L2 cache should be enabled. bool enable_l2_cache; ///< Whether extra L2 cache should be enabled.
bool enable_804MHz_cpu; ///< Whether the CPU should run at 804MHz. bool enable_804MHz_cpu; ///< Whether the CPU should run at 804MHz.
New3dsMemoryMode memory_mode; ///< The New 3DS memory mode. New3dsMemoryMode memory_mode; ///< The New 3DS memory mode.
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int);
friend class boost::serialization::access;
}; };
class KernelSystem { class KernelSystem {
@ -401,12 +395,6 @@ private:
* to load and setup themselves before the game starts. * to load and setup themselves before the game starts.
*/ */
bool main_thread_extended_sleep = false; bool main_thread_extended_sleep = false;
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int);
}; };
} // namespace Kernel } // namespace Kernel
BOOST_CLASS_EXPORT_KEY(Kernel::New3dsHwCapabilities)

View file

@ -4,10 +4,8 @@
#include <algorithm> #include <algorithm>
#include <memory> #include <memory>
#include <utility>
#include <vector> #include <vector>
#include <boost/serialization/set.hpp>
#include "common/archives.h"
#include "common/assert.h" #include "common/assert.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/logging/log.h" #include "common/logging/log.h"
@ -21,8 +19,6 @@
#include "core/hle/result.h" #include "core/hle/result.h"
#include "core/memory.h" #include "core/memory.h"
SERIALIZE_EXPORT_IMPL(Kernel::MemoryRegionInfo)
namespace Kernel { namespace Kernel {
/// Size of the APPLICATION, SYSTEM and BASE memory regions (respectively) for each system /// Size of the APPLICATION, SYSTEM and BASE memory regions (respectively) for each system
@ -166,8 +162,6 @@ void KernelSystem::MapSharedPages(VMManager& address_space) {
} }
void MemoryRegionInfo::Reset(u32 base, u32 size) { void MemoryRegionInfo::Reset(u32 base, u32 size) {
ASSERT(!is_locked);
this->base = base; this->base = base;
this->size = size; this->size = size;
used = 0; used = 0;
@ -178,8 +172,6 @@ void MemoryRegionInfo::Reset(u32 base, u32 size) {
} }
MemoryRegionInfo::IntervalSet MemoryRegionInfo::HeapAllocate(u32 size) { MemoryRegionInfo::IntervalSet MemoryRegionInfo::HeapAllocate(u32 size) {
ASSERT(!is_locked);
IntervalSet result; IntervalSet result;
u32 rest = size; u32 rest = size;
@ -207,8 +199,6 @@ MemoryRegionInfo::IntervalSet MemoryRegionInfo::HeapAllocate(u32 size) {
} }
bool MemoryRegionInfo::LinearAllocate(u32 offset, u32 size) { bool MemoryRegionInfo::LinearAllocate(u32 offset, u32 size) {
ASSERT(!is_locked);
Interval interval(offset, offset + size); Interval interval(offset, offset + size);
if (!boost::icl::contains(free_blocks, interval)) { if (!boost::icl::contains(free_blocks, interval)) {
// The requested range is already allocated // The requested range is already allocated
@ -220,8 +210,6 @@ bool MemoryRegionInfo::LinearAllocate(u32 offset, u32 size) {
} }
std::optional<u32> MemoryRegionInfo::LinearAllocate(u32 size) { std::optional<u32> MemoryRegionInfo::LinearAllocate(u32 size) {
ASSERT(!is_locked);
// Find the first sufficient continuous block from the lower address // Find the first sufficient continuous block from the lower address
for (const auto& interval : free_blocks) { for (const auto& interval : free_blocks) {
ASSERT(interval.bounds() == boost::icl::interval_bounds::right_open()); ASSERT(interval.bounds() == boost::icl::interval_bounds::right_open());
@ -238,8 +226,6 @@ std::optional<u32> MemoryRegionInfo::LinearAllocate(u32 size) {
} }
std::optional<u32> MemoryRegionInfo::RLinearAllocate(u32 size) { std::optional<u32> MemoryRegionInfo::RLinearAllocate(u32 size) {
ASSERT(!is_locked);
// Find the first sufficient continuous block from the upper address // Find the first sufficient continuous block from the upper address
for (auto iter = free_blocks.rbegin(); iter != free_blocks.rend(); ++iter) { for (auto iter = free_blocks.rbegin(); iter != free_blocks.rend(); ++iter) {
auto interval = *iter; auto interval = *iter;
@ -257,30 +243,10 @@ std::optional<u32> MemoryRegionInfo::RLinearAllocate(u32 size) {
} }
void MemoryRegionInfo::Free(u32 offset, u32 size) { void MemoryRegionInfo::Free(u32 offset, u32 size) {
if (is_locked) {
return;
}
Interval interval(offset, offset + size); Interval interval(offset, offset + size);
ASSERT(!boost::icl::intersects(free_blocks, interval)); // must be allocated blocks ASSERT(!boost::icl::intersects(free_blocks, interval)); // must be allocated blocks
free_blocks += interval; free_blocks += interval;
used -= size; used -= size;
} }
void MemoryRegionInfo::Unlock() {
is_locked = false;
}
template <class Archive>
void MemoryRegionInfo::serialize(Archive& ar, const unsigned int) {
ar& base;
ar& size;
ar& used;
ar& free_blocks;
if (Archive::is_loading::value) {
is_locked = true;
}
}
SERIALIZE_IMPL(MemoryRegionInfo)
} // namespace Kernel } // namespace Kernel

View file

@ -6,9 +6,7 @@
#include <optional> #include <optional>
#include <boost/icl/interval_set.hpp> #include <boost/icl/interval_set.hpp>
#include <boost/serialization/export.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/serialization/boost_interval_set.hpp"
namespace Kernel { namespace Kernel {
@ -26,10 +24,6 @@ struct MemoryRegionInfo {
IntervalSet free_blocks; IntervalSet free_blocks;
// When locked, Free calls will be ignored, while Allocate calls will hit an assert. A memory
// region locks itself after deserialization.
bool is_locked{};
/** /**
* Reset the allocator state * Reset the allocator state
* @param base The base offset the beginning of FCRAM. * @param base The base offset the beginning of FCRAM.
@ -74,18 +68,6 @@ struct MemoryRegionInfo {
* @param size the size of the region to free. * @param size the size of the region to free.
*/ */
void Free(u32 offset, u32 size); void Free(u32 offset, u32 size);
/**
* Unlock the MemoryRegion. Used after loading is completed.
*/
void Unlock();
private:
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int);
}; };
} // namespace Kernel } // namespace Kernel
BOOST_CLASS_EXPORT_KEY(Kernel::MemoryRegionInfo)

View file

@ -2,10 +2,6 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/string.hpp>
#include "common/archives.h"
#include "common/assert.h" #include "common/assert.h"
#include "core/core.h" #include "core/core.h"
#include "core/hle/kernel/errors.h" #include "core/hle/kernel/errors.h"
@ -15,8 +11,6 @@
#include "core/hle/kernel/resource_limit.h" #include "core/hle/kernel/resource_limit.h"
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
SERIALIZE_EXPORT_IMPL(Kernel::Mutex)
namespace Kernel { namespace Kernel {
void ReleaseThreadMutexes(Thread* thread) { void ReleaseThreadMutexes(Thread* thread) {
@ -130,15 +124,4 @@ void Mutex::UpdatePriority() {
} }
} }
template <class Archive>
void Mutex::serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<WaitObject>(*this);
ar& lock_count;
ar& priority;
ar& name;
ar& holding_thread;
ar& resource_limit;
}
SERIALIZE_IMPL(Mutex)
} // namespace Kernel } // namespace Kernel

View file

@ -6,7 +6,6 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <boost/serialization/export.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/resource_limit.h" #include "core/hle/kernel/resource_limit.h"
@ -61,10 +60,6 @@ public:
private: private:
KernelSystem& kernel; KernelSystem& kernel;
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int);
}; };
/** /**
@ -74,6 +69,3 @@ private:
void ReleaseThreadMutexes(Thread* thread); void ReleaseThreadMutexes(Thread* thread);
} // namespace Kernel } // namespace Kernel
BOOST_CLASS_EXPORT_KEY(Kernel::Mutex)
CONSTRUCT_KERNEL_OBJECT(Kernel::Mutex)

View file

@ -6,10 +6,6 @@
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
#include "common/archives.h"
SERIALIZE_EXPORT_IMPL(Kernel::Object)
namespace Kernel { namespace Kernel {
Object::Object(KernelSystem& kernel) : object_id{kernel.GenerateObjectID()} {} Object::Object(KernelSystem& kernel) : object_id{kernel.GenerateObjectID()} {}
@ -41,10 +37,4 @@ bool Object::IsWaitable() const {
UNREACHABLE(); UNREACHABLE();
} }
template <class Archive>
void Object::serialize(Archive& ar, const unsigned int) {
ar& object_id;
}
SERIALIZE_IMPL(Object)
} // namespace Kernel } // namespace Kernel

View file

@ -7,10 +7,8 @@
#include <atomic> #include <atomic>
#include <memory> #include <memory>
#include <string> #include <string>
#include <boost/serialization/export.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/serialization/atomic.h"
#include "core/global.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
namespace Kernel { namespace Kernel {
@ -67,10 +65,6 @@ public:
private: private:
std::atomic<u32> object_id; std::atomic<u32> object_id;
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int);
}; };
template <typename T> template <typename T>
@ -94,13 +88,3 @@ inline std::shared_ptr<T> DynamicObjectCast(std::shared_ptr<Object> object) {
} }
} // namespace Kernel } // namespace Kernel
BOOST_CLASS_EXPORT_KEY(Kernel::Object)
#define CONSTRUCT_KERNEL_OBJECT(T) \
namespace boost::serialization { \
template <class Archive> \
void load_construct_data(Archive& ar, T* t, const unsigned int file_version) { \
::new (t) T(Core::Global<Kernel::KernelSystem>()); \
} \
}

View file

@ -4,17 +4,10 @@
#include <algorithm> #include <algorithm>
#include <memory> #include <memory>
#include <boost/serialization/array.hpp>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/bitset.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/string.hpp>
#include <boost/serialization/vector.hpp>
#include "common/archives.h"
#include "common/assert.h" #include "common/assert.h"
#include "common/common_funcs.h" #include "common/common_funcs.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/serialization/boost_vector.hpp"
#include "core/core.h" #include "core/core.h"
#include "core/hle/kernel/errors.h" #include "core/hle/kernel/errors.h"
#include "core/hle/kernel/memory.h" #include "core/hle/kernel/memory.h"
@ -26,48 +19,8 @@
#include "core/loader/loader.h" #include "core/loader/loader.h"
#include "core/memory.h" #include "core/memory.h"
SERIALIZE_EXPORT_IMPL(Kernel::AddressMapping)
SERIALIZE_EXPORT_IMPL(Kernel::Process)
SERIALIZE_EXPORT_IMPL(Kernel::CodeSet)
SERIALIZE_EXPORT_IMPL(Kernel::CodeSet::Segment)
namespace Kernel { namespace Kernel {
template <class Archive>
void AddressMapping::serialize(Archive& ar, const unsigned int) {
ar& address;
ar& size;
ar& read_only;
ar& unk_flag;
}
SERIALIZE_IMPL(AddressMapping)
template <class Archive>
void Process::serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<Object>(*this);
ar& handle_table;
ar& codeset; // TODO: Replace with apploader reference
ar& resource_limit;
ar& svc_access_mask;
ar& handle_table_size;
ar&(boost::container::vector<AddressMapping, boost::container::dtl::static_storage_allocator<
AddressMapping, 8, 0, true>>&)address_mappings;
ar& flags.raw;
ar& no_thread_restrictions;
ar& kernel_version;
ar& ideal_processor;
ar& status;
ar& process_id;
ar& creation_time_ticks;
ar& vm_manager;
ar& memory_used;
ar& memory_region;
ar& holding_memory;
ar& holding_tls_memory;
ar& tls_slots;
}
SERIALIZE_IMPL(Process)
std::shared_ptr<CodeSet> KernelSystem::CreateCodeSet(std::string name, u64 program_id) { std::shared_ptr<CodeSet> KernelSystem::CreateCodeSet(std::string name, u64 program_id) {
auto codeset{std::make_shared<CodeSet>(*this)}; auto codeset{std::make_shared<CodeSet>(*this)};
@ -80,25 +33,6 @@ std::shared_ptr<CodeSet> KernelSystem::CreateCodeSet(std::string name, u64 progr
CodeSet::CodeSet(KernelSystem& kernel) : Object(kernel) {} CodeSet::CodeSet(KernelSystem& kernel) : Object(kernel) {}
CodeSet::~CodeSet() {} CodeSet::~CodeSet() {}
template <class Archive>
void CodeSet::serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<Object>(*this);
ar& memory;
ar& segments;
ar& entrypoint;
ar& name;
ar& program_id;
}
SERIALIZE_IMPL(CodeSet)
template <class Archive>
void CodeSet::Segment::serialize(Archive& ar, const unsigned int) {
ar& offset;
ar& addr;
ar& size;
}
SERIALIZE_IMPL(CodeSet::Segment)
std::shared_ptr<Process> KernelSystem::CreateProcess(std::shared_ptr<CodeSet> code_set) { std::shared_ptr<Process> KernelSystem::CreateProcess(std::shared_ptr<CodeSet> code_set) {
auto process{std::make_shared<Process>(*this)}; auto process{std::make_shared<Process>(*this)};

View file

@ -11,7 +11,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <boost/container/static_vector.hpp> #include <boost/container/static_vector.hpp>
#include <boost/serialization/export.hpp>
#include "common/bit_field.h" #include "common/bit_field.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/handle_table.h" #include "core/hle/kernel/handle_table.h"
@ -26,11 +25,6 @@ struct AddressMapping {
u32 size; u32 size;
bool read_only; bool read_only;
bool unk_flag; bool unk_flag;
private:
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int);
}; };
union ProcessFlags { union ProcessFlags {
@ -65,11 +59,6 @@ public:
std::size_t offset = 0; std::size_t offset = 0;
VAddr addr = 0; VAddr addr = 0;
u32 size = 0; u32 size = 0;
private:
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int);
}; };
std::string GetTypeName() const override { std::string GetTypeName() const override {
@ -117,11 +106,6 @@ public:
std::string name; std::string name;
/// Title ID corresponding to the process /// Title ID corresponding to the process
u64 program_id; u64 program_id;
private:
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int);
}; };
class Process final : public Object { class Process final : public Object {
@ -230,17 +214,6 @@ private:
void FreeAllMemory(); void FreeAllMemory();
KernelSystem& kernel; KernelSystem& kernel;
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int file_version);
}; };
} // namespace Kernel } // namespace Kernel
BOOST_CLASS_EXPORT_KEY(Kernel::AddressMapping)
BOOST_CLASS_EXPORT_KEY(Kernel::CodeSet)
BOOST_CLASS_EXPORT_KEY(Kernel::CodeSet::Segment)
BOOST_CLASS_EXPORT_KEY(Kernel::Process)
CONSTRUCT_KERNEL_OBJECT(Kernel::CodeSet)
CONSTRUCT_KERNEL_OBJECT(Kernel::Process)

View file

@ -2,18 +2,10 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <boost/serialization/array.hpp>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/string.hpp>
#include "common/archives.h"
#include "common/assert.h" #include "common/assert.h"
#include "common/settings.h" #include "common/settings.h"
#include "core/hle/kernel/resource_limit.h" #include "core/hle/kernel/resource_limit.h"
SERIALIZE_EXPORT_IMPL(Kernel::ResourceLimit)
SERIALIZE_EXPORT_IMPL(Kernel::ResourceLimitList)
namespace Kernel { namespace Kernel {
ResourceLimit::ResourceLimit(KernelSystem& kernel) : Object(kernel) {} ResourceLimit::ResourceLimit(KernelSystem& kernel) : Object(kernel) {}
@ -66,15 +58,6 @@ bool ResourceLimit::Release(ResourceLimitType type, s32 amount) {
return true; return true;
} }
template <class Archive>
void ResourceLimit::serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<Object>(*this);
ar& m_name;
ar& m_limit_values;
ar& m_current_values;
}
SERIALIZE_IMPL(ResourceLimit)
ResourceLimitList::ResourceLimitList(KernelSystem& kernel) { ResourceLimitList::ResourceLimitList(KernelSystem& kernel) {
// PM makes APPMEMALLOC always match app RESLIMIT_COMMIT. // PM makes APPMEMALLOC always match app RESLIMIT_COMMIT.
// See: https://github.com/LumaTeam/Luma3DS/blob/e2778a45/sysmodules/pm/source/reslimit.c#L275 // See: https://github.com/LumaTeam/Luma3DS/blob/e2778a45/sysmodules/pm/source/reslimit.c#L275
@ -152,10 +135,4 @@ std::shared_ptr<ResourceLimit> ResourceLimitList::GetForCategory(ResourceLimitCa
} }
} }
template <class Archive>
void ResourceLimitList::serialize(Archive& ar, const unsigned int) {
ar& resource_limits;
}
SERIALIZE_IMPL(ResourceLimitList)
} // namespace Kernel } // namespace Kernel

View file

@ -6,7 +6,6 @@
#include <array> #include <array>
#include <memory> #include <memory>
#include <boost/serialization/export.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
@ -69,11 +68,6 @@ private:
ResourceArray m_limit_values{}; ResourceArray m_limit_values{};
ResourceArray m_current_values{}; ResourceArray m_current_values{};
std::string m_name; std::string m_name;
private:
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int);
}; };
class ResourceLimitList { class ResourceLimitList {
@ -90,15 +84,6 @@ public:
private: private:
std::array<std::shared_ptr<ResourceLimit>, 4> resource_limits; std::array<std::shared_ptr<ResourceLimit>, 4> resource_limits;
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int);
}; };
} // namespace Kernel } // namespace Kernel
BOOST_CLASS_EXPORT_KEY(Kernel::ResourceLimit)
BOOST_CLASS_EXPORT_KEY(Kernel::ResourceLimitList)
CONSTRUCT_KERNEL_OBJECT(Kernel::ResourceLimit)
CONSTRUCT_KERNEL_OBJECT(Kernel::ResourceLimitList)

Some files were not shown because too many files have changed in this diff Show more