Ejemplo n.º 1
0
        public SdlInput(string controllerMappingFilepath)
        {
            ControllerMappingFilepath = controllerMappingFilepath;

            Timestamp = 0;
            Buttons   = new InputButtons();
            Analog    = new InputAnalogue();
            Extension = new InputExtension();

            // Set "controller byte"
            Extension.Unknown1 = 1;
        }
Ejemplo n.º 2
0
        public DxInput(string controllerMappingFilepath)
        {
            ControllerMappingFilepath = controllerMappingFilepath;

            Timestamp = 0;
            Buttons   = new InputButtons();
            Analog    = new InputAnalogue();
            Extension = new InputExtension();

            // Set "controller byte"
            Extension.Unknown1 = 1;

            // Initialize DirectInput
            _directInput = new DirectInput();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Send controller input frame
        /// </summary>
        /// <param name="createdTime">Creation timestamp of input data.</param>
        /// <param name="buttons">Input button data.</param>
        /// <param name="analogue">Input analog axis data.</param>
        /// <param name="extension">Input extension data.</param>
        /// <returns></returns>
        public async Task SendInputFrame(DateTime createdTime, InputButtons buttons,
                                         InputAnalogue analogue, InputExtension extension)
        {
            // Convert DateTime to relative timestamp
            // e.g. microSeconds since reference timestamp
            ulong      createdTimestampMicroS = DateTimeHelper.ToTimestampMicroseconds(createdTime, ReferenceTimestamp);
            InputFrame frame = new InputFrame(NextFrameId, Timestamp, createdTimestampMicroS,
                                              buttons, analogue, extension);

            /*
             * await WaitForMessageAsync<InputFrameAck>(
             *  TimeSpan.FromMilliseconds(10),
             *  async () => await SendAsync(frame)
             * );
             */
            await SendAsync(frame);
        }