Esempio n. 1
0
 internal static void PopulatePluginListsThread(EpsxeTabControl epsxeTabControl)
 {
     if (!_mainWindow.ProfileListMenu.Items.Contains("--"))
     {
         _epsxeTabControl = epsxeTabControl;
         PopFound.DoWork += PopFoundDoWork;
         PopFound.RunWorkerCompleted += PopFoundWorkerCompleted;
         PopFound.WorkerSupportsCancellation = true;
         PopFound.RunWorkerAsync();
     }
 }
Esempio n. 2
0
        //private readonly Pcsx2TabControl _mainPcsx2Tab;
        internal MainWindow()
        {
            InitializeComponent();

            //if (ProfileListMenu.ComboBox != null)
            //	ProfileListMenu.ComboBox.MouseWheel += ProfileListMenuMouseWheel; //Prevents multiple BackgroundWorker instances as a result of quick scrolling

            if (File.Exists(RegistryAccess.TempRegFile)) //Cleans up any previously undeleted temp files
            {
                File.Delete(RegistryAccess.TempRegFile);
            }

            #region Creates a settings file

            if (!Directory.Exists(XmlAccess.SettingsDir))
            {
                Directory.CreateDirectory(XmlAccess.SettingsDir);
            }

            if (!File.Exists(XmlAccess.SettingsFile))
            {
                XmlAccess.CreateSettings();
            }

            RegistryAccess.FirstRunKey();

            #endregion

            #region Sets up frontend/settings

            TabControlContainer.BackgroundImage = Resources.logobg;
            TabControlContainer.BackgroundImageLayout = ImageLayout.Center;

            XmlAccess.LoadSettingsToMemory();
            ChangeStyle(XmlAccess.ReadSettings("ToolbarStyle"));

            PopulateList.PopulateProfileListThread(this);

            while (PopulateList.PopProfile.IsBusy)
            {
                Application.DoEvents();
            }

            if (Convert.ToBoolean(XmlAccess.ReadSettings("LastProfileAttribute")) &&
                XmlAccess.ReadSettings("LastProfile").Length > 0)
            {
                ProfileListMenu.SelectedItem = XmlAccess.ReadSettings("LastProfile");
            }

            #endregion

            _mainEpsxeTab = new EpsxeTabControl();
            //_mainPcsx2Tab = new Pcsx2TabControl();
            CheckProfileStatus();
        }
Esempio n. 3
0
        internal static void WritePluginSettingsToRegistry(EpsxeTabControl mainEpsxeTab)
        {
            var registryKey = Registry.CurrentUser.CreateSubKey(EpsxeKey);
            if (registryKey != null)
            {
                var finalRegKeyImport = new List<string> {RegTag + "\n"};

                #region BIOS

                if (XmlAccess.ReadProfile("BIOS") != string.Empty)
                {
                    registryKey.SetValue("BiosName", Path.Combine(XmlAccess.EpsxeBiosDir, XmlAccess.ReadProfile("BIOS")));
                }

                #endregion

                #region GPU

                if (XmlAccess.ReadProfile("GraphicsSettings") != string.Empty)
                {
                    registryKey.SetValue("VideoPlugin",
                                            Path.GetFileName(PopulateList.GpuFilePaths[mainEpsxeTab.GpuList.SelectedIndex].ToString()));
                    finalRegKeyImport.Add(XmlAccess.ReadProfile("GraphicsSettings"));
                }
                if (XmlAccess.ReadProfile("IntGraphics") != string.Empty)
                {
                    finalRegKeyImport.Add(XmlAccess.ReadProfile("IntGraphics"));
                }

                #endregion

                #region SPU

                if (XmlAccess.ReadProfile("SoundSettings") != string.Empty)
                {
                    switch (XmlAccess.ReadProfile("Sound"))
                    {
                        case "(Internal) ePSXe SPU Core v1.7":
                            registryKey.SetValue("SoundPlugin", "SPUCORE");
                            break;
                        default:
                            registryKey.SetValue("SoundPlugin",
                                                    Path.GetFileName(PopulateList.SpuFilePaths[mainEpsxeTab.SpuList.SelectedIndex - 1].ToString()));
                            finalRegKeyImport.Add(XmlAccess.ReadProfile("SoundSettings"));
                            break;
                    }
                }

                #endregion

                #region Disc

                if (XmlAccess.ReadProfile("DiscSettings") != string.Empty)
                {
                    switch (XmlAccess.ReadProfile("Disc"))
                    {
                        case "(Internal) ePSXe CDR Core v1.7":
                            registryKey.SetValue("CdromPlugin", "W2KCDRCORE");
                            char[] val = XmlAccess.ReadProfile("DiscSettings").ToCharArray();
                            registryKey.SetValue("CdromLetter", val[0].ToString() + val[1].ToString());
                            registryKey.SetValue("SubchannelW2kCdromEnabled", val[3]);
                            break;
                        default:
                            registryKey.SetValue("CdromPlugin",
                                                    Path.GetFileName(PopulateList.CdFilePaths[mainEpsxeTab.CdList.SelectedIndex - 1].ToString()));
                            finalRegKeyImport.Add(XmlAccess.ReadProfile("DiscSettings"));
                            break;
                    }
                }

                #endregion

                #region Pad

                if (XmlAccess.ReadProfile("Pad") != string.Empty)
                {
                    finalRegKeyImport.Add(XmlAccess.ReadProfile("Pad"));
                }

                #endregion

                #region MemoryCards

                registryKey.SetValue("Memcard1",
                                        XmlAccess.ReadProfile("MemoryCard1") != string.Empty ? Path.Combine(XmlAccess.EpsxeMemDir,
                                        XmlAccess.ReadProfile("MemoryCard1")) : string.Empty);
                registryKey.SetValue("Memcard2",
                                        XmlAccess.ReadProfile("MemoryCard2") != string.Empty ? Path.Combine(XmlAccess.EpsxeMemDir,
                                        XmlAccess.ReadProfile("MemoryCard2")) : string.Empty);

                #endregion

                #region NetPlay

                if (XmlAccess.ReadProfile("NetPlay") != string.Empty)
                {
                    switch (XmlAccess.ReadProfile("NetPlay"))
                    {
                        case "NetPlay Disabled":
                            registryKey.SetValue("NetPlugin", "DISABLED");
                            break;
                        case "netSock Driver":
                            registryKey.SetValue("NetPlugin",
                                                    Path.GetFileName(PopulateList.NetFilePaths[mainEpsxeTab.NetList.SelectedIndex - 1].ToString()));
                            break;
                    }
                }

                #endregion

                #region Misc.

                bool tempPpf = Convert.ToBoolean(XmlAccess.ReadSettings("AutoPPF"));
                bool tempLog = Convert.ToBoolean(XmlAccess.ReadSettings("Logging"));
                registryKey.SetValue("AutoPpfLoad", Convert.ToInt16(tempPpf));
                registryKey.SetValue("Logswindow", Convert.ToInt16(tempLog));

                #endregion

                if (finalRegKeyImport.Count <= 1) return;
                File.WriteAllText(TempRegFile, string.Join("\n", finalRegKeyImport.ToArray()));
                using (var proc = new Process())
                {
                    proc.StartInfo.FileName = "regedit";
                    proc.StartInfo.Arguments = string.Format("/s " + TempRegFile);
                    proc.Start();
                }
                while (!File.Exists(TempRegFile))
                {
                    Thread.Sleep(100);
                }

                File.Delete(TempRegFile);
            }
        }
Esempio n. 4
0
 //private static Pcsx2TabControl _pcsx2TabControl;
 internal static void InitEpsxeControl(EpsxeTabControl epsxeTabControl)
 {
     _epsxeTabControl = epsxeTabControl;
 }