Exemplo n.º 1
0
        static public void ApplyConfig()
        {
            PreferenceInfo preferenceInfo = ConfigManager.Config.PreferenceInfo;

            UpdateFileAssociation("nes", preferenceInfo.AssociateNesFiles);
            UpdateFileAssociation("fds", preferenceInfo.AssociateFdsFiles);
            UpdateFileAssociation("mmo", preferenceInfo.AssociateMmoFiles);
            UpdateFileAssociation("mst", preferenceInfo.AssociateMstFiles);
            UpdateFileAssociation("nsf", preferenceInfo.AssociateNsfFiles);
            UpdateFileAssociation("nsfe", preferenceInfo.AssociateNsfeFiles);
            UpdateFileAssociation("unf", preferenceInfo.AssociateUnfFiles);

            InteropEmu.SetFlag(EmulationFlags.Mmc3IrqAltBehavior, preferenceInfo.UseAlternativeMmc3Irq);
            InteropEmu.SetFlag(EmulationFlags.AllowInvalidInput, preferenceInfo.AllowInvalidInput);
            InteropEmu.SetFlag(EmulationFlags.RemoveSpriteLimit, preferenceInfo.RemoveSpriteLimit);
            InteropEmu.SetFlag(EmulationFlags.FdsAutoLoadDisk, preferenceInfo.FdsAutoLoadDisk);
            InteropEmu.SetFlag(EmulationFlags.FdsFastForwardOnLoad, preferenceInfo.FdsFastForwardOnLoad);
            InteropEmu.SetFlag(EmulationFlags.PauseOnMovieEnd, preferenceInfo.PauseOnMovieEnd);
            InteropEmu.SetFlag(EmulationFlags.AllowBackgroundInput, preferenceInfo.AllowBackgroundInput);
            InteropEmu.SetFlag(EmulationFlags.PauseWhenInBackground, preferenceInfo.PauseWhenInBackground);
            InteropEmu.SetFlag(EmulationFlags.DisableGameDatabase, preferenceInfo.DisableGameDatabase);

            InteropEmu.NsfSetNsfConfig(preferenceInfo.NsfAutoDetectSilence ? preferenceInfo.NsfAutoDetectSilenceDelay : 0, preferenceInfo.NsfMoveToNextTrackAfterTime ? preferenceInfo.NsfMoveToNextTrackTime : -1, preferenceInfo.NsfDisableApuIrqs);
            InteropEmu.SetAutoSaveOptions(preferenceInfo.AutoSave ? (uint)preferenceInfo.AutoSaveDelay : 0, preferenceInfo.AutoSaveNotify);
            InteropEmu.SetEmulatorKeys(new EmulatorKeyMappingSet()
            {
                KeySet1 = preferenceInfo.EmulatorKeySet1.Value, KeySet2 = preferenceInfo.EmulatorKeySet2.Value
            });
        }
Exemplo 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);
            }

            InteropEmu.SetFlag(EmulationFlags.AllowInvalidInput, preferenceInfo.AllowInvalidInput);
            InteropEmu.SetFlag(EmulationFlags.RemoveSpriteLimit, preferenceInfo.RemoveSpriteLimit);
            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.PauseWhenInBackground, preferenceInfo.PauseWhenInBackground || preferenceInfo.PauseWhenInMenusAndConfig || preferenceInfo.PauseWhenInDebuggingTools);
            InteropEmu.SetFlag(EmulationFlags.DisableGameDatabase, preferenceInfo.DisableGameDatabase);
            InteropEmu.SetFlag(EmulationFlags.DisableOsd, preferenceInfo.DisableOsd);
            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.NsfDisableApuIrqs);
            InteropEmu.SetFlag(EmulationFlags.NsfRepeat, preferenceInfo.NsfRepeat);
            InteropEmu.SetFlag(EmulationFlags.NsfShuffle, preferenceInfo.NsfShuffle);

            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);
        }
Exemplo n.º 3
0
        static public void ConfigureLinuxMimeTypes()
        {
            PreferenceInfo preferenceInfo = ConfigManager.Config.PreferenceInfo;

            string baseFolder    = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), ".local", "share");
            string desktopFolder = Path.Combine(baseFolder, "applications");
            string mimeFolder    = Path.Combine(baseFolder, "mime");
            string iconFolder    = Path.Combine(baseFolder, "icons");

            if (!Directory.Exists(mimeFolder))
            {
                Directory.CreateDirectory(mimeFolder);
            }
            if (!Directory.Exists(iconFolder))
            {
                Directory.CreateDirectory(iconFolder);
            }
            if (!Directory.Exists(desktopFolder))
            {
                Directory.CreateDirectory(desktopFolder);
            }


            //Use a GUID to get a unique filename and then delete old files to force a reset of file associations
            //Otherwise they are sometimes not refreshed properly
            string desktopFilename = "mesen." + Guid.NewGuid().ToString() + ".desktop";
            string desktopFile     = Path.Combine(desktopFolder, desktopFilename);

            foreach (string file in Directory.GetFiles(desktopFolder, "mesen.*.desktop"))
            {
                if (File.Exists(file))
                {
                    try {
                        File.Delete(file);
                    } catch { }
                }
            }

            List <string> mimeTypes = new List <string>();

            CreateMimeType("x-mesen-nes", "nes", "NES Rom", mimeTypes, preferenceInfo.AssociateNesFiles);
            CreateMimeType("x-mesen-fds", "fds", "FDS Rom", mimeTypes, preferenceInfo.AssociateFdsFiles);
            CreateMimeType("x-mesen-nsf", "nsf", "Nintendo Sound File", mimeTypes, preferenceInfo.AssociateNsfFiles);
            CreateMimeType("x-mesen-nsfe", "nsfe", "Nintendo Sound File (extended)", mimeTypes, preferenceInfo.AssociateNsfFiles);
            CreateMimeType("x-mesen-mst", "mst", "Mesen Save State", mimeTypes, preferenceInfo.AssociateMstFiles);
            CreateMimeType("x-mesen-mmo", "mmo", "Mesen Movie File", mimeTypes, preferenceInfo.AssociateMmoFiles);
            CreateMimeType("x-mesen-unif", "unf", "NES Rom (UNIF)", mimeTypes, preferenceInfo.AssociateUnfFiles);

            //Icon used for shortcuts
            Mesen.GUI.Properties.Resources.MesenLogo.Save(Path.Combine(iconFolder, "MesenIcon.png"), ImageFormat.Png);

            CreateShortcutFile(desktopFile, mimeTypes);

            //Update databases
            System.Diagnostics.Process.Start("update-mime-database", mimeFolder).WaitForExit();
            System.Diagnostics.Process.Start("update-desktop-database", desktopFolder);
        }
Exemplo n.º 4
0
 public Configuration()
 {
     Profile = new PlayerProfile();
     ClientConnectionInfo = new ClientConnectionInfo();
     ServerInfo           = new ServerInfo();
     AudioInfo            = new AudioInfo();
     VideoInfo            = new VideoInfo();
     PreferenceInfo       = new PreferenceInfo();
     EmulationInfo        = new EmulationInfo();
     RecentFiles          = new List <RecentItem>();
     InputInfo            = new InputInfo();
     Cheats    = new List <CheatInfo>();
     VsConfig  = new List <VsConfigInfo>();
     DebugInfo = new DebugInfo();
 }
Exemplo n.º 5
0
 public Configuration()
 {
     Profile = new PlayerProfile();
     ClientConnectionInfo = new ClientConnectionInfo();
     ServerInfo           = new ServerInfo();
     AudioInfo            = new AudioInfo();
     VideoInfo            = new VideoInfo();
     PreferenceInfo       = new PreferenceInfo();
     EmulationInfo        = new EmulationInfo();
     RecentFiles          = new List <RecentItem>();
     InputInfo            = new InputInfo();
     Cheats               = new List <CheatInfo>();
     DebugInfo            = new DebugInfo();
     AviRecordInfo        = new AviRecordInfo();
     MovieRecordInfo      = new MovieRecordInfo();
     GameSpecificSettings = new List <GameSpecificInfo>();
 }
Exemplo n.º 6
0
        static public void ConfigureLinuxMimeTypes()
        {
            PreferenceInfo preferenceInfo = ConfigManager.Config.PreferenceInfo;

            string baseFolder    = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), ".local", "share");
            string desktopFolder = Path.Combine(baseFolder, "applications");
            string mimeFolder    = Path.Combine(baseFolder, "mime");
            string iconFolder    = Path.Combine(baseFolder, "icons");

            if (!Directory.Exists(mimeFolder))
            {
                Directory.CreateDirectory(mimeFolder);
            }
            if (!Directory.Exists(iconFolder))
            {
                Directory.CreateDirectory(iconFolder);
            }
            if (!Directory.Exists(desktopFolder))
            {
                Directory.CreateDirectory(desktopFolder);
            }


            //Use a GUID to get a unique filename and then delete old files to force a reset of file associations
            //Otherwise they are sometimes not refreshed properly
            string desktopFilename = "mesen." + Guid.NewGuid().ToString() + ".desktop";
            string desktopFile     = Path.Combine(desktopFolder, desktopFilename);

            foreach (string file in Directory.GetFiles(desktopFolder, "mesen.*.desktop"))
            {
                if (File.Exists(file))
                {
                    try {
                        File.Delete(file);
                    } catch { }
                }
            }

            List <string> mimeTypes = new List <string>();

            CreateMimeType("x-mesen-nes", "nes", "NES ROM", mimeTypes, preferenceInfo.AssociateNesFiles);
            CreateMimeType("x-mesen-fds", "fds", "FDS ROM", mimeTypes, preferenceInfo.AssociateFdsFiles);
            CreateMimeType("x-mesen-nsf", "nsf", "Nintendo Sound File", mimeTypes, preferenceInfo.AssociateNsfFiles);
            CreateMimeType("x-mesen-nsfe", "nsfe", "Nintendo Sound File (extended)", mimeTypes, preferenceInfo.AssociateNsfFiles);
            CreateMimeType("x-mesen-mst", "mst", "Mesen Save State", mimeTypes, preferenceInfo.AssociateMstFiles);
            CreateMimeType("x-mesen-mmo", "mmo", "Mesen Movie File", mimeTypes, preferenceInfo.AssociateMmoFiles);
            CreateMimeType("x-mesen-unif", "unf", "NES ROM (UNIF)", mimeTypes, preferenceInfo.AssociateUnfFiles);
            CreateMimeType("x-mesen-studybox", "studybox", "Studybox ROM (Famicom)", mimeTypes, preferenceInfo.AssociateStudyBoxFiles);

            //Icon used for shortcuts
            Mesen.GUI.Properties.Resources.MesenLogo.Save(Path.Combine(iconFolder, "MesenIcon.png"), ImageFormat.Png);

            CreateShortcutFile(desktopFile, mimeTypes);

            //Update databases
            try {
                System.Diagnostics.Process.Start("update-mime-database", mimeFolder).WaitForExit();
                System.Diagnostics.Process.Start("update-desktop-database", desktopFolder);
            } catch {
                try {
                    InteropEmu.WriteLogEntry("An error occurred while updating file associations");
                } catch {
                    //For some reason, Mono crashes when trying to call this if libMesenCore.dll was not already next to the .exe before the process starts?
                    //This causes a "MesenCore.dll not found" popup, so catch it here and ignore it.
                }
            }
        }