Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        internal static void SetSaveDirs(Model.Model model)
        {
            foreach (var gd in model.GameData)
            {
                if (gd.Value.SaveDir.StartsWith("??") || gd.Value.SaveDir.Contains("."))
                {
                    gd.Value.SaveDir = Tools.HashGenerator.GetHash(gd.Value.LaunchFile).ToString("x8");
                }

                gd.Value.GameSetting.PreviousOfficialEmulationState = gd.Value.GameSetting.OfficialEmulationState;

                if (gd.Value.ShaderCacheFileSize == -1)
                {
                    var      version = CemuFeatures.GetLatestVersion(model);
                    FileInfo info    = new FileInfo(Path.Combine(SpecialFolders.ShaderCacheFolderCemu(version), gd.Value.SaveDir + ".bin"));
                    if (File.Exists(info.FullName))
                    {
                        gd.Value.ShaderCacheFileSize = (int)info.Length;
                    }
                    else
                    {
                        gd.Value.ShaderCacheFileSize = 999;
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Save to XML
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        internal static Model.Model Load(string fileName)
        {
            Model.Model model;

            if (File.Exists(fileName))
            {
                XmlSerializer xsSubmit = new XmlSerializer(typeof(Model.Model));

                using (var sww = new StreamReader(fileName))
                {
                    XmlReader writer = XmlReader.Create(sww);
                    model = (Model.Model)xsSubmit.Deserialize(writer);
                }


                FileManager.SearchForInstalledVersions(model);
                FolderScanner.GetGameInformation(null, "", "");
                SetGameTypes(model);
                CemuFeatures.UpdateFeaturesForInstalledVersions(model);

                SetSaveDirs(model);

                return(model);
            }
            model = new Model.Model();
            return(model);
        }
Пример #3
0
        internal static void DownloadCemu(Form parent, Unpacker unpacker, Model.Model model)
        {
            using (FormMultiFileDownload dl = new FormMultiFileDownload(model))
            {
                dl.ShowDialog(parent);
            }

            SearchForInstalledVersions(model);

            if (Directory.Exists("graphicsPacks"))
            {
                FolderScanner.FindGraphicsPacks(new DirectoryInfo(Path.Combine("graphicsPacks", "graphicsPacks")), model.GraphicsPacks);
            }
            FolderScanner.AddGraphicsPacksToGames(model);
            CemuFeatures.UpdateFeaturesForInstalledVersions(model);
        }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        internal static void SearchForInstalledVersions(Model.Model model)
        {
            CemuFeatures.SetVersionSizes();

            if (Directory.Exists(model.Settings.DefaultInstallFolder))
            {
                foreach (var folder in Directory.EnumerateDirectories(model.Settings.DefaultInstallFolder))
                {
                    string version;
                    if (CemuFeatures.IsCemuFolder(folder, out version))
                    {
                        AddInstalledVersion(model, folder, version);
                    }
                }
            }
        }
Пример #5
0
        static void Main()
        {
            string programFiles = Environment.ExpandEnvironmentVariables("%ProgramW6432%");

            var arguments = Environment.GetCommandLineArgs();

            if (!arguments[0].Contains(programFiles))
            {
                if (arguments[0].Contains("Budford.exe"))
                {
                    IsInstalled = false;
                }
            }

            var model = FormMainWindow.TransferLegacyModel();

            if (!Get45Or451FromRegistry())
            {
                MessageBox.Show(Resources.Program_Main_Needs__NET_4_5_or_higher_to_run, Resources.Program_Main_Please_update_your__NET_run_environment);
            }

            if (IsInstalled)
            {
                SetDefaultFolder(model);
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);


            bool   cmdLineLaunch     = false;
            bool   cmdLineFullScreen = false;
            string cmdLineFileName   = string.Empty;

            ParseCommandLineArguments(arguments, ref cmdLineLaunch, ref cmdLineFullScreen, ref cmdLineFileName);

            if (arguments.Length == 2)
            {
                cmdLineLaunch = true;
            }

            FormMainWindow mainForm = new FormMainWindow();

            if (cmdLineFileName == string.Empty || !cmdLineLaunch)
            {
                Application.Run(mainForm);
            }
            else
            {
                if (model.Settings.StopHotkey != "None")
                {
                    mainForm.launchGame = cmdLineFileName;
                    mainForm.LaunchFull = cmdLineFullScreen;

                    Application.Run(mainForm);
                }
                else
                {
                    if (model.Settings.AutomaticallyDownloadGraphicsPackOnStart)
                    {
                        CemuFeatures.DownloadLatestGraphicsPack(null, model, false);
                    }
                    foreach (var game in model.GameData)
                    {
                        if (game.Value.LaunchFile.ToLower() == cmdLineFileName.ToLower())
                        {
                            game.Value.Exists = true;
                            new Launcher(null).LaunchCemu(null, model, game.Value, false, false, true, cmdLineFullScreen);
                            return;
                        }
                    }
                    new Launcher(null).LaunchRpx(model, cmdLineFileName, cmdLineFullScreen);
                }
            }
        }