diff options
| -rw-r--r-- | src/common/logging/backend.cpp | 1 | ||||
| -rw-r--r-- | src/common/logging/log.h | 1 | ||||
| -rw-r--r-- | src/core/hle/service/hid/irs.cpp | 158 | ||||
| -rw-r--r-- | src/core/hle/service/hid/irs.h | 27 |
4 files changed, 169 insertions, 18 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index efd776db6..9f5918851 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp | |||
| @@ -183,6 +183,7 @@ void FileBackend::Write(const Entry& entry) { | |||
| 183 | SUB(Service, FS) \ | 183 | SUB(Service, FS) \ |
| 184 | SUB(Service, GRC) \ | 184 | SUB(Service, GRC) \ |
| 185 | SUB(Service, HID) \ | 185 | SUB(Service, HID) \ |
| 186 | SUB(Service, IRS) \ | ||
| 186 | SUB(Service, LBL) \ | 187 | SUB(Service, LBL) \ |
| 187 | SUB(Service, LDN) \ | 188 | SUB(Service, LDN) \ |
| 188 | SUB(Service, LDR) \ | 189 | SUB(Service, LDR) \ |
diff --git a/src/common/logging/log.h b/src/common/logging/log.h index 4d577524f..abbd056ee 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h | |||
| @@ -70,6 +70,7 @@ enum class Class : ClassType { | |||
| 70 | Service_FS, ///< The FS (Filesystem) service | 70 | Service_FS, ///< The FS (Filesystem) service |
| 71 | Service_GRC, ///< The game recording service | 71 | Service_GRC, ///< The game recording service |
| 72 | Service_HID, ///< The HID (Human interface device) service | 72 | Service_HID, ///< The HID (Human interface device) service |
| 73 | Service_IRS, ///< The IRS service | ||
| 73 | Service_LBL, ///< The LBL (LCD backlight) service | 74 | Service_LBL, ///< The LBL (LCD backlight) service |
| 74 | Service_LDN, ///< The LDN (Local domain network) service | 75 | Service_LDN, ///< The LDN (Local domain network) service |
| 75 | Service_LDR, ///< The loader service | 76 | Service_LDR, ///< The loader service |
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 @@ | |||
| 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 "common/swap.h" | ||
| 6 | #include "core/core.h" | ||
| 7 | #include "core/core_timing.h" | ||
| 8 | #include "core/hle/ipc_helpers.h" | ||
| 9 | #include "core/hle/kernel/shared_memory.h" | ||
| 5 | #include "core/hle/service/hid/irs.h" | 10 | #include "core/hle/service/hid/irs.h" |
| 6 | 11 | ||
| 7 | namespace Service::HID { | 12 | namespace Service::HID { |
| @@ -9,28 +14,145 @@ namespace Service::HID { | |||
| 9 | IRS::IRS() : ServiceFramework{"irs"} { | 14 | IRS::IRS() : ServiceFramework{"irs"} { |
| 10 | // clang-format off | 15 | // clang-format off |
| 11 | static const FunctionInfo functions[] = { | 16 | static const FunctionInfo functions[] = { |
| 12 | {302, nullptr, "ActivateIrsensor"}, | 17 | {302, &IRS::ActivateIrsensor, "ActivateIrsensor"}, |
| 13 | {303, nullptr, "DeactivateIrsensor"}, | 18 | {303, &IRS::DeactivateIrsensor, "DeactivateIrsensor"}, |
| 14 | {304, nullptr, "GetIrsensorSharedMemoryHandle"}, | 19 | {304, &IRS::GetIrsensorSharedMemoryHandle, "GetIrsensorSharedMemoryHandle"}, |
| 15 | {305, nullptr, "StopImageProcessor"}, | 20 | {305, &IRS::StopImageProcessor, "StopImageProcessor"}, |
| 16 | {306, nullptr, "RunMomentProcessor"}, | 21 | {306, &IRS::RunMomentProcessor, "RunMomentProcessor"}, |
| 17 | {307, nullptr, "RunClusteringProcessor"}, | 22 | {307, &IRS::RunClusteringProcessor, "RunClusteringProcessor"}, |
| 18 | {308, nullptr, "RunImageTransferProcessor"}, | 23 | {308, &IRS::RunImageTransferProcessor, "RunImageTransferProcessor"}, |
| 19 | {309, nullptr, "GetImageTransferProcessorState"}, | 24 | {309, &IRS::GetImageTransferProcessorState, "GetImageTransferProcessorState"}, |
| 20 | {310, nullptr, "RunTeraPluginProcessor"}, | 25 | {310, &IRS::RunTeraPluginProcessor, "RunTeraPluginProcessor"}, |
| 21 | {311, nullptr, "GetNpadIrCameraHandle"}, | 26 | {311, &IRS::GetNpadIrCameraHandle, "GetNpadIrCameraHandle"}, |
| 22 | {312, nullptr, "RunPointingProcessor"}, | 27 | {312, &IRS::RunPointingProcessor, "RunPointingProcessor"}, |
| 23 | {313, nullptr, "SuspendImageProcessor"}, | 28 | {313, &IRS::SuspendImageProcessor, "SuspendImageProcessor"}, |
| 24 | {314, nullptr, "CheckFirmwareVersion"}, | 29 | {314, &IRS::CheckFirmwareVersion, "CheckFirmwareVersion"}, |
| 25 | {315, nullptr, "SetFunctionLevel"}, | 30 | {315, &IRS::SetFunctionLevel, "SetFunctionLevel"}, |
| 26 | {316, nullptr, "RunImageTransferExProcessor"}, | 31 | {316, &IRS::RunImageTransferExProcessor, "RunImageTransferExProcessor"}, |
| 27 | {317, nullptr, "RunIrLedProcessor"}, | 32 | {317, &IRS::RunIrLedProcessor, "RunIrLedProcessor"}, |
| 28 | {318, nullptr, "StopImageProcessorAsync"}, | 33 | {318, &IRS::StopImageProcessorAsync, "StopImageProcessorAsync"}, |
| 29 | {319, nullptr, "ActivateIrsensorWithFunctionLevel"}, | 34 | {319, &IRS::ActivateIrsensorWithFunctionLevel, "ActivateIrsensorWithFunctionLevel"}, |
| 30 | }; | 35 | }; |
| 31 | // clang-format on | 36 | // clang-format on |
| 32 | 37 | ||
| 33 | RegisterHandlers(functions); | 38 | RegisterHandlers(functions); |
| 39 | |||
| 40 | auto& kernel = Core::System::GetInstance().Kernel(); | ||
| 41 | shared_mem = Kernel::SharedMemory::Create( | ||
| 42 | kernel, nullptr, 0x8000, Kernel::MemoryPermission::ReadWrite, | ||
| 43 | Kernel::MemoryPermission::Read, 0, Kernel::MemoryRegion::BASE, "IRS:SharedMemory"); | ||
| 44 | } | ||
| 45 | |||
| 46 | void IRS::ActivateIrsensor(Kernel::HLERequestContext& ctx) { | ||
| 47 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 48 | rb.Push(RESULT_SUCCESS); | ||
| 49 | LOG_WARNING(Service_IRS, "(STUBBED) called"); | ||
| 50 | } | ||
| 51 | |||
| 52 | void IRS::DeactivateIrsensor(Kernel::HLERequestContext& ctx) { | ||
| 53 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 54 | rb.Push(RESULT_SUCCESS); | ||
| 55 | LOG_WARNING(Service_IRS, "(STUBBED) called"); | ||
| 56 | } | ||
| 57 | |||
| 58 | void IRS::GetIrsensorSharedMemoryHandle(Kernel::HLERequestContext& ctx) { | ||
| 59 | IPC::ResponseBuilder rb{ctx, 2, 1}; | ||
| 60 | rb.Push(RESULT_SUCCESS); | ||
| 61 | rb.PushCopyObjects(shared_mem); | ||
| 62 | LOG_DEBUG(Service_IRS, "called"); | ||
| 63 | } | ||
| 64 | |||
| 65 | void IRS::StopImageProcessor(Kernel::HLERequestContext& ctx) { | ||
| 66 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 67 | rb.Push(RESULT_SUCCESS); | ||
| 68 | LOG_WARNING(Service_IRS, "(STUBBED) called"); | ||
| 69 | } | ||
| 70 | |||
| 71 | void IRS::RunMomentProcessor(Kernel::HLERequestContext& ctx) { | ||
| 72 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 73 | rb.Push(RESULT_SUCCESS); | ||
| 74 | LOG_WARNING(Service_IRS, "(STUBBED) called"); | ||
| 75 | } | ||
| 76 | |||
| 77 | void IRS::RunClusteringProcessor(Kernel::HLERequestContext& ctx) { | ||
| 78 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 79 | rb.Push(RESULT_SUCCESS); | ||
| 80 | LOG_WARNING(Service_IRS, "(STUBBED) called"); | ||
| 81 | } | ||
| 82 | |||
| 83 | void IRS::RunImageTransferProcessor(Kernel::HLERequestContext& ctx) { | ||
| 84 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 85 | rb.Push(RESULT_SUCCESS); | ||
| 86 | LOG_WARNING(Service_IRS, "(STUBBED) called"); | ||
| 87 | } | ||
| 88 | |||
| 89 | void IRS::GetImageTransferProcessorState(Kernel::HLERequestContext& ctx) { | ||
| 90 | IPC::ResponseBuilder rb{ctx, 5}; | ||
| 91 | rb.Push(RESULT_SUCCESS); | ||
| 92 | rb.PushRaw<u64>(CoreTiming::GetTicks()); | ||
| 93 | rb.PushRaw<u32>(0); | ||
| 94 | LOG_WARNING(Service_IRS, "(STUBBED) called"); | ||
| 95 | } | ||
| 96 | |||
| 97 | void IRS::RunTeraPluginProcessor(Kernel::HLERequestContext& ctx) { | ||
| 98 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 99 | rb.Push(RESULT_SUCCESS); | ||
| 100 | LOG_WARNING(Service_IRS, "(STUBBED) called"); | ||
| 101 | } | ||
| 102 | |||
| 103 | void IRS::GetNpadIrCameraHandle(Kernel::HLERequestContext& ctx) { | ||
| 104 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 105 | rb.Push(RESULT_SUCCESS); | ||
| 106 | rb.PushRaw<u32>(device_handle); | ||
| 107 | LOG_WARNING(Service_IRS, "(STUBBED) called"); | ||
| 108 | } | ||
| 109 | |||
| 110 | void IRS::RunPointingProcessor(Kernel::HLERequestContext& ctx) { | ||
| 111 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 112 | rb.Push(RESULT_SUCCESS); | ||
| 113 | LOG_WARNING(Service_IRS, "(STUBBED) called"); | ||
| 114 | } | ||
| 115 | |||
| 116 | void IRS::SuspendImageProcessor(Kernel::HLERequestContext& ctx) { | ||
| 117 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 118 | rb.Push(RESULT_SUCCESS); | ||
| 119 | LOG_WARNING(Service_IRS, "(STUBBED) called"); | ||
| 120 | } | ||
| 121 | |||
| 122 | void IRS::CheckFirmwareVersion(Kernel::HLERequestContext& ctx) { | ||
| 123 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 124 | rb.Push(RESULT_SUCCESS); | ||
| 125 | LOG_WARNING(Service_IRS, "(STUBBED) called"); | ||
| 126 | } | ||
| 127 | |||
| 128 | void IRS::SetFunctionLevel(Kernel::HLERequestContext& ctx) { | ||
| 129 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 130 | rb.Push(RESULT_SUCCESS); | ||
| 131 | LOG_WARNING(Service_IRS, "(STUBBED) called"); | ||
| 132 | } | ||
| 133 | |||
| 134 | void IRS::RunImageTransferExProcessor(Kernel::HLERequestContext& ctx) { | ||
| 135 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 136 | rb.Push(RESULT_SUCCESS); | ||
| 137 | LOG_WARNING(Service_IRS, "(STUBBED) called"); | ||
| 138 | } | ||
| 139 | |||
| 140 | void IRS::RunIrLedProcessor(Kernel::HLERequestContext& ctx) { | ||
| 141 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 142 | rb.Push(RESULT_SUCCESS); | ||
| 143 | LOG_WARNING(Service_IRS, "(STUBBED) called"); | ||
| 144 | } | ||
| 145 | |||
| 146 | void IRS::StopImageProcessorAsync(Kernel::HLERequestContext& ctx) { | ||
| 147 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 148 | rb.Push(RESULT_SUCCESS); | ||
| 149 | LOG_WARNING(Service_IRS, "(STUBBED) called"); | ||
| 150 | } | ||
| 151 | |||
| 152 | void IRS::ActivateIrsensorWithFunctionLevel(Kernel::HLERequestContext& ctx) { | ||
| 153 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 154 | rb.Push(RESULT_SUCCESS); | ||
| 155 | LOG_WARNING(Service_IRS, "(STUBBED) called"); | ||
| 34 | } | 156 | } |
| 35 | 157 | ||
| 36 | IRS::~IRS() = default; | 158 | 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 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "core/hle/kernel/object.h" | ||
| 7 | #include "core/hle/service/service.h" | 8 | #include "core/hle/service/service.h" |
| 8 | 9 | ||
| 10 | namespace Kernel { | ||
| 11 | class SharedMemory; | ||
| 12 | } | ||
| 13 | |||
| 9 | namespace Service::HID { | 14 | namespace Service::HID { |
| 10 | 15 | ||
| 11 | class IRS final : public ServiceFramework<IRS> { | 16 | class IRS final : public ServiceFramework<IRS> { |
| 12 | public: | 17 | public: |
| 13 | explicit IRS(); | 18 | explicit IRS(); |
| 14 | ~IRS() override; | 19 | ~IRS() override; |
| 20 | |||
| 21 | private: | ||
| 22 | void ActivateIrsensor(Kernel::HLERequestContext& ctx); | ||
| 23 | void DeactivateIrsensor(Kernel::HLERequestContext& ctx); | ||
| 24 | void GetIrsensorSharedMemoryHandle(Kernel::HLERequestContext& ctx); | ||
| 25 | void StopImageProcessor(Kernel::HLERequestContext& ctx); | ||
| 26 | void RunMomentProcessor(Kernel::HLERequestContext& ctx); | ||
| 27 | void RunClusteringProcessor(Kernel::HLERequestContext& ctx); | ||
| 28 | void RunImageTransferProcessor(Kernel::HLERequestContext& ctx); | ||
| 29 | void GetImageTransferProcessorState(Kernel::HLERequestContext& ctx); | ||
| 30 | void RunTeraPluginProcessor(Kernel::HLERequestContext& ctx); | ||
| 31 | void GetNpadIrCameraHandle(Kernel::HLERequestContext& ctx); | ||
| 32 | void RunPointingProcessor(Kernel::HLERequestContext& ctx); | ||
| 33 | void SuspendImageProcessor(Kernel::HLERequestContext& ctx); | ||
| 34 | void CheckFirmwareVersion(Kernel::HLERequestContext& ctx); | ||
| 35 | void SetFunctionLevel(Kernel::HLERequestContext& ctx); | ||
| 36 | void RunImageTransferExProcessor(Kernel::HLERequestContext& ctx); | ||
| 37 | void RunIrLedProcessor(Kernel::HLERequestContext& ctx); | ||
| 38 | void StopImageProcessorAsync(Kernel::HLERequestContext& ctx); | ||
| 39 | void ActivateIrsensorWithFunctionLevel(Kernel::HLERequestContext& ctx); | ||
| 40 | Kernel::SharedPtr<Kernel::SharedMemory> shared_mem; | ||
| 41 | const u32 device_handle{0xABCD}; | ||
| 15 | }; | 42 | }; |
| 16 | 43 | ||
| 17 | class IRS_SYS final : public ServiceFramework<IRS_SYS> { | 44 | class IRS_SYS final : public ServiceFramework<IRS_SYS> { |