public MainWindowViewModel()
        {
            var vGenWrapper = new VGenWrapper();
            HidManager = new HidManager();
            _gamepadManager = new GamepadManager(vGenWrapper, HidManager);
            _gamepadManager.ErrorOccuredEvent += (_, message) => { Log(message); };

            IsRunning.AsObservable().Where(b => !b).Subscribe(_ => _runningGamepadsDisposable?.Dispose());
        }
예제 #2
0
        public Gamepad(GamepadConfiguration config, VGenWrapper vGenWrapper, HidDeviceLoader hidDeviceLoader)
        {
            _config = config;
            _vGenWrapper = vGenWrapper;
            _hidDeviceLoader = hidDeviceLoader;
            _virtualMappings = new Dictionary<XInputGamepadButtons, XInputGamepadButtons>();

            foreach (var virtualMapping in _config.Mapping.VirtualKeysItems.Where(item => item.DestinationItem != null))
            {
                var virtualPattern = virtualMapping.SourceKeys
                    .Where(sourceKey => sourceKey != null)
                    .Aggregate((XInputGamepadButtons)0, (current, sourceKey) => current | sourceKey.Value);

                // ReSharper disable once PossibleInvalidOperationException
                _virtualMappings[virtualPattern] = (XInputGamepadButtons) virtualMapping.DestinationItem;
            }
        }
예제 #3
0
 public GamepadManager(VGenWrapper vGenWrapper, HidManager hidManager)
 {
     _vGenWrapper = vGenWrapper;
     _hidManager = hidManager;
 }