diff --git a/TODO b/TODO index ad64a0084..d72a79712 100644 --- a/TODO +++ b/TODO @@ -4,8 +4,7 @@ ✔ CPU @done(19-08-13 15:41) ✔ Memory @done(19-08-13 15:41) ☐ Page tables - ✘ Skip N3DS RAM if unused @cancelled(20-01-03 15:26) - Since no n3ds support, leave this for now + ✔ Skip N3DS RAM if unused @done(20-01-03 23:26) ✔ DSP @done(19-12-28 16:57) Memory only ✔ Service manager @started(19-12-23 00:36) @done(19-12-23 11:38) @lasted(11h2m3s) @@ -99,7 +98,7 @@ ✔ AM @started(19-12-24 23:17) @done(19-12-24 23:53) @lasted(36m8s) ✔ APT @done(19-12-25 21:41) ✔ BOSS @started(19-12-25 21:48) @done(19-12-25 23:18) @lasted(1h30m14s) - ☐ CAM @started(19-12-26 10:37) + ✔ CAM @started(19-12-26 10:37) @done(20-01-03 23:38) @lasted(1w1d13h1m50s) Need to check capture_result ✔ CECD @done(20-01-01 23:58) ✔ CFG @done(20-01-02 00:44) @@ -111,7 +110,8 @@ ✔ FRD @done(19-12-26 19:09) ✔ FS @done(19-12-27 11:46) ✔ GSP @done(19-12-30 12:45) - ☐ Fix the global weak_ptr to gsp + ✔ Fix the global weak_ptr to gsp @done(20-01-04 00:29) + Didn't quite 'fix' it but worked around it ✔ HID @done(19-12-30 14:46) ✔ HTTP @done(19-12-30 15:18) ✔ IR @done(19-12-30 16:06) diff --git a/src/core/core.cpp b/src/core/core.cpp index 5b9b4fca0..a05e2a636 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -31,6 +31,7 @@ #include "core/hle/kernel/process.h" #include "core/hle/kernel/thread.h" #include "core/hle/service/fs/archive.h" +#include "core/hle/service/gsp/gsp.h" #include "core/hle/service/service.h" #include "core/hle/service/sm/sm.h" #include "core/hw/gpu.h" @@ -213,8 +214,8 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, u32 system_mo timing = std::make_unique(); - kernel = std::make_unique(*memory, *timing, - [this] { PrepareReschedule(); }, system_mode); + kernel = std::make_unique( + *memory, *timing, [this] { PrepareReschedule(); }, system_mode); if (Settings::values.use_cpu_jit) { #ifdef ARCHITECTURE_x86_64 @@ -413,6 +414,9 @@ void System::serialize(Archive& ar, const unsigned int file_version) { ar & dsp_core->GetDspMemory(); ar&* memory.get(); ar&* kernel.get(); + + // This needs to be set from somewhere - might as well be here! + Service::GSP::SetGlobalModule(*this); } void System::Save(std::ostream& stream) const { diff --git a/src/core/hle/service/cam/cam.h b/src/core/hle/service/cam/cam.h index 876e2e185..9c56407a3 100644 --- a/src/core/hle/service/cam/cam.h +++ b/src/core/hle/service/cam/cam.h @@ -830,8 +830,7 @@ private: ar& completion_event; ar& buffer_error_interrupt_event; ar& vsync_interrupt_event; - // TODO: Check if this is ever needed: - // ar & capture_result; + // Ignore capture_result. In-progress captures might be affected but this is OK. ar& dest_process; ar& dest; ar& dest_size; diff --git a/src/core/hle/service/gsp/gsp.cpp b/src/core/hle/service/gsp/gsp.cpp index 3d3f497b2..c360d895c 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; // TODO: Fix this for the love of god +static std::weak_ptr gsp_gpu; void SignalInterrupt(InterruptId interrupt_id) { auto gpu = gsp_gpu.lock(); @@ -27,4 +27,8 @@ void InstallInterfaces(Core::System& system) { std::make_shared()->InstallAsService(service_manager); } +void SetGlobalModule(Core::System& system) { + gsp_gpu = system.ServiceManager().GetService("gsp::Gpu"); +} + } // namespace Service::GSP diff --git a/src/core/hle/service/gsp/gsp.h b/src/core/hle/service/gsp/gsp.h index 4cde19e93..a4dd84f27 100644 --- a/src/core/hle/service/gsp/gsp.h +++ b/src/core/hle/service/gsp/gsp.h @@ -23,4 +23,6 @@ namespace Service::GSP { void SignalInterrupt(InterruptId interrupt_id); void InstallInterfaces(Core::System& system); + +void SetGlobalModule(Core::System& system); } // namespace Service::GSP diff --git a/src/core/hle/service/gsp/gsp_gpu.h b/src/core/hle/service/gsp/gsp_gpu.h index d1f2c0742..6194f0446 100644 --- a/src/core/hle/service/gsp/gsp_gpu.h +++ b/src/core/hle/service/gsp/gsp_gpu.h @@ -444,6 +444,7 @@ private: template void serialize(Archive& ar, const unsigned int) { + ar& boost::serialization::base_object(*this); ar& shared_memory; ar& active_thread_id; ar& first_initialization; diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 92bce0b69..cba5867eb 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -18,6 +18,7 @@ #include "core/hle/kernel/process.h" #include "core/hle/lock.h" #include "core/memory.h" +#include "core/settings.h" #include "video_core/renderer_base.h" #include "video_core/video_core.h" @@ -84,15 +85,17 @@ private: friend class boost::serialization::access; template void serialize(Archive& ar, const unsigned int file_version) { - ar& boost::serialization::make_binary_object(fcram.get(), Memory::FCRAM_N3DS_SIZE); + bool save_n3ds_ram = Settings::values.is_new_3ds; + ar& save_n3ds_ram; ar& boost::serialization::make_binary_object(vram.get(), Memory::VRAM_SIZE); - // TODO: When n3ds support is added, put this back in - // ar& boost::serialization::make_binary_object(n3ds_extra_ram.get(), - // Memory::N3DS_EXTRA_RAM_SIZE); - ar& current_page_table; + ar& boost::serialization::make_binary_object( + fcram.get(), save_n3ds_ram ? Memory::FCRAM_N3DS_SIZE : Memory::FCRAM_SIZE); + ar& boost::serialization::make_binary_object( + n3ds_extra_ram.get(), save_n3ds_ram ? Memory::N3DS_EXTRA_RAM_SIZE : 0); ar& cache_marker; ar& page_table_list; // dsp is set from Core::System at startup + // current page table set from current process? } };