summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/hid
diff options
context:
space:
mode:
authorDavid <25727384+ogniK5377@users.noreply.github.com>2018-09-24 04:33:29 +0200
committerbunnei <bunneidev@gmail.com>2018-09-24 04:33:29 +0200
commit2513e086abe4b317763add86d25e6fed7300d6c7 (patch)
treee9c1c58ee19526047f79413760c91d4e165175fd /src/core/hle/service/hid
parentMerge pull request #1354 from ogniK5377/ssl-version (diff)
downloadyuzu-2513e086abe4b317763add86d25e6fed7300d6c7.tar
yuzu-2513e086abe4b317763add86d25e6fed7300d6c7.tar.gz
yuzu-2513e086abe4b317763add86d25e6fed7300d6c7.tar.bz2
yuzu-2513e086abe4b317763add86d25e6fed7300d6c7.tar.lz
yuzu-2513e086abe4b317763add86d25e6fed7300d6c7.tar.xz
yuzu-2513e086abe4b317763add86d25e6fed7300d6c7.tar.zst
yuzu-2513e086abe4b317763add86d25e6fed7300d6c7.zip
Diffstat (limited to 'src/core/hle/service/hid')
-rw-r--r--src/core/hle/service/hid/irs.cpp158
-rw-r--r--src/core/hle/service/hid/irs.h27
2 files changed, 167 insertions, 18 deletions
diff --git a/src/core/hle/service/hid/irs.cpp b/src/core/hle/service/hid/irs.cpp
index e587ad0d8..872e3c344 100644
--- a/src/core/hle/service/hid/irs.cpp
+++ b/src/core/hle/service/hid/irs.cpp
@@ -2,6 +2,11 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include "common/swap.h"
+#include "core/core.h"
+#include "core/core_timing.h"
+#include "core/hle/ipc_helpers.h"
+#include "core/hle/kernel/shared_memory.h"
#include "core/hle/service/hid/irs.h"
namespace Service::HID {
@@ -9,28 +14,145 @@ namespace Service::HID {
IRS::IRS() : ServiceFramework{"irs"} {
// clang-format off
static const FunctionInfo functions[] = {
- {302, nullptr, "ActivateIrsensor"},
- {303, nullptr, "DeactivateIrsensor"},
- {304, nullptr, "GetIrsensorSharedMemoryHandle"},
- {305, nullptr, "StopImageProcessor"},
- {306, nullptr, "RunMomentProcessor"},
- {307, nullptr, "RunClusteringProcessor"},
- {308, nullptr, "RunImageTransferProcessor"},
- {309, nullptr, "GetImageTransferProcessorState"},
- {310, nullptr, "RunTeraPluginProcessor"},
- {311, nullptr, "GetNpadIrCameraHandle"},
- {312, nullptr, "RunPointingProcessor"},
- {313, nullptr, "SuspendImageProcessor"},
- {314, nullptr, "CheckFirmwareVersion"},
- {315, nullptr, "SetFunctionLevel"},
- {316, nullptr, "RunImageTransferExProcessor"},
- {317, nullptr, "RunIrLedProcessor"},
- {318, nullptr, "StopImageProcessorAsync"},
- {319, nullptr, "ActivateIrsensorWithFunctionLevel"},
+ {302, &IRS::ActivateIrsensor, "ActivateIrsensor"},
+ {303, &IRS::DeactivateIrsensor, "DeactivateIrsensor"},
+ {304, &IRS::GetIrsensorSharedMemoryHandle, "GetIrsensorSharedMemoryHandle"},
+ {305, &IRS::StopImageProcessor, "StopImageProcessor"},
+ {306, &IRS::RunMomentProcessor, "RunMomentProcessor"},
+ {307, &IRS::RunClusteringProcessor, "RunClusteringProcessor"},
+ {308, &IRS::RunImageTransferProcessor, "RunImageTransferProcessor"},
+ {309, &IRS::GetImageTransferProcessorState, "GetImageTransferProcessorState"},
+ {310, &IRS::RunTeraPluginProcessor, "RunTeraPluginProcessor"},
+ {311, &IRS::GetNpadIrCameraHandle, "GetNpadIrCameraHandle"},
+ {312, &IRS::RunPointingProcessor, "RunPointingProcessor"},
+ {313, &IRS::SuspendImageProcessor, "SuspendImageProcessor"},
+ {314, &IRS::CheckFirmwareVersion, "CheckFirmwareVersion"},
+ {315, &IRS::SetFunctionLevel, "SetFunctionLevel"},
+ {316, &IRS::RunImageTransferExProcessor, "RunImageTransferExProcessor"},
+ {317, &IRS::RunIrLedProcessor, "RunIrLedProcessor"},
+ {318, &IRS::StopImageProcessorAsync, "StopImageProcessorAsync"},
+ {319, &IRS::ActivateIrsensorWithFunctionLevel, "ActivateIrsensorWithFunctionLevel"},
};
// clang-format on
RegisterHandlers(functions);
+
+ auto& kernel = Core::System::GetInstance().Kernel();
+ shared_mem = Kernel::SharedMemory::Create(
+ kernel, nullptr, 0x8000, Kernel::MemoryPermission::ReadWrite,
+ Kernel::MemoryPermission::Read, 0, Kernel::MemoryRegion::BASE, "IRS:SharedMemory");
+}
+
+void IRS::ActivateIrsensor(Kernel::HLERequestContext& ctx) {
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(RESULT_SUCCESS);
+ LOG_WARNING(Service_IRS, "(STUBBED) called");
+}
+
+void IRS::DeactivateIrsensor(Kernel::HLERequestContext& ctx) {
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(RESULT_SUCCESS);
+ LOG_WARNING(Service_IRS, "(STUBBED) called");
+}
+
+void IRS::GetIrsensorSharedMemoryHandle(Kernel::HLERequestContext& ctx) {
+ IPC::ResponseBuilder rb{ctx, 2, 1};
+ rb.Push(RESULT_SUCCESS);
+ rb.PushCopyObjects(shared_mem);
+ LOG_DEBUG(Service_IRS, "called");
+}
+
+void IRS::StopImageProcessor(Kernel::HLERequestContext& ctx) {
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(RESULT_SUCCESS);
+ LOG_WARNING(Service_IRS, "(STUBBED) called");
+}
+
+void IRS::RunMomentProcessor(Kernel::HLERequestContext& ctx) {
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(RESULT_SUCCESS);
+ LOG_WARNING(Service_IRS, "(STUBBED) called");
+}
+
+void IRS::RunClusteringProcessor(Kernel::HLERequestContext& ctx) {
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(RESULT_SUCCESS);
+ LOG_WARNING(Service_IRS, "(STUBBED) called");
+}
+
+void IRS::RunImageTransferProcessor(Kernel::HLERequestContext& ctx) {
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(RESULT_SUCCESS);
+ LOG_WARNING(Service_IRS, "(STUBBED) called");
+}
+
+void IRS::GetImageTransferProcessorState(Kernel::HLERequestContext& ctx) {
+ IPC::ResponseBuilder rb{ctx, 5};
+ rb.Push(RESULT_SUCCESS);
+ rb.PushRaw<u64>(CoreTiming::GetTicks());
+ rb.PushRaw<u32>(0);
+ LOG_WARNING(Service_IRS, "(STUBBED) called");
+}
+
+void IRS::RunTeraPluginProcessor(Kernel::HLERequestContext& ctx) {
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(RESULT_SUCCESS);
+ LOG_WARNING(Service_IRS, "(STUBBED) called");
+}
+
+void IRS::GetNpadIrCameraHandle(Kernel::HLERequestContext& ctx) {
+ IPC::ResponseBuilder rb{ctx, 3};
+ rb.Push(RESULT_SUCCESS);
+ rb.PushRaw<u32>(device_handle);
+ LOG_WARNING(Service_IRS, "(STUBBED) called");
+}
+
+void IRS::RunPointingProcessor(Kernel::HLERequestContext& ctx) {
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(RESULT_SUCCESS);
+ LOG_WARNING(Service_IRS, "(STUBBED) called");
+}
+
+void IRS::SuspendImageProcessor(Kernel::HLERequestContext& ctx) {
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(RESULT_SUCCESS);
+ LOG_WARNING(Service_IRS, "(STUBBED) called");
+}
+
+void IRS::CheckFirmwareVersion(Kernel::HLERequestContext& ctx) {
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(RESULT_SUCCESS);
+ LOG_WARNING(Service_IRS, "(STUBBED) called");
+}
+
+void IRS::SetFunctionLevel(Kernel::HLERequestContext& ctx) {
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(RESULT_SUCCESS);
+ LOG_WARNING(Service_IRS, "(STUBBED) called");
+}
+
+void IRS::RunImageTransferExProcessor(Kernel::HLERequestContext& ctx) {
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(RESULT_SUCCESS);
+ LOG_WARNING(Service_IRS, "(STUBBED) called");
+}
+
+void IRS::RunIrLedProcessor(Kernel::HLERequestContext& ctx) {
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(RESULT_SUCCESS);
+ LOG_WARNING(Service_IRS, "(STUBBED) called");
+}
+
+void IRS::StopImageProcessorAsync(Kernel::HLERequestContext& ctx) {
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(RESULT_SUCCESS);
+ LOG_WARNING(Service_IRS, "(STUBBED) called");
+}
+
+void IRS::ActivateIrsensorWithFunctionLevel(Kernel::HLERequestContext& ctx) {
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(RESULT_SUCCESS);
+ LOG_WARNING(Service_IRS, "(STUBBED) called");
}
IRS::~IRS() = default;
diff --git a/src/core/hle/service/hid/irs.h b/src/core/hle/service/hid/irs.h
index 6fb16b45d..12de6bfb3 100644
--- a/src/core/hle/service/hid/irs.h
+++ b/src/core/hle/service/hid/irs.h
@@ -4,14 +4,41 @@
#pragma once
+#include "core/hle/kernel/object.h"
#include "core/hle/service/service.h"
+namespace Kernel {
+class SharedMemory;
+}
+
namespace Service::HID {
class IRS final : public ServiceFramework<IRS> {
public:
explicit IRS();
~IRS() override;
+
+private:
+ void ActivateIrsensor(Kernel::HLERequestContext& ctx);
+ void DeactivateIrsensor(Kernel::HLERequestContext& ctx);
+ void GetIrsensorSharedMemoryHandle(Kernel::HLERequestContext& ctx);
+ void StopImageProcessor(Kernel::HLERequestContext& ctx);
+ void RunMomentProcessor(Kernel::HLERequestContext& ctx);
+ void RunClusteringProcessor(Kernel::HLERequestContext& ctx);
+ void RunImageTransferProcessor(Kernel::HLERequestContext& ctx);
+ void GetImageTransferProcessorState(Kernel::HLERequestContext& ctx);
+ void RunTeraPluginProcessor(Kernel::HLERequestContext& ctx);
+ void GetNpadIrCameraHandle(Kernel::HLERequestContext& ctx);
+ void RunPointingProcessor(Kernel::HLERequestContext& ctx);
+ void SuspendImageProcessor(Kernel::HLERequestContext& ctx);
+ void CheckFirmwareVersion(Kernel::HLERequestContext& ctx);
+ void SetFunctionLevel(Kernel::HLERequestContext& ctx);
+ void RunImageTransferExProcessor(Kernel::HLERequestContext& ctx);
+ void RunIrLedProcessor(Kernel::HLERequestContext& ctx);
+ void StopImageProcessorAsync(Kernel::HLERequestContext& ctx);
+ void ActivateIrsensorWithFunctionLevel(Kernel::HLERequestContext& ctx);
+ Kernel::SharedPtr<Kernel::SharedMemory> shared_mem;
+ const u32 device_handle{0xABCD};
};
class IRS_SYS final : public ServiceFramework<IRS_SYS> {