Exemplo n.º 1
0
        //On form closing
        protected override void OnClosing(CancelEventArgs e)
        {
            //Defines ini files
            var gameIni = new IniFile(AppDomain.CurrentDomain.BaseDirectory + @"\resources\configs\" + currentGame + @"\spectabis.ini");
            var uiIni   = new IniFile(AppDomain.CurrentDomain.BaseDirectory + @"\resources\configs\" + currentGame + @"\PCSX2_ui.ini");
            var vmIni   = new IniFile(AppDomain.CurrentDomain.BaseDirectory + @"\resources\configs\" + currentGame + @"\PCSX2_vm.ini");
            var gsdxIni = new IniFile(AppDomain.CurrentDomain.BaseDirectory + @"\resources\configs\" + currentGame + @"\GSdx.ini");

            //Writes zoom level to pcsx2_ui
            uiIni.Write("Zoom", zoom.Text, "GSWindow");

            //Aspect Ratio - written to pcsx2_ui
            if (aspectratio.Text == "Letterbox")
            {
                uiIni.Write("AspectRatio", "4:3", "GSWindow");
            }
            else if (aspectratio.Text == "Widescreen")
            {
                uiIni.Write("AspectRatio", "16:9", "GSWindow");
            }
            else
            {
                uiIni.Write("AspectRatio", "Stretch", "GSWindow");
            }

            //Emulation Settings - written to spectabis ini
            if (nogui.Checked == true)
            {
                gameIni.Write("nogui", "1", "Spectabis");
            }
            else
            {
                gameIni.Write("nogui", "0", "Spectabis");
            }

            if (fullscreen.Checked == true)
            {
                gameIni.Write("fullscreen", "1", "Spectabis");
            }
            else
            {
                gameIni.Write("fullscreen", "0", "Spectabis");
            }

            if (fullboot.Checked == true)
            {
                gameIni.Write("fullboot", "1", "Spectabis");
            }
            else
            {
                gameIni.Write("fullboot", "0", "Spectabis");
            }

            if (nohacks.Checked == true)
            {
                gameIni.Write("nohacks", "1", "Spectabis");
            }
            else
            {
                gameIni.Write("nohacks", "0", "Spectabis");
            }

            gameIni.Write("isoDirectory", isoDirBox.Text, "Spectabis");


            //Widescreen patch - written to pcsx2_vm
            if (widescreen.Checked == true)
            {
                vmIni.Write("EnableWideScreenPatches", "enabled", "EmuCore");
            }
            else
            {
                vmIni.Write("EnableWideScreenPatches", "disabled", "EmuCore");
            }


            //Mipmap hack - written to gsdx.ini
            if (hwmipmap.Checked == true)
            {
                gsdxIni.Write("UserHacks_mipmap", "1", "Settings");
                gsdxIni.Write("UserHacks", "1", "Settings");
            }
            else
            {
                gsdxIni.Write("UserHacks_mipmap", "0", "Settings");
            }

            //Show mainForm
            this.RefToForm2.Show();
        }
Exemplo n.º 2
0
        //Add Iso function
        public void addIso(string _img, string _isoDir, string _title)
        {
            //Item properties
            FlowLayoutPanel gameGroupBox = new FlowLayoutPanel();

            gameGroupBox.FlowDirection = FlowDirection.TopDown;
            gameGroupBox.AutoSize      = true;
            gameGroupBox.WrapContents  = true;
            gameGroupBox.Name          = _title;

            PictureBox gameBox = new PictureBox();

            gameBox.Height   = 200;
            gameBox.Width    = 150;
            gameBox.SizeMode = PictureBoxSizeMode.StretchImage;

            _title = _title.Replace(@"/", string.Empty);
            _title = _title.Replace(@"\", string.Empty);
            _title = _title.Replace(@":", string.Empty);

            //Path to iso from mainForm
            string selfPath = Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]);


            //If boxart exists in folder, then set it in isoPanel
            if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\resources\configs\" + _title + @"\art.jpg"))
            {
                gameBox.ImageLocation = AppDomain.CurrentDomain.BaseDirectory + @"\resources\configs\" + _title + @"\art.jpg";
            }
            else
            {
                gameBox.ImageLocation = _img;
            }

            Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + @"\resources\configs\" + _title);

            //copies pcsx2 inis to added game

            //looks for inis in pcsx2 directory
            if (Directory.Exists(emuDir + @"\inis\"))
            {
                string[] inisDir = Directory.GetFiles(emuDir + @"\inis\");
                foreach (string inifile in inisDir)
                {
                    Debug.WriteLine(inifile + " found!");
                    if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\resources\configs\" + _title + @"\" + Path.GetFileName(inifile)) == false)
                    {
                        string _destinationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + @"\resources\configs\" + _title + @"\" + Path.GetFileName(inifile));
                        File.Copy(inifile, _destinationPath);
                    }
                }
            }
            else
            {
                //looks for pcsx2 inis in documents folder
                if (Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\PCSX2\inis"))
                {
                    string[] inisDirDoc = Directory.GetFiles((Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\PCSX2\inis"));
                    foreach (string inifile in inisDirDoc)
                    {
                        if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\resources\configs\" + _title + @"\" + Path.GetFileName(inifile)) == false)
                        {
                            string _destinationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + @"\resources\configs\" + _title + @"\" + Path.GetFileName(inifile));
                            File.Copy(inifile, _destinationPath);
                        }
                    }
                }

                //if no inis are found, warning is shown
                else
                {
                    MessageBox.Show("Cannot find default PCSX2 configuration at " + emuDir + @"\inis\");
                    MessageBox.Show("Neither in " + Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\PCSX2\inis");
                }
            }



            gameBox.Name       = _title;
            gameBox.MouseDown += gameBox_Click;
            gameBox.Tag        = _isoDir;
            gamelist.Add(_isoDir);
            gameGroupBox.Controls.Add(gameBox);

            //If showtitle is selected, create a label object
            if (Properties.Settings.Default.showtitle == true)
            {
                MaterialLabel gamelabel = new MaterialLabel();
                gamelabel.Text  = _title;
                gamelabel.Width = 180;
                gameGroupBox.Controls.Add(gamelabel);
            }

            isoPanel.Controls.Add(gameGroupBox);



            Debug.WriteLine("creating a folder at - " + AppDomain.CurrentDomain.BaseDirectory + @"\resources\configs\" + _title);


            using (WebClient client = new WebClient())
            {
                try
                {
                    client.DownloadFile(_img, AppDomain.CurrentDomain.BaseDirectory + @"\resources\configs\" + _title + @"\art.jpg");
                }
                catch
                {
                    //throw;
                    MessageBox.Show("Image not available, none set.");
                }
            }

            var gameIni = new IniFile(AppDomain.CurrentDomain.BaseDirectory + @"\resources\configs\" + _title + @"\spectabis.ini");

            gameIni.Write("isoDirectory", _isoDir, "Spectabis");
            gameIni.Write("nogui", "0", "Spectabis");
            gameIni.Write("fullscreen", "0", "Spectabis");
            gameIni.Write("fullboot", "0", "Spectabis");

            //MessageBox.Show("Please, configure the game");
            //string cfgDir = AppDomain.CurrentDomain.BaseDirectory + @"\resources\configs\" + _title;
            //Process.Start(emuDir + @"\pcsx2.exe", "--cfgpath \"" + cfgDir + "\"");
        }