Exemplo n.º 1
0
 public override void DeleteUpdate()
 {
     base.DeleteUpdate();
     try
     {
         GClass6.smethod_5(System.IO.Path.Combine(this.UpdatePath, "code"));
     }
     catch
     {
     }
     try
     {
         GClass6.smethod_5(System.IO.Path.Combine(this.UpdatePath, "meta"));
     }
     catch
     {
     }
     try
     {
         GClass6.smethod_5(System.IO.Path.Combine(this.UpdatePath, "content"));
     }
     catch
     {
     }
 }
Exemplo n.º 2
0
 public override void DeleteUpdate()
 {
     try
     {
         GClass6.smethod_5(this.UpdatePath);
     }
     catch
     {
     }
 }
Exemplo n.º 3
0
 public override void DeleteDlc()
 {
     try
     {
         GClass6.smethod_5(this.DlcPath);
     }
     catch
     {
     }
 }
Exemplo n.º 4
0
 protected override void PrepareRomIfNecessary(bool directDownload)
 {
     if (!this.Boolean_2)
     {
         string str = Path.Combine(this.String_5, this.gclass30_0.TitleId.IdRaw);
         GClass6.smethod_5(str);
         this.gclass30_0.method_3(str, false);
         string name = new DirectoryInfo(this.CurrentGamePath).Name;
         GClass6.smethod_5(Path.Combine(this.String_5, name));
         FileSystem.RenameDirectory(str, name);
     }
     this.PrepareUpdateIfNecessary(directDownload);
 }
Exemplo n.º 5
0
    // Token: 0x060003AC RID: 940 RVA: 0x00009CB8 File Offset: 0x00007EB8
    public static GraphicsPath smethod_1(float float_0, float float_1, float float_2, float float_3, double double_0 = 0.3, bool bool_0 = true, bool bool_1 = true, bool bool_2 = true, bool bool_3 = true)
    {
        float        num  = GClass6.smethod_5(float_2, float_3) * (float)double_0;
        float        num2 = float_0 + float_2;
        float        num3 = float_1 + float_3;
        GraphicsPath graphicsPath_;
        GraphicsPath result = graphicsPath_ = GClass6.smethod_4();

        if (bool_0)
        {
            GClass6.smethod_6(graphicsPath_, float_0, float_1, num, num, 180f, 90f);
        }
        else
        {
            GClass6.smethod_7(graphicsPath_, float_0, float_1, float_0, float_1);
        }
        if (bool_1)
        {
            GClass6.smethod_6(graphicsPath_, num2 - num, float_1, num, num, 270f, 90f);
        }
        else
        {
            GClass6.smethod_7(graphicsPath_, num2, float_1, num2, float_1);
        }
        if (bool_2)
        {
            GClass6.smethod_6(graphicsPath_, num2 - num, num3 - num, num, num, 0f, 90f);
        }
        else
        {
            GClass6.smethod_7(graphicsPath_, num2, num3, num2, num3);
        }
        if (bool_3)
        {
            GClass6.smethod_6(graphicsPath_, float_0, num3 - num, num, num, 90f, 90f);
        }
        else
        {
            GClass6.smethod_7(graphicsPath_, float_0, num3, float_0, num3);
        }
        GClass6.smethod_8(graphicsPath_);
        return(result);
    }
Exemplo n.º 6
0
        private bool CheckNvidiaDriverVersion()
        {
            try
            {
                foreach (ManagementObject managementObject in new ManagementObjectSearcher("SELECT * FROM Win32_VideoController").Get())
                {
                    PropertyData property1 = managementObject.Properties["CurrentBitsPerPixel"];
                    PropertyData property2 = managementObject.Properties["Description"];
                    PropertyData property3 = managementObject.Properties["DriverVersion"];
                    int          result;
                    if (property1.Value != null && property2.Value != null && (property3.Value != null && property2.Value.ToString().ToLower().Contains("nvidia")) && (int.TryParse(property3.Value.ToString().Replace(".", "").Substring(5), out result) && result < 38792))
                    {
                        switch (RadMessageBox.Show("USB Helper has detected that your NVIDIA driver is very old. You will encounter several issues when playing games with Cemu. Please update your driver as soon as possible. Should I take you to the download page?", "Old driver", MessageBoxButtons.YesNoCancel))
                        {
                        case DialogResult.Cancel:
                            return(false);

                        case DialogResult.Yes:
                            Process.Start("http://www.nvidia.fr/Download/index.aspx");
                            if (RadMessageBox.Show("It is recommended that you also delete your old shader cache, should I do it for you?", "Delete shader cache?", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                                GClass6.smethod_5(System.IO.Path.Combine(this.Root_BIN_Path, "shaderCache", "precompiled"));
                            }
                            return(false);

                        default:
                            continue;
                        }
                    }
                }
            }
            catch
            {
            }
            return(true);
        }
Exemplo n.º 7
0
        private void DownloadArchive(GClass32 archive)
        {
            string str = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), nameof(Citra), "nand", "00000000000000000000000000000000", "title", archive.TitleId.Low.ToLower(), archive.TitleId.High.ToLower(), "content");

            Directory.CreateDirectory(str);
            string destinationFile = Path.Combine(str, "00000000.app.romfs");

            if (System.IO.File.Exists(destinationFile))
            {
                return;
            }
            GClass80 gclass80 = new GClass80((WebProxy)null, true, true);
            FrmWait  frmWait  = new FrmWait("Downloading system archive from: NUS...", true);

            gclass80.Event_5 += (EventHandler <GClass81>)((_param1, _param2) =>
            {
                string temp_dir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
                GClass6.smethod_5(temp_dir);
                Directory.CreateDirectory(temp_dir);
                Path.Combine(temp_dir, "game.cia");
                archive.method_5(temp_dir, "game");
                GClass27.smethod_11(temp_dir);
                ProcessStartInfo processStartInfo1 = new ProcessStartInfo()
                {
                    FileName         = Path.Combine(temp_dir, "PART1"),
                    WorkingDirectory = temp_dir
                };
                Process process1 = new Process();
                process1.StartInfo           = processStartInfo1;
                process1.EnableRaisingEvents = true;
                process1.Exited += (EventHandler)((sender1, e1) =>
                {
                    try
                    {
                        IEnumerable <FileInfo> potential_files = new DirectoryInfo(temp_dir).EnumerateFiles("contents.*");
                        if (potential_files.Count <FileInfo>() == 0)
                        {
                            throw new Exception("An error occured while preparing the system archive!");
                        }
                        FileInfo fileInfo = potential_files.First <FileInfo>((Func <FileInfo, bool>)(x => x.Length == potential_files.Max <FileInfo>((Func <FileInfo, long>)(y => y.Length))));
                        ProcessStartInfo processStartInfo2 = new ProcessStartInfo()
                        {
                            FileName = Path.Combine(temp_dir, "3dstool.exe"),
                            WorkingDirectory = temp_dir,
                            Arguments = string.Format("-xvtf cfa {0} --romfs 00000000.app.romfs --romfs-auto-key", (object)fileInfo)
                        };
                        Process process2 = new Process();
                        process2.StartInfo = processStartInfo2;
                        process2.Exited += (EventHandler)((sender2, e2) =>
                        {
                            string path = Path.Combine(temp_dir, "00000000.app.romfs");
                            using (FileStream fileStream1 = System.IO.File.Create(destinationFile))
                            {
                                using (FileStream fileStream2 = System.IO.File.Open(path, FileMode.Open))
                                {
                                    fileStream2.Seek(4096L, SeekOrigin.Begin);
                                    for (int index = 0; (long)index < fileStream2.Length - 4096L; ++index)
                                    {
                                        int num = fileStream2.ReadByte();
                                        fileStream1.WriteByte((byte)num);
                                    }
                                }
                            }
                            GClass6.smethod_5(temp_dir);
                            frmWait.method_0();
                        });
                        process2.EnableRaisingEvents = true;
                        process2.Start();
                    }
                    catch
                    {
                    }
                });
                process1.Start();
            });
            gclass80.Event_6 += (EventHandler <GEventArgs0>)((sender, e) => frmWait.method_2(e.GameProgress));
            gclass80.method_1(((IEnumerable <GClass30>) new GClass30[1]
            {
                (GClass30)archive
            }).ToList <GClass30>(), 100, 10000);
            int num1 = (int)frmWait.ShowDialog();
        }
Exemplo n.º 8
0
        private void InternaPrelPlay()
        {
            if (!this.CheckNvidiaDriverVersion())
            {
                return;
            }
            if (this.EmuConfiguration_0.AutoUpdate && new ComputerInfo().TotalPhysicalMemory >= 6442450944UL)
            {
                this.InstallCommunityShaders();
            }
            this.Event_0           += (EventHandler)((sender, e) => Class27.smethod_0(this.gclass30_0 as GClass32));
            this._modArgumentString = (string)null;
            GClass15 gclass15 = new GClass15((GClass32)this.gclass30_0);

            if (gclass15.InstalledMods.Count <= 0)
            {
                return;
            }
            Dictionary <string, ulong> counter     = (Dictionary <string, ulong>)null;
            Dictionary <string, ulong> counter_mlc = (Dictionary <string, ulong>)null;

            try
            {
                counter = JsonConvert.DeserializeObject <Dictionary <string, ulong> >(System.IO.File.ReadAllText(this.PerformanceFile));
            }
            catch
            {
                counter = new Dictionary <string, ulong>();
            }
            try
            {
                counter_mlc = JsonConvert.DeserializeObject <Dictionary <string, ulong> >(System.IO.File.ReadAllText(this.PerformanceFileMlc));
            }
            catch
            {
                counter_mlc = new Dictionary <string, ulong>();
            }
            gclass15.method_7();
            List <GClass16> gclass16List = gclass15.method_4();
            Class22         mapper       = new Class22(this.CurrentGamePath, counter, 134217728L);
            Class22         mapper_mlc   = new Class22(System.IO.Path.Combine(this.Root_BIN_Path, "mlc01"), counter_mlc, 134217728L);

            foreach (Alphaleonis.Win32.Filesystem.FileInfo fileInfo in gclass15.List_0)
            {
                if (System.IO.File.Exists(this.Root_BIN_Path + "\\mlc01\\usr\\title\\00050000\\" + this.gclass30_0.TitleId.High.ToLower() + fileInfo.FullName.Substring(gclass15.String_0.Length)))
                {
                    mapper_mlc.method_1("\\usr\\title\\00050000\\" + this.gclass30_0.TitleId.High.ToLower() + fileInfo.FullName.Substring(gclass15.String_0.Length), fileInfo.FullName);
                }
                else if (System.IO.File.Exists(this.CurrentGamePath + fileInfo.FullName.Substring(gclass15.String_0.Length)))
                {
                    mapper.method_1(fileInfo.FullName.Substring(gclass15.String_0.Length), fileInfo.FullName);
                }
                else
                {
                    mapper_mlc.method_1("\\usr\\title\\00050000\\" + this.gclass30_0.TitleId.High.ToLower() + fileInfo.FullName.Substring(gclass15.String_0.Length), fileInfo.FullName);
                    mapper.method_1(fileInfo.FullName.Substring(gclass15.String_0.Length), fileInfo.FullName);
                }
            }
            foreach (GClass16 gclass16 in gclass16List)
            {
                string string_2 = gclass15.String_0 + gclass16.ArchiveRelativePath;
                mapper.method_1(gclass16.GameRelativePath, string_2);
                mapper_mlc.method_1("\\usr\\title\\00050000\\" + this.gclass30_0.TitleId.High.ToLower() + gclass16.GameRelativePath, string_2);
            }
            Task.Run((Action)(() =>
            {
                foreach (KeyValuePair <string, ulong> keyValuePair in (IEnumerable <KeyValuePair <string, ulong> >)counter.OrderByDescending <KeyValuePair <string, ulong>, ulong>((Func <KeyValuePair <string, ulong>, ulong>)(x => x.Value)))
                {
                    mapper.method_2(keyValuePair.Key);
                }
                foreach (KeyValuePair <string, ulong> keyValuePair in (IEnumerable <KeyValuePair <string, ulong> >)counter_mlc.OrderByDescending <KeyValuePair <string, ulong>, ulong>((Func <KeyValuePair <string, ulong>, ulong>)(x => x.Value)))
                {
                    mapper_mlc.method_2(keyValuePair.Key);
                }
                mapper.method_0();
                mapper_mlc.method_0();
            }));
            System.IO.Directory.CreateDirectory(System.IO.Path.Combine(GClass88.DirectoryCache, "mods", "mount"));
            foreach (System.IO.DirectoryInfo enumerateDirectory in new System.IO.DirectoryInfo(System.IO.Path.Combine(GClass88.DirectoryCache, "mods", "mount")).EnumerateDirectories())
            {
                try
                {
                    try
                    {
                        Dokan.RemoveMountPoint(enumerateDirectory.FullName);
                    }
                    catch
                    {
                    }
                    enumerateDirectory.Delete(true);
                }
                catch
                {
                }
            }
            string mount_point     = System.IO.Path.Combine(GClass88.DirectoryCache, "mods", "mount", System.IO.Path.GetRandomFileName());
            string mount_point_mlc = System.IO.Path.Combine(GClass88.DirectoryCache, "mods", "mount", System.IO.Path.GetRandomFileName());

            GClass6.smethod_5(mount_point);
            System.IO.Directory.CreateDirectory(mount_point);
            System.IO.Directory.CreateDirectory(mount_point_mlc);
            this.Event_0 += (EventHandler)((sender, e) =>
            {
                mapper.method_4();
                mapper_mlc.method_4();
                System.IO.File.WriteAllText(this.PerformanceFile, JsonConvert.SerializeObject((object)counter));
                string performanceFileMlc = this.PerformanceFileMlc;
                IEnumerable <KeyValuePair <string, ulong> > source = counter_mlc.Where <KeyValuePair <string, ulong> >((Func <KeyValuePair <string, ulong>, bool>)(x => x.Key.Contains("\\USR\\TITLE\\00050000\\")));
                Func <KeyValuePair <string, ulong>, string> func = (Func <KeyValuePair <string, ulong>, string>)(x => x.Key);
                Func <KeyValuePair <string, ulong>, string> keySelector;
                string contents = JsonConvert.SerializeObject((object)source.ToDictionary <KeyValuePair <string, ulong>, string, ulong>(keySelector, (Func <KeyValuePair <string, ulong>, ulong>)(x => x.Value)));
                System.IO.File.WriteAllText(performanceFileMlc, contents);
                Dokan.RemoveMountPoint(mount_point);
                Dokan.RemoveMountPoint(mount_point_mlc);
                GClass6.smethod_5(mount_point);
                GClass6.smethod_5(mount_point_mlc);
            });
            Task.Run((Action)(() => mapper.Mount(mount_point, DokanOptions.WriteProtection, 10, (ILogger)null)));
            Task.Run((Action)(() => mapper_mlc.Mount(mount_point_mlc, DokanOptions.FixedDrive, 10, (ILogger)null)));
            Thread.Sleep(2000);
            this._modArgumentString = this.GenerateArguments(((IEnumerable <string>)System.IO.Directory.GetFiles(System.IO.Path.Combine(mount_point, "code") + "\\")).Where <string>((Func <string, bool>)(x => System.IO.Path.GetExtension(x) == ".rpx")).ToList <string>()[0], mount_point_mlc);
        }