Example #1
0
 private void InstallCommunityShaders()
 {
     try
     {
         string id  = this.GetId();
         long   num = 0;
         string str = System.IO.Path.Combine(this.ShaderTransferDir, id + ".bin");
         if (System.IO.File.Exists(str))
         {
             num = new System.IO.FileInfo(str).Length;
         }
         if (!(GClass6.smethod_20(string.Format("{0}/shaders/proposal.php", (object)Class67.String_1), new NameValueCollection()
         {
             {
                 "id",
                 id
             },
             {
                 "size",
                 num.ToString()
             }
         }) == "LARGER"))
         {
             return;
         }
         GClass27.smethod_7(string.Format("{0}/shaders/vault/{1}.zip", (object)Class67.String_1, (object)id), this.ShaderTransferDir);
     }
     catch
     {
     }
 }
Example #2
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();
        }
Example #3
0
        private void DownloadSharedFont()
        {
            string sharedFontDestination = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), nameof(Citra), "sysdata", "shared_font.bin");

            if (System.IO.File.Exists(sharedFontDestination))
            {
                return;
            }
            GClass80 gclass80 = new GClass80((WebProxy)null, true, true);
            FrmWait  frmWait  = new FrmWait("Downloading the Shared Font from NUS...", true);

            gclass80.Event_5 += (EventHandler <GClass81>)((_param1, _param2) =>
            {
                Path.Combine(Path.GetTempPath(), "game.cia");
                GClass28.gclass32_0.method_5(Path.GetTempPath(), "game");
                string outputDir = Path.GetTempPath();
                GClass27.smethod_11(outputDir);
                ProcessStartInfo processStartInfo1 = new ProcessStartInfo()
                {
                    FileName         = Path.Combine(outputDir, "PART1"),
                    WorkingDirectory = outputDir
                };
                Process process1 = new Process();
                process1.StartInfo           = processStartInfo1;
                process1.EnableRaisingEvents = true;
                process1.Exited += (EventHandler)((sender1, e1) =>
                {
                    try
                    {
                        ProcessStartInfo processStartInfo2 = new ProcessStartInfo()
                        {
                            FileName = Path.Combine(outputDir, "3dstool.exe"),
                            WorkingDirectory = outputDir,
                            Arguments = "-xvtf cfa contents.0000.00000000 --romfs DecryptedRomFS.bin --romfs-auto-key"
                        };
                        Process process2 = new Process();
                        process2.StartInfo = processStartInfo2;
                        process2.Exited += (EventHandler)((sender2, e2) =>
                        {
                            ProcessStartInfo processStartInfo2 = new ProcessStartInfo()
                            {
                                FileName = "3dstool.exe",
                                WorkingDirectory = outputDir,
                                Arguments = "-xvtf romfs DecryptedRomFS.bin --romfs-dir ExtractedRomFS"
                            };
                            Process process2 = new Process();
                            process2.StartInfo = processStartInfo2;
                            process2.EnableRaisingEvents = true;
                            process2.Exited += (EventHandler)((sender3, e3) =>
                            {
                                byte[] buffer = new LZ11().Decompress(System.IO.File.ReadAllBytes(Path.Combine(outputDir, "ExtractedRomFS", "cbf_std.bcfnt.lz")));
                                Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), nameof(Citra), "sysdata"));
                                using (FileStream fileStream = System.IO.File.Create(sharedFontDestination))
                                {
                                    using (MemoryStream memoryStream = new MemoryStream(buffer))
                                    {
                                        memoryStream.Seek(928L, SeekOrigin.Begin);
                                        fileStream.Write(Class3.byte_1, 0, Class3.byte_1.Length);
                                        for (int index = 0; index < 3095744; ++index)
                                        {
                                            int num = memoryStream.ReadByte();
                                            fileStream.WriteByte((byte)num);
                                        }
                                        fileStream.Write(Class3.byte_0, 0, Class3.byte_0.Length);
                                    }
                                }
                                frmWait.method_0();
                            });
                            process2.Start();
                        });
                        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)GClass28.gclass32_0
            }).ToList <GClass30>(), 100, 10000);
            int num1 = (int)frmWait.ShowDialog();
        }
Example #4
0
 public void InstallShaderCache()
 {
     System.IO.Directory.CreateDirectory(this.ShaderTransferDir);
     GClass27.smethod_7(string.Format("{0}{1}.zip", (object)this.ShaderBaseUrl, (object)this.GetId()), this.ShaderTransferDir);
 }