Ejemplo n.º 1
0
        protected override void OnPrepareMSDialog()
        {
            //Default yugi directory with fallback
            base.FileDlgInitialDirectory = YuGiExtendedMethods.GetDefaultGamePath()[0];//Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
            base.FileDlgShowHelp         = false;
            base.FileDlgMultiselect      = true;

            //base.FileDlgFileNames
            //base.
            if (Environment.OSVersion.Version.Major < 6)
            {
                MSDialog.SetPlaces(new object[] { @"c:\", (int)Places.MyComputer, (int)Places.Favorites, (int)Places.Printers, (int)Places.Fonts, });
            }
            base.OnPrepareMSDialog();
        }
Ejemplo n.º 2
0
 private void Button_ChangePath_Click(object sender, EventArgs e)
 {
     YuGiExtendedMethods.SetDefaultGamePath();
 }
Ejemplo n.º 3
0
        static public Process startYuGiBase(string filepath, bool customDirectories)
        {
            Process theGame = new Process();
            string  directory, file;

            if (customDirectories)
            {
                directory = Path.GetDirectoryName(filepath);
                file      = filepath;
            }
            else
            {
                string[] FileDirectoryFromGame = YuGiExtendedMethods.GetDefaultGamePath();
                directory = FileDirectoryFromGame[0];
                file      = FileDirectoryFromGame[1];
            }

            string registry_flags = "DISABLEDWM";

            theGame.StartInfo.FileName         = file;
            theGame.StartInfo.Arguments        = "";
            theGame.StartInfo.WorkingDirectory = directory;// + "\\test123\\"; //Anti-Crash fix (konami...), injection point for efficient modlauncher

            RegistryKey   checkSettings = Registry.CurrentUser.OpenSubKey("SOFTWARE\\YuGiOhModLauncher\\v1\\", true);
            List <string> parametersExe = new List <string>();

            foreach (var item in checkSettings.GetValueNames())
            {
                bool boolCheck = false;

                if (item != "Language" && item != "GamePath")
                {
                    boolCheck = Convert.ToBoolean(checkSettings.GetValue(item));
                }

                //I like offending people, because I think people who get offended should be offended.
                switch (item)
                {
                case "60 FPS Mode": if (boolCheck)
                    {
                        parametersExe.Add("-speedy");
                    }
                    break;

                case "Disable Sound": if (boolCheck)
                    {
                        parametersExe.Add("-nosound");
                    }
                    break;

                case "Easy": if (boolCheck)
                    {
                        parametersExe.Add("-e");
                    }
                    break;

                case "FPS Counter": if (boolCheck)
                    {
                        parametersExe.Add("-fps");
                    }
                    break;

                case "Full Screen (16-Bit)": if (boolCheck)
                    {
                        parametersExe.Add("-16");
                    }
                    break;

                case "Full Screen (24-Bit)": if (boolCheck)
                    {
                        parametersExe.Add("-24");
                    }
                    break;

                case "Full Screen (32-Bit)": if (boolCheck)
                    {
                        parametersExe.Add("-32");
                    }
                    break;

                case "Hard": if (boolCheck)
                    {
                        parametersExe.Add("-h");
                    }
                    break;

                case "Language":
                    switch (checkSettings.GetValue(item).ToString())
                    {
                    case "Spanish":
                        parametersExe.Add("-Lspa");
                        break;

                    case "Italian":
                        parametersExe.Add("-Lita");
                        break;

                    case "French":
                        parametersExe.Add("-Lfra");
                        break;

                    case "English":
                        parametersExe.Add("-Leng");
                        break;

                    case "German":
                        parametersExe.Add("-Lger");
                        break;

                    case "Japanese":
                        parametersExe.Add("-Ljpn");
                        break;
                    }
                    break;

                case "Window Mode": if (boolCheck)
                    {
                        parametersExe.Add("-win");
                    }
                    break;

                case "Windows Vista+ Bugfix":
                    RegistryKey myKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\\", true);

                    //Bugfix for Windows 7+ (TODO: More...)
                    if (myKey != null)
                    {
                        myKey.SetValue(file, registry_flags, RegistryValueKind.String);
                        myKey.Close();
                    }
                    break;
                }
            }

            try
            {
                theGame.StartInfo.Arguments = String.Join(" ", parametersExe);
                theGame.Start();
            }
            catch //When something f***s up try to start with admin rights
            {
                theGame.StartInfo.Verb = "runas";
                theGame.Start();
            }

            return(theGame);
        }