Skip to content

Commit

Permalink
Update to beta03
Browse files Browse the repository at this point in the history
  • Loading branch information
SilicaAndPina committed Oct 10, 2019
1 parent 6bd010e commit 88d9b69
Show file tree
Hide file tree
Showing 17 changed files with 2,462 additions and 215 deletions.
2 changes: 1 addition & 1 deletion CHOVY/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
</configuration>
14 changes: 11 additions & 3 deletions CHOVY/CHOVY-GUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}</ProjectGuid>
<OutputType>Exe</OutputType>
<OutputType>WinExe</OutputType>
<RootNamespace>CHOVY</RootNamespace>
<AssemblyName>CHOVY-SIGN</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
Expand Down Expand Up @@ -37,6 +37,9 @@
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.8.5.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
<HintPath>..\packages\BouncyCastle.1.8.5\lib\BouncyCastle.Crypto.dll</HintPath>
Expand Down Expand Up @@ -84,7 +87,6 @@
<Compile Include="PSVIMGFileStream.cs" />
<Compile Include="PSVIMGStream.cs" />
<Compile Include="PSVIMGStructs.cs" />
<Compile Include="psvimgtools.cs" />
<Compile Include="PSVMDBuilder.cs" />
<EmbeddedResource Include="CHOVY.resx">
<DependentUpon>CHOVY.cs</DependentUpon>
Expand Down Expand Up @@ -128,5 +130,11 @@
<ItemGroup>
<None Include="Resources\MINIS.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\ChovyLogo.png" />
</ItemGroup>
<ItemGroup>
<Content Include="Icon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
151 changes: 60 additions & 91 deletions CHOVY/CHOVY.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using System.IO;
using System.Media;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Windows.Forms;

namespace CHOVY
Expand Down Expand Up @@ -156,20 +156,10 @@ private void FREEDOM_Click(object sender, EventArgs e)
string TitleID = GetTitleID(ISOPath.Text);

string TmpDir = Path.Combine(Application.StartupPath, "_tmp");
string GameWorkDir = Path.Combine(TmpDir, "ux0_pspemu_temp_game_PSP_GAME_"+ TitleID);
// string GameWorkDir = Path.Combine(TmpDir, TitleID);
string LicenseWorkDir = Path.Combine(TmpDir, "ux0_pspemu_temp_game_PSP_LICENSE");
string GameWorkDir = Path.Combine(TmpDir, TitleID);
string EbootFile = Path.Combine(GameWorkDir, "EBOOT.PBP");
string EbootSignature = Path.Combine(GameWorkDir, "__sce_ebootpbp");
string GamePathFile = Path.Combine(GameWorkDir, "VITA_PATH.TXT");
string LicensePathFile = Path.Combine(LicenseWorkDir, "VITA_PATH.TXT");


try
{
Directory.Delete(TmpDir, true);
}
catch (Exception) { };
Directory.CreateDirectory(TmpDir);
Directory.CreateDirectory(GameWorkDir);

Expand All @@ -188,15 +178,20 @@ private void FREEDOM_Click(object sender, EventArgs e)
string Aid = BitConverter.ToString(RifAid).Replace("-", "").ToLower();
string BackupWorkDir = Path.Combine(CmaDir, "PGAME", Aid, TitleID);

TotalProgress.Style = ProgressBarStyle.Continuous;
Status.Text = "Overthrowing The PSPEMU Monarchy 00%";
TotalProgress.Maximum = 100;
Status.Text = "Overthrowing The PSPEMU Monarchy 0%";

string BootupImage = "";
if (isMini(ISOPath.Text))
{
BootupImage = Path.Combine(Application.StartupPath, "_tmp", "minis.png");
Resources.MINIS.Save(BootupImage);
}
else
{
BootupImage = Path.Combine(Application.StartupPath, "_tmp", "chovy.png");
Resources.ChovyLogo.Save(BootupImage);
}

Process signnp = pbp.GenPbpFromIso(ISOPath.Text, EbootFile, ContentID, Versionkey.Text, CompressPBP.Checked, BootupImage);
while (!signnp.HasExited)
Expand All @@ -207,33 +202,29 @@ private void FREEDOM_Click(object sender, EventArgs e)
Progress = Progress.Remove(0,19);
int ProgressInt = int.Parse(Progress.Substring(0,3));
TotalProgress.Value = ProgressInt;
Status.Text = "Overthrowing The PSPEMU Monarchy " + Progress;
Status.Text = "Overthrowing The PSPEMU Monarchy " + ProgressInt.ToString() + "%";
}
Application.DoEvents();
}
TotalProgress.Value = 100;
TotalProgress.Value = 0;

if (isMini(ISOPath.Text))
Status.Text = "Signing the Declaration of Independance 0%";
UInt64 IntAid = BitConverter.ToUInt64(RifAid,0x00);
Thread thrd = new Thread(() =>
{
try
int ChovyGenRes = pbp.gen__sce_ebootpbp(EbootFile, IntAid, EbootSignature);
if (!File.Exists(EbootSignature) || ChovyGenRes != 0)
{
File.Delete(BootupImage);
MessageBox.Show("CHOVY-GEN Failed! Please check CHOVY.DLL exists\nand that the Microsoft Visual C++ 2015 Redistributable Update 3 RC is installed");
enable();
return;
}
catch (Exception) { };

}

// File.WriteAllText(GamePathFile, "ux0:pspemu/temp/game/PSP/GAME/" + TitleID + "\x00");

//TotalProgress.Style = ProgressBarStyle.Marquee;
Status.Text = "Signing the Declaration of Independance 0%";
UInt64 IntAid = BitConverter.ToUInt64(RifAid,0x00);
int ChovyGenRes = pbp.gen__sce_ebootpbp(EbootFile, IntAid, EbootSignature);
if (!File.Exists(EbootSignature) || ChovyGenRes != 0)
{
MessageBox.Show("CHOVY-GEN Failed! Please check CHOVY.DLL exists\nand that the Microsoft Visual C++ 2015 Redistributable Update 3 RC is installed");
enable();
return;
});
thrd.Start();
while(thrd.IsAlive)
{
Application.DoEvents();
}

/*
Expand All @@ -242,8 +233,7 @@ private void FREEDOM_Click(object sender, EventArgs e)

// Pacakge GAME


//string BackupGameDir = Path.Combine(BackupWorkDir, "game");
byte[] CmaKey = CmaKeys.GenerateKey(RifAid);

string[] entrys = Directory.GetFileSystemEntries(GameWorkDir, "*", SearchOption.AllDirectories);
long noEntrys = entrys.LongLength;
Expand All @@ -255,20 +245,19 @@ private void FREEDOM_Click(object sender, EventArgs e)
}
TotalProgress.Maximum = noBlocks;

byte[] CmaKey = CmaKeys.GenerateKey(RifAid);

string BackupDir = Path.Combine(BackupWorkDir, "game");
Directory.CreateDirectory(BackupDir);
FileStream psvimg = File.OpenWrite(Path.Combine(BackupDir, "game.psvimg"));
psvimg.SetLength(0);

PSVIMGBuilder builder = new PSVIMGBuilder(psvimg, CmaKey);


string psvimgFilepath = Path.Combine(BackupDir, "game.psvimg");
FileStream gamePsvimg = File.OpenWrite(psvimgFilepath);
gamePsvimg.SetLength(0);
PSVIMGBuilder builder = new PSVIMGBuilder(gamePsvimg, CmaKey);

foreach (string entry in entrys)
{
string relativePath = entry.Remove(0, GameWorkDir.Length);
relativePath = relativePath.Replace('\\', '/');

bool isDir = File.GetAttributes(entry).HasFlag(FileAttributes.Directory);

if (isDir)
Expand All @@ -295,54 +284,29 @@ private void FREEDOM_Click(object sender, EventArgs e)
}

long ContentSize = builder.Finish();
gamePsvimg = File.OpenRead(psvimgFilepath);
FileStream gamePsvmd = File.OpenWrite(Path.Combine(BackupDir, "game.psvmd"));
PSVMDBuilder.CreatePsvmd(gamePsvmd, gamePsvimg, ContentSize, "game", CmaKey);
gamePsvmd.Close();
gamePsvimg.Close();

psvimg = File.OpenRead(Path.Combine(BackupDir, "game.psvimg"));
FileStream psvmd = File.OpenWrite(Path.Combine(BackupDir, "game.psvmd"));
PSVMDBuilder.CreatePsvmd(psvmd, psvimg, ContentSize, "game", CmaKey);
psvmd.Close();

// Directory.CreateDirectory(BackupGameDir);

//Process psvimg_create = psvimgtools.PSVIMG_CREATE(Aid, "game" ,TmpDir, Path.Combine(BackupWorkDir,"game"));
/* while(!psvimg_create.HasExited)
{
Application.DoEvents();
}
if (psvimg_create.ExitCode != 0)
{
MessageBox.Show("PSVIMG-CREATE.EXE FAILED!\nArguments:\n" + psvimg_create.StartInfo.Arguments + "\nStdOut:\n" + psvimg_create.StandardOutput.ReadToEnd() + "\nStdErr:\n" + psvimg_create.StandardError.ReadToEnd());
enable();
return;
}
*/
// Package LICENSE
try
{
Directory.Delete(TmpDir, true);
}
catch (Exception) { };
Directory.CreateDirectory(TmpDir);
Directory.CreateDirectory(LicenseWorkDir);
File.Copy(RifPath.Text, Path.Combine(LicenseWorkDir, ContentID + ".rif"), true);
File.WriteAllText(LicensePathFile, "ux0:pspemu/temp/game/PSP/LICENSE\x00");
/*Directory.CreateDirectory(BackupGameDir);
Process psvimg_create = psvimgtools.PSVIMG_CREATE(Aid, "license", TmpDir, Path.Combine(BackupWorkDir, "license"));
while (!psvimg_create.HasExited)
{
Application.DoEvents();
}
if(psvimg_create.ExitCode != 0)
{
MessageBox.Show("PSVIMG-CREATE.EXE FAILED!\nArguments:\n" + psvimg_create.StartInfo.Arguments + "\nStdOut:\n" + psvimg_create.StandardOutput.ReadToEnd() + "\nStdErr:\n" + psvimg_create.StandardError.ReadToEnd());
enable();
return;
}*/

try
{
Directory.Delete(TmpDir, true);
}
catch (Exception) { };
BackupDir = Path.Combine(BackupWorkDir, "license");
psvimgFilepath = Path.Combine(BackupDir, "license.psvimg");

Directory.CreateDirectory(BackupDir);
FileStream licensePsvimg = File.OpenWrite(psvimgFilepath);
licensePsvimg.SetLength(0);
builder = new PSVIMGBuilder(licensePsvimg, CmaKey);
builder.AddFile(RifPath.Text, "ux0:pspemu/temp/game/PSP/LICENSE", "/"+ContentID + ".rif");
ContentSize = builder.Finish();

licensePsvimg = File.OpenRead(psvimgFilepath);
FileStream licensePsvmd = File.OpenWrite(Path.Combine(BackupDir, "license.psvmd"));
PSVMDBuilder.CreatePsvmd(licensePsvmd, licensePsvimg, ContentSize, "license", CmaKey);
licensePsvmd.Close();
licensePsvimg.Close();

// Write PARAM.SFO & ICON0.PNG
string SceSysWorkDir = Path.Combine(BackupWorkDir, "sce_sys");
Expand All @@ -355,9 +319,14 @@ private void FREEDOM_Click(object sender, EventArgs e)

Status.Text = "YOU HAVE MADE A SOCIAL CONTRACT WITH FREEDOM!";
TotalProgress.Value = 0;
TotalProgress.Style = ProgressBarStyle.Continuous;

if(!MutedAudio)

try
{
Directory.Delete(TmpDir, true);
}
catch (Exception) { };

if (!MutedAudio)
{
Stream str = Resources.Murica;
SoundPlayer snd = new SoundPlayer(str);
Expand Down
2 changes: 2 additions & 0 deletions CHOVY/Chovy.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 88d9b69

Please sign in to comment.