Repository: skyline-emu/skyline
File: app/src/main/cpp/skyline/input/npad_device.h (C/C++)

Code before:

    class NpadManager;

    /**
     * @brief An easy to use interface for a NPad which abstracts away the complicated details
     */
    class NpadDevice {
      private:
        NpadManager &manager; //!< The manager responsible for managing this NpadDevice
        NpadSection &section; //!< The section in HID shared memory for this controller
        NpadControllerInfo *controllerInfo{}; //!< The NpadControllerInfo for this controller's type
        u64 globalTimestamp{}; //!< An incrementing timestamp that's common across all sections
        NpadControllerState controllerState{}, defaultState{}; //!< The current state of the controller (normal and default)

        /**
         * @brief Updates the headers and writes a new entry in HID Shared Memory
         * @param info The controller info of the NPad that needs to be updated
         * @param entry An entry with the state of the controller
         */
        void WriteNextEntry(NpadControllerInfo &info, NpadControllerState entry);

        /**
         * @brief Writes on all ring lifo buffers a new empty entry in HID Shared Memory
         */
        void WriteEmptyEntries();

        /**
         * @brief Reverts all device properties to the default state
         */
        void ResetDeviceProperties();

        /**
         * @return The NpadControllerInfo for this controller based on its type
         */
        NpadControllerInfo &GetControllerInfo();

      public:
        NpadId id;
        static constexpr i8 NullIndex{-1}; //!< The placeholder index value when there is no device present
        i8 index{NullIndex}; //!< The index of the device assigned to this player
        i8 partnerIndex{NullIndex}; //!< The index of a partner device, if present
        NpadVibrationValue vibrationLeft{}; //!< Vibration for the left Joy-Con (Handheld/Pair), left LRA in a Pro-Controller or individual Joy-Cons
        std::optional<NpadVibrationValue> vibrationRight; //!< Vibration for the right Joy-Con (Handheld/Pair) or right LRA in a Pro-Controller
        NpadControllerType type{};
        NpadConnectionState connectionState{};
        std::shared_ptr<kernel::type::KEvent> updateEvent; //!< This event is triggered on the controller's style changing
        GyroscopeZeroDriftMode gyroZeroDriftMode;

        NpadDevice(NpadManager &manager, NpadSection &section, NpadId id);

        void SetAssignment(NpadJoyAssignment assignment) {

Review comment (suggestion):
```suggestion
        NpadSixAxisInfo *sixAxisInfoRight{}; //!< The NpadSixAxisInfo for the right side of this controller's type
```

Code after:
    /**
     * @brief The parameters to produce a vibration using an LRA
     * @note The vibration is broken into a frequency band with the lower and high range supplied
     * @note Amplitude is in arbitrary units from 0f to 1f
     * @note Frequency is in Hertz
     */
    struct NpadVibrationValue {
        float amplitudeLow;
        float frequencyLow;
        float amplitudeHigh;
        float frequencyHigh;

        constexpr bool operator==(const NpadVibrationValue &) const = default;
    };
    static_assert(sizeof(NpadVibrationValue) == 0x10);

    /**
     * @url https://switchbrew.org/wiki/HID_services#GyroscopeZeroDriftMode
     */
    enum class GyroscopeZeroDriftMode : u32 {
        Loose = 0,
        Standard = 1,
        Tight = 2,
    };

    class NpadManager;

    /**
     * @brief An easy to use interface for a NPad which abstracts away the complicated details
     */
    class NpadDevice {
      private:
        NpadManager &manager; //!< The manager responsible for managing this NpadDevice
        NpadSection &section; //!< The section in HID shared memory for this controller
        NpadControllerInfo *controllerInfo{}; //!< The NpadControllerInfo for this controller's type
        NpadSixAxisInfo *sixAxisInfoLeft{}; //!< The NpadSixAxisInfo for the main or left side of this controller's type
        NpadSixAxisInfo *sixAxisInfoRight{}; //!< The NpadSixAxisInfo for the right side of this controller's type
        u64 globalTimestamp{}; //!< An incrementing timestamp that's common across all sections
        NpadControllerState controllerState{}, defaultState{}; //!< The current state of the controller (normal and default)
        NpadSixAxisState sixAxisStateLeft{}, sixAxisStateRight{}; //!< The current state of the sixaxis (left and right)

        /**
         * @brief Updates the headers and writes a new entry in HID Shared Memory
         * @param info The controller info of the NPad that needs to be updated
         * @param entry An entry with the state of the controller
         */
        void WriteNextEntry(NpadControllerInfo &info, NpadControllerState entry);

        /**
         * @brief Updates the headers and writes a new entry in HID Shared Memory
         * @param info The sixaxis controller info of the NPad that needs to be updated