public void AddController(IMappableDevice controller, int port) { if (port >= _maxControllers) { return; } IRetroPad retroPad = controller as IRetroPad; if (retroPad != null) { _retroPads[port] = retroPad; } IRetroAnalog retroAnalog = controller as IRetroAnalog; if (retroAnalog != null) { _retroAnalogs[port] = retroAnalog; } IRetroRumble retroRumble = controller as IRetroRumble; if (retroRumble != null) { _retroRumbles[port] = retroRumble; } IHidDevice hidDevice = controller as IHidDevice; if (hidDevice != null) { _hidDevices.Add(hidDevice); } }
protected RetroPadMapping CreateNewMapping(IMappableDevice device) { return(new RetroPadMapping() { DeviceId = device.DeviceId, SubDeviceId = device.SubDeviceId, DeviceName = device.DeviceName }); }
public RetroPadMapping GetDeviceMapping(IMappableDevice device) { RetroPadMapping mapping = _settings.Mappings.FirstOrDefault(m => m.DeviceId == device.DeviceId && m.SubDeviceId == device.SubDeviceId); if (mapping == null) { mapping = device.DefaultMapping != null ? device.DefaultMapping : CreateNewMapping(device); } return(mapping); }
public void PortItemSelected(PortMappingItem item) { _currentPortMapping = item.PortMapping; _currentDevice = _deviceProxy.GetDevice(_currentPortMapping.DeviceId, _currentPortMapping.SubDeviceId); CurrentDeviceName = _currentDevice != null ? _currentDevice.DeviceName : null; CurrentPlayerHeader = item.Label(Consts.KEY_NAME, "").Evaluate(); var wm = ServiceRegistration.Get <IWorkflowManager>(); wm.NavigatePushAsync(STATE_DEVICE_CONFIGURE, new NavigationContextConfig() { NavigationContextDisplayLabel = CurrentPlayerHeader }); }
public IMappableDevice GetDevice(Guid deviceId, string subDeviceId, List <IMappableDevice> devices) { if (deviceId == Guid.Empty) { return(null); } IMappableDevice device = devices.FirstOrDefault(d => d.DeviceId == deviceId && d.SubDeviceId == subDeviceId); if (device == null && deviceId == HidGameControl.DEVICE_ID) { device = GetDisconnectedHidDevice(subDeviceId); } return(device); }
protected void Reset() { EndMapping(); ResetMapper(); CurrentPlayerHeader = null; CurrentDeviceName = null; _currentDevice = null; _currentPortMapping = null; _portsList.Clear(); _portsList.FireChange(); _deviceList.Clear(); _deviceList.FireChange(); _inputList.Clear(); _inputList.FireChange(); }
protected void InitializeControllerWrapper() { _controllerWrapper = new ControllerWrapper(_settings.MaxPlayers); DeviceProxy deviceProxy = new DeviceProxy(); List <IMappableDevice> deviceList = deviceProxy.GetDevices(false); MappingProxy mappingProxy = new MappingProxy(); foreach (PortMapping port in mappingProxy.PortMappings) { IMappableDevice device = deviceProxy.GetDevice(port.DeviceId, port.SubDeviceId, deviceList); if (device != null) { RetroPadMapping mapping = mappingProxy.GetDeviceMapping(device); device.Map(mapping); _controllerWrapper.AddController(device, port.Port); Logger.Debug("LibRetroFrontend: Mapped controller {0} to port {1}", device.DeviceName, port.Port); } } }
public void DeviceItemSelected(MappableDeviceItem item) { _currentDevice = item.Device; CurrentDeviceName = _currentDevice != null ? _currentDevice.DeviceName : null; UpdateMappings(); }
public void SetDevice(IMappableDevice device) { DeviceId = device.DeviceId; SubDeviceId = device.SubDeviceId; DeviceName = device.DeviceName; }
public MappableDeviceItem(string name, IMappableDevice device) : base(Consts.KEY_NAME, name) { _device = device; }