/// <summary> /// Connects the XboxGamepad to the console. /// </summary> /// <param name="systemIpAddress">The system IP address of the console.</param> /// <returns>The id of the XboxGamepad.</returns> protected override ulong ConnectXboxGamepadImpl(string systemIpAddress) { IVirtualGamepad gamepad = this.XboxXdk.CreateXboxGamepad(systemIpAddress); this.gamepads.Add(gamepad); return(gamepad.Connect()); }
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; }