diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/nvdrv/nvdrv_a.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/core/hle/service/nvdrv/nvdrv_a.h b/src/core/hle/service/nvdrv/nvdrv_a.h index 09522a486..af1017881 100644 --- a/src/core/hle/service/nvdrv/nvdrv_a.h +++ b/src/core/hle/service/nvdrv/nvdrv_a.h @@ -4,8 +4,9 @@ #pragma once -#include "core/hle/service/service.h" #include <memory> +#include "core/hle/service/service.h" +#include "core/hle/service/nvdrv/nvdrv.h" namespace Service { namespace NVDRV { @@ -15,6 +16,15 @@ public: NVDRV_A(); ~NVDRV_A() = default; + /// Returns a pointer to one of the available devices, identified by its name. + template <typename T> + std::shared_ptr<T> GetDevice(std::string name) { + auto itr = devices.find(name); + if (itr == devices.end()) + return nullptr; + return std::static_pointer_cast<T>(itr->second); + } + private: void Open(Kernel::HLERequestContext& ctx); void Ioctl(Kernel::HLERequestContext& ctx); @@ -26,5 +36,7 @@ private: std::unordered_map<std::string, std::shared_ptr<nvdevice>> devices; }; +extern std::weak_ptr<NVDRV_A> nvdrv_a; + } // namespace NVDRV } // namespace Service |