From 196f8dff084b7229982af214617d55ca084dfed2 Mon Sep 17 00:00:00 2001 From: bunnei Date: Wed, 7 Feb 2018 21:53:31 -0500 Subject: nvmap: Refactor to expose nvmap objects. --- src/core/hle/service/nvdrv/devices/nvmap.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/core/hle/service/nvdrv/devices/nvmap.h') diff --git a/src/core/hle/service/nvdrv/devices/nvmap.h b/src/core/hle/service/nvdrv/devices/nvmap.h index 1591ac8ff..4681e438b 100644 --- a/src/core/hle/service/nvdrv/devices/nvmap.h +++ b/src/core/hle/service/nvdrv/devices/nvmap.h @@ -26,8 +26,7 @@ public: u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; -private: - // Represents an nvmap object. + /// Represents an nvmap object. struct Object { enum class Status { Created, Allocated }; u32 id; @@ -39,10 +38,19 @@ private: Status status; }; + std::shared_ptr GetObject(u32 handle) const { + auto itr = handles.find(handle); + if (itr != handles.end()) { + return itr->second; + } + return {}; + } + +private: /// Id to use for the next handle that is created. u32 next_handle = 1; - // Id to use for the next object that is created. + /// Id to use for the next object that is created. u32 next_id = 1; /// Mapping of currently allocated handles to the objects they represent. -- cgit v1.2.3