Пример #1
0
        /// <summary>
        ///     Submits an <see cref="Xbox360Report"/> to this device which will update its state.
        /// </summary>
        /// <param name="report">The <see cref="Xbox360Report"/> to submit.</param>
        public void SendReport(Xbox360Report report)
        {
            // Convert managed to unmanaged structure
            var submit = new ViGEmClient.XUSB_REPORT
            {
                wButtons      = report.Buttons,
                bLeftTrigger  = report.LeftTrigger,
                bRightTrigger = report.RightTrigger,
                sThumbLX      = report.LeftThumbX,
                sThumbLY      = report.LeftThumbY,
                sThumbRX      = report.RightThumbX,
                sThumbRY      = report.RightThumbY
            };

            var error = ViGEmClient.vigem_target_x360_update(Client.NativeHandle, NativeHandle, submit);

            switch (error)
            {
            case ViGEmClient.VIGEM_ERROR.VIGEM_ERROR_BUS_NOT_FOUND:
                throw new VigemBusNotFoundException();

            case ViGEmClient.VIGEM_ERROR.VIGEM_ERROR_INVALID_TARGET:
                throw new VigemInvalidTargetException();
            }
        }
Пример #2
0
 public void ResetReport()
 {
     _nativeReport = default(ViGEmClient.XUSB_REPORT);
 }