Exemplo n.º 1
0
        private void SettingsChangedDelegate()
        {
            EmulatorSettings        settings    = EmulatorSettings.Current;
            IsolatedStorageSettings isoSettings = IsolatedStorageSettings.ApplicationSettings;

            isoSettings[SettingsPage.EnableSoundKey]    = settings.SoundEnabled;
            isoSettings[SettingsPage.VControllerPosKey] = settings.VirtualControllerOnTop;
            isoSettings[SettingsPage.LowFreqModeKey]    = settings.LowFrequencyMode;
            //isoSettings[SettingsPage.LowFreqModeMeasuredKey] = settings.LowFrequencyModeMeasured;
            isoSettings[SettingsPage.VControllerSizeKey]        = settings.LargeVController;
            isoSettings[SettingsPage.VControllerButtonStyleKey] = settings.GrayVControllerButtons;
            isoSettings[SettingsPage.OrientationKey]            = settings.Orientation;
            isoSettings[SettingsPage.StretchKey]              = settings.FullscreenStretch;
            isoSettings[SettingsPage.ControllerScaleKey]      = settings.ControllerScale;
            isoSettings[SettingsPage.OpacityKey]              = settings.ControllerOpacity;
            isoSettings[SettingsPage.ImageScalingKey]         = settings.ImageScaling;
            isoSettings[SettingsPage.TurboFrameSkipKey]       = settings.TurboFrameSkip;
            isoSettings[SettingsPage.SyncAudioKey]            = settings.SynchronizeAudio;
            isoSettings[SettingsPage.PowerSaverKey]           = settings.PowerFrameSkip;
            isoSettings[SettingsPage.SkipFramesKey]           = settings.FrameSkip;
            isoSettings[SettingsPage.DPadStyleKey]            = settings.DPadStyle;
            isoSettings[SettingsPage.DeadzoneKey]             = settings.Deadzone;
            isoSettings[SettingsPage.CameraAssignKey]         = settings.CameraButtonAssignment;
            isoSettings[SettingsPage.ConfirmationKey]         = settings.HideConfirmationDialogs;
            isoSettings[SettingsPage.AutoIncKey]              = settings.AutoIncrementSavestates;
            isoSettings[SettingsPage.ConfirmationLoadKey]     = settings.HideLoadConfirmationDialogs;
            isoSettings[SettingsPage.SelectLastState]         = settings.SelectLastState;
            isoSettings[SettingsPage.CreateManualSnapshotKey] = settings.ManualSnapshots;
            isoSettings.Save();
        }
Exemplo n.º 2
0
        private void ReadSettings()
        {
            EmulatorSettings emuSettings = EmulatorSettings.Current;

            this.vcontrollerPosSwitch.IsChecked   = emuSettings.VirtualControllerOnTop;
            this.enableSoundSwitch.IsChecked      = emuSettings.SoundEnabled;
            this.lowFreqSwitch.IsChecked          = emuSettings.LowFrequencyMode;
            this.vcontrollerSizeSwitch.IsChecked  = emuSettings.LargeVController;
            this.vcontrollerStyleSwitch.IsChecked = emuSettings.GrayVControllerButtons;
            this.stretchToggle.IsChecked          = emuSettings.FullscreenStretch;
            this.scaleSlider.Value                = emuSettings.ControllerScale;
            this.opacitySlider.Value              = emuSettings.ControllerOpacity;
            this.imageScaleSlider.Value           = emuSettings.ImageScaling;
            this.deadzoneSlider.Value             = emuSettings.Deadzone;
            this.syncSoundSwitch.IsChecked        = emuSettings.SynchronizeAudio;
            this.confirmationSwitch.IsChecked     = emuSettings.HideConfirmationDialogs;
            this.autoIncSwitch.IsChecked          = emuSettings.AutoIncrementSavestates;
            this.confirmationLoadSwitch.IsChecked = emuSettings.HideLoadConfirmationDialogs;
            this.restoreLastStateSwitch.IsChecked = emuSettings.SelectLastState;
            this.manualSnapshotSwitch.IsChecked   = emuSettings.ManualSnapshots;

            this.Loaded += (o, e) =>
            {
                this.dpadStyleBox.SelectedIndex         = emuSettings.DPadStyle;
                this.powerFrameSkipPicker.SelectedIndex = emuSettings.PowerFrameSkip;
                this.frameSkipPicker.SelectedIndex      = Math.Min(emuSettings.FrameSkip + 1, this.frameSkipPicker.Items.Count - 1);
                this.turboFrameSkipPicker.SelectedIndex = Math.Min(emuSettings.TurboFrameSkip - 1, this.turboFrameSkipPicker.Items.Count - 1);
                this.orientationPicker.SelectedIndex    = emuSettings.Orientation;
                this.assignPicker.SelectedIndex         = emuSettings.CameraButtonAssignment;
                initdone = true;
            };
        }
Exemplo n.º 3
0
        private void okButton_click(object sender, EventArgs e)
        {
            int[] cpos = new int[18];
            m_d3dBackground.GetControllerPosition(cpos);

            if (orientation == 2) //portrait
            {
                //save to setting object
                EmulatorSettings.Current.PadCenterXP  = cpos[0];
                EmulatorSettings.Current.PadCenterYP  = cpos[1];
                EmulatorSettings.Current.ALeftP       = cpos[2];
                EmulatorSettings.Current.ATopP        = cpos[3];
                EmulatorSettings.Current.BLeftP       = cpos[4];
                EmulatorSettings.Current.BTopP        = cpos[5];
                EmulatorSettings.Current.StartLeftP   = cpos[6];
                EmulatorSettings.Current.StartTopP    = cpos[7];
                EmulatorSettings.Current.SelectRightP = cpos[8];
                EmulatorSettings.Current.SelectTopP   = cpos[9];
                EmulatorSettings.Current.LLeftP       = cpos[10];
                EmulatorSettings.Current.LTopP        = cpos[11];
                EmulatorSettings.Current.RRightP      = cpos[12];
                EmulatorSettings.Current.RTopP        = cpos[13];
                EmulatorSettings.Current.TurboLeftP   = cpos[14];
                EmulatorSettings.Current.TurboTopP    = cpos[15];
                EmulatorSettings.Current.ComboLeftP   = cpos[16];
                EmulatorSettings.Current.ComboTopP    = cpos[17];

                //save to disk
                IsolatedStorageSettings isoSettings = IsolatedStorageSettings.ApplicationSettings;
                EmulatorSettings        settings    = EmulatorSettings.Current;

                isoSettings[SettingsPage.PadCenterXPKey]  = cpos[0];
                isoSettings[SettingsPage.PadCenterYPKey]  = cpos[1];
                isoSettings[SettingsPage.ALeftPKey]       = cpos[2];
                isoSettings[SettingsPage.ATopPKey]        = cpos[3];
                isoSettings[SettingsPage.BLeftPKey]       = cpos[4];
                isoSettings[SettingsPage.BTopPKey]        = cpos[5];
                isoSettings[SettingsPage.StartLeftPKey]   = cpos[6];
                isoSettings[SettingsPage.StartTopPKey]    = cpos[7];
                isoSettings[SettingsPage.SelectRightPKey] = cpos[8];
                isoSettings[SettingsPage.SelectTopPKey]   = cpos[9];
                isoSettings[SettingsPage.LLeftPKey]       = cpos[10];
                isoSettings[SettingsPage.LTopPKey]        = cpos[11];
                isoSettings[SettingsPage.RRightPKey]      = cpos[12];
                isoSettings[SettingsPage.RTopPKey]        = cpos[13];
                isoSettings[SettingsPage.TurboLeftPKey]   = cpos[14];
                isoSettings[SettingsPage.TurboTopPKey]    = cpos[15];
                isoSettings[SettingsPage.ComboLeftPKey]   = cpos[16];
                isoSettings[SettingsPage.ComboTopPKey]    = cpos[17];

                isoSettings.Save();
            }
            else
            {
                //save to setting object
                EmulatorSettings.Current.PadCenterXL  = cpos[0];
                EmulatorSettings.Current.PadCenterYL  = cpos[1];
                EmulatorSettings.Current.ALeftL       = cpos[2];
                EmulatorSettings.Current.ATopL        = cpos[3];
                EmulatorSettings.Current.BLeftL       = cpos[4];
                EmulatorSettings.Current.BTopL        = cpos[5];
                EmulatorSettings.Current.StartLeftL   = cpos[6];
                EmulatorSettings.Current.StartTopL    = cpos[7];
                EmulatorSettings.Current.SelectRightL = cpos[8];
                EmulatorSettings.Current.SelectTopL   = cpos[9];
                EmulatorSettings.Current.LLeftL       = cpos[10];
                EmulatorSettings.Current.LTopL        = cpos[11];
                EmulatorSettings.Current.RRightL      = cpos[12];
                EmulatorSettings.Current.RTopL        = cpos[13];
                EmulatorSettings.Current.TurboLeftL   = cpos[14];
                EmulatorSettings.Current.TurboTopL    = cpos[15];
                EmulatorSettings.Current.ComboLeftL   = cpos[16];
                EmulatorSettings.Current.ComboTopL    = cpos[17];

                //save to disk
                IsolatedStorageSettings isoSettings = IsolatedStorageSettings.ApplicationSettings;
                EmulatorSettings        settings    = EmulatorSettings.Current;

                isoSettings[SettingsPage.PadCenterXLKey]  = cpos[0];
                isoSettings[SettingsPage.PadCenterYLKey]  = cpos[1];
                isoSettings[SettingsPage.ALeftLKey]       = cpos[2];
                isoSettings[SettingsPage.ATopLKey]        = cpos[3];
                isoSettings[SettingsPage.BLeftLKey]       = cpos[4];
                isoSettings[SettingsPage.BTopLKey]        = cpos[5];
                isoSettings[SettingsPage.StartLeftLKey]   = cpos[6];
                isoSettings[SettingsPage.StartTopLKey]    = cpos[7];
                isoSettings[SettingsPage.SelectRightLKey] = cpos[8];
                isoSettings[SettingsPage.SelectTopLKey]   = cpos[9];
                isoSettings[SettingsPage.LLeftLKey]       = cpos[10];
                isoSettings[SettingsPage.LTopLKey]        = cpos[11];
                isoSettings[SettingsPage.RRightLKey]      = cpos[12];
                isoSettings[SettingsPage.RTopLKey]        = cpos[13];
                isoSettings[SettingsPage.TurboLeftLKey]   = cpos[14];
                isoSettings[SettingsPage.TurboTopLKey]    = cpos[15];
                isoSettings[SettingsPage.ComboLeftLKey]   = cpos[16];
                isoSettings[SettingsPage.ComboTopLKey]    = cpos[17];

                isoSettings.Save();
            }

            if (this.NavigationService.CanGoBack)
            {
                this.NavigationService.GoBack();
            }
        }
Exemplo n.º 4
0
        private void ReadSettings()
        {
            EmulatorSettings emuSettings = EmulatorSettings.Current;

            this.vcontrollerPosSwitch.IsChecked = emuSettings.VirtualControllerOnTop;
            this.enableSoundSwitch.IsChecked    = emuSettings.SoundEnabled;
            this.lowFreqSwitch.IsChecked        = emuSettings.LowFrequencyMode;
            //this.stretchToggle.IsChecked = emuSettings.FullscreenStretch;
            this.scaleSlider.Value                = emuSettings.ControllerScale;
            this.opacitySlider.Value              = emuSettings.ControllerOpacity;
            this.imageScaleSlider.Value           = emuSettings.ImageScaling;
            this.deadzoneSlider.Value             = emuSettings.Deadzone;
            this.syncSoundSwitch.IsChecked        = emuSettings.SynchronizeAudio;
            this.confirmationSwitch.IsChecked     = emuSettings.HideConfirmationDialogs;
            this.autoIncSwitch.IsChecked          = emuSettings.AutoIncrementSavestates;
            this.confirmationLoadSwitch.IsChecked = emuSettings.HideLoadConfirmationDialogs;
            this.restoreLastStateSwitch.IsChecked = emuSettings.SelectLastState;
            this.cheatRestoreSwitch.IsChecked     = emuSettings.RestoreOldCheatValues;
            this.manualSnapshotSwitch.IsChecked   = emuSettings.ManualSnapshots;

            this.Loaded += (o, e) =>
            {
                switch (emuSettings.Orientation)
                {
                default:
                case 0:
                    this.orientationBothRadio.IsChecked = true;
                    break;

                case 1:
                    this.orientationLandscapeRadio.IsChecked = true;
                    break;

                case 2:
                    this.orientationPortraitRadio.IsChecked = true;
                    break;
                }

#if GBC
                switch (emuSettings.TurboFrameSkip)
                {
                default:
                case 2:
                    this.turboSkip1Radio.IsChecked = true;
                    break;

                case 4:
                    this.turboSkip2Radio.IsChecked = true;
                    break;

                case 6:
                    this.turboSkip3Radio.IsChecked = true;
                    break;

                case 8:
                    this.turboSkip4Radio.IsChecked = true;
                    break;

                case 10:
                    this.turboSkip5Radio.IsChecked = true;
                    break;
                }
#else
                switch (emuSettings.TurboFrameSkip)
                {
                default:
                case 1:
                    this.turboSkip1Radio.IsChecked = true;
                    break;

                case 2:
                    this.turboSkip2Radio.IsChecked = true;
                    break;

                case 3:
                    this.turboSkip3Radio.IsChecked = true;
                    break;

                case 4:
                    this.turboSkip4Radio.IsChecked = true;
                    break;

                case 5:
                    this.turboSkip5Radio.IsChecked = true;
                    break;
                }
#endif
                switch (emuSettings.PowerFrameSkip)
                {
                default:
                case 0:
                    this.powerSkip0Radio.IsChecked = true;
                    break;

                case 1:
                    this.powerSkip1Radio.IsChecked = true;
                    break;

                case 2:
                    this.powerSkip2Radio.IsChecked = true;
                    break;
                }
                switch (emuSettings.FrameSkip)
                {
                case -1:
                    this.skipAutoRadio.IsChecked = true;
                    break;

                default:
                case 0:
                    this.skip0Radio.IsChecked = true;
                    break;

                case 1:
                    this.skip1Radio.IsChecked = true;
                    break;

                case 2:
                    this.skip2Radio.IsChecked = true;
                    break;

                case 3:
                    this.skip3Radio.IsChecked = true;
                    break;
                }

                switch (emuSettings.DPadStyle)
                {
                default:
                case 0:
                    this.dpadStandardRadio.IsChecked = true;
                    break;

                case 1:
                    this.dpadFixedRadio.IsChecked = true;
                    break;

                case 2:
                    this.dpadDynamicRadio.IsChecked = true;
                    break;
                }

                switch (emuSettings.CameraButtonAssignment)
                {
                default:
                case 0:
                    this.cameraTurboRadio.IsChecked = true;
                    break;

                case 1:
                    this.cameraRRadio.IsChecked = true;
                    break;

                case 2:
                    this.cameraLRadio.IsChecked = true;
                    break;
                }

                switch (emuSettings.AspectRatio)
                {
                default:
                case AspectRatioMode.Original:
                    this.aspect32Radio.IsChecked = true;
                    break;

                case AspectRatioMode.Stretch:
                    this.aspectStretchRadio.IsChecked = true;
                    break;

                case AspectRatioMode.FourToThree:
                    this.aspect43Radio.IsChecked = true;
                    break;

                case AspectRatioMode.FiveToFour:
                    this.aspect54Radio.IsChecked = true;
                    break;

                case AspectRatioMode.One:
                    this.aspect1Radio.IsChecked = true;
                    break;
                }
                initdone = true;
            };
        }
Exemplo n.º 5
0
        private void LoadInitialSettings()
        {
            EmulatorSettings settings = EmulatorSettings.Current;

            if (!settings.Initialized)
            {
                IsolatedStorageSettings isoSettings = IsolatedStorageSettings.ApplicationSettings;
                settings.Initialized = true;

                if (!isoSettings.Contains(SettingsPage.EnableSoundKey))
                {
                    isoSettings[SettingsPage.EnableSoundKey] = true;
                }
                if (!isoSettings.Contains(SettingsPage.VControllerPosKey))
                {
                    isoSettings[SettingsPage.VControllerPosKey] = false;
                }
                if (!isoSettings.Contains(SettingsPage.LowFreqModeKey))
                {
                    isoSettings[SettingsPage.LowFreqModeKey] = false;
                }
                //if (!isoSettings.Contains(SettingsPage.LowFreqModeMeasuredKey))
                //{
                //    isoSettings[SettingsPage.LowFreqModeMeasuredKey] = false;
                //}
                if (!isoSettings.Contains(SettingsPage.VControllerSizeKey))
                {
                    isoSettings[SettingsPage.VControllerSizeKey] = false;
                }
                if (!isoSettings.Contains(SettingsPage.VControllerButtonStyleKey))
                {
                    isoSettings[SettingsPage.VControllerButtonStyleKey] = false;
                }
                if (!isoSettings.Contains(SettingsPage.StretchKey))
                {
                    isoSettings[SettingsPage.StretchKey] = false;
                }
                if (!isoSettings.Contains(SettingsPage.OrientationKey))
                {
                    isoSettings[SettingsPage.OrientationKey] = 0;
                }
                if (!isoSettings.Contains(SettingsPage.ControllerScaleKey))
                {
                    isoSettings[SettingsPage.ControllerScaleKey] = 100;
                }
                if (!isoSettings.Contains(SettingsPage.OpacityKey))
                {
                    isoSettings[SettingsPage.OpacityKey] = 30;
                }
                if (!isoSettings.Contains(SettingsPage.SkipFramesKey))
                {
                    isoSettings[SettingsPage.SkipFramesKey] = 0;
                }
                if (!isoSettings.Contains(SettingsPage.TurboFrameSkipKey))
                {
                    isoSettings[SettingsPage.TurboFrameSkipKey] = 4;
                }
                if (!isoSettings.Contains(SettingsPage.SyncAudioKey))
                {
                    isoSettings[SettingsPage.SyncAudioKey] = true;
                }
                if (!isoSettings.Contains(SettingsPage.PowerSaverKey))
                {
                    isoSettings[SettingsPage.PowerSaverKey] = 0;
                }
                if (!isoSettings.Contains(SettingsPage.DPadStyleKey))
                {
                    isoSettings[SettingsPage.DPadStyleKey] = 1;
                }
                if (!isoSettings.Contains(SettingsPage.DeadzoneKey))
                {
                    isoSettings[SettingsPage.DeadzoneKey] = 10.0f;
                }
                if (!isoSettings.Contains(SettingsPage.ImageScalingKey))
                {
                    isoSettings[SettingsPage.ImageScalingKey] = 100;
                }
                if (!isoSettings.Contains(SettingsPage.CameraAssignKey))
                {
                    isoSettings[SettingsPage.CameraAssignKey] = 0;
                }
                if (!isoSettings.Contains(SettingsPage.ConfirmationKey))
                {
                    isoSettings[SettingsPage.ConfirmationKey] = false;
                }
                if (!isoSettings.Contains(SettingsPage.ConfirmationLoadKey))
                {
                    isoSettings[SettingsPage.ConfirmationLoadKey] = false;
                }
                if (!isoSettings.Contains(SettingsPage.AutoIncKey))
                {
                    isoSettings[SettingsPage.AutoIncKey] = false;
                }
                if (!isoSettings.Contains(SettingsPage.SelectLastState))
                {
                    isoSettings[SettingsPage.SelectLastState] = true;
                }
                if (!isoSettings.Contains(SettingsPage.CreateManualSnapshotKey))
                {
                    isoSettings[SettingsPage.CreateManualSnapshotKey] = false;
                }
                isoSettings.Save();

                settings.LowFrequencyMode       = (bool)isoSettings[SettingsPage.LowFreqModeKey];
                settings.SoundEnabled           = (bool)isoSettings[SettingsPage.EnableSoundKey];
                settings.VirtualControllerOnTop = (bool)isoSettings[SettingsPage.VControllerPosKey];
                //settings.LowFrequencyModeMeasured = (bool)isoSettings[SettingsPage.LowFreqModeMeasuredKey];
                settings.LargeVController       = (bool)isoSettings[SettingsPage.VControllerSizeKey];
                settings.GrayVControllerButtons = (bool)isoSettings[SettingsPage.VControllerButtonStyleKey];
                settings.Orientation            = (int)isoSettings[SettingsPage.OrientationKey];
                settings.FullscreenStretch      = (bool)isoSettings[SettingsPage.StretchKey];
                settings.ControllerScale        = (int)isoSettings[SettingsPage.ControllerScaleKey];
                settings.ControllerOpacity      = (int)isoSettings[SettingsPage.OpacityKey];
                settings.FrameSkip                   = (int)isoSettings[SettingsPage.SkipFramesKey];
                settings.ImageScaling                = (int)isoSettings[SettingsPage.ImageScalingKey];
                settings.TurboFrameSkip              = (int)isoSettings[SettingsPage.TurboFrameSkipKey];
                settings.SynchronizeAudio            = (bool)isoSettings[SettingsPage.SyncAudioKey];
                settings.PowerFrameSkip              = (int)isoSettings[SettingsPage.PowerSaverKey];
                settings.DPadStyle                   = (int)isoSettings[SettingsPage.DPadStyleKey];
                settings.Deadzone                    = (float)isoSettings[SettingsPage.DeadzoneKey];
                settings.CameraButtonAssignment      = (int)isoSettings[SettingsPage.CameraAssignKey];
                settings.AutoIncrementSavestates     = (bool)isoSettings[SettingsPage.AutoIncKey];
                settings.HideConfirmationDialogs     = (bool)isoSettings[SettingsPage.ConfirmationKey];
                settings.HideLoadConfirmationDialogs = (bool)isoSettings[SettingsPage.ConfirmationLoadKey];
                settings.SelectLastState             = (bool)isoSettings[SettingsPage.SelectLastState];
                settings.ManualSnapshots             = (bool)isoSettings[SettingsPage.CreateManualSnapshotKey];

                settings.SettingsChanged = this.SettingsChangedDelegate;
            }
        }
Exemplo n.º 6
0
        private void LoadInitialSettings()
        {
            EmulatorSettings settings = EmulatorSettings.Current;

            if (!settings.Initialized)
            {
                IsolatedStorageSettings isoSettings = IsolatedStorageSettings.ApplicationSettings;
                settings.Initialized = true;

                if (!isoSettings.Contains(SettingsPage.EnableSoundKey))
                {
                    isoSettings[SettingsPage.EnableSoundKey] = true;
                }
                if (!isoSettings.Contains(SettingsPage.VControllerPosKey))
                {
                    isoSettings[SettingsPage.VControllerPosKey] = false;
                }
                if (!isoSettings.Contains(SettingsPage.LowFreqModeKey))
                {
                    isoSettings[SettingsPage.LowFreqModeKey] = false;
                }
                //if (!isoSettings.Contains(SettingsPage.LowFreqModeMeasuredKey))
                //{
                //    isoSettings[SettingsPage.LowFreqModeMeasuredKey] = false;
                //}
                if (!isoSettings.Contains(SettingsPage.OrientationKey))
                {
                    isoSettings[SettingsPage.OrientationKey] = 0;
                }
                if (!isoSettings.Contains(SettingsPage.ControllerScaleKey))
                {
                    isoSettings[SettingsPage.ControllerScaleKey] = 100;
                }
                if (!isoSettings.Contains(SettingsPage.OpacityKey))
                {
                    isoSettings[SettingsPage.OpacityKey] = 30;
                }
                if (!isoSettings.Contains(SettingsPage.AspectKey))
                {
                    isoSettings[SettingsPage.AspectKey] = AspectRatioMode.Original;
                }
                if (!isoSettings.Contains(SettingsPage.SkipFramesKey))
                {
                    isoSettings[SettingsPage.SkipFramesKey] = 0;
                }
                if (!isoSettings.Contains(SettingsPage.ImageScalingKey))
                {
                    isoSettings[SettingsPage.ImageScalingKey] = 100;
                }
                if (!isoSettings.Contains(SettingsPage.TurboFrameSkipKey))
                {
#if GBC
                    // Must be divisible by two for GBC
                    isoSettings[SettingsPage.TurboFrameSkipKey] = 6;
#else
                    isoSettings[SettingsPage.TurboFrameSkipKey] = 4;
#endif
                }
                if (!isoSettings.Contains(SettingsPage.SyncAudioKey))
                {
                    isoSettings[SettingsPage.SyncAudioKey] = true;
                }
                if (!isoSettings.Contains(SettingsPage.PowerSaverKey))
                {
                    isoSettings[SettingsPage.PowerSaverKey] = 0;
                }
                if (!isoSettings.Contains(SettingsPage.DPadStyleKey))
                {
                    isoSettings[SettingsPage.DPadStyleKey] = 1;
                }
                if (!isoSettings.Contains(SettingsPage.DeadzoneKey))
                {
                    isoSettings[SettingsPage.DeadzoneKey] = 10.0f;
                }
                if (!isoSettings.Contains(SettingsPage.CameraAssignKey))
                {
                    isoSettings[SettingsPage.CameraAssignKey] = 0;
                }
                if (!isoSettings.Contains(SettingsPage.ConfirmationKey))
                {
                    isoSettings[SettingsPage.ConfirmationKey] = false;
                }
                if (!isoSettings.Contains(SettingsPage.ConfirmationLoadKey))
                {
                    isoSettings[SettingsPage.ConfirmationLoadKey] = false;
                }
                if (!isoSettings.Contains(SettingsPage.AutoIncKey))
                {
                    isoSettings[SettingsPage.AutoIncKey] = false;
                }
                if (!isoSettings.Contains(SettingsPage.SelectLastState))
                {
                    isoSettings[SettingsPage.SelectLastState] = true;
                }
                if (!isoSettings.Contains(SettingsPage.RestoreCheatKey))
                {
                    isoSettings[SettingsPage.RestoreCheatKey] = false;
                }
                if (!isoSettings.Contains(SettingsPage.CreateManualSnapshotKey))
                {
                    isoSettings[SettingsPage.CreateManualSnapshotKey] = false;
                }
                isoSettings.Save();

                settings.LowFrequencyMode       = (bool)isoSettings[SettingsPage.LowFreqModeKey];
                settings.SoundEnabled           = (bool)isoSettings[SettingsPage.EnableSoundKey];
                settings.VirtualControllerOnTop = (bool)isoSettings[SettingsPage.VControllerPosKey];
                //settings.LowFrequencyModeMeasured = (bool)isoSettings[SettingsPage.LowFreqModeMeasuredKey];
                settings.Orientation                 = (int)isoSettings[SettingsPage.OrientationKey];
                settings.ControllerScale             = (int)isoSettings[SettingsPage.ControllerScaleKey];
                settings.ControllerOpacity           = (int)isoSettings[SettingsPage.OpacityKey];
                settings.AspectRatio                 = (AspectRatioMode)isoSettings[SettingsPage.AspectKey];
                settings.FrameSkip                   = (int)isoSettings[SettingsPage.SkipFramesKey];
                settings.ImageScaling                = (int)isoSettings[SettingsPage.ImageScalingKey];
                settings.TurboFrameSkip              = (int)isoSettings[SettingsPage.TurboFrameSkipKey];
                settings.SynchronizeAudio            = (bool)isoSettings[SettingsPage.SyncAudioKey];
                settings.PowerFrameSkip              = (int)isoSettings[SettingsPage.PowerSaverKey];
                settings.DPadStyle                   = (int)isoSettings[SettingsPage.DPadStyleKey];
                settings.Deadzone                    = (float)isoSettings[SettingsPage.DeadzoneKey];
                settings.CameraButtonAssignment      = (int)isoSettings[SettingsPage.CameraAssignKey];
                settings.AutoIncrementSavestates     = (bool)isoSettings[SettingsPage.AutoIncKey];
                settings.HideConfirmationDialogs     = (bool)isoSettings[SettingsPage.ConfirmationKey];
                settings.HideLoadConfirmationDialogs = (bool)isoSettings[SettingsPage.ConfirmationLoadKey];
                settings.SelectLastState             = (bool)isoSettings[SettingsPage.SelectLastState];
                settings.RestoreOldCheatValues       = (bool)isoSettings[SettingsPage.RestoreCheatKey];
                settings.ManualSnapshots             = (bool)isoSettings[SettingsPage.CreateManualSnapshotKey];

                settings.SettingsChanged = this.SettingsChangedDelegate;
            }
        }
Exemplo n.º 7
0
        private void ReadSettings()
        {
            EmulatorSettings emuSettings = EmulatorSettings.Current;


            this.enableSoundSwitch.IsChecked = emuSettings.SoundEnabled;
            this.lowFreqSwitch.IsChecked     = emuSettings.LowFrequencyMode;

            this.scaleSlider.Value                = emuSettings.ControllerScale;
            this.buttonScaleSlider.Value          = emuSettings.ButtonScale;
            this.opacitySlider.Value              = emuSettings.ControllerOpacity;
            this.imageScaleSlider.Value           = emuSettings.ImageScaling;
            this.deadzoneSlider.Value             = emuSettings.Deadzone;
            this.syncSoundSwitch.IsChecked        = emuSettings.SynchronizeAudio;
            this.confirmationSwitch.IsChecked     = emuSettings.HideConfirmationDialogs;
            this.autoIncSwitch.IsChecked          = emuSettings.AutoIncrementSavestates;
            this.confirmationLoadSwitch.IsChecked = emuSettings.HideLoadConfirmationDialogs;
            //this.restoreLastStateSwitch.IsChecked = emuSettings.SelectLastState;
            this.cheatRestoreSwitch.IsChecked   = emuSettings.RestoreOldCheatValues;
            this.manualSnapshotSwitch.IsChecked = emuSettings.ManualSnapshots;


            this.showThreeDotsSwitch.IsChecked      = App.metroSettings.ShowThreeDots;
            this.showLastPlayedGameSwitch.IsChecked = App.metroSettings.ShowLastPlayedGame;
            this.loadLastStateSwitch.IsChecked      = emuSettings.AutoSaveLoad;

            this.autoBackupSwitch.IsChecked = App.metroSettings.AutoBackup;

            this.autoFireSwitch.IsChecked           = emuSettings.EnableAutoFire;
            this.mapABLRTurboSwitch.IsChecked       = emuSettings.MapABLRTurbo;
            this.fullPressStickABRLSwitch.IsChecked = emuSettings.FullPressStickABLR;
            this.useGameboyColorSwitch.IsChecked    = emuSettings.UseGameboyColor;
            this.useLinearFilterSwitch.IsChecked    = emuSettings.UseLinearFilter;

            if (App.metroSettings.BackgroundUri != null)
            {
                this.useBackgroundImageSwitch.IsChecked   = true;
                this.backgroundOpacityPanel.Visibility    = Visibility.Visible;
                this.ChooseBackgroundImageGrid.Visibility = Visibility.Visible;
            }
            else
            {
                this.useBackgroundImageSwitch.IsChecked   = false;
                this.backgroundOpacityPanel.Visibility    = Visibility.Collapsed;
                this.ChooseBackgroundImageGrid.Visibility = Visibility.Collapsed;
            }
            if (emuSettings.VirtualControllerStyle != 2)
            {
                CustomizeBgcolorBtn.Visibility = System.Windows.Visibility.Visible;
            }
            else
            {
                CustomizeBgcolorBtn.Visibility = System.Windows.Visibility.Collapsed;
            }


            if (this.autoBackupSwitch.IsChecked.Value)
            {
                SetupAutoBackupBtn.Visibility = System.Windows.Visibility.Visible;
            }
            else
            {
                SetupAutoBackupBtn.Visibility = System.Windows.Visibility.Collapsed;
            }


            this.chkUseAccentColor.IsChecked = App.metroSettings.UseAccentColor;


            this.toggleVibration.IsChecked = emuSettings.VibrationEnabled;

            if (emuSettings.VibrationEnabled)
            {
                this.txtVibrationDuration.Visibility = Visibility.Visible;
            }
            else
            {
                this.txtVibrationDuration.Visibility = Visibility.Collapsed;
            }

            this.toggleTurbo.IsChecked = emuSettings.UseTurbo;

            this.Loaded += (o, e) =>
            {
                this.turboFrameSkipPicker.SelectedIndex = emuSettings.TurboFrameSkip;
                //this.powerFrameSkipPicker.SelectedIndex = emuSettings.PowerFrameSkip;
                this.frameSkipPicker.SelectedIndex   = Math.Min(emuSettings.FrameSkip + 1, this.frameSkipPicker.Items.Count - 1);
                this.aspectRatioPicker.SelectedIndex = (int)emuSettings.AspectRatio;
                this.orientationPicker.SelectedIndex = emuSettings.Orientation;

                this.dpadStyleBox.SelectedIndex = emuSettings.DPadStyle;              //dpad, this need to be set after loaded because we set the items in xaml
                this.assignPicker.SelectedIndex = emuSettings.CameraButtonAssignment; //camera assignment



                if (emuSettings.CameraButtonAssignment == 0) //hide auto fire setting
                {
                    this.autoFireSwitch.Visibility           = Visibility.Collapsed;
                    this.mapABLRTurboSwitch.Visibility       = Visibility.Collapsed;
                    this.fullPressStickABRLSwitch.Visibility = Visibility.Collapsed;
                }
                else
                {
                    this.autoFireSwitch.Visibility           = Visibility.Visible;
                    this.mapABLRTurboSwitch.Visibility       = Visibility.Visible;
                    this.fullPressStickABRLSwitch.Visibility = Visibility.Visible;
                }

                this.themePicker.SelectedIndex = App.metroSettings.ThemeSelection;

                this.virtualControlStyleBox.SelectedIndex = emuSettings.VirtualControllerStyle;

                this.backgroundOpacitySlider.Value = App.metroSettings.BackgroundOpacity * 100;

                this.txtVibrationDuration.Text = emuSettings.VibrationDuration.ToString();


                this.motionControlBox.SelectedIndex = emuSettings.UseMotionControl;

                if (EmulatorSettings.Current.UseMotionControl == 0)
                {
                    MotionSettingBtn.Visibility = Visibility.Collapsed;
                }
                else
                {
                    MotionSettingBtn.Visibility = Visibility.Visible;
                }

                initdone = true;
            };
        }