early-access version 2853
This commit is contained in:
@@ -105,12 +105,10 @@ static u32 DecodeAdpcm(Core::Memory::Memory& memory, std::span<s16> out_buffer,
|
||||
constexpr u32 NibblesPerFrame{16};
|
||||
|
||||
if (req.buffer == 0 || req.buffer_size == 0) {
|
||||
LOG_ERROR(Service_Audio, "Buffer is 0!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (req.start_offset >= req.end_offset) {
|
||||
LOG_ERROR(Service_Audio, "Start offset greater than end offset!");
|
||||
if (req.end_offset < req.start_offset) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -122,8 +120,7 @@ static u32 DecodeAdpcm(Core::Memory::Memory& memory, std::span<s16> out_buffer,
|
||||
end += 1;
|
||||
}
|
||||
|
||||
if (end / 2 > req.buffer_size) {
|
||||
LOG_ERROR(Service_Audio, "End greater than buffer size!");
|
||||
if (req.buffer_size < end / 2) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -141,7 +138,7 @@ static u32 DecodeAdpcm(Core::Memory::Memory& memory, std::span<s16> out_buffer,
|
||||
}
|
||||
|
||||
const auto size{std::max((samples_to_process / 8U) * SamplesPerFrame, 8U)};
|
||||
std::vector<u8> wavebuffer(size, 0);
|
||||
std::vector<u8> wavebuffer(size);
|
||||
memory.ReadBlockUnsafe(req.buffer + position_in_frame / 2, wavebuffer.data(),
|
||||
wavebuffer.size());
|
||||
|
||||
@@ -239,7 +236,7 @@ void DecodeFromWaveBuffers(Core::Memory::Memory& memory, const DecodeFromWaveBuf
|
||||
args.pitch};
|
||||
const auto size_required{fraction + remaining_sample_count * sample_rate_ratio};
|
||||
|
||||
if (size_required.to_int_floor() < 0) {
|
||||
if (size_required < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -325,19 +322,22 @@ void DecodeFromWaveBuffers(Core::Memory::Memory& memory, const DecodeFromWaveBuf
|
||||
switch (args.sample_format) {
|
||||
case SampleFormat::PcmInt16:
|
||||
samples_decoded = DecodePcm<s16>(
|
||||
memory, {&temp_buffer[temp_buffer_pos], args.sample_count}, decode_arg);
|
||||
memory, {&temp_buffer[temp_buffer_pos], TempBufferSize - temp_buffer_pos},
|
||||
decode_arg);
|
||||
break;
|
||||
|
||||
case SampleFormat::PcmFloat:
|
||||
samples_decoded = DecodePcm<f32>(
|
||||
memory, {&temp_buffer[temp_buffer_pos], args.sample_count}, decode_arg);
|
||||
memory, {&temp_buffer[temp_buffer_pos], TempBufferSize - temp_buffer_pos},
|
||||
decode_arg);
|
||||
break;
|
||||
|
||||
case SampleFormat::Adpcm: {
|
||||
decode_arg.adpcm_context = &voice_state.adpcm_context;
|
||||
memory.ReadBlockUnsafe(args.data_address, &decode_arg.coefficients, args.data_size);
|
||||
samples_decoded = DecodeAdpcm(
|
||||
memory, {&temp_buffer[temp_buffer_pos], args.sample_count}, decode_arg);
|
||||
memory, {&temp_buffer[temp_buffer_pos], TempBufferSize - temp_buffer_pos},
|
||||
decode_arg);
|
||||
} break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -189,8 +189,9 @@ create_target_directory_groups(common)
|
||||
|
||||
target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile Threads::Threads)
|
||||
target_link_libraries(common PRIVATE lz4::lz4 xbyak)
|
||||
if (MSVC)
|
||||
if (TARGET zstd::zstd)
|
||||
target_link_libraries(common PRIVATE zstd::zstd)
|
||||
else()
|
||||
target_link_libraries(common PRIVATE zstd)
|
||||
target_link_libraries(common PRIVATE
|
||||
$<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>)
|
||||
endif()
|
||||
|
||||
@@ -28,7 +28,7 @@ enum class InputType {
|
||||
Color,
|
||||
Vibration,
|
||||
Nfc,
|
||||
IrSensor,
|
||||
Ir,
|
||||
};
|
||||
|
||||
// Internal battery charge level
|
||||
@@ -53,15 +53,6 @@ enum class PollingMode {
|
||||
IR,
|
||||
};
|
||||
|
||||
enum class CameraFormat {
|
||||
Size320x240,
|
||||
Size160x120,
|
||||
Size80x60,
|
||||
Size40x30,
|
||||
Size20x15,
|
||||
None,
|
||||
};
|
||||
|
||||
// Vibration reply from the controller
|
||||
enum class VibrationError {
|
||||
None,
|
||||
@@ -77,13 +68,6 @@ enum class PollingError {
|
||||
Unknown,
|
||||
};
|
||||
|
||||
// Ir camera reply from the controller
|
||||
enum class CameraError {
|
||||
None,
|
||||
NotSupported,
|
||||
Unknown,
|
||||
};
|
||||
|
||||
// Hint for amplification curve to be used
|
||||
enum class VibrationAmplificationType {
|
||||
Linear,
|
||||
@@ -192,12 +176,6 @@ struct LedStatus {
|
||||
bool led_4{};
|
||||
};
|
||||
|
||||
// Raw data fom camera
|
||||
struct CameraStatus {
|
||||
CameraFormat format{CameraFormat::None};
|
||||
std::vector<u8> data{};
|
||||
};
|
||||
|
||||
// List of buttons to be passed to Qt that can be translated
|
||||
enum class ButtonNames {
|
||||
Undefined,
|
||||
@@ -255,7 +233,6 @@ struct CallbackStatus {
|
||||
BodyColorStatus color_status{};
|
||||
BatteryStatus battery_status{};
|
||||
VibrationStatus vibration_status{};
|
||||
CameraStatus camera_status{};
|
||||
};
|
||||
|
||||
// Triggered once every input change
|
||||
@@ -304,10 +281,6 @@ public:
|
||||
virtual PollingError SetPollingMode([[maybe_unused]] PollingMode polling_mode) {
|
||||
return PollingError::NotSupported;
|
||||
}
|
||||
|
||||
virtual CameraError SetCameraFormat([[maybe_unused]] CameraFormat camera_format) {
|
||||
return CameraError::NotSupported;
|
||||
}
|
||||
};
|
||||
|
||||
/// An abstract class template for a factory that can create input devices.
|
||||
|
||||
@@ -503,9 +503,6 @@ struct Values {
|
||||
Setting<bool> enable_ring_controller{true, "enable_ring_controller"};
|
||||
RingconRaw ringcon_analogs;
|
||||
|
||||
Setting<bool> enable_ir_sensor{false, "enable_ir_sensor"};
|
||||
Setting<std::string> ir_sensor_device{"auto", "ir_sensor_device"};
|
||||
|
||||
// Data Storage
|
||||
Setting<bool> use_virtual_sd{true, "use_virtual_sd"};
|
||||
Setting<bool> gamecard_inserted{false, "gamecard_inserted"};
|
||||
|
||||
@@ -156,7 +156,6 @@ add_library(core STATIC
|
||||
hid/input_converter.h
|
||||
hid/input_interpreter.cpp
|
||||
hid/input_interpreter.h
|
||||
hid/irs_types.h
|
||||
hid/motion_input.cpp
|
||||
hid/motion_input.h
|
||||
hle/api_version.h
|
||||
@@ -476,20 +475,6 @@ add_library(core STATIC
|
||||
hle/service/hid/hidbus/starlink.h
|
||||
hle/service/hid/hidbus/stubbed.cpp
|
||||
hle/service/hid/hidbus/stubbed.h
|
||||
hle/service/hid/irsensor/clustering_processor.cpp
|
||||
hle/service/hid/irsensor/clustering_processor.h
|
||||
hle/service/hid/irsensor/image_transfer_processor.cpp
|
||||
hle/service/hid/irsensor/image_transfer_processor.h
|
||||
hle/service/hid/irsensor/ir_led_processor.cpp
|
||||
hle/service/hid/irsensor/ir_led_processor.h
|
||||
hle/service/hid/irsensor/moment_processor.cpp
|
||||
hle/service/hid/irsensor/moment_processor.h
|
||||
hle/service/hid/irsensor/pointing_processor.cpp
|
||||
hle/service/hid/irsensor/pointing_processor.h
|
||||
hle/service/hid/irsensor/processor_base.cpp
|
||||
hle/service/hid/irsensor/processor_base.h
|
||||
hle/service/hid/irsensor/tera_plugin_processor.cpp
|
||||
hle/service/hid/irsensor/tera_plugin_processor.h
|
||||
hle/service/jit/jit_context.cpp
|
||||
hle/service/jit/jit_context.h
|
||||
hle/service/jit/jit.cpp
|
||||
|
||||
@@ -126,14 +126,10 @@ void EmulatedController::LoadDevices() {
|
||||
battery_params[LeftIndex].Set("battery", true);
|
||||
battery_params[RightIndex].Set("battery", true);
|
||||
|
||||
camera_params = Common::ParamPackage{"engine:camera,camera:1"};
|
||||
|
||||
output_params[LeftIndex] = left_joycon;
|
||||
output_params[RightIndex] = right_joycon;
|
||||
output_params[2] = camera_params;
|
||||
output_params[LeftIndex].Set("output", true);
|
||||
output_params[RightIndex].Set("output", true);
|
||||
output_params[2].Set("output", true);
|
||||
|
||||
LoadTASParams();
|
||||
|
||||
@@ -150,7 +146,6 @@ void EmulatedController::LoadDevices() {
|
||||
Common::Input::CreateDevice<Common::Input::InputDevice>);
|
||||
std::transform(battery_params.begin(), battery_params.end(), battery_devices.begin(),
|
||||
Common::Input::CreateDevice<Common::Input::InputDevice>);
|
||||
camera_devices = Common::Input::CreateDevice<Common::Input::InputDevice>(camera_params);
|
||||
std::transform(output_params.begin(), output_params.end(), output_devices.begin(),
|
||||
Common::Input::CreateDevice<Common::Input::OutputDevice>);
|
||||
|
||||
@@ -272,14 +267,6 @@ void EmulatedController::ReloadInput() {
|
||||
motion_devices[index]->ForceUpdate();
|
||||
}
|
||||
|
||||
if (camera_devices) {
|
||||
camera_devices->SetCallback({
|
||||
.on_change =
|
||||
[this](const Common::Input::CallbackStatus& callback) { SetCamera(callback); },
|
||||
});
|
||||
camera_devices->ForceUpdate();
|
||||
}
|
||||
|
||||
// Use a common UUID for TAS
|
||||
static constexpr Common::UUID TAS_UUID = Common::UUID{
|
||||
{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0xA5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}};
|
||||
@@ -864,25 +851,6 @@ void EmulatedController::SetBattery(const Common::Input::CallbackStatus& callbac
|
||||
TriggerOnChange(ControllerTriggerType::Battery, true);
|
||||
}
|
||||
|
||||
void EmulatedController::SetCamera(const Common::Input::CallbackStatus& callback) {
|
||||
std::unique_lock lock{mutex};
|
||||
controller.camera_values = TransformToCamera(callback);
|
||||
|
||||
if (is_configuring) {
|
||||
lock.unlock();
|
||||
TriggerOnChange(ControllerTriggerType::IrSensor, false);
|
||||
return;
|
||||
}
|
||||
|
||||
controller.camera_state.sample++;
|
||||
controller.camera_state.format =
|
||||
static_cast<Core::IrSensor::ImageTransferProcessorFormat>(controller.camera_values.format);
|
||||
controller.camera_state.data = controller.camera_values.data;
|
||||
|
||||
lock.unlock();
|
||||
TriggerOnChange(ControllerTriggerType::IrSensor, true);
|
||||
}
|
||||
|
||||
bool EmulatedController::SetVibration(std::size_t device_index, VibrationValue vibration) {
|
||||
if (device_index >= output_devices.size()) {
|
||||
return false;
|
||||
@@ -960,23 +928,6 @@ bool EmulatedController::SetPollingMode(Common::Input::PollingMode polling_mode)
|
||||
return output_device->SetPollingMode(polling_mode) == Common::Input::PollingError::None;
|
||||
}
|
||||
|
||||
bool EmulatedController::SetCameraFormat(
|
||||
Core::IrSensor::ImageTransferProcessorFormat camera_format) {
|
||||
LOG_INFO(Service_HID, "Set camera format {}", camera_format);
|
||||
|
||||
auto& right_output_device = output_devices[static_cast<std::size_t>(DeviceIndex::Right)];
|
||||
auto& camera_output_device = output_devices[2];
|
||||
|
||||
if (right_output_device->SetCameraFormat(static_cast<Common::Input::CameraFormat>(
|
||||
camera_format)) == Common::Input::CameraError::None) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Fallback to Qt camera if native device doesn't have support
|
||||
return camera_output_device->SetCameraFormat(static_cast<Common::Input::CameraFormat>(
|
||||
camera_format)) == Common::Input::CameraError::None;
|
||||
}
|
||||
|
||||
void EmulatedController::SetLedPattern() {
|
||||
for (auto& device : output_devices) {
|
||||
if (!device) {
|
||||
@@ -1212,11 +1163,6 @@ BatteryValues EmulatedController::GetBatteryValues() const {
|
||||
return controller.battery_values;
|
||||
}
|
||||
|
||||
CameraValues EmulatedController::GetCameraValues() const {
|
||||
std::scoped_lock lock{mutex};
|
||||
return controller.camera_values;
|
||||
}
|
||||
|
||||
HomeButtonState EmulatedController::GetHomeButtons() const {
|
||||
std::scoped_lock lock{mutex};
|
||||
if (is_configuring) {
|
||||
@@ -1305,11 +1251,6 @@ BatteryLevelState EmulatedController::GetBattery() const {
|
||||
return controller.battery_state;
|
||||
}
|
||||
|
||||
const CameraState& EmulatedController::GetCamera() const {
|
||||
std::scoped_lock lock{mutex};
|
||||
return controller.camera_state;
|
||||
}
|
||||
|
||||
void EmulatedController::TriggerOnChange(ControllerTriggerType type, bool is_npad_service_update) {
|
||||
std::scoped_lock lock{callback_mutex};
|
||||
for (const auto& poller_pair : callback_list) {
|
||||
|
||||
@@ -15,12 +15,10 @@
|
||||
#include "common/settings.h"
|
||||
#include "common/vector_math.h"
|
||||
#include "core/hid/hid_types.h"
|
||||
#include "core/hid/irs_types.h"
|
||||
#include "core/hid/motion_input.h"
|
||||
|
||||
namespace Core::HID {
|
||||
const std::size_t max_emulated_controllers = 2;
|
||||
const std::size_t output_devices = 3;
|
||||
struct ControllerMotionInfo {
|
||||
Common::Input::MotionStatus raw_status{};
|
||||
MotionInput emulated{};
|
||||
@@ -36,16 +34,15 @@ using TriggerDevices =
|
||||
std::array<std::unique_ptr<Common::Input::InputDevice>, Settings::NativeTrigger::NumTriggers>;
|
||||
using BatteryDevices =
|
||||
std::array<std::unique_ptr<Common::Input::InputDevice>, max_emulated_controllers>;
|
||||
using CameraDevices = std::unique_ptr<Common::Input::InputDevice>;
|
||||
using OutputDevices = std::array<std::unique_ptr<Common::Input::OutputDevice>, output_devices>;
|
||||
using OutputDevices =
|
||||
std::array<std::unique_ptr<Common::Input::OutputDevice>, max_emulated_controllers>;
|
||||
|
||||
using ButtonParams = std::array<Common::ParamPackage, Settings::NativeButton::NumButtons>;
|
||||
using StickParams = std::array<Common::ParamPackage, Settings::NativeAnalog::NumAnalogs>;
|
||||
using ControllerMotionParams = std::array<Common::ParamPackage, Settings::NativeMotion::NumMotions>;
|
||||
using TriggerParams = std::array<Common::ParamPackage, Settings::NativeTrigger::NumTriggers>;
|
||||
using BatteryParams = std::array<Common::ParamPackage, max_emulated_controllers>;
|
||||
using CameraParams = Common::ParamPackage;
|
||||
using OutputParams = std::array<Common::ParamPackage, output_devices>;
|
||||
using OutputParams = std::array<Common::ParamPackage, max_emulated_controllers>;
|
||||
|
||||
using ButtonValues = std::array<Common::Input::ButtonStatus, Settings::NativeButton::NumButtons>;
|
||||
using SticksValues = std::array<Common::Input::StickStatus, Settings::NativeAnalog::NumAnalogs>;
|
||||
@@ -54,7 +51,6 @@ using TriggerValues =
|
||||
using ControllerMotionValues = std::array<ControllerMotionInfo, Settings::NativeMotion::NumMotions>;
|
||||
using ColorValues = std::array<Common::Input::BodyColorStatus, max_emulated_controllers>;
|
||||
using BatteryValues = std::array<Common::Input::BatteryStatus, max_emulated_controllers>;
|
||||
using CameraValues = Common::Input::CameraStatus;
|
||||
using VibrationValues = std::array<Common::Input::VibrationStatus, max_emulated_controllers>;
|
||||
|
||||
struct AnalogSticks {
|
||||
@@ -74,12 +70,6 @@ struct BatteryLevelState {
|
||||
NpadPowerInfo right{};
|
||||
};
|
||||
|
||||
struct CameraState {
|
||||
Core::IrSensor::ImageTransferProcessorFormat format{};
|
||||
std::vector<u8> data{};
|
||||
std::size_t sample{};
|
||||
};
|
||||
|
||||
struct ControllerMotion {
|
||||
Common::Vec3f accel{};
|
||||
Common::Vec3f gyro{};
|
||||
@@ -106,7 +96,6 @@ struct ControllerStatus {
|
||||
ColorValues color_values{};
|
||||
BatteryValues battery_values{};
|
||||
VibrationValues vibration_values{};
|
||||
CameraValues camera_values{};
|
||||
|
||||
// Data for HID serices
|
||||
HomeButtonState home_button_state{};
|
||||
@@ -118,7 +107,6 @@ struct ControllerStatus {
|
||||
NpadGcTriggerState gc_trigger_state{};
|
||||
ControllerColors colors_state{};
|
||||
BatteryLevelState battery_state{};
|
||||
CameraState camera_state{};
|
||||
};
|
||||
|
||||
enum class ControllerTriggerType {
|
||||
@@ -129,7 +117,6 @@ enum class ControllerTriggerType {
|
||||
Color,
|
||||
Battery,
|
||||
Vibration,
|
||||
IrSensor,
|
||||
Connected,
|
||||
Disconnected,
|
||||
Type,
|
||||
@@ -282,9 +269,6 @@ public:
|
||||
/// Returns the latest battery status from the controller with parameters
|
||||
BatteryValues GetBatteryValues() const;
|
||||
|
||||
/// Returns the latest camera status from the controller with parameters
|
||||
CameraValues GetCameraValues() const;
|
||||
|
||||
/// Returns the latest status of button input for the hid::HomeButton service
|
||||
HomeButtonState GetHomeButtons() const;
|
||||
|
||||
@@ -312,9 +296,6 @@ public:
|
||||
/// Returns the latest battery status from the controller
|
||||
BatteryLevelState GetBattery() const;
|
||||
|
||||
/// Returns the latest camera status from the controller
|
||||
const CameraState& GetCamera() const;
|
||||
|
||||
/**
|
||||
* Sends a specific vibration to the output device
|
||||
* @return true if vibration had no errors
|
||||
@@ -334,13 +315,6 @@ public:
|
||||
*/
|
||||
bool SetPollingMode(Common::Input::PollingMode polling_mode);
|
||||
|
||||
/**
|
||||
* Sets the desired camera format to be polled from a controller
|
||||
* @param camera_format size of each frame
|
||||
* @return true if SetCameraFormat was successfull
|
||||
*/
|
||||
bool SetCameraFormat(Core::IrSensor::ImageTransferProcessorFormat camera_format);
|
||||
|
||||
/// Returns the led pattern corresponding to this emulated controller
|
||||
LedPattern GetLedPattern() const;
|
||||
|
||||
@@ -418,12 +392,6 @@ private:
|
||||
*/
|
||||
void SetBattery(const Common::Input::CallbackStatus& callback, std::size_t index);
|
||||
|
||||
/**
|
||||
* Updates the camera status of the controller
|
||||
* @param callback A CallbackStatus containing the camera status
|
||||
*/
|
||||
void SetCamera(const Common::Input::CallbackStatus& callback);
|
||||
|
||||
/**
|
||||
* Triggers a callback that something has changed on the controller status
|
||||
* @param type Input type of the event to trigger
|
||||
@@ -449,7 +417,6 @@ private:
|
||||
ControllerMotionParams motion_params;
|
||||
TriggerParams trigger_params;
|
||||
BatteryParams battery_params;
|
||||
CameraParams camera_params;
|
||||
OutputParams output_params;
|
||||
|
||||
ButtonDevices button_devices;
|
||||
@@ -457,7 +424,6 @@ private:
|
||||
ControllerMotionDevices motion_devices;
|
||||
TriggerDevices trigger_devices;
|
||||
BatteryDevices battery_devices;
|
||||
CameraDevices camera_devices;
|
||||
OutputDevices output_devices;
|
||||
|
||||
// TAS related variables
|
||||
|
||||
@@ -270,20 +270,6 @@ Common::Input::AnalogStatus TransformToAnalog(const Common::Input::CallbackStatu
|
||||
return status;
|
||||
}
|
||||
|
||||
Common::Input::CameraStatus TransformToCamera(const Common::Input::CallbackStatus& callback) {
|
||||
Common::Input::CameraStatus camera{};
|
||||
switch (callback.type) {
|
||||
case Common::Input::InputType::IrSensor:
|
||||
camera = callback.camera_status;
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR(Input, "Conversion from type {} to camera not implemented", callback.type);
|
||||
break;
|
||||
}
|
||||
|
||||
return camera;
|
||||
}
|
||||
|
||||
void SanitizeAnalog(Common::Input::AnalogStatus& analog, bool clamp_value) {
|
||||
const auto& properties = analog.properties;
|
||||
float& raw_value = analog.raw_value;
|
||||
|
||||
@@ -76,14 +76,6 @@ Common::Input::TriggerStatus TransformToTrigger(const Common::Input::CallbackSta
|
||||
*/
|
||||
Common::Input::AnalogStatus TransformToAnalog(const Common::Input::CallbackStatus& callback);
|
||||
|
||||
/**
|
||||
* Converts raw input data into a valid camera status.
|
||||
*
|
||||
* @param callback Supported callbacks: Camera.
|
||||
* @return A valid CameraObject object.
|
||||
*/
|
||||
Common::Input::CameraStatus TransformToCamera(const Common::Input::CallbackStatus& callback);
|
||||
|
||||
/**
|
||||
* Converts raw analog data into a valid analog value
|
||||
* @param analog An analog object containing raw data and properties
|
||||
|
||||
@@ -19,10 +19,3 @@ constexpr Result InvalidNpadId{ErrorModule::HID, 709};
|
||||
constexpr Result NpadNotConnected{ErrorModule::HID, 710};
|
||||
|
||||
} // namespace Service::HID
|
||||
|
||||
namespace Service::IRS {
|
||||
|
||||
constexpr Result InvalidProcessorState{ErrorModule::Irsensor, 78};
|
||||
constexpr Result InvalidIrCameraHandle{ErrorModule::Irsensor, 204};
|
||||
|
||||
} // namespace Service::IRS
|
||||
|
||||
@@ -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<Service::IRS::IRS>(system)->InstallAsService(service_manager);
|
||||
std::make_shared<Service::IRS::IRS_SYS>(system)->InstallAsService(service_manager);
|
||||
std::make_shared<IRS>(system)->InstallAsService(service_manager);
|
||||
std::make_shared<IRS_SYS>(system)->InstallAsService(service_manager);
|
||||
|
||||
std::make_shared<XCD_SYS>(system)->InstallAsService(service_manager);
|
||||
}
|
||||
|
||||
@@ -1,28 +1,16 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <algorithm>
|
||||
#include <random>
|
||||
|
||||
#include "core/core.h"
|
||||
#include "core/core_timing.h"
|
||||
#include "core/hid/emulated_controller.h"
|
||||
#include "core/hid/hid_core.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/k_shared_memory.h"
|
||||
#include "core/hle/kernel/k_transfer_memory.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/service/hid/errors.h"
|
||||
#include "core/hle/service/hid/irs.h"
|
||||
#include "core/hle/service/hid/irsensor/clustering_processor.h"
|
||||
#include "core/hle/service/hid/irsensor/image_transfer_processor.h"
|
||||
#include "core/hle/service/hid/irsensor/ir_led_processor.h"
|
||||
#include "core/hle/service/hid/irsensor/moment_processor.h"
|
||||
#include "core/hle/service/hid/irsensor/pointing_processor.h"
|
||||
#include "core/hle/service/hid/irsensor/tera_plugin_processor.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
namespace Service::IRS {
|
||||
namespace Service::HID {
|
||||
|
||||
IRS::IRS(Core::System& system_) : ServiceFramework{system_, "irs"} {
|
||||
// clang-format off
|
||||
@@ -48,19 +36,14 @@ IRS::IRS(Core::System& system_) : ServiceFramework{system_, "irs"} {
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
u8* raw_shared_memory = system.Kernel().GetIrsSharedMem().GetPointer();
|
||||
RegisterHandlers(functions);
|
||||
shared_memory = std::construct_at(reinterpret_cast<StatusManager*>(raw_shared_memory));
|
||||
|
||||
npad_device = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
|
||||
}
|
||||
IRS::~IRS() = default;
|
||||
|
||||
void IRS::ActivateIrsensor(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
const auto applet_resource_user_id{rp.Pop<u64>()};
|
||||
|
||||
LOG_WARNING(Service_IRS, "(STUBBED) called, applet_resource_user_id={}",
|
||||
LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}",
|
||||
applet_resource_user_id);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
@@ -71,7 +54,7 @@ void IRS::DeactivateIrsensor(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
const auto applet_resource_user_id{rp.Pop<u64>()};
|
||||
|
||||
LOG_WARNING(Service_IRS, "(STUBBED) called, applet_resource_user_id={}",
|
||||
LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}",
|
||||
applet_resource_user_id);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
@@ -92,7 +75,7 @@ void IRS::GetIrsensorSharedMemoryHandle(Kernel::HLERequestContext& ctx) {
|
||||
void IRS::StopImageProcessor(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
struct Parameters {
|
||||
Core::IrSensor::IrCameraHandle camera_handle;
|
||||
IrCameraHandle camera_handle;
|
||||
INSERT_PADDING_WORDS_NOINIT(1);
|
||||
u64 applet_resource_user_id;
|
||||
};
|
||||
@@ -105,23 +88,17 @@ void IRS::StopImageProcessor(Kernel::HLERequestContext& ctx) {
|
||||
parameters.camera_handle.npad_type, parameters.camera_handle.npad_id,
|
||||
parameters.applet_resource_user_id);
|
||||
|
||||
auto result = IsIrCameraHandleValid(parameters.camera_handle);
|
||||
if (result.IsSuccess()) {
|
||||
// TODO: Stop Image processor
|
||||
result = ResultSuccess;
|
||||
}
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(result);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void IRS::RunMomentProcessor(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
struct Parameters {
|
||||
Core::IrSensor::IrCameraHandle camera_handle;
|
||||
IrCameraHandle camera_handle;
|
||||
INSERT_PADDING_WORDS_NOINIT(1);
|
||||
u64 applet_resource_user_id;
|
||||
Core::IrSensor::PackedMomentProcessorConfig processor_config;
|
||||
PackedMomentProcessorConfig processor_config;
|
||||
};
|
||||
static_assert(sizeof(Parameters) == 0x30, "Parameters has incorrect size.");
|
||||
|
||||
@@ -132,28 +109,19 @@ void IRS::RunMomentProcessor(Kernel::HLERequestContext& ctx) {
|
||||
parameters.camera_handle.npad_type, parameters.camera_handle.npad_id,
|
||||
parameters.applet_resource_user_id);
|
||||
|
||||
const auto result = IsIrCameraHandleValid(parameters.camera_handle);
|
||||
|
||||
if (result.IsSuccess()) {
|
||||
auto& device = GetIrCameraSharedMemoryDeviceEntry(parameters.camera_handle);
|
||||
MakeProcessor<MomentProcessor>(parameters.camera_handle, device);
|
||||
auto& image_transfer_processor = GetProcessor<MomentProcessor>(parameters.camera_handle);
|
||||
image_transfer_processor.SetConfig(parameters.processor_config);
|
||||
}
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(result);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void IRS::RunClusteringProcessor(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
struct Parameters {
|
||||
Core::IrSensor::IrCameraHandle camera_handle;
|
||||
IrCameraHandle camera_handle;
|
||||
INSERT_PADDING_WORDS_NOINIT(1);
|
||||
u64 applet_resource_user_id;
|
||||
Core::IrSensor::PackedClusteringProcessorConfig processor_config;
|
||||
PackedClusteringProcessorConfig processor_config;
|
||||
};
|
||||
static_assert(sizeof(Parameters) == 0x38, "Parameters has incorrect size.");
|
||||
static_assert(sizeof(Parameters) == 0x40, "Parameters has incorrect size.");
|
||||
|
||||
const auto parameters{rp.PopRaw<Parameters>()};
|
||||
|
||||
@@ -162,27 +130,17 @@ void IRS::RunClusteringProcessor(Kernel::HLERequestContext& ctx) {
|
||||
parameters.camera_handle.npad_type, parameters.camera_handle.npad_id,
|
||||
parameters.applet_resource_user_id);
|
||||
|
||||
auto result = IsIrCameraHandleValid(parameters.camera_handle);
|
||||
|
||||
if (result.IsSuccess()) {
|
||||
auto& device = GetIrCameraSharedMemoryDeviceEntry(parameters.camera_handle);
|
||||
MakeProcessor<ClusteringProcessor>(parameters.camera_handle, device);
|
||||
auto& image_transfer_processor =
|
||||
GetProcessor<ClusteringProcessor>(parameters.camera_handle);
|
||||
image_transfer_processor.SetConfig(parameters.processor_config);
|
||||
}
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(result);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void IRS::RunImageTransferProcessor(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
struct Parameters {
|
||||
Core::IrSensor::IrCameraHandle camera_handle;
|
||||
IrCameraHandle camera_handle;
|
||||
INSERT_PADDING_WORDS_NOINIT(1);
|
||||
u64 applet_resource_user_id;
|
||||
Core::IrSensor::PackedImageTransferProcessorConfig processor_config;
|
||||
PackedImageTransferProcessorConfig processor_config;
|
||||
u32 transfer_memory_size;
|
||||
};
|
||||
static_assert(sizeof(Parameters) == 0x30, "Parameters has incorrect size.");
|
||||
@@ -193,166 +151,20 @@ void IRS::RunImageTransferProcessor(Kernel::HLERequestContext& ctx) {
|
||||
auto t_mem =
|
||||
system.CurrentProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(t_mem_handle);
|
||||
|
||||
if (t_mem.IsNull()) {
|
||||
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;
|
||||
}
|
||||
|
||||
ASSERT_MSG(t_mem->GetSize() == parameters.transfer_memory_size, "t_mem has incorrect size");
|
||||
|
||||
u8* transfer_memory = system.Memory().GetPointer(t_mem->GetSourceAddress());
|
||||
|
||||
LOG_INFO(Service_IRS,
|
||||
"called, npad_type={}, npad_id={}, transfer_memory_size={}, transfer_memory_size={}, "
|
||||
"applet_resource_user_id={}",
|
||||
parameters.camera_handle.npad_type, parameters.camera_handle.npad_id,
|
||||
parameters.transfer_memory_size, t_mem->GetSize(), parameters.applet_resource_user_id);
|
||||
|
||||
const auto result = IsIrCameraHandleValid(parameters.camera_handle);
|
||||
|
||||
if (result.IsSuccess()) {
|
||||
auto& device = GetIrCameraSharedMemoryDeviceEntry(parameters.camera_handle);
|
||||
MakeProcessorWithCoreContext<ImageTransferProcessor>(parameters.camera_handle, device);
|
||||
auto& image_transfer_processor =
|
||||
GetProcessor<ImageTransferProcessor>(parameters.camera_handle);
|
||||
image_transfer_processor.SetConfig(parameters.processor_config);
|
||||
image_transfer_processor.SetTransferMemoryPointer(transfer_memory);
|
||||
}
|
||||
LOG_WARNING(Service_IRS,
|
||||
"(STUBBED) called, npad_type={}, npad_id={}, transfer_memory_size={}, "
|
||||
"applet_resource_user_id={}",
|
||||
parameters.camera_handle.npad_type, parameters.camera_handle.npad_id,
|
||||
parameters.transfer_memory_size, parameters.applet_resource_user_id);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(result);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void IRS::GetImageTransferProcessorState(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
struct Parameters {
|
||||
Core::IrSensor::IrCameraHandle camera_handle;
|
||||
INSERT_PADDING_WORDS_NOINIT(1);
|
||||
u64 applet_resource_user_id;
|
||||
};
|
||||
static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
|
||||
|
||||
const auto parameters{rp.PopRaw<Parameters>()};
|
||||
|
||||
LOG_DEBUG(Service_IRS, "(STUBBED) called, npad_type={}, npad_id={}, applet_resource_user_id={}",
|
||||
parameters.camera_handle.npad_type, parameters.camera_handle.npad_id,
|
||||
parameters.applet_resource_user_id);
|
||||
|
||||
const auto result = IsIrCameraHandleValid(parameters.camera_handle);
|
||||
if (result.IsError()) {
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(result);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& device = GetIrCameraSharedMemoryDeviceEntry(parameters.camera_handle);
|
||||
|
||||
if (device.mode != Core::IrSensor::IrSensorMode::ImageTransferProcessor) {
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(InvalidProcessorState);
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<u8> data{};
|
||||
const auto& image_transfer_processor =
|
||||
GetProcessor<ImageTransferProcessor>(parameters.camera_handle);
|
||||
const auto& state = image_transfer_processor.GetState(data);
|
||||
|
||||
ctx.WriteBuffer(data);
|
||||
IPC::ResponseBuilder rb{ctx, 6};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw(state);
|
||||
}
|
||||
|
||||
void IRS::RunTeraPluginProcessor(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
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.");
|
||||
|
||||
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(parameters.camera_handle);
|
||||
|
||||
if (result.IsSuccess()) {
|
||||
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};
|
||||
rb.Push(result);
|
||||
}
|
||||
|
||||
void IRS::GetNpadIrCameraHandle(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
const auto npad_id{rp.PopEnum<Core::HID::NpadIdType>()};
|
||||
|
||||
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(Service::HID::InvalidNpadId);
|
||||
return;
|
||||
}
|
||||
|
||||
Core::IrSensor::IrCameraHandle camera_handle{
|
||||
.npad_id = static_cast<u8>(NpadIdTypeToIndex(npad_id)),
|
||||
.npad_type = Core::HID::NpadStyleIndex::None,
|
||||
};
|
||||
|
||||
LOG_INFO(Service_IRS, "called, npad_id={}, camera_npad_id={}, camera_npad_type={}", npad_id,
|
||||
camera_handle.npad_id, camera_handle.npad_type);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 3};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw(camera_handle);
|
||||
}
|
||||
|
||||
void IRS::RunPointingProcessor(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
const auto camera_handle{rp.PopRaw<Core::IrSensor::IrCameraHandle>()};
|
||||
const auto processor_config{rp.PopRaw<Core::IrSensor::PackedPointingProcessorConfig>()};
|
||||
const auto applet_resource_user_id{rp.Pop<u64>()};
|
||||
|
||||
LOG_WARNING(
|
||||
Service_IRS,
|
||||
"(STUBBED) called, npad_type={}, npad_id={}, mcu_version={}.{}, applet_resource_user_id={}",
|
||||
camera_handle.npad_type, camera_handle.npad_id, processor_config.required_mcu_version.major,
|
||||
processor_config.required_mcu_version.minor, applet_resource_user_id);
|
||||
|
||||
auto result = IsIrCameraHandleValid(camera_handle);
|
||||
|
||||
if (result.IsSuccess()) {
|
||||
auto& device = GetIrCameraSharedMemoryDeviceEntry(camera_handle);
|
||||
MakeProcessor<PointingProcessor>(camera_handle, device);
|
||||
auto& image_transfer_processor = GetProcessor<PointingProcessor>(camera_handle);
|
||||
image_transfer_processor.SetConfig(processor_config);
|
||||
}
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(result);
|
||||
}
|
||||
|
||||
void IRS::SuspendImageProcessor(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
struct Parameters {
|
||||
Core::IrSensor::IrCameraHandle camera_handle;
|
||||
IrCameraHandle camera_handle;
|
||||
INSERT_PADDING_WORDS_NOINIT(1);
|
||||
u64 applet_resource_user_id;
|
||||
};
|
||||
@@ -365,20 +177,93 @@ void IRS::SuspendImageProcessor(Kernel::HLERequestContext& ctx) {
|
||||
parameters.camera_handle.npad_type, parameters.camera_handle.npad_id,
|
||||
parameters.applet_resource_user_id);
|
||||
|
||||
auto result = IsIrCameraHandleValid(parameters.camera_handle);
|
||||
if (result.IsSuccess()) {
|
||||
// TODO: Suspend image processor
|
||||
result = ResultSuccess;
|
||||
}
|
||||
IPC::ResponseBuilder rb{ctx, 5};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw<u64>(system.CoreTiming().GetCPUTicks());
|
||||
rb.PushRaw<u32>(0);
|
||||
}
|
||||
|
||||
void IRS::RunTeraPluginProcessor(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
const auto camera_handle{rp.PopRaw<IrCameraHandle>()};
|
||||
const auto processor_config{rp.PopRaw<PackedTeraPluginProcessorConfig>()};
|
||||
const auto applet_resource_user_id{rp.Pop<u64>()};
|
||||
|
||||
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);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(result);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void IRS::GetNpadIrCameraHandle(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
const auto npad_id{rp.PopEnum<Core::HID::NpadIdType>()};
|
||||
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
||||
IrCameraHandle camera_handle{
|
||||
.npad_id = static_cast<u8>(NpadIdTypeToIndex(npad_id)),
|
||||
.npad_type = Core::HID::NpadStyleIndex::None,
|
||||
};
|
||||
|
||||
LOG_WARNING(Service_IRS, "(STUBBED) called, npad_id={}, camera_npad_id={}, camera_npad_type={}",
|
||||
npad_id, camera_handle.npad_id, camera_handle.npad_type);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 3};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw(camera_handle);
|
||||
}
|
||||
|
||||
void IRS::RunPointingProcessor(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
const auto camera_handle{rp.PopRaw<IrCameraHandle>()};
|
||||
const auto processor_config{rp.PopRaw<PackedPointingProcessorConfig>()};
|
||||
const auto applet_resource_user_id{rp.Pop<u64>()};
|
||||
|
||||
LOG_WARNING(
|
||||
Service_IRS,
|
||||
"(STUBBED) called, npad_type={}, npad_id={}, mcu_version={}.{}, applet_resource_user_id={}",
|
||||
camera_handle.npad_type, camera_handle.npad_id, processor_config.required_mcu_version.major,
|
||||
processor_config.required_mcu_version.minor, applet_resource_user_id);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void IRS::SuspendImageProcessor(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
struct Parameters {
|
||||
IrCameraHandle camera_handle;
|
||||
INSERT_PADDING_WORDS_NOINIT(1);
|
||||
u64 applet_resource_user_id;
|
||||
};
|
||||
static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
|
||||
|
||||
const auto parameters{rp.PopRaw<Parameters>()};
|
||||
|
||||
LOG_WARNING(Service_IRS,
|
||||
"(STUBBED) called, npad_type={}, npad_id={}, applet_resource_user_id={}",
|
||||
parameters.camera_handle.npad_type, parameters.camera_handle.npad_id,
|
||||
parameters.applet_resource_user_id);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void IRS::CheckFirmwareVersion(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
const auto camera_handle{rp.PopRaw<Core::IrSensor::IrCameraHandle>()};
|
||||
const auto mcu_version{rp.PopRaw<Core::IrSensor::PackedMcuVersion>()};
|
||||
const auto camera_handle{rp.PopRaw<IrCameraHandle>()};
|
||||
const auto mcu_version{rp.PopRaw<PackedMcuVersion>()};
|
||||
const auto applet_resource_user_id{rp.Pop<u64>()};
|
||||
|
||||
LOG_WARNING(
|
||||
@@ -387,45 +272,37 @@ void IRS::CheckFirmwareVersion(Kernel::HLERequestContext& ctx) {
|
||||
camera_handle.npad_type, camera_handle.npad_id, applet_resource_user_id, mcu_version.major,
|
||||
mcu_version.minor);
|
||||
|
||||
auto result = IsIrCameraHandleValid(camera_handle);
|
||||
if (result.IsSuccess()) {
|
||||
// TODO: Check firmware version
|
||||
result = ResultSuccess;
|
||||
}
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(result);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void IRS::SetFunctionLevel(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
const auto camera_handle{rp.PopRaw<Core::IrSensor::IrCameraHandle>()};
|
||||
const auto function_level{rp.PopRaw<Core::IrSensor::PackedFunctionLevel>()};
|
||||
const auto applet_resource_user_id{rp.Pop<u64>()};
|
||||
struct Parameters {
|
||||
IrCameraHandle camera_handle;
|
||||
PackedFunctionLevel function_level;
|
||||
u64 applet_resource_user_id;
|
||||
};
|
||||
static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
|
||||
|
||||
LOG_WARNING(
|
||||
Service_IRS,
|
||||
"(STUBBED) called, npad_type={}, npad_id={}, function_level={}, applet_resource_user_id={}",
|
||||
camera_handle.npad_type, camera_handle.npad_id, function_level.function_level,
|
||||
applet_resource_user_id);
|
||||
const auto parameters{rp.PopRaw<Parameters>()};
|
||||
|
||||
auto result = IsIrCameraHandleValid(camera_handle);
|
||||
if (result.IsSuccess()) {
|
||||
// TODO: Set Function level
|
||||
result = ResultSuccess;
|
||||
}
|
||||
LOG_WARNING(Service_IRS,
|
||||
"(STUBBED) called, npad_type={}, npad_id={}, applet_resource_user_id={}",
|
||||
parameters.camera_handle.npad_type, parameters.camera_handle.npad_id,
|
||||
parameters.applet_resource_user_id);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(result);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void IRS::RunImageTransferExProcessor(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
struct Parameters {
|
||||
Core::IrSensor::IrCameraHandle camera_handle;
|
||||
IrCameraHandle camera_handle;
|
||||
INSERT_PADDING_WORDS_NOINIT(1);
|
||||
u64 applet_resource_user_id;
|
||||
Core::IrSensor::PackedImageTransferProcessorExConfig processor_config;
|
||||
PackedImageTransferProcessorExConfig processor_config;
|
||||
u64 transfer_memory_size;
|
||||
};
|
||||
static_assert(sizeof(Parameters) == 0x38, "Parameters has incorrect size.");
|
||||
@@ -436,33 +313,20 @@ void IRS::RunImageTransferExProcessor(Kernel::HLERequestContext& ctx) {
|
||||
auto t_mem =
|
||||
system.CurrentProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(t_mem_handle);
|
||||
|
||||
u8* transfer_memory = system.Memory().GetPointer(t_mem->GetSourceAddress());
|
||||
|
||||
LOG_INFO(Service_IRS,
|
||||
"called, npad_type={}, npad_id={}, transfer_memory_size={}, "
|
||||
"applet_resource_user_id={}",
|
||||
parameters.camera_handle.npad_type, parameters.camera_handle.npad_id,
|
||||
parameters.transfer_memory_size, parameters.applet_resource_user_id);
|
||||
|
||||
auto result = IsIrCameraHandleValid(parameters.camera_handle);
|
||||
|
||||
if (result.IsSuccess()) {
|
||||
auto& device = GetIrCameraSharedMemoryDeviceEntry(parameters.camera_handle);
|
||||
MakeProcessorWithCoreContext<ImageTransferProcessor>(parameters.camera_handle, device);
|
||||
auto& image_transfer_processor =
|
||||
GetProcessor<ImageTransferProcessor>(parameters.camera_handle);
|
||||
image_transfer_processor.SetConfig(parameters.processor_config);
|
||||
image_transfer_processor.SetTransferMemoryPointer(transfer_memory);
|
||||
}
|
||||
LOG_WARNING(Service_IRS,
|
||||
"(STUBBED) called, npad_type={}, npad_id={}, transfer_memory_size={}, "
|
||||
"applet_resource_user_id={}",
|
||||
parameters.camera_handle.npad_type, parameters.camera_handle.npad_id,
|
||||
parameters.transfer_memory_size, parameters.applet_resource_user_id);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(result);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void IRS::RunIrLedProcessor(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
const auto camera_handle{rp.PopRaw<Core::IrSensor::IrCameraHandle>()};
|
||||
const auto processor_config{rp.PopRaw<Core::IrSensor::PackedIrLedProcessorConfig>()};
|
||||
const auto camera_handle{rp.PopRaw<IrCameraHandle>()};
|
||||
const auto processor_config{rp.PopRaw<PackedIrLedProcessorConfig>()};
|
||||
const auto applet_resource_user_id{rp.Pop<u64>()};
|
||||
|
||||
LOG_WARNING(Service_IRS,
|
||||
@@ -472,23 +336,14 @@ void IRS::RunIrLedProcessor(Kernel::HLERequestContext& ctx) {
|
||||
processor_config.required_mcu_version.major,
|
||||
processor_config.required_mcu_version.minor, applet_resource_user_id);
|
||||
|
||||
auto result = IsIrCameraHandleValid(camera_handle);
|
||||
|
||||
if (result.IsSuccess()) {
|
||||
auto& device = GetIrCameraSharedMemoryDeviceEntry(camera_handle);
|
||||
MakeProcessor<IrLedProcessor>(camera_handle, device);
|
||||
auto& image_transfer_processor = GetProcessor<IrLedProcessor>(camera_handle);
|
||||
image_transfer_processor.SetConfig(processor_config);
|
||||
}
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(result);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void IRS::StopImageProcessorAsync(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
struct Parameters {
|
||||
Core::IrSensor::IrCameraHandle camera_handle;
|
||||
IrCameraHandle camera_handle;
|
||||
INSERT_PADDING_WORDS_NOINIT(1);
|
||||
u64 applet_resource_user_id;
|
||||
};
|
||||
@@ -501,20 +356,14 @@ void IRS::StopImageProcessorAsync(Kernel::HLERequestContext& ctx) {
|
||||
parameters.camera_handle.npad_type, parameters.camera_handle.npad_id,
|
||||
parameters.applet_resource_user_id);
|
||||
|
||||
auto result = IsIrCameraHandleValid(parameters.camera_handle);
|
||||
if (result.IsSuccess()) {
|
||||
// TODO: Stop image processor async
|
||||
result = ResultSuccess;
|
||||
}
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(result);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void IRS::ActivateIrsensorWithFunctionLevel(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
struct Parameters {
|
||||
Core::IrSensor::PackedFunctionLevel function_level;
|
||||
PackedFunctionLevel function_level;
|
||||
INSERT_PADDING_WORDS_NOINIT(1);
|
||||
u64 applet_resource_user_id;
|
||||
};
|
||||
@@ -529,22 +378,7 @@ void IRS::ActivateIrsensorWithFunctionLevel(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
Result IRS::IsIrCameraHandleValid(const Core::IrSensor::IrCameraHandle& camera_handle) const {
|
||||
if (camera_handle.npad_id >
|
||||
static_cast<u8>(NpadIdTypeToIndex(Core::HID::NpadIdType::Handheld))) {
|
||||
return InvalidIrCameraHandle;
|
||||
}
|
||||
if (camera_handle.npad_type != Core::HID::NpadStyleIndex::None) {
|
||||
return InvalidIrCameraHandle;
|
||||
}
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
Core::IrSensor::DeviceFormat& IRS::GetIrCameraSharedMemoryDeviceEntry(
|
||||
const Core::IrSensor::IrCameraHandle& camera_handle) {
|
||||
ASSERT_MSG(sizeof(StatusManager::device) > camera_handle.npad_id, "invalid npad_id");
|
||||
return shared_memory->device[camera_handle.npad_id];
|
||||
}
|
||||
IRS::~IRS() = default;
|
||||
|
||||
IRS_SYS::IRS_SYS(Core::System& system_) : ServiceFramework{system_, "irs:sys"} {
|
||||
// clang-format off
|
||||
@@ -561,4 +395,4 @@ IRS_SYS::IRS_SYS(Core::System& system_) : ServiceFramework{system_, "irs:sys"} {
|
||||
|
||||
IRS_SYS::~IRS_SYS() = default;
|
||||
|
||||
} // namespace Service::IRS
|
||||
} // namespace Service::HID
|
||||
|
||||
@@ -4,19 +4,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "core/hid/hid_types.h"
|
||||
#include "core/hid/irs_types.h"
|
||||
#include "core/hle/service/hid/irsensor/processor_base.h"
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace Core::HID {
|
||||
class EmulatedController;
|
||||
} // namespace Core::HID
|
||||
|
||||
namespace Service::IRS {
|
||||
namespace Service::HID {
|
||||
|
||||
class IRS final : public ServiceFramework<IRS> {
|
||||
public:
|
||||
@@ -24,19 +18,234 @@ public:
|
||||
~IRS() override;
|
||||
|
||||
private:
|
||||
// This is nn::irsensor::detail::AruidFormat
|
||||
struct AruidFormat {
|
||||
u64 sensor_aruid;
|
||||
u64 sensor_aruid_status;
|
||||
// This is nn::irsensor::IrCameraStatus
|
||||
enum IrCameraStatus : u32 {
|
||||
Available,
|
||||
Unsupported,
|
||||
Unconnected,
|
||||
};
|
||||
static_assert(sizeof(AruidFormat) == 0x10, "AruidFormat is an invalid size");
|
||||
|
||||
// This is nn::irsensor::detail::StatusManager
|
||||
struct StatusManager {
|
||||
std::array<Core::IrSensor::DeviceFormat, 9> device;
|
||||
std::array<AruidFormat, 5> aruid;
|
||||
// This is nn::irsensor::IrCameraInternalStatus
|
||||
enum IrCameraInternalStatus : u32 {
|
||||
Stopped,
|
||||
FirmwareUpdateNeeded,
|
||||
Unkown2,
|
||||
Unkown3,
|
||||
Unkown4,
|
||||
FirmwareVersionRequested,
|
||||
FirmwareVersionIsInvalid,
|
||||
Ready,
|
||||
Setting,
|
||||
};
|
||||
static_assert(sizeof(StatusManager) == 0x8000, "StatusManager is an invalid size");
|
||||
|
||||
// This is nn::irsensor::detail::StatusManager::IrSensorMode
|
||||
enum IrSensorMode : u64 {
|
||||
None,
|
||||
MomentProcessor,
|
||||
ClusteringProcessor,
|
||||
ImageTransferProcessor,
|
||||
PointingProcessorMarker,
|
||||
TeraPluginProcessor,
|
||||
IrLedProcessor,
|
||||
};
|
||||
|
||||
// This is nn::irsensor::ImageProcessorStatus
|
||||
enum ImageProcessorStatus : u8 {
|
||||
stopped,
|
||||
running,
|
||||
};
|
||||
|
||||
// This is nn::irsensor::ImageTransferProcessorFormat
|
||||
enum ImageTransferProcessorFormat : u8 {
|
||||
Size320x240,
|
||||
Size160x120,
|
||||
Size80x60,
|
||||
Size40x30,
|
||||
Size20x15,
|
||||
};
|
||||
|
||||
// This is nn::irsensor::AdaptiveClusteringMode
|
||||
enum AdaptiveClusteringMode : u8 {
|
||||
StaticFov,
|
||||
DynamicFov,
|
||||
};
|
||||
|
||||
// This is nn::irsensor::AdaptiveClusteringTargetDistance
|
||||
enum AdaptiveClusteringTargetDistance : u8 {
|
||||
Near,
|
||||
Middle,
|
||||
Far,
|
||||
};
|
||||
|
||||
// This is nn::irsensor::IrsHandAnalysisMode
|
||||
enum IrsHandAnalysisMode : u8 {
|
||||
Silhouette,
|
||||
Image,
|
||||
SilhoueteAndImage,
|
||||
SilhuetteOnly,
|
||||
};
|
||||
|
||||
// This is nn::irsensor::IrSensorFunctionLevel
|
||||
enum IrSensorFunctionLevel : u8 {
|
||||
unknown0,
|
||||
unknown1,
|
||||
unknown2,
|
||||
unknown3,
|
||||
unknown4,
|
||||
};
|
||||
|
||||
// This is nn::irsensor::IrCameraHandle
|
||||
struct IrCameraHandle {
|
||||
u8 npad_id{};
|
||||
Core::HID::NpadStyleIndex npad_type{Core::HID::NpadStyleIndex::None};
|
||||
INSERT_PADDING_BYTES(2);
|
||||
};
|
||||
static_assert(sizeof(IrCameraHandle) == 4, "IrCameraHandle is an invalid size");
|
||||
|
||||
struct IrsRect {
|
||||
s16 x;
|
||||
s16 y;
|
||||
s16 width;
|
||||
s16 height;
|
||||
};
|
||||
|
||||
// This is nn::irsensor::PackedMcuVersion
|
||||
struct PackedMcuVersion {
|
||||
u16 major;
|
||||
u16 minor;
|
||||
};
|
||||
static_assert(sizeof(PackedMcuVersion) == 4, "PackedMcuVersion is an invalid size");
|
||||
|
||||
// This is nn::irsensor::MomentProcessorConfig
|
||||
struct MomentProcessorConfig {
|
||||
u64 exposire_time;
|
||||
u8 light_target;
|
||||
u8 gain;
|
||||
u8 is_negative_used;
|
||||
INSERT_PADDING_BYTES(7);
|
||||
IrsRect window_of_interest;
|
||||
u8 preprocess;
|
||||
u8 preprocess_intensity_threshold;
|
||||
INSERT_PADDING_BYTES(5);
|
||||
};
|
||||
static_assert(sizeof(MomentProcessorConfig) == 0x28,
|
||||
"MomentProcessorConfig is an invalid size");
|
||||
|
||||
// This is nn::irsensor::PackedMomentProcessorConfig
|
||||
struct PackedMomentProcessorConfig {
|
||||
u64 exposire_time;
|
||||
u8 light_target;
|
||||
u8 gain;
|
||||
u8 is_negative_used;
|
||||
INSERT_PADDING_BYTES(5);
|
||||
IrsRect window_of_interest;
|
||||
PackedMcuVersion required_mcu_version;
|
||||
u8 preprocess;
|
||||
u8 preprocess_intensity_threshold;
|
||||
INSERT_PADDING_BYTES(2);
|
||||
};
|
||||
static_assert(sizeof(PackedMomentProcessorConfig) == 0x20,
|
||||
"PackedMomentProcessorConfig is an invalid size");
|
||||
|
||||
// This is nn::irsensor::ClusteringProcessorConfig
|
||||
struct ClusteringProcessorConfig {
|
||||
u64 exposire_time;
|
||||
u32 light_target;
|
||||
u32 gain;
|
||||
u8 is_negative_used;
|
||||
INSERT_PADDING_BYTES(7);
|
||||
IrsRect window_of_interest;
|
||||
u32 pixel_count_min;
|
||||
u32 pixel_count_max;
|
||||
u32 object_intensity_min;
|
||||
u8 is_external_light_filter_enabled;
|
||||
INSERT_PADDING_BYTES(3);
|
||||
};
|
||||
static_assert(sizeof(ClusteringProcessorConfig) == 0x30,
|
||||
"ClusteringProcessorConfig is an invalid size");
|
||||
|
||||
// This is nn::irsensor::PackedClusteringProcessorConfig
|
||||
struct PackedClusteringProcessorConfig {
|
||||
u64 exposire_time;
|
||||
u8 light_target;
|
||||
u8 gain;
|
||||
u8 is_negative_used;
|
||||
INSERT_PADDING_BYTES(5);
|
||||
IrsRect window_of_interest;
|
||||
PackedMcuVersion required_mcu_version;
|
||||
u32 pixel_count_min;
|
||||
u32 pixel_count_max;
|
||||
u32 object_intensity_min;
|
||||
u8 is_external_light_filter_enabled;
|
||||
INSERT_PADDING_BYTES(2);
|
||||
};
|
||||
static_assert(sizeof(PackedClusteringProcessorConfig) == 0x30,
|
||||
"PackedClusteringProcessorConfig is an invalid size");
|
||||
|
||||
// This is nn::irsensor::PackedImageTransferProcessorConfig
|
||||
struct PackedImageTransferProcessorConfig {
|
||||
u64 exposire_time;
|
||||
u8 light_target;
|
||||
u8 gain;
|
||||
u8 is_negative_used;
|
||||
INSERT_PADDING_BYTES(5);
|
||||
PackedMcuVersion required_mcu_version;
|
||||
u8 format;
|
||||
INSERT_PADDING_BYTES(3);
|
||||
};
|
||||
static_assert(sizeof(PackedImageTransferProcessorConfig) == 0x18,
|
||||
"PackedImageTransferProcessorConfig is an invalid size");
|
||||
|
||||
// This is nn::irsensor::PackedTeraPluginProcessorConfig
|
||||
struct PackedTeraPluginProcessorConfig {
|
||||
PackedMcuVersion required_mcu_version;
|
||||
u8 mode;
|
||||
INSERT_PADDING_BYTES(3);
|
||||
};
|
||||
static_assert(sizeof(PackedTeraPluginProcessorConfig) == 0x8,
|
||||
"PackedTeraPluginProcessorConfig is an invalid size");
|
||||
|
||||
// This is nn::irsensor::PackedPointingProcessorConfig
|
||||
struct PackedPointingProcessorConfig {
|
||||
IrsRect window_of_interest;
|
||||
PackedMcuVersion required_mcu_version;
|
||||
};
|
||||
static_assert(sizeof(PackedPointingProcessorConfig) == 0xC,
|
||||
"PackedPointingProcessorConfig is an invalid size");
|
||||
|
||||
// This is nn::irsensor::PackedFunctionLevel
|
||||
struct PackedFunctionLevel {
|
||||
IrSensorFunctionLevel function_level;
|
||||
INSERT_PADDING_BYTES(3);
|
||||
};
|
||||
static_assert(sizeof(PackedFunctionLevel) == 0x4, "PackedFunctionLevel is an invalid size");
|
||||
|
||||
// This is nn::irsensor::PackedImageTransferProcessorExConfig
|
||||
struct PackedImageTransferProcessorExConfig {
|
||||
u64 exposire_time;
|
||||
u8 light_target;
|
||||
u8 gain;
|
||||
u8 is_negative_used;
|
||||
INSERT_PADDING_BYTES(5);
|
||||
PackedMcuVersion required_mcu_version;
|
||||
ImageTransferProcessorFormat origin_format;
|
||||
ImageTransferProcessorFormat trimming_format;
|
||||
u16 trimming_start_x;
|
||||
u16 trimming_start_y;
|
||||
u8 is_external_light_filter_enabled;
|
||||
INSERT_PADDING_BYTES(3);
|
||||
};
|
||||
static_assert(sizeof(PackedImageTransferProcessorExConfig) == 0x20,
|
||||
"PackedImageTransferProcessorExConfig is an invalid size");
|
||||
|
||||
// This is nn::irsensor::PackedIrLedProcessorConfig
|
||||
struct PackedIrLedProcessorConfig {
|
||||
PackedMcuVersion required_mcu_version;
|
||||
u8 light_target;
|
||||
INSERT_PADDING_BYTES(3);
|
||||
};
|
||||
static_assert(sizeof(PackedIrLedProcessorConfig) == 0x8,
|
||||
"PackedIrLedProcessorConfig is an invalid size");
|
||||
|
||||
void ActivateIrsensor(Kernel::HLERequestContext& ctx);
|
||||
void DeactivateIrsensor(Kernel::HLERequestContext& ctx);
|
||||
@@ -56,56 +265,6 @@ private:
|
||||
void RunIrLedProcessor(Kernel::HLERequestContext& ctx);
|
||||
void StopImageProcessorAsync(Kernel::HLERequestContext& ctx);
|
||||
void ActivateIrsensorWithFunctionLevel(Kernel::HLERequestContext& ctx);
|
||||
|
||||
Result IsIrCameraHandleValid(const Core::IrSensor::IrCameraHandle& camera_handle) const;
|
||||
Core::IrSensor::DeviceFormat& GetIrCameraSharedMemoryDeviceEntry(
|
||||
const Core::IrSensor::IrCameraHandle& camera_handle);
|
||||
|
||||
template <typename T>
|
||||
void MakeProcessor(const Core::IrSensor::IrCameraHandle& handle,
|
||||
Core::IrSensor::DeviceFormat& device_state) {
|
||||
const auto index = static_cast<std::size_t>(handle.npad_id);
|
||||
if (index > sizeof(processors)) {
|
||||
LOG_CRITICAL(Service_IRS, "Invalid index {}", index);
|
||||
return;
|
||||
}
|
||||
processors[index] = std::make_unique<T>(device_state);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void MakeProcessorWithCoreContext(const Core::IrSensor::IrCameraHandle& handle,
|
||||
Core::IrSensor::DeviceFormat& device_state) {
|
||||
const auto index = static_cast<std::size_t>(handle.npad_id);
|
||||
if (index > sizeof(processors)) {
|
||||
LOG_CRITICAL(Service_IRS, "Invalid index {}", index);
|
||||
return;
|
||||
}
|
||||
processors[index] = std::make_unique<T>(system.HIDCore(), device_state, index);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T& GetProcessor(const Core::IrSensor::IrCameraHandle& handle) {
|
||||
const auto index = static_cast<std::size_t>(handle.npad_id);
|
||||
if (index > sizeof(processors)) {
|
||||
LOG_CRITICAL(Service_IRS, "Invalid index {}", index);
|
||||
return static_cast<T&>(*processors[0]);
|
||||
}
|
||||
return static_cast<T&>(*processors[index]);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
const T& GetProcessor(const Core::IrSensor::IrCameraHandle& handle) const {
|
||||
const auto index = static_cast<std::size_t>(handle.npad_id);
|
||||
if (index > sizeof(processors)) {
|
||||
LOG_CRITICAL(Service_IRS, "Invalid index {}", index);
|
||||
return static_cast<T&>(*processors[0]);
|
||||
}
|
||||
return static_cast<T&>(*processors[index]);
|
||||
}
|
||||
|
||||
Core::HID::EmulatedController* npad_device = nullptr;
|
||||
StatusManager* shared_memory = nullptr;
|
||||
std::array<std::unique_ptr<ProcessorBase>, 9> processors{};
|
||||
};
|
||||
|
||||
class IRS_SYS final : public ServiceFramework<IRS_SYS> {
|
||||
@@ -114,4 +273,4 @@ public:
|
||||
~IRS_SYS() override;
|
||||
};
|
||||
|
||||
} // namespace Service::IRS
|
||||
} // namespace Service::HID
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
add_library(input_common STATIC
|
||||
drivers/camera.cpp
|
||||
drivers/camera.h
|
||||
drivers/gc_adapter.cpp
|
||||
drivers/gc_adapter.h
|
||||
drivers/keyboard.cpp
|
||||
|
||||
@@ -90,18 +90,6 @@ void InputEngine::SetMotion(const PadIdentifier& identifier, int motion, const B
|
||||
TriggerOnMotionChange(identifier, motion, value);
|
||||
}
|
||||
|
||||
void InputEngine::SetCamera(const PadIdentifier& identifier,
|
||||
const Common::Input::CameraStatus& value) {
|
||||
{
|
||||
std::scoped_lock lock{mutex};
|
||||
ControllerData& controller = controller_list.at(identifier);
|
||||
if (!configuring) {
|
||||
controller.camera = value;
|
||||
}
|
||||
}
|
||||
TriggerOnCameraChange(identifier, value);
|
||||
}
|
||||
|
||||
bool InputEngine::GetButton(const PadIdentifier& identifier, int button) const {
|
||||
std::scoped_lock lock{mutex};
|
||||
const auto controller_iter = controller_list.find(identifier);
|
||||
@@ -177,18 +165,6 @@ BasicMotion InputEngine::GetMotion(const PadIdentifier& identifier, int motion)
|
||||
return controller.motions.at(motion);
|
||||
}
|
||||
|
||||
Common::Input::CameraStatus InputEngine::GetCamera(const PadIdentifier& identifier) const {
|
||||
std::scoped_lock lock{mutex};
|
||||
const auto controller_iter = controller_list.find(identifier);
|
||||
if (controller_iter == controller_list.cend()) {
|
||||
LOG_ERROR(Input, "Invalid identifier guid={}, pad={}, port={}", identifier.guid.RawString(),
|
||||
identifier.pad, identifier.port);
|
||||
return {};
|
||||
}
|
||||
const ControllerData& controller = controller_iter->second;
|
||||
return controller.camera;
|
||||
}
|
||||
|
||||
void InputEngine::ResetButtonState() {
|
||||
for (const auto& controller : controller_list) {
|
||||
for (const auto& button : controller.second.buttons) {
|
||||
@@ -341,20 +317,6 @@ void InputEngine::TriggerOnMotionChange(const PadIdentifier& identifier, int mot
|
||||
});
|
||||
}
|
||||
|
||||
void InputEngine::TriggerOnCameraChange(const PadIdentifier& identifier,
|
||||
[[maybe_unused]] const Common::Input::CameraStatus& value) {
|
||||
std::scoped_lock lock{mutex_callback};
|
||||
for (const auto& poller_pair : callback_list) {
|
||||
const InputIdentifier& poller = poller_pair.second;
|
||||
if (!IsInputIdentifierEqual(poller, identifier, EngineInputType::Camera, 0)) {
|
||||
continue;
|
||||
}
|
||||
if (poller.callback.on_change) {
|
||||
poller.callback.on_change();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool InputEngine::IsInputIdentifierEqual(const InputIdentifier& input_identifier,
|
||||
const PadIdentifier& identifier, EngineInputType type,
|
||||
int index) const {
|
||||
|
||||
@@ -36,12 +36,11 @@ struct BasicMotion {
|
||||
// Types of input that are stored in the engine
|
||||
enum class EngineInputType {
|
||||
None,
|
||||
Analog,
|
||||
Battery,
|
||||
Button,
|
||||
Camera,
|
||||
HatButton,
|
||||
Analog,
|
||||
Motion,
|
||||
Battery,
|
||||
};
|
||||
|
||||
namespace std {
|
||||
@@ -116,17 +115,10 @@ public:
|
||||
// Sets polling mode to a controller
|
||||
virtual Common::Input::PollingError SetPollingMode(
|
||||
[[maybe_unused]] const PadIdentifier& identifier,
|
||||
[[maybe_unused]] const Common::Input::PollingMode polling_mode) {
|
||||
[[maybe_unused]] const Common::Input::PollingMode vibration) {
|
||||
return Common::Input::PollingError::NotSupported;
|
||||
}
|
||||
|
||||
// Sets camera format to a controller
|
||||
virtual Common::Input::CameraError SetCameraFormat(
|
||||
[[maybe_unused]] const PadIdentifier& identifier,
|
||||
[[maybe_unused]] Common::Input::CameraFormat camera_format) {
|
||||
return Common::Input::CameraError::NotSupported;
|
||||
}
|
||||
|
||||
// Returns the engine name
|
||||
[[nodiscard]] const std::string& GetEngineName() const;
|
||||
|
||||
@@ -182,7 +174,6 @@ public:
|
||||
f32 GetAxis(const PadIdentifier& identifier, int axis) const;
|
||||
Common::Input::BatteryLevel GetBattery(const PadIdentifier& identifier) const;
|
||||
BasicMotion GetMotion(const PadIdentifier& identifier, int motion) const;
|
||||
Common::Input::CameraStatus GetCamera(const PadIdentifier& identifier) const;
|
||||
|
||||
int SetCallback(InputIdentifier input_identifier);
|
||||
void SetMappingCallback(MappingCallback callback);
|
||||
@@ -194,7 +185,6 @@ protected:
|
||||
void SetAxis(const PadIdentifier& identifier, int axis, f32 value);
|
||||
void SetBattery(const PadIdentifier& identifier, Common::Input::BatteryLevel value);
|
||||
void SetMotion(const PadIdentifier& identifier, int motion, const BasicMotion& value);
|
||||
void SetCamera(const PadIdentifier& identifier, const Common::Input::CameraStatus& value);
|
||||
|
||||
virtual std::string GetHatButtonName([[maybe_unused]] u8 direction_value) const {
|
||||
return "Unknown";
|
||||
@@ -207,7 +197,6 @@ private:
|
||||
std::unordered_map<int, float> axes;
|
||||
std::unordered_map<int, BasicMotion> motions;
|
||||
Common::Input::BatteryLevel battery{};
|
||||
Common::Input::CameraStatus camera{};
|
||||
};
|
||||
|
||||
void TriggerOnButtonChange(const PadIdentifier& identifier, int button, bool value);
|
||||
@@ -216,8 +205,6 @@ private:
|
||||
void TriggerOnBatteryChange(const PadIdentifier& identifier, Common::Input::BatteryLevel value);
|
||||
void TriggerOnMotionChange(const PadIdentifier& identifier, int motion,
|
||||
const BasicMotion& value);
|
||||
void TriggerOnCameraChange(const PadIdentifier& identifier,
|
||||
const Common::Input::CameraStatus& value);
|
||||
|
||||
bool IsInputIdentifierEqual(const InputIdentifier& input_identifier,
|
||||
const PadIdentifier& identifier, EngineInputType type,
|
||||
|
||||
@@ -664,47 +664,6 @@ private:
|
||||
InputEngine* input_engine;
|
||||
};
|
||||
|
||||
class InputFromCamera final : public Common::Input::InputDevice {
|
||||
public:
|
||||
explicit InputFromCamera(PadIdentifier identifier_, InputEngine* input_engine_)
|
||||
: identifier(identifier_), input_engine(input_engine_) {
|
||||
UpdateCallback engine_callback{[this]() { OnChange(); }};
|
||||
const InputIdentifier input_identifier{
|
||||
.identifier = identifier,
|
||||
.type = EngineInputType::Camera,
|
||||
.index = 0,
|
||||
.callback = engine_callback,
|
||||
};
|
||||
callback_key = input_engine->SetCallback(input_identifier);
|
||||
}
|
||||
|
||||
~InputFromCamera() override {
|
||||
input_engine->DeleteCallback(callback_key);
|
||||
}
|
||||
|
||||
Common::Input::CameraStatus GetStatus() const {
|
||||
return input_engine->GetCamera(identifier);
|
||||
}
|
||||
|
||||
void ForceUpdate() override {
|
||||
OnChange();
|
||||
}
|
||||
|
||||
void OnChange() {
|
||||
const Common::Input::CallbackStatus status{
|
||||
.type = Common::Input::InputType::IrSensor,
|
||||
.camera_status = GetStatus(),
|
||||
};
|
||||
|
||||
TriggerOnChange(status);
|
||||
}
|
||||
|
||||
private:
|
||||
const PadIdentifier identifier;
|
||||
int callback_key;
|
||||
InputEngine* input_engine;
|
||||
};
|
||||
|
||||
class OutputFromIdentifier final : public Common::Input::OutputDevice {
|
||||
public:
|
||||
explicit OutputFromIdentifier(PadIdentifier identifier_, InputEngine* input_engine_)
|
||||
@@ -723,10 +682,6 @@ public:
|
||||
return input_engine->SetPollingMode(identifier, polling_mode);
|
||||
}
|
||||
|
||||
Common::Input::CameraError SetCameraFormat(Common::Input::CameraFormat camera_format) override {
|
||||
return input_engine->SetCameraFormat(identifier, camera_format);
|
||||
}
|
||||
|
||||
private:
|
||||
const PadIdentifier identifier;
|
||||
InputEngine* input_engine;
|
||||
@@ -965,18 +920,6 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateMotionDevice(
|
||||
properties_y, properties_z, input_engine.get());
|
||||
}
|
||||
|
||||
std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateCameraDevice(
|
||||
const Common::ParamPackage& params) {
|
||||
const PadIdentifier identifier = {
|
||||
.guid = Common::UUID{params.Get("guid", "")},
|
||||
.port = static_cast<std::size_t>(params.Get("port", 0)),
|
||||
.pad = static_cast<std::size_t>(params.Get("pad", 0)),
|
||||
};
|
||||
|
||||
input_engine->PreSetController(identifier);
|
||||
return std::make_unique<InputFromCamera>(identifier, input_engine.get());
|
||||
}
|
||||
|
||||
InputFactory::InputFactory(std::shared_ptr<InputEngine> input_engine_)
|
||||
: input_engine(std::move(input_engine_)) {}
|
||||
|
||||
@@ -985,9 +928,6 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::Create(
|
||||
if (params.Has("battery")) {
|
||||
return CreateBatteryDevice(params);
|
||||
}
|
||||
if (params.Has("camera")) {
|
||||
return CreateCameraDevice(params);
|
||||
}
|
||||
if (params.Has("button") && params.Has("axis")) {
|
||||
return CreateTriggerDevice(params);
|
||||
}
|
||||
|
||||
@@ -211,17 +211,6 @@ private:
|
||||
*/
|
||||
std::unique_ptr<Common::Input::InputDevice> CreateMotionDevice(Common::ParamPackage params);
|
||||
|
||||
/**
|
||||
* Creates a camera device from the parameters given.
|
||||
* @param params contains parameters for creating the device:
|
||||
* - "guid": text string for identifying controllers
|
||||
* - "port": port of the connected device
|
||||
* - "pad": slot of the connected controller
|
||||
* @returns a unique input device with the parameters specified
|
||||
*/
|
||||
std::unique_ptr<Common::Input::InputDevice> CreateCameraDevice(
|
||||
const Common::ParamPackage& params);
|
||||
|
||||
std::shared_ptr<InputEngine> input_engine;
|
||||
};
|
||||
} // namespace InputCommon
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <memory>
|
||||
#include "common/input.h"
|
||||
#include "common/param_package.h"
|
||||
#include "input_common/drivers/camera.h"
|
||||
#include "input_common/drivers/gc_adapter.h"
|
||||
#include "input_common/drivers/keyboard.h"
|
||||
#include "input_common/drivers/mouse.h"
|
||||
@@ -79,15 +78,6 @@ struct InputSubsystem::Impl {
|
||||
Common::Input::RegisterFactory<Common::Input::OutputDevice>(tas_input->GetEngineName(),
|
||||
tas_output_factory);
|
||||
|
||||
camera = std::make_shared<Camera>("camera");
|
||||
camera->SetMappingCallback(mapping_callback);
|
||||
camera_input_factory = std::make_shared<InputFactory>(camera);
|
||||
camera_output_factory = std::make_shared<OutputFactory>(camera);
|
||||
Common::Input::RegisterFactory<Common::Input::InputDevice>(camera->GetEngineName(),
|
||||
camera_input_factory);
|
||||
Common::Input::RegisterFactory<Common::Input::OutputDevice>(camera->GetEngineName(),
|
||||
camera_output_factory);
|
||||
|
||||
#ifdef HAVE_SDL2
|
||||
sdl = std::make_shared<SDLDriver>("sdl");
|
||||
sdl->SetMappingCallback(mapping_callback);
|
||||
@@ -327,7 +317,6 @@ struct InputSubsystem::Impl {
|
||||
std::shared_ptr<TouchScreen> touch_screen;
|
||||
std::shared_ptr<TasInput::Tas> tas_input;
|
||||
std::shared_ptr<CemuhookUDP::UDPClient> udp_client;
|
||||
std::shared_ptr<Camera> camera;
|
||||
|
||||
std::shared_ptr<InputFactory> keyboard_factory;
|
||||
std::shared_ptr<InputFactory> mouse_factory;
|
||||
@@ -335,14 +324,12 @@ struct InputSubsystem::Impl {
|
||||
std::shared_ptr<InputFactory> touch_screen_factory;
|
||||
std::shared_ptr<InputFactory> udp_client_input_factory;
|
||||
std::shared_ptr<InputFactory> tas_input_factory;
|
||||
std::shared_ptr<InputFactory> camera_input_factory;
|
||||
|
||||
std::shared_ptr<OutputFactory> keyboard_output_factory;
|
||||
std::shared_ptr<OutputFactory> mouse_output_factory;
|
||||
std::shared_ptr<OutputFactory> gcadapter_output_factory;
|
||||
std::shared_ptr<OutputFactory> udp_client_output_factory;
|
||||
std::shared_ptr<OutputFactory> tas_output_factory;
|
||||
std::shared_ptr<OutputFactory> camera_output_factory;
|
||||
|
||||
#ifdef HAVE_SDL2
|
||||
std::shared_ptr<SDLDriver> sdl;
|
||||
@@ -395,14 +382,6 @@ const TasInput::Tas* InputSubsystem::GetTas() const {
|
||||
return impl->tas_input.get();
|
||||
}
|
||||
|
||||
Camera* InputSubsystem::GetCamera() {
|
||||
return impl->camera.get();
|
||||
}
|
||||
|
||||
const Camera* InputSubsystem::GetCamera() const {
|
||||
return impl->camera.get();
|
||||
}
|
||||
|
||||
std::vector<Common::ParamPackage> InputSubsystem::GetInputDevices() const {
|
||||
return impl->GetInputDevices();
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ enum Values : int;
|
||||
}
|
||||
|
||||
namespace InputCommon {
|
||||
class Camera;
|
||||
class Keyboard;
|
||||
class Mouse;
|
||||
class TouchScreen;
|
||||
@@ -93,15 +92,9 @@ public:
|
||||
/// Retrieves the underlying tas input device.
|
||||
[[nodiscard]] TasInput::Tas* GetTas();
|
||||
|
||||
/// Retrieves the underlying tas input device.
|
||||
/// Retrieves the underlying tas input device.
|
||||
[[nodiscard]] const TasInput::Tas* GetTas() const;
|
||||
|
||||
/// Retrieves the underlying camera input device.
|
||||
[[nodiscard]] Camera* GetCamera();
|
||||
|
||||
/// Retrieves the underlying camera input device.
|
||||
[[nodiscard]] const Camera* GetCamera() const;
|
||||
|
||||
/**
|
||||
* Returns all available input devices that this Factory can create a new device with.
|
||||
* Each returned ParamPackage should have a `display` field used for display, a `engine` field
|
||||
|
||||
@@ -87,8 +87,12 @@ u32 GetBytesPerPixel(const Tegra::FramebufferConfig& framebuffer) {
|
||||
}
|
||||
|
||||
std::size_t GetSizeInBytes(const Tegra::FramebufferConfig& framebuffer) {
|
||||
return static_cast<std::size_t>(framebuffer.stride) *
|
||||
static_cast<std::size_t>(framebuffer.height) * GetBytesPerPixel(framebuffer);
|
||||
// TODO(Rodrigo): Read this from HLE
|
||||
constexpr u32 block_height_log2 = 4;
|
||||
const u32 bytes_per_pixel = GetBytesPerPixel(framebuffer);
|
||||
const u64 size_bytes{Tegra::Texture::CalculateSize(
|
||||
true, bytes_per_pixel, framebuffer.stride, framebuffer.height, 1, block_height_log2, 0)};
|
||||
return size_bytes;
|
||||
}
|
||||
|
||||
VkFormat GetFormat(const Tegra::FramebufferConfig& framebuffer) {
|
||||
@@ -169,9 +173,8 @@ VkSemaphore BlitScreen::Draw(const Tegra::FramebufferConfig& framebuffer,
|
||||
// TODO(Rodrigo): Read this from HLE
|
||||
constexpr u32 block_height_log2 = 4;
|
||||
const u32 bytes_per_pixel = GetBytesPerPixel(framebuffer);
|
||||
const u64 size_bytes{Tegra::Texture::CalculateSize(true, bytes_per_pixel,
|
||||
framebuffer.stride, framebuffer.height,
|
||||
1, block_height_log2, 0)};
|
||||
const u64 size_bytes{GetSizeInBytes(framebuffer)};
|
||||
|
||||
Tegra::Texture::UnswizzleTexture(
|
||||
mapped_span.subspan(image_offset, size_bytes), std::span(host_ptr, size_bytes),
|
||||
bytes_per_pixel, framebuffer.width, framebuffer.height, 1, block_height_log2, 0);
|
||||
|
||||
@@ -41,9 +41,6 @@ add_executable(yuzu
|
||||
configuration/configure_audio.cpp
|
||||
configuration/configure_audio.h
|
||||
configuration/configure_audio.ui
|
||||
configuration/configure_camera.cpp
|
||||
configuration/configure_camera.h
|
||||
configuration/configure_camera.ui
|
||||
configuration/configure_cpu.cpp
|
||||
configuration/configure_cpu.h
|
||||
configuration/configure_cpu.ui
|
||||
@@ -257,7 +254,7 @@ endif()
|
||||
create_target_directory_groups(yuzu)
|
||||
|
||||
target_link_libraries(yuzu PRIVATE common core input_common video_core)
|
||||
target_link_libraries(yuzu PRIVATE Boost::boost glad Qt::Widgets Qt::Multimedia)
|
||||
target_link_libraries(yuzu PRIVATE Boost::boost glad Qt::Widgets)
|
||||
target_link_libraries(yuzu PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
|
||||
|
||||
target_include_directories(yuzu PRIVATE ../../externals/Vulkan-Headers/include)
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
#include <glad/glad.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCameraImageCapture>
|
||||
#include <QCameraInfo>
|
||||
#include <QHBoxLayout>
|
||||
#include <QMessageBox>
|
||||
#include <QPainter>
|
||||
@@ -33,7 +31,6 @@
|
||||
#include "core/core.h"
|
||||
#include "core/cpu_manager.h"
|
||||
#include "core/frontend/framebuffer_layout.h"
|
||||
#include "input_common/drivers/camera.h"
|
||||
#include "input_common/drivers/keyboard.h"
|
||||
#include "input_common/drivers/mouse.h"
|
||||
#include "input_common/drivers/tas_input.h"
|
||||
@@ -804,74 +801,6 @@ void GRenderWindow::TouchEndEvent() {
|
||||
input_subsystem->GetTouchScreen()->ReleaseAllTouch();
|
||||
}
|
||||
|
||||
void GRenderWindow::InitializeCamera() {
|
||||
if (!Settings::values.enable_ir_sensor) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool camera_found = false;
|
||||
const QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
|
||||
for (const QCameraInfo& cameraInfo : cameras) {
|
||||
if (Settings::values.ir_sensor_device.GetValue() == cameraInfo.deviceName().toStdString() ||
|
||||
Settings::values.ir_sensor_device.GetValue() == "Auto") {
|
||||
camera = std::make_unique<QCamera>(cameraInfo);
|
||||
camera_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!camera_found) {
|
||||
return;
|
||||
}
|
||||
|
||||
camera_capture = std::make_unique<QCameraImageCapture>(camera.get());
|
||||
connect(camera_capture.get(), &QCameraImageCapture::imageCaptured, this,
|
||||
&GRenderWindow::OnCameraCapture);
|
||||
camera->unload();
|
||||
camera->setCaptureMode(QCamera::CaptureViewfinder);
|
||||
camera->load();
|
||||
|
||||
camera_timer = std::make_unique<QTimer>();
|
||||
connect(camera_timer.get(), &QTimer::timeout, [this] { RequestCameraCapture(); });
|
||||
// This timer should be dependent of camera resolution 5ms for every 100 pixels
|
||||
camera_timer->start(100);
|
||||
}
|
||||
|
||||
void GRenderWindow::FinalizeCamera() {
|
||||
if (camera_timer) {
|
||||
camera_timer->stop();
|
||||
}
|
||||
if (camera) {
|
||||
camera->unload();
|
||||
}
|
||||
}
|
||||
|
||||
void GRenderWindow::RequestCameraCapture() {
|
||||
if (!Settings::values.enable_ir_sensor) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Idealy one should only call capture but Qt refuses to take a second capture without
|
||||
// stopping the camera
|
||||
camera->stop();
|
||||
camera->start();
|
||||
|
||||
camera_capture->capture();
|
||||
}
|
||||
|
||||
void GRenderWindow::OnCameraCapture(int requestId, const QImage& img) {
|
||||
constexpr std::size_t camera_width = 320;
|
||||
constexpr std::size_t camera_height = 240;
|
||||
const auto converted =
|
||||
img.scaled(camera_width, camera_height, Qt::AspectRatioMode::IgnoreAspectRatio,
|
||||
Qt::TransformationMode::SmoothTransformation)
|
||||
.mirrored(false, true);
|
||||
std::vector<u32> camera_data{};
|
||||
camera_data.resize(camera_width * camera_height);
|
||||
std::memcpy(camera_data.data(), converted.bits(), camera_width * camera_height * sizeof(u32));
|
||||
input_subsystem->GetCamera()->SetCameraData(camera_width, camera_height, camera_data);
|
||||
}
|
||||
|
||||
bool GRenderWindow::event(QEvent* event) {
|
||||
if (event->type() == QEvent::TouchBegin) {
|
||||
TouchBeginEvent(static_cast<QTouchEvent*>(event));
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
|
||||
class GRenderWindow;
|
||||
class GMainWindow;
|
||||
class QCamera;
|
||||
class QCameraImageCapture;
|
||||
class QKeyEvent;
|
||||
|
||||
namespace Core {
|
||||
@@ -166,9 +164,6 @@ public:
|
||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
void wheelEvent(QWheelEvent* event) override;
|
||||
|
||||
void InitializeCamera();
|
||||
void FinalizeCamera();
|
||||
|
||||
bool event(QEvent* event) override;
|
||||
|
||||
void focusOutEvent(QFocusEvent* event) override;
|
||||
@@ -212,9 +207,6 @@ private:
|
||||
void TouchUpdateEvent(const QTouchEvent* event);
|
||||
void TouchEndEvent();
|
||||
|
||||
void RequestCameraCapture();
|
||||
void OnCameraCapture(int requestId, const QImage& img);
|
||||
|
||||
void OnMinimalClientAreaChangeRequest(std::pair<u32, u32> minimal_size) override;
|
||||
|
||||
bool InitializeOpenGL();
|
||||
@@ -240,10 +232,6 @@ private:
|
||||
bool first_frame = false;
|
||||
InputCommon::TasInput::TasState last_tas_state;
|
||||
|
||||
std::unique_ptr<QCamera> camera;
|
||||
std::unique_ptr<QCameraImageCapture> camera_capture;
|
||||
std::unique_ptr<QTimer> camera_timer;
|
||||
|
||||
Core::System& system;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -368,11 +368,6 @@ void Config::ReadHidbusValues() {
|
||||
}
|
||||
}
|
||||
|
||||
void Config::ReadIrCameraValues() {
|
||||
ReadBasicSetting(Settings::values.enable_ir_sensor);
|
||||
ReadBasicSetting(Settings::values.ir_sensor_device);
|
||||
}
|
||||
|
||||
void Config::ReadAudioValues() {
|
||||
qt_config->beginGroup(QStringLiteral("Audio"));
|
||||
|
||||
@@ -398,7 +393,6 @@ void Config::ReadControlValues() {
|
||||
ReadTouchscreenValues();
|
||||
ReadMotionTouchValues();
|
||||
ReadHidbusValues();
|
||||
ReadIrCameraValues();
|
||||
|
||||
#ifdef _WIN32
|
||||
ReadBasicSetting(Settings::values.enable_raw_input);
|
||||
@@ -1004,11 +998,6 @@ void Config::SaveHidbusValues() {
|
||||
QString::fromStdString(default_param));
|
||||
}
|
||||
|
||||
void Config::SaveIrCameraValues() {
|
||||
WriteBasicSetting(Settings::values.enable_ir_sensor);
|
||||
WriteBasicSetting(Settings::values.ir_sensor_device);
|
||||
}
|
||||
|
||||
void Config::SaveValues() {
|
||||
if (global) {
|
||||
SaveControlValues();
|
||||
@@ -1051,7 +1040,6 @@ void Config::SaveControlValues() {
|
||||
SaveTouchscreenValues();
|
||||
SaveMotionTouchValues();
|
||||
SaveHidbusValues();
|
||||
SaveIrCameraValues();
|
||||
|
||||
WriteGlobalSetting(Settings::values.use_docked_mode);
|
||||
WriteGlobalSetting(Settings::values.vibration_enabled);
|
||||
|
||||
@@ -68,7 +68,6 @@ private:
|
||||
void ReadTouchscreenValues();
|
||||
void ReadMotionTouchValues();
|
||||
void ReadHidbusValues();
|
||||
void ReadIrCameraValues();
|
||||
|
||||
// Read functions bases off the respective config section names.
|
||||
void ReadAudioValues();
|
||||
@@ -97,7 +96,6 @@ private:
|
||||
void SaveTouchscreenValues();
|
||||
void SaveMotionTouchValues();
|
||||
void SaveHidbusValues();
|
||||
void SaveIrCameraValues();
|
||||
|
||||
// Save functions based off the respective config section names.
|
||||
void SaveAudioValues();
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "ui_configure_input.h"
|
||||
#include "ui_configure_input_advanced.h"
|
||||
#include "ui_configure_input_player.h"
|
||||
#include "yuzu/configuration/configure_camera.h"
|
||||
#include "yuzu/configuration/configure_debug_controller.h"
|
||||
#include "yuzu/configuration/configure_input.h"
|
||||
#include "yuzu/configuration/configure_input_advanced.h"
|
||||
@@ -164,10 +163,6 @@ void ConfigureInput::Initialize(InputCommon::InputSubsystem* input_subsystem,
|
||||
[this, input_subsystem, &hid_core] {
|
||||
CallConfigureDialog<ConfigureRingController>(*this, input_subsystem, hid_core);
|
||||
});
|
||||
connect(advanced, &ConfigureInputAdvanced::CallCameraDialog,
|
||||
[this, input_subsystem, &hid_core] {
|
||||
CallConfigureDialog<ConfigureCamera>(*this, input_subsystem);
|
||||
});
|
||||
|
||||
connect(ui->vibrationButton, &QPushButton::clicked,
|
||||
[this, &hid_core] { CallConfigureDialog<ConfigureVibration>(*this, hid_core); });
|
||||
|
||||
@@ -89,7 +89,6 @@ ConfigureInputAdvanced::ConfigureInputAdvanced(QWidget* parent)
|
||||
[this] { CallMotionTouchConfigDialog(); });
|
||||
connect(ui->ring_controller_configure, &QPushButton::clicked, this,
|
||||
[this] { CallRingControllerDialog(); });
|
||||
connect(ui->camera_configure, &QPushButton::clicked, this, [this] { CallCameraDialog(); });
|
||||
|
||||
#ifndef _WIN32
|
||||
ui->enable_raw_input->setVisible(false);
|
||||
@@ -137,7 +136,6 @@ void ConfigureInputAdvanced::ApplyConfiguration() {
|
||||
Settings::values.enable_udp_controller = ui->enable_udp_controller->isChecked();
|
||||
Settings::values.controller_navigation = ui->controller_navigation->isChecked();
|
||||
Settings::values.enable_ring_controller = ui->enable_ring_controller->isChecked();
|
||||
Settings::values.enable_ir_sensor = ui->enable_ir_sensor->isChecked();
|
||||
}
|
||||
|
||||
void ConfigureInputAdvanced::LoadConfiguration() {
|
||||
@@ -171,7 +169,6 @@ void ConfigureInputAdvanced::LoadConfiguration() {
|
||||
ui->enable_udp_controller->setChecked(Settings::values.enable_udp_controller.GetValue());
|
||||
ui->controller_navigation->setChecked(Settings::values.controller_navigation.GetValue());
|
||||
ui->enable_ring_controller->setChecked(Settings::values.enable_ring_controller.GetValue());
|
||||
ui->enable_ir_sensor->setChecked(Settings::values.enable_ir_sensor.GetValue());
|
||||
|
||||
UpdateUIEnabled();
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ signals:
|
||||
void CallTouchscreenConfigDialog();
|
||||
void CallMotionTouchConfigDialog();
|
||||
void CallRingControllerDialog();
|
||||
void CallCameraDialog();
|
||||
|
||||
private:
|
||||
void changeEvent(QEvent* event) override;
|
||||
|
||||
@@ -2617,20 +2617,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="enable_ir_sensor">
|
||||
<property name="text">
|
||||
<string>Infrared Camera</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QPushButton" name="camera_configure">
|
||||
<property name="text">
|
||||
<string>Configure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -1541,8 +1541,6 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
|
||||
mouse_hide_timer.start();
|
||||
}
|
||||
|
||||
render_window->InitializeCamera();
|
||||
|
||||
std::string title_name;
|
||||
std::string title_version;
|
||||
const auto res = system->GetGameName(title_name);
|
||||
@@ -1624,7 +1622,6 @@ void GMainWindow::ShutdownGame() {
|
||||
tas_label->clear();
|
||||
input_subsystem->GetTas()->Stop();
|
||||
OnTasStateChanged();
|
||||
render_window->FinalizeCamera();
|
||||
|
||||
// Enable all controllers
|
||||
system->HIDCore().SetSupportedStyleTag({Core::HID::NpadStyleSet::All});
|
||||
@@ -2864,12 +2861,6 @@ void GMainWindow::OnConfigure() {
|
||||
mouse_hide_timer.start();
|
||||
}
|
||||
|
||||
// Restart camera config
|
||||
if (emulation_running) {
|
||||
render_window->FinalizeCamera();
|
||||
render_window->InitializeCamera();
|
||||
}
|
||||
|
||||
if (!UISettings::values.has_broken_vulkan) {
|
||||
renderer_status_button->setEnabled(!emulation_running);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user