Exemplo n.º 1
0
        /// <summary>
        /// Read mupen64plus.cfg
        /// </summary>
        public static void ReadMupen64PlusCfg()
        {
            // Check if Paths Config TextBox is Empty
            if (string.IsNullOrWhiteSpace(VM.PathsView.Config_Text))
            {
                MessageBox.Show("Could not read mupen64plus.cfg. Config Path is empty.",
                                "Error",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);

                return;
            }

            // Check if Paths Config TextBox is valid
            if (MainWindow.IsValidPath(VM.PathsView.Config_Text) == false)
            {
                MessageBox.Show("Could not read mupen64plus.cfg. Config Path is not valid.",
                                "Error",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);

                return;
            }

            // Label Notice
            VM.MainView.CfgErrorNotice_Text = "";

            if (File.Exists(Path.Combine(VM.PathsView.Config_Text, "mupen64plus.cfg")) == false)
            {
                VM.MainView.CfgErrorNotice_Text = "Notice: mupen64plus.cfg not found.";

                return;
            }


            // Start mupen64plus.cfg Read
            Configure.ConigFile cfg = new Configure.ConigFile(Path.Combine(VM.PathsView.Config_Text, "mupen64plus.cfg"));

            // -------------------------
            // Paths
            // -------------------------
            try
            {
                // Plugins
                VM.PathsView.Plugins_Text = cfg.Read("UI-Console", "PluginDir");

                // Change Plugins default path "\." to full path "C:\Path\To\Plugins\"
                if (VM.PathsView.Plugins_Text == @"\.")
                {
                    VM.PathsView.Plugins_Text = MainWindow.appRootDir;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Problem importing Plugins Path from mupen64plus.cfg." + ex.ToString(),
                                "Error",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
            }


            // -------------------------
            // Plugins
            // -------------------------
            // LoadPlugins() in MainWindow.Window_Loaded() after ScanPlugins()


            // -------------------------
            // Emulator
            // -------------------------
            try
            {
                // CPU Core
                int cpuCore = 2; // Default Dynamic Recompiler fallback
                int.TryParse(cfg.Read("Core", "R4300Emulator").ToLower(), out cpuCore);
                switch (cpuCore)
                {
                // Pure Interpreter
                case 0:
                    VM.EmulatorView.CPU_SelectedItem = "Pure Interpreter";
                    break;

                // Cached Interpreter
                case 1:
                    VM.EmulatorView.CPU_SelectedItem = "Cached Interpreter";
                    break;

                // Dynamic Recompiler
                case 2:
                    VM.EmulatorView.CPU_SelectedItem = "Dynamic Recompiler";
                    break;
                }

                // DisableSpecRecomp
                bool disableSpecRecomp = true;
                bool.TryParse(cfg.Read("Core", "DisableSpecRecomp").ToLower(), out disableSpecRecomp);
                VM.EmulatorView.Emulator_DisableSpecRecomp_IsChecked = disableSpecRecomp;

                // RandomizeInterrupt
                bool randomizeInterrupt = true;
                bool.TryParse(cfg.Read("Core", "RandomizeInterrupt").ToLower(), out randomizeInterrupt);
                VM.EmulatorView.Emulator_RandomizeInterrupt_IsChecked = randomizeInterrupt;

                // No Compiled Jump
                bool noCompiledJump = false;
                bool.TryParse(cfg.Read("Core", "NoCompiledJump").ToLower(), out noCompiledJump);
                VM.EmulatorView.Emulator_NoCompiledJump_IsChecked = noCompiledJump;

                // Disable Extra Memory
                bool disableExtraMem = false;
                bool.TryParse(cfg.Read("Core", "DisableExtraMem").ToLower(), out disableExtraMem);
                VM.EmulatorView.Emulator_DisableExtraMemory_IsChecked = disableExtraMem;

                // Delay SI
                bool delaySI = true;
                bool.TryParse(cfg.Read("Core", "DelaySI").ToLower(), out delaySI);
                VM.EmulatorView.Emulator_DelaySI_IsChecked = delaySI;

                // Cycles
                VM.EmulatorView.Emulator_Cycles_SelectedItem = cfg.Read("Core", "CountPerOp");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Problem importing Emulator settings from mupen64plus.cfg.\r\n\r\n" + ex.ToString(),
                                "Error",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
            }

            // -------------------------
            // Display
            // -------------------------
            try
            {
                // Resolution
                string screenWidth  = cfg.Read("Video-General", "ScreenWidth");
                string screenHeight = cfg.Read("Video-General", "ScreenHeight");
                VM.DisplayView.Display_Resolution_SelectedItem = screenWidth + "x" + screenHeight;

                // Vsync
                bool vsync = true;
                bool.TryParse(cfg.Read("Video-General", "VerticalSync").ToLower(), out vsync);
                VM.DisplayView.Display_Vsync_IsChecked = vsync;

                // View
                bool fullscreen = true;
                bool.TryParse(cfg.Read("Video-General", "Fullscreen").ToLower(), out fullscreen);
                switch (fullscreen)
                {
                // Fullscreen
                case true:
                    VM.DisplayView.Display_View_SelectedItem = "Fullscreen";
                    break;

                // Windowed
                case false:
                    VM.DisplayView.Display_View_SelectedItem = "Windowed";
                    break;
                }

                // OSD
                bool osd = true;
                bool.TryParse(cfg.Read("Core", "OnScreenDisplay").ToLower(), out osd);
                VM.DisplayView.Display_OSD_IsChecked = osd;

                // Disable Screensaver
                //bool disableScreensaver = true;
                //bool.TryParse(cfg.Read("Core", "xxxxxx").ToLower(), out disableScreensaver);
                //VM.DisplayView.Display_Screensaver_IsChecked = disableScreensaver;

                // Label Notice
                VM.MainView.CfgErrorNotice_Text = "";
            }
            catch (Exception ex)
            {
                MessageBox.Show("Problem importing Display settings from mupen64plus.cfg." + ex.ToString(),
                                "Error",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
            }
        }
Exemplo n.º 2
0
        public static void ScanGameFiles()
        {
            // Check if ROMs Path is Empty
            if (string.IsNullOrWhiteSpace(VM.PathsView.ROMs_Text))
            {
                return;
            }

            // Check if Paths ROMs Path is Valid
            if (MainWindow.IsValidPath(VM.PathsView.ROMs_Text) == false)
            {
                MessageBox.Show("ROMs folder path is not valid.",
                                "Error",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);

                return;
            }

            // Check if ROMs Directory exists
            if (Directory.Exists(VM.PathsView.ROMs_Text.TrimEnd('\\') + @"\") == false)
            {
                MessageBox.Show("ROMs folder does not exist.",
                                "Error",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return;
            }


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

            // Scan PC Directory
            try
            {
                romsList = Directory.GetFiles(VM.PathsView.ROMs_Text, "*.*", SearchOption.AllDirectories)
                           .Where(file => file.ToLower().EndsWith("n64") || file.ToLower().EndsWith("v64") || file.ToLower().EndsWith("z64"))
                           .ToList();

                // ROM files not found
                if (romsList.Count <= 0)
                {
                    MessageBox.Show("N64 ROM files (.n64, .v64, .z64) not found.",
                                    "Notice",
                                    MessageBoxButton.OK,
                                    MessageBoxImage.Warning);
                }
            }
            // Error
            catch (Exception ex)
            {
                MessageBox.Show("Could not scan ROMs folder.\r\n\r\n" + ex.ToString(),
                                "Error",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
            }

            // -------------------------
            // Write Game Paths to ultra.conf
            // -------------------------
            Configure.ConigFile conf = null; // Initialize Read & Write

            try
            {
                // Read
                conf = new Configure.ConigFile(MainWindow.ultraConfFile);
            }
            // Error
            catch
            {
                //MessageBox.Show("Could not save ROMs list to ultra.conf.",
                //                "Error",
                //                MessageBoxButton.OK,
                //                MessageBoxImage.Error);
            }

            // Only if conf can be read/written
            if (conf != null)
            {
                // -------------------------
                // [ROMs]
                // -------------------------
                // Clear ROMs List
                List <string> romsConfList = new List <string>();

                // Count ROM Paths in ultra.conf
                for (int i = 0; i < 999; i++)
                {
                    // Read
                    romsConfList.Add(conf.Read("ROMs", i.ToString()));
                }
                romsConfList = romsConfList.Where(s => !string.IsNullOrWhiteSpace(s)).Distinct().ToList();

                // -------------------------
                // Write ROM File Paths to ultra.conf
                // -------------------------
                // ultra.conf actions to write
                List <Action> actionsToWrite = new List <Action>
                {
                    // Clear Missing ROM Paths
                    new Action(() =>
                    {
                        for (int i = 0; i < romsConfList.Count; i++)
                        {
                            Configure.ConigFile.conf.Write("ROMs", i.ToString(), string.Empty);
                        }
                    }),

                    // Write ROM Paths
                    new Action(() =>
                    {
                        for (int i = 0; i < romsList.Count; i++)
                        {
                            Configure.ConigFile.conf.Write("ROMs", i.ToString(), romsList[i]);
                        }
                    }),
                };

                // Save Config
                Configure.WriteUltraConf(MainWindow.ultraConfDir, // Directory: %AppData%\Ultra UI\
                                         "ultra.conf",            // Filename
                                         actionsToWrite           // Actions to write
                                         );
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///  Load Plugins from mupen64plus.cfg
        /// </summary>
        public static void LoadPlugins(MainWindow mainwindow)
        {
            // Check if Paths Config TextBox is Empty
            if (string.IsNullOrWhiteSpace(VM.PathsView.Config_Text))
            {
                MessageBox.Show("Could not load plugins. Config Path is empty.",
                                "Error",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);

                return;
            }

            // Check if Paths Config TextBox is valid
            if (MainWindow.IsValidPath(VM.PathsView.Config_Text) == false)
            {
                MessageBox.Show("Could not load plugins. Config Path is not valid.",
                                "Error",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);

                return;
            }

            // Check if Cfg File Exists
            if (File.Exists(Path.Combine(VM.PathsView.Config_Text, "mupen64plus.cfg")) == false)
            {
                MessageBox.Show("Could not load plugins. Config file ultra.conf does not exist.",
                                "Error",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);

                return;
            }

            // Start Cfg File Read
            Configure.ConigFile cfg = null;

            try
            {
                cfg = new Configure.ConigFile(Path.Combine(VM.PathsView.Config_Text, "mupen64plus.cfg"));

                // Get the .dll file paths from the cfg [UI-Console] plugins section
                // Select those file names in the Plugin ComboBoxes

                // -------------------------
                // Video
                // -------------------------
                List <string> videoPluginNames = VM.PluginsView.Video_Items.Select(item => item.Name).ToList();
                string        videoPlugin      = Path.GetFileName(cfg.Read("UI-Console", "VideoPlugin"));
                //MessageBox.Show(videoPlugin); //debug

                // Selected
                if (!string.IsNullOrWhiteSpace(videoPlugin))
                {
                    // Default
                    if (videoPluginNames.Contains(videoPlugin))
                    {
                        VM.PluginsView.Video_SelectedItem = videoPlugin;
                    }
                    // Missing Fallback
                    else
                    {
                        //MessageBox.Show("Missing Fallback"); //debug
                        // Default
                        if (videoPluginNames.Contains("mupen64plus-video-GLideN64.dll"))
                        {
                            //MessageBox.Show("Default"); //debug
                            VM.PluginsView.Video_SelectedItem = "mupen64plus-video-GLideN64.dll";
                        }
                        // Missing
                        else
                        {
                            //MessageBox.Show("Missing"); //debug
                            //VM.PluginsView.Video_SelectedIndex = 0;
                            mainwindow.cboPlugin_Video.SelectedIndex = 0;
                        }
                    }
                }
                // Null Fallback
                else
                {
                    //VM.PluginsView.Video_SelectedIndex = 0;
                    mainwindow.cboPlugin_Video.SelectedIndex = 0;
                }

                // -------------------------
                // Audio
                // -------------------------
                List <string> audioPluginNames = VM.PluginsView.Audio_Items.Select(item => item.Name).ToList();
                string        audioPlugin      = Path.GetFileName(cfg.Read("UI-Console", "AudioPlugin"));

                // Selected
                if (!string.IsNullOrWhiteSpace(audioPlugin))
                {
                    // Default
                    if (audioPluginNames.Contains(audioPlugin))
                    {
                        VM.PluginsView.Audio_SelectedItem = audioPlugin;
                    }
                    // Missing Fallback
                    else
                    {
                        //MessageBox.Show("Missing Fallback"); //debug
                        // Default
                        if (audioPluginNames.Contains("mupen64plus-audio-sdl.dll"))
                        {
                            //MessageBox.Show("Default"); //debug
                            VM.PluginsView.Audio_SelectedItem = "mupen64plus-audio-sdl.dll";
                        }
                        // Missing
                        else
                        {
                            //MessageBox.Show("Missing"); //debug
                            //VM.PluginsView.Audio_SelectedIndex = 0;
                            mainwindow.cboPlugin_Audio.SelectedIndex = 0;
                        }
                    }
                }
                // Null Fallback
                else
                {
                    //VM.PluginsView.Audio_SelectedIndex = 0;
                    mainwindow.cboPlugin_Audio.SelectedIndex = 0;
                }

                // -------------------------
                // RSP
                // -------------------------
                List <string> rspPluginNames = VM.PluginsView.RSP_Items.Select(item => item.Name).ToList();
                string        rspPlugin      = Path.GetFileName(cfg.Read("UI-Console", "RSPPlugin"));

                // Selected
                if (!string.IsNullOrWhiteSpace(rspPlugin))
                {
                    // Default
                    if (rspPluginNames.Contains(rspPlugin))
                    {
                        VM.PluginsView.RSP_SelectedItem = rspPlugin;
                    }
                    // Missing Fallback
                    else
                    {
                        //MessageBox.Show("Missing Fallback"); //debug
                        // Default
                        if (rspPluginNames.Contains("mupen64plus-rsp-hle.dll"))
                        {
                            //MessageBox.Show("Default"); //debug
                            VM.PluginsView.RSP_SelectedItem = "mupen64plus-rsp-hle.dll";
                        }
                        // Missing
                        else
                        {
                            //MessageBox.Show("Missing"); //debug
                            //VM.PluginsView.RSP_SelectedIndex = 0;
                            mainwindow.cboPlugin_RSP.SelectedIndex = 0;
                        }
                    }
                }
                // Null Fallback
                else
                {
                    //VM.PluginsView.RSP_SelectedIndex = 0;
                    mainwindow.cboPlugin_RSP.SelectedIndex = 0;
                }

                // -------------------------
                // Input
                // -------------------------
                List <string> inputPluginNames = VM.PluginsView.Input_Items.Select(item => item.Name).ToList();
                string        inputPlugin      = Path.GetFileName(cfg.Read("UI-Console", "InputPlugin"));

                // Selected
                if (!string.IsNullOrWhiteSpace(inputPlugin))
                {
                    // Default
                    if (inputPluginNames.Contains(inputPlugin))
                    {
                        VM.PluginsView.Input_SelectedItem = inputPlugin;
                    }
                    // Missing Fallback
                    else
                    {
                        //MessageBox.Show("Missing Fallback"); //debug
                        // Default
                        if (inputPluginNames.Contains("mupen64plus-input-sdl.dll"))
                        {
                            //MessageBox.Show("Default"); //debug
                            VM.PluginsView.Input_SelectedItem = "mupen64plus-input-sdl.dll";
                        }
                        // Missing
                        else
                        {
                            //MessageBox.Show("Missing"); //debug
                            //VM.PluginsView.Input_SelectedIndex = 0;
                            mainwindow.cboPlugin_Input.SelectedIndex = 0;
                        }
                    }
                }
                // Null Fallback
                else
                {
                    //VM.PluginsView.Input_SelectedIndex = 0;
                    mainwindow.cboPlugin_Input.SelectedIndex = 0;
                }
            }
            // Error
            catch (Exception ex)
            {
                MessageBox.Show("Problem importing selected plugins from mupen64plus.cfg.\r\n\r\n" + ex.ToString(),
                                "Error",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
            }
        }
Exemplo n.º 4
0
        public static void ParseGamesList(MainWindow mainwindow)
        {
            // -------------------------
            // Parse ultra.conf
            // -------------------------
            Configure.ConigFile conf = null;

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

            // [ROMs]
            try
            {
                conf = new Configure.ConigFile(MainWindow.ultraConfFile);

                for (int i = 0; i < 999; i++)
                {
                    // Read
                    // Add Game Paths from ultra.conf to List
                    romsList.Add(conf.Read("ROMs", i.ToString()));

                    romsList = romsList.Where(s => !string.IsNullOrWhiteSpace(s)).Distinct().ToList();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Could not read ROMs list from ultra.conf.\r\n\r\n" + ex.ToString(),
                                "Error",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
            }

            // -------------------------
            // View Games List
            // -------------------------
            try
            {
                mainwindow.Dispatcher.Invoke(() => // must use dispatcher to cross-thread
                {
                    // Clear Games List to prevent doubling up
                    if (VM.MainView.Games_Items != null)
                    {
                        VM.MainView.Games_Items.Clear();
                    }

                    // Alphabetize
                    romsList.Sort();

                    // Add ROMs to Games ListView
                    for (int i = 0; i < romsList.Count; i++)
                    {
                        VM.MainView.Games_Items.Add(new MainViewModel.Games()
                        {
                            FullPath  = romsList[i],
                            Directory = System.IO.Path.GetDirectoryName(romsList[i]),
                            Name      = System.IO.Path.GetFileNameWithoutExtension(romsList[i])
                        });
                    }
                });
            }
            catch (Exception ex)
            {
                //Console.WriteLine("Problem parsing Games List. Please try another Proxy.");
                MessageBox.Show("Problem reading Games List.\r\n\r\n" + ex.ToString(),
                                "Error",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        ///  Plugin Cfg Reader
        /// </summary>
        /// <remarks>
        ///  Import Control Values from mupen64plus.cfg
        /// </remarks>
        private static void PluginCfgReader()
        {
            // Check if Paths Config TextBox is Empty
            if (MainWindow.IsValidPath(VM.PathsView.Config_Text))
            {
                // Check if Cfg File Exists
                if (File.Exists(Path.Combine(VM.PathsView.Config_Text, "mupen64plus.cfg")))
                {
                    // Start Cfg File Read
                    Configure.ConigFile cfg = null;

                    try
                    {
                        cfg = new Configure.ConigFile(Path.Combine(VM.PathsView.Config_Text, "mupen64plus.cfg"));

                        // Version
                        VM.Plugins_Audio_AudioSDL_View.Version_Text = cfg.Read("Audio-SDL", "Version");

                        // Default Frequency
                        VM.Plugins_Audio_AudioSDL_View.DefaultFrequency_Text = cfg.Read("Audio-SDL", "DEFAULT_FREQUENCY");

                        // Swap Channels
                        bool swapChannels = false;
                        bool.TryParse(cfg.Read("Audio-SDL", "SWAP_CHANNELS").ToLower(), out swapChannels);
                        VM.Plugins_Audio_AudioSDL_View.SwapChannels_IsChecked = swapChannels;

                        // Primary Buffer Size
                        VM.Plugins_Audio_AudioSDL_View.PrimaryBufferSize_Text = cfg.Read("Audio-SDL", "PRIMARY_BUFFER_SIZE");

                        // Primary Buffer Target
                        VM.Plugins_Audio_AudioSDL_View.PrimaryBufferTarget_Text = cfg.Read("Audio-SDL", "PRIMARY_BUFFER_TARGET");

                        // Secondary Buffer Size
                        VM.Plugins_Audio_AudioSDL_View.SecondaryBufferSize_Text = cfg.Read("Audio-SDL", "SECONDARY_BUFFER_SIZE");

                        // Resample
                        VM.Plugins_Audio_AudioSDL_View.Resample_SelectedItem = cfg.Read("Audio-SDL", "RESAMPLE");

                        // Volume Control Type
                        string volControlType = cfg.Read("Audio-SDL", "VOLUME_CONTROL_TYPE");
                        if (volControlType == "1")
                        {
                            VM.Plugins_Audio_AudioSDL_View.VolumeControlType_SelectedItem = "SDL";
                        }
                        else if (volControlType == "2")
                        {
                            VM.Plugins_Audio_AudioSDL_View.VolumeControlType_SelectedItem = "OSS mixer";
                        }

                        // Volume Adjust
                        VM.Plugins_Audio_AudioSDL_View.VolumeAdjust_Text = cfg.Read("Audio-SDL", "VOLUME_ADJUST");

                        // Volume Default
                        VM.Plugins_Audio_AudioSDL_View.VolumeDefault_Text = cfg.Read("Audio-SDL", "VOLUME_DEFAULT");

                        // Audio Sync
                        bool audioSync = true;
                        bool.TryParse(cfg.Read("Audio-SDL", "AUDIO_SYNC").ToLower(), out audioSync);
                        VM.Plugins_Audio_AudioSDL_View.AudioSync_IsChecked = audioSync;
                    }
                    // Error
                    catch
                    {
                        MessageBox.Show("Problem reading mupen64plus.cfg.",
                                        "Read Error",
                                        MessageBoxButton.OK,
                                        MessageBoxImage.Error);
                    }
                }
                // Error
                else
                {
                    MessageBox.Show("Could not find mupen64plus.cfg.",
                                    "Read Error",
                                    MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                }
            }
            // Path not found
            else
            {
                MessageBox.Show("Config Path is empty.",
                                "Notice",
                                MessageBoxButton.OK,
                                MessageBoxImage.Warning);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Plugin Cfg Reader
        /// </summary>
        /// <remarks>
        /// Import Control Values from mupen64plus.cfg
        /// </remarks>
        private static void PluginCfgReader()
        {
            // Check if Paths Config TextBox is Empty
            if (MainWindow.IsValidPath(VM.PathsView.Config_Text))
            {
                // Check if Cfg File Exists
                if (File.Exists(Path.Combine(VM.PathsView.Config_Text, "mupen64plus.cfg")))
                {
                    // Start Cfg File Read
                    Configure.ConigFile cfg = null;

                    try
                    {
                        cfg = new Configure.ConigFile(Path.Combine(VM.PathsView.Config_Text, "mupen64plus.cfg"));

                        // -------------------------
                        // [rsp-cxd4]
                        // -------------------------

                        // Version
                        VM.Plugins_RSP_cxd4SSE2_View.Version_Text = cfg.Read("rsp-cxd4", "Version");

                        // DisplayListToGraphicsPlugin
                        bool displayListToGraphicsPlugin = true;
                        bool.TryParse(cfg.Read("rsp-cxd4", "DisplayListToGraphicsPlugin").ToLower(), out displayListToGraphicsPlugin);
                        VM.Plugins_RSP_cxd4SSE2_View.DisplayListToGraphicsPlugin_IsChecked = displayListToGraphicsPlugin;

                        //  AudioListToAudioPlugin
                        bool audioListToAudioPlugin = false;
                        bool.TryParse(cfg.Read("rsp-cxd4", "AudioListToAudioPlugin").ToLower(), out audioListToAudioPlugin);
                        VM.Plugins_RSP_cxd4SSE2_View.AudioListToAudioPlugin_IsChecked = audioListToAudioPlugin;

                        //  WaitForCPUHost
                        bool waitForCPUHost = false;
                        bool.TryParse(cfg.Read("rsp-cxd4", "WaitForCPUHost").ToLower(), out waitForCPUHost);
                        VM.Plugins_RSP_cxd4SSE2_View.WaitForCPUHost_IsChecked = waitForCPUHost;

                        //  SupportCPUSemaphoreLock
                        bool supportCPUSemaphoreLock = false;
                        bool.TryParse(cfg.Read("rsp-cxd4", "SupportCPUSemaphoreLock").ToLower(), out supportCPUSemaphoreLock);
                        VM.Plugins_RSP_cxd4SSE2_View.SupportCPUSemaphoreLock_IsChecked = supportCPUSemaphoreLock;
                    }
                    // Error
                    catch
                    {
                        MessageBox.Show("Problem reading mupen64plus.cfg.",
                                        "Read Error",
                                        MessageBoxButton.OK,
                                        MessageBoxImage.Error);
                    }
                }
                // Error
                else
                {
                    MessageBox.Show("Could not find mupen64plus.cfg.",
                                    "Read Error",
                                    MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                }
            }
            // Path not found
            else
            {
                MessageBox.Show("Config Path is empty.",
                                "Notice",
                                MessageBoxButton.OK,
                                MessageBoxImage.Warning);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Plugin Cfg Reader
        /// </summary>
        /// <remarks>
        /// Import Control Values from mupen64plus.cfg
        /// </remarks>
        private static void PluginCfgReader()
        {
            // Check if Paths Config TextBox is Empty
            if (MainWindow.IsValidPath(VM.PathsView.Config_Text))
            {
                // Check if Cfg File Exists
                if (File.Exists(Path.Combine(VM.PathsView.Config_Text, "mupen64plus.cfg")))
                {
                    // Start Cfg File Read
                    Configure.ConigFile cfg = null;

                    try
                    {
                        cfg = new Configure.ConigFile(Path.Combine(VM.PathsView.Config_Text, "mupen64plus.cfg"));

                        // --------------------------------------------------
                        // [Video-Angrylion-Plus]
                        // --------------------------------------------------

                        // Parallel
                        // # Distribute rendering between multiple processors if True
                        bool parallel = true;
                        bool.TryParse(cfg.Read("Video-Angrylion-Plus", "Parallel").ToLower(), out parallel);
                        VM.Plugins_Video_AngrylionPlus_View.Parallel_IsChecked = parallel;

                        // NumWorkers
                        // # Rendering Workers (0=Use all logical processors)
                        string numbWorkers = cfg.Read("Video-Angrylion-Plus", "NumWorkers");
                        if (numbWorkers == "0")
                        {
                            VM.Plugins_Video_AngrylionPlus_View.NumWorkers_SelectedItem = "All";
                        }
                        else
                        {
                            VM.Plugins_Video_AngrylionPlus_View.NumWorkers_SelectedItem = numbWorkers;
                        }

                        // VI mode
                        // # (0=Filtered, 1=Unfiltered, 2=Depth, 3=Coverage)
                        string viMode = cfg.Read("Video-Angrylion-Plus", "ViMode");
                        switch (viMode)
                        {
                        case "0":
                            VM.Plugins_Video_AngrylionPlus_View.ViMode_SelectedItem = "Filtered";
                            break;

                        case "1":
                            VM.Plugins_Video_AngrylionPlus_View.ViMode_SelectedItem = "Unfiltered";
                            break;

                        case "2":
                            VM.Plugins_Video_AngrylionPlus_View.ViMode_SelectedItem = "Depth";
                            break;

                        case "3":
                            VM.Plugins_Video_AngrylionPlus_View.ViMode_SelectedItem = "Coverage";
                            break;
                        }

                        // Scaling interpolation type
                        // # Scaling interpolation type (0=NN, 1=Linear)
                        string viInterpolation = cfg.Read("Video-Angrylion-Plus", "ViInterpolation");
                        switch (viInterpolation)
                        {
                        case "0":
                            VM.Plugins_Video_AngrylionPlus_View.ViInterpolation_SelectedItem = "Nearest Neighbor";
                            break;

                        case "1":
                            VM.Plugins_Video_AngrylionPlus_View.ViInterpolation_SelectedItem = "Linear";
                            break;
                        }

                        // ViWidescreen
                        // # Use anamorphic 16:9 output mode if True
                        bool viWidescreen = false;
                        bool.TryParse(cfg.Read("Video-Angrylion-Plus", "ViWidescreen").ToLower(), out viWidescreen);
                        VM.Plugins_Video_AngrylionPlus_View.ViWidescreen_IsChecked = viWidescreen;

                        // ViHideOverscan
                        // # Hide overscan area in filteded mode if True
                        bool viHideOverscan = false;
                        bool.TryParse(cfg.Read("Video-Angrylion-Plus", "ViHideOverscan").ToLower(), out viHideOverscan);
                        VM.Plugins_Video_AngrylionPlus_View.ViHideOverscan_IsChecked = viHideOverscan;

                        // DpCompat
                        // # Compatibility mode (0=Fast 1=Moderate 2=Slow)
                        string dpCompat = cfg.Read("Video-Angrylion-Plus", "DpCompat");
                        switch (dpCompat)
                        {
                        case "0":
                            VM.Plugins_Video_AngrylionPlus_View.DpCompat_SelectedItem = "Fast";
                            break;

                        case "1":
                            VM.Plugins_Video_AngrylionPlus_View.DpCompat_SelectedItem = "Moderate";
                            break;

                        case "2":
                            VM.Plugins_Video_AngrylionPlus_View.DpCompat_SelectedItem = "Slow";
                            break;
                        }
                    }
                    // Error
                    catch
                    {
                        MessageBox.Show("Problem reading mupen64plus.cfg.",
                                        "Read Error",
                                        MessageBoxButton.OK,
                                        MessageBoxImage.Error);
                    }
                }
                // Error
                else
                {
                    MessageBox.Show("Could not find mupen64plus.cfg.",
                                    "Read Error",
                                    MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                }
            }
            // Path not found
            else
            {
                MessageBox.Show("Config Path is empty.",
                                "Notice",
                                MessageBoxButton.OK,
                                MessageBoxImage.Warning);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Plugin Cfg Reader
        /// </summary>
        /// <remarks>
        /// Import Control Values from mupen64plus.cfg
        /// </remarks>
        private static void PluginCfgReader()
        {
            // Check if Paths Config TextBox is Empty
            if (MainWindow.IsValidPath(VM.PathsView.Config_Text))
            {
                // Check if Cfg File Exists
                if (File.Exists(Path.Combine(VM.PathsView.Config_Text, "mupen64plus.cfg")))
                {
                    // Start Cfg File Read
                    Configure.ConigFile cfg = null;

                    try
                    {
                        cfg = new Configure.ConigFile(Path.Combine(VM.PathsView.Config_Text, "mupen64plus.cfg"));

                        // -------------------------
                        // [Rsp-HLE]
                        // -------------------------

                        // Version
                        VM.Plugins_RSP_RSPHLE_View.Version_Text = cfg.Read("Rsp-HLE", "Version");

                        // RSP Fallback
                        VM.Plugins_RSP_RSPHLE_View.RSPFallback_Text = cfg.Read("Rsp-HLE", "RspFallback");

                        // Display List To Graphics Plugin
                        bool displayListToGraphicsPlugin = true;
                        bool.TryParse(cfg.Read("Rsp-HLE", "DisplayListToGraphicsPlugin").ToLower(), out displayListToGraphicsPlugin);
                        VM.Plugins_RSP_RSPHLE_View.DisplayListToGraphicsPlugin_IsChecked = displayListToGraphicsPlugin;

                        //  Audio List To Audio Plugin
                        bool audioListToAudioPlugin = false;
                        bool.TryParse(cfg.Read("Rsp-HLE", "AudioListToAudioPlugin").ToLower(), out audioListToAudioPlugin);
                        VM.Plugins_RSP_RSPHLE_View.AudioListToAudioPlugin_IsChecked = audioListToAudioPlugin;
                    }
                    // Error
                    catch
                    {
                        MessageBox.Show("Problem reading mupen64plus.cfg.",
                                        "Read Error",
                                        MessageBoxButton.OK,
                                        MessageBoxImage.Error);
                    }
                }
                // Error
                else
                {
                    MessageBox.Show("Could not find mupen64plus.cfg.",
                                    "Read Error",
                                    MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                }
            }
            // Path not found
            else
            {
                MessageBox.Show("Config Path is empty.",
                                "Notice",
                                MessageBoxButton.OK,
                                MessageBoxImage.Warning);
            }
        }