Skip to content

Commit 88d9b69

Browse files
author
SilicaAndPina
committed
Update to beta03
1 parent 6bd010e commit 88d9b69

17 files changed

+2462
-215
lines changed

CHOVY/App.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<startup>
4-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
55
</startup>
66
</configuration>

CHOVY/CHOVY-GUI.csproj

+11-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
77
<ProjectGuid>{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}</ProjectGuid>
8-
<OutputType>Exe</OutputType>
8+
<OutputType>WinExe</OutputType>
99
<RootNamespace>CHOVY</RootNamespace>
1010
<AssemblyName>CHOVY-SIGN</AssemblyName>
11-
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
11+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1212
<FileAlignment>512</FileAlignment>
1313
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
1414
<TargetFrameworkProfile />
@@ -37,6 +37,9 @@
3737
<PropertyGroup>
3838
<StartupObject />
3939
</PropertyGroup>
40+
<PropertyGroup>
41+
<ApplicationIcon>Icon.ico</ApplicationIcon>
42+
</PropertyGroup>
4043
<ItemGroup>
4144
<Reference Include="BouncyCastle.Crypto, Version=1.8.5.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
4245
<HintPath>..\packages\BouncyCastle.1.8.5\lib\BouncyCastle.Crypto.dll</HintPath>
@@ -84,7 +87,6 @@
8487
<Compile Include="PSVIMGFileStream.cs" />
8588
<Compile Include="PSVIMGStream.cs" />
8689
<Compile Include="PSVIMGStructs.cs" />
87-
<Compile Include="psvimgtools.cs" />
8890
<Compile Include="PSVMDBuilder.cs" />
8991
<EmbeddedResource Include="CHOVY.resx">
9092
<DependentUpon>CHOVY.cs</DependentUpon>
@@ -128,5 +130,11 @@
128130
<ItemGroup>
129131
<None Include="Resources\MINIS.png" />
130132
</ItemGroup>
133+
<ItemGroup>
134+
<None Include="Resources\ChovyLogo.png" />
135+
</ItemGroup>
136+
<ItemGroup>
137+
<Content Include="Icon.ico" />
138+
</ItemGroup>
131139
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
132140
</Project>

CHOVY/CHOVY.cs

+60-91
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
using System.IO;
1010
using System.Media;
1111
using System.Text;
12-
using System.Threading.Tasks;
12+
using System.Threading;
1313
using System.Windows.Forms;
1414

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

158158
string TmpDir = Path.Combine(Application.StartupPath, "_tmp");
159-
string GameWorkDir = Path.Combine(TmpDir, "ux0_pspemu_temp_game_PSP_GAME_"+ TitleID);
160-
// string GameWorkDir = Path.Combine(TmpDir, TitleID);
161-
string LicenseWorkDir = Path.Combine(TmpDir, "ux0_pspemu_temp_game_PSP_LICENSE");
159+
string GameWorkDir = Path.Combine(TmpDir, TitleID);
162160
string EbootFile = Path.Combine(GameWorkDir, "EBOOT.PBP");
163161
string EbootSignature = Path.Combine(GameWorkDir, "__sce_ebootpbp");
164-
string GamePathFile = Path.Combine(GameWorkDir, "VITA_PATH.TXT");
165-
string LicensePathFile = Path.Combine(LicenseWorkDir, "VITA_PATH.TXT");
166162

167-
168-
try
169-
{
170-
Directory.Delete(TmpDir, true);
171-
}
172-
catch (Exception) { };
173163
Directory.CreateDirectory(TmpDir);
174164
Directory.CreateDirectory(GameWorkDir);
175165

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

191-
TotalProgress.Style = ProgressBarStyle.Continuous;
192-
Status.Text = "Overthrowing The PSPEMU Monarchy 00%";
181+
TotalProgress.Maximum = 100;
182+
Status.Text = "Overthrowing The PSPEMU Monarchy 0%";
193183

194184
string BootupImage = "";
195185
if (isMini(ISOPath.Text))
196186
{
197187
BootupImage = Path.Combine(Application.StartupPath, "_tmp", "minis.png");
198188
Resources.MINIS.Save(BootupImage);
199189
}
190+
else
191+
{
192+
BootupImage = Path.Combine(Application.StartupPath, "_tmp", "chovy.png");
193+
Resources.ChovyLogo.Save(BootupImage);
194+
}
200195

201196
Process signnp = pbp.GenPbpFromIso(ISOPath.Text, EbootFile, ContentID, Versionkey.Text, CompressPBP.Checked, BootupImage);
202197
while (!signnp.HasExited)
@@ -207,33 +202,29 @@ private void FREEDOM_Click(object sender, EventArgs e)
207202
Progress = Progress.Remove(0,19);
208203
int ProgressInt = int.Parse(Progress.Substring(0,3));
209204
TotalProgress.Value = ProgressInt;
210-
Status.Text = "Overthrowing The PSPEMU Monarchy " + Progress;
205+
Status.Text = "Overthrowing The PSPEMU Monarchy " + ProgressInt.ToString() + "%";
211206
}
212207
Application.DoEvents();
213208
}
214-
TotalProgress.Value = 100;
209+
TotalProgress.Value = 0;
215210

216-
if (isMini(ISOPath.Text))
211+
Status.Text = "Signing the Declaration of Independance 0%";
212+
UInt64 IntAid = BitConverter.ToUInt64(RifAid,0x00);
213+
Thread thrd = new Thread(() =>
217214
{
218-
try
215+
216+
int ChovyGenRes = pbp.gen__sce_ebootpbp(EbootFile, IntAid, EbootSignature);
217+
if (!File.Exists(EbootSignature) || ChovyGenRes != 0)
219218
{
220-
File.Delete(BootupImage);
219+
MessageBox.Show("CHOVY-GEN Failed! Please check CHOVY.DLL exists\nand that the Microsoft Visual C++ 2015 Redistributable Update 3 RC is installed");
220+
enable();
221+
return;
221222
}
222-
catch (Exception) { };
223-
224-
}
225-
226-
// File.WriteAllText(GamePathFile, "ux0:pspemu/temp/game/PSP/GAME/" + TitleID + "\x00");
227-
228-
//TotalProgress.Style = ProgressBarStyle.Marquee;
229-
Status.Text = "Signing the Declaration of Independance 0%";
230-
UInt64 IntAid = BitConverter.ToUInt64(RifAid,0x00);
231-
int ChovyGenRes = pbp.gen__sce_ebootpbp(EbootFile, IntAid, EbootSignature);
232-
if (!File.Exists(EbootSignature) || ChovyGenRes != 0)
233-
{
234-
MessageBox.Show("CHOVY-GEN Failed! Please check CHOVY.DLL exists\nand that the Microsoft Visual C++ 2015 Redistributable Update 3 RC is installed");
235-
enable();
236-
return;
223+
});
224+
thrd.Start();
225+
while(thrd.IsAlive)
226+
{
227+
Application.DoEvents();
237228
}
238229

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

243234
// Pacakge GAME
244235

245-
246-
//string BackupGameDir = Path.Combine(BackupWorkDir, "game");
236+
byte[] CmaKey = CmaKeys.GenerateKey(RifAid);
247237

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

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

260249
string BackupDir = Path.Combine(BackupWorkDir, "game");
261250
Directory.CreateDirectory(BackupDir);
262-
FileStream psvimg = File.OpenWrite(Path.Combine(BackupDir, "game.psvimg"));
263-
psvimg.SetLength(0);
264-
265-
PSVIMGBuilder builder = new PSVIMGBuilder(psvimg, CmaKey);
266-
267-
251+
string psvimgFilepath = Path.Combine(BackupDir, "game.psvimg");
252+
FileStream gamePsvimg = File.OpenWrite(psvimgFilepath);
253+
gamePsvimg.SetLength(0);
254+
PSVIMGBuilder builder = new PSVIMGBuilder(gamePsvimg, CmaKey);
268255

269256
foreach (string entry in entrys)
270257
{
271258
string relativePath = entry.Remove(0, GameWorkDir.Length);
259+
relativePath = relativePath.Replace('\\', '/');
260+
272261
bool isDir = File.GetAttributes(entry).HasFlag(FileAttributes.Directory);
273262

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

297286
long ContentSize = builder.Finish();
287+
gamePsvimg = File.OpenRead(psvimgFilepath);
288+
FileStream gamePsvmd = File.OpenWrite(Path.Combine(BackupDir, "game.psvmd"));
289+
PSVMDBuilder.CreatePsvmd(gamePsvmd, gamePsvimg, ContentSize, "game", CmaKey);
290+
gamePsvmd.Close();
291+
gamePsvimg.Close();
298292

299-
psvimg = File.OpenRead(Path.Combine(BackupDir, "game.psvimg"));
300-
FileStream psvmd = File.OpenWrite(Path.Combine(BackupDir, "game.psvmd"));
301-
PSVMDBuilder.CreatePsvmd(psvmd, psvimg, ContentSize, "game", CmaKey);
302-
psvmd.Close();
303-
304-
// Directory.CreateDirectory(BackupGameDir);
305-
306-
//Process psvimg_create = psvimgtools.PSVIMG_CREATE(Aid, "game" ,TmpDir, Path.Combine(BackupWorkDir,"game"));
307-
/* while(!psvimg_create.HasExited)
308-
{
309-
Application.DoEvents();
310-
}
311-
if (psvimg_create.ExitCode != 0)
312-
{
313-
MessageBox.Show("PSVIMG-CREATE.EXE FAILED!\nArguments:\n" + psvimg_create.StartInfo.Arguments + "\nStdOut:\n" + psvimg_create.StandardOutput.ReadToEnd() + "\nStdErr:\n" + psvimg_create.StandardError.ReadToEnd());
314-
enable();
315-
return;
316-
}
317-
*/
318293
// Package LICENSE
319-
try
320-
{
321-
Directory.Delete(TmpDir, true);
322-
}
323-
catch (Exception) { };
324-
Directory.CreateDirectory(TmpDir);
325-
Directory.CreateDirectory(LicenseWorkDir);
326-
File.Copy(RifPath.Text, Path.Combine(LicenseWorkDir, ContentID + ".rif"), true);
327-
File.WriteAllText(LicensePathFile, "ux0:pspemu/temp/game/PSP/LICENSE\x00");
328-
/*Directory.CreateDirectory(BackupGameDir);
329-
Process psvimg_create = psvimgtools.PSVIMG_CREATE(Aid, "license", TmpDir, Path.Combine(BackupWorkDir, "license"));
330-
while (!psvimg_create.HasExited)
331-
{
332-
Application.DoEvents();
333-
}
334-
if(psvimg_create.ExitCode != 0)
335-
{
336-
MessageBox.Show("PSVIMG-CREATE.EXE FAILED!\nArguments:\n" + psvimg_create.StartInfo.Arguments + "\nStdOut:\n" + psvimg_create.StandardOutput.ReadToEnd() + "\nStdErr:\n" + psvimg_create.StandardError.ReadToEnd());
337-
enable();
338-
return;
339-
}*/
340294

341-
try
342-
{
343-
Directory.Delete(TmpDir, true);
344-
}
345-
catch (Exception) { };
295+
BackupDir = Path.Combine(BackupWorkDir, "license");
296+
psvimgFilepath = Path.Combine(BackupDir, "license.psvimg");
297+
298+
Directory.CreateDirectory(BackupDir);
299+
FileStream licensePsvimg = File.OpenWrite(psvimgFilepath);
300+
licensePsvimg.SetLength(0);
301+
builder = new PSVIMGBuilder(licensePsvimg, CmaKey);
302+
builder.AddFile(RifPath.Text, "ux0:pspemu/temp/game/PSP/LICENSE", "/"+ContentID + ".rif");
303+
ContentSize = builder.Finish();
304+
305+
licensePsvimg = File.OpenRead(psvimgFilepath);
306+
FileStream licensePsvmd = File.OpenWrite(Path.Combine(BackupDir, "license.psvmd"));
307+
PSVMDBuilder.CreatePsvmd(licensePsvmd, licensePsvimg, ContentSize, "license", CmaKey);
308+
licensePsvmd.Close();
309+
licensePsvimg.Close();
346310

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

356320
Status.Text = "YOU HAVE MADE A SOCIAL CONTRACT WITH FREEDOM!";
357321
TotalProgress.Value = 0;
358-
TotalProgress.Style = ProgressBarStyle.Continuous;
359-
360-
if(!MutedAudio)
322+
323+
try
324+
{
325+
Directory.Delete(TmpDir, true);
326+
}
327+
catch (Exception) { };
328+
329+
if (!MutedAudio)
361330
{
362331
Stream str = Resources.Murica;
363332
SoundPlayer snd = new SoundPlayer(str);

CHOVY/Chovy.Designer.cs

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)