summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-01-17 18:29:23 +0100
committerGitHub <noreply@github.com>2018-01-17 18:29:23 +0100
commit8bff9c91525da2617e5152a16e09b980237dce75 (patch)
tree16b569b3e1e1cdf463b5a2effbb266f95571bce2 /src/core/hle
parentsvc: Clang-format fix. (diff)
parentnvdrv: stubbed Close(cmd 2) (diff)
downloadyuzu-8bff9c91525da2617e5152a16e09b980237dce75.tar
yuzu-8bff9c91525da2617e5152a16e09b980237dce75.tar.gz
yuzu-8bff9c91525da2617e5152a16e09b980237dce75.tar.bz2
yuzu-8bff9c91525da2617e5152a16e09b980237dce75.tar.lz
yuzu-8bff9c91525da2617e5152a16e09b980237dce75.tar.xz
yuzu-8bff9c91525da2617e5152a16e09b980237dce75.tar.zst
yuzu-8bff9c91525da2617e5152a16e09b980237dce75.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/nvdrv/interface.cpp13
-rw-r--r--src/core/hle/service/nvdrv/interface.h1
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.cpp10
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.h2
4 files changed, 26 insertions, 0 deletions
diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp
index 0670ca155..848615fa7 100644
--- a/src/core/hle/service/nvdrv/interface.cpp
+++ b/src/core/hle/service/nvdrv/interface.cpp
@@ -48,6 +48,18 @@ void NVDRV::Ioctl(Kernel::HLERequestContext& ctx) {
rb.Push(nv_result);
}
+void NVDRV::Close(Kernel::HLERequestContext& ctx) {
+ LOG_WARNING(Service, "(STUBBED) called");
+
+ IPC::RequestParser rp{ctx};
+ u32 fd = rp.Pop<u32>();
+
+ auto result = nvdrv->Close(fd);
+
+ IPC::RequestBuilder rb{ctx, 2};
+ rb.Push(result);
+}
+
void NVDRV::Initialize(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service, "(STUBBED) called");
IPC::RequestBuilder rb{ctx, 3};
@@ -60,6 +72,7 @@ NVDRV::NVDRV(std::shared_ptr<Module> nvdrv, const char* name)
static const FunctionInfo functions[] = {
{0, &NVDRV::Open, "Open"},
{1, &NVDRV::Ioctl, "Ioctl"},
+ {2, &NVDRV::Close, "Close"},
{3, &NVDRV::Initialize, "Initialize"},
};
RegisterHandlers(functions);
diff --git a/src/core/hle/service/nvdrv/interface.h b/src/core/hle/service/nvdrv/interface.h
index 8c95b7217..1b9aa9938 100644
--- a/src/core/hle/service/nvdrv/interface.h
+++ b/src/core/hle/service/nvdrv/interface.h
@@ -20,6 +20,7 @@ public:
private:
void Open(Kernel::HLERequestContext& ctx);
void Ioctl(Kernel::HLERequestContext& ctx);
+ void Close(Kernel::HLERequestContext& ctx);
void Initialize(Kernel::HLERequestContext& ctx);
std::shared_ptr<Module> nvdrv;
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp
index cf525a875..9b73886bb 100644
--- a/src/core/hle/service/nvdrv/nvdrv.cpp
+++ b/src/core/hle/service/nvdrv/nvdrv.cpp
@@ -49,5 +49,15 @@ u32 Module::Ioctl(u32 fd, u32 command, const std::vector<u8>& input, std::vector
return device->ioctl(command, input, output);
}
+ResultCode Module::Close(u32 fd) {
+ auto itr = open_files.find(fd);
+ ASSERT_MSG(itr != open_files.end(), "Tried to talk to an invalid device");
+
+ open_files.erase(itr);
+
+ // TODO(flerovium): return correct result code if operation failed.
+ return RESULT_SUCCESS;
+}
+
} // namespace Nvidia
} // namespace Service
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h
index 1940ced99..e44644624 100644
--- a/src/core/hle/service/nvdrv/nvdrv.h
+++ b/src/core/hle/service/nvdrv/nvdrv.h
@@ -35,6 +35,8 @@ public:
u32 Open(std::string device_name);
/// Sends an ioctl command to the specified file descriptor.
u32 Ioctl(u32 fd, u32 command, const std::vector<u8>& input, std::vector<u8>& output);
+ /// Closes a device file descriptor and returns operation success.
+ ResultCode Close(u32 fd);
private:
/// Id to use for the next open file descriptor.