async private void OnBLEAdvertisement(BluetoothLEAdvertisementWatcher watcher, BluetoothLEAdvertisementReceivedEventArgs eventArgs)
        {
            if (eventArgs.Advertisement.LocalName.Contains("Ble Guitar"))
            {
                BluetoothLEDevice guitar = await BluetoothLEDevice.FromBluetoothAddressAsync(eventArgs.BluetoothAddress);

                iOSGuitar newGuitar = new iOSGuitar(guitar, client.CreateXbox360Controller());
                iOSGuitars.Add(newGuitar);
            }
        }
Beispiel #2
0
        private void DisplayTimer_Tick(object sender, EventArgs e)
        {
            // Create list of devices to prevent re-attaching existing dongles.
            List <string> devices = new List <string>();

            foreach (PS3Peripheral peripheral in PS3Peripherals.ToList())
            {
                // Remove any guitars that can't be found anymore
                if (!peripheral.isReadable())
                {
                    peripheral.destroy();
                    PS3Peripherals.Remove(peripheral);
                }
                else
                {
                    // Add guitars that are still found to the list of existing devices
                    devices.Add(peripheral.device.DevicePath);
                }
            }

            // Enumerate through WinUSB devices and set those up if they are valid dongles.
            foreach (UsbRegistry device in LibUsbDotNet.UsbDevice.AllDevices)
            {
                // USB\VID_12BA&PID_074B is the ID of the PS3/Wii U dongle.
                if (device.Vid == 0x12BA && device.Pid == 0x074B)
                {
                    UsbDevice trueDevice;
                    device.Open(out trueDevice);
                    if (PS3Peripherals.Count < 4 && trueDevice != null && !devices.Contains(trueDevice.DevicePath))
                    {
                        PS3Peripheral newGuitar = new PS3Guitar(trueDevice, client.CreateXbox360Controller());
                        PS3Peripherals.Add(newGuitar);
                    }
                }
                // USB\VID_12BA&PID_074B is the ID of the PS3 Turntable
                else if (device.Vid == 0x12BA && device.Pid == 0x0140)
                {
                    UsbDevice trueDevice;
                    device.Open(out trueDevice);
                    if (PS3Peripherals.Count < 4 && trueDevice != null && !devices.Contains(trueDevice.DevicePath))
                    {
                        PS3Peripheral newTurntable = new PS3Turntable(trueDevice, client.CreateXbox360Controller());
                        PS3Peripherals.Add(newTurntable);
                    }
                }
            }
            UpdatePS3Display();
        }
Beispiel #3
0
        public void DeviceArrived(IDualShockDevice device)
        {
            Log.Information("ViGEmNavMergeX360: Device with index {Index} attached", device.DeviceIndex);
            // Only create virtual 360 controller if one hasn't been created yet
            if (_target == null)
            {
                _target = _client.CreateXbox360Controller();

                _target.AutoSubmitReport = false;

                _target.FeedbackReceived += (sender, args) =>
                {
                    //TODO: Check if needed
                };

                try
                {
                    Log.Information("ViGEmNavMergeX360: Connecting ViGEm target {Target}", _target);
                    _target.Connect();
                    Log.Information("ViGEmNavMergeX360: ViGEm target {Target} connected successfully", _target);
                }
                catch (Exception ex)
                {
                    Log.Error("ViGEmNavMergeX360: Failed to connect target {@Target}: {Exception}", _target, ex);
                }
            }

            _deviceCount++;
        }
Beispiel #4
0
        public void DeviceArrived(IDualShockDevice device)
        {
            var target = _client.CreateXbox360Controller();

            target.AutoSubmitReport = false;

            _deviceMap.Add(device, target);

            if (Configuration.Rumble.IsEnabled)
            {
                target.FeedbackReceived += (sender, args) =>
                {
                    var source = _deviceMap.First(m => m.Value.Equals(sender)).Key;

                    RumbleRequestReceived?.Invoke(source, new RumbleRequestEventArgs(args.LargeMotor, args.SmallMotor));
                };
            }
            else
            {
                Log.Warning("Rumble disabled by configuration");
            }

            try
            {
                Log.Information("Connecting ViGEm target {Target}", target);
                target.Connect();
                Log.Information("ViGEm target {Target} connected successfully", target);
            }
            catch (Exception ex)
            {
                Log.Error("Failed to connect target {@Target}: {Exception}", target, ex);
            }
        }
Beispiel #5
0
        /// <summary>
        /// Implements <see cref="IXOutputInterface.Plugin(int)"/>
        /// </summary>
        /// <param name="controllerCount">number of controller</param>
        /// <returns>If it was successful</returns>
        public bool Plugin(int controllerCount)
        {
            var controller = client.CreateXbox360Controller();

            controller.Connect();
            controllers.Add(controllerCount, controller);
            return(true);
        }
Beispiel #6
0
        internal static XboxControllerAdapter Create()
        {
            var client     = new ViGEmClient();
            var controller = client.CreateXbox360Controller();

            controller.Connect();
            TryWaitUntilConnected(controller);
            controller.AutoSubmitReport = false;

            return(new XboxControllerAdapter(client, controller));
        }
Beispiel #7
0
        public BaseHIDController(HidDevice device, HidStream stream, ViGEmClient client, int index)
        {
            _device = device;
            _stream = stream;
            _client = client;
            _index  = index;
            running = true;

            target360 = _client.CreateXbox360Controller();
            targetDS4 = _client.CreateDualShock4Controller();
            target360.AutoSubmitReport = false;
            targetDS4.AutoSubmitReport = false;
        }
Beispiel #8
0
        public JoyHandler()
        {
            //Create a new ViGem Client
            var client = new ViGEmClient();

            //create the controller
            _controller = client.CreateXbox360Controller();

            //connect the controller?
            _controller.Connect();

            Thread.Sleep(500);
            _controller.SetButtonState(Xbox360Button.X, false);
        }
 public XboxController()
 {
     try
     {
         client = new ViGEmClient();
         Global.PushMessage(LogLevel.INFO, "Create ViGEmClient...");
         controller = client.CreateXbox360Controller();
         Global.PushMessage(LogLevel.INFO, "Create vitrual Xbox360 Controller...");
         controller.Connect();
         Global.PushMessage(LogLevel.INFO, "Connect vitrual Xbox360 Controller...");
     }
     catch (Exception e)
     {
         MessageBox.Show(Global.MainForm, String.Format("You must install ViGemBus to use this tool:\nCution! This is a driver-level simulation, which may cause unexpected factors. When you install, please pay attention to the safety and stability of your computer.\n\n{0}\n\nOr this tool cannot create a vitrual xbox controller by ViGemBus.\nPlease try again or report this problems:\n\n{1}\n\nThis program will be close...\n\n{2}", "https://github.com/ViGEm/ViGEmBus", "https://github.com/HaoJun0823/CODEVEIN-Piano-Helper", e.Message), "Error! Unable to initialize device!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         System.Environment.Exit(0);
     }
 }
Beispiel #10
0
        public MiGamepad(string device, ViGEmClient client)
        {
            _Logger.Information("Initializing MiGamepad handler for device {Device}", device);

            _Device = HidDevices.GetDevice(device);
            _Device.MonitorDeviceEvents = false;

            _Target = client.CreateXbox360Controller();
            _Target.AutoSubmitReport  = false;
            _Target.FeedbackReceived += Target_OnFeedbackReceived;

            // TODO mark the threads as background?
            _InputThread = new Thread(DeviceWorker);

            _CTS            = new CancellationTokenSource();
            _VibrationTimer = new Timer(VibrationTimer_Trigger);

            LedNumber = 0xFF;
        }
Beispiel #11
0
        public StadiaController(HidDevice device, HidStream stream, ViGEmClient client, int index)
        {
            _device = device;
            _stream = stream;
            _client = client;
            _index  = index;
            running = true;

            target360 = _client.CreateXbox360Controller();
            targetDS4 = _client.CreateDualShock4Controller();
            target360.AutoSubmitReport  = false;
            targetDS4.AutoSubmitReport  = false;
            target360.FeedbackReceived += this.Target360_FeedbackReceived;
            targetDS4.FeedbackReceived += this.TargetDS4_FeedbackReceived;

            inputThread          = new Thread(() => input_thread());
            inputThread.Priority = ThreadPriority.AboveNormal;
            inputThread.Name     = "Controller #" + index + " Input";
            inputThread.Start();
        }
Beispiel #12
0
        void OnStartEmulation(object arg)
        {
            var client = new ViGEmClient();

            var controller = client.CreateXbox360Controller();

            controller.AutoSubmitReport = false;
            controller.Connect();

            emulationCancellation = new CancellationTokenSource();
            var token = emulationCancellation.Token;

            Task.Run(async() => {
                var prevState = new GamepadState();

                try {
                    var gamepad = (GamepadDevice)DeviceManager.GetDevice(Path, Id);
                    while (!token.IsCancellationRequested)
                    {
                        var state = await gamepad.GetStateAsync(token);
                        if (token.IsCancellationRequested || prevState == state && state.IsDefault)
                        {
                            continue;
                        }

                        controller.ResetReport();
                        SetReport(controller, state);
                        controller.SubmitReport();
                        prevState = state;
                    }
                } finally {
                    client.Dispose();
                    IsEmulated = false;
                }
            }, token);

            IsEmulated = true;
        }
Beispiel #13
0
        public DualSense_Base(IDevice _device)
        {
            device = _device;
            if (!device.IsInitialized)
            {
                device.InitializeAsync().Wait();
            }
            if (!device.ConnectedDeviceDefinition.WriteBufferSize.HasValue)
            {
                throw new AccessViolationException("Write Buffer Size is null");
            }
            if (!device.ConnectedDeviceDefinition.ReadBufferSize.HasValue)
            {
                throw new AccessViolationException("Read Buffer Size is null");
            }
            WriteBufferSize = device.ConnectedDeviceDefinition.WriteBufferSize.Value;
            ReadBufferSize  = device.ConnectedDeviceDefinition.ReadBufferSize.Value;
            ++_VirtualXboxId;

            controller = client.CreateXbox360Controller();
            controller.Connect();
            controller.FeedbackReceived += Controller_FeedbackReceived;
            new Thread(() =>
            {
                try
                {
                    while (true)
                    {
                        RefreshButtonStatus();
                        Thread.Sleep(RefreshInterval);
                    }
                }catch (Exception e)
                {
                    Console.WriteLine($"An error occurs.\n{e.ToString()}\n{e.StackTrace}\n");
                }
            }).Start();
        }
Beispiel #14
0
        public static void Main(string[] args)
        {
            Console.Title = "GHL HID Emulator";
            UsbDevice guitar = null;
            bool      isPS4  = false;

            foreach (WinUsbRegistry device in LibUsbDotNet.UsbDevice.AllWinUsbDevices)
            {
                // USB\VID_12BA&PID_074B
                if ((device.Vid == 0x12BA && device.Pid == 0x074B) || (device.Vid == 0x1430 && device.Pid == 0x07BB))
                {
                    guitar = device.Device;
                    isPS4  = (device.Pid == 0x07BB);
                }
            }
            if (guitar == null)
            {
                Console.WriteLine("Could not find any Guitar Hero Live guitars.");
                Console.WriteLine("Make sure you are using a PS3/Wii U/PS4 Guitar Hero Live dongle with the WinUSB driver installed.");
                Console.WriteLine("Press any key to exit...");
                Console.ReadKey(true);
                return;
            }

            // Set up Virtual Xbox 360 controller
            ViGEmClient client;

            try
            {
                client = new ViGEmClient();
            } catch (Exception)
            {
                Console.WriteLine("Failed to initialise ViGEm Client. Make sure you have the ViGEm bus driver installed.");
                Console.WriteLine("Press any key to exit...");
                Console.ReadKey(true);
                return;
            }

            IXbox360Controller controller = client.CreateXbox360Controller();

            controller.Connect();
            Console.WriteLine($"Found a Guitar Hero Live guitar!");

            var reader = guitar.OpenEndpointReader(ReadEndpointID.Ep01);

            byte[] readBuffer = new byte[100];
            int    runner     = 0;

            while (true)
            {
                if (runner == 0)
                {
                    // Send control packet (to enable strumming)
                    byte[] buffer;
                    if (isPS4)
                    {
                        buffer = new byte[9] {
                            0x30, 0x02, 0x08, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00
                        }
                    }
                    ;
                    else
                    {
                        buffer = new byte[9] {
                            0x02, 0x08, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                        }
                    };
                    int            bytesWrote;
                    UsbSetupPacket setupPacket = new UsbSetupPacket(0x21, 0x09, 0x0201, 0x0000, 0x0008);
                    guitar.ControlTransfer(ref setupPacket, buffer, 0x0008, out bytesWrote);
                }
                runner++;
                if (runner > 500)
                {
                    runner = 0;
                }

                int bytesRead;
                reader.Read(readBuffer, 100, out bytesRead);
                Console.SetCursorPosition(0, 1);
                Console.WriteLine("Frets:    " + BitConverter.ToString(new byte[] { readBuffer[0] }));
                Console.WriteLine("Buttons:  " + BitConverter.ToString(new byte[] { readBuffer[1] }));
                Console.WriteLine("Tilt:     " + BitConverter.ToString(new byte[] { readBuffer[19] }));
                Console.WriteLine("Whammy:   " + BitConverter.ToString(new byte[] { readBuffer[6] }));
                Console.WriteLine("Strum:    " + (readBuffer[4] == 0x00 || readBuffer[4] == 0xFF) + " ");
                Console.WriteLine("Raw Data: " + BitConverter.ToString(readBuffer));

                byte frets = readBuffer[0];
                controller.SetButtonState(Xbox360Button.A, (frets & 0x02) != 0x00);             // B1
                controller.SetButtonState(Xbox360Button.B, (frets & 0x04) != 0x00);             // B2
                controller.SetButtonState(Xbox360Button.Y, (frets & 0x08) != 0x00);             // B3
                controller.SetButtonState(Xbox360Button.X, (frets & 0x01) != 0x00);             // W1
                controller.SetButtonState(Xbox360Button.LeftShoulder, (frets & 0x10) != 0x00);  // W2
                controller.SetButtonState(Xbox360Button.RightShoulder, (frets & 0x20) != 0x00); // W3

                byte strum = readBuffer[4];
                if (strum == 0xFF)
                {
                    // Strum Down
                    controller.SetButtonState(Xbox360Button.Down, true);
                    controller.SetButtonState(Xbox360Button.Up, false);
                }
                else if (strum == 0x00)
                {
                    // Strum Up
                    controller.SetButtonState(Xbox360Button.Down, false);
                    controller.SetButtonState(Xbox360Button.Up, true);
                }
                else
                {
                    // No Strum
                    controller.SetButtonState(Xbox360Button.Down, false);
                    controller.SetButtonState(Xbox360Button.Up, false);
                }

                byte buttons = readBuffer[1];
                controller.SetButtonState(Xbox360Button.Start, (buttons & 0x02) != 0x00); // Pause
                controller.SetButtonState(Xbox360Button.Back, (buttons & 0x01) != 0x00);  // Hero Power

                // ViGEm isn't co-operating here - setting to some weird value causes an issue.
                //controller.SetAxisValue(Xbox360Axis.RightThumbY, (short)(~readBuffer[6]-128));
                //controller.SetAxisValue(Xbox360Axis.RightThumbX, readBuffer[19]);

                Console.WriteLine("Emulating as Xbox 360 Controller " + (controller.UserIndex + 1));
            }
        }
    }
        public async Task Start(IPAddress iPAddress)
        {
            _controller = MainWindow.Instance.Settings.TargetType == TargetType.Xbox360 ? (IVirtualGamepad)_viGEmClient.CreateXbox360Controller() : _viGEmClient.CreateDualShock4Controller();
            _controller.AutoSubmitReport = false;
            _controller.Connect();

            _dummy = new Dummy(iPAddress)
            {
                Running = true
            };

            _connectToken = new CancellationTokenSource();

            Dummy.ConnectedHandler handler = (d) => _connectToken.Cancel();
            _dummy.Connected    += handler;
            _dummy.StateChanged += OnStateChanged;

            _ = Task.Run(() => _dummy.HandleLoop());

            await Task.Delay(-1, _connectToken.Token).ContinueWith((t) => { });

            _dummy.Connected -= handler;
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            try
            {
                client     = new ViGEmClient();
                controller = client.CreateXbox360Controller();
                controller.Connect();
                Console.WriteLine("Virtual Xbox360 gamepad connected.");
            }
            catch (Exception e)
            {
                Console.WriteLine("Could not connect to ViGEmClient\n");
                Console.WriteLine(e);
                Console.WriteLine("\nNote that you need to install ViGemBus for this app to work\n");
                Console.Read();
                return;
            }

            int i = 0;

            while (true)
            {
                // We'll cycle through 8 different stick states
                i++;
                i %= 80;
                int state = i / 10;

                short amount = Int16.MaxValue / 2;

                if (i == 0)
                {
                    controller.SetButtonState(Xbox360Button.A, true);
                }
                else
                {
                    controller.SetButtonState(Xbox360Button.A, false);
                }

                if (state == 0)
                {
                    controller.SetAxisValue(Xbox360Axis.LeftThumbX, amount);
                }
                else if (state == 1)
                {
                    controller.SetAxisValue(Xbox360Axis.LeftThumbX, (short)(-amount));
                }
                else
                {
                    controller.SetAxisValue(Xbox360Axis.LeftThumbX, 0);
                }

                if (state == 2)
                {
                    controller.SetAxisValue(Xbox360Axis.LeftThumbY, amount);
                }
                else if (state == 3)
                {
                    controller.SetAxisValue(Xbox360Axis.LeftThumbY, (short)(-amount));
                }
                else
                {
                    controller.SetAxisValue(Xbox360Axis.LeftThumbY, 0);
                }

                if (state == 4)
                {
                    controller.SetAxisValue(Xbox360Axis.RightThumbX, amount);
                }
                else if (state == 5)
                {
                    controller.SetAxisValue(Xbox360Axis.RightThumbX, (short)(-amount));
                }
                else
                {
                    controller.SetAxisValue(Xbox360Axis.RightThumbX, 0);
                }

                if (state == 6)
                {
                    controller.SetAxisValue(Xbox360Axis.RightThumbY, amount);
                }
                else if (state == 7)
                {
                    controller.SetAxisValue(Xbox360Axis.RightThumbY, (short)(-amount));
                }
                else
                {
                    controller.SetAxisValue(Xbox360Axis.RightThumbY, 0);
                }


                System.Threading.Thread.Sleep(50);
            }
        }
Beispiel #17
0
        public XboxDevice CreateDevice()
        {
            var controller = client.CreateXbox360Controller();

            return(new ViGEmXboxDevice(controller));
        }
        static void Main(string[] args)
        {
            ViGEmClient        client     = new ViGEmClient();
            IXbox360Controller controller = client.CreateXbox360Controller();

            controller.AutoSubmitReport = false;
            controller.Connect();

            using (Host server = new Host()) {
                server.InitializeServer(6789, 2);

                Event netEvent;

                while (true)
                {
                    bool polled = false;

                    while (!polled)
                    {
                        if (server.CheckEvents(out netEvent) == false)
                        {
                            if (server.Service(15, out netEvent) == false)
                            {
                                break;
                            }

                            polled = true;
                        }

                        switch (netEvent.Type)
                        {
                        case EventType.None:
                            break;

                        case EventType.Connect:
                            Console.WriteLine("Client connected - ID: " + netEvent.ChannelID + ", IP: " + netEvent.Peer.Host);
                            break;

                        case EventType.Disconnect:
                            Console.WriteLine("Client disconnected - ID: " + netEvent.ChannelID + ", IP: " + netEvent.Peer.Host);
                            break;


                        case EventType.Receive:
                            Console.WriteLine("Packet received from - ID: " + netEvent.ChannelID + ", IP: " + netEvent.Peer.Host + ", Channel ID: " + netEvent.ChannelID + ", Data length: " + netEvent.Packet.Length);
                            int t;
                            Console.WriteLine(System.Text.Encoding.Default.GetString(netEvent.Packet.GetBytes()));
                            if (Int32.TryParse(System.Text.Encoding.Default.GetString(netEvent.Packet.GetBytes()), out t))
                            {
                                bool press = t < 20;

                                if (!keyboard_mode)
                                {
                                    if (t % 20 < 14)
                                    {
                                        controller.SetButtonState(t % 20, press);
                                    }
                                    else if (t % 20 == 14)
                                    {
                                        controller.SetSliderValue(Xbox360Slider.LeftTrigger, press ? (byte)0xFF : (byte)0x00);
                                    }
                                    else if (t % 20 == 15)
                                    {
                                        controller.SetSliderValue(Xbox360Slider.RightTrigger, press ? (byte)0xFF : (byte)0x00);
                                    }

                                    controller.SubmitReport();
                                }
                                else
                                {
                                    switch (t % 20)
                                    {
                                    case 0:
                                        if (press)
                                        {
                                            WindowsInput.Simulate.Events().Hold(WindowsInput.Events.KeyCode.D4).Invoke();
                                        }
                                        else
                                        {
                                            WindowsInput.Simulate.Events().Release(WindowsInput.Events.KeyCode.D4).Invoke();
                                        }
                                        break;

                                    case 1:
                                        if (press)
                                        {
                                            WindowsInput.Simulate.Events().Hold(WindowsInput.Events.KeyCode.D5).Invoke();
                                        }
                                        else
                                        {
                                            WindowsInput.Simulate.Events().Release(WindowsInput.Events.KeyCode.D5).Invoke();
                                        }
                                        break;

                                    case 2:
                                        if (press)
                                        {
                                            WindowsInput.Simulate.Events().Hold(WindowsInput.Events.KeyCode.D6).Invoke();
                                        }
                                        else
                                        {
                                            WindowsInput.Simulate.Events().Release(WindowsInput.Events.KeyCode.D6).Invoke();
                                        }
                                        break;

                                    case 3:
                                        if (press)
                                        {
                                            WindowsInput.Simulate.Events().Hold(WindowsInput.Events.KeyCode.D7).Invoke();
                                        }
                                        else
                                        {
                                            WindowsInput.Simulate.Events().Release(WindowsInput.Events.KeyCode.D7).Invoke();
                                        }
                                        break;

                                    case 4:
                                        if (press)
                                        {
                                            WindowsInput.Simulate.Events().Hold(WindowsInput.Events.KeyCode.R).Invoke();
                                        }
                                        else
                                        {
                                            WindowsInput.Simulate.Events().Release(WindowsInput.Events.KeyCode.R).Invoke();
                                        }
                                        break;

                                    case 5:
                                        if (press)
                                        {
                                            WindowsInput.Simulate.Events().Hold(WindowsInput.Events.KeyCode.T).Invoke();
                                        }
                                        else
                                        {
                                            WindowsInput.Simulate.Events().Release(WindowsInput.Events.KeyCode.T).Invoke();
                                        }
                                        break;

                                    case 6:
                                        if (press)
                                        {
                                            WindowsInput.Simulate.Events().Hold(WindowsInput.Events.KeyCode.Y).Invoke();
                                        }
                                        else
                                        {
                                            WindowsInput.Simulate.Events().Release(WindowsInput.Events.KeyCode.Y).Invoke();
                                        }
                                        break;

                                    case 7:
                                        if (press)
                                        {
                                            WindowsInput.Simulate.Events().Hold(WindowsInput.Events.KeyCode.U).Invoke();
                                        }
                                        else
                                        {
                                            WindowsInput.Simulate.Events().Release(WindowsInput.Events.KeyCode.U).Invoke();
                                        }
                                        break;

                                    case 8:
                                        if (press)
                                        {
                                            WindowsInput.Simulate.Events().Hold(WindowsInput.Events.KeyCode.F).Invoke();
                                        }
                                        else
                                        {
                                            WindowsInput.Simulate.Events().Release(WindowsInput.Events.KeyCode.F).Invoke();
                                        }
                                        break;

                                    case 9:
                                        if (press)
                                        {
                                            WindowsInput.Simulate.Events().Hold(WindowsInput.Events.KeyCode.G).Invoke();
                                        }
                                        else
                                        {
                                            WindowsInput.Simulate.Events().Release(WindowsInput.Events.KeyCode.G).Invoke();
                                        }
                                        break;

                                    case 10:
                                        if (press)
                                        {
                                            WindowsInput.Simulate.Events().Hold(WindowsInput.Events.KeyCode.H).Invoke();
                                        }
                                        else
                                        {
                                            WindowsInput.Simulate.Events().Release(WindowsInput.Events.KeyCode.H).Invoke();
                                        }
                                        break;

                                    case 11:
                                        if (press)
                                        {
                                            WindowsInput.Simulate.Events().Hold(WindowsInput.Events.KeyCode.J).Invoke();
                                        }
                                        else
                                        {
                                            WindowsInput.Simulate.Events().Release(WindowsInput.Events.KeyCode.J).Invoke();
                                        }
                                        break;

                                    case 12:
                                        if (press)
                                        {
                                            WindowsInput.Simulate.Events().Hold(WindowsInput.Events.KeyCode.V).Invoke();
                                        }
                                        else
                                        {
                                            WindowsInput.Simulate.Events().Release(WindowsInput.Events.KeyCode.V).Invoke();
                                        }
                                        break;

                                    case 13:
                                        if (press)
                                        {
                                            WindowsInput.Simulate.Events().Hold(WindowsInput.Events.KeyCode.B).Invoke();
                                        }
                                        else
                                        {
                                            WindowsInput.Simulate.Events().Release(WindowsInput.Events.KeyCode.B).Invoke();
                                        }
                                        break;

                                    case 14:
                                        if (press)
                                        {
                                            WindowsInput.Simulate.Events().Hold(WindowsInput.Events.KeyCode.N).Invoke();
                                        }
                                        else
                                        {
                                            WindowsInput.Simulate.Events().Release(WindowsInput.Events.KeyCode.N).Invoke();
                                        }
                                        break;

                                    case 15:
                                        if (press)
                                        {
                                            WindowsInput.Simulate.Events().Hold(WindowsInput.Events.KeyCode.M).Invoke();
                                        }
                                        else
                                        {
                                            WindowsInput.Simulate.Events().Release(WindowsInput.Events.KeyCode.M).Invoke();
                                        }
                                        break;
                                    }
                                }
                            }
                            netEvent.Packet.Dispose();
                            break;
                        }
                    }
                }

                server.Flush();
            }

            controller.Disconnect();
        }
Beispiel #19
0
 public Xbox360OutDevice(ViGEmClient client)
 {
     cont = client.CreateXbox360Controller();
     cont.AutoSubmitReport = false;
 }