diff --git a/TODO b/TODO index 45e6ae3b74..fa627b214a 100644 --- a/TODO +++ b/TODO @@ -81,7 +81,8 @@ ✔ ERR @done(19-12-26 18:14) ✔ FRD @done(19-12-26 19:09) ✔ FS @done(19-12-27 11:46) - ☐ GSP + ✔ GSP @done(19-12-30 12:45) + ☐ Fix the global weak_ptr to gsp ☐ HID ☐ HTTP ☐ IR diff --git a/src/core/hle/service/gsp/gsp.cpp b/src/core/hle/service/gsp/gsp.cpp index 4291b99710..3d3f497b2b 100644 --- a/src/core/hle/service/gsp/gsp.cpp +++ b/src/core/hle/service/gsp/gsp.cpp @@ -10,7 +10,7 @@ namespace Service::GSP { -static std::weak_ptr gsp_gpu; +static std::weak_ptr gsp_gpu; // TODO: Fix this for the love of god void SignalInterrupt(InterruptId interrupt_id) { auto gpu = gsp_gpu.lock(); diff --git a/src/core/hle/service/gsp/gsp_gpu.cpp b/src/core/hle/service/gsp/gsp_gpu.cpp index 33558fe10f..78d84499b9 100644 --- a/src/core/hle/service/gsp/gsp_gpu.cpp +++ b/src/core/hle/service/gsp/gsp_gpu.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include +#include "common/archives.h" #include "common/bit_field.h" #include "common/microprofile.h" #include "common/swap.h" @@ -21,6 +22,10 @@ #include "video_core/debug_utils/debug_utils.h" #include "video_core/gpu_debugger.h" +SERIALIZE_EXPORT_IMPL(Service::GSP::SessionData) +SERIALIZE_EXPORT_IMPL(Service::GSP::GSP_GPU) +SERVICE_CONSTRUCT_IMPL(Service::GSP::GSP_GPU) + // Main graphics debugger object - TODO: Here is probably not the best place for this GraphicsDebugger g_debugger; diff --git a/src/core/hle/service/gsp/gsp_gpu.h b/src/core/hle/service/gsp/gsp_gpu.h index 8b43b9cea3..d1f2c0742f 100644 --- a/src/core/hle/service/gsp/gsp_gpu.h +++ b/src/core/hle/service/gsp/gsp_gpu.h @@ -199,6 +199,16 @@ public: u32 thread_id; /// Whether RegisterInterruptRelayQueue was called for this session bool registered = false; + +private: + template + void serialize(Archive& ar, const unsigned int) { + ar& gsp; + ar& interrupt_event; + ar& thread_id; + ar& registered; + } + friend class boost::serialization::access; }; class GSP_GPU final : public ServiceFramework { @@ -431,8 +441,22 @@ private: std::array used_thread_ids = {false, false, false, false}; friend class SessionData; + + template + void serialize(Archive& ar, const unsigned int) { + ar& shared_memory; + ar& active_thread_id; + ar& first_initialization; + ar& used_thread_ids; + } + + friend class boost::serialization::access; }; ResultCode SetBufferSwap(u32 screen_id, const FrameBufferInfo& info); } // namespace Service::GSP + +BOOST_CLASS_EXPORT_KEY(Service::GSP::SessionData) +BOOST_CLASS_EXPORT_KEY(Service::GSP::GSP_GPU) +SERVICE_CONSTRUCT(Service::GSP::GSP_GPU) diff --git a/src/core/hle/service/gsp/gsp_lcd.cpp b/src/core/hle/service/gsp/gsp_lcd.cpp index d795b87161..67a2e76286 100644 --- a/src/core/hle/service/gsp/gsp_lcd.cpp +++ b/src/core/hle/service/gsp/gsp_lcd.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/gsp/gsp_lcd.h" +SERIALIZE_EXPORT_IMPL(Service::GSP::GSP_LCD) + namespace Service::GSP { GSP_LCD::GSP_LCD() : ServiceFramework("gsp::Lcd") { diff --git a/src/core/hle/service/gsp/gsp_lcd.h b/src/core/hle/service/gsp/gsp_lcd.h index 24e57fb42f..781d9dba8d 100644 --- a/src/core/hle/service/gsp/gsp_lcd.h +++ b/src/core/hle/service/gsp/gsp_lcd.h @@ -15,3 +15,5 @@ public: }; } // namespace Service::GSP + +BOOST_CLASS_EXPORT_KEY(Service::GSP::GSP_LCD)