VERY experimental Nintendo Switch 2 emulator
C++
core/loader: Track the NSO build ID of the current process
Zach Hilmand2d7eacee7cb
diff --git a/src/core/core.cpp b/src/core/core.cppindex 92ba42fb9c..75a7ffb973 100644--- a/src/core/core.cpp+++ b/src/core/core.cpp@@ -339,6 +339,7 @@ struct System::Impl {std::unique_ptr<Memory::CheatEngine> cheat_engine;std::unique_ptr<Tools::Freezer> memory_freezer;+ std::array<u8, 0x20> build_id{};/// Frontend appletsService::AM::Applets::AppletManager applet_manager;@@ -640,6 +641,14 @@ bool System::GetExitLock() const {return impl->exit_lock;}+void System::SetCurrentProcessBuildID(std::array<u8, 32> id) {+ impl->build_id = id;+}++const std::array<u8, 32>& System::GetCurrentProcessBuildID() const {+ return impl->build_id;+}+System::ResultStatus System::Init(Frontend::EmuWindow& emu_window) {return impl->Init(*this, emu_window);}diff --git a/src/core/core.h b/src/core/core.hindex ff10ebe12b..f49b7fbf9f 100644--- a/src/core/core.h+++ b/src/core/core.h@@ -330,6 +330,10 @@ public:bool GetExitLock() const;+ void SetCurrentProcessBuildID(std::array<u8, 0x20> id);++ const std::array<u8, 0x20>& GetCurrentProcessBuildID() const;+private:System();diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cppindex e75c700ad1..f629892aea 100644--- a/src/core/loader/nso.cpp+++ b/src/core/loader/nso.cpp@@ -150,6 +150,7 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::Process& process,// Apply cheats if they exist and the program has a valid title IDif (pm) {auto& system = Core::System::GetInstance();+ system.SetCurrentProcessBuildID(nso_header.build_id);const auto cheats = pm->CreateCheatList(system, nso_header.build_id);if (!cheats.empty()) {system.RegisterCheatList(cheats, nso_header.build_id, load_base, image_size);