From e483fe990ebd36f1241906a18215220243f96c21 Mon Sep 17 00:00:00 2001 From: Jakob Date: Fri, 6 Jul 2018 18:56:45 +0200 Subject: [PATCH] working on auto-mode --- download-resources/create.bat | 4 + h-encore-auto/AutoMode.xaml.cs | 140 ++++++++++++++++++++------------ h-encore-auto/VitaGuide.xaml.cs | 6 +- h-encore-auto/ref.cs | 1 + 4 files changed, 95 insertions(+), 56 deletions(-) create mode 100644 download-resources/create.bat diff --git a/download-resources/create.bat b/download-resources/create.bat new file mode 100644 index 0000000..7495ca2 --- /dev/null +++ b/download-resources/create.bat @@ -0,0 +1,4 @@ +..\psvimg-create -n app -K %1 app PCSG90096/app +..\psvimg-create -n appmeta -K %1 appmeta PCSG90096/appmeta +..\psvimg-create -n license -K %1 license PCSG90096/license +..\psvimg-create -n savedata -K %1 savedata PCSG90096/savedata \ No newline at end of file diff --git a/h-encore-auto/AutoMode.xaml.cs b/h-encore-auto/AutoMode.xaml.cs index c6e71d4..6eb9536 100644 --- a/h-encore-auto/AutoMode.xaml.cs +++ b/h-encore-auto/AutoMode.xaml.cs @@ -37,11 +37,14 @@ namespace h_encore_auto Util.DeleteDirectory(Ref.tempDir); Directory.CreateDirectory(Ref.tempDir); } + + InitTimer(); } private void buttonStart_Click(object sender, RoutedEventArgs e) { buttonStart.IsEnabled = false; + buttonClose.IsEnabled = false; barWorking.Visibility = Visibility.Visible; new Thread(() => @@ -71,6 +74,10 @@ namespace h_encore_auto startInfo.FileName = "cmd.exe"; startInfo.WorkingDirectory = Ref.tempDir; + startInfoOut.WindowStyle = ProcessWindowStyle.Hidden; + startInfoOut.FileName = "cmd.exe"; + startInfoOut.WorkingDirectory = Ref.tempDir; + startInfo.Arguments = "/C 7zr.exe x 7z-extra.7z"; process.StartInfo = startInfo; process.Start(); @@ -89,6 +96,8 @@ namespace h_encore_auto File.WriteAllText(Ref.pathImportReg, text); text = text.Replace("\\", "/"); File.WriteAllText(Ref.pathImportReg, text); + text = text.Replace("HKEY_CURRENT_USER/Software/codestation/qcma", @"HKEY_CURRENT_USER\Software\codestation\qcma"); + File.WriteAllText(Ref.pathImportReg, text); startInfo.Arguments = "/C " + Ref.path7z + " x " + Ref.pathPsvimg; process.StartInfo = startInfo; @@ -105,6 +114,8 @@ namespace h_encore_auto process.Start(); process.WaitForExit(); + Util.dlFile(Ref.urlCreateBat, "h-encore\\create.bat"); + startInfo.Arguments = "/C " + Ref.path7z + " x " + Ref.pathQcma; process.StartInfo = startInfo; process.Start(); @@ -178,58 +189,7 @@ namespace h_encore_auto process.StartInfo = startInfo; process.Start(); - var guide = new VitaGuide(); - for (; ; ) - { - guide.ShowDialog(); - - if (Util.IsDirectoryEmpty(Ref.pathQcmaRes + "PSVita\\APP\\")) - { - MessageBox.Show("Required folder not found. \nMake sure you did everything correctly and follow the steps again."); - } - else - { - break; - } - } - - Ref.shortAID = Directory.GetDirectories(Ref.pathQcmaRes + "PSVita\\APP\\")[0]; - - Ref.longAID = Util.GetEncKey(Ref.shortAID); - - startInfo.WorkingDirectory = Ref.tempDir + "h-encore"; - - startInfo.Arguments = @"/C ..\psvimg-create -n app -K " + Ref.longAID + " PCSG90096/app"; - process.StartInfo = startInfo; - process.Start(); - process.WaitForExit(); - - startInfo.Arguments = @"/C ..\psvimg-create -n appmeta -K " + Ref.longAID + " PCSG90096/appmeta"; - process.StartInfo = startInfo; - process.Start(); - process.WaitForExit(); - - startInfo.Arguments = @"/C ..\psvimg-create -n license -K " + Ref.longAID + " PCSG90096/license"; - process.StartInfo = startInfo; - process.Start(); - process.WaitForExit(); - - startInfo.Arguments = @"/C ..\psvimg-create -n savedata -K " + Ref.longAID + " PCSG90096/savedata"; - process.StartInfo = startInfo; - process.Start(); - process.WaitForExit(); - - startInfo.Arguments = "/C xcopy /E /Y /I " + Ref.tempDir + @"h-encore\PCSG90096\ " + Ref.pathQcmaRes + "PSVita\\" + Ref.shortAID + "\\PCSG90096\\"; - process.StartInfo = startInfo; - process.Start(); - process.WaitForExit(); - - Ref.isSecondGuide = true; - guide.ShowDialog(); - - MessageBox.Show("If not already done, wait until your Vita has copied over the exploit, then press OK."); - - Util.Cleanup(); + stage = 1; }).Start(); } @@ -241,8 +201,82 @@ namespace h_encore_auto private void buttonClose_Click(object sender, RoutedEventArgs e) { - Util.Cleanup(); } + + private int stage = 0; + private System.Windows.Forms.Timer timer1; + public void InitTimer() + { + timer1 = new System.Windows.Forms.Timer(); + timer1.Tick += new EventHandler(timer1_Tick); + timer1.Interval = 1000; // in miliseconds + timer1.Start(); + } + + private void timer1_Tick(object sender, EventArgs e) + { + var guide = new VitaGuide(); + if (stage == 1) + { + for (; ; ) + { + stage = 0; + guide.ShowDialog(); + + if (Util.IsDirectoryEmpty(Ref.pathQcmaRes + "PSVita\\APP\\")) + { + MessageBox.Show("Required folder not found. \nMake sure you did everything correctly and follow the steps again."); + } + else + { + stage = 2; + break; + } + } + } + if (stage == 2) + { + stage = 0; + new Thread(() => + { + Thread.CurrentThread.IsBackground = true; + + Process process = new Process(); + ProcessStartInfo startInfo = new ProcessStartInfo(); + ProcessStartInfo startInfoOut = new ProcessStartInfo(); + + startInfo.WindowStyle = ProcessWindowStyle.Hidden; + startInfo.FileName = "cmd.exe"; + startInfo.WorkingDirectory = Ref.tempDir + "h-encore"; + + Ref.shortAID = Directory.GetDirectories(Ref.pathQcmaRes + "PSVita\\APP\\")[0]; + + Ref.longAID = Util.GetEncKey(Ref.shortAID); + + startInfo.Arguments = @"/C create.bat " + Ref.longAID; + process.StartInfo = startInfo; + process.Start(); + process.WaitForExit(); + + startInfo.Arguments = "/C xcopy /E /Y /I " + Ref.tempDir + @"h-encore\PCSG90096\ " + Ref.pathQcmaRes + "PSVita\\" + Ref.shortAID + "\\PCSG90096\\"; + process.StartInfo = startInfo; + process.Start(); + process.WaitForExit(); + + stage = 3; + }).Start(); + } + if (stage == 3) + { + stage = 0; + Ref.isSecondGuide = true; + guide.ShowDialog(); + + MessageBox.Show("If not already done, wait until your Vita has copied over the exploit, then press OK."); + + Util.Cleanup(); + } + } } } diff --git a/h-encore-auto/VitaGuide.xaml.cs b/h-encore-auto/VitaGuide.xaml.cs index 78f9614..7e6a26d 100644 --- a/h-encore-auto/VitaGuide.xaml.cs +++ b/h-encore-auto/VitaGuide.xaml.cs @@ -29,11 +29,11 @@ namespace h_encore_auto if (Ref.isSecondGuide == true) { - currImg = 101; + currImg = 15; } imgFrame.Source = new BitmapImage(new Uri("/img/" + currImg + ".png", UriKind.Relative)); - textField.Text = currText[currImg]; + textField.Text = currText[currImg - 1]; buttonDone.Visibility = Visibility.Hidden; } @@ -41,7 +41,7 @@ namespace h_encore_auto { currImg++; imgFrame.Source = new BitmapImage(new Uri("/img/" + currImg + ".png", UriKind.Relative)); - textField.Text = currText[currImg]; + textField.Text = currText[currImg - 1]; buttonBck.IsEnabled = true; if (currImg == 14 || currImg == 25) diff --git a/h-encore-auto/ref.cs b/h-encore-auto/ref.cs index 4c13db3..f7a0838 100644 --- a/h-encore-auto/ref.cs +++ b/h-encore-auto/ref.cs @@ -14,6 +14,7 @@ namespace h_encore_auto public static readonly string url7za = "https://www.7-zip.org/a/7z1805-extra.7z"; public static readonly string urlQcma = "https://raw.githubusercontent.com/fyr77/ZUGABE/master/download-resources/Qcma.zip"; public static readonly string urlReg = "https://raw.githubusercontent.com/fyr77/ZUGABE/master/download-resources/qcma.reg"; + public static readonly string urlCreateBat = "https://raw.githubusercontent.com/fyr77/ZUGABE/master/download-resources/create.bat"; public static readonly string pathCurrPic = "img/1.png";