From b2370ea35317040ca1159e46ec5c2653898a36ad Mon Sep 17 00:00:00 2001
From: Hamish Milne <hamishmilne83@gmail.com>
Date: Fri, 17 Jan 2020 01:01:18 +0000
Subject: [PATCH] Fixed setting the right DSP service on deserialization

---
 src/core/core.cpp                  | 5 ++++-
 src/core/core_timing.cpp           | 5 +++--
 src/video_core/geometry_pipeline.h | 8 ++++++++
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/core/core.cpp b/src/core/core.cpp
index 985d37291..d199b16e2 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -448,7 +448,10 @@ void System::serialize(Archive& ar, const unsigned int file_version) {
     ar&* kernel.get();
 
     // This needs to be set from somewhere - might as well be here!
-    Service::GSP::SetGlobalModule(*this);
+    if (Archive::is_loading::value) {
+        Service::GSP::SetGlobalModule(*this);
+        DSP().SetServiceToInterrupt(ServiceManager().GetService<Service::DSP::DSP_DSP>("dsp::DSP"));
+    }
 }
 
 void System::Save(std::ostream& stream) const {
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index 4b2729a76..116ba3a40 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -130,8 +130,9 @@ void Timing::Advance() {
         std::pop_heap(event_queue.begin(), event_queue.end(), std::greater<>());
         event_queue.pop_back();
         if (event_types.find(*evt.type->name) == event_types.end()) {
-            LOG_ERROR(Core, "Unknown queued event");
-            continue;
+            LOG_ERROR(Core, "Unknown queued event {}", *evt.type->name);
+        } else if (evt.type->callback == nullptr) {
+            LOG_ERROR(Core, "Event '{}' has no callback", *evt.type->name);
         }
         if (evt.type->callback != nullptr) {
             evt.type->callback(evt.userdata, global_timer - evt.time);
diff --git a/src/video_core/geometry_pipeline.h b/src/video_core/geometry_pipeline.h
index 1ca2d00c4..1a903b1e0 100644
--- a/src/video_core/geometry_pipeline.h
+++ b/src/video_core/geometry_pipeline.h
@@ -5,6 +5,7 @@
 #pragma once
 
 #include <memory>
+#include <boost/serialization/export.hpp>
 #include "video_core/shader/shader.h"
 
 namespace Pica {
@@ -12,6 +13,9 @@ namespace Pica {
 struct State;
 
 class GeometryPipelineBackend;
+class GeometryPipeline_Point;
+class GeometryPipeline_VariablePrimitive;
+class GeometryPipeline_FixedPrimitive;
 
 /// A pipeline receiving from vertex shader and sending to geometry shader and primitive assembler
 class GeometryPipeline {
@@ -52,3 +56,7 @@ private:
     friend class boost::serialization::access;
 };
 } // namespace Pica
+
+BOOST_CLASS_EXPORT_KEY(Pica::GeometryPipeline_Point)
+BOOST_CLASS_EXPORT_KEY(Pica::GeometryPipeline_VariablePrimitive)
+BOOST_CLASS_EXPORT_KEY(Pica::GeometryPipeline_FixedPrimitive)