Esempio n. 1
0
        public void ApplyConfig()
        {
            if (Program.IsMono)
            {
                FileAssociationHelper.ConfigureLinuxMimeTypes();
            }
            else
            {
                FileAssociationHelper.UpdateFileAssociation("sfc", this.AssociateRomFiles);
                FileAssociationHelper.UpdateFileAssociation("smc", this.AssociateRomFiles);
                FileAssociationHelper.UpdateFileAssociation("swc", this.AssociateRomFiles);
                FileAssociationHelper.UpdateFileAssociation("fig", this.AssociateRomFiles);
                FileAssociationHelper.UpdateFileAssociation("msm", this.AssociateMsmFiles);
                FileAssociationHelper.UpdateFileAssociation("mss", this.AssociateMssFiles);
            }

            Application.OpenForms[0].TopMost = AlwaysOnTop;

            ShortcutKeyInfo[] shortcutKeys = new ShortcutKeyInfo[ShortcutKeys1.Count + ShortcutKeys2.Count];
            int i = 0;

            foreach (ShortcutKeyInfo shortcutInfo in ShortcutKeys1)
            {
                shortcutKeys[i++] = shortcutInfo;
            }
            foreach (ShortcutKeyInfo shortcutInfo in ShortcutKeys2)
            {
                shortcutKeys[i++] = shortcutInfo;
            }
            ConfigApi.SetShortcutKeys(shortcutKeys, (UInt32)shortcutKeys.Length);

            ConfigApi.SetPreferences(new InteropPreferencesConfig()
            {
                ShowFps                  = ShowFps,
                ShowFrameCounter         = ShowFrameCounter,
                ShowGameTimer            = ShowGameTimer,
                ShowDebugInfo            = ShowDebugInfo,
                DisableOsd               = DisableOsd,
                SaveFolderOverride       = OverrideSaveDataFolder ? SaveDataFolder : "",
                SaveStateFolderOverride  = OverrideSaveStateFolder ? SaveStateFolder : "",
                ScreenshotFolderOverride = OverrideScreenshotFolder ? ScreenshotFolder : "",
                RewindBufferSize         = RewindBufferSize
            });
        }
Esempio n. 2
0
        static public void ApplyConfig()
        {
            PreferenceInfo preferenceInfo = ConfigManager.Config.PreferenceInfo;

            if (Program.IsMono)
            {
                FileAssociationHelper.ConfigureLinuxMimeTypes();
            }
            else
            {
                FileAssociationHelper.UpdateFileAssociation("nes", preferenceInfo.AssociateNesFiles);
                FileAssociationHelper.UpdateFileAssociation("fds", preferenceInfo.AssociateFdsFiles);
                FileAssociationHelper.UpdateFileAssociation("mmo", preferenceInfo.AssociateMmoFiles);
                FileAssociationHelper.UpdateFileAssociation("mst", preferenceInfo.AssociateMstFiles);
                FileAssociationHelper.UpdateFileAssociation("nsf", preferenceInfo.AssociateNsfFiles);
                FileAssociationHelper.UpdateFileAssociation("nsfe", preferenceInfo.AssociateNsfFiles);
                FileAssociationHelper.UpdateFileAssociation("unf", preferenceInfo.AssociateUnfFiles);
                FileAssociationHelper.UpdateFileAssociation("studybox", preferenceInfo.AssociateStudyBoxFiles);
            }

            InteropEmu.SetOsdState(!preferenceInfo.DisableOsd);
            InteropEmu.SetGameDatabaseState(!preferenceInfo.DisableGameDatabase);

            InteropEmu.SetFlag(EmulationFlags.FdsAutoLoadDisk, preferenceInfo.FdsAutoLoadDisk);
            InteropEmu.SetFlag(EmulationFlags.FdsFastForwardOnLoad, preferenceInfo.FdsFastForwardOnLoad);
            InteropEmu.SetFlag(EmulationFlags.FdsAutoInsertDisk, preferenceInfo.FdsAutoInsertDisk);
            InteropEmu.SetFlag(EmulationFlags.PauseOnMovieEnd, preferenceInfo.PauseOnMovieEnd);
            InteropEmu.SetFlag(EmulationFlags.AllowBackgroundInput, preferenceInfo.AllowBackgroundInput);
            InteropEmu.SetFlag(EmulationFlags.UseHighResolutionTimer, !preferenceInfo.DisableHighResolutionTimer);
            InteropEmu.SetFlag(EmulationFlags.AllowMismatchingSaveStates, preferenceInfo.AllowMismatchingSaveStates);

            InteropEmu.SetFlag(EmulationFlags.ShowFrameCounter, preferenceInfo.ShowFrameCounter);
            InteropEmu.SetFlag(EmulationFlags.ShowGameTimer, preferenceInfo.ShowGameTimer);

            InteropEmu.SetFlag(EmulationFlags.HidePauseOverlay, preferenceInfo.HidePauseOverlay);
            InteropEmu.SetFlag(EmulationFlags.DisplayMovieIcons, preferenceInfo.DisplayMovieIcons);
            InteropEmu.SetFlag(EmulationFlags.DisableGameSelectionScreen, preferenceInfo.DisableGameSelectionScreen);
            InteropEmu.SetFlag(EmulationFlags.ConfirmExitResetPower, preferenceInfo.ConfirmExitResetPower);

            InteropEmu.NsfSetNsfConfig(preferenceInfo.NsfAutoDetectSilence ? preferenceInfo.NsfAutoDetectSilenceDelay : 0, preferenceInfo.NsfMoveToNextTrackAfterTime ? preferenceInfo.NsfMoveToNextTrackTime : -1, !preferenceInfo.NsfEnableApuIrqs);
            InteropEmu.SetFlag(EmulationFlags.NsfRepeat, preferenceInfo.NsfRepeat);
            InteropEmu.SetFlag(EmulationFlags.NsfShuffle, preferenceInfo.NsfShuffle);

            InteropEmu.SetFlag(EmulationFlags.DisplayDebugInfo, preferenceInfo.DisplayDebugInfo);

            InteropEmu.SetFlag(EmulationFlags.VsDualMuteMaster, preferenceInfo.VsDualAudioOutput == VsDualOutputOption.SlaveOnly);
            InteropEmu.SetFlag(EmulationFlags.VsDualMuteSlave, preferenceInfo.VsDualAudioOutput == VsDualOutputOption.MasterOnly);

            InteropEmu.SetAutoSaveOptions(preferenceInfo.AutoSave ? (uint)preferenceInfo.AutoSaveDelay : 0, preferenceInfo.AutoSaveNotify);

            InteropEmu.ClearShortcutKeys();
            foreach (ShortcutKeyInfo shortcutInfo in preferenceInfo.ShortcutKeys1)
            {
                InteropEmu.SetShortcutKey(shortcutInfo.Shortcut, shortcutInfo.KeyCombination, 0);
            }
            foreach (ShortcutKeyInfo shortcutInfo in preferenceInfo.ShortcutKeys2)
            {
                InteropEmu.SetShortcutKey(shortcutInfo.Shortcut, shortcutInfo.KeyCombination, 1);
            }

            InteropEmu.SetRewindBufferSize(preferenceInfo.RewindBufferSize);

            InteropEmu.SetFolderOverrides(ConfigManager.SaveFolder, ConfigManager.SaveStateFolder, ConfigManager.ScreenshotFolder);
        }