예제 #1
0
        private static bool AcceptFile(EmulatorFile whichFile, string path)
        {
            var acceptFile = !string.IsNullOrWhiteSpace(path) && System.IO.File.Exists(path);

            if (acceptFile)
            {
                switch (whichFile)
                {
                case EmulatorFile.JzIntv:
                    acceptFile = string.Compare(System.IO.Path.GetExtension(path), INTV.Shared.Utility.PathUtils.ProgramSuffix, true) == 0;
                    break;

                case EmulatorFile.Ecs:
                case EmulatorFile.Exec:
                case EmulatorFile.Grom:
                    acceptFile = ConfigurationCommandGroup.IsRomPathValid(path);
                    break;

                case EmulatorFile.KeyboardConfig:
                case EmulatorFile.Cgc0Config:
                case EmulatorFile.Cgc1Config:
                    break;

                default:
                    acceptFile = false;     // don't know what file this is for
                    break;
                }
            }
            return(acceptFile);
        }
예제 #2
0
        /// <inheritdoc />
        public override void AwakeFromNib()
        {
            // TODO: Delete this call?
            JzIntv.Model.Emulator.Instances(); // Why is this here? It doesn't have side effects.
            DisplayResolutionsArrayController.SynchronizeCollection(ViewModel.AvailableDisplayResolutions);
            _initializedDisplayResolutions = true;
            var selectedResolutionViewModel = ViewModel.SelectedDisplayResolutionViewModel;
            var selectedResolution          = selectedResolutionViewModel == null ? JzIntvSettingsPageViewModel.DefaultResolution : selectedResolutionViewModel.Resolution;

            selectedResolutionViewModel = ViewModel.AvailableDisplayResolutions.First(r => r.Resolution == selectedResolution);
            if (selectedResolutionViewModel != null)
            {
                var selectedIndex = ViewModel.AvailableDisplayResolutions.IndexOf(selectedResolutionViewModel);
                if (selectedIndex >= 0)
                {
                    DisplayResolutionsArrayController.SelectionIndex = (SelIndexType)selectedIndex;
                }
            }

            JzIntvDisplayModesController.SynchronizeCollection(ViewModel.AvailableDisplayModes);
            _initializeDisplayModes = true;
            var selectedModeViewModel = ViewModel.SelectedDisplayModeViewModel;
            var selectedMode          = selectedModeViewModel == null ? JzIntvSettingsPageViewModel.DefaultMode : selectedModeViewModel.DisplayMode;

            selectedModeViewModel = ViewModel.AvailableDisplayModes.First(m => m.DisplayMode == selectedMode);
            if (selectedModeViewModel != null)
            {
                var selectedIndex = ViewModel.AvailableDisplayModes.IndexOf(selectedModeViewModel);
                if (selectedIndex >= 0)
                {
                    JzIntvDisplayModesController.SelectionIndex = (SelIndexType)selectedIndex;
                }
            }

            if (LastSelectedTab == SelectedTab.None)
            {
                LastSelectedTab = ConfigurationCommandGroup.AreRequiredEmulatorPathsValid(false) ? SelectedTab.General : SelectedTab.Paths;
            }

            var tab = View.FindChild <NSTabView>();

            if (LastSelectedTab > SelectedTab.None)
            {
                tab.SelectAt((int)LastSelectedTab - 1);
            }

            InitializeAlwaysUpdateDelegates(tab);
            InitializeCommandLineModeRadioButtons(tab);

            tab.DidSelect  += OnTabSelected;
            View.Controller = this;
            HandleViewModelPropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(JzIntvSettingsPageViewModel.EnableIntellivoicePropertyName));
            HandleViewModelPropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(JzIntvSettingsPageViewModel.EnableEcsPropertyName));
            ViewModel.PropertyChanged += HandleViewModelPropertyChanged;
        }
예제 #3
0
        public JzIntvSettingsPageViewModel()
        {
            _emulatorPath = JzIntvLauncherConfiguration.Instance.EmulatorPath;
            _execRomPath  = Properties.Settings.Default.ExecRomPath;
            _gromRomPath  = Properties.Settings.Default.GromRomPath;
            _ecsRomPath   = Properties.Settings.Default.EcsRomPath;

            _defaultKeyboardConfigPath = Properties.Settings.Default.DefaultKeyboardConfigPath;
            _initialKeyboardMap        = KeyboardMapHelpers.FromSettingString(Properties.Settings.Default.InitialKeyboardMap);
            var maps = new[] { KeyboardMap.Default, KeyboardMap.LeftControllerOnly, KeyboardMap.EcsKeyboard };

            AvailableKeyboardMaps         = new ObservableCollection <KeyboardMapViewModel>(maps.Select(m => new KeyboardMapViewModel(m)));
            _selectedKeyboardMapViewModel = AvailableKeyboardMaps.First(m => m.KeyboardMap == _initialKeyboardMap);

            _jzIntvJoystick0Config = Properties.Settings.Default.Joystick0Config;
            _jzIntvJoystick1Config = Properties.Settings.Default.Joystick1Config;
            _jzIntvJoystick2Config = Properties.Settings.Default.Joystick2Config;
            _jzIntvJoystick3Config = Properties.Settings.Default.Joystick3Config;

            _jzIntvCgc0ConfigPath = Properties.Settings.Default.ClassicGameController0ConfigPath;
            _jzIntvCgc1ConfigPath = Properties.Settings.Default.ClassicGameController1ConfigPath;

            var resolutions = Enum.GetValues(typeof(DisplayResolution)).Cast <DisplayResolution>().Distinct();

            AvailableDisplayResolutions = new ObservableCollection <DisplayResolutionViewModel>(resolutions.Select(r => new DisplayResolutionViewModel(r)));
            var resolutionFromSettings = DisplayResolutionHelpers.FromLongCommandLineArgumentString(Properties.Settings.Default.DisplaySize);

            _selectedDisplayResolutionViewModel = AvailableDisplayResolutions.First(r => r.Resolution == resolutionFromSettings);
            _jzIntvDisplaySize = _selectedDisplayResolutionViewModel.DisplayResolution;

            var displayModes = Enum.GetValues(typeof(DisplayMode)).Cast <DisplayMode>().Distinct();

            AvailableDisplayModes = new ObservableCollection <DisplayModeViewModel>(displayModes.Select(m => new DisplayModeViewModel(m)));
            var modeFromSettings = DisplayModeHelpers.FromSettingString(Properties.Settings.Default.DisplayMode);

            _selectedDisplayModeViewModel = AvailableDisplayModes.First(m => m.DisplayMode == modeFromSettings);
            _jzIntvDisplayMode            = _selectedDisplayModeViewModel.Mode;

            _enableIntellivoice = EnableFeatureHelpers.FromSettingString(Properties.Settings.Default.EnableIntellivoice);
            _enableEcs          = EnableFeatureHelpers.FromSettingString(Properties.Settings.Default.EnableEcs);
            _enableJlp          = EnableFeatureHelpers.FromSettingString(Properties.Settings.Default.EnableJlp);

            _commandLineMode = CommandLineModeHelpers.FromSettingsString(Properties.Settings.Default.CommandLineMode);

            if ((_lastSelectedPageIndex < 0) && !ConfigurationCommandGroup.AreRequiredEmulatorPathsValid(false))
            {
                _lastSelectedPageIndex = 1;
            }

            _status = Commands.ConfigurationCommandGroup.GetConfigurationStatus(true);
            UpdateStatusColor();

            Properties.Settings.Default.PropertyChanged += HandleEmulatorSettingsChanged;
        }
예제 #4
0
        private void UpdateStatusColor()
        {
            var color = INTV.Core.Model.Stic.Color.Black.ToColor();

            if (!ConfigurationCommandGroup.IsEmulatorPathValid() || !ConfigurationCommandGroup.IsExecRomPathvalid(ExecRomPath) || !ConfigurationCommandGroup.IsGromRomPathValid(GromRomPath))
            {
                color = INTV.Core.Model.Stic.Color.Red.ToColor();
            }
            else if (!ConfigurationCommandGroup.IsEcsRomPathValid(EcsRomPath))
            {
                color = INTV.Core.Model.Stic.Color.Orange.ToColor();
            }
            ConfigurationStatusColor = color;
        }