Fixed serialization runtime exceptions

This commit is contained in:
Hamish Milne 2020-01-11 16:33:48 +00:00 committed by zhupengfei
parent ca971ff31f
commit e4f05884c3
23 changed files with 140 additions and 24 deletions

View file

@ -3,10 +3,13 @@
// Refer to the license.txt file included.
#include <cstring>
#include "common/archives.h"
#include "core/hle/kernel/config_mem.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
SERIALIZE_EXPORT_IMPL(ConfigMem::Handler)
namespace ConfigMem {
Handler::Handler() {

View file

@ -10,6 +10,7 @@
// putting this as a subset of HLE for now.
#include <boost/serialization/binary_object.hpp>
#include <boost/serialization/export.hpp>
#include "common/common_funcs.h"
#include "common/common_types.h"
#include "common/memory_ref.h"
@ -76,3 +77,5 @@ private:
};
} // namespace ConfigMem
BOOST_CLASS_EXPORT_KEY(ConfigMem::Handler)

View file

@ -14,6 +14,8 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
SERIALIZE_EXPORT_IMPL(SharedPage::Handler)
namespace boost::serialization {
template <class Archive>

View file

@ -14,6 +14,7 @@
#include <ctime>
#include <memory>
#include <boost/serialization/binary_object.hpp>
#include <boost/serialization/export.hpp>
#include "common/bit_field.h"
#include "common/common_funcs.h"
#include "common/common_types.h"
@ -131,3 +132,5 @@ template <class Archive>
void load_construct_data(Archive& ar, SharedPage::Handler* t, const unsigned int);
} // namespace boost::serialization
BOOST_CLASS_EXPORT_KEY(SharedPage::Handler)

View file

@ -12,6 +12,9 @@ class GSP_LCD final : public ServiceFramework<GSP_LCD> {
public:
GSP_LCD();
~GSP_LCD() = default;
private:
SERVICE_SERIALIZATION_SIMPLE
};
} // namespace Service::GSP

View file

@ -29,7 +29,6 @@ void IR_RST::serialize(Archive& ar, const unsigned int) {
// update_callback_id and input devices are set separately
ReloadInputDevices();
}
SERIALIZE_IMPL(IR_RST)
struct PadDataEntry {
PadState current_state;

View file

@ -12,6 +12,9 @@ namespace Service::IR {
class IR_U final : public ServiceFramework<IR_U> {
public:
IR_U();
private:
SERVICE_SERIALIZATION_SIMPLE
};
} // namespace Service::IR

View file

@ -4,6 +4,8 @@
#include <memory>
#include <boost/crc.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/unique_ptr.hpp>
#include "common/string_util.h"
#include "common/swap.h"
#include "core/core.h"
@ -13,6 +15,9 @@
#include "core/hle/service/ir/extra_hid.h"
#include "core/hle/service/ir/ir_user.h"
SERIALIZE_EXPORT_IMPL(Service::IR::IR_USER)
SERVICE_CONSTRUCT_IMPL(Service::IR::IR_USER)
namespace Service::IR {
template <class Archive>
@ -23,10 +28,9 @@ void IR_USER::serialize(Archive& ar, const unsigned int) {
ar& receive_event;
ar& shared_memory;
ar& connected_device;
ar&* receive_buffer.get();
ar& receive_buffer;
ar&* extra_hid.get();
}
SERIALIZE_IMPL(IR_USER)
// This is a header that will present in the ir:USER shared memory if it is initialized with
// InitializeIrNopShared service function. Otherwise the shared memory doesn't have this header if
@ -204,6 +208,8 @@ private:
u32 max_data_size;
private:
BufferManager() = default;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& info;
@ -449,6 +455,7 @@ IR_USER::IR_USER(Core::System& system) : ServiceFramework("ir:USER", 1) {
using namespace Kernel;
connected_device = false;
conn_status_event = system.Kernel().CreateEvent(ResetType::OneShot, "IR:ConnectionStatusEvent");
send_event = system.Kernel().CreateEvent(ResetType::OneShot, "IR:SendEvent");
receive_event = system.Kernel().CreateEvent(ResetType::OneShot, "IR:ReceiveEvent");

View file

@ -7,7 +7,6 @@
#include <functional>
#include <memory>
#include <vector>
#include <boost/serialization/shared_ptr.hpp>
#include "core/hle/service/service.h"
namespace Kernel {
@ -177,3 +176,6 @@ private:
};
} // namespace Service::IR
BOOST_CLASS_EXPORT_KEY(Service::IR::IR_USER)
SERVICE_CONSTRUCT(Service::IR::IR_USER)

View file

@ -28,7 +28,6 @@ void MIC_U::serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<Kernel::SessionRequestHandler>(*this);
ar&* impl.get();
}
SERIALIZE_IMPL(MIC_U)
/// Microphone audio encodings.
enum class Encoding : u8 {

View file

@ -24,6 +24,9 @@
#include "core/hle/service/nwm/uds_data.h"
#include "core/memory.h"
SERIALIZE_EXPORT_IMPL(Service::NWM::NWM_UDS)
SERVICE_CONSTRUCT_IMPL(Service::NWM::NWM_UDS)
namespace Service::NWM {
template <class Archive>
@ -34,7 +37,6 @@ void NWM_UDS::serialize(Archive& ar, const unsigned int) {
ar& received_beacons;
// wifi_packet_received set in constructor
}
SERIALIZE_IMPL(NWM_UDS)
namespace ErrCodes {
enum {

View file

@ -557,6 +557,7 @@ private:
template <class Archive>
void serialize(Archive& ar, const unsigned int);
friend class boost::serialization::access;
};
} // namespace Service::NWM

View file

@ -35,7 +35,6 @@ void SRV::serialize(Archive& ar, const unsigned int) {
ar& notification_semaphore;
ar& get_service_handle_delayed_map;
}
SERIALIZE_IMPL(SRV)
constexpr int MAX_PENDING_NOTIFICATIONS = 16;

View file

@ -28,7 +28,6 @@ void Y2R_U::serialize(Archive& ar, const unsigned int) {
ar& transfer_end_interrupt_enabled;
ar& spacial_dithering_enabled;
}
SERIALIZE_IMPL(Y2R_U)
static const CoefficientSet standard_coefficients[4] = {
{{0x100, 0x166, 0xB6, 0x58, 0x1C5, -0x166F, 0x10EE, -0x1C5B}}, // ITU_Rec601