Sign-Nplessness! almost works !
This commit is contained in:
parent
b215adde4e
commit
0a8dc4c062
|
@ -9,14 +9,6 @@
|
|||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="chovy-gen.c" />
|
||||
|
@ -45,19 +37,6 @@
|
|||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
|
@ -69,30 +48,18 @@
|
|||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)CHOVY-SIGN\bin\$(Configuration)</OutDir>
|
||||
<TargetName>$(ProjectName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IgnoreImportLibrary />
|
||||
<TargetName>CHOVY</TargetName>
|
||||
<TargetName>$(ProjectName)</TargetName>
|
||||
<OutDir>$(SolutionDir)CHOVY-SIGN\bin\$(Configuration)</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
|
@ -109,18 +76,6 @@
|
|||
<AdditionalDependencies>ws2_32.lib;libsslMT.lib;Crypt32.lib;libcryptoMT.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;CHOVYGEN_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
|
@ -141,22 +96,6 @@
|
|||
<AdditionalDependencies>ws2_32.lib;libsslMT.lib;Crypt32.lib;libcryptoMT.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;CHOVYGEN_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
|
|
@ -5,10 +5,6 @@
|
|||
<Configuration>CHOVY</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="CHOVY|x64">
|
||||
<Configuration>CHOVY</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
|
@ -17,14 +13,6 @@
|
|||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
|
@ -48,25 +36,9 @@
|
|||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='CHOVY|Win32'">
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='CHOVY|x64'">
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
|
@ -78,27 +50,15 @@
|
|||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)CHOVY-SIGN\bin\$(Configuration)</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)CHOVY-SIGN\bin\$(Configuration)</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='CHOVY|Win32'">
|
||||
<OutDir>$(SolutionDir)CHOVY-SIGN\bin\$(Configuration)</OutDir>
|
||||
</PropertyGroup>
|
||||
|
@ -114,18 +74,6 @@
|
|||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;KIRK_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
|
@ -143,22 +91,6 @@
|
|||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;KIRK_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Optimize>true</Optimize>
|
||||
|
@ -56,9 +56,6 @@
|
|||
<HintPath>..\packages\System.Buffers.4.5.1\lib\netstandard1.1\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
|
@ -398,7 +395,7 @@
|
|||
<Compile Include="DiscUtils\VolumeManager.cs" />
|
||||
<Compile Include="DiscUtils\WindowsFileInformation.cs" />
|
||||
<Compile Include="MobyGamesDB.cs" />
|
||||
<Compile Include="pbp.cs" />
|
||||
<Compile Include="Pbp.cs" />
|
||||
<Compile Include="PSXPackager\ApplicationInfo.cs" />
|
||||
<Compile Include="PSXPackager\FileExtensionHelper.cs" />
|
||||
<Compile Include="PSXPackager\GameEntry.cs" />
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace CHOVY_SIGN
|
|||
string SfoPath = Path.Combine(BackupPath, Dir, "sce_sys", "param.sfo");
|
||||
FileStream SfoStream = File.OpenRead(SfoPath);
|
||||
Dictionary<string,object> SfoKeys = Sfo.ReadSfo(SfoStream);
|
||||
string Title = (string)SfoKeys["Title"];
|
||||
string Title = (string)SfoKeys["TITLE"];
|
||||
SfoStream.Close();
|
||||
string BackupName = (Path.GetFileName(Dir) + " - " + Title);
|
||||
BackupList.Items.Add(BackupName);
|
||||
|
|
|
@ -145,7 +145,6 @@ namespace CHOVY_SIGN
|
|||
this.FREEDOM.ForeColor = enabled ? red : black;
|
||||
this.FREEDOM.BackColor = enabled ? black : red;
|
||||
}
|
||||
|
||||
private void FREEDOM_Click(object sender, EventArgs e)
|
||||
{
|
||||
Action enable = () => {
|
||||
|
@ -227,23 +226,55 @@ namespace CHOVY_SIGN
|
|||
|
||||
|
||||
|
||||
// Try New System
|
||||
FileStream EbootStream = File.OpenWrite(EbootFile);
|
||||
FileStream IsoStream = File.OpenRead(ISOPath.Text);
|
||||
Bitmap BootupImage;
|
||||
if (isMini(ISOPath.Text))
|
||||
BootupImage = Resources.MINIS;
|
||||
else
|
||||
BootupImage = Resources.ChovyLogo;
|
||||
|
||||
byte[] ParamSfo = ReadFileFromISO(ISOPath.Text, @"PSP_GAME\PARAM.SFO");
|
||||
byte[] Icon0 = ReadFileFromISO(ISOPath.Text, @"PSP_GAME\ICON0.PNG");
|
||||
byte[] Icon1 = ReadFileFromISO(ISOPath.Text, @"PSP_GAME\ICON1.PMF");
|
||||
byte[] Pic0 = ReadFileFromISO(ISOPath.Text, @"PSP_GAME\PIC0.PNG");
|
||||
byte[] Pic1 = ReadFileFromISO(ISOPath.Text, @"PSP_GAME\PIC1.PNG");
|
||||
byte[] Snd0 = ReadFileFromISO(ISOPath.Text, @"PSP_GAME\SND0.AT3");
|
||||
|
||||
Thread BuildPbpThread = new Thread(() =>
|
||||
{
|
||||
// Try New System
|
||||
try
|
||||
{
|
||||
FileStream EbootStream = File.OpenWrite(EbootFile);
|
||||
FileStream IsoStream = File.OpenRead(ISOPath.Text);
|
||||
Bitmap BootupImage;
|
||||
if (isMini(ISOPath.Text))
|
||||
BootupImage = Resources.MINIS;
|
||||
else
|
||||
BootupImage = Resources.ChovyLogo;
|
||||
|
||||
Pbp.BuildPbp(EbootStream, IsoStream, CompressPBP.Checked, FromHex(Versionkey.Text), BootupImage, ContentID, ParamSfo, Icon0, Icon1, Pic0, Pic1, Snd0);
|
||||
byte[] Sfo = ReadFileFromISO(ISOPath.Text, @"PSP_GAME\PARAM.SFO");
|
||||
byte[] Icon0Png = ReadFileFromISO(ISOPath.Text, @"PSP_GAME\ICON0.PNG");
|
||||
byte[] Icon1 = ReadFileFromISO(ISOPath.Text, @"PSP_GAME\ICON1.PMF");
|
||||
byte[] Pic0 = ReadFileFromISO(ISOPath.Text, @"PSP_GAME\PIC0.PNG");
|
||||
byte[] Pic1 = ReadFileFromISO(ISOPath.Text, @"PSP_GAME\PIC1.PNG");
|
||||
byte[] Snd0 = ReadFileFromISO(ISOPath.Text, @"PSP_GAME\SND0.AT3");
|
||||
|
||||
Pbp.BuildPbp(EbootStream, IsoStream, CompressPBP.Checked, FromHex(Versionkey.Text), BootupImage, ContentID, Sfo, Icon0Png, Icon1, Pic0, Pic1, Snd0);
|
||||
IsoStream.Close();
|
||||
EbootStream.Close();
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
MessageBox.Show(exp.Message, "Error.", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
});
|
||||
BuildPbpThread.Start();
|
||||
while(BuildPbpThread.IsAlive)
|
||||
{
|
||||
if(!Pbp.HasFinished)
|
||||
{
|
||||
TotalProgress.Maximum = Pbp.NumberOfSectors;
|
||||
TotalProgress.Value = Pbp.SectorsDone;
|
||||
if (Pbp.SectorsDone != 0 && Pbp.NumberOfSectors != 0)
|
||||
{
|
||||
decimal progress = Math.Floor(((decimal)Pbp.SectorsDone / (decimal)Pbp.NumberOfSectors) * 100);
|
||||
Status.Text = "Overthrowing The PSPEMU Monarchy " + progress.ToString() + "%";
|
||||
}
|
||||
else
|
||||
Status.Text = "Overthrowing The PSPEMU Monarchy 0%";
|
||||
Application.DoEvents();
|
||||
}
|
||||
}
|
||||
|
||||
/*Process signnp = pbp.GenPbpFromIso(ISOPath.Text, EbootFile, ContentID, Versionkey.Text, CompressPBP.Checked, BootupImage);
|
||||
while (!signnp.HasExited)
|
||||
|
@ -262,19 +293,19 @@ namespace CHOVY_SIGN
|
|||
|
||||
Status.Text = "Signing the Declaration of Independance 0%";
|
||||
UInt64 IntAid = BitConverter.ToUInt64(RifAid,0x00);
|
||||
Thread thrd = new Thread(() =>
|
||||
Thread ChovyGenThread = new Thread(() =>
|
||||
{
|
||||
|
||||
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");
|
||||
MessageBox.Show("CHOVY-GEN Failed! Please check CHOVY-KIRK.DLL exists");
|
||||
enable();
|
||||
return;
|
||||
}
|
||||
});
|
||||
thrd.Start();
|
||||
while(thrd.IsAlive)
|
||||
ChovyGenThread.Start();
|
||||
while(ChovyGenThread.IsAlive)
|
||||
{
|
||||
Application.DoEvents();
|
||||
}
|
||||
|
@ -384,6 +415,8 @@ namespace CHOVY_SIGN
|
|||
string SceSysWorkDir = Path.Combine(BackupWorkDir, "sce_sys");
|
||||
Directory.CreateDirectory(SceSysWorkDir);
|
||||
|
||||
byte[] ParamSfo = ReadFileFromISO(ISOPath.Text, @"PSP_GAME\PARAM.SFO");
|
||||
byte[] Icon0 = ReadFileFromISO(ISOPath.Text, @"PSP_GAME\ICON0.PNG");
|
||||
File.WriteAllBytes(Path.Combine(SceSysWorkDir, "param.sfo"), ParamSfo);
|
||||
File.WriteAllBytes(Path.Combine(SceSysWorkDir, "icon0.png"), Icon0);
|
||||
|
||||
|
|
|
@ -177,6 +177,24 @@ namespace BasicDataTypes
|
|||
WriteString(Str,Text);
|
||||
Str.Seek(oldPos, SeekOrigin.Begin);
|
||||
}
|
||||
public static void WriteBytes(Stream Str, byte[] Bytes, Int64 Size)
|
||||
{
|
||||
Int64 Written = 0;
|
||||
while (Written < Size)
|
||||
{
|
||||
if ((Size - Written) > 2000000000)
|
||||
{
|
||||
Str.Write(Bytes, 0x00, 2000000000);
|
||||
Written += 2000000000;
|
||||
}
|
||||
else
|
||||
{
|
||||
Str.Write(Bytes, 0x00, Convert.ToInt32(Size - Written));
|
||||
Written += (Size - Written);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void WriteString(Stream Str, String Text, int len = -1)
|
||||
{
|
||||
if (len < 0)
|
||||
|
|
|
@ -49,10 +49,10 @@ namespace ParamSfo
|
|||
|
||||
if(KeyName == replaceOption)
|
||||
{
|
||||
int padLen = Convert.ToInt32(TotalSize - replaceValue.Length);
|
||||
// int padLen = Convert.ToInt32(TotalSize - replaceValue.Length);
|
||||
DataUtils.WriteStringAt(Sfo, replaceValue, ValueLocation);
|
||||
|
||||
int newSz = replaceValue.Length + 1;
|
||||
/*int newSz = replaceValue.Length + 1;
|
||||
if(newSz > TotalSize)
|
||||
{
|
||||
throw new Exception("New Value is larger than Total Size.");
|
||||
|
@ -63,6 +63,7 @@ namespace ParamSfo
|
|||
|
||||
byte[] zeros = new byte[padLen];
|
||||
Sfo.Write(zeros, 0x00, zeros.Length);
|
||||
*/
|
||||
return SfoValues;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using BasicDataTypes;
|
||||
using DiscUtils.Streams;
|
||||
using ParamSfo;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
@ -7,7 +6,6 @@ using System.Drawing;
|
|||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
@ -125,6 +123,9 @@ namespace CHOVY_SIGN
|
|||
return signnp;
|
||||
}
|
||||
|
||||
public static int NumberOfSectors = 0;
|
||||
public static int SectorsDone = 0;
|
||||
public static bool HasFinished = false;
|
||||
|
||||
private static UInt32 readUInt32(Stream src)
|
||||
{
|
||||
|
@ -436,6 +437,9 @@ namespace CHOVY_SIGN
|
|||
sceDrmBBCipherFinal(&bck);
|
||||
|
||||
|
||||
Array.ConstrainedCopy(ToEncrypt, 0x00, NpumdimgHeader, 0x40, ToEncrypt.Length);
|
||||
|
||||
|
||||
// Generate header hash.
|
||||
byte[] header_hash = new byte[0x10];
|
||||
|
||||
|
@ -483,71 +487,67 @@ namespace CHOVY_SIGN
|
|||
}
|
||||
|
||||
// Verify the generated ECDSA signature.
|
||||
byte[] TestSignature = new byte[0x64];
|
||||
Array.ConstrainedCopy(npumdimg_public_key, 0, TestSignature, 0, npumdimg_public_key.Length);
|
||||
Array.ConstrainedCopy(NpuimgHash, 0, TestSignature, npumdimg_public_key.Length, NpuimgHash.Length);
|
||||
Array.ConstrainedCopy(NpumdimgSignature, 0, TestSignature, npumdimg_public_key.Length + NpuimgHash.Length, NpumdimgSignature.Length);
|
||||
if (sceUtilsBufferCopyWithRange(null, 0, TestSignature, 0x64, KIRK_CMD_ECDSA_VERIFY) != 0)
|
||||
{
|
||||
throw new Exception("ECDSA signature for NPUMDIMG header is invalid!");
|
||||
}
|
||||
VerifySignature(false, NpuimgHash, NpumdimgSignature);
|
||||
|
||||
// Finally put ECDSA signature into header.
|
||||
Array.ConstrainedCopy(NpumdimgSignature, 0, NpumdimgHeader, 0xD8, NpumdimgSignature.Length);
|
||||
|
||||
return NpumdimgSignature;
|
||||
return NpumdimgHeader;
|
||||
}
|
||||
unsafe public static void SignIso(Stream BaseStr, Stream Iso, string ContentId, byte[] VersionKey, bool Compress)
|
||||
unsafe public static void SignIso(int HeaderOffset, Stream BaseStr, Stream Iso, string ContentId, byte[] VersionKey, bool Compress)
|
||||
{
|
||||
MAC_KEY MKey;
|
||||
CIPHER_KEY CKey;
|
||||
|
||||
Int64 IsoSize = Iso.Length;
|
||||
Int64 TableOffset = Convert.ToInt64(BaseStr.Position);
|
||||
Int64 TableOffset = Convert.ToInt64(HeaderOffset);
|
||||
int BlockBasis = 0x10;
|
||||
int BlockSize = BlockBasis * 2048;
|
||||
|
||||
Int64 IsoBlocks = (IsoSize + BlockSize - 1) / BlockSize;
|
||||
NumberOfSectors = Convert.ToInt32(IsoBlocks);
|
||||
|
||||
Int64 TableSize = IsoBlocks * 0x20;
|
||||
Int64 NpOffset = TableOffset - 0x100;
|
||||
|
||||
int NpSize = 0x100;
|
||||
|
||||
// Generate Random Header Key
|
||||
byte[] HeaderKey = new byte[0x10];
|
||||
sceUtilsBufferCopyWithRange(HeaderKey, HeaderKey.Length, null, 0, KIRK_CMD_PRNG);
|
||||
|
||||
byte[] TableBuffer = new byte[TableSize];
|
||||
BaseStr.Write(TableBuffer, 0x00, TableBuffer.Length);
|
||||
DataUtils.WriteBytes(BaseStr, TableBuffer, TableSize);
|
||||
|
||||
// Write ISO Blocks
|
||||
byte[] IsoBuffer = new byte[BlockSize * 2];
|
||||
byte[] LZRCBuffer = new byte[BlockSize * 2];
|
||||
byte[] Tb = new byte[0x20];
|
||||
byte[] WBuf;
|
||||
Int64 IsoOffset = 0x100 + TableSize;
|
||||
int WSize, LZRCSize, Ratio;
|
||||
int LZRCSize, Ratio;
|
||||
int TbOffset = 0;
|
||||
int WSize = 0;
|
||||
for (int i = 0; i < IsoBlocks; i++)
|
||||
{
|
||||
SectorsDone = i;
|
||||
Array.Clear(IsoBuffer, 0, IsoBuffer.Length);
|
||||
Array.Clear(LZRCBuffer, 0, IsoBuffer.Length);
|
||||
Array.Clear(LZRCBuffer, 0, LZRCBuffer.Length);
|
||||
Array.Clear(Tb, 0, Tb.Length);
|
||||
|
||||
TbOffset = i * 0x20;
|
||||
Array.ConstrainedCopy(TableBuffer, TbOffset, Tb, 0, Tb.Length);
|
||||
|
||||
if ((Iso.Length + BlockSize) > IsoSize)
|
||||
if ((Iso.Position + BlockSize) > IsoSize)
|
||||
{
|
||||
int Remaining = Convert.ToInt32(IsoSize - Iso.Length);
|
||||
Iso.Read(IsoBuffer, 0x00, Remaining);
|
||||
WSize = Remaining;
|
||||
Int64 Remaining = IsoSize - Iso.Position;
|
||||
Iso.Read(IsoBuffer, 0x00, Convert.ToInt32(Remaining));
|
||||
WSize = Convert.ToInt32(Remaining);
|
||||
}
|
||||
else
|
||||
{
|
||||
Iso.Read(IsoBuffer, 0x01, BlockSize);
|
||||
Iso.Read(IsoBuffer, 0x00, BlockSize);
|
||||
WSize = BlockSize;
|
||||
}
|
||||
|
||||
WBuf = IsoBuffer;
|
||||
|
||||
if (Compress)
|
||||
{
|
||||
|
@ -556,7 +556,6 @@ namespace CHOVY_SIGN
|
|||
|
||||
if (Ratio < RATIO_LIMIT)
|
||||
{
|
||||
WBuf = LZRCBuffer;
|
||||
WSize = (LZRCSize + 15) & ~15;
|
||||
}
|
||||
}
|
||||
|
@ -569,12 +568,18 @@ namespace CHOVY_SIGN
|
|||
|
||||
// Encrypt Block
|
||||
sceDrmBBCipherInit(&CKey, 1, 2, HeaderKey, VersionKey, Convert.ToUInt32((IsoOffset >> 4)));
|
||||
sceDrmBBCipherUpdate(&CKey, WBuf, WSize);
|
||||
if(!Compress)
|
||||
sceDrmBBCipherUpdate(&CKey, IsoBuffer, WSize);
|
||||
else
|
||||
sceDrmBBCipherUpdate(&CKey, LZRCBuffer, WSize);
|
||||
sceDrmBBCipherFinal(&CKey);
|
||||
|
||||
// Build MAC.
|
||||
sceDrmBBMacInit(&MKey, 3);
|
||||
sceDrmBBMacUpdate(&MKey, WBuf, WSize);
|
||||
if (!Compress)
|
||||
sceDrmBBMacUpdate(&MKey, IsoBuffer, WSize);
|
||||
else
|
||||
sceDrmBBMacUpdate(&MKey, LZRCBuffer, WSize);
|
||||
sceDrmBBMacFinal(&MKey, Tb, VersionKey);
|
||||
|
||||
bbmac_build_final2(3, Tb);
|
||||
|
@ -584,7 +589,10 @@ namespace CHOVY_SIGN
|
|||
|
||||
// Write ISO data.
|
||||
WSize = (WSize + 15) & ~15;
|
||||
BaseStr.Write(WBuf, 0x00, WSize);
|
||||
if (!Compress)
|
||||
BaseStr.Write(IsoBuffer, 0x00, WSize);
|
||||
else
|
||||
BaseStr.Write(LZRCBuffer, 0x00, WSize);
|
||||
|
||||
// Update offset.
|
||||
IsoOffset += WSize;
|
||||
|
@ -593,7 +601,7 @@ namespace CHOVY_SIGN
|
|||
Array.ConstrainedCopy(EncTb, 0, TableBuffer, TbOffset, EncTb.Length);
|
||||
|
||||
}
|
||||
|
||||
HasFinished = true;
|
||||
// Generate data key.
|
||||
byte[] DataKey = new byte[0x10];
|
||||
sceDrmBBMacInit(&MKey, 3);
|
||||
|
@ -603,11 +611,9 @@ namespace CHOVY_SIGN
|
|||
|
||||
byte[] NpumdimgHeader = BuildNpumdimgHeader(Convert.ToInt32(IsoSize), Convert.ToInt32(IsoBlocks), BlockBasis, ContentId, NP_FLAGS, VersionKey, HeaderKey, DataKey);
|
||||
BaseStr.Seek(NpOffset, SeekOrigin.Begin);
|
||||
BaseStr.Write(NpumdimgHeader, 0x00, NpumdimgHeader.Length);
|
||||
BaseStr.Write(NpumdimgHeader, 0x00, NpSize);
|
||||
BaseStr.Seek(TableOffset, SeekOrigin.Begin);
|
||||
BaseStr.Write(TableBuffer, 0x00, TableBuffer.Length);
|
||||
|
||||
return;
|
||||
DataUtils.WriteBytes(BaseStr, TableBuffer, TableSize);
|
||||
}
|
||||
|
||||
public static UInt32[] ByteArrayToUint32Array(byte[] ByteArray)
|
||||
|
@ -619,7 +625,7 @@ namespace CHOVY_SIGN
|
|||
public static byte[] UInt32ArrayToByteArray(UInt32[] Uint32Array)
|
||||
{
|
||||
byte[] decode = new byte[Uint32Array.Length * 4];
|
||||
System.Buffer.BlockCopy(Uint32Array, 0, decode, 0, Uint32Array.Length);
|
||||
System.Buffer.BlockCopy(Uint32Array, 0, decode, 0, Uint32Array.Length * 4);
|
||||
return decode;
|
||||
}
|
||||
public static byte[] encrypt_table(byte[] table)
|
||||
|
@ -686,6 +692,13 @@ namespace CHOVY_SIGN
|
|||
Str.Seek(OffsetToWrite, SeekOrigin.Begin);
|
||||
Str.Write(pic0, 0x00, pic0.Length);
|
||||
OffsetToWrite += pic0.Length;
|
||||
|
||||
//Write Pic1
|
||||
Str.Seek(0x18, SeekOrigin.Begin); // Pic0 Offset
|
||||
DataUtils.WriteInt32(Str, OffsetToWrite);
|
||||
Str.Seek(OffsetToWrite, SeekOrigin.Begin);
|
||||
Str.Write(pic1, 0x00, pic1.Length);
|
||||
OffsetToWrite += pic1.Length;
|
||||
|
||||
//Write SND0
|
||||
Str.Seek(0x1C, SeekOrigin.Begin); // SND0 Offset
|
||||
|
@ -714,7 +727,11 @@ namespace CHOVY_SIGN
|
|||
OffsetToWrite += DataPsar.Length;
|
||||
|
||||
// Sign ISO Contents.
|
||||
SignIso(Str, Iso, content_id, VersionKey, Compress);
|
||||
SignIso(OffsetToWrite, Str, Iso, content_id, VersionKey, Compress);
|
||||
|
||||
NumberOfSectors = 0;
|
||||
SectorsDone = 0;
|
||||
HasFinished = false;
|
||||
}
|
||||
public static int gen__sce_ebootpbp(string EbootFile, UInt64 AID, string OutSceebootpbpFile)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue