diff options
| -rw-r--r-- | src/core/hle/service/nvdrv/nvdrv.cpp | 10 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/nvdrv.h | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp index cc5cfe34e..1555ea806 100644 --- a/src/core/hle/service/nvdrv/nvdrv.cpp +++ b/src/core/hle/service/nvdrv/nvdrv.cpp | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <utility> | ||
| 6 | |||
| 5 | #include "core/hle/ipc_helpers.h" | 7 | #include "core/hle/ipc_helpers.h" |
| 6 | #include "core/hle/service/nvdrv/devices/nvdevice.h" | 8 | #include "core/hle/service/nvdrv/devices/nvdevice.h" |
| 7 | #include "core/hle/service/nvdrv/devices/nvdisp_disp0.h" | 9 | #include "core/hle/service/nvdrv/devices/nvdisp_disp0.h" |
| @@ -40,14 +42,14 @@ Module::Module() { | |||
| 40 | devices["/dev/nvhost-nvdec"] = std::make_shared<Devices::nvhost_nvdec>(); | 42 | devices["/dev/nvhost-nvdec"] = std::make_shared<Devices::nvhost_nvdec>(); |
| 41 | } | 43 | } |
| 42 | 44 | ||
| 43 | u32 Module::Open(std::string device_name) { | 45 | u32 Module::Open(const std::string& device_name) { |
| 44 | ASSERT_MSG(devices.find(device_name) != devices.end(), "Trying to open unknown device {}", | 46 | ASSERT_MSG(devices.find(device_name) != devices.end(), "Trying to open unknown device {}", |
| 45 | device_name); | 47 | device_name); |
| 46 | 48 | ||
| 47 | auto device = devices[device_name]; | 49 | auto device = devices[device_name]; |
| 48 | u32 fd = next_fd++; | 50 | const u32 fd = next_fd++; |
| 49 | 51 | ||
| 50 | open_files[fd] = device; | 52 | open_files[fd] = std::move(device); |
| 51 | 53 | ||
| 52 | return fd; | 54 | return fd; |
| 53 | } | 55 | } |
| @@ -56,7 +58,7 @@ u32 Module::Ioctl(u32 fd, u32_le command, const std::vector<u8>& input, std::vec | |||
| 56 | auto itr = open_files.find(fd); | 58 | auto itr = open_files.find(fd); |
| 57 | ASSERT_MSG(itr != open_files.end(), "Tried to talk to an invalid device"); | 59 | ASSERT_MSG(itr != open_files.end(), "Tried to talk to an invalid device"); |
| 58 | 60 | ||
| 59 | auto device = itr->second; | 61 | auto& device = itr->second; |
| 60 | return device->ioctl({command}, input, output); | 62 | return device->ioctl({command}, input, output); |
| 61 | } | 63 | } |
| 62 | 64 | ||
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h index 35b2c65fc..184f3c9fc 100644 --- a/src/core/hle/service/nvdrv/nvdrv.h +++ b/src/core/hle/service/nvdrv/nvdrv.h | |||
| @@ -38,7 +38,7 @@ public: | |||
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | /// Opens a device node and returns a file descriptor to it. | 40 | /// Opens a device node and returns a file descriptor to it. |
| 41 | u32 Open(std::string device_name); | 41 | u32 Open(const std::string& device_name); |
| 42 | /// Sends an ioctl command to the specified file descriptor. | 42 | /// Sends an ioctl command to the specified file descriptor. |
| 43 | u32 Ioctl(u32 fd, u32 command, const std::vector<u8>& input, std::vector<u8>& output); | 43 | u32 Ioctl(u32 fd, u32 command, const std::vector<u8>& input, std::vector<u8>& output); |
| 44 | /// Closes a device file descriptor and returns operation success. | 44 | /// Closes a device file descriptor and returns operation success. |