Esempio n. 1
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);
            }
        }
Esempio n. 2
0
        public void DeviceArrived(IDualShockDevice device)
        {
            Log.Information("Device {Device} got attached", device);

            var target = new DualShock4Controller(_client);

            _deviceMap.Add(device, target);

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

                RumbleRequestReceived?.Invoke(source, new RumbleRequestEventArgs(args.LargeMotor, args.SmallMotor));
            };

            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);
            }
        }