From ef2e50328133f6553046219eb54027800d88a148 Mon Sep 17 00:00:00 2001 From: Hamish Milne Date: Wed, 1 Jan 2020 22:57:21 +0000 Subject: [PATCH] Serialize QTM, Y2R services --- TODO | 4 +- src/core/hle/service/qtm/qtm_c.cpp | 3 ++ src/core/hle/service/qtm/qtm_c.h | 2 + src/core/hle/service/qtm/qtm_s.cpp | 3 ++ src/core/hle/service/qtm/qtm_s.h | 2 + src/core/hle/service/qtm/qtm_sp.cpp | 3 ++ src/core/hle/service/qtm/qtm_sp.h | 2 + src/core/hle/service/qtm/qtm_u.cpp | 3 ++ src/core/hle/service/qtm/qtm_u.h | 2 + src/core/hle/service/y2r_u.cpp | 15 ++++++++ src/core/hle/service/y2r_u.h | 60 +++++++++++++++++++++++++++++ 11 files changed, 97 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index 0b7d5dd36..30b51a68c 100644 --- a/TODO +++ b/TODO @@ -105,7 +105,7 @@ ✔ PS @done(20-01-01 00:54) ✔ PTM @done(20-01-01 22:36) ✔ PXI @done(20-01-01 00:53) - ☐ QTM + ✔ QTM @done(20-01-01 22:41) ✔ SOC @done(20-01-01 00:51) ✔ SSL @done(20-01-01 00:48) - ☐ Y2R \ No newline at end of file + ✔ Y2R @done(20-01-01 22:56) \ No newline at end of file diff --git a/src/core/hle/service/qtm/qtm_c.cpp b/src/core/hle/service/qtm/qtm_c.cpp index 84baaba3a..2adc896df 100644 --- a/src/core/hle/service/qtm/qtm_c.cpp +++ b/src/core/hle/service/qtm/qtm_c.cpp @@ -2,9 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/archives.h" #include "core/hle/ipc_helpers.h" #include "core/hle/service/qtm/qtm_c.h" +SERIALIZE_EXPORT_IMPL(Service::QTM::QTM_C) + namespace Service::QTM { QTM_C::QTM_C() : ServiceFramework("qtm:c", 2) { diff --git a/src/core/hle/service/qtm/qtm_c.h b/src/core/hle/service/qtm/qtm_c.h index c9cad0329..8ad05b6e1 100644 --- a/src/core/hle/service/qtm/qtm_c.h +++ b/src/core/hle/service/qtm/qtm_c.h @@ -15,3 +15,5 @@ public: }; } // namespace Service::QTM + +BOOST_CLASS_EXPORT_KEY(Service::QTM::QTM_C) diff --git a/src/core/hle/service/qtm/qtm_s.cpp b/src/core/hle/service/qtm/qtm_s.cpp index 2af7ced7b..6163ef4dc 100644 --- a/src/core/hle/service/qtm/qtm_s.cpp +++ b/src/core/hle/service/qtm/qtm_s.cpp @@ -2,9 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/archives.h" #include "core/hle/ipc_helpers.h" #include "core/hle/service/qtm/qtm_s.h" +SERIALIZE_EXPORT_IMPL(Service::QTM::QTM_S) + namespace Service::QTM { QTM_S::QTM_S() : ServiceFramework("qtm:s", 2) { diff --git a/src/core/hle/service/qtm/qtm_s.h b/src/core/hle/service/qtm/qtm_s.h index 72b5e058b..51e1a4bc8 100644 --- a/src/core/hle/service/qtm/qtm_s.h +++ b/src/core/hle/service/qtm/qtm_s.h @@ -15,3 +15,5 @@ public: }; } // namespace Service::QTM + +BOOST_CLASS_EXPORT_KEY(Service::QTM::QTM_S) diff --git a/src/core/hle/service/qtm/qtm_sp.cpp b/src/core/hle/service/qtm/qtm_sp.cpp index bd5a71605..fdfc80003 100644 --- a/src/core/hle/service/qtm/qtm_sp.cpp +++ b/src/core/hle/service/qtm/qtm_sp.cpp @@ -2,9 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/archives.h" #include "core/hle/ipc_helpers.h" #include "core/hle/service/qtm/qtm_sp.h" +SERIALIZE_EXPORT_IMPL(Service::QTM::QTM_SP) + namespace Service::QTM { QTM_SP::QTM_SP() : ServiceFramework("qtm:sp", 2) { diff --git a/src/core/hle/service/qtm/qtm_sp.h b/src/core/hle/service/qtm/qtm_sp.h index c3f1049a1..3c16dea37 100644 --- a/src/core/hle/service/qtm/qtm_sp.h +++ b/src/core/hle/service/qtm/qtm_sp.h @@ -15,3 +15,5 @@ public: }; } // namespace Service::QTM + +BOOST_CLASS_EXPORT_KEY(Service::QTM::QTM_SP) diff --git a/src/core/hle/service/qtm/qtm_u.cpp b/src/core/hle/service/qtm/qtm_u.cpp index 471692189..84415dde9 100644 --- a/src/core/hle/service/qtm/qtm_u.cpp +++ b/src/core/hle/service/qtm/qtm_u.cpp @@ -2,9 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/archives.h" #include "core/hle/ipc_helpers.h" #include "core/hle/service/qtm/qtm_u.h" +SERIALIZE_EXPORT_IMPL(Service::QTM::QTM_U) + namespace Service::QTM { QTM_U::QTM_U() : ServiceFramework("qtm:u", 2) { diff --git a/src/core/hle/service/qtm/qtm_u.h b/src/core/hle/service/qtm/qtm_u.h index 01bb1e6e0..f6b54c8af 100644 --- a/src/core/hle/service/qtm/qtm_u.h +++ b/src/core/hle/service/qtm/qtm_u.h @@ -15,3 +15,5 @@ public: }; } // namespace Service::QTM + +BOOST_CLASS_EXPORT_KEY(Service::QTM::QTM_U) diff --git a/src/core/hle/service/y2r_u.cpp b/src/core/hle/service/y2r_u.cpp index 356ebd843..0c981b545 100644 --- a/src/core/hle/service/y2r_u.cpp +++ b/src/core/hle/service/y2r_u.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include +#include "common/archives.h" #include "common/common_funcs.h" #include "common/logging/log.h" #include "core/core.h" @@ -12,8 +13,22 @@ #include "core/hle/service/y2r_u.h" #include "core/hw/y2r.h" +SERVICE_CONSTRUCT_IMPL(Service::Y2R::Y2R_U) +SERIALIZE_EXPORT_IMPL(Service::Y2R::Y2R_U) + namespace Service::Y2R { +template +void Y2R_U::serialize(Archive& ar, const unsigned int) { + ar& completion_event; + ar& conversion; + ar& dithering_weight_params; + ar& temporal_dithering_enabled; + 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 {{0x100, 0x193, 0x77, 0x2F, 0x1DB, -0x1933, 0xA7C, -0x1D51}}, // ITU_Rec709 diff --git a/src/core/hle/service/y2r_u.h b/src/core/hle/service/y2r_u.h index 332d3b240..1ac675f92 100644 --- a/src/core/hle/service/y2r_u.h +++ b/src/core/hle/service/y2r_u.h @@ -7,6 +7,7 @@ #include #include #include +#include #include "common/common_types.h" #include "core/hle/result.h" #include "core/hle/service/service.h" @@ -91,6 +92,16 @@ struct ConversionBuffer { u16 transfer_unit; /// Amount of bytes to be skipped between copying each `transfer_unit` bytes. u16 gap; + +private: + template + void serialize(Archive& ar, const unsigned int) { + ar& address; + ar& image_size; + ar& transfer_unit; + ar& gap; + } + friend class boost::serialization::access; }; struct ConversionConfiguration { @@ -112,6 +123,26 @@ struct ConversionConfiguration { ResultCode SetInputLineWidth(u16 width); ResultCode SetInputLines(u16 lines); ResultCode SetStandardCoefficient(StandardCoefficient standard_coefficient); + +private: + template + void serialize(Archive& ar, const unsigned int) { + ar& input_format; + ar& output_format; + ar& rotation; + ar& block_alignment; + ar& input_line_width; + ar& input_lines; + ar& coefficients; + ar& padding; + ar& alpha; + ar& src_Y; + ar& src_U; + ar& src_V; + ar& src_YUYV; + ar& dst; + } + friend class boost::serialization::access; }; struct DitheringWeightParams { @@ -131,6 +162,28 @@ struct DitheringWeightParams { u16 w3_xOdd_yEven; u16 w3_xEven_yOdd; u16 w3_xOdd_yOdd; + +private: + template + void serialize(Archive& ar, const unsigned int) { + ar& w0_xEven_yEven; + ar& w0_xOdd_yEven; + ar& w0_xEven_yOdd; + ar& w0_xOdd_yOdd; + ar& w1_xEven_yEven; + ar& w1_xOdd_yEven; + ar& w1_xEven_yOdd; + ar& w1_xOdd_yOdd; + ar& w2_xEven_yEven; + ar& w2_xOdd_yEven; + ar& w2_xEven_yOdd; + ar& w2_xOdd_yOdd; + ar& w3_xEven_yEven; + ar& w3_xOdd_yEven; + ar& w3_xEven_yOdd; + ar& w3_xOdd_yOdd; + } + friend class boost::serialization::access; }; struct ConversionParameters { @@ -301,8 +354,15 @@ private: bool temporal_dithering_enabled = false; bool transfer_end_interrupt_enabled = false; bool spacial_dithering_enabled = false; + + template + void serialize(Archive& ar, const unsigned int); + friend class boost::serialization::access; }; void InstallInterfaces(Core::System& system); } // namespace Service::Y2R + +SERVICE_CONSTRUCT(Service::Y2R::Y2R_U) +BOOST_CLASS_EXPORT_KEY(Service::Y2R::Y2R_U)