diff options
Diffstat (limited to 'src/core/hle/service/hid')
18 files changed, 66 insertions, 69 deletions
diff --git a/src/core/hle/service/hid/errors.h b/src/core/hle/service/hid/errors.h index 1bd62461c..accc2b646 100644 --- a/src/core/hle/service/hid/errors.h +++ b/src/core/hle/service/hid/errors.h @@ -18,7 +18,11 @@ constexpr Result NpadIsSameType{ErrorModule::HID, 602}; constexpr Result InvalidNpadId{ErrorModule::HID, 709}; constexpr Result NpadNotConnected{ErrorModule::HID, 710}; +} // namespace Service::HID + +namespace Service::IRS { + constexpr ResultCode InvalidProcessorState{ErrorModule::Irsensor, 78}; constexpr ResultCode InvalidIrCameraHandle{ErrorModule::Irsensor, 204}; -} // namespace Service::HID +} // namespace Service::IRS diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 89bb12442..5ecbddf94 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -2345,8 +2345,8 @@ void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system std::make_shared<HidSys>(system)->InstallAsService(service_manager); std::make_shared<HidTmp>(system)->InstallAsService(service_manager); - std::make_shared<IRS>(system)->InstallAsService(service_manager); - std::make_shared<IRS_SYS>(system)->InstallAsService(service_manager); + std::make_shared<Service::IRS::IRS>(system)->InstallAsService(service_manager); + std::make_shared<Service::IRS::IRS_SYS>(system)->InstallAsService(service_manager); std::make_shared<XCD_SYS>(system)->InstallAsService(service_manager); } diff --git a/src/core/hle/service/hid/irs.cpp b/src/core/hle/service/hid/irs.cpp index 53a31df79..b6e7c0792 100644 --- a/src/core/hle/service/hid/irs.cpp +++ b/src/core/hle/service/hid/irs.cpp @@ -22,7 +22,7 @@ #include "core/hle/service/hid/irsensor/tera_plugin_processor.h" #include "core/memory.h" -namespace Service::HID { +namespace Service::IRS { IRS::IRS(Core::System& system_) : ServiceFramework{system_, "irs"} { // clang-format off @@ -60,7 +60,7 @@ void IRS::ActivateIrsensor(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto applet_resource_user_id{rp.Pop<u64>()}; - LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}", + LOG_WARNING(Service_IRS, "(STUBBED) called, applet_resource_user_id={}", applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; @@ -71,7 +71,7 @@ void IRS::DeactivateIrsensor(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto applet_resource_user_id{rp.Pop<u64>()}; - LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}", + LOG_WARNING(Service_IRS, "(STUBBED) called, applet_resource_user_id={}", applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; @@ -153,7 +153,7 @@ void IRS::RunClusteringProcessor(Kernel::HLERequestContext& ctx) { u64 applet_resource_user_id; Core::IrSensor::PackedClusteringProcessorConfig processor_config; }; - static_assert(sizeof(Parameters) == 0x40, "Parameters has incorrect size."); + static_assert(sizeof(Parameters) == 0x38, "Parameters has incorrect size."); const auto parameters{rp.PopRaw<Parameters>()}; @@ -194,7 +194,7 @@ void IRS::RunImageTransferProcessor(Kernel::HLERequestContext& ctx) { system.CurrentProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(t_mem_handle); if (t_mem.IsNull()) { - LOG_ERROR(Service_HID, "t_mem is a nullptr for handle=0x{:08X}", t_mem_handle); + LOG_ERROR(Service_IRS, "t_mem is a nullptr for handle=0x{:08X}", t_mem_handle); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultUnknown); return; @@ -268,24 +268,32 @@ void IRS::GetImageTransferProcessorState(Kernel::HLERequestContext& ctx) { void IRS::RunTeraPluginProcessor(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - const auto camera_handle{rp.PopRaw<Core::IrSensor::IrCameraHandle>()}; - const auto processor_config{rp.PopRaw<Core::IrSensor::PackedTeraPluginProcessorConfig>()}; - const auto applet_resource_user_id{rp.Pop<u64>()}; + struct Parameters { + Core::IrSensor::IrCameraHandle camera_handle; + Core::IrSensor::PackedTeraPluginProcessorConfig processor_config; + INSERT_PADDING_WORDS_NOINIT(1); + u64 applet_resource_user_id; + }; + static_assert(sizeof(Parameters) == 0x18, "Parameters has incorrect size."); - LOG_WARNING(Service_IRS, - "(STUBBED) called, npad_type={}, npad_id={}, mode={}, mcu_version={}.{}, " - "applet_resource_user_id={}", - camera_handle.npad_type, camera_handle.npad_id, processor_config.mode, - processor_config.required_mcu_version.major, - processor_config.required_mcu_version.minor, applet_resource_user_id); + const auto parameters{rp.PopRaw<Parameters>()}; + + LOG_WARNING( + Service_IRS, + "(STUBBED) called, npad_type={}, npad_id={}, mode={}, mcu_version={}.{}, " + "applet_resource_user_id={}", + parameters.camera_handle.npad_type, parameters.camera_handle.npad_id, + parameters.processor_config.mode, parameters.processor_config.required_mcu_version.major, + parameters.processor_config.required_mcu_version.minor, parameters.applet_resource_user_id); - const auto result = IsIrCameraHandleValid(camera_handle); + const auto result = IsIrCameraHandleValid(parameters.camera_handle); if (result.IsSuccess()) { - auto& device = GetIrCameraSharedMemoryDeviceEntry(camera_handle); - MakeProcessor<TeraPluginProcessor>(camera_handle, device); - auto& image_transfer_processor = GetProcessor<TeraPluginProcessor>(camera_handle); - image_transfer_processor.SetConfig(processor_config); + auto& device = GetIrCameraSharedMemoryDeviceEntry(parameters.camera_handle); + MakeProcessor<TeraPluginProcessor>(parameters.camera_handle, device); + auto& image_transfer_processor = + GetProcessor<TeraPluginProcessor>(parameters.camera_handle); + image_transfer_processor.SetConfig(parameters.processor_config); } IPC::ResponseBuilder rb{ctx, 2}; @@ -299,7 +307,7 @@ void IRS::GetNpadIrCameraHandle(Kernel::HLERequestContext& ctx) { if (npad_id > Core::HID::NpadIdType::Player8 && npad_id != Core::HID::NpadIdType::Invalid && npad_id != Core::HID::NpadIdType::Handheld) { IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(InvalidNpadId); + rb.Push(Service::HID::InvalidNpadId); return; } @@ -553,4 +561,4 @@ IRS_SYS::IRS_SYS(Core::System& system_) : ServiceFramework{system_, "irs:sys"} { IRS_SYS::~IRS_SYS() = default; -} // namespace Service::HID +} // namespace Service::IRS diff --git a/src/core/hle/service/hid/irs.h b/src/core/hle/service/hid/irs.h index ae7f7719b..516620b4d 100644 --- a/src/core/hle/service/hid/irs.h +++ b/src/core/hle/service/hid/irs.h @@ -16,7 +16,7 @@ namespace Core::HID { class EmulatedController; } // namespace Core::HID -namespace Service::HID { +namespace Service::IRS { class IRS final : public ServiceFramework<IRS> { public: @@ -114,4 +114,4 @@ public: ~IRS_SYS() override; }; -} // namespace Service::HID +} // namespace Service::IRS diff --git a/src/core/hle/service/hid/irsensor/clustering_processor.cpp b/src/core/hle/service/hid/irsensor/clustering_processor.cpp index aac3e4fec..6479af212 100644 --- a/src/core/hle/service/hid/irsensor/clustering_processor.cpp +++ b/src/core/hle/service/hid/irsensor/clustering_processor.cpp @@ -3,14 +3,12 @@ #include "core/hle/service/hid/irsensor/clustering_processor.h" -namespace Service::HID { +namespace Service::IRS { ClusteringProcessor::ClusteringProcessor(Core::IrSensor::DeviceFormat& device_format) : device(device_format) { device.mode = Core::IrSensor::IrSensorMode::ClusteringProcessor; device.camera_status = Core::IrSensor::IrCameraStatus::Unconnected; device.camera_internal_status = Core::IrSensor::IrCameraInternalStatus::Stopped; - device.state.start = 0; - device.state.count = 0; } ClusteringProcessor::~ClusteringProcessor() = default; @@ -33,4 +31,4 @@ void ClusteringProcessor::SetConfig(Core::IrSensor::PackedClusteringProcessorCon current_config.object_intensity_min = config.object_intensity_min; } -} // namespace Service::HID +} // namespace Service::IRS diff --git a/src/core/hle/service/hid/irsensor/clustering_processor.h b/src/core/hle/service/hid/irsensor/clustering_processor.h index 58b2acf1c..6e2ba8846 100644 --- a/src/core/hle/service/hid/irsensor/clustering_processor.h +++ b/src/core/hle/service/hid/irsensor/clustering_processor.h @@ -7,7 +7,7 @@ #include "core/hid/irs_types.h" #include "core/hle/service/hid/irsensor/processor_base.h" -namespace Service::HID { +namespace Service::IRS { class ClusteringProcessor final : public ProcessorBase { public: explicit ClusteringProcessor(Core::IrSensor::DeviceFormat& device_format); @@ -71,4 +71,4 @@ private: ClusteringProcessorConfig current_config{}; Core::IrSensor::DeviceFormat& device; }; -} // namespace Service::HID +} // namespace Service::IRS diff --git a/src/core/hle/service/hid/irsensor/image_transfer_processor.cpp b/src/core/hle/service/hid/irsensor/image_transfer_processor.cpp index 703e825e6..98f0c579d 100644 --- a/src/core/hle/service/hid/irsensor/image_transfer_processor.cpp +++ b/src/core/hle/service/hid/irsensor/image_transfer_processor.cpp @@ -5,7 +5,7 @@ #include "core/hid/hid_core.h" #include "core/hle/service/hid/irsensor/image_transfer_processor.h" -namespace Service::HID { +namespace Service::IRS { ImageTransferProcessor::ImageTransferProcessor(Core::HID::HIDCore& hid_core_, Core::IrSensor::DeviceFormat& device_format, std::size_t npad_index) @@ -21,8 +21,6 @@ ImageTransferProcessor::ImageTransferProcessor(Core::HID::HIDCore& hid_core_, device.mode = Core::IrSensor::IrSensorMode::ImageTransferProcessor; device.camera_status = Core::IrSensor::IrCameraStatus::Unconnected; device.camera_internal_status = Core::IrSensor::IrCameraInternalStatus::Stopped; - device.state.start = 0; - device.state.count = 0; } ImageTransferProcessor::~ImageTransferProcessor() { @@ -33,8 +31,6 @@ void ImageTransferProcessor::StartProcessor() { is_active = true; device.camera_status = Core::IrSensor::IrCameraStatus::Available; device.camera_internal_status = Core::IrSensor::IrCameraInternalStatus::Ready; - device.state.start = 0; - device.state.count = 1; processor_state.sampling_number = 0; processor_state.ambient_noise_level = Core::IrSensor::CameraAmbientNoiseLevel::Low; } @@ -151,4 +147,4 @@ Core::IrSensor::ImageTransferProcessorState ImageTransferProcessor::GetState( return processor_state; } -} // namespace Service::HID +} // namespace Service::IRS diff --git a/src/core/hle/service/hid/irsensor/image_transfer_processor.h b/src/core/hle/service/hid/irsensor/image_transfer_processor.h index b557eaf20..393df492d 100644 --- a/src/core/hle/service/hid/irsensor/image_transfer_processor.h +++ b/src/core/hle/service/hid/irsensor/image_transfer_processor.h @@ -11,7 +11,7 @@ namespace Core::HID { class EmulatedController; } // namespace Core::HID -namespace Service::HID { +namespace Service::IRS { class ImageTransferProcessor final : public ProcessorBase { public: explicit ImageTransferProcessor(Core::HID::HIDCore& hid_core_, @@ -70,4 +70,4 @@ private: u8* transfer_memory = nullptr; bool is_transfer_memory_set = false; }; -} // namespace Service::HID +} // namespace Service::IRS diff --git a/src/core/hle/service/hid/irsensor/ir_led_processor.cpp b/src/core/hle/service/hid/irsensor/ir_led_processor.cpp index 656e17c95..8e6dd99e4 100644 --- a/src/core/hle/service/hid/irsensor/ir_led_processor.cpp +++ b/src/core/hle/service/hid/irsensor/ir_led_processor.cpp @@ -3,14 +3,12 @@ #include "core/hle/service/hid/irsensor/ir_led_processor.h" -namespace Service::HID { +namespace Service::IRS { IrLedProcessor::IrLedProcessor(Core::IrSensor::DeviceFormat& device_format) : device(device_format) { device.mode = Core::IrSensor::IrSensorMode::IrLedProcessor; device.camera_status = Core::IrSensor::IrCameraStatus::Unconnected; device.camera_internal_status = Core::IrSensor::IrCameraInternalStatus::Stopped; - device.state.start = 0; - device.state.count = 0; } IrLedProcessor::~IrLedProcessor() = default; @@ -26,4 +24,4 @@ void IrLedProcessor::SetConfig(Core::IrSensor::PackedIrLedProcessorConfig config static_cast<Core::IrSensor::CameraLightTarget>(config.light_target); } -} // namespace Service::HID +} // namespace Service::IRS diff --git a/src/core/hle/service/hid/irsensor/ir_led_processor.h b/src/core/hle/service/hid/irsensor/ir_led_processor.h index cb04d0b94..c3d8693c9 100644 --- a/src/core/hle/service/hid/irsensor/ir_led_processor.h +++ b/src/core/hle/service/hid/irsensor/ir_led_processor.h @@ -8,7 +8,7 @@ #include "core/hid/irs_types.h" #include "core/hle/service/hid/irsensor/processor_base.h" -namespace Service::HID { +namespace Service::IRS { class IrLedProcessor final : public ProcessorBase { public: explicit IrLedProcessor(Core::IrSensor::DeviceFormat& device_format); @@ -44,4 +44,4 @@ private: Core::IrSensor::DeviceFormat& device; }; -} // namespace Service::HID +} // namespace Service::IRS diff --git a/src/core/hle/service/hid/irsensor/moment_processor.cpp b/src/core/hle/service/hid/irsensor/moment_processor.cpp index fb36be577..dbaca420a 100644 --- a/src/core/hle/service/hid/irsensor/moment_processor.cpp +++ b/src/core/hle/service/hid/irsensor/moment_processor.cpp @@ -3,14 +3,12 @@ #include "core/hle/service/hid/irsensor/moment_processor.h" -namespace Service::HID { +namespace Service::IRS { MomentProcessor::MomentProcessor(Core::IrSensor::DeviceFormat& device_format) : device(device_format) { device.mode = Core::IrSensor::IrSensorMode::MomentProcessor; device.camera_status = Core::IrSensor::IrCameraStatus::Unconnected; device.camera_internal_status = Core::IrSensor::IrCameraInternalStatus::Stopped; - device.state.start = 0; - device.state.count = 0; } MomentProcessor::~MomentProcessor() = default; @@ -33,4 +31,4 @@ void MomentProcessor::SetConfig(Core::IrSensor::PackedMomentProcessorConfig conf current_config.preprocess_intensity_threshold = config.preprocess_intensity_threshold; } -} // namespace Service::HID +} // namespace Service::IRS diff --git a/src/core/hle/service/hid/irsensor/moment_processor.h b/src/core/hle/service/hid/irsensor/moment_processor.h index 63cdadfda..d4bd22e0f 100644 --- a/src/core/hle/service/hid/irsensor/moment_processor.h +++ b/src/core/hle/service/hid/irsensor/moment_processor.h @@ -8,7 +8,7 @@ #include "core/hid/irs_types.h" #include "core/hle/service/hid/irsensor/processor_base.h" -namespace Service::HID { +namespace Service::IRS { class MomentProcessor final : public ProcessorBase { public: explicit MomentProcessor(Core::IrSensor::DeviceFormat& device_format); @@ -58,4 +58,4 @@ private: Core::IrSensor::DeviceFormat& device; }; -} // namespace Service::HID +} // namespace Service::IRS diff --git a/src/core/hle/service/hid/irsensor/pointing_processor.cpp b/src/core/hle/service/hid/irsensor/pointing_processor.cpp index 7eb123636..929f177fc 100644 --- a/src/core/hle/service/hid/irsensor/pointing_processor.cpp +++ b/src/core/hle/service/hid/irsensor/pointing_processor.cpp @@ -3,14 +3,12 @@ #include "core/hle/service/hid/irsensor/pointing_processor.h" -namespace Service::HID { +namespace Service::IRS { PointingProcessor::PointingProcessor(Core::IrSensor::DeviceFormat& device_format) : device(device_format) { device.mode = Core::IrSensor::IrSensorMode::PointingProcessorMarker; device.camera_status = Core::IrSensor::IrCameraStatus::Unconnected; device.camera_internal_status = Core::IrSensor::IrCameraInternalStatus::Stopped; - device.state.start = 0; - device.state.count = 0; } PointingProcessor::~PointingProcessor() = default; @@ -25,4 +23,4 @@ void PointingProcessor::SetConfig(Core::IrSensor::PackedPointingProcessorConfig current_config.window_of_interest = config.window_of_interest; } -} // namespace Service::HID +} // namespace Service::IRS diff --git a/src/core/hle/service/hid/irsensor/pointing_processor.h b/src/core/hle/service/hid/irsensor/pointing_processor.h index 2f67eff91..cf4930794 100644 --- a/src/core/hle/service/hid/irsensor/pointing_processor.h +++ b/src/core/hle/service/hid/irsensor/pointing_processor.h @@ -3,12 +3,11 @@ #pragma once -#include "common/bit_field.h" #include "common/common_types.h" #include "core/hid/irs_types.h" #include "core/hle/service/hid/irsensor/processor_base.h" -namespace Service::HID { +namespace Service::IRS { class PointingProcessor final : public ProcessorBase { public: explicit PointingProcessor(Core::IrSensor::DeviceFormat& device_format); @@ -59,4 +58,4 @@ private: Core::IrSensor::DeviceFormat& device; }; -} // namespace Service::HID +} // namespace Service::IRS diff --git a/src/core/hle/service/hid/irsensor/processor_base.cpp b/src/core/hle/service/hid/irsensor/processor_base.cpp index bc8025375..4d43ca17a 100644 --- a/src/core/hle/service/hid/irsensor/processor_base.cpp +++ b/src/core/hle/service/hid/irsensor/processor_base.cpp @@ -3,7 +3,7 @@ #include "core/hle/service/hid/irsensor/processor_base.h" -namespace Service::HID { +namespace Service::IRS { ProcessorBase::ProcessorBase() {} ProcessorBase::~ProcessorBase() = default; @@ -64,4 +64,4 @@ std::size_t ProcessorBase::GetDataHeight( } } -} // namespace Service::HID +} // namespace Service::IRS diff --git a/src/core/hle/service/hid/irsensor/processor_base.h b/src/core/hle/service/hid/irsensor/processor_base.h index 49831aab6..bc0d2977b 100644 --- a/src/core/hle/service/hid/irsensor/processor_base.h +++ b/src/core/hle/service/hid/irsensor/processor_base.h @@ -6,7 +6,7 @@ #include "common/common_types.h" #include "core/hid/irs_types.h" -namespace Service::HID { +namespace Service::IRS { class ProcessorBase { public: explicit ProcessorBase(); @@ -30,4 +30,4 @@ protected: bool is_active{false}; }; -} // namespace Service::HID +} // namespace Service::IRS diff --git a/src/core/hle/service/hid/irsensor/tera_plugin_processor.cpp b/src/core/hle/service/hid/irsensor/tera_plugin_processor.cpp index deec22072..e691c840a 100644 --- a/src/core/hle/service/hid/irsensor/tera_plugin_processor.cpp +++ b/src/core/hle/service/hid/irsensor/tera_plugin_processor.cpp @@ -3,14 +3,12 @@ #include "core/hle/service/hid/irsensor/tera_plugin_processor.h" -namespace Service::HID { +namespace Service::IRS { TeraPluginProcessor::TeraPluginProcessor(Core::IrSensor::DeviceFormat& device_format) : device(device_format) { device.mode = Core::IrSensor::IrSensorMode::TeraPluginProcessor; device.camera_status = Core::IrSensor::IrCameraStatus::Unconnected; device.camera_internal_status = Core::IrSensor::IrCameraInternalStatus::Stopped; - device.state.start = 0; - device.state.count = 0; } TeraPluginProcessor::~TeraPluginProcessor() = default; @@ -28,4 +26,4 @@ void TeraPluginProcessor::SetConfig(Core::IrSensor::PackedTeraPluginProcessorCon current_config.unknown_3 = config.unknown_3; } -} // namespace Service::HID +} // namespace Service::IRS diff --git a/src/core/hle/service/hid/irsensor/tera_plugin_processor.h b/src/core/hle/service/hid/irsensor/tera_plugin_processor.h index 60f8057a5..bbea7ed0b 100644 --- a/src/core/hle/service/hid/irsensor/tera_plugin_processor.h +++ b/src/core/hle/service/hid/irsensor/tera_plugin_processor.h @@ -8,7 +8,7 @@ #include "core/hid/irs_types.h" #include "core/hle/service/hid/irsensor/processor_base.h" -namespace Service::HID { +namespace Service::IRS { class TeraPluginProcessor final : public ProcessorBase { public: explicit TeraPluginProcessor(Core::IrSensor::DeviceFormat& device_format); @@ -50,4 +50,4 @@ private: Core::IrSensor::DeviceFormat& device; }; -} // namespace Service::HID +} // namespace Service::IRS |