|
@@ -15,10 +15,12 @@
|
|
|
#include "common/settings.h"
|
|
#include "common/settings.h"
|
|
|
#include "common/vector_math.h"
|
|
#include "common/vector_math.h"
|
|
|
#include "core/hid/hid_types.h"
|
|
#include "core/hid/hid_types.h"
|
|
|
|
|
+#include "core/hid/irs_types.h"
|
|
|
#include "core/hid/motion_input.h"
|
|
#include "core/hid/motion_input.h"
|
|
|
|
|
|
|
|
namespace Core::HID {
|
|
namespace Core::HID {
|
|
|
const std::size_t max_emulated_controllers = 2;
|
|
const std::size_t max_emulated_controllers = 2;
|
|
|
|
|
+const std::size_t output_devices = 3;
|
|
|
struct ControllerMotionInfo {
|
|
struct ControllerMotionInfo {
|
|
|
Common::Input::MotionStatus raw_status{};
|
|
Common::Input::MotionStatus raw_status{};
|
|
|
MotionInput emulated{};
|
|
MotionInput emulated{};
|
|
@@ -34,15 +36,16 @@ using TriggerDevices =
|
|
|
std::array<std::unique_ptr<Common::Input::InputDevice>, Settings::NativeTrigger::NumTriggers>;
|
|
std::array<std::unique_ptr<Common::Input::InputDevice>, Settings::NativeTrigger::NumTriggers>;
|
|
|
using BatteryDevices =
|
|
using BatteryDevices =
|
|
|
std::array<std::unique_ptr<Common::Input::InputDevice>, max_emulated_controllers>;
|
|
std::array<std::unique_ptr<Common::Input::InputDevice>, max_emulated_controllers>;
|
|
|
-using OutputDevices =
|
|
|
|
|
- std::array<std::unique_ptr<Common::Input::OutputDevice>, max_emulated_controllers>;
|
|
|
|
|
|
|
+using CameraDevices = std::unique_ptr<Common::Input::InputDevice>;
|
|
|
|
|
+using OutputDevices = std::array<std::unique_ptr<Common::Input::OutputDevice>, output_devices>;
|
|
|
|
|
|
|
|
using ButtonParams = std::array<Common::ParamPackage, Settings::NativeButton::NumButtons>;
|
|
using ButtonParams = std::array<Common::ParamPackage, Settings::NativeButton::NumButtons>;
|
|
|
using StickParams = std::array<Common::ParamPackage, Settings::NativeAnalog::NumAnalogs>;
|
|
using StickParams = std::array<Common::ParamPackage, Settings::NativeAnalog::NumAnalogs>;
|
|
|
using ControllerMotionParams = std::array<Common::ParamPackage, Settings::NativeMotion::NumMotions>;
|
|
using ControllerMotionParams = std::array<Common::ParamPackage, Settings::NativeMotion::NumMotions>;
|
|
|
using TriggerParams = std::array<Common::ParamPackage, Settings::NativeTrigger::NumTriggers>;
|
|
using TriggerParams = std::array<Common::ParamPackage, Settings::NativeTrigger::NumTriggers>;
|
|
|
using BatteryParams = std::array<Common::ParamPackage, max_emulated_controllers>;
|
|
using BatteryParams = std::array<Common::ParamPackage, max_emulated_controllers>;
|
|
|
-using OutputParams = std::array<Common::ParamPackage, max_emulated_controllers>;
|
|
|
|
|
|
|
+using CameraParams = Common::ParamPackage;
|
|
|
|
|
+using OutputParams = std::array<Common::ParamPackage, output_devices>;
|
|
|
|
|
|
|
|
using ButtonValues = std::array<Common::Input::ButtonStatus, Settings::NativeButton::NumButtons>;
|
|
using ButtonValues = std::array<Common::Input::ButtonStatus, Settings::NativeButton::NumButtons>;
|
|
|
using SticksValues = std::array<Common::Input::StickStatus, Settings::NativeAnalog::NumAnalogs>;
|
|
using SticksValues = std::array<Common::Input::StickStatus, Settings::NativeAnalog::NumAnalogs>;
|
|
@@ -51,6 +54,7 @@ using TriggerValues =
|
|
|
using ControllerMotionValues = std::array<ControllerMotionInfo, Settings::NativeMotion::NumMotions>;
|
|
using ControllerMotionValues = std::array<ControllerMotionInfo, Settings::NativeMotion::NumMotions>;
|
|
|
using ColorValues = std::array<Common::Input::BodyColorStatus, max_emulated_controllers>;
|
|
using ColorValues = std::array<Common::Input::BodyColorStatus, max_emulated_controllers>;
|
|
|
using BatteryValues = std::array<Common::Input::BatteryStatus, 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>;
|
|
using VibrationValues = std::array<Common::Input::VibrationStatus, max_emulated_controllers>;
|
|
|
|
|
|
|
|
struct AnalogSticks {
|
|
struct AnalogSticks {
|
|
@@ -70,6 +74,12 @@ struct BatteryLevelState {
|
|
|
NpadPowerInfo right{};
|
|
NpadPowerInfo right{};
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+struct CameraState {
|
|
|
|
|
+ Core::IrSensor::ImageTransferProcessorFormat format{};
|
|
|
|
|
+ std::vector<u8> data{};
|
|
|
|
|
+ std::size_t sample{};
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
struct ControllerMotion {
|
|
struct ControllerMotion {
|
|
|
Common::Vec3f accel{};
|
|
Common::Vec3f accel{};
|
|
|
Common::Vec3f gyro{};
|
|
Common::Vec3f gyro{};
|
|
@@ -96,6 +106,7 @@ struct ControllerStatus {
|
|
|
ColorValues color_values{};
|
|
ColorValues color_values{};
|
|
|
BatteryValues battery_values{};
|
|
BatteryValues battery_values{};
|
|
|
VibrationValues vibration_values{};
|
|
VibrationValues vibration_values{};
|
|
|
|
|
+ CameraValues camera_values{};
|
|
|
|
|
|
|
|
// Data for HID serices
|
|
// Data for HID serices
|
|
|
HomeButtonState home_button_state{};
|
|
HomeButtonState home_button_state{};
|
|
@@ -107,6 +118,7 @@ struct ControllerStatus {
|
|
|
NpadGcTriggerState gc_trigger_state{};
|
|
NpadGcTriggerState gc_trigger_state{};
|
|
|
ControllerColors colors_state{};
|
|
ControllerColors colors_state{};
|
|
|
BatteryLevelState battery_state{};
|
|
BatteryLevelState battery_state{};
|
|
|
|
|
+ CameraState camera_state{};
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
enum class ControllerTriggerType {
|
|
enum class ControllerTriggerType {
|
|
@@ -117,6 +129,7 @@ enum class ControllerTriggerType {
|
|
|
Color,
|
|
Color,
|
|
|
Battery,
|
|
Battery,
|
|
|
Vibration,
|
|
Vibration,
|
|
|
|
|
+ IrSensor,
|
|
|
Connected,
|
|
Connected,
|
|
|
Disconnected,
|
|
Disconnected,
|
|
|
Type,
|
|
Type,
|
|
@@ -269,6 +282,9 @@ public:
|
|
|
/// Returns the latest battery status from the controller with parameters
|
|
/// Returns the latest battery status from the controller with parameters
|
|
|
BatteryValues GetBatteryValues() const;
|
|
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
|
|
/// Returns the latest status of button input for the hid::HomeButton service
|
|
|
HomeButtonState GetHomeButtons() const;
|
|
HomeButtonState GetHomeButtons() const;
|
|
|
|
|
|
|
@@ -296,6 +312,9 @@ public:
|
|
|
/// Returns the latest battery status from the controller
|
|
/// Returns the latest battery status from the controller
|
|
|
BatteryLevelState GetBattery() const;
|
|
BatteryLevelState GetBattery() const;
|
|
|
|
|
|
|
|
|
|
+ /// Returns the latest camera status from the controller
|
|
|
|
|
+ const CameraState& GetCamera() const;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Sends a specific vibration to the output device
|
|
* Sends a specific vibration to the output device
|
|
|
* @return true if vibration had no errors
|
|
* @return true if vibration had no errors
|
|
@@ -315,6 +334,13 @@ public:
|
|
|
*/
|
|
*/
|
|
|
bool SetPollingMode(Common::Input::PollingMode polling_mode);
|
|
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
|
|
/// Returns the led pattern corresponding to this emulated controller
|
|
|
LedPattern GetLedPattern() const;
|
|
LedPattern GetLedPattern() const;
|
|
|
|
|
|
|
@@ -392,6 +418,12 @@ private:
|
|
|
*/
|
|
*/
|
|
|
void SetBattery(const Common::Input::CallbackStatus& callback, std::size_t index);
|
|
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
|
|
* Triggers a callback that something has changed on the controller status
|
|
|
* @param type Input type of the event to trigger
|
|
* @param type Input type of the event to trigger
|
|
@@ -417,6 +449,7 @@ private:
|
|
|
ControllerMotionParams motion_params;
|
|
ControllerMotionParams motion_params;
|
|
|
TriggerParams trigger_params;
|
|
TriggerParams trigger_params;
|
|
|
BatteryParams battery_params;
|
|
BatteryParams battery_params;
|
|
|
|
|
+ CameraParams camera_params;
|
|
|
OutputParams output_params;
|
|
OutputParams output_params;
|
|
|
|
|
|
|
|
ButtonDevices button_devices;
|
|
ButtonDevices button_devices;
|
|
@@ -424,6 +457,7 @@ private:
|
|
|
ControllerMotionDevices motion_devices;
|
|
ControllerMotionDevices motion_devices;
|
|
|
TriggerDevices trigger_devices;
|
|
TriggerDevices trigger_devices;
|
|
|
BatteryDevices battery_devices;
|
|
BatteryDevices battery_devices;
|
|
|
|
|
+ CameraDevices camera_devices;
|
|
|
OutputDevices output_devices;
|
|
OutputDevices output_devices;
|
|
|
|
|
|
|
|
// TAS related variables
|
|
// TAS related variables
|