コード例 #1
0
        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
ファイル: Gamepad.cs プロジェクト: Axadiw/MFIGamepadFeeder
        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;
 }