VERY experimental Nintendo Switch 2 emulator
C++
nv_services: Deglobalize NvServices
Fernando Sahmkow531e3431fb05
diff --git a/src/core/hle/service/nvdrv/devices/nvdevice.h b/src/core/hle/service/nvdrv/devices/nvdevice.hindex 4f6042b00a..ed606cd15d 100644--- a/src/core/hle/service/nvdrv/devices/nvdevice.h+++ b/src/core/hle/service/nvdrv/devices/nvdevice.h@@ -9,13 +9,17 @@#include "common/common_types.h"#include "common/swap.h"+namespace Core {+class System;+}+namespace Service::Nvidia::Devices {/// Represents an abstract nvidia device node. It is to be subclassed by concrete device nodes to/// implement the ioctl interface.class nvdevice {public:- nvdevice() = default;+ nvdevice(Core::System& system) : system{system} {};virtual ~nvdevice() = default;union Ioctl {u32_le raw;@@ -34,6 +38,9 @@ public:* @returns The result code of the ioctl.*/virtual u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) = 0;++protected:+ Core::System& system;};} // namespace Service::Nvidia::Devicesdiff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cppindex 20c7c39aaf..3336b2080f 100644--- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp+++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp@@ -13,7 +13,8 @@namespace Service::Nvidia::Devices {-nvdisp_disp0::nvdisp_disp0(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {}+nvdisp_disp0::nvdisp_disp0(Core::System& system, std::shared_ptr<nvmap> nvmap_dev)+ : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {}nvdisp_disp0 ::~nvdisp_disp0() = default;u32 nvdisp_disp0::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {@@ -34,7 +35,7 @@ void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u3addr, offset, width, height, stride, static_cast<PixelFormat>(format),transform, crop_rect};- auto& instance = Core::System::GetInstance();+ auto& instance = system;instance.GetPerfStats().EndGameFrame();instance.GPU().SwapBuffers(framebuffer);}diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.hindex 12f3ef8254..812967bdf9 100644--- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h+++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h@@ -17,7 +17,7 @@ class nvmap;class nvdisp_disp0 final : public nvdevice {public:- explicit nvdisp_disp0(std::shared_ptr<nvmap> nvmap_dev);+ explicit nvdisp_disp0(Core::System& system, std::shared_ptr<nvmap> nvmap_dev);~nvdisp_disp0() override;u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cppindex af62d33d21..eccc3f1d95 100644--- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp+++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp@@ -22,7 +22,8 @@ enum {};}-nvhost_as_gpu::nvhost_as_gpu(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {}+nvhost_as_gpu::nvhost_as_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_dev)+ : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {}nvhost_as_gpu::~nvhost_as_gpu() = default;u32 nvhost_as_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {@@ -65,7 +66,7 @@ u32 nvhost_as_gpu::AllocateSpace(const std::vector<u8>& input, std::vector<u8>&LOG_DEBUG(Service_NVDRV, "called, pages={:X}, page_size={:X}, flags={:X}", params.pages,params.page_size, params.flags);- auto& gpu = Core::System::GetInstance().GPU();+ auto& gpu = system.GPU();const u64 size{static_cast<u64>(params.pages) * static_cast<u64>(params.page_size)};if (params.flags & 1) {params.offset = gpu.MemoryManager().AllocateSpace(params.offset, size, 1);@@ -85,7 +86,7 @@ u32 nvhost_as_gpu::Remap(const std::vector<u8>& input, std::vector<u8>& output)std::vector<IoctlRemapEntry> entries(num_entries);std::memcpy(entries.data(), input.data(), input.size());- auto& gpu = Core::System::GetInstance().GPU();+ auto& gpu = system.GPU();for (const auto& entry : entries) {LOG_WARNING(Service_NVDRV, "remap entry, offset=0x{:X} handle=0x{:X} pages=0x{:X}",entry.offset, entry.nvmap_handle, entry.pages);@@ -136,7 +137,7 @@ u32 nvhost_as_gpu::MapBufferEx(const std::vector<u8>& input, std::vector<u8>& ou// case to prevent unexpected behavior.ASSERT(object->id == params.nvmap_handle);- auto& gpu = Core::System::GetInstance().GPU();+ auto& gpu = system.GPU();if (params.flags & 1) {params.offset = gpu.MemoryManager().MapBufferEx(object->addr, params.offset, object->size);@@ -173,8 +174,7 @@ u32 nvhost_as_gpu::UnmapBuffer(const std::vector<u8>& input, std::vector<u8>& oureturn 0;}- params.offset = Core::System::GetInstance().GPU().MemoryManager().UnmapBuffer(params.offset,- itr->second.size);+ params.offset = system.GPU().MemoryManager().UnmapBuffer(params.offset, itr->second.size);buffer_mappings.erase(itr->second.offset);std::memcpy(output.data(), ¶ms, output.size());diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.hindex eb14b1da8e..e45d4f1ff4 100644--- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h+++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h@@ -17,7 +17,7 @@ class nvmap;class nvhost_as_gpu final : public nvdevice {public:- explicit nvhost_as_gpu(std::shared_ptr<nvmap> nvmap_dev);+ explicit nvhost_as_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_dev);~nvhost_as_gpu() override;u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cppindex 96310ed83f..02b078c2f6 100644--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp@@ -15,7 +15,8 @@namespace Service::Nvidia::Devices {-nvhost_ctrl::nvhost_ctrl(EventsInterface& events_interface) : events_interface{events_interface} {}+nvhost_ctrl::nvhost_ctrl(Core::System& system, EventsInterface& events_interface)+ : nvdevice(system), events_interface{events_interface} {}nvhost_ctrl::~nvhost_ctrl() = default;u32 nvhost_ctrl::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {@@ -59,7 +60,7 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>&return NvResult::BadParameter;}- auto& gpu = Core::System::GetInstance().GPU();+ auto& gpu = system.GPU();// This is mostly to take into account unimplemented features. As synced// gpu is always synced.if (!gpu.IsAsync()) {@@ -158,7 +159,7 @@ u32 nvhost_ctrl::IocCtrlEventSignal(const std::vector<u8>& input, std::vector<u8return NvResult::BadParameter;}if (events_interface.status[event_id] == EventState::Waiting) {- auto& gpu = Core::System::GetInstance().GPU();+ auto& gpu = system.GPU();gpu.CancelEvent(event_id, events_interface.assigned_syncpt[event_id],events_interface.assigned_value[event_id]);events_interface.LiberateEvent(event_id);diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.hindex b5bc9337b2..6cbf75f89c 100644--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h@@ -14,7 +14,7 @@ namespace Service::Nvidia::Devices {class nvhost_ctrl final : public nvdevice {public:- nvhost_ctrl(EventsInterface& events_interface);+ nvhost_ctrl(Core::System& system, EventsInterface& events_interface);~nvhost_ctrl() override;u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cppindex 0e28755bdd..c139f2ceba 100644--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp@@ -12,7 +12,7 @@namespace Service::Nvidia::Devices {-nvhost_ctrl_gpu::nvhost_ctrl_gpu() = default;+nvhost_ctrl_gpu::nvhost_ctrl_gpu(Core::System& system) : nvdevice(system){};nvhost_ctrl_gpu::~nvhost_ctrl_gpu() = default;u32 nvhost_ctrl_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {@@ -185,7 +185,7 @@ u32 nvhost_ctrl_gpu::GetGpuTime(const std::vector<u8>& input, std::vector<u8>& oIoctlGetGpuTime params{};std::memcpy(¶ms, input.data(), input.size());- const auto ns = Core::Timing::CyclesToNs(Core::System::GetInstance().CoreTiming().GetTicks());+ const auto ns = Core::Timing::CyclesToNs(system.CoreTiming().GetTicks());params.gpu_time = static_cast<u64_le>(ns.count());std::memcpy(output.data(), ¶ms, output.size());return 0;diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.hindex 240435eea5..65eac47d14 100644--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h@@ -13,7 +13,7 @@ namespace Service::Nvidia::Devices {class nvhost_ctrl_gpu final : public nvdevice {public:- nvhost_ctrl_gpu();+ nvhost_ctrl_gpu(Core::System& system);~nvhost_ctrl_gpu() override;u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cppindex 8083f5a87a..13e80bfad5 100644--- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp+++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp@@ -13,7 +13,8 @@namespace Service::Nvidia::Devices {-nvhost_gpu::nvhost_gpu(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {}+nvhost_gpu::nvhost_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_dev)+ : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {}nvhost_gpu::~nvhost_gpu() = default;u32 nvhost_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {@@ -119,7 +120,7 @@ u32 nvhost_gpu::AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8>& ouparams.num_entries, params.flags, params.unk0, params.unk1, params.unk2,params.unk3);- auto& gpu = Core::System::GetInstance().GPU();+ auto& gpu = system.GPU();params.fence_out.id = channels;params.fence_out.value = gpu.GetSyncpointValue(channels);channels++;@@ -158,7 +159,7 @@ u32 nvhost_gpu::SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& outpUNIMPLEMENTED_IF(params.flags.add_wait.Value() != 0);UNIMPLEMENTED_IF(params.flags.add_increment.Value() != 0);- auto& gpu = Core::System::GetInstance().GPU();+ auto& gpu = system.GPU();u32 current_syncpoint_value = gpu.GetSyncpointValue(params.fence_out.id);if (params.flags.increment.Value()) {params.fence_out.value += current_syncpoint_value;@@ -189,7 +190,7 @@ u32 nvhost_gpu::KickoffPB(const std::vector<u8>& input, std::vector<u8>& output)UNIMPLEMENTED_IF(params.flags.add_wait.Value() != 0);UNIMPLEMENTED_IF(params.flags.add_increment.Value() != 0);- auto& gpu = Core::System::GetInstance().GPU();+ auto& gpu = system.GPU();u32 current_syncpoint_value = gpu.GetSyncpointValue(params.fence_out.id);if (params.flags.increment.Value()) {params.fence_out.value += current_syncpoint_value;diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_gpu.hindex 54378cb5d2..106359f876 100644--- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h+++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h@@ -20,7 +20,7 @@ constexpr u32 NVGPU_IOCTL_CHANNEL_KICKOFF_PB(0x1b);class nvhost_gpu final : public nvdevice {public:- explicit nvhost_gpu(std::shared_ptr<nvmap> nvmap_dev);+ explicit nvhost_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_dev);~nvhost_gpu() override;u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cppindex f5e8ea7c3a..3bfcb84230 100644--- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp@@ -10,7 +10,7 @@namespace Service::Nvidia::Devices {-nvhost_nvdec::nvhost_nvdec() = default;+nvhost_nvdec::nvhost_nvdec(Core::System& system) : nvdevice(system){};nvhost_nvdec::~nvhost_nvdec() = default;u32 nvhost_nvdec::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.hindex 0e7b284f87..febfd4cc4c 100644--- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h@@ -13,7 +13,7 @@ namespace Service::Nvidia::Devices {class nvhost_nvdec final : public nvdevice {public:- nvhost_nvdec();+ nvhost_nvdec(Core::System& system);~nvhost_nvdec() override;u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cppindex 3e0951ab04..16c683b476 100644--- a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp@@ -10,7 +10,7 @@namespace Service::Nvidia::Devices {-nvhost_nvjpg::nvhost_nvjpg() = default;+nvhost_nvjpg::nvhost_nvjpg(Core::System& system) : nvdevice(system){};nvhost_nvjpg::~nvhost_nvjpg() = default;u32 nvhost_nvjpg::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.hindex 89fd5e95ed..33b149bb73 100644--- a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h@@ -13,7 +13,7 @@ namespace Service::Nvidia::Devices {class nvhost_nvjpg final : public nvdevice {public:- nvhost_nvjpg();+ nvhost_nvjpg(Core::System& system);~nvhost_nvjpg() override;u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp b/src/core/hle/service/nvdrv/devices/nvhost_vic.cppindex d544f0f314..853136dea1 100644--- a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp+++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp@@ -10,7 +10,7 @@namespace Service::Nvidia::Devices {-nvhost_vic::nvhost_vic() = default;+nvhost_vic::nvhost_vic(Core::System& system) : nvdevice(system){};nvhost_vic::~nvhost_vic() = default;u32 nvhost_vic::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.h b/src/core/hle/service/nvdrv/devices/nvhost_vic.hindex fc24c3f9c0..b71816ba17 100644--- a/src/core/hle/service/nvdrv/devices/nvhost_vic.h+++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.h@@ -13,7 +13,7 @@ namespace Service::Nvidia::Devices {class nvhost_vic final : public nvdevice {public:- nvhost_vic();+ nvhost_vic(Core::System& system);~nvhost_vic() override;u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;diff --git a/src/core/hle/service/nvdrv/devices/nvmap.cpp b/src/core/hle/service/nvdrv/devices/nvmap.cppindex 1ec796fc6d..a75ff334b5 100644--- a/src/core/hle/service/nvdrv/devices/nvmap.cpp+++ b/src/core/hle/service/nvdrv/devices/nvmap.cpp@@ -18,7 +18,7 @@ enum {};}-nvmap::nvmap() = default;+nvmap::nvmap(Core::System& system) : nvdevice(system){};nvmap::~nvmap() = default;VAddr nvmap::GetObjectAddress(u32 handle) const {diff --git a/src/core/hle/service/nvdrv/devices/nvmap.h b/src/core/hle/service/nvdrv/devices/nvmap.hindex 396230c191..623c9b232d 100644--- a/src/core/hle/service/nvdrv/devices/nvmap.h+++ b/src/core/hle/service/nvdrv/devices/nvmap.h@@ -16,7 +16,7 @@ namespace Service::Nvidia::Devices {class nvmap final : public nvdevice {public:- nvmap();+ nvmap(Core::System& system);~nvmap() override;/// Returns the allocated address of an nvmap object given its handle.diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cppindex d95ba18cb2..c548f1223d 100644--- a/src/core/hle/service/nvdrv/interface.cpp+++ b/src/core/hle/service/nvdrv/interface.cpp@@ -138,8 +138,6 @@ NVDRV::NVDRV(std::shared_ptr<Module> nvdrv, const char* name){13, &NVDRV::FinishInitialize, "FinishInitialize"},};RegisterHandlers(functions);-- auto& kernel = Core::System::GetInstance().Kernel();}NVDRV::~NVDRV() = default;diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cppindex 3a716e7348..c68d291776 100644--- a/src/core/hle/service/nvdrv/nvdrv.cpp+++ b/src/core/hle/service/nvdrv/nvdrv.cpp@@ -25,8 +25,9 @@namespace Service::Nvidia {-void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger) {- auto module_ = std::make_shared<Module>();+void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger,+ Core::System& system) {+ auto module_ = std::make_shared<Module>(system);std::make_shared<NVDRV>(module_, "nvdrv")->InstallAsService(service_manager);std::make_shared<NVDRV>(module_, "nvdrv:a")->InstallAsService(service_manager);std::make_shared<NVDRV>(module_, "nvdrv:s")->InstallAsService(service_manager);@@ -35,25 +36,25 @@ void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlingernvflinger.SetNVDrvInstance(module_);}-Module::Module() {- auto& kernel = Core::System::GetInstance().Kernel();+Module::Module(Core::System& system) {+ auto& kernel = system.Kernel();for (u32 i = 0; i < MaxNvEvents; i++) {std::string event_label = fmt::format("NVDRV::NvEvent_{}", i);- events_interface.events[i] = Kernel::WritableEvent::CreateEventPair(- kernel, Kernel::ResetType::Manual, event_label);+ events_interface.events[i] =+ Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual, event_label);events_interface.status[i] = EventState::Free;events_interface.registered[i] = false;}- auto nvmap_dev = std::make_shared<Devices::nvmap>();- devices["/dev/nvhost-as-gpu"] = std::make_shared<Devices::nvhost_as_gpu>(nvmap_dev);- devices["/dev/nvhost-gpu"] = std::make_shared<Devices::nvhost_gpu>(nvmap_dev);- devices["/dev/nvhost-ctrl-gpu"] = std::make_shared<Devices::nvhost_ctrl_gpu>();+ auto nvmap_dev = std::make_shared<Devices::nvmap>(system);+ devices["/dev/nvhost-as-gpu"] = std::make_shared<Devices::nvhost_as_gpu>(system, nvmap_dev);+ devices["/dev/nvhost-gpu"] = std::make_shared<Devices::nvhost_gpu>(system, nvmap_dev);+ devices["/dev/nvhost-ctrl-gpu"] = std::make_shared<Devices::nvhost_ctrl_gpu>(system);devices["/dev/nvmap"] = nvmap_dev;- devices["/dev/nvdisp_disp0"] = std::make_shared<Devices::nvdisp_disp0>(nvmap_dev);- devices["/dev/nvhost-ctrl"] = std::make_shared<Devices::nvhost_ctrl>(events_interface);- devices["/dev/nvhost-nvdec"] = std::make_shared<Devices::nvhost_nvdec>();- devices["/dev/nvhost-nvjpg"] = std::make_shared<Devices::nvhost_nvjpg>();- devices["/dev/nvhost-vic"] = std::make_shared<Devices::nvhost_vic>();+ devices["/dev/nvdisp_disp0"] = std::make_shared<Devices::nvdisp_disp0>(system, nvmap_dev);+ devices["/dev/nvhost-ctrl"] = std::make_shared<Devices::nvhost_ctrl>(system, events_interface);+ devices["/dev/nvhost-nvdec"] = std::make_shared<Devices::nvhost_nvdec>(system);+ devices["/dev/nvhost-nvjpg"] = std::make_shared<Devices::nvhost_nvjpg>(system);+ devices["/dev/nvhost-vic"] = std::make_shared<Devices::nvhost_vic>(system);}Module::~Module() = default;diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.hindex d299f28772..0e8eed113f 100644--- a/src/core/hle/service/nvdrv/nvdrv.h+++ b/src/core/hle/service/nvdrv/nvdrv.h@@ -12,6 +12,10 @@#include "core/hle/service/nvdrv/nvdata.h"#include "core/hle/service/service.h"+namespace Core {+class System;+}+namespace Service::NVFlinger {class NVFlinger;}@@ -66,7 +70,7 @@ struct EventsInterface {class Module final {public:- Module();+ Module(Core::System& system);~Module();/// Returns a pointer to one of the available devices, identified by its name.@@ -103,6 +107,7 @@ private:};/// Registers all NVDRV services with the specified service manager.-void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger);+void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger,+ Core::System& system);} // namespace Service::Nvidiadiff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cppindex 5fc7d3cab7..07b1f4d436 100644--- a/src/core/hle/service/service.cpp+++ b/src/core/hle/service/service.cpp@@ -237,7 +237,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system,NIM::InstallInterfaces(*sm);NPNS::InstallInterfaces(*sm);NS::InstallInterfaces(*sm);- Nvidia::InstallInterfaces(*sm, *nv_flinger);+ Nvidia::InstallInterfaces(*sm, *nv_flinger, system);PCIe::InstallInterfaces(*sm);PCTL::InstallInterfaces(*sm);PCV::InstallInterfaces(*sm);