private void UpdateInputDeviceList() { _inputDevice.RemoveAll(); _inputDevice.Append("disabled", "Disabled"); _inputDevice.SetActiveId("disabled"); _inputDevice.Append($"keyboard/{KeyboardConfig.AllKeyboardsIndex}", "All keyboards"); for (int i = 0; i < 20; i++) { if (KeyboardController.GetKeyboardState(i + 1).IsConnected) { _inputDevice.Append($"keyboard/{i + 1}", $"Keyboard/{i + 1}"); } if (GamePad.GetState(i).IsConnected) { _inputDevice.Append($"controller/{i}", $"Controller/{i} ({GamePad.GetName(i)})"); } } switch (_inputConfig) { case KeyboardConfig keyboard: _inputDevice.SetActiveId($"keyboard/{keyboard.Index}"); break; case ControllerConfig controller: _inputDevice.SetActiveId($"controller/{controller.Index}"); break; } }
private void SetValues(InputConfig config) { switch (config) { case KeyboardConfig keyboardConfig: _controllerType.SetActiveId(keyboardConfig.ControllerType.ToString()); _lStickUp.Label = keyboardConfig.LeftJoycon.StickUp.ToString(); _lStickDown.Label = keyboardConfig.LeftJoycon.StickDown.ToString(); _lStickLeft.Label = keyboardConfig.LeftJoycon.StickLeft.ToString(); _lStickRight.Label = keyboardConfig.LeftJoycon.StickRight.ToString(); _lStickButton.Label = keyboardConfig.LeftJoycon.StickButton.ToString(); _dpadUp.Label = keyboardConfig.LeftJoycon.DPadUp.ToString(); _dpadDown.Label = keyboardConfig.LeftJoycon.DPadDown.ToString(); _dpadLeft.Label = keyboardConfig.LeftJoycon.DPadLeft.ToString(); _dpadRight.Label = keyboardConfig.LeftJoycon.DPadRight.ToString(); _minus.Label = keyboardConfig.LeftJoycon.ButtonMinus.ToString(); _l.Label = keyboardConfig.LeftJoycon.ButtonL.ToString(); _zL.Label = keyboardConfig.LeftJoycon.ButtonZl.ToString(); _lSl.Label = keyboardConfig.LeftJoycon.ButtonSl.ToString(); _lSr.Label = keyboardConfig.LeftJoycon.ButtonSr.ToString(); _rStickUp.Label = keyboardConfig.RightJoycon.StickUp.ToString(); _rStickDown.Label = keyboardConfig.RightJoycon.StickDown.ToString(); _rStickLeft.Label = keyboardConfig.RightJoycon.StickLeft.ToString(); _rStickRight.Label = keyboardConfig.RightJoycon.StickRight.ToString(); _rStickButton.Label = keyboardConfig.RightJoycon.StickButton.ToString(); _a.Label = keyboardConfig.RightJoycon.ButtonA.ToString(); _b.Label = keyboardConfig.RightJoycon.ButtonB.ToString(); _x.Label = keyboardConfig.RightJoycon.ButtonX.ToString(); _y.Label = keyboardConfig.RightJoycon.ButtonY.ToString(); _plus.Label = keyboardConfig.RightJoycon.ButtonPlus.ToString(); _r.Label = keyboardConfig.RightJoycon.ButtonR.ToString(); _zR.Label = keyboardConfig.RightJoycon.ButtonZr.ToString(); _rSl.Label = keyboardConfig.RightJoycon.ButtonSl.ToString(); _rSr.Label = keyboardConfig.RightJoycon.ButtonSr.ToString(); break; case ControllerConfig controllerConfig: _controllerType.SetActiveId(controllerConfig.ControllerType.ToString()); _lStickX.Label = controllerConfig.LeftJoycon.StickX.ToString(); _invertLStickX.Active = controllerConfig.LeftJoycon.InvertStickX; _lStickY.Label = controllerConfig.LeftJoycon.StickY.ToString(); _invertLStickY.Active = controllerConfig.LeftJoycon.InvertStickY; _lStickButton.Label = controllerConfig.LeftJoycon.StickButton.ToString(); _dpadUp.Label = controllerConfig.LeftJoycon.DPadUp.ToString(); _dpadDown.Label = controllerConfig.LeftJoycon.DPadDown.ToString(); _dpadLeft.Label = controllerConfig.LeftJoycon.DPadLeft.ToString(); _dpadRight.Label = controllerConfig.LeftJoycon.DPadRight.ToString(); _minus.Label = controllerConfig.LeftJoycon.ButtonMinus.ToString(); _l.Label = controllerConfig.LeftJoycon.ButtonL.ToString(); _zL.Label = controllerConfig.LeftJoycon.ButtonZl.ToString(); _lSl.Label = controllerConfig.LeftJoycon.ButtonSl.ToString(); _lSr.Label = controllerConfig.LeftJoycon.ButtonSr.ToString(); _rStickX.Label = controllerConfig.RightJoycon.StickX.ToString(); _invertRStickX.Active = controllerConfig.RightJoycon.InvertStickX; _rStickY.Label = controllerConfig.RightJoycon.StickY.ToString(); _invertRStickY.Active = controllerConfig.RightJoycon.InvertStickY; _rStickButton.Label = controllerConfig.RightJoycon.StickButton.ToString(); _a.Label = controllerConfig.RightJoycon.ButtonA.ToString(); _b.Label = controllerConfig.RightJoycon.ButtonB.ToString(); _x.Label = controllerConfig.RightJoycon.ButtonX.ToString(); _y.Label = controllerConfig.RightJoycon.ButtonY.ToString(); _plus.Label = controllerConfig.RightJoycon.ButtonPlus.ToString(); _r.Label = controllerConfig.RightJoycon.ButtonR.ToString(); _zR.Label = controllerConfig.RightJoycon.ButtonZr.ToString(); _rSl.Label = controllerConfig.RightJoycon.ButtonSl.ToString(); _rSr.Label = controllerConfig.RightJoycon.ButtonSr.ToString(); _controllerDeadzoneLeft.Value = controllerConfig.DeadzoneLeft; _controllerDeadzoneRight.Value = controllerConfig.DeadzoneRight; _controllerTriggerThreshold.Value = controllerConfig.TriggerThreshold; break; } }
private SettingsWindow(MainWindow parent, Builder builder, VirtualFileSystem virtualFileSystem, HLE.FileSystem.Content.ContentManager contentManager) : base(builder.GetObject("_settingsWin").Handle) { Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.Resources.Logo_Ryujinx.png"); _parent = parent; builder.Autoconnect(this); _timeZoneContentManager = new TimeZoneContentManager(); _timeZoneContentManager.InitializeInstance(virtualFileSystem, contentManager, IntegrityCheckLevel.None); _validTzRegions = new HashSet <string>(_timeZoneContentManager.LocationNameCache.Length, StringComparer.Ordinal); // Zone regions are identifiers. Must match exactly. // Bind Events. _configureController1.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player1); _configureController2.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player2); _configureController3.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player3); _configureController4.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player4); _configureController5.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player5); _configureController6.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player6); _configureController7.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player7); _configureController8.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player8); _configureControllerH.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Handheld); _systemTimeZoneEntry.FocusOutEvent += TimeZoneEntry_FocusOut; _resScaleCombo.Changed += (sender, args) => _resScaleText.Visible = _resScaleCombo.ActiveId == "-1"; _galThreading.Changed += (sender, args) => { if (_galThreading.ActiveId != ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString()) { GtkDialog.CreateInfoDialog("Warning - Backend Threading", "Ryujinx must be restarted after changing this option for it to apply fully. Depending on your platform, you may need to manually disable your driver's own multithreading when using Ryujinx's."); } }; // Setup Currents. if (ConfigurationState.Instance.Logger.EnableTrace) { _traceLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableFileLog) { _fileLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableError) { _errorLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableWarn) { _warningLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableInfo) { _infoLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableStub) { _stubLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableDebug) { _debugLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableGuest) { _guestLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableFsAccessLog) { _fsAccessLogToggle.Click(); } foreach (GraphicsDebugLevel level in Enum.GetValues <GraphicsDebugLevel>()) { _graphicsDebugLevel.Append(level.ToString(), level.ToString()); } _graphicsDebugLevel.SetActiveId(ConfigurationState.Instance.Logger.GraphicsDebugLevel.Value.ToString()); if (ConfigurationState.Instance.System.EnableDockedMode) { _dockedModeToggle.Click(); } if (ConfigurationState.Instance.EnableDiscordIntegration) { _discordToggle.Click(); } if (ConfigurationState.Instance.CheckUpdatesOnStart) { _checkUpdatesToggle.Click(); } if (ConfigurationState.Instance.ShowConfirmExit) { _showConfirmExitToggle.Click(); } if (ConfigurationState.Instance.HideCursorOnIdle) { _hideCursorOnIdleToggle.Click(); } if (ConfigurationState.Instance.Graphics.EnableVsync) { _vSyncToggle.Click(); } if (ConfigurationState.Instance.Graphics.EnableShaderCache) { _shaderCacheToggle.Click(); } if (ConfigurationState.Instance.System.EnablePtc) { _ptcToggle.Click(); } if (ConfigurationState.Instance.System.EnableInternetAccess) { _internetToggle.Click(); } if (ConfigurationState.Instance.System.EnableFsIntegrityChecks) { _fsicToggle.Click(); } switch (ConfigurationState.Instance.System.MemoryManagerMode.Value) { case MemoryManagerMode.SoftwarePageTable: _mmSoftware.Click(); break; case MemoryManagerMode.HostMapped: _mmHost.Click(); break; case MemoryManagerMode.HostMappedUnsafe: _mmHostUnsafe.Click(); break; } if (ConfigurationState.Instance.System.ExpandRam) { _expandRamToggle.Click(); } if (ConfigurationState.Instance.System.IgnoreMissingServices) { _ignoreToggle.Click(); } if (ConfigurationState.Instance.Hid.EnableKeyboard) { _directKeyboardAccess.Click(); } if (ConfigurationState.Instance.Hid.EnableMouse) { _directMouseAccess.Click(); } if (ConfigurationState.Instance.Ui.EnableCustomTheme) { _custThemeToggle.Click(); } // Custom EntryCompletion Columns. If added to glade, need to override more signals ListStore tzList = new ListStore(typeof(string), typeof(string), typeof(string)); _systemTimeZoneCompletion.Model = tzList; CellRendererText offsetCol = new CellRendererText(); CellRendererText abbrevCol = new CellRendererText(); _systemTimeZoneCompletion.PackStart(offsetCol, false); _systemTimeZoneCompletion.AddAttribute(offsetCol, "text", 0); _systemTimeZoneCompletion.TextColumn = 1; // Regions Column _systemTimeZoneCompletion.PackStart(abbrevCol, false); _systemTimeZoneCompletion.AddAttribute(abbrevCol, "text", 2); int maxLocationLength = 0; foreach (var(offset, location, abbr) in _timeZoneContentManager.ParseTzOffsets()) { var hours = Math.DivRem(offset, 3600, out int seconds); var minutes = Math.Abs(seconds) / 60; var abbr2 = (abbr.StartsWith('+') || abbr.StartsWith('-')) ? string.Empty : abbr; tzList.AppendValues($"UTC{hours:+0#;-0#;+00}:{minutes:D2} ", location, abbr2); _validTzRegions.Add(location); maxLocationLength = Math.Max(maxLocationLength, location.Length); } _systemTimeZoneEntry.WidthChars = Math.Max(20, maxLocationLength + 1); // Ensure minimum Entry width _systemTimeZoneEntry.Text = _timeZoneContentManager.SanityCheckDeviceLocationName(ConfigurationState.Instance.System.TimeZone); _systemTimeZoneCompletion.MatchFunc = TimeZoneMatchFunc; _systemLanguageSelect.SetActiveId(ConfigurationState.Instance.System.Language.Value.ToString()); _systemRegionSelect.SetActiveId(ConfigurationState.Instance.System.Region.Value.ToString()); _galThreading.SetActiveId(ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString()); _resScaleCombo.SetActiveId(ConfigurationState.Instance.Graphics.ResScale.Value.ToString()); _anisotropy.SetActiveId(ConfigurationState.Instance.Graphics.MaxAnisotropy.Value.ToString()); _aspectRatio.SetActiveId(((int)ConfigurationState.Instance.Graphics.AspectRatio.Value).ToString()); _custThemePath.Buffer.Text = ConfigurationState.Instance.Ui.CustomThemePath; _resScaleText.Buffer.Text = ConfigurationState.Instance.Graphics.ResScaleCustom.Value.ToString(); _resScaleText.Visible = _resScaleCombo.ActiveId == "-1"; _graphicsShadersDumpPath.Buffer.Text = ConfigurationState.Instance.Graphics.ShadersDumpPath; _fsLogSpinAdjustment.Value = ConfigurationState.Instance.System.FsGlobalAccessLogMode; _systemTimeOffset = ConfigurationState.Instance.System.SystemTimeOffset; _gameDirsBox.AppendColumn("", new CellRendererText(), "text", 0); _gameDirsBoxStore = new ListStore(typeof(string)); _gameDirsBox.Model = _gameDirsBoxStore; foreach (string gameDir in ConfigurationState.Instance.Ui.GameDirs.Value) { _gameDirsBoxStore.AppendValues(gameDir); } if (_custThemeToggle.Active == false) { _custThemePath.Sensitive = false; _custThemePathLabel.Sensitive = false; _browseThemePath.Sensitive = false; } //Setup system time spinners UpdateSystemTimeSpinners(); _audioBackendStore = new ListStore(typeof(string), typeof(AudioBackend)); TreeIter openAlIter = _audioBackendStore.AppendValues("OpenAL", AudioBackend.OpenAl); TreeIter soundIoIter = _audioBackendStore.AppendValues("SoundIO", AudioBackend.SoundIo); TreeIter sdl2Iter = _audioBackendStore.AppendValues("SDL2", AudioBackend.SDL2); TreeIter dummyIter = _audioBackendStore.AppendValues("Dummy", AudioBackend.Dummy); _audioBackendSelect = ComboBox.NewWithModelAndEntry(_audioBackendStore); _audioBackendSelect.EntryTextColumn = 0; _audioBackendSelect.Entry.IsEditable = false; switch (ConfigurationState.Instance.System.AudioBackend.Value) { case AudioBackend.OpenAl: _audioBackendSelect.SetActiveIter(openAlIter); break; case AudioBackend.SoundIo: _audioBackendSelect.SetActiveIter(soundIoIter); break; case AudioBackend.SDL2: _audioBackendSelect.SetActiveIter(sdl2Iter); break; case AudioBackend.Dummy: _audioBackendSelect.SetActiveIter(dummyIter); break; default: throw new ArgumentOutOfRangeException(); } _audioBackendBox.Add(_audioBackendSelect); _audioBackendSelect.Show(); _previousVolumeLevel = ConfigurationState.Instance.System.AudioVolume; _audioVolumeLabel = new Label("Volume: "); _audioVolumeSlider = new Scale(Orientation.Horizontal, 0, 100, 1); _audioVolumeLabel.MarginStart = 10; _audioVolumeSlider.ValuePos = PositionType.Right; _audioVolumeSlider.WidthRequest = 200; _audioVolumeSlider.Value = _previousVolumeLevel * 100; _audioVolumeSlider.ValueChanged += VolumeSlider_OnChange; _audioBackendBox.Add(_audioVolumeLabel); _audioBackendBox.Add(_audioVolumeSlider); _audioVolumeLabel.Show(); _audioVolumeSlider.Show(); bool openAlIsSupported = false; bool soundIoIsSupported = false; bool sdl2IsSupported = false; Task.Run(() => { openAlIsSupported = OpenALHardwareDeviceDriver.IsSupported; soundIoIsSupported = SoundIoHardwareDeviceDriver.IsSupported; sdl2IsSupported = SDL2HardwareDeviceDriver.IsSupported; }); // This function runs whenever the dropdown is opened _audioBackendSelect.SetCellDataFunc(_audioBackendSelect.Cells[0], (layout, cell, model, iter) => { cell.Sensitive = ((AudioBackend)_audioBackendStore.GetValue(iter, 1)) switch { AudioBackend.OpenAl => openAlIsSupported, AudioBackend.SoundIo => soundIoIsSupported, AudioBackend.SDL2 => sdl2IsSupported, AudioBackend.Dummy => true, _ => throw new ArgumentOutOfRangeException() }; });
private SettingsWindow(MainWindow parent, Builder builder, VirtualFileSystem virtualFileSystem, HLE.FileSystem.Content.ContentManager contentManager) : base(builder.GetObject("_settingsWin").Handle) { _parent = parent; builder.Autoconnect(this); _timeZoneContentManager = new TimeZoneContentManager(); _timeZoneContentManager.InitializeInstance(virtualFileSystem, contentManager, LibHac.FsSystem.IntegrityCheckLevel.None); _validTzRegions = new HashSet <string>(_timeZoneContentManager.LocationNameCache.Length, StringComparer.Ordinal); // Zone regions are identifiers. Must match exactly. // Bind Events. _configureController1.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player1); _configureController2.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player2); _configureController3.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player3); _configureController4.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player4); _configureController5.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player5); _configureController6.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player6); _configureController7.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player7); _configureController8.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player8); _configureControllerH.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Handheld); _systemTimeZoneEntry.FocusOutEvent += TimeZoneEntry_FocusOut; _resScaleCombo.Changed += (sender, args) => _resScaleText.Visible = _resScaleCombo.ActiveId == "-1"; // Setup Currents. if (ConfigurationState.Instance.Logger.EnableFileLog) { _fileLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableError) { _errorLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableWarn) { _warningLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableInfo) { _infoLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableStub) { _stubLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableDebug) { _debugLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableGuest) { _guestLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableFsAccessLog) { _fsAccessLogToggle.Click(); } foreach (GraphicsDebugLevel level in Enum.GetValues(typeof(GraphicsDebugLevel))) { _graphicsDebugLevel.Append(level.ToString(), level.ToString()); } _graphicsDebugLevel.SetActiveId(ConfigurationState.Instance.Logger.GraphicsDebugLevel.Value.ToString()); if (ConfigurationState.Instance.System.EnableDockedMode) { _dockedModeToggle.Click(); } if (ConfigurationState.Instance.EnableDiscordIntegration) { _discordToggle.Click(); } if (ConfigurationState.Instance.CheckUpdatesOnStart) { _checkUpdatesToggle.Click(); } if (ConfigurationState.Instance.Graphics.EnableVsync) { _vSyncToggle.Click(); } if (ConfigurationState.Instance.Graphics.EnableShaderCache) { _shaderCacheToggle.Click(); } if (ConfigurationState.Instance.System.EnablePtc) { _ptcToggle.Click(); } if (ConfigurationState.Instance.System.EnableFsIntegrityChecks) { _fsicToggle.Click(); } if (ConfigurationState.Instance.System.IgnoreMissingServices) { _ignoreToggle.Click(); } if (ConfigurationState.Instance.Hid.EnableKeyboard) { _directKeyboardAccess.Click(); } if (ConfigurationState.Instance.Ui.EnableCustomTheme) { _custThemeToggle.Click(); } // Custom EntryCompletion Columns. If added to glade, need to override more signals ListStore tzList = new ListStore(typeof(string), typeof(string), typeof(string)); _systemTimeZoneCompletion.Model = tzList; CellRendererText offsetCol = new CellRendererText(); CellRendererText abbrevCol = new CellRendererText(); _systemTimeZoneCompletion.PackStart(offsetCol, false); _systemTimeZoneCompletion.AddAttribute(offsetCol, "text", 0); _systemTimeZoneCompletion.TextColumn = 1; // Regions Column _systemTimeZoneCompletion.PackStart(abbrevCol, false); _systemTimeZoneCompletion.AddAttribute(abbrevCol, "text", 2); int maxLocationLength = 0; foreach (var(offset, location, abbr) in _timeZoneContentManager.ParseTzOffsets()) { var hours = Math.DivRem(offset, 3600, out int seconds); var minutes = Math.Abs(seconds) / 60; var abbr2 = (abbr.StartsWith('+') || abbr.StartsWith('-')) ? string.Empty : abbr; tzList.AppendValues($"UTC{hours:+0#;-0#;+00}:{minutes:D2} ", location, abbr2); _validTzRegions.Add(location); maxLocationLength = Math.Max(maxLocationLength, location.Length); } _systemTimeZoneEntry.WidthChars = Math.Max(20, maxLocationLength + 1); // Ensure minimum Entry width _systemTimeZoneEntry.Text = _timeZoneContentManager.SanityCheckDeviceLocationName(); _systemTimeZoneCompletion.MatchFunc = TimeZoneMatchFunc; _systemLanguageSelect.SetActiveId(ConfigurationState.Instance.System.Language.Value.ToString()); _systemRegionSelect.SetActiveId(ConfigurationState.Instance.System.Region.Value.ToString()); _resScaleCombo.SetActiveId(ConfigurationState.Instance.Graphics.ResScale.Value.ToString()); _anisotropy.SetActiveId(ConfigurationState.Instance.Graphics.MaxAnisotropy.Value.ToString()); _aspectRatio.SetActiveId(((int)ConfigurationState.Instance.Graphics.AspectRatio.Value).ToString()); _custThemePath.Buffer.Text = ConfigurationState.Instance.Ui.CustomThemePath; _resScaleText.Buffer.Text = ConfigurationState.Instance.Graphics.ResScaleCustom.Value.ToString(); _resScaleText.Visible = _resScaleCombo.ActiveId == "-1"; _graphicsShadersDumpPath.Buffer.Text = ConfigurationState.Instance.Graphics.ShadersDumpPath; _fsLogSpinAdjustment.Value = ConfigurationState.Instance.System.FsGlobalAccessLogMode; _systemTimeOffset = ConfigurationState.Instance.System.SystemTimeOffset; _gameDirsBox.AppendColumn("", new CellRendererText(), "text", 0); _gameDirsBoxStore = new ListStore(typeof(string)); _gameDirsBox.Model = _gameDirsBoxStore; foreach (string gameDir in ConfigurationState.Instance.Ui.GameDirs.Value) { _gameDirsBoxStore.AppendValues(gameDir); } if (_custThemeToggle.Active == false) { _custThemePath.Sensitive = false; _custThemePathLabel.Sensitive = false; _browseThemePath.Sensitive = false; } //Setup system time spinners UpdateSystemTimeSpinners(); _audioBackendStore = new ListStore(typeof(string), typeof(AudioBackend)); TreeIter openAlIter = _audioBackendStore.AppendValues("OpenAL", AudioBackend.OpenAl); TreeIter soundIoIter = _audioBackendStore.AppendValues("SoundIO", AudioBackend.SoundIo); TreeIter dummyIter = _audioBackendStore.AppendValues("Dummy", AudioBackend.Dummy); _audioBackendSelect = ComboBox.NewWithModelAndEntry(_audioBackendStore); _audioBackendSelect.EntryTextColumn = 0; _audioBackendSelect.Entry.IsEditable = false; switch (ConfigurationState.Instance.System.AudioBackend.Value) { case AudioBackend.OpenAl: _audioBackendSelect.SetActiveIter(openAlIter); break; case AudioBackend.SoundIo: _audioBackendSelect.SetActiveIter(soundIoIter); break; case AudioBackend.Dummy: _audioBackendSelect.SetActiveIter(dummyIter); break; default: throw new ArgumentOutOfRangeException(); } _audioBackendBox.Add(_audioBackendSelect); _audioBackendSelect.Show(); bool openAlIsSupported = false; bool soundIoIsSupported = false; Task.Run(() => { openAlIsSupported = OpenALAudioOut.IsSupported; soundIoIsSupported = SoundIoAudioOut.IsSupported; }); // This function runs whenever the dropdown is opened _audioBackendSelect.SetCellDataFunc(_audioBackendSelect.Cells[0], (layout, cell, model, iter) => { cell.Sensitive = ((AudioBackend)_audioBackendStore.GetValue(iter, 1)) switch { AudioBackend.OpenAl => openAlIsSupported, AudioBackend.SoundIo => soundIoIsSupported, AudioBackend.Dummy => true, _ => throw new ArgumentOutOfRangeException() }; });
private SwitchSettings(Builder builder, HLE.Switch device) : base(builder.GetObject("_settingsWin").Handle) { Device = device; builder.Autoconnect(this); _settingsWin.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.ryujinxIcon.png"); _controllerImage.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.JoyCon.png", 500, 500); //Bind Events _lStickUp1.Clicked += (o, args) => Button_Pressed(o, args, _lStickUp1); _lStickDown1.Clicked += (o, args) => Button_Pressed(o, args, _lStickDown1); _lStickLeft1.Clicked += (o, args) => Button_Pressed(o, args, _lStickLeft1); _lStickRight1.Clicked += (o, args) => Button_Pressed(o, args, _lStickRight1); _lStickButton1.Clicked += (o, args) => Button_Pressed(o, args, _lStickButton1); _dpadUp1.Clicked += (o, args) => Button_Pressed(o, args, _dpadUp1); _dpadDown1.Clicked += (o, args) => Button_Pressed(o, args, _dpadDown1); _dpadLeft1.Clicked += (o, args) => Button_Pressed(o, args, _dpadLeft1); _dpadRight1.Clicked += (o, args) => Button_Pressed(o, args, _dpadRight1); _minus1.Clicked += (o, args) => Button_Pressed(o, args, _minus1); _l1.Clicked += (o, args) => Button_Pressed(o, args, _l1); _zL1.Clicked += (o, args) => Button_Pressed(o, args, _zL1); _rStickUp1.Clicked += (o, args) => Button_Pressed(o, args, _rStickUp1); _rStickDown1.Clicked += (o, args) => Button_Pressed(o, args, _rStickDown1); _rStickLeft1.Clicked += (o, args) => Button_Pressed(o, args, _rStickLeft1); _rStickRight1.Clicked += (o, args) => Button_Pressed(o, args, _rStickRight1); _rStickButton1.Clicked += (o, args) => Button_Pressed(o, args, _rStickButton1); _a1.Clicked += (o, args) => Button_Pressed(o, args, _a1); _b1.Clicked += (o, args) => Button_Pressed(o, args, _b1); _x1.Clicked += (o, args) => Button_Pressed(o, args, _x1); _y1.Clicked += (o, args) => Button_Pressed(o, args, _y1); _plus1.Clicked += (o, args) => Button_Pressed(o, args, _plus1); _r1.Clicked += (o, args) => Button_Pressed(o, args, _r1); _zR1.Clicked += (o, args) => Button_Pressed(o, args, _zR1); //Setup Currents if (SwitchConfig.EnableFileLog) { _fileLogToggle.Click(); } if (SwitchConfig.LoggingEnableError) { _errorLogToggle.Click(); } if (SwitchConfig.LoggingEnableWarn) { _warningLogToggle.Click(); } if (SwitchConfig.LoggingEnableInfo) { _infoLogToggle.Click(); } if (SwitchConfig.LoggingEnableStub) { _stubLogToggle.Click(); } if (SwitchConfig.LoggingEnableDebug) { _debugLogToggle.Click(); } if (SwitchConfig.LoggingEnableGuest) { _guestLogToggle.Click(); } if (SwitchConfig.LoggingEnableFsAccessLog) { _fsAccessLogToggle.Click(); } if (SwitchConfig.DockedMode) { _dockedModeToggle.Click(); } if (SwitchConfig.EnableDiscordIntegration) { _discordToggle.Click(); } if (SwitchConfig.EnableVsync) { _vSyncToggle.Click(); } if (SwitchConfig.EnableMulticoreScheduling) { _multiSchedToggle.Click(); } if (SwitchConfig.EnableFsIntegrityChecks) { _fsicToggle.Click(); } if (SwitchConfig.EnableLegacyJit) { _legacyJitToggle.Click(); } if (SwitchConfig.IgnoreMissingServices) { _ignoreToggle.Click(); } if (SwitchConfig.EnableKeyboard) { _directKeyboardAccess.Click(); } if (SwitchConfig.EnableCustomTheme) { _custThemeToggle.Click(); } _systemLanguageSelect.SetActiveId(SwitchConfig.SystemLanguage.ToString()); _controller1Type.SetActiveId(SwitchConfig.ControllerType.ToString()); _lStickUp1.Label = SwitchConfig.KeyboardControls.LeftJoycon.StickUp.ToString(); _lStickDown1.Label = SwitchConfig.KeyboardControls.LeftJoycon.StickDown.ToString(); _lStickLeft1.Label = SwitchConfig.KeyboardControls.LeftJoycon.StickLeft.ToString(); _lStickRight1.Label = SwitchConfig.KeyboardControls.LeftJoycon.StickRight.ToString(); _lStickButton1.Label = SwitchConfig.KeyboardControls.LeftJoycon.StickButton.ToString(); _dpadUp1.Label = SwitchConfig.KeyboardControls.LeftJoycon.DPadUp.ToString(); _dpadDown1.Label = SwitchConfig.KeyboardControls.LeftJoycon.DPadDown.ToString(); _dpadLeft1.Label = SwitchConfig.KeyboardControls.LeftJoycon.DPadLeft.ToString(); _dpadRight1.Label = SwitchConfig.KeyboardControls.LeftJoycon.DPadRight.ToString(); _minus1.Label = SwitchConfig.KeyboardControls.LeftJoycon.ButtonMinus.ToString(); _l1.Label = SwitchConfig.KeyboardControls.LeftJoycon.ButtonL.ToString(); _zL1.Label = SwitchConfig.KeyboardControls.LeftJoycon.ButtonZl.ToString(); _rStickUp1.Label = SwitchConfig.KeyboardControls.RightJoycon.StickUp.ToString(); _rStickDown1.Label = SwitchConfig.KeyboardControls.RightJoycon.StickDown.ToString(); _rStickLeft1.Label = SwitchConfig.KeyboardControls.RightJoycon.StickLeft.ToString(); _rStickRight1.Label = SwitchConfig.KeyboardControls.RightJoycon.StickRight.ToString(); _rStickButton1.Label = SwitchConfig.KeyboardControls.RightJoycon.StickButton.ToString(); _a1.Label = SwitchConfig.KeyboardControls.RightJoycon.ButtonA.ToString(); _b1.Label = SwitchConfig.KeyboardControls.RightJoycon.ButtonB.ToString(); _x1.Label = SwitchConfig.KeyboardControls.RightJoycon.ButtonX.ToString(); _y1.Label = SwitchConfig.KeyboardControls.RightJoycon.ButtonY.ToString(); _plus1.Label = SwitchConfig.KeyboardControls.RightJoycon.ButtonPlus.ToString(); _r1.Label = SwitchConfig.KeyboardControls.RightJoycon.ButtonR.ToString(); _zR1.Label = SwitchConfig.KeyboardControls.RightJoycon.ButtonZr.ToString(); _custThemePath.Buffer.Text = SwitchConfig.CustomThemePath; _graphicsShadersDumpPath.Buffer.Text = SwitchConfig.GraphicsShadersDumpPath; _fsLogSpinAdjustment.Value = SwitchConfig.FsGlobalAccessLogMode; _gameDirsBox.AppendColumn("", new CellRendererText(), "text", 0); _gameDirsBoxStore = new ListStore(typeof(string)); _gameDirsBox.Model = _gameDirsBoxStore; foreach (string gameDir in SwitchConfig.GameDirs) { _gameDirsBoxStore.AppendValues(gameDir); } if (_custThemeToggle.Active == false) { _custThemePath.Sensitive = false; _custThemePathLabel.Sensitive = false; _browseThemePath.Sensitive = false; } _logPath.Buffer.Text = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Ryujinx.log"); _listeningForKeypress = false; }
private SwitchSettings(Builder builder, HLE.FileSystem.VirtualFileSystem virtualFileSystem, HLE.FileSystem.Content.ContentManager contentManager) : base(builder.GetObject("_settingsWin").Handle) { builder.Autoconnect(this); _settingsWin.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.Icon.png"); _controller1Image.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.JoyCon.png", 500, 500); //Bind Events _lStickUp1.Clicked += (sender, args) => Button_Pressed(sender, args, _lStickUp1); _lStickDown1.Clicked += (sender, args) => Button_Pressed(sender, args, _lStickDown1); _lStickLeft1.Clicked += (sender, args) => Button_Pressed(sender, args, _lStickLeft1); _lStickRight1.Clicked += (sender, args) => Button_Pressed(sender, args, _lStickRight1); _lStickButton1.Clicked += (sender, args) => Button_Pressed(sender, args, _lStickButton1); _dpadUp1.Clicked += (sender, args) => Button_Pressed(sender, args, _dpadUp1); _dpadDown1.Clicked += (sender, args) => Button_Pressed(sender, args, _dpadDown1); _dpadLeft1.Clicked += (sender, args) => Button_Pressed(sender, args, _dpadLeft1); _dpadRight1.Clicked += (sender, args) => Button_Pressed(sender, args, _dpadRight1); _minus1.Clicked += (sender, args) => Button_Pressed(sender, args, _minus1); _l1.Clicked += (sender, args) => Button_Pressed(sender, args, _l1); _zL1.Clicked += (sender, args) => Button_Pressed(sender, args, _zL1); _rStickUp1.Clicked += (sender, args) => Button_Pressed(sender, args, _rStickUp1); _rStickDown1.Clicked += (sender, args) => Button_Pressed(sender, args, _rStickDown1); _rStickLeft1.Clicked += (sender, args) => Button_Pressed(sender, args, _rStickLeft1); _rStickRight1.Clicked += (sender, args) => Button_Pressed(sender, args, _rStickRight1); _rStickButton1.Clicked += (sender, args) => Button_Pressed(sender, args, _rStickButton1); _a1.Clicked += (sender, args) => Button_Pressed(sender, args, _a1); _b1.Clicked += (sender, args) => Button_Pressed(sender, args, _b1); _x1.Clicked += (sender, args) => Button_Pressed(sender, args, _x1); _y1.Clicked += (sender, args) => Button_Pressed(sender, args, _y1); _plus1.Clicked += (sender, args) => Button_Pressed(sender, args, _plus1); _r1.Clicked += (sender, args) => Button_Pressed(sender, args, _r1); _zR1.Clicked += (sender, args) => Button_Pressed(sender, args, _zR1); _controller1Type.Changed += (sender, args) => Controller_Changed(sender, args, _controller1Type.ActiveId, _controller1Image); //Setup Currents if (ConfigurationState.Instance.Logger.EnableFileLog) { _fileLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableError) { _errorLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableWarn) { _warningLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableInfo) { _infoLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableStub) { _stubLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableDebug) { _debugLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableGuest) { _guestLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableFsAccessLog) { _fsAccessLogToggle.Click(); } if (ConfigurationState.Instance.System.EnableDockedMode) { _dockedModeToggle.Click(); } if (ConfigurationState.Instance.EnableDiscordIntegration) { _discordToggle.Click(); } if (ConfigurationState.Instance.Graphics.EnableVsync) { _vSyncToggle.Click(); } if (ConfigurationState.Instance.System.EnableMulticoreScheduling) { _multiSchedToggle.Click(); } if (ConfigurationState.Instance.System.EnableFsIntegrityChecks) { _fsicToggle.Click(); } if (ConfigurationState.Instance.System.IgnoreMissingServices) { _ignoreToggle.Click(); } if (ConfigurationState.Instance.Hid.EnableKeyboard) { _directKeyboardAccess.Click(); } if (ConfigurationState.Instance.Ui.EnableCustomTheme) { _custThemeToggle.Click(); } TimeZoneContentManager timeZoneContentManager = new TimeZoneContentManager(); timeZoneContentManager.InitializeInstance(virtualFileSystem, contentManager, LibHac.FsSystem.IntegrityCheckLevel.None); List <string> locationNames = timeZoneContentManager.LocationNameCache.ToList(); locationNames.Sort(); foreach (string locationName in locationNames) { _systemTimeZoneSelect.Append(locationName, locationName); } _systemLanguageSelect.SetActiveId(ConfigurationState.Instance.System.Language.Value.ToString()); _systemRegionSelect.SetActiveId(ConfigurationState.Instance.System.Region.Value.ToString()); _systemTimeZoneSelect.SetActiveId(timeZoneContentManager.SanityCheckDeviceLocationName()); _anisotropy.SetActiveId(ConfigurationState.Instance.Graphics.MaxAnisotropy.Value.ToString()); _controller1Type.SetActiveId(ConfigurationState.Instance.Hid.ControllerType.Value.ToString()); Controller_Changed(null, null, _controller1Type.ActiveId, _controller1Image); _lStickUp1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.StickUp.ToString(); _lStickDown1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.StickDown.ToString(); _lStickLeft1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.StickLeft.ToString(); _lStickRight1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.StickRight.ToString(); _lStickButton1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.StickButton.ToString(); _dpadUp1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.DPadUp.ToString(); _dpadDown1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.DPadDown.ToString(); _dpadLeft1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.DPadLeft.ToString(); _dpadRight1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.DPadRight.ToString(); _minus1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.ButtonMinus.ToString(); _l1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.ButtonL.ToString(); _zL1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.ButtonZl.ToString(); _rStickUp1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.StickUp.ToString(); _rStickDown1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.StickDown.ToString(); _rStickLeft1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.StickLeft.ToString(); _rStickRight1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.StickRight.ToString(); _rStickButton1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.StickButton.ToString(); _a1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.ButtonA.ToString(); _b1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.ButtonB.ToString(); _x1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.ButtonX.ToString(); _y1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.ButtonY.ToString(); _plus1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.ButtonPlus.ToString(); _r1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.ButtonR.ToString(); _zR1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.ButtonZr.ToString(); _custThemePath.Buffer.Text = ConfigurationState.Instance.Ui.CustomThemePath; _graphicsShadersDumpPath.Buffer.Text = ConfigurationState.Instance.Graphics.ShadersDumpPath; _fsLogSpinAdjustment.Value = ConfigurationState.Instance.System.FsGlobalAccessLogMode; _systemTimeOffset = ConfigurationState.Instance.System.SystemTimeOffset; _gameDirsBox.AppendColumn("", new CellRendererText(), "text", 0); _gameDirsBoxStore = new ListStore(typeof(string)); _gameDirsBox.Model = _gameDirsBoxStore; foreach (string gameDir in ConfigurationState.Instance.Ui.GameDirs.Value) { _gameDirsBoxStore.AppendValues(gameDir); } if (_custThemeToggle.Active == false) { _custThemePath.Sensitive = false; _custThemePathLabel.Sensitive = false; _browseThemePath.Sensitive = false; } _listeningForKeypress = false; //Setup system time spinners UpdateSystemTimeSpinners(); }
/// <summary> /// Implement Data Model to HMI binding /// </summary> public void SiKConfig_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { var sik_conf = sender as SiKConfig; switch (e.PropertyName) { case "ParameterFormat": EepromFmtEntry.Text = sik_conf.ParameterFormat.ToString(); break; case "SerialSpeed": SerialSpeedCombo.SetActiveId(sik_conf.SerialSpeed.ToString()); break; case "AirSpeed": AirSpeedEntry.Text = sik_conf.AirSpeed.ToString(); break; case "NetworkID": NetIdEntry.Text = sik_conf.NetworkID.ToString(); break; case "TxPower": TxPowerCombo.SetActiveId(sik_conf.TxPower.ToString()); break; case "ECC": EccCheck.Active = sik_conf.ECC; break; case "MavlinkMode": MavLinkVerCombo.SetActiveId(sik_conf.MavlinkMode.ToString()); break; case "OpportunisticResend": OpportunisticCheck.Active = sik_conf.OpportunisticResend; break; case "MinFrequency": MinFreqEntry.Text = sik_conf.MinFrequency.ToString(); break; case "MaxFrequency": MaxFreqEntry.Text = sik_conf.MaxFrequency.ToString(); break; case "NumChannels": NumChanEntry.Text = sik_conf.NumChannels.ToString(); break; case "DutyCycle": DutyCycleCombo.SetActiveId(sik_conf.DutyCycle.ToString()); break; case "LbtRssiThreshold": LbtRssiCombo.SetActiveId(sik_conf.LbtRssiThreshold.ToString()); break; case "ManchesterEncoding": ManchesterCheck.Active = sik_conf.ManchesterEncoding; break; case "UseRtsCts": RtsCtsCheck.Active = sik_conf.UseRtsCts; break; case "MaxWindowSize": MaxWndCombo.SetActiveId(sik_conf.MaxWindowSize.ToString()); break; default: break; } }
private SettingsWindow(Builder builder, VirtualFileSystem virtualFileSystem, HLE.FileSystem.Content.ContentManager contentManager) : base(builder.GetObject("_settingsWin").Handle) { builder.Autoconnect(this); this.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.Icon.png"); _virtualFileSystem = virtualFileSystem; //Bind Events _configureController1.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player1); _configureController2.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player2); _configureController3.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player3); _configureController4.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player4); _configureController5.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player5); _configureController6.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player6); _configureController7.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player7); _configureController8.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player8); _configureControllerH.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Handheld); //Setup Currents if (ConfigurationState.Instance.Logger.EnableFileLog) { _fileLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableError) { _errorLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableWarn) { _warningLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableInfo) { _infoLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableStub) { _stubLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableDebug) { _debugLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableGuest) { _guestLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableFsAccessLog) { _fsAccessLogToggle.Click(); } if (ConfigurationState.Instance.System.EnableDockedMode) { _dockedModeToggle.Click(); } if (ConfigurationState.Instance.EnableDiscordIntegration) { _discordToggle.Click(); } if (ConfigurationState.Instance.Graphics.EnableVsync) { _vSyncToggle.Click(); } if (ConfigurationState.Instance.System.EnableMulticoreScheduling) { _multiSchedToggle.Click(); } if (ConfigurationState.Instance.System.EnableFsIntegrityChecks) { _fsicToggle.Click(); } if (ConfigurationState.Instance.System.IgnoreMissingServices) { _ignoreToggle.Click(); } if (ConfigurationState.Instance.Hid.EnableKeyboard) { _directKeyboardAccess.Click(); } if (ConfigurationState.Instance.Ui.EnableCustomTheme) { _custThemeToggle.Click(); } TimeZoneContentManager timeZoneContentManager = new TimeZoneContentManager(); timeZoneContentManager.InitializeInstance(virtualFileSystem, contentManager, LibHac.FsSystem.IntegrityCheckLevel.None); List <string> locationNames = timeZoneContentManager.LocationNameCache.ToList(); locationNames.Sort(); foreach (string locationName in locationNames) { _systemTimeZoneSelect.Append(locationName, locationName); } _systemLanguageSelect.SetActiveId(ConfigurationState.Instance.System.Language.Value.ToString()); _systemRegionSelect.SetActiveId(ConfigurationState.Instance.System.Region.Value.ToString()); _systemTimeZoneSelect.SetActiveId(timeZoneContentManager.SanityCheckDeviceLocationName()); _anisotropy.SetActiveId(ConfigurationState.Instance.Graphics.MaxAnisotropy.Value.ToString()); _custThemePath.Buffer.Text = ConfigurationState.Instance.Ui.CustomThemePath; _graphicsShadersDumpPath.Buffer.Text = ConfigurationState.Instance.Graphics.ShadersDumpPath; _fsLogSpinAdjustment.Value = ConfigurationState.Instance.System.FsGlobalAccessLogMode; _systemTimeOffset = ConfigurationState.Instance.System.SystemTimeOffset; _gameDirsBox.AppendColumn("", new CellRendererText(), "text", 0); _gameDirsBoxStore = new ListStore(typeof(string)); _gameDirsBox.Model = _gameDirsBoxStore; foreach (string gameDir in ConfigurationState.Instance.Ui.GameDirs.Value) { _gameDirsBoxStore.AppendValues(gameDir); } if (_custThemeToggle.Active == false) { _custThemePath.Sensitive = false; _custThemePathLabel.Sensitive = false; _browseThemePath.Sensitive = false; } //Setup system time spinners UpdateSystemTimeSpinners(); }
private void SetValues(InputConfig config) { switch (config) { case KeyboardConfig keyboardConfig: if (!_controllerType.SetActiveId(keyboardConfig.ControllerType.ToString())) { _controllerType.SetActiveId(_playerIndex == PlayerIndex.Handheld ? ControllerType.Handheld.ToString() : ControllerType.ProController.ToString()); } _lStickUp.Label = keyboardConfig.LeftJoycon.StickUp.ToString(); _lStickDown.Label = keyboardConfig.LeftJoycon.StickDown.ToString(); _lStickLeft.Label = keyboardConfig.LeftJoycon.StickLeft.ToString(); _lStickRight.Label = keyboardConfig.LeftJoycon.StickRight.ToString(); _lStickButton.Label = keyboardConfig.LeftJoycon.StickButton.ToString(); _dpadUp.Label = keyboardConfig.LeftJoycon.DPadUp.ToString(); _dpadDown.Label = keyboardConfig.LeftJoycon.DPadDown.ToString(); _dpadLeft.Label = keyboardConfig.LeftJoycon.DPadLeft.ToString(); _dpadRight.Label = keyboardConfig.LeftJoycon.DPadRight.ToString(); _minus.Label = keyboardConfig.LeftJoycon.ButtonMinus.ToString(); _l.Label = keyboardConfig.LeftJoycon.ButtonL.ToString(); _zL.Label = keyboardConfig.LeftJoycon.ButtonZl.ToString(); _lSl.Label = keyboardConfig.LeftJoycon.ButtonSl.ToString(); _lSr.Label = keyboardConfig.LeftJoycon.ButtonSr.ToString(); _rStickUp.Label = keyboardConfig.RightJoycon.StickUp.ToString(); _rStickDown.Label = keyboardConfig.RightJoycon.StickDown.ToString(); _rStickLeft.Label = keyboardConfig.RightJoycon.StickLeft.ToString(); _rStickRight.Label = keyboardConfig.RightJoycon.StickRight.ToString(); _rStickButton.Label = keyboardConfig.RightJoycon.StickButton.ToString(); _a.Label = keyboardConfig.RightJoycon.ButtonA.ToString(); _b.Label = keyboardConfig.RightJoycon.ButtonB.ToString(); _x.Label = keyboardConfig.RightJoycon.ButtonX.ToString(); _y.Label = keyboardConfig.RightJoycon.ButtonY.ToString(); _plus.Label = keyboardConfig.RightJoycon.ButtonPlus.ToString(); _r.Label = keyboardConfig.RightJoycon.ButtonR.ToString(); _zR.Label = keyboardConfig.RightJoycon.ButtonZr.ToString(); _rSl.Label = keyboardConfig.RightJoycon.ButtonSl.ToString(); _rSr.Label = keyboardConfig.RightJoycon.ButtonSr.ToString(); _slotNumber.Value = keyboardConfig.Slot; _altSlotNumber.Value = keyboardConfig.AltSlot; _sensitivity.Value = keyboardConfig.Sensitivity; _gyroDeadzone.Value = keyboardConfig.GyroDeadzone; _enableMotion.Active = keyboardConfig.EnableMotion; _mirrorInput.Active = keyboardConfig.MirrorInput; _dsuServerHost.Buffer.Text = keyboardConfig.DsuServerHost; _dsuServerPort.Buffer.Text = keyboardConfig.DsuServerPort.ToString(); break; case ControllerConfig controllerConfig: if (!_controllerType.SetActiveId(controllerConfig.ControllerType.ToString())) { _controllerType.SetActiveId(_playerIndex == PlayerIndex.Handheld ? ControllerType.Handheld.ToString() : ControllerType.ProController.ToString()); } _lStickX.Label = controllerConfig.LeftJoycon.StickX.ToString(); _invertLStickX.Active = controllerConfig.LeftJoycon.InvertStickX; _lStickY.Label = controllerConfig.LeftJoycon.StickY.ToString(); _invertLStickY.Active = controllerConfig.LeftJoycon.InvertStickY; _lStickButton.Label = controllerConfig.LeftJoycon.StickButton.ToString(); _dpadUp.Label = controllerConfig.LeftJoycon.DPadUp.ToString(); _dpadDown.Label = controllerConfig.LeftJoycon.DPadDown.ToString(); _dpadLeft.Label = controllerConfig.LeftJoycon.DPadLeft.ToString(); _dpadRight.Label = controllerConfig.LeftJoycon.DPadRight.ToString(); _minus.Label = controllerConfig.LeftJoycon.ButtonMinus.ToString(); _l.Label = controllerConfig.LeftJoycon.ButtonL.ToString(); _zL.Label = controllerConfig.LeftJoycon.ButtonZl.ToString(); _lSl.Label = controllerConfig.LeftJoycon.ButtonSl.ToString(); _lSr.Label = controllerConfig.LeftJoycon.ButtonSr.ToString(); _rStickX.Label = controllerConfig.RightJoycon.StickX.ToString(); _invertRStickX.Active = controllerConfig.RightJoycon.InvertStickX; _rStickY.Label = controllerConfig.RightJoycon.StickY.ToString(); _invertRStickY.Active = controllerConfig.RightJoycon.InvertStickY; _rStickButton.Label = controllerConfig.RightJoycon.StickButton.ToString(); _a.Label = controllerConfig.RightJoycon.ButtonA.ToString(); _b.Label = controllerConfig.RightJoycon.ButtonB.ToString(); _x.Label = controllerConfig.RightJoycon.ButtonX.ToString(); _y.Label = controllerConfig.RightJoycon.ButtonY.ToString(); _plus.Label = controllerConfig.RightJoycon.ButtonPlus.ToString(); _r.Label = controllerConfig.RightJoycon.ButtonR.ToString(); _zR.Label = controllerConfig.RightJoycon.ButtonZr.ToString(); _rSl.Label = controllerConfig.RightJoycon.ButtonSl.ToString(); _rSr.Label = controllerConfig.RightJoycon.ButtonSr.ToString(); _controllerDeadzoneLeft.Value = controllerConfig.DeadzoneLeft; _controllerDeadzoneRight.Value = controllerConfig.DeadzoneRight; _controllerTriggerThreshold.Value = controllerConfig.TriggerThreshold; _slotNumber.Value = controllerConfig.Slot; _altSlotNumber.Value = controllerConfig.AltSlot; _sensitivity.Value = controllerConfig.Sensitivity; _gyroDeadzone.Value = controllerConfig.GyroDeadzone; _enableMotion.Active = controllerConfig.EnableMotion; _mirrorInput.Active = controllerConfig.MirrorInput; _dsuServerHost.Buffer.Text = controllerConfig.DsuServerHost; _dsuServerPort.Buffer.Text = controllerConfig.DsuServerPort.ToString(); break; } }
private SettingsWindow(Builder builder, VirtualFileSystem virtualFileSystem, HLE.FileSystem.Content.ContentManager contentManager) : base(builder.GetObject("_settingsWin").Handle) { builder.Autoconnect(this); this.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.Icon.png"); _virtualFileSystem = virtualFileSystem; _timeZoneContentManager = new TimeZoneContentManager(); _timeZoneContentManager.InitializeInstance(virtualFileSystem, contentManager, LibHac.FsSystem.IntegrityCheckLevel.None); _validTzRegions = new HashSet <string>(_timeZoneContentManager.LocationNameCache.Length, StringComparer.Ordinal); // Zone regions are identifiers. Must match exactly. //Bind Events _configureController1.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player1); _configureController2.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player2); _configureController3.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player3); _configureController4.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player4); _configureController5.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player5); _configureController6.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player6); _configureController7.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player7); _configureController8.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player8); _configureControllerH.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Handheld); _systemTimeZoneEntry.FocusOutEvent += TimeZoneEntry_FocusOut; _resScaleCombo.Changed += (sender, args) => _resScaleText.Visible = _resScaleCombo.ActiveId == "-1"; //Setup Currents if (ConfigurationState.Instance.Logger.EnableFileLog) { _fileLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableError) { _errorLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableWarn) { _warningLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableInfo) { _infoLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableStub) { _stubLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableDebug) { _debugLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableGuest) { _guestLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableFsAccessLog) { _fsAccessLogToggle.Click(); } if (ConfigurationState.Instance.System.EnableDockedMode) { _dockedModeToggle.Click(); } if (ConfigurationState.Instance.EnableDiscordIntegration) { _discordToggle.Click(); } if (ConfigurationState.Instance.Graphics.EnableVsync) { _vSyncToggle.Click(); } if (ConfigurationState.Instance.System.EnableMulticoreScheduling) { _multiSchedToggle.Click(); } if (ConfigurationState.Instance.System.EnablePtc) { _ptcToggle.Click(); } if (ConfigurationState.Instance.System.EnableFsIntegrityChecks) { _fsicToggle.Click(); } if (ConfigurationState.Instance.System.IgnoreMissingServices) { _ignoreToggle.Click(); } if (ConfigurationState.Instance.Hid.EnableKeyboard) { _directKeyboardAccess.Click(); } if (ConfigurationState.Instance.Ui.EnableCustomTheme) { _custThemeToggle.Click(); } Task.Run(() => { if (SoundIoAudioOut.IsSupported) { Application.Invoke(delegate { _audioBackendSelect.Append(AudioBackend.SoundIo.ToString(), "SoundIO"); }); } if (OpenALAudioOut.IsSupported) { Application.Invoke(delegate { _audioBackendSelect.Append(AudioBackend.OpenAl.ToString(), "OpenAL"); }); } Application.Invoke(delegate { _audioBackendSelect.SetActiveId(ConfigurationState.Instance.System.AudioBackend.Value.ToString()); }); }); // Custom EntryCompletion Columns. If added to glade, need to override more signals ListStore tzList = new ListStore(typeof(string), typeof(string), typeof(string)); _systemTimeZoneCompletion.Model = tzList; CellRendererText offsetCol = new CellRendererText(); CellRendererText abbrevCol = new CellRendererText(); _systemTimeZoneCompletion.PackStart(offsetCol, false); _systemTimeZoneCompletion.AddAttribute(offsetCol, "text", 0); _systemTimeZoneCompletion.TextColumn = 1; // Regions Column _systemTimeZoneCompletion.PackStart(abbrevCol, false); _systemTimeZoneCompletion.AddAttribute(abbrevCol, "text", 2); int maxLocationLength = 0; foreach (var(offset, location, abbr) in _timeZoneContentManager.ParseTzOffsets()) { var hours = Math.DivRem(offset, 3600, out int seconds); var minutes = Math.Abs(seconds) / 60; var abbr2 = (abbr.StartsWith('+') || abbr.StartsWith('-')) ? string.Empty : abbr; tzList.AppendValues($"UTC{hours:+0#;-0#;+00}:{minutes:D2} ", location, abbr2); _validTzRegions.Add(location); maxLocationLength = Math.Max(maxLocationLength, location.Length); } _systemTimeZoneEntry.WidthChars = Math.Max(20, maxLocationLength + 1); // Ensure minimum Entry width _systemTimeZoneEntry.Text = _timeZoneContentManager.SanityCheckDeviceLocationName(); _systemTimeZoneCompletion.MatchFunc = TimeZoneMatchFunc; _systemLanguageSelect.SetActiveId(ConfigurationState.Instance.System.Language.Value.ToString()); _systemRegionSelect.SetActiveId(ConfigurationState.Instance.System.Region.Value.ToString()); _resScaleCombo.SetActiveId(ConfigurationState.Instance.Graphics.ResScale.Value.ToString()); _anisotropy.SetActiveId(ConfigurationState.Instance.Graphics.MaxAnisotropy.Value.ToString()); _custThemePath.Buffer.Text = ConfigurationState.Instance.Ui.CustomThemePath; _resScaleText.Buffer.Text = ConfigurationState.Instance.Graphics.ResScaleCustom.Value.ToString(); _resScaleText.Visible = _resScaleCombo.ActiveId == "-1"; _graphicsShadersDumpPath.Buffer.Text = ConfigurationState.Instance.Graphics.ShadersDumpPath; _fsLogSpinAdjustment.Value = ConfigurationState.Instance.System.FsGlobalAccessLogMode; _systemTimeOffset = ConfigurationState.Instance.System.SystemTimeOffset; _gameDirsBox.AppendColumn("", new CellRendererText(), "text", 0); _gameDirsBoxStore = new ListStore(typeof(string)); _gameDirsBox.Model = _gameDirsBoxStore; foreach (string gameDir in ConfigurationState.Instance.Ui.GameDirs.Value) { _gameDirsBoxStore.AppendValues(gameDir); } if (_custThemeToggle.Active == false) { _custThemePath.Sensitive = false; _custThemePathLabel.Sensitive = false; _browseThemePath.Sensitive = false; } //Setup system time spinners UpdateSystemTimeSpinners(); }