public ControlMappingViewModel() { _captureState = CaptureState.NotCapturing; InitInGameConfigOptions(); _selectedGameConfigOption = InGameConfigurationMap.Where(s => s.Value == Sys.Settings.GameLaunchSettings.InGameConfigOption) .Select(c => c.Key) .FirstOrDefault(); if (string.IsNullOrWhiteSpace(SelectedGameConfigOption)) { // default to first option if their previous option is missing _selectedGameConfigOption = InGameConfigOptions[0]; } // setting private variables here so code in property setters are not executed (e.g update sys.settings and ui) _isPs4SupportChecked = Sys.Settings.GameLaunchSettings.EnablePs4ControllerService; _isDpadSupportChecked = Sys.Settings.GameLaunchSettings.EnableGamepadPolling; LoadSelectedConfiguration(); }
private void LoadSettings(LaunchSettings launchSettings) { HasLoaded = false; if (Sys.Settings.GameLaunchSettings == null) { Logger.Warn("No game launcher settings found, initializing to defaults."); Sys.Settings.GameLaunchSettings = LaunchSettings.DefaultSettings(); launchSettings = Sys.Settings.GameLaunchSettings; } ProgramList = new ObservableCollection <ProgramToRunViewModel>(Sys.Settings.ProgramsToLaunchPrior.Select(s => new ProgramToRunViewModel(s.PathToProgram, s.ProgramArgs))); AutoUpdatePathChecked = launchSettings.AutoUpdateDiscPath; Code5FixChecked = launchSettings.Code5Fix; HighDpiFixChecked = launchSettings.HighDpiFix; IsShowLauncherChecked = launchSettings.ShowLauncherWindow; SelectedGameConfigOption = InGameConfigurationMap.Where(s => s.Value == launchSettings.InGameConfigOption) .Select(c => c.Key) .FirstOrDefault(); if (string.IsNullOrWhiteSpace(SelectedGameConfigOption)) { // default to first option if their previous option is missing SelectedGameConfigOption = InGameConfigOptions[0]; } // disable options to auto-mount if user OS does not support it IsAutoMountSupported = GameLauncher.OSHasAutoMountSupport(); if (IsAutoMountSupported) { AutoMountChecked = launchSettings.AutoMountGameDisc; AutoUnmountChecked = launchSettings.AutoUnmountGameDisc; } else { AutoMountChecked = false; AutoUnmountChecked = false; } // Have option look unchecked and disabled when user does not have The Reunion installed IsReunionInstalled = GameLauncher.IsReunionModInstalled(); if (IsReunionInstalled) { DisableReunionChecked = launchSettings.DisableReunionOnLaunch; } else { DisableReunionChecked = false; IsReunionInstalled = false; } SelectedSoundDevice = SoundDeviceGuids.Where(s => s.Value == launchSettings.SelectedSoundDevice) .Select(s => s.Key) .FirstOrDefault(); // switch back to 'Auto' if device not found if (SelectedSoundDevice == null) { SelectedSoundDevice = SoundDeviceGuids.Where(s => s.Value == Guid.Empty) .Select(s => s.Key) .FirstOrDefault(); } SelectedMidiDevice = MidiDeviceMap.Where(s => s.Value == launchSettings.SelectedMidiDevice) .Select(s => s.Key) .FirstOrDefault(); MusicVolumeValue = launchSettings.MusicVolume; SfxVolumeValue = launchSettings.SfxVolume; IsReverseSpeakersChecked = launchSettings.ReverseSpeakers; IsLogVolumeChecked = launchSettings.LogarithmicVolumeControl; SelectedRenderer = RendererMap.Where(s => s.Value == launchSettings.SelectedRenderer) .Select(s => s.Key) .FirstOrDefault(); IsRivaOptionChecked = launchSettings.UseRiva128GraphicsOption; IsTntOptionChecked = launchSettings.UseTntGraphicsOption; IsQuarterScreenChecked = launchSettings.QuarterScreenMode; IsFullScreenChecked = launchSettings.FullScreenMode; HasLoaded = true; }