Compare commits

...

116 Commits

Author SHA1 Message Date
Li 2ef6e0c65d add new setting n stuff 2024-04-12 16:50:25 +12:00
Li 58b6de3d00 Get it working on .net 8.0 and latest avalonia! 2024-04-12 14:47:18 +12:00
Li dd3431c312 Fix bugs 2024-01-11 21:29:23 +13:00
Li 97c5959caf Fix an issue where yuo cant enable using content manager again 2024-01-11 19:52:35 +13:00
Li fb8c379751 Update 'README.md' 2023-06-10 09:03:03 +00:00
Li b433e30fcc Update 'README.md' 2023-06-10 09:02:24 +00:00
Li 1c1711d844 Update 'README.md' 2023-06-10 08:59:50 +00:00
Li 2b1154a140 Update 'README.md' 2023-06-10 08:58:53 +00:00
Li fec8c58ae5 Update 'README.md' 2023-06-10 08:53:35 +00:00
Li dad692f9dd Update 'README.md' 2023-06-10 08:48:52 +00:00
Li 434c3304b7 Update info2 2023-06-10 20:22:52 +12:00
Li 1779f2f7c2 Update readme again 2023-06-10 20:22:06 +12:00
Li c837fddb9f Update readme, fix some stuff 2023-06-10 20:20:11 +12:00
Li f087076653 Put new discoveries into practice 2023-06-10 19:20:27 +12:00
Li c15e345b30 make Chovy-Sign-CLI and GUI version run on linux 2023-06-09 21:06:44 +12:00
Li 5aa34528ea Update slight 2023-05-02 06:15:49 +12:00
Li 36a088e256 Add settings menu, libcrypt from database, etc 2023-05-02 05:52:34 +12:00
Li de65c71d2c Implement Sub Channel Generation. 2023-05-01 23:51:00 +12:00
Li dd6707d5ef Fix LC1 games! 2023-04-30 22:13:23 +12:00
Li 6647b319a2 Add code to read SBI File (Subchannel information, for libcrypt), and include magic word inside ISO HEADER 2023-04-30 21:08:57 +12:00
Li b13fa203a8 Merge pull request 'remove unused code, fix ps1 multi-disc gen `__sce_ebootpbp` failed.' (#18) from SquallATF/chovy-sign:master into master
Reviewed-on: SilicaAndPina/chovy-sign#18
2023-04-30 02:16:08 +00:00
SquallATF c96b43031a remove unused code, fix ps1 multi-disc gen `__sce_ebootpbp` failed. 2023-04-30 08:34:40 +08:00
Li 299b042dd9 Merge branch 'master' of https://silica.codes/SilicaAndPina/chovy-sign 2023-04-26 20:36:04 +12:00
Li 9001a461cc Remove test code from PbpResign 2023-04-26 20:35:47 +12:00
Li 73a6c3a0eb Update 'README.md' 2023-04-26 04:27:15 +00:00
Li 743a2cfc13 Update 'README.md' 2023-04-26 04:25:58 +00:00
Li 2d34072f91 Update 'README.md' 2023-04-26 03:30:10 +00:00
Li 5fdceefa8b Update 'README.md' 2023-04-26 03:12:18 +00:00
Li 4e6cf9bd6f Update keys 2023-04-26 15:08:59 +12:00
Li 644c5579e3 Add METHODS.PNG 2023-04-26 15:08:10 +12:00
Li c8fedc3d79 Update Readme 2023-04-26 15:07:17 +12:00
Li 6057979bc3 Merge branch 'v2' into HEAD 2023-04-26 14:08:04 +12:00
Li 3787e96e43 Go back !! GO BACK! 2023-04-26 14:01:44 +12:00
Li bd3d985aba maybe make homebrew work better, idk it doesnt work very well anyway 2023-04-26 13:53:24 +12:00
Li e9aa19ec18 Add Complete sound effected 2023-04-26 12:08:47 +12:00
Li d911c20ca2 Merge branch 'main' of https://silica.codes/SilicaAndPina/Chovy-Sign-v2 2023-04-25 14:58:24 +12:00
Li fef3fbc4a0 Merge branch 'main' of https://silica.codes/SilicaAndPina/Chovy-Sign-v2 2023-04-25 14:23:20 +12:00
Li 86dcb439ee Fix textboxes 2023-04-25 14:22:34 +12:00
Li fa4f38bbd0 Fix textboxes 2023-04-25 14:19:41 +12:00
Li 5f047866d9 Update ChovySignv2 2023-04-25 11:16:52 +12:00
Li b51b7a7312 Update 2023-04-24 23:53:22 +12:00
Li e726931b86 Make the GUI version functional! 2023-04-23 20:15:11 +12:00
Li c14a5cc73c Add rif/act method GUI 2023-04-22 15:54:29 +12:00
Li cc838ff1b5 add gui functionality 2023-04-21 18:21:21 +12:00
Li 526f756b7b Update ChovySign GUI 2023-04-20 20:15:36 +12:00
Li ef19d3eeef Update mainWindow 2023-04-20 09:35:49 +12:00
Li ba1ffaf429 Begin work on GUI 2023-04-20 01:40:05 +12:00
Li e25ab121d9 Update to use LibChovy 2023-04-19 21:58:21 +12:00
Li e15f1897a7 Update to use LibChovy 2023-04-19 21:58:07 +12:00
Li 537b1b1229 start moving to other lib 2023-04-18 15:10:03 +12:00
Li eeabf1a33a change names of folders 2023-04-18 07:28:50 +12:00
Li fb10fc23c7 Revert corruption .. 2023-04-18 07:07:24 +12:00
Li 03be164a0e some shit got corrupted, will probably have to revert some stuff 2023-04-18 07:00:52 +12:00
Li f14b166dec Fix key obtain (eboot.pbp) 2023-04-18 02:41:55 +12:00
Li ab38aa8ed4 add stuff 2023-04-18 00:28:19 +12:00
Li 8000c946bd Fix multidisc 2023-04-17 10:14:13 +12:00
Li 9e00f65cb9 Fix stuff 2023-04-17 08:51:24 +12:00
Li fc5e6835ed Fix startdat not appearing 2023-04-17 08:25:45 +12:00
Li f5e9d5eaee add chovysign-cli 2023-04-17 07:48:32 +12:00
Li 9cb01e4a4b Add UMD Reader 2023-04-17 01:07:43 +12:00
Li 50c91e024c Remove unicorntest 2023-04-16 21:25:06 +12:00
Li 4665da300c Update compression to work with both pops and npumdimg. 2023-04-16 20:55:40 +12:00
Li eb5120a674 Fix gitignore 2023-04-16 05:23:05 +12:00
Li 562016688a Add NpUmdImg 2023-04-16 05:22:43 +12:00
Li 7b6830a40b Initial commit 2023-04-14 15:55:11 +12:00
Li 04bafb8b70 Initial commit 2023-04-14 03:52:57 +00:00
Bluzume cdb7b7e3f1
Delete CODE-OF_CONDUCT.md 2021-02-01 03:18:55 +13:00
SilicaAndPina bc2ce3f215 Merge branch 'master' of https://github.com/KuromeSan/chovy-sign 2020-10-17 15:43:32 +13:00
SilicaAndPina 9bea79554f no message 2020-10-17 15:43:09 +13:00
Bluzume 230e35398d
Update CODE-OF_CONDUCT.md 2020-09-25 12:21:17 +12:00
Bluzume 372fa4b350
Update CODE-OF_CONDUCT.md 2020-09-25 12:20:33 +12:00
Bluzume 0cccf6586d
Update CODE-OF_CONDUCT.md 2020-09-25 12:20:21 +12:00
Bluzume c5be100088
Update CODE-OF_CONDUCT.md 2020-09-25 12:18:34 +12:00
Bluzume 010dadc91b
Create CODE-OF_CONDUCT.md 2020-09-25 12:17:57 +12:00
SilicaAndPina 318cd09f5a Add stuff 2020-09-03 12:27:33 +12:00
SilicaAndPina b98eac4789 No more depends on sign_np.exe :3 2020-08-27 22:06:52 +12:00
SilicaAndPina 0a8dc4c062 Sign-Nplessness! almost works ! 2020-08-26 03:48:28 +12:00
SilicaAndPina b215adde4e Update code 2020-08-26 00:23:16 +12:00
Bluzume da8d02ca1c
Update MobyGamesDB.cs 2020-08-25 18:17:01 +12:00
Bluzume db7d7425e8
Update MobyGamesDB.cs 2020-08-25 18:15:59 +12:00
Bluzume 46346f6a51
Update README.md 2020-08-25 06:55:38 +12:00
Bluzume 4a3412c382
Update README.md 2020-08-25 06:54:36 +12:00
Bluzume b10d5bed1d
Update README.md 2020-08-25 06:53:43 +12:00
Bluzume 175179dc57
Update README.md 2020-08-25 06:53:10 +12:00
SilicaAndPina 5c58c31270 Update files more... 2020-08-25 06:50:46 +12:00
SilicaAndPina 9df7b33678 Merge branch 'master' of https://github.com/KuromeSan/chovy-sign 2020-08-24 23:12:16 +12:00
SilicaAndPina 27e4883113 Fix Building. and naming. 2020-08-24 23:11:49 +12:00
Bluzume 9c680aaa0c
Update README.md 2020-08-24 22:56:18 +12:00
Bluzume 930724d257
Update README.md 2020-08-24 22:55:23 +12:00
Bluzume af73d7d682
Update README.md 2020-08-24 22:47:15 +12:00
Bluzume a6453ad2e7
Update README.md 2020-08-24 22:47:00 +12:00
Bluzume fe7a8dc0a8
Update README.md 2020-08-24 22:36:58 +12:00
Bluzume 1cbd4c9b29
Update README.md 2020-08-24 22:29:27 +12:00
Bluzume 021bd2ae76
Update LICENSE 2020-08-24 22:28:13 +12:00
Bluzume 07af1e24b4
Update LICENSE 2020-08-24 22:27:40 +12:00
Bluzume d1da166ea3
Update README.md 2020-08-24 22:24:16 +12:00
Bluzume ae02a0382c
Update README.md 2020-08-24 22:24:10 +12:00
Bluzume f10560d361
Update README.md 2020-08-24 22:20:01 +12:00
Bluzume 9d376211c1
Update README.md 2020-08-24 22:17:26 +12:00
Bluzume 57ac62ecc7
Update README.md 2020-08-24 22:16:59 +12:00
Bluzume 456a7bae4b
Add full license info 2020-08-24 22:10:03 +12:00
SilicaAndPina d8491b95d7 Rename back to CHOVY-GEN. 2020-08-24 22:06:53 +12:00
SilicaAndPina 69f1c18890 Rename to CHOVY-GEN2 (so i can capitialize it) 2020-08-24 22:06:29 +12:00
SilicaAndPina 3b024948fc Finish POPS Gui, and include https://github.com/RupertAvery/PSXPackager 2020-08-24 22:05:02 +12:00
Bluzume 157d8de398
Add files via upload
Start POPS Support.
2020-08-24 04:31:26 +12:00
Bluzume 927ebb3e71
Start work on POPS. 2020-08-24 04:29:07 +12:00
Bluzume 148152705d
Update README.md 2020-08-12 12:11:22 +12:00
Bluzume 98a68583f5
Add TestKit Support. 2020-08-12 12:08:58 +12:00
Bluzume fa8c5ff1b3
Update README.md
*3.73
2019-10-17 17:29:46 +13:00
SilicaAndPina 4cb867b384 Merge branch 'master' of https://github.com/KuromeSan/chovy-sign 2019-10-15 15:01:53 +13:00
SilicaAndPina 80f8c117e8 Compress Murica.wav 2019-10-15 15:01:31 +13:00
Bluzume 4ca6d1531d
Update README.md 2019-10-11 01:27:18 +13:00
Bluzume 152fa0f955
Update README.md 2019-10-10 23:07:42 +13:00
Bluzume c262a527b9
Update README.md 2019-10-10 23:07:13 +13:00
Bluzume be8b70b9b5
Update README.md 2019-10-10 20:26:17 +13:00
Bluzume 5827002ba5
Update README.md 2019-10-10 20:25:24 +13:00
583 changed files with 61093 additions and 82665 deletions

39
.gitignore vendored Normal file
View File

@ -0,0 +1,39 @@
*/bin/*
*/obj/*
.vs/*
*.7z
*.pdn
*.user
*launchSettings.json
*Thumbs.db
PbpResign/bin/*
PbpResign/obj/*
ChovySign-CLI/bin/*
ChovySign-CLI/obj/*
ChovySign-GUI/bin/*
ChovySign-GUI/obj/*
DiscUtils/bin/*
DiscUtils/obj/*
GameBuilder/bin/*
GameBuilder/obj/*
PspCrypto/bin/*
PspCrypto/obj/*
LibChovy/bin/*
LibChovy/obj/*
LiLib/bin/*
LiLib/obj/*
Vita/bin/*
Vita/obj/*
UnicornTest/*
UnicornManaged/*

View File

@ -1,62 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.76
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CHOVY-GUI", "CHOVY\CHOVY-GUI.csproj", "{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KIRK", "KIRK\KIRK.vcxproj", "{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CHOVY-GEN", "CHOVY-GEN\CHOVY-GEN.vcxproj", "{DCDBF747-DFB6-450E-A403-1C592D20EAEB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Debug|x64.ActiveCfg = Debug|Any CPU
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Debug|x64.Build.0 = Debug|Any CPU
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Debug|x86.ActiveCfg = Debug|Any CPU
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Debug|x86.Build.0 = Debug|Any CPU
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Release|Any CPU.Build.0 = Release|Any CPU
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Release|x64.ActiveCfg = Release|Any CPU
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Release|x64.Build.0 = Release|Any CPU
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Release|x86.ActiveCfg = Release|Any CPU
{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}.Release|x86.Build.0 = Release|Any CPU
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Debug|Any CPU.ActiveCfg = Debug|Win32
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Debug|Any CPU.Build.0 = Debug|Win32
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Debug|x64.ActiveCfg = Debug|x64
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Debug|x64.Build.0 = Debug|x64
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Debug|x86.ActiveCfg = Debug|Win32
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Debug|x86.Build.0 = Debug|Win32
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Release|Any CPU.ActiveCfg = Release|Win32
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Release|Any CPU.Build.0 = Release|Win32
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Release|x64.ActiveCfg = Release|x64
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Release|x64.Build.0 = Release|x64
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Release|x86.ActiveCfg = Release|Win32
{C441ACC2-EC4E-424B-AA99-3F5D1A997A4F}.Release|x86.Build.0 = Release|Win32
{DCDBF747-DFB6-450E-A403-1C592D20EAEB}.Debug|Any CPU.ActiveCfg = Debug|Win32
{DCDBF747-DFB6-450E-A403-1C592D20EAEB}.Debug|Any CPU.Build.0 = Debug|Win32
{DCDBF747-DFB6-450E-A403-1C592D20EAEB}.Debug|x64.ActiveCfg = Debug|x64
{DCDBF747-DFB6-450E-A403-1C592D20EAEB}.Debug|x64.Build.0 = Debug|x64
{DCDBF747-DFB6-450E-A403-1C592D20EAEB}.Debug|x86.ActiveCfg = Debug|Win32
{DCDBF747-DFB6-450E-A403-1C592D20EAEB}.Debug|x86.Build.0 = Debug|Win32
{DCDBF747-DFB6-450E-A403-1C592D20EAEB}.Release|Any CPU.ActiveCfg = Release|Win32
{DCDBF747-DFB6-450E-A403-1C592D20EAEB}.Release|Any CPU.Build.0 = Release|Win32
{DCDBF747-DFB6-450E-A403-1C592D20EAEB}.Release|x64.ActiveCfg = Release|x64
{DCDBF747-DFB6-450E-A403-1C592D20EAEB}.Release|x64.Build.0 = Release|x64
{DCDBF747-DFB6-450E-A403-1C592D20EAEB}.Release|x86.ActiveCfg = Release|Win32
{DCDBF747-DFB6-450E-A403-1C592D20EAEB}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
</configuration>

View File

@ -1,140 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>CHOVY</RootNamespace>
<AssemblyName>CHOVY-SIGN</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<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>
</Reference>
<Reference Include="DiscUtils, Version=0.11.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Discutils.0.11.0.2\lib\net40\DiscUtils.dll</HintPath>
</Reference>
<Reference Include="DiscUtils.Common, Version=0.11.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Discutils.0.11.0.2\lib\net40\DiscUtils.Common.dll</HintPath>
</Reference>
<Reference Include="DotNetZip, Version=1.13.4.0, Culture=neutral, PublicKeyToken=6583c7c814667745, processorArchitecture=MSIL">
<HintPath>..\packages\DotNetZip.1.13.4\lib\net40\DotNetZip.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CHOVY.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CHOVY.Designer.cs">
<DependentUpon>CHOVY.cs</DependentUpon>
</Compile>
<Compile Include="CHOVYCmaSelector.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CHOVYCmaSelector.Designer.cs">
<DependentUpon>CHOVYCmaSelector.cs</DependentUpon>
</Compile>
<Compile Include="cmakeys.cs" />
<Compile Include="param.cs" />
<Compile Include="pbp.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="PSVIMGBuilder.cs" />
<Compile Include="PSVIMGFileStream.cs" />
<Compile Include="PSVIMGStream.cs" />
<Compile Include="PSVIMGStructs.cs" />
<Compile Include="PSVMDBuilder.cs" />
<EmbeddedResource Include="CHOVY.resx">
<DependentUpon>CHOVY.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="CHOVYCmaSelector.resx">
<DependentUpon>CHOVYCmaSelector.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\idkbackground.gif" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\umd.gif" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Murica.wav" />
</ItemGroup>
<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>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<EnableUnmanagedDebugging>true</EnableUnmanagedDebugging>
</PropertyGroup>
</Project>

View File

@ -1,490 +0,0 @@
using CHOVY.Properties;
using DiscUtils.Iso9660;
using Microsoft.Win32;
using Param_SFO;
using PSVIMGTOOLS;
using System;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Media;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace CHOVY
{
public partial class CHOVY : Form
{
bool MutedAudio = false;
public byte[] GetSfo(string ISOFile)
{
FileStream ISO = File.OpenRead(ISOFile);
CDReader cdr = new CDReader(ISO, false);
Stream ParamSfo = cdr.OpenFile(@"PSP_GAME\PARAM.SFO", FileMode.Open,FileAccess.Read);
byte[] Sfo = new byte[ParamSfo.Length];
ParamSfo.Read(Sfo, 0x00, (int)ParamSfo.Length);
ISO.Close();
return Sfo;
}
public byte[] GetIcon(string ISOFile)
{
FileStream ISO = File.OpenRead(ISOFile);
CDReader cdr = new CDReader(ISO, false);
Stream ParamSfo = cdr.OpenFile(@"PSP_GAME\ICON0.PNG", FileMode.Open, FileAccess.Read);
byte[] Icon0 = new byte[ParamSfo.Length];
ParamSfo.Read(Icon0, 0x00, (int)ParamSfo.Length);
ISO.Close();
return Icon0;
}
public static string GetTitleID(string ISOFile)
{
FileStream ISO = File.OpenRead(ISOFile);
CDReader cdr = new CDReader(ISO, false);
Stream ParamSfo = cdr.OpenFile(@"PSP_GAME\PARAM.SFO", FileMode.Open, FileAccess.Read);
PARAM_SFO sfo = new PARAM_SFO(ParamSfo);
string TitleID = sfo.GetValue("DISC_ID");
ISO.Close();
return TitleID;
}
public static bool isMini(string ISOFile)
{
FileStream ISO = File.OpenRead(ISOFile);
CDReader cdr = new CDReader(ISO, false);
Stream Icon0 = cdr.OpenFile(@"PSP_GAME\ICON0.PNG", FileMode.Open, FileAccess.Read);
Bitmap bmp = new Bitmap(Icon0);
bool isMini = (bmp.Width == 80 && bmp.Height == 80);
bmp.Dispose();
ISO.Close();
return isMini;
}
public string ReadSetting(string Setting)
{
string Value = "";
try
{
RegistryKey key;
key = Registry.CurrentUser.CreateSubKey(@"Software\CHOVYProject\Chovy-Sign");
Value = key.GetValue(Setting).ToString();
key.Close();
}
catch (Exception) { return ""; }
return Value;
}
public void WriteSetting(string Setting,string Value)
{
try
{
RegistryKey key;
key = Registry.CurrentUser.CreateSubKey(@"Software\CHOVYProject\Chovy-Sign");
key.SetValue(Setting, Value);
key.Close();
}
catch (Exception) { }
}
public CHOVY()
{
InitializeComponent();
}
private void CHOVY_Load(object sender, EventArgs e)
{
if(ReadSetting("MuteAudio") == "1")
{
MutedAudio = true;
}
Versionkey.Text = ReadSetting("VersionKey");
RifPath.Text = ReadSetting("RifPath");
}
private void FREEDOM_EnabledChanged(object sender, EventArgs e)
{
Color red = Color.FromArgb(192, 0, 0);
Color black = Color.Black;
bool enabled = this.FREEDOM.Enabled;
this.FREEDOM.ForeColor = enabled ? red : black;
this.FREEDOM.BackColor = enabled ? black : red;
}
private void FREEDOM_Click(object sender, EventArgs e)
{
Action enable = () => {
this.FREEDOM.Enabled = true;
};
if(RifPath.Text == "" || !File.Exists(RifPath.Text))
{
MessageBox.Show("INVALID RIF PATH!\nPlease try \"Find from CMA\"", "RIF ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if(Versionkey.Text.Length != 32)
{
MessageBox.Show("INVALID VERSION KEY!\nPlease try \"Find from CMA\"", "VERKEY ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if(ISOPath.Text == "" || !File.Exists(ISOPath.Text))
{
MessageBox.Show("INVALID ISO PATH!", "ISO ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
this.FREEDOM.Enabled = false;
string CmaDir = ReadSetting("CmaDir");
if(CmaDir == "")
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
fbd.Description = "Select CMA Backups Directory";
fbd.ShowDialog();
CmaDir = fbd.SelectedPath;
}
string TitleID = GetTitleID(ISOPath.Text);
string TmpDir = Path.Combine(Application.StartupPath, "_tmp");
string GameWorkDir = Path.Combine(TmpDir, TitleID);
string EbootFile = Path.Combine(GameWorkDir, "EBOOT.PBP");
string EbootSignature = Path.Combine(GameWorkDir, "__sce_ebootpbp");
Directory.CreateDirectory(TmpDir);
Directory.CreateDirectory(GameWorkDir);
//Read RIF data
byte[] ContentId = new byte[0x24];
byte[] RifAid = new byte[0x08];
FileStream rif = File.OpenRead(RifPath.Text);
rif.Seek(0x10, SeekOrigin.Begin);
rif.Read(ContentId, 0x00, 0x24);
rif.Seek(0x08, SeekOrigin.Begin);
rif.Read(RifAid, 0x00, 0x08);
rif.Close();
string ContentID = Encoding.UTF8.GetString(ContentId);
string Aid = BitConverter.ToString(RifAid).Replace("-", "").ToLower();
string BackupWorkDir = Path.Combine(CmaDir, "PGAME", Aid, TitleID);
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)
{
string Progress = signnp.StandardOutput.ReadLine();
if(Progress.StartsWith("Writing ISO blocks: "))
{
Progress = Progress.Remove(0,19);
int ProgressInt = int.Parse(Progress.Substring(0,3));
TotalProgress.Value = ProgressInt;
Status.Text = "Overthrowing The PSPEMU Monarchy " + ProgressInt.ToString() + "%";
}
Application.DoEvents();
}
TotalProgress.Value = 0;
Status.Text = "Signing the Declaration of Independance 0%";
UInt64 IntAid = BitConverter.ToUInt64(RifAid,0x00);
Thread thrd = 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");
enable();
return;
}
});
thrd.Start();
while(thrd.IsAlive)
{
Application.DoEvents();
}
/*
* BUILD PSVIMG FILE
*/
// Pacakge GAME
byte[] CmaKey = CmaKeys.GenerateKey(RifAid);
string[] entrys = Directory.GetFileSystemEntries(GameWorkDir, "*", SearchOption.AllDirectories);
long noEntrys = entrys.LongLength;
string parentPath = "ux0:pspemu/temp/game/PSP/GAME/" + TitleID;
int noBlocks = 0;
foreach (string fileName in Directory.GetFiles(GameWorkDir,"*",SearchOption.AllDirectories))
{
noBlocks += Convert.ToInt32(new FileInfo(fileName).Length / PSVIMGConstants.PSVIMG_BLOCK_SIZE);
}
TotalProgress.Maximum = noBlocks;
string BackupDir = Path.Combine(BackupWorkDir, "game");
Directory.CreateDirectory(BackupDir);
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)
{
builder.AddDir(entry, parentPath, relativePath);
}
else
{
builder.AddFileAsync(entry, parentPath, relativePath);
while(!builder.HasFinished)
{
try
{
int tBlocks = builder.BlocksWritten;
TotalProgress.Value = tBlocks;
decimal progress = Math.Floor(((decimal)tBlocks / (decimal)noBlocks) * 100);
Status.Text = "Signing the Declaration of Independance " + progress.ToString() + "%";
}
catch (Exception) { }
Application.DoEvents();
}
}
}
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();
// Package LICENSE
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");
Directory.CreateDirectory(SceSysWorkDir);
byte[] ParamSfo = GetSfo(ISOPath.Text);
byte[] Icon0 = GetIcon(ISOPath.Text);
File.WriteAllBytes(Path.Combine(SceSysWorkDir, "param.sfo"), ParamSfo);
File.WriteAllBytes(Path.Combine(SceSysWorkDir, "icon0.png"), Icon0);
Status.Text = "YOU HAVE MADE A SOCIAL CONTRACT WITH FREEDOM!";
TotalProgress.Value = 0;
try
{
Directory.Delete(TmpDir, true);
}
catch (Exception) { };
if (!MutedAudio)
{
Stream str = Resources.Murica;
SoundPlayer snd = new SoundPlayer(str);
snd.Play();
}
enable();
MessageBox.Show("YOU HAVE MADE A SOCIAL CONTRACT WITH FREEDOM!", "FREEDOM!", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void FindFromCMA_Click(object sender, EventArgs e)
{
this.Hide();
string cmaDir = "";
string accountId = "0000000000000000";
try
{
//try qcma
cmaDir = Registry.CurrentUser.OpenSubKey(@"Software\codestation\qcma").GetValue("appsPath").ToString();
accountId = Registry.CurrentUser.OpenSubKey(@"Software\codestation\qcma").GetValue("lastAccountId").ToString();
}
catch (Exception)
{
try
{
//try sony cma
cmaDir = Registry.CurrentUser.OpenSubKey(@"Software\Sony Corporation\Content Manager Assistant\Settings").GetValue("ApplicationHomePath").ToString();
}
catch (Exception)
{
try
{
//try devkit cma
cmaDir = Registry.CurrentUser.OpenSubKey(@"Software\SCE\PSP2\Services\Content Manager Assistant for PlayStation(R)Vita DevKit\Settings").GetValue("ApplicationHomePath").ToString();
}
catch (Exception)
{
try
{
string DefaultDir = Path.Combine(Environment.GetEnvironmentVariable("HOMEDRIVE"), Environment.GetEnvironmentVariable("HOMEPATH"), "Documents", "PS Vita");
if (Directory.Exists(DefaultDir))
{
cmaDir = DefaultDir;
}
}
catch (Exception)
{
//Do nothing
}
}
}
}
CHOVYCmaSelector ccs = new CHOVYCmaSelector(cmaDir, accountId);
ccs.FormClosing += Ccs_FormClosing;
ccs.ShowDialog();
}
private void Ccs_FormClosing(object sender, FormClosingEventArgs e)
{
CHOVYCmaSelector ccs = (CHOVYCmaSelector)sender;
string CmaDir = ccs.GetCmaDir();
string CmaAid = ccs.GetCmaAid();
string Backup = ccs.GetSelectedBackup();
WriteSetting("CmaDir", CmaDir);
if (Backup == "")
{
return;
}
string BackupPath = Path.Combine(CmaDir, "PGAME", CmaAid, Backup, "game", "game.psvimg");
if(!File.Exists(BackupPath))
{
MessageBox.Show("Could not find \n" + BackupPath + "\n Perhaps backup failed?", "License Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
ccs.Hide();
this.Show();
this.Focus();
return;
}
byte[] AID = BitConverter.GetBytes(Convert.ToInt64(CmaAid, 16));
Array.Reverse(AID);
byte[] Key = CmaKeys.GenerateKey(AID);
PSVIMGStream GamePsvimg = new PSVIMGStream(File.OpenRead(BackupPath), Key);
BackupPath = Path.Combine(CmaDir, "PGAME", CmaAid, Backup, "license", "license.psvimg");
if (!File.Exists(BackupPath))
{
MessageBox.Show("Could not find \n"+BackupPath+"\n Perhaps backup failed?","License Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
ccs.Hide();
this.Show();
this.Focus();
return;
}
PSVIMGStream LicensePsvimg = new PSVIMGStream(File.OpenRead(BackupPath), Key);
string Rif = Path.Combine(Application.StartupPath, "GAME.RIF");
PSVIMGFileStream EbootPbp = new PSVIMGFileStream(GamePsvimg, "/EBOOT.PBP");
byte[] VersionKey = pbp.GetVersionKey(EbootPbp);
string VerKey = BitConverter.ToString(VersionKey).Replace("-", "");
WriteSetting("VersionKey", VerKey);
string ContentID = pbp.GetContentId(EbootPbp);
PSVIMGFileStream LicenseRif = new PSVIMGFileStream(LicensePsvimg, "/"+ ContentID+ ".rif");
LicenseRif.WriteToFile(Rif);
LicenseRif.Close();
LicensePsvimg.Close();
EbootPbp.Close();
GamePsvimg.Close();
WriteSetting("RifPath", Rif);
Versionkey.Text = VerKey;
RifPath.Text = Rif;
ccs.Hide();
this.Show();
this.Focus();
MessageBox.Show("KEYS HAVE BEEN EXTRACTED FROM CMA, YOU MAY NOW LIBERATE YOURSELF", "SUCCESS", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void BrowseButton_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Title = "Select PSP UMD image *.iso";
ofd.Filter = "ISO9660 Image Files (*.iso)|*.iso";
ofd.ShowDialog();
ISOPath.Text = ofd.FileName;
}
private void CHOVY_FormClosing(object sender, FormClosingEventArgs e)
{
Environment.Exit(0);
}
private void PsmChan_Click(object sender, EventArgs e)
{
if(!MutedAudio)
{
MutedAudio = true;
WriteSetting("MuteAudio", "1");
}
else
{
MutedAudio = false;
WriteSetting("MuteAudio", "0");
}
}
}
}

View File

@ -1,110 +0,0 @@
using Param_SFO;
using System;
using System.IO;
using System.Windows.Forms;
namespace CHOVY
{
public partial class CHOVYCmaSelector : Form
{
public CHOVYCmaSelector(string CMA = "", string AID = "")
{
InitializeComponent();
CMADir.Text = CMA;
AIDSelector.Text = AID;
}
public string GetSelectedBackup()
{
try
{
return BackupList.Text.Substring(0, 9);
}
catch (Exception)
{
return "";
}
}
public string GetCmaDir()
{
return CMADir.Text;
}
public string GetCmaAid()
{
return AIDSelector.Text;
}
private void UpdateAidList()
{
AIDSelector.Items.Clear();
try
{
string CmaDir = CMADir.Text;
string BackupuPath = Path.Combine(CmaDir, "PGAME");
foreach (string Dir in Directory.GetDirectories(BackupuPath))
{
AIDSelector.Items.Add(Path.GetFileName(Dir));
}
AIDSelector.SelectedIndex = 0;
}
catch (Exception) { }
}
private void UpdateBackupList()
{
BackupList.Items.Clear();
try
{
string CmaDir = CMADir.Text;
string Aid = AIDSelector.Text;
string BackupuPath = Path.Combine(CmaDir, "PGAME", Aid);
foreach (string Dir in Directory.GetDirectories(BackupuPath))
{
try
{
string SfoPath = Path.Combine(BackupuPath, Dir, "sce_sys", "param.sfo");
FileStream SfoStream = File.OpenRead(SfoPath);
PARAM_SFO sfo = new PARAM_SFO(SfoStream);
string Title = sfo.Title;
SfoStream.Close();
string BackupName = (Path.GetFileName(Dir) + " - " + Title);
BackupList.Items.Add(BackupName);
}
catch (Exception)
{
BackupList.Items.Add(Path.GetFileName(Dir));
}
}
}
catch (Exception) { }
}
private void AIDSelector_TextChanged(object sender, EventArgs e)
{
UpdateBackupList();
}
private void CMADir_TextChanged(object sender, EventArgs e)
{
UpdateBackupList();
UpdateAidList();
}
private void Browse_Click(object sender, EventArgs e)
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
fbd.Description = "CMA Backups Directory";
fbd.ShowDialog();
CMADir.Text = fbd.SelectedPath;
}
private void GitRifAndVerKey_Click(object sender, EventArgs e)
{
this.Close();
}
}
}

323
CHOVY/Chovy.Designer.cs generated
View File

@ -1,323 +0,0 @@
namespace CHOVY
{
partial class CHOVY
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CHOVY));
this.label1 = new System.Windows.Forms.Label();
this.RifPath = new System.Windows.Forms.TextBox();
this.Versionkey = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.FindFromCMA = new System.Windows.Forms.Button();
this.ISOPath = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.PsmChan = new System.Windows.Forms.PictureBox();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.BrowseButton = new System.Windows.Forms.Button();
this.TotalProgress = new System.Windows.Forms.ProgressBar();
this.Status = new System.Windows.Forms.Label();
this.FREEDOM = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.CompressPBP = new System.Windows.Forms.CheckBox();
this.label6 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PsmChan)).BeginInit();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.ForeColor = System.Drawing.Color.Chartreuse;
this.label1.Location = new System.Drawing.Point(6, 19);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(27, 13);
this.label1.TabIndex = 0;
this.label1.Text = "RIF:";
//
// RifPath
//
this.RifPath.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.RifPath.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.RifPath.ForeColor = System.Drawing.Color.Lime;
this.RifPath.Location = new System.Drawing.Point(37, 16);
this.RifPath.Name = "RifPath";
this.RifPath.Size = new System.Drawing.Size(225, 20);
this.RifPath.TabIndex = 1;
//
// Versionkey
//
this.Versionkey.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.Versionkey.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.Versionkey.ForeColor = System.Drawing.Color.Lime;
this.Versionkey.Location = new System.Drawing.Point(337, 16);
this.Versionkey.MaxLength = 32;
this.Versionkey.Name = "Versionkey";
this.Versionkey.Size = new System.Drawing.Size(225, 20);
this.Versionkey.TabIndex = 2;
//
// label2
//
this.label2.AutoSize = true;
this.label2.ForeColor = System.Drawing.Color.Chartreuse;
this.label2.Location = new System.Drawing.Point(268, 19);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(63, 13);
this.label2.TabIndex = 3;
this.label2.Text = "VersionKey:";
//
// FindFromCMA
//
this.FindFromCMA.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.FindFromCMA.ForeColor = System.Drawing.Color.Lime;
this.FindFromCMA.Location = new System.Drawing.Point(568, 16);
this.FindFromCMA.Name = "FindFromCMA";
this.FindFromCMA.Size = new System.Drawing.Size(109, 23);
this.FindFromCMA.TabIndex = 4;
this.FindFromCMA.Text = "Find from CMA";
this.FindFromCMA.UseVisualStyleBackColor = true;
this.FindFromCMA.Click += new System.EventHandler(this.FindFromCMA_Click);
//
// ISOPath
//
this.ISOPath.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.ISOPath.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ISOPath.ForeColor = System.Drawing.Color.Lime;
this.ISOPath.Location = new System.Drawing.Point(77, 54);
this.ISOPath.Name = "ISOPath";
this.ISOPath.Size = new System.Drawing.Size(345, 20);
this.ISOPath.TabIndex = 6;
//
// label3
//
this.label3.AutoSize = true;
this.label3.ForeColor = System.Drawing.Color.Chartreuse;
this.label3.Location = new System.Drawing.Point(74, 38);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(60, 13);
this.label3.TabIndex = 8;
this.label3.Text = "ISO Image:";
//
// pictureBox2
//
this.pictureBox2.BackgroundImage = global::CHOVY.Properties.Resources.UMD;
this.pictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.pictureBox2.Location = new System.Drawing.Point(15, 31);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(53, 43);
this.pictureBox2.TabIndex = 9;
this.pictureBox2.TabStop = false;
//
// PsmChan
//
this.PsmChan.BackgroundImage = global::CHOVY.Properties.Resources.idkbackground;
this.PsmChan.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.PsmChan.Location = new System.Drawing.Point(3, 3);
this.PsmChan.Name = "PsmChan";
this.PsmChan.Size = new System.Drawing.Size(123, 297);
this.PsmChan.TabIndex = 5;
this.PsmChan.TabStop = false;
this.PsmChan.Click += new System.EventHandler(this.PsmChan_Click);
//
// label4
//
this.label4.AutoSize = true;
this.label4.ForeColor = System.Drawing.Color.Chartreuse;
this.label4.Location = new System.Drawing.Point(132, 280);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(145, 13);
this.label4.TabIndex = 10;
this.label4.Text = "Made Possible by the CBPS! ";
//
// label5
//
this.label5.AutoSize = true;
this.label5.ForeColor = System.Drawing.Color.Chartreuse;
this.label5.Location = new System.Drawing.Point(664, 280);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(167, 13);
this.label5.TabIndex = 11;
this.label5.Text = "SilicaAndPina, dots_tb, Motoharu.";
//
// BrowseButton
//
this.BrowseButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.BrowseButton.ForeColor = System.Drawing.Color.Lime;
this.BrowseButton.Location = new System.Drawing.Point(428, 52);
this.BrowseButton.Name = "BrowseButton";
this.BrowseButton.Size = new System.Drawing.Size(60, 22);
this.BrowseButton.TabIndex = 12;
this.BrowseButton.Text = "Browse";
this.BrowseButton.UseVisualStyleBackColor = true;
this.BrowseButton.Click += new System.EventHandler(this.BrowseButton_Click);
//
// TotalProgress
//
this.TotalProgress.BackColor = System.Drawing.Color.Black;
this.TotalProgress.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
this.TotalProgress.Location = new System.Drawing.Point(209, 227);
this.TotalProgress.Name = "TotalProgress";
this.TotalProgress.Size = new System.Drawing.Size(443, 23);
this.TotalProgress.TabIndex = 13;
//
// Status
//
this.Status.AutoSize = true;
this.Status.ForeColor = System.Drawing.Color.LawnGreen;
this.Status.Location = new System.Drawing.Point(206, 211);
this.Status.Name = "Status";
this.Status.Size = new System.Drawing.Size(62, 13);
this.Status.TabIndex = 14;
this.Status.Text = "Progress % ";
//
// FREEDOM
//
this.FREEDOM.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.FREEDOM.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.FREEDOM.Location = new System.Drawing.Point(658, 227);
this.FREEDOM.Name = "FREEDOM";
this.FREEDOM.Size = new System.Drawing.Size(75, 23);
this.FREEDOM.TabIndex = 15;
this.FREEDOM.Text = "FREEDOM";
this.FREEDOM.UseVisualStyleBackColor = true;
this.FREEDOM.EnabledChanged += new System.EventHandler(this.FREEDOM_EnabledChanged);
this.FREEDOM.Click += new System.EventHandler(this.FREEDOM_Click);
//
// groupBox1
//
this.groupBox1.BackColor = System.Drawing.Color.Black;
this.groupBox1.Controls.Add(this.RifPath);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.Versionkey);
this.groupBox1.Controls.Add(this.FindFromCMA);
this.groupBox1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.groupBox1.ForeColor = System.Drawing.Color.Lime;
this.groupBox1.Location = new System.Drawing.Point(135, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(696, 47);
this.groupBox1.TabIndex = 16;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Keys To The Kingdom";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.CompressPBP);
this.groupBox2.Controls.Add(this.pictureBox2);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.ISOPath);
this.groupBox2.Controls.Add(this.BrowseButton);
this.groupBox2.ForeColor = System.Drawing.Color.Lime;
this.groupBox2.Location = new System.Drawing.Point(209, 74);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(524, 105);
this.groupBox2.TabIndex = 17;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "The PSP Game";
//
// CompressPBP
//
this.CompressPBP.AutoSize = true;
this.CompressPBP.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.CompressPBP.Location = new System.Drawing.Point(15, 80);
this.CompressPBP.Name = "CompressPBP";
this.CompressPBP.Size = new System.Drawing.Size(93, 17);
this.CompressPBP.TabIndex = 18;
this.CompressPBP.Text = "Compress PBP";
this.CompressPBP.UseVisualStyleBackColor = true;
//
// label6
//
this.label6.AutoSize = true;
this.label6.ForeColor = System.Drawing.Color.Lime;
this.label6.Location = new System.Drawing.Point(735, 62);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(96, 13);
this.label6.TabIndex = 18;
this.label6.Text = "100% percent free!\r\n";
//
// CHOVY
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Black;
this.ClientSize = new System.Drawing.Size(843, 302);
this.Controls.Add(this.label6);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.FREEDOM);
this.Controls.Add(this.Status);
this.Controls.Add(this.TotalProgress);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.PsmChan);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "CHOVY";
this.Text = "CHOVY-SIGN";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CHOVY_FormClosing);
this.Load += new System.EventHandler(this.CHOVY_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PsmChan)).EndInit();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox RifPath;
private System.Windows.Forms.TextBox Versionkey;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button FindFromCMA;
private System.Windows.Forms.PictureBox PsmChan;
private System.Windows.Forms.TextBox ISOPath;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Button BrowseButton;
private System.Windows.Forms.ProgressBar TotalProgress;
private System.Windows.Forms.Label Status;
private System.Windows.Forms.Button FREEDOM;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.CheckBox CompressPBP;
private System.Windows.Forms.Label label6;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,152 +0,0 @@
namespace CHOVY
{
partial class CHOVYCmaSelector
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CHOVYCmaSelector));
this.BackupList = new System.Windows.Forms.ListBox();
this.label1 = new System.Windows.Forms.Label();
this.CMADir = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.AIDSelector = new System.Windows.Forms.ComboBox();
this.Browse = new System.Windows.Forms.Button();
this.GitRifAndVerKey = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// BackupList
//
this.BackupList.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.BackupList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.BackupList.ForeColor = System.Drawing.Color.Lime;
this.BackupList.FormattingEnabled = true;
this.BackupList.Location = new System.Drawing.Point(12, 40);
this.BackupList.Name = "BackupList";
this.BackupList.Size = new System.Drawing.Size(617, 262);
this.BackupList.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.ForeColor = System.Drawing.Color.Chartreuse;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(49, 13);
this.label1.TabIndex = 1;
this.label1.Text = "CMA Dir:";
//
// CMADir
//
this.CMADir.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.CMADir.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.CMADir.ForeColor = System.Drawing.Color.Lime;
this.CMADir.Location = new System.Drawing.Point(67, 6);
this.CMADir.Name = "CMADir";
this.CMADir.Size = new System.Drawing.Size(240, 20);
this.CMADir.TabIndex = 2;
this.CMADir.TextChanged += new System.EventHandler(this.CMADir_TextChanged);
//
// label2
//
this.label2.AutoSize = true;
this.label2.ForeColor = System.Drawing.Color.Chartreuse;
this.label2.Location = new System.Drawing.Point(373, 9);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(28, 13);
this.label2.TabIndex = 3;
this.label2.Text = "AID:";
//
// AIDSelector
//
this.AIDSelector.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.AIDSelector.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.AIDSelector.ForeColor = System.Drawing.Color.Lime;
this.AIDSelector.FormattingEnabled = true;
this.AIDSelector.Location = new System.Drawing.Point(407, 6);
this.AIDSelector.Name = "AIDSelector";
this.AIDSelector.Size = new System.Drawing.Size(222, 21);
this.AIDSelector.TabIndex = 4;
this.AIDSelector.Text = "0000000000000000";
this.AIDSelector.TextChanged += new System.EventHandler(this.AIDSelector_TextChanged);
//
// Browse
//
this.Browse.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.Browse.ForeColor = System.Drawing.Color.Chartreuse;
this.Browse.Location = new System.Drawing.Point(313, 6);
this.Browse.Name = "Browse";
this.Browse.Size = new System.Drawing.Size(54, 21);
this.Browse.TabIndex = 5;
this.Browse.Text = "Browse";
this.Browse.UseVisualStyleBackColor = true;
this.Browse.Click += new System.EventHandler(this.Browse_Click);
//
// GitRifAndVerKey
//
this.GitRifAndVerKey.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.GitRifAndVerKey.ForeColor = System.Drawing.Color.Red;
this.GitRifAndVerKey.Location = new System.Drawing.Point(12, 308);
this.GitRifAndVerKey.Name = "GitRifAndVerKey";
this.GitRifAndVerKey.Size = new System.Drawing.Size(617, 25);
this.GitRifAndVerKey.TabIndex = 6;
this.GitRifAndVerKey.Text = "GO GIT THE RIF AND VERSION KEY!!!!";
this.GitRifAndVerKey.UseVisualStyleBackColor = true;
this.GitRifAndVerKey.Click += new System.EventHandler(this.GitRifAndVerKey_Click);
//
// CHOVYCmaSelector
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Black;
this.ClientSize = new System.Drawing.Size(641, 341);
this.Controls.Add(this.GitRifAndVerKey);
this.Controls.Add(this.Browse);
this.Controls.Add(this.AIDSelector);
this.Controls.Add(this.label2);
this.Controls.Add(this.CMADir);
this.Controls.Add(this.label1);
this.Controls.Add(this.BackupList);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "CHOVYCmaSelector";
this.Text = "Chovy-Sign - Find Keys";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ListBox BackupList;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox CMADir;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox AIDSelector;
private System.Windows.Forms.Button Browse;
private System.Windows.Forms.Button GitRifAndVerKey;
}
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

View File

@ -1,136 +0,0 @@
/*using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CHOVY
{
class KIRK
{
public MemoryStream kirk_buf = new MemoryStream(); // 1DC0 1DD4
public unsafe struct MAC_KEY
{
public int type;
public byte[] key;
public byte[] pad;
//public fixed byte key[0xF];
//public fixed byte pad[0xF];
public int pad_size;
}
public static int sceDrmBBMacInit(MAC_KEY mkey, int type)
{
mkey.type = type;
mkey.pad_size = 0;
mkey.key = new byte[0xF];
mkey.pad = new byte[0xF];
return 0;
}
int sceDrmBBMacUpdate(MAC_KEY mkey, Stream buf, int size)
{
int retv = 0;
int ksize;
int p;
int type;
kirk_buf.SetLength(0x0814);
if (mkey.pad_size + size <= 16)
{
buf.Write(mkey.pad, 0x00, mkey.pad_size);
buf.Seek(mkey.pad_size / -1, SeekOrigin.Current);
mkey.pad_size += size;
retv = 0;
}
else
{
//kbuf = kirk_buf + 0x14;
kirk_buf.Seek(0x14, SeekOrigin.Begin);
// copy pad data first
kirk_buf.Write(mkey.pad, 0x0, mkey.pad_size);
kirk_buf.Seek(mkey.pad_size / -1, SeekOrigin.Current);
p = mkey.pad_size;
mkey.pad_size += size;
mkey.pad_size &= 0x0f;
if (mkey.pad_size == 0)
mkey.pad_size = 16;
size -= mkey.pad_size;
// save last data to pad buf
buf.Seek(size, SeekOrigin.Begin);
buf.Write(mkey.pad, 0x00, mkey.pad_size);
type = (mkey.type == 2) ? 0x3A : 0x38;
while (size >= 0)
{
ksize = (size + p >= 0x0800) ? 0x0800 : size + p;
kirk_buf.Seek(p,SeekOrigin.Current);
for(int i = 0; i < (ksize - p); i++)
{
byte by = (byte)buf.ReadByte();
kirk_buf.WriteByte(by);
}
retv = sub_158(kirk_buf, ksize, mkey.key, type);
if (retv)
goto _exit;
size -= (ksize - p);
buf.Seek(ksize - p,SeekOrigin.Current);
p = 0;
}
}
_exit:
return retv;
}
static int sub_158(byte[] buf, int size, byte[] key, int key_type)
{
int i, retv;
for (i = 0; i < 16; i++)
{
buf[0x14 + i] ^= key[i];
}
retv = kirk4(buf, size, key_type);
if (retv)
return retv;
// copy last 16 bytes to keys
for (i = 0; i < 16; i++)
{
key[i] = buf[i + size + 4];
}
return 0;
}
[DllImport("KIRK.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int kirk_init();
// [DllImport("KIRK.dll", CallingConvention = CallingConvention.Cdecl)]
// public unsafe static extern int sceDrmBBMacInit(MAC_KEY* mkey, int type);
[DllImport("KIRK.dll", CallingConvention = CallingConvention.Cdecl)]
public unsafe static extern int sceDrmBBMacUpdate(MAC_KEY* mkey, byte[] buf, int size);
[DllImport("KIRK.dll", CallingConvention = CallingConvention.Cdecl)]
public unsafe static extern int bbmac_getkey(MAC_KEY* mkey, byte[] bbmac, byte[] vkey);
}
}
*/

View File

@ -1,19 +0,0 @@
using System;
using System.Windows.Forms;
namespace CHOVY
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new CHOVY());
}
}
}

View File

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CHOVY")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CHOVY")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d46aa2c2-2bdc-45c7-aca5-d7a2295564e8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,26 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CHOVY.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.0.1.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BouncyCastle" version="1.8.5" targetFramework="net45" />
<package id="Discutils" version="0.11.0.2" targetFramework="net452" />
<package id="DotNetZip" version="1.13.4" targetFramework="net46" />
</packages>

View File

@ -1,569 +0,0 @@
/* Copyright (c) 2015 - 2018 TheDarkporgramer
*
* This was originally done by Jappi88 (Jappi88 at Gmail dot com) https://github.com/Jappi88
* All modifications have been TheDarkporgramer (save sfo ext ext ) https://github.com/xXxTheDarkprogramerxXx
*
* This(software Is provided) 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications*, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledge in the product documentation is required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source distribution.
*
* *Contact must be made to discuses permission and terms.
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Linq;
namespace Param_SFO
{
public class PARAM_SFO
{
#region << Enums >>
public enum DataTypes : uint
{
PSN_Game = 18248,
GameData = 0x4744,
SaveData = 0x5344,
AppPhoto = 0x4150,
AppMusic = 0x414D,
AppVideo = 0x4156,
BroadCastVideo = 0x4256,
AppleTV = 4154,
WebTV = 5754,
CellBE = 0x4342,
Home = 0x484D,
StoreFronted = 0x5346,
HDDGame = 0x4847,
DiscGame = 0x4447,
AutoInstallRoot = 0x4152,
DiscPackage = 0x4450,
ExtraRoot = 0x5852,
VideoRoot = 0x5652,
ThemeRoot = 0x5452,
DiscMovie = 0x444D,
Game_Digital_Application = 0x4081AC0,//GD
PS4_Game_Application_Patch = 28775,
Additional_Content = 25441,//PSvita PS4
GameContent = 25447,//PSVITA
Blu_Ray_Disc = 25698,//PS4
None
}
public enum FMT : ushort
{
UTF_8 = 0x0004,
ASCII = 0x0402,
Utf8Null = 0x0204,
UINT32 = 0x0404,
}
#endregion << Enums >>
#region << Vars>>
public List<Table> Tables { get; set; }
#endregion << Vars>>
#region << Example Of Calling Functions >>
//ypu can use this as SFO.Atribute
public string Attribute
{
get
{
if (Tables == null)
return "";
foreach (Table t in Tables)
{
if (t.Name == "ATTRIBUTE")
return t.Value;
}
return "";
}
}
public DataTypes DataType
{
get
{
if (Tables == null)
return DataTypes.None;
foreach (Table t in Tables)
if (t.Name == "CATEGORY")
return ((DataTypes)BitConverter.ToUInt16(Encoding.UTF8.GetBytes(t.Value), 0));
return DataTypes.None;
}
}
public string APP_VER
{
get
{
if (Tables == null)
return "";
foreach (Table t in Tables)
{
if (t.Name == "APP_VER")
return t.Value;
}
return "";
}
}
public string Detail
{
get
{
if (Tables == null)
return "";
foreach (Table t in Tables)
if (t.Name == "DETAIL")
return t.Value;
return "";
}
}
public string ContentID
{
get
{
if (Tables == null)
return "";
foreach (Table t in Tables)
if (t.Name == "CONTENT_ID")
return t.Value;
return "";
}
}
public string GetValue(string tagName)
{
foreach (Table t in Tables)
if (t.Name == tagName)
return t.Value;
return "";
}
public string TITLEID
{
get
{
if (Tables == null)
return "";
foreach (Table t in Tables)
if (t.Name == "TITLE_ID")
return t.Value;
return "";
}
}
public string TitleID
{
get
{
string name = TITLEID;
if (name == "")
return "";
return name.Split('-')[0];
}
}
public string Title
{
get
{
if (Tables == null)
return "";
foreach (Table t in Tables)
if (t.Name == "TITLE")
return t.Value;
return "";
}
}
public string Category
{
get
{
if (Tables == null)
return "";
foreach (Table t in Tables)
if (t.Name == "CATEGORY")
return t.Value;
return "";
}
}
public enum Playstation
{
ps3 = 0,
psvita = 1,
ps4 = 2,
psp = 3,
unknown = 4,//there will be a time i no longer support the scene this will be for ps5+ most probabbly
}
public Playstation PlaystationVersion
{
get
{
if (Tables == null)
return Playstation.unknown;
foreach (Table t in Tables)
{
if (t.Name == "PS3_SYSTEM_VER")
return Playstation.ps3;//this is the unique offset for ps3
if (t.Name == "PSP2_SYSTEM_VER")
{
return Playstation.psvita;//this is the only flag that tells us its a psvita
}
if (t.Name == "PSP_SYSTEM_VER")
{
return Playstation.psp;//this is how we know its a psp
}
if (t.Name == "SYSTEM_VER")//i believe this to be only ps4
{
return Playstation.ps4;
}
}
return Playstation.unknown;
}
}
#endregion << Example Of Calling Functions >>
#region Param.SFO Struct
public struct Header
{
public static byte[] Magic = { 0, 0x50, 0x53, 0x46 };
public static byte[] version = { 01, 01, 0, 0 };
public static uint KeyTableStart = 0;
public static uint DataTableStart = 0;
public static uint IndexTableEntries = 0;
private static byte[] Buffer
{
get
{
var header = new byte[20];
Array.Copy(Magic, 0, header, 0, 4);
Array.Copy(version, 0, header, 4, 4);
Array.Copy(BitConverter.GetBytes(KeyTableStart), 0, header, 8, 4);
Array.Copy(BitConverter.GetBytes(DataTableStart), 0, header, 12, 4);
Array.Copy(BitConverter.GetBytes(IndexTableEntries), 0, header, 16, 4);
return header;
}
}
public static void Read(BinaryReader input)
{
input.BaseStream.Seek(0, SeekOrigin.Begin);
input.Read(Magic, 0, 4);
input.Read(version, 0, 4);
KeyTableStart = input.ReadUInt32();
DataTableStart = input.ReadUInt32();
IndexTableEntries = input.ReadUInt32();
}
}
[Serializable]
public struct Table : IComparable
{
public index_table Indextable;
public string Name;
public string Value;
public int index;
public byte[] NameBuffer
{
get
{
var buffer = new byte[Name.Length + 1];
Array.Copy(Encoding.UTF8.GetBytes(Name), 0, buffer, 0, Encoding.UTF8.GetBytes(Name).Length);
return buffer;
}
}
public byte[] ValueBuffer
{
get
{
byte[] buffer;
switch (Indextable.param_data_fmt)
{
case FMT.ASCII:
buffer = new byte[Indextable.param_data_max_len];
Array.Copy(Encoding.ASCII.GetBytes(Value), 0, buffer, 0, Encoding.UTF8.GetBytes(Value).Length);
return buffer;
case FMT.UINT32:
return BitConverter.GetBytes(uint.Parse(Value));
case FMT.UTF_8:
buffer = new byte[Indextable.param_data_max_len];
Array.Copy(Encoding.UTF8.GetBytes(Value), 0, buffer, 0, Encoding.UTF8.GetBytes(Value).Length);
return buffer;
case FMT.Utf8Null:
buffer = new byte[Indextable.param_data_max_len];
Array.Copy(Encoding.UTF8.GetBytes(Value), 0, buffer, 0, Encoding.UTF8.GetBytes(Value).Length);/*write the length of the array*/
return buffer;
default:
return null;
}
}
}
public int CompareTo(object obj)
{
throw new NotImplementedException();
}
}
[Serializable]
public struct index_table
{
public FMT param_data_fmt; /* param_data data type */
public uint param_data_len; /* param_data used bytes */
public uint param_data_max_len; /* param_data total reserved bytes */
public uint param_data_offset; /* param_data offset (relative to start offset of data_table) */
public ushort param_key_offset; /* param_key offset (relative to start offset of key_table) */
private byte[] Buffer
{
get
{
var data = new byte[16];
Array.Copy(BitConverter.GetBytes(param_key_offset), 0, data, 0, 2);
Array.Copy(BitConverter.GetBytes(((ushort)param_data_fmt)), 0, data, 2, 2);
Array.Copy(BitConverter.GetBytes(param_data_len), 0, data, 4, 4);
Array.Copy(BitConverter.GetBytes(param_data_max_len), 0, data, 8, 4);
Array.Copy(BitConverter.GetBytes(param_data_offset), 0, data, 12, 4);
return data;
}
}
public void Read(BinaryReader input)
{
param_key_offset = input.ReadUInt16();
param_data_fmt = (FMT)input.ReadUInt16();
param_data_len = input.ReadUInt32();
param_data_max_len = input.ReadUInt32();
param_data_offset = input.ReadUInt32();
}
}
[Serializable]
private enum DATA_TYPE : byte
{
BinaryData = 0,
Utf8Text = 2,
Si32Integer = 4
}
#endregion Param.SFO Struct
#region << Methods >>
public PARAM_SFO()
{
}
public PARAM_SFO(string filepath)
{
Init(new FileStream(filepath, FileMode.Open, FileAccess.Read, FileShare.Read));
}
public PARAM_SFO(byte[] inputdata)
{
Init(new MemoryStream(inputdata));
}
public PARAM_SFO(Stream input)
{
Init(input);
}
/// <summary>
/// This is the SaveSFO Function for PS3/PS4/PSVita/And PSP no longer needed for Sony's CMD
/// </summary>
/// <param name="psfo">SFO That has been opened</param>
/// <param name="filename">Save Location</param>
public void SaveSFO(PARAM_SFO psfo, string filename)
{
//we start by opening the stream to the file
using (var stream = File.Open(filename, FileMode.Create, FileAccess.Write, FileShare.Read))
{
if (!stream.CanSeek)
throw new ArgumentException("Stream must be seekable");//throw this error we cant seek the stream
var utf8 = new UTF8Encoding(false);//encoding
using (var writer = new BinaryWriter(stream, utf8))//start binary reader
{
#region << Header Info (DevWiki) >>
/*
Header
* 0x00 0x04 magic PSF
0x04 0x04 version 01 01 00 00 1.01
0x08 0x04 key_table_start 24 00 00 00 Absolute start offset of key_table = 0x24
0x0C 0x04 data_table_start 30 00 00 00 Absolute start offset of data_table = 0x30
0x10 0x04 tables_entries 01 00 00 00 Number of entries in index_table, key_table, and data_table = 1
*/
#endregion <<Header Info >>
//so lets start writing the info
writer.Write(Header.Magic);//write magic "\0PSF"
writer.Write(Header.version);//write version info this is mayjor and minor (01 01 00 00 1.01)
Header.KeyTableStart = 0x14 + Header.IndexTableEntries * 0x10;/*we can write all this lovely info from the tables back*/
writer.Write(Header.KeyTableStart);
Header.DataTableStart = Convert.ToUInt32(Header.KeyTableStart + Tables.Sum(i => i.Name.Length + 1));//needs to be Uint
if (Header.DataTableStart % 4 != 0)
Header.DataTableStart = (Header.DataTableStart / 4 + 1) * 4;
writer.Write(Header.DataTableStart);
Header.IndexTableEntries = Convert.ToUInt32(Tables.Count);
writer.Write(Header.IndexTableEntries);
int lastKeyOffset = Convert.ToInt32(Header.KeyTableStart);
int lastValueOffset = Convert.ToInt32(Header.DataTableStart);
for (var i = 0; i < Tables.Count; i++)
{
var entry = Tables[i];
writer.BaseStream.Seek(0x14 + i * 0x10, SeekOrigin.Begin);
writer.Write((ushort)(lastKeyOffset - Header.KeyTableStart));
writer.Write((ushort)entry.Indextable.param_data_fmt);
writer.Write(entry.Indextable.param_data_len);
writer.Write(entry.Indextable.param_data_max_len);
writer.Write(lastValueOffset - Header.DataTableStart);
writer.BaseStream.Seek(lastKeyOffset, SeekOrigin.Begin);
writer.Write(utf8.GetBytes(entry.Name));
writer.Write((byte)0);
lastKeyOffset = (int)writer.BaseStream.Position;
writer.BaseStream.Seek(lastValueOffset, SeekOrigin.Begin);
writer.Write(entry.ValueBuffer);
lastValueOffset = (int)writer.BaseStream.Position;
}
//I'm doing this to just rewrite the first item (Some Cleanup will be needed)
//Or maybe not as when I checked this gives a 1 - 1 match with how the Sony tool works
//we need to rewrite that first item (PS4/PS3/PSV should be APP-VER)
lastKeyOffset = Convert.ToInt32(Header.KeyTableStart);
lastValueOffset = Convert.ToInt32(Header.DataTableStart);
var tableentry = Tables[0];
writer.BaseStream.Seek(lastKeyOffset, SeekOrigin.Begin);
writer.Write(utf8.GetBytes(tableentry.Name));
writer.Write((byte)0);
lastKeyOffset = (int)writer.BaseStream.Position;
}
}
}
private string ReadValue(BinaryReader br, index_table table)
{
br.BaseStream.Position = ((Header.DataTableStart) + table.param_data_offset);
switch (table.param_data_fmt)
{
case FMT.ASCII:
//return Encoding.GetEncoding(1252).GetString(br.ReadBytes((int) table.param_data_max_len)).Replace("\0", "");
return Encoding.UTF8.GetString(br.ReadBytes((int)table.param_data_max_len)).Replace("\0", "");
case FMT.UINT32:
return br.ReadUInt32().ToString();
case FMT.UTF_8:
return Encoding.UTF8.GetString(br.ReadBytes((int)table.param_data_max_len)).Replace("\0", "");
case FMT.Utf8Null:
return Encoding.UTF8.GetString(br.ReadBytes((int)table.param_data_max_len)).Replace("\0", "");
default:
return null;
}
}
private string ReadValueSpecialChars(BinaryReader br, index_table table)
{
br.BaseStream.Position = ((Header.DataTableStart) + table.param_data_offset);
switch (table.param_data_fmt)
{
case FMT.ASCII:
return Encoding.UTF8.GetString(br.ReadBytes((int)table.param_data_max_len)).Replace("\0", "");
case FMT.UINT32:
return br.ReadUInt32().ToString();
case FMT.UTF_8:
return Encoding.UTF8.GetString(br.ReadBytes((int)table.param_data_max_len)).Replace("\0", "");
default:
return null;
}
}
private string ReadName(BinaryReader br, index_table table)
{
br.BaseStream.Position = (Header.KeyTableStart + table.param_key_offset);
string name = "";
while (((byte)br.PeekChar()) != 0)
name += br.ReadChar();
br.BaseStream.Position++;
return name;
}
/// <summary>
/// Start Reading the Parameter file
/// </summary>
/// <param name="input">Input Stream</param>
private void Init(Stream input)
{
using (var br = new BinaryReader(input))
{
Header.Read(br);
var tables = new List<index_table>();
for (int i = 0; i < Header.IndexTableEntries; i++)
{
var t = new index_table();
t.Read(br);
tables.Add(t);
}
var xtables = new List<Table>();
int count = 0;
foreach (index_table t in tables)
{
var x = new Table();
x.index = count;
x.Indextable = t;
x.Name = ReadName(br, t);
x.Value = ReadValue(br, t);
count++;
xtables.Add(x);
}
Tables = xtables;
br.Close();
}
}
#endregion << Methods >>
}
}

View File

@ -1,111 +0,0 @@
using PSVIMGTOOLS;
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
namespace CHOVY
{
class pbp
{
unsafe struct MAC_KEY
{
int type;
fixed byte key[0xF];
fixed byte pad[0xF];
int pad_size;
}
[DllImport("KIRK.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern int kirk_init();
[DllImport("KIRK.dll", CallingConvention = CallingConvention.Cdecl)]
private unsafe static extern int sceDrmBBMacInit(MAC_KEY *mkey, int type);
[DllImport("KIRK.dll", CallingConvention = CallingConvention.Cdecl)]
private unsafe static extern int sceDrmBBMacUpdate(MAC_KEY *mkey, byte[] buf, int size);
[DllImport("KIRK.dll", CallingConvention = CallingConvention.Cdecl)]
private unsafe static extern int bbmac_getkey(MAC_KEY *mkey, byte[] bbmac, byte[] vkey);
[DllImport("CHOVY.dll", CallingConvention = CallingConvention.Cdecl)]
private unsafe static extern int chovy_gen(string ebootpbp, UInt64 AID, string outscefile);
public static Process GenPbpFromIso(string ISOPath, string OutputPBP, string ContentId, string VersionKey, bool compress, string bootup="")
{
string SignNpArgs = "-pbp ";
if(compress)
{
SignNpArgs += "-c ";
}
SignNpArgs += "\"" + ISOPath + "\" ";
SignNpArgs += "\"" + OutputPBP + "\" ";
SignNpArgs += ContentId+" ";
SignNpArgs += VersionKey;
if(bootup != "")
{
SignNpArgs += " \"" + bootup + "\" ";
}
Process signnp = new Process();
signnp.StartInfo.FileName = Path.Combine(Application.StartupPath, "tools", "sign_np.exe");
signnp.StartInfo.Arguments = SignNpArgs;
signnp.StartInfo.CreateNoWindow = true;
signnp.StartInfo.UseShellExecute = false;
signnp.StartInfo.RedirectStandardOutput = true;
signnp.StartInfo.RedirectStandardError = true;
signnp.Start();
return signnp;
}
private static UInt32 readUInt32(Stream src)
{
byte[] intBuf = new byte[0x4];
src.Read(intBuf, 0x00, 0x04);
return BitConverter.ToUInt32(intBuf, 0);
}
public unsafe static byte[] GetVersionKey(Stream pbp)
{
MAC_KEY mkey;
kirk_init();
pbp.Seek(0x24,SeekOrigin.Begin);
Int64 NPUMDIMGOffest = Convert.ToInt64(readUInt32(pbp));
pbp.Seek(NPUMDIMGOffest, SeekOrigin.Begin);
byte[] NP_HEADER = new byte[0x0100];
pbp.Read(NP_HEADER, 0x00, 0x0100);
byte[] VER_KEY_ENC = new byte[0x40];
pbp.Seek(NPUMDIMGOffest+0xC0, SeekOrigin.Begin);
pbp.Read(VER_KEY_ENC, 0x00, 0x40);
byte[] VERSION_KEY = new byte[16];
sceDrmBBMacInit(&mkey, 3);
sceDrmBBMacUpdate(&mkey, NP_HEADER, 0xc0);
bbmac_getkey(&mkey, VER_KEY_ENC, VERSION_KEY);
pbp.Close();
return VERSION_KEY;
}
public static int gen__sce_ebootpbp(string EbootFile, UInt64 AID, string OutSceebootpbpFile)
{
return chovy_gen(EbootFile, AID, OutSceebootpbpFile);
}
public static string GetContentId(Stream pbp)
{
pbp.Seek(0x24, SeekOrigin.Begin);
Int64 NPUMDIMGOffest = Convert.ToInt64(readUInt32(pbp));
pbp.Seek(NPUMDIMGOffest+0x10, SeekOrigin.Begin);
byte[] ContentId = new byte[0x24];
pbp.Read(ContentId, 0x00, 0x24);
pbp.Close();
return Encoding.UTF8.GetString(ContentId);
}
}
}

View File

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>ChovySign_CLI</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\GameBuilder\GameBuilder.csproj" />
<ProjectReference Include="..\LibChovy\LibChovy.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_LastSelectedProfileId>C:\Users\Li\Desktop\git\chovy-sign\ChovySign-CLI\Properties\PublishProfiles\Linux64.pubxml</_LastSelectedProfileId>
</PropertyGroup>
</Project>

423
ChovySign-CLI/Program.cs Normal file
View File

@ -0,0 +1,423 @@
using Li.Progress;
using GameBuilder.Pops;
using GameBuilder.Psp;
using LibChovy;
using LibChovy.VersionKey;
using System.Text;
using Vita.ContentManager;
using PspCrypto;
using System.ComponentModel;
namespace ChovySign_CLI
{
internal class Program
{
private static ArgumentParsingMode mode = ArgumentParsingMode.ARG;
private static List<string> parameters = new List<string>();
private static string[] discs = new string[] { };
private static bool pspCompress = false;
private static string? popsDiscName;
private static byte[]? popsIcon0File;
private static byte[]? popsPic0File;
private static PbpMode? pbpMode = null;
private static NpDrmRif? rifFile = null;
private static NpDrmInfo? drmInfo = null;
// cma
private static bool devKit = false;
private static bool packagePsvImg = true;
private static string? outputFolder = null;
// --vkey-gen
private static byte[]? actDat = null;
private static byte[]? idps = null;
private static string? rifFolder = null;
// --pops-eboot-sign
private static byte[]? ebootElf = null;
private static byte[]? configBin = null;
enum PbpMode
{
PSP = 0,
POPS = 1,
PCENGINE = 2,
NEOGEO = 3
}
enum ArgumentParsingMode
{
ARG,
POPS_DISC,
PSP_UMD,
VERSIONKEY,
VERSIONKEY_EXTRACT,
VERSIONKEY_GENERATOR,
CMA_DEVKIT,
CMA_OUTPUT_FOLDER,
CMA_PACKAGE_PSVIMG,
POPS_INFO,
POPS_EBOOT,
KEYS_TXT_GEN,
RIF
}
public static int Error(string errorMsg, int ret)
{
Console.Error.WriteLine("ERROR: "+errorMsg);
return ret;
}
public static byte[] StringToByteArray(string hex)
{
return Enumerable.Range(0, hex.Length).Where(x => x % 2 == 0).Select(x => Convert.ToByte(hex.Substring(x, 2), 16)).ToArray();
}
private static void onProgress(ProgressInfo info)
{
string msg = info.CurrentProcess + " " + info.ProgressInt.ToString() + "% (" + info.Done + "/" + info.Remain + ")";
int spaceLen = (Console.WindowWidth - msg.Length) - 2;
string emptySpace = " ";
for (int i = 0; i < spaceLen; i++)
emptySpace += " ";
Console.Write(msg + emptySpace + "\r");
}
private static void generateKeysTxt()
{
if (rifFolder is null || actDat is null || idps is null) return;
UInt64 accountId = BitConverter.ToUInt64(actDat, 0x8);
if (File.Exists("KEYS.TXT"))
KeysTxtMethod.KeysTxt = File.ReadAllText("KEYS.TXT");
else
File.WriteAllText("KEYS.TXT", KeysTxtMethod.KeysTxt);
HashSet<string> knownKeys = new HashSet<string>();
foreach (string contentId in KeysTxtMethod.ContentIds)
knownKeys.Add(contentId);
StringBuilder addKeys = new StringBuilder();
foreach (string rifFile in Directory.GetFiles(rifFolder, "*.rif"))
{
NpDrmRif rif = new NpDrmRif(File.ReadAllBytes(rifFile));
if (knownKeys.Contains(rif.ContentId)) continue;
if(rif.AccountId != accountId) { Error(rif.ContentId + " account id does not match: " + accountId.ToString("X") + " (was " + rif.AccountId.ToString("X") + ")", 10); continue; }
string[] keys = new string[4];
for (int i = 0; i < keys.Length; i++)
keys[i] = BitConverter.ToString(ActRifMethod.GetVersionKey(actDat, rif.Rif, idps, i).VersionKey).Replace("-", "");
string[] keysTxtLine = new string[] { rif.ContentId, keys[0], keys[1], keys[2], keys[3] };
string keysTxt = String.Join(' ', keysTxtLine);
addKeys.AppendLine(keysTxt);
//Console.WriteLine(keysTxt);
}
File.AppendAllText("KEYS.TXT", addKeys.ToString());
}
private static int complete()
{
switch (mode)
{
case ArgumentParsingMode.POPS_DISC:
if (parameters.Count > 5) return Error("--pops: no more than 5 disc images allowed in a single game (sony's rules, not mine)", 4);
if (parameters.Count < 1) return Error("--pops: at least 1 disc image file is required.", 4);
discs = parameters.ToArray();
break;
case ArgumentParsingMode.PSP_UMD:
if (parameters.Count < 1) return Error("--psp: a path to a disc image is required", 4);
if (parameters.Count > 2) return Error("--psp: no more than 2 arguments. ("+parameters.Count+" given)", 4);
discs = new string[1];
discs[0] = parameters[0];
if (parameters.Count > 1)
pspCompress = parameters[1].ToLowerInvariant() == "true";
else
pspCompress = false;
break;
case ArgumentParsingMode.VERSIONKEY:
if (parameters.Count != 3) return Error("--vkey: expect 3 arguments. ("+parameters.Count+" given)", 4);
drmInfo = new NpDrmInfo(StringToByteArray(parameters[0]), parameters[1], int.Parse(parameters[2]));
break;
case ArgumentParsingMode.VERSIONKEY_EXTRACT:
if (parameters.Count != 2) return Error("--vkey-extract: expect 2 arguments. ("+parameters.Count+" given)", 4);
drmInfo = EbootPbpMethod.GetVersionKey(File.OpenRead(parameters[0]), int.Parse(parameters[1]));
break;
case ArgumentParsingMode.VERSIONKEY_GENERATOR:
if(parameters.Count != 4) return Error("--vkey-gen: expect 4 arguments. ("+parameters.Count+" given)", 4);
drmInfo = ActRifMethod.GetVersionKey(File.ReadAllBytes(parameters[0]), File.ReadAllBytes(parameters[1]), StringToByteArray(parameters[2]), int.Parse(parameters[3]));
break;
case ArgumentParsingMode.POPS_INFO:
if (parameters.Count < 2) return Error("--pops-info takes at least 1 arguments ("+parameters.Count+" given)", 4);
if (parameters.Count > 3) return Error("--pops-info takes no more than 3 arguments("+parameters.Count+" given)", 4);
popsDiscName = parameters[0];
if (parameters.Count > 1 && File.Exists(parameters[1]))
popsIcon0File = File.ReadAllBytes(parameters[1]);
if (parameters.Count > 2 && File.Exists(parameters[2]))
popsPic0File = File.ReadAllBytes(parameters[2]);
break;
case ArgumentParsingMode.KEYS_TXT_GEN:
if (parameters.Count != 3) return Error("--keys-txt-gen takes 3 arguments, (" + parameters.Count + " given)", 4);
actDat = File.ReadAllBytes(parameters[0]);
idps = StringToByteArray(parameters[1]);
rifFolder = parameters[2];
break;
case ArgumentParsingMode.POPS_EBOOT:
if (parameters.Count < 1) return Error("--pops-eboot-sign expects at most 1 arguments", 4);
if (!File.Exists(parameters[0])) return Error("--pops-eboot-sign: file not found", 4);
ebootElf = File.ReadAllBytes(parameters[0]);
if (parameters.Count >= 2 && File.Exists(parameters[1]))
configBin = File.ReadAllBytes(parameters[1]);
else
configBin = GameBuilder.Resources.DATAPSPSDCFG;
break;
case ArgumentParsingMode.CMA_OUTPUT_FOLDER:
if (parameters.Count < 1) return Error("--output-folder expects 1 output", 4);
if (!Directory.Exists(parameters[0])) return Error("--output-folder: directory not found", 4);
SettingsReader.BackupsFolder = parameters[0];
break;
case ArgumentParsingMode.RIF:
if (parameters.Count != 1) return Error("--rif expects only 1 argument,", 4);
rifFile = new NpDrmRif(File.ReadAllBytes(parameters[0]));
break;
}
mode = ArgumentParsingMode.ARG;
parameters.Clear();
return 0;
}
/*
public static void generateRif(byte[] idps, byte[] actBuf, byte[] versionKey, int versionKeyType, ulong accountId, string contentId)
{
byte[] vkey2 = new byte[versionKey.Length];
Array.Copy(versionKey, vkey2, versionKey.Length);
byte[] rkey = Rng.RandomBytes(0x10);
int keyId = 0x10; // (Int32)(Rng.RandomUInt() % 0x80);
Array.ConstrainedCopy(BitConverter.GetBytes(keyId).Reverse().ToArray(), 0, rkey, 0xC, 0x4);
byte[] encKey1 = new byte[0x10];
AesHelper.AesEncrypt(rkey, encKey1, KeyVault.drmRifKey);
// get the act key
byte[] actKey = new byte[0x10];
SceNpDrm.SetPSID(idps);
SceNpDrm.Aid = accountId;
Act act = MemoryMarshal.AsRef<Act>(actBuf);
GetActKey(actKey, act.PrimKeyTable[(keyId * 0x10)..], 1);
// reverse version key back to main version key
sceNpDrmTransformVersionKey(vkey2, versionKeyType, 0);
byte[] encKey2 = new byte[0x10];
AesHelper.AesEncrypt(vkey2, encKey2, actKey);
using (MemoryStream rifStream = new MemoryStream())
{
StreamUtil rifUtil = new StreamUtil(rifStream);
rifUtil.WriteInt16(0x0);
rifUtil.WriteInt16(0x1);
rifUtil.WriteInt32(0x2);
rifUtil.WriteUInt64(accountId);
rifUtil.WriteStrWithPadding(contentId, 0x00, 0x30);
rifUtil.WriteBytes(encKey1); // enckey1
rifUtil.WriteBytes(encKey2); // enckey2
rifUtil.WriteUInt64(SceRtc.ksceRtcGetCurrentSecureTick());
rifUtil.WriteUInt64(0x00); // expiry
rifUtil.WritePadding(0xFF, 0x28);
}
}
*/
public static int Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("Chovy-Sign v2 (CLI)");
Console.WriteLine("--pops [disc1.cue] [disc2.cue] [disc3.cue] ... (up to 5)");
Console.WriteLine("--pops-info [game title] [icon0.png] (optional) [pic1.png] (optional)");
Console.WriteLine("--pops-eboot [eboot.elf] [config.bin] (optional)");
Console.WriteLine("--psp [umd.iso] [compress; true/false] (optional)");
Console.WriteLine("--rif [GAME.RIF]");
Console.WriteLine("--devkit (Use 000000000000 account id)");
Console.WriteLine("--no-psvimg (Disable creating a .psvimg file)");
Console.WriteLine("--output-folder [output_folder]");
Console.WriteLine("--vkey [versionkey] [contentid] [key_index]");
Console.WriteLine("--vkey-extract [eboot.pbp] [key_index]");
Console.WriteLine("--vkey-gen [act.dat] [license.rif] [console_id] [key_index]");
Console.WriteLine("--keys-txt-gen [act.dat] [console_id] [psp_license_folder]");
}
foreach (string arg in args)
{
if (arg.StartsWith("--")) { int ret = complete(); if (ret != 0) return ret; }
switch (mode)
{
case ArgumentParsingMode.ARG:
switch (arg)
{
case "--pops":
mode = ArgumentParsingMode.POPS_DISC;
if (pbpMode is not null)
return Error("pbpMode is already set to: " + pbpMode.ToString() + " cannot do that *and* POPS", 2);
pbpMode = PbpMode.POPS;
break;
case "--pops-info":
mode = ArgumentParsingMode.POPS_INFO;
break;
case "--psp":
mode = ArgumentParsingMode.PSP_UMD;
if (pbpMode is not null)
return Error("pbpMode is already set to: " + pbpMode.ToString() + " cannot do that *and* PSP", 2);
pbpMode = PbpMode.PSP;
break;
case "--vkey":
mode = ArgumentParsingMode.VERSIONKEY;
if (drmInfo is not null)
return Error("versionkey is already set", 3);
break;
case "--vkey-extract":
mode = ArgumentParsingMode.VERSIONKEY_EXTRACT;
if (drmInfo is not null)
return Error("versionkey is already set", 3);
break;
case "--vkey-gen":
mode = ArgumentParsingMode.VERSIONKEY_GENERATOR;
if (drmInfo is not null)
return Error("versionkey is already set", 3);
break;
case "--keys-txt-gen":
mode = ArgumentParsingMode.KEYS_TXT_GEN;
if (rifFolder is not null)
return Error("rif folder already set", 3);
break;
case "--rif":
mode = ArgumentParsingMode.RIF;
if (rifFile is not null)
return Error("rif is already set", 3);
break;
case "--pops-eboot":
mode = ArgumentParsingMode.POPS_EBOOT;
break;
case "--output-folder":
mode = ArgumentParsingMode.CMA_OUTPUT_FOLDER;
break;
case "--no-psvimg":
packagePsvImg = false;
break;
case "--devkit":
devKit = true;
break;
default:
return Error("Unknown argument: " + arg, 1);
}
break;
case ArgumentParsingMode.VERSIONKEY:
case ArgumentParsingMode.VERSIONKEY_GENERATOR:
case ArgumentParsingMode.VERSIONKEY_EXTRACT:
case ArgumentParsingMode.PSP_UMD:
case ArgumentParsingMode.POPS_DISC:
case ArgumentParsingMode.POPS_EBOOT:
case ArgumentParsingMode.POPS_INFO:
case ArgumentParsingMode.RIF:
default:
parameters.Add(arg);
break;
}
}
int res = complete();
if(res != 0) return res;
generateKeysTxt();
if (drmInfo is null) return Error("no versionkey was found, exiting", 6);
if (pbpMode is null) return Error("no pbp mode was set, exiting", 7);
int targetKeyIndex = (pbpMode == PbpMode.PSP) ? 2 : 1;
if (drmInfo.KeyIndex != targetKeyIndex)
{
SceNpDrm.sceNpDrmTransformVersionKey(drmInfo.VersionKey, drmInfo.KeyIndex, 2);
drmInfo.KeyIndex = targetKeyIndex;
}
if (rifFile is null) return Error("Rif is not set, use --rif to specify base game RIF", 8);
ChovySign csign = new ChovySign();
csign.RegisterCallback(onProgress);
if (pbpMode == PbpMode.POPS)
{
PopsParameters popsParameters = new PopsParameters(drmInfo, rifFile);
foreach (string disc in discs)
popsParameters.AddCd(disc);
if(popsDiscName is not null)
popsParameters.Name = popsDiscName;
if(popsIcon0File is not null)
popsParameters.Icon0 = popsIcon0File;
popsParameters.CreatePsvImg = packagePsvImg;
popsParameters.Account.Devkit = devKit;
// Allow for custom eboot.elf and configs
popsParameters.ConfigBinOverride = configBin;
popsParameters.EbootElfOverride = ebootElf;
csign.Go(popsParameters);
}
else if(pbpMode == PbpMode.PSP)
{
PspParameters pspParameters = new PspParameters(drmInfo, rifFile);
pspParameters.Account.Devkit = devKit;
pspParameters.CreatePsvImg = packagePsvImg;
pspParameters.Compress = pspCompress;
pspParameters.Umd = new UmdInfo(discs.First());
csign.Go(pspParameters);
}
return 0;
}
}
}

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>bin\Release\Linux</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>true</PublishSingleFile>
<PublishReadyToRun>true</PublishReadyToRun>
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>bin\Release\Windows</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>true</PublishSingleFile>
<PublishReadyToRun>true</PublishReadyToRun>
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup>
</Project>

454
ChovySign-GUI/.gitignore vendored Normal file
View File

@ -0,0 +1,454 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# Tye
.tye/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
##
## Visual studio for Mac
##
# globs
Makefile.in
*.userprefs
*.usertasks
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.tar.gz
tarballs/
test-results/
# Mac bundle stuff
*.dmg
*.app
# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# JetBrains Rider
.idea/
*.sln.iml
##
## Visual Studio Code
##
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

337
ChovySign-GUI/App.axaml Normal file
View File

@ -0,0 +1,337 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ChovySign_GUI.App"
RequestedThemeVariant="Dark">
<Application.Styles>
<FluentTheme/>
<!-- Checkbox Styling -->
<!-- checked -->
<Style Selector="CheckBox:checked">
<Setter Property="BorderBrush" Value="LightGreen" />
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="LightGreen" />
</Style>
<Style Selector="^ /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="LightGreen" />
<Setter Property="Background" Value="#3f3f3f" />
</Style>
</Style>
<!-- unchecked -->
<Style Selector="CheckBox:unchecked">
<Setter Property="BorderBrush" Value="LightGreen" />
<Setter Property="Foreground" Value="LightGreen" />
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="LightGreen" />
</Style>
<Style Selector="^ /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="LightGreen" />
<Setter Property="Background" Value="#3f3f3f" />
</Style>
</Style>
<!-- pointerover -->
<Style Selector="CheckBox:pointerover">
<Setter Property="BorderBrush" Value="Green" />
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="Green" />
</Style>
<Style Selector="^ /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="Green" />
<Setter Property="Background" Value="#1f1f1f" />
</Style>
</Style>
<!-- Button styles -->
<!-- disabled -->
<Style Selector="Button:disabled">
<Style Selector="^:disabled /template/ ContentPresenter">
<Setter Property="Background" Value="Black" />
<Setter Property="BorderBrush" Value="DarkRed" />
<Setter Property="Foreground" Value="DarkRed" />
</Style>
</Style>
<!-- pointerover -->
<Style Selector="Button:pointerover">
<Style Selector="^:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="Red" />
<Setter Property="BorderBrush" Value="DarkRed" />
<Setter Property="Foreground" Value="Black" />
</Style>
</Style>
<!-- regular -->
<Style Selector="Button">
<Setter Property="Background" Value="Black" />
<Setter Property="BorderBrush" Value="Red" />
<Setter Property="Foreground" Value="Red" />
<Setter Property="BorderThickness" Value="1" />
</Style>
<!-- Textbox Styling -->
<Style Selector="TextBox:focus">
<Setter Property="Foreground" Value="LightGreen" />
<Style Selector="^ /template/ TextBlock">
<Setter Property="Foreground" Value="LightGreen" />
</Style>
<Style Selector="^ /template/ Border">
<Setter Property="Background" Value="#3f3f3f" />
<Setter Property="BorderBrush" Value="LightGreen" />
</Style>
</Style>
<Style Selector="TextBox:pointerover">
<Setter Property="Foreground" Value="Green" />
<Style Selector="^ /template/ TextBlock">
<Setter Property="Foreground" Value="Green" />
</Style>
<Style Selector="^ /template/ Border">
<Setter Property="Background" Value="#1f1f1f" />
<Setter Property="BorderBrush" Value="Green" />
</Style>
</Style>
<Style Selector="TextBox">
<Setter Property="Foreground" Value="LightGreen" />
<Setter Property="Background" Value="#3f3f3f" />
<Setter Property="BorderBrush" Value="LightGreen" />
</Style>
<!-- ComboBox -->
<Style Selector="ComboBox">
<Setter Property="Foreground">
<Setter.Value>LightGreen</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>#3f3f3f</Setter.Value>
</Setter>
<Setter Property="BorderBrush">
<Setter.Value>LightGreen</Setter.Value>
</Setter>
<Setter Property="BorderThickness">
<Setter.Value>1</Setter.Value>
</Setter>
</Style>
<Style Selector="ComboBox:pointerover">
<Setter Property="Foreground">
<Setter.Value>Green</Setter.Value>
</Setter>
</Style>
<Style Selector="ComboBox:pointerover /template/ TextBlock">
<Setter Property="Foreground">
<Setter.Value>Green</Setter.Value>
</Setter>
</Style>
<Style Selector="ComboBox:pointerover /template/ Border">
<Setter Property="Background">
<Setter.Value>#1f1f1f</Setter.Value>
</Setter>
<Setter Property="BorderBrush">
<Setter.Value>Green</Setter.Value>
</Setter>
</Style>
<Style Selector="ComboBoxItem:pointerover /template/ ContentPresenter">
<Setter Property="TextBlock.Foreground">
<Setter.Value>Green</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>#1f1f1f</Setter.Value>
</Setter>
</Style>
<Style Selector="ComboBoxItem:selected /template/ ContentPresenter">
<Setter Property="TextBlock.Foreground">
<Setter.Value>Black</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>LightGreen</Setter.Value>
</Setter>
</Style>
<Style Selector="ComboBoxItem:selected:pointerover /template/ ContentPresenter">
<Setter Property="TextBlock.Foreground">
<Setter.Value>Black</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>Green</Setter.Value>
</Setter>
</Style>
<Style Selector="ComboBoxItem">
<Setter Property="Foreground">
<Setter.Value>LightGreen</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>#3f3f3f</Setter.Value>
</Setter>
<Setter Property="BorderBrush">
<Setter.Value>LightGreen</Setter.Value>
</Setter>
<Setter Property="BorderThickness">
<Setter.Value>1</Setter.Value>
</Setter>
</Style>
<!-- ListBox -->
<Style Selector="ListBoxItem:pointerover /template/ ContentPresenter">
<Setter Property="TextBlock.Foreground">
<Setter.Value>Green</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>#1f1f1f</Setter.Value>
</Setter>
</Style>
<Style Selector="ListBoxItem:selected /template/ ContentPresenter">
<Setter Property="TextBlock.Foreground">
<Setter.Value>Black</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>LightGreen</Setter.Value>
</Setter>
</Style>
<Style Selector="ListBoxItem:selected:pointerover /template/ ContentPresenter">
<Setter Property="TextBlock.Foreground">
<Setter.Value>Black</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>Green</Setter.Value>
</Setter>
</Style>
<Style Selector="ListBoxItem">
<Setter Property="Foreground">
<Setter.Value>LightGreen</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>#3f3f3f</Setter.Value>
</Setter>
<Setter Property="BorderBrush">
<Setter.Value>LightGreen</Setter.Value>
</Setter>
<Setter Property="BorderThickness">
<Setter.Value>1</Setter.Value>
</Setter>
</Style>
<Style Selector="ListBox">
<Setter Property="Foreground">
<Setter.Value>LightGreen</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>#3f3f3f</Setter.Value>
</Setter>
<Setter Property="BorderBrush">
<Setter.Value>LightGreen</Setter.Value>
</Setter>
<Setter Property="BorderThickness">
<Setter.Value>1</Setter.Value>
</Setter>
</Style>
<!-- TabControl -->
<Style Selector="TabControl">
<Setter Property="Background">
<Setter.Value>Black</Setter.Value>
</Setter>
</Style>
<Style Selector="TabItem:pointerover /template/ Border">
<Setter Property="Background">
<Setter.Value>LightGreen</Setter.Value>
</Setter>
</Style>
<Style Selector="TabItem:selected">
<Setter Property="Foreground">
<Setter.Value>LightGreen</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>Green</Setter.Value>
</Setter>
</Style>
<Style Selector="TabItem">
<Setter Property="Foreground">
<Setter.Value>LightGreen</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>DarkGreen</Setter.Value>
</Setter>
</Style>
<!-- other -->
<Style Selector="ProgressBar">
<Setter Property="Foreground">
<Setter.Value>LightGreen</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>#3f3f3f</Setter.Value>
</Setter>
<Setter Property="BorderBrush">
<Setter.Value>LightGreen</Setter.Value>
</Setter>
<Setter Property="BorderThickness">
<Setter.Value>1</Setter.Value>
</Setter>
</Style>
<Style Selector="Label">
<Setter Property="Foreground">
<Setter.Value>LightGreen</Setter.Value>
</Setter>
</Style>
<Style Selector="Border">
<Setter Property="BorderBrush">
<Setter.Value>LightGreen</Setter.Value>
</Setter>
<Setter Property="BorderThickness">
<Setter.Value>1</Setter.Value>
</Setter>
</Style>
<Style Selector="Window">
<Setter Property="Background">
<Setter.Value>Black</Setter.Value>
</Setter>
<Setter Property="BorderBrush">
<Setter.Value>Black</Setter.Value>
</Setter>
</Style>
</Application.Styles>
</Application>

View File

@ -0,0 +1,38 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using System;
using System.Media;
using System.Threading.Tasks;
namespace ChovySign_GUI
{
public partial class App : Application
{
public static async Task PlayFinishSound()
{
if (!OperatingSystem.IsWindows()) return;
await Task.Run(() =>
{
using (SoundPlayer player = new SoundPlayer(Resource.FINISHSND))
{
player.Play();
}
});
}
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = new MainWindow();
}
base.OnFrameworkInitializationCompleted();
}
}
}

View File

@ -0,0 +1,74 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationManifest>app.manifest</ApplicationManifest>
<RootNamespace>ChovySign_GUI</RootNamespace>
<AssemblyName>ChovySign v2</AssemblyName>
<ApplicationIcon>ICON.ICO</ApplicationIcon>
<Authors>SquallATF, Li, Dots-Tb</Authors>
</PropertyGroup>
<ItemGroup>
<None Remove=".gitignore" />
<None Remove="DEFAULTICON.PNG" />
<None Remove="Icon.png" />
<None Remove="Popup\Global\KeySelector\ACTRIFMETHOD.PNG" />
<None Remove="Popup\Global\KeySelector\EBOOTMETHOD.PNG" />
<None Remove="Popup\Global\KeySelector\KEYSTXTMETHOD.PNG" />
<None Remove="PS1CD.PNG" />
<None Remove="UMD.png" />
</ItemGroup>
<ItemGroup>
<AvaloniaResource Include="ICON.PNG" />
<AvaloniaResource Include="Popup\Global\KeySelector\ACTRIFMETHOD.PNG" />
<AvaloniaResource Include="Popup\Global\KeySelector\EBOOTMETHOD.PNG" />
<AvaloniaResource Include="Popup\Global\KeySelector\KEYSTXTMETHOD.PNG" />
<AvaloniaResource Include="Ps1\PS1CD.PNG" />
<AvaloniaResource Include="Psp\UMD.PNG">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</AvaloniaResource>
</ItemGroup>
<ItemGroup>
<Content Include="ICON.ICO" />
</ItemGroup>
<ItemGroup>
<TrimmerRootDescriptor Include="Roots.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.1.0-beta1" />
<PackageReference Include="Avalonia.Desktop" Version="11.1.0-beta1" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.1.0-beta1" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.1.0-beta1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GameBuilder\GameBuilder.csproj" />
<ProjectReference Include="..\LibChovy\LibChovy.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Settings\ConfigPath.axaml.cs">
<DependentUpon>ConfigPath.axaml</DependentUpon>
</Compile>
<Compile Update="Settings\ConfigToggle.axaml.cs">
<DependentUpon>ConfigToggle.axaml</DependentUpon>
</Compile>
<Compile Update="Resource.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resource.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resource.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resource.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

View File

@ -0,0 +1,26 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="80"
x:Class="ChovySign_GUI.Global.BrowseButton"
Height="60">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<Label Name="browseLabel" Content="File Path:" VerticalAlignment="Bottom" Grid.Row="0"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="75" />
</Grid.ColumnDefinitions>
<TextBox Name="filePath" HorizontalAlignment="Stretch" VerticalAlignment="Center" Watermark="(None)" Grid.Column="0"/>
<Button Name="browseButton" Content="Browse" HorizontalAlignment="Center" VerticalAlignment="Center" Click="browseClick" Grid.Column="1"/>
</Grid>
</Grid>
</UserControl>

View File

@ -0,0 +1,203 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Org.BouncyCastle.Tls.Crypto;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace ChovySign_GUI.Global
{
public partial class BrowseButton : UserControl
{
private string fileTypeName;
private string extension;
private bool directory;
public event EventHandler<EventArgs>? FileChanged;
protected virtual void OnFileChanged(EventArgs e)
{
if(FileChanged is not null)
FileChanged(this, e);
}
public string Extension
{
get
{
return extension.Replace(".", "");
}
set
{
extension = value;
}
}
public string FileTypeName
{
get
{
return fileTypeName;
}
set
{
fileTypeName = value;
}
}
public bool IsDirectory
{
get
{
return this.directory;
}
set
{
this.directory = value;
}
}
public string Watermark
{
get
{
return this.filePath.Watermark;
}
set
{
this.filePath.Watermark = value;
}
}
public string Label
{
get
{
string? lbl = this.browseLabel.Content as String;
if (lbl is null) return "";
else return lbl;
}
set
{
this.browseLabel.Content = value;
}
}
public bool ContainsFile
{
get
{
if (!this.IsDirectory)
return (File.Exists(this.filePath.Text) && Path.GetExtension(this.filePath.Text).Equals("." + Extension, StringComparison.InvariantCultureIgnoreCase));
else
return (Directory.Exists(this.filePath.Text));
}
}
public string FilePath
{
get
{
if (!ContainsFile) return "";
return this.filePath.Text;
}
set
{
if (!this.IsDirectory)
{
if (File.Exists(value))
this.filePath.Text = value;
else
this.filePath.Text = "";
}
else
{
if (Directory.Exists(value))
this.filePath.Text = value;
else
this.filePath.Text = "";
}
}
}
private async void browseClick(object sender, RoutedEventArgs e)
{
Window? currentWindow = this.VisualRoot as Window;
if (currentWindow is not Window) throw new Exception("could not find current window");
Button? btn = sender as Button;
if (btn is Button)
{
btn.IsEnabled = false;
if (this.IsDirectory)
{
// open directory
OpenFolderDialog browseDialog = new OpenFolderDialog();
if (this.ContainsFile) browseDialog.Directory = this.FilePath;
browseDialog.Title = "Select directory.";
string? directory = await browseDialog.ShowAsync(currentWindow);
if(directory is not null)
this.FilePath = directory;
}
else
{
// open file
OpenFileDialog browseDialog = new OpenFileDialog();
if (extension != "")
{
browseDialog.Filters = new List<FileDialogFilter>();
FileDialogFilter filter = new FileDialogFilter();
filter.Extensions.Add(extension);
filter.Name = fileTypeName;
browseDialog.Filters.Add(filter);
browseDialog.Title = "Select " + fileTypeName;
}
else
{
browseDialog.Title = "Select a file.";
}
if (this.ContainsFile) browseDialog.Directory = Path.GetDirectoryName(this.FilePath);
string[]? selectedFiles = await browseDialog.ShowAsync(currentWindow);
if (selectedFiles is not null && selectedFiles.Length > 0)
this.FilePath = selectedFiles.First();
}
btn.IsEnabled = true;
OnFileChanged(new EventArgs());
}
}
public BrowseButton()
{
InitializeComponent();
this.filePath.PropertyChanged += onPropertyChanged;
this.extension = "";
this.fileTypeName = "All Files";
}
private void onPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e)
{
TextBox? txt = sender as TextBox;
if (txt is null) return;
if (e.Property.Name == "Text")
{
if (txt.Text is null) return;
if (!ContainsFile) return;
OnFileChanged(new EventArgs());
}
}
}
}

View File

@ -0,0 +1,8 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="ChovySign_GUI.Global.FilteredTextBox">
<TextBox Name="txtBox" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
</UserControl>

View File

@ -0,0 +1,133 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using System;
using System.Text;
using System.Threading.Tasks;
namespace ChovySign_GUI.Global
{
public partial class FilteredTextBox : UserControl
{
private string? allowedChars = null;
public event EventHandler<EventArgs>? TextChanged;
protected virtual void OnTextChanged(EventArgs e)
{
if (TextChanged is not null)
TextChanged(this, e);
}
public int MaxLength
{
get
{
return this.txtBox.MaxLength;
}
set
{
this.txtBox.MaxLength = value;
}
}
public bool Password
{
get
{
return this.txtBox.PasswordChar == default(char);
}
set
{
if (value) this.txtBox.PasswordChar = 'X';
else this.txtBox.PasswordChar = default(char);
}
}
public string Watermark
{
get
{
return this.txtBox.Watermark;
}
set
{
this.txtBox.Watermark = value;
}
}
public string? AllowedChars
{
get
{
if (allowedChars is null) return "";
else return allowedChars;
}
set
{
allowedChars = value;
}
}
public string Text
{
get
{
if (this.txtBox.Text is null) return "";
return this.txtBox.Text;
}
set
{
this.txtBox.Text = value;
}
}
public FilteredTextBox()
{
InitializeComponent();
this.txtBox.PropertyChanged += onPropertyChanged;
this.txtBox.AddHandler(TextInputEvent, onTxtInput, RoutingStrategies.Tunnel);
}
private void onPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e)
{
TextBox? txt = sender as TextBox;
if (txt is null) return;
if (e.Property.Name == "Text")
{
if (txt.Text is null) return;
txt.Text = filter(txt.Text);
OnTextChanged(new EventArgs());
}
}
private string filter(string original)
{
if (allowedChars is not null)
{
StringBuilder str = new StringBuilder();
for (int i = 0; i < original.Length; i++)
{
if (allowedChars.Contains(original[i]))
str.Append(original[i]);
}
return str.ToString();
}
return original;
}
private void onTxtInput(object? sender, TextInputEventArgs e)
{
string? newTxt = e.Text;
if (newTxt is null) newTxt = "";
newTxt = filter(newTxt);
e.Text = newTxt;
OnTextChanged(new EventArgs());
}
}
}

View File

@ -0,0 +1,36 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Global="clr-namespace:ChovySign_GUI.Global"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="40"
x:Class="ChovySign_GUI.Global.KeySelector">
<!-- key selector -->
<Border Padding="10 3" HorizontalAlignment="Stretch" VerticalAlignment="Top">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="80" />
</Grid.ColumnDefinitions>
<Grid HorizontalAlignment="Stretch" Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Label HorizontalAlignment="Left" VerticalAlignment="Center" Content="Rif:" Grid.Column="0"/>
<Global:FilteredTextBox Name="zRif" AllowedChars="1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=+/" HorizontalAlignment="Stretch" Watermark="LICENSE ZRIF" Grid.Column="1"/>
</Grid>
<Grid HorizontalAlignment="Stretch" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Label HorizontalAlignment="Left" VerticalAlignment="Center" Content="Key:" Grid.Column="0"/>
<Global:FilteredTextBox AllowedChars="1234567890ABCDEFabcdef" HorizontalAlignment="Stretch" MaxLength="32" Watermark="Version Key" Name="vKey" Grid.Column="1"/>
</Grid>
<Button Name="getKeys" Click="getKeysClick" Content="Get Keys" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="2"/>
</Grid>
</Border>
</UserControl>

View File

@ -0,0 +1,284 @@
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Remote.Protocol.Input;
using ChovySign_GUI.Popup.Global;
using ChovySign_GUI.Popup.Global.KeySelector;
using GameBuilder.Psp;
using Ionic.Zlib;
using Li.Utilities;
using LibChovy.Config;
using LibChovy.VersionKey;
using SixLabors.ImageSharp.PixelFormats;
using System;
using System.ComponentModel;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using Vita.ContentManager;
using Vita.PsvImgTools;
using static ChovySign_GUI.Popup.Global.MessageBox;
using static PspCrypto.SceNpDrm;
namespace ChovySign_GUI.Global
{
public partial class KeySelector : UserControl
{
private string licenseDataConfigKey
{
get
{
return "KEY_INDEX_" + keyIndex + "_LICENSE_DATA";
}
}
private string versionKeyConfigKey
{
get
{
return "KEY_INDEX_" + keyIndex + "_VERSION_KEY";
}
}
private bool lastValid;
private int keyIndex = 1;
private NpDrmRif? npRif;
private byte[]? versionKey;
public bool IsValid
{
get
{
try
{
if (vKey.Text is null) return false;
if (vKey.Text.Length != 32) return false;
if (zRif.Text is null) return false;
if (zRif.Text.Length <= 0) return false;
byte[] rif = new NpDrmRif(zRif.Text).Rif;
if (rif.Length <= 0) return false;
return (VersionKey is not null && Rif is not null);
}
catch { return false; };
}
}
public byte[]? VersionKey
{
get
{
return versionKey;
}
set
{
if (value is null) return;
versionKey = value;
ChovyConfig.CurrentConfig.SetBytes(versionKeyConfigKey, versionKey);
vKey.Text = BitConverter.ToString(versionKey).Replace("-", "");
OnVersionKeyChanged(new EventArgs());
}
}
public byte[]? Rif
{
get
{
if (npRif is null) return null;
return npRif.Rif;
}
set
{
if (value is null) return;
npRif = new NpDrmRif(value);
zRif.Text = npRif.ZRif;
ChovyConfig.CurrentConfig.SetBytes(licenseDataConfigKey, npRif.Rif);
OnRifChanged(new EventArgs());
}
}
private void reloadCfg()
{
byte[]? rifData = ChovyConfig.CurrentConfig.GetBytes(licenseDataConfigKey);
byte[]? vkeyData = ChovyConfig.CurrentConfig.GetBytes(versionKeyConfigKey);
if(vkeyData is not null)
{
vKey.Text = BitConverter.ToString(vkeyData).Replace("-", "");
versionKey = vkeyData;
}
if (rifData is not null)
{
npRif = new NpDrmRif(rifData);
zRif.Text = npRif.ZRif;
}
}
private async void getKeysClick(object sender, RoutedEventArgs e)
{
Button? btn = sender as Button;
if (btn is null) return;
btn.IsEnabled = false;
Window? currentWindow = this.VisualRoot as Window;
if (currentWindow is not Window) throw new Exception("could not find current window");
KeyObtainMethods keyObt = new KeyObtainMethods();
keyObt.KeyIndex = keyIndex;
VersionKeyMethod? method = await keyObt.ShowDialog<VersionKeyMethod>(currentWindow);
if (method is null) return;
NpDrmInfo? key = null;
NpDrmRif? rif = null;
switch (method)
{
case VersionKeyMethod.ACT_RIF_METHOD:
ActRifMethodGUI actRifMethodGUI = new ActRifMethodGUI();
NpDrmInfo[]? keys = await actRifMethodGUI.ShowDialog<NpDrmInfo[]>(currentWindow);
if (keys is null) break;
key = keys[keyIndex];
rif = actRifMethodGUI.Rif;
break;
case VersionKeyMethod.EBOOT_PBP_METHOD:
CmaBackupPicker ebootBackupSelector = new CmaBackupPicker();
ebootBackupSelector.BackupType = new string[] { "PGAME", "PSGAME" };
string? gameBackupFolder = await ebootBackupSelector.ShowDialog<string>(currentWindow);
string accountId = ebootBackupSelector.AccountId;
if (gameBackupFolder is null) break;
if (accountId == "") break;
key = CMAVersionKeyHelper.GetKeyFromGamePsvimg(gameBackupFolder, accountId, this.keyIndex);
rif = CMAVersionKeyHelper.GetRifFromLicensePsvimg(gameBackupFolder, accountId);
break;
case VersionKeyMethod.KEYS_TXT_METHOD:
CmaBackupPicker pspLicenseBackupSelector = new CmaBackupPicker();
pspLicenseBackupSelector.BackupType = new string[] { "PGAME", "PSGAME" };
pspLicenseBackupSelector.Filter = KeysTxtMethod.TitleIds;
gameBackupFolder = await pspLicenseBackupSelector.ShowDialog<string>(currentWindow);
accountId = pspLicenseBackupSelector.AccountId;
if (gameBackupFolder is null) break;
if (accountId == "") break;
rif = CMAVersionKeyHelper.GetRifFromLicensePsvimg(gameBackupFolder, accountId);
if (rif is null) break;
key = KeysTxtMethod.GetVersionKey(rif.ContentId, this.KeyIndex);
break;
}
if (key is not null)
{
if (key.KeyIndex != this.keyIndex)
sceNpDrmTransformVersionKey(key.VersionKey, key.KeyIndex, this.keyIndex);
// its a revoolution~
VersionKey = key.VersionKey;
}
if (rif is not null)
Rif = rif.Rif;
btn.IsEnabled = true;
}
public int KeyIndex
{
get
{
return keyIndex;
}
set
{
keyIndex = value;
reloadCfg();
}
}
public event EventHandler<EventArgs>? VersionKeyChanged;
protected virtual void OnVersionKeyChanged(EventArgs e)
{
if (IsValid != lastValid) OnValidStateChanged(new EventArgs());
if (VersionKeyChanged is not null)
VersionKeyChanged(this, e);
}
public event EventHandler<EventArgs>? RifChanged;
protected virtual void OnRifChanged(EventArgs e)
{
if (IsValid != lastValid) OnValidStateChanged(new EventArgs());
if (RifChanged is not null)
RifChanged(this, e);
}
public event EventHandler<EventArgs>? ValidStateChanged;
protected virtual void OnValidStateChanged(EventArgs e)
{
lastValid = IsValid;
if (ValidStateChanged is not null)
ValidStateChanged(this, e);
}
public KeySelector()
{
InitializeComponent();
reloadCfg();
lastValid = IsValid;
zRif.TextChanged += onZrifChanged;
vKey.TextChanged += onVkeyChanged;
}
private void onVkeyChanged(object? sender, EventArgs e)
{
FilteredTextBox? txt = sender as FilteredTextBox;
if (txt is null) return;
if (lastValid != IsValid)
OnValidStateChanged(new EventArgs());
try
{
if (txt.Text is null) return;
if (txt.Text.Length != 32) return;
this.VersionKey = MathUtil.StringToByteArray(txt.Text);
}
catch { };
}
private void onZrifChanged(object? sender, EventArgs e)
{
FilteredTextBox? txt = sender as FilteredTextBox;
if (txt is null) return;
if (lastValid != IsValid)
OnValidStateChanged(new EventArgs());
try
{
byte[] rifBytes = new NpDrmRif(txt.Text).Rif;
if (rifBytes.Length != 0) this.Rif = rifBytes;
}
catch { };
}
}
}

View File

@ -0,0 +1,16 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="80"
x:Class="ChovySign_GUI.Global.LabeledComboBox"
Height="60">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<Label Name="lblTxt" Content="Label:" VerticalAlignment="Bottom" Grid.Row="0"/>
<ComboBox Name="comboBox" HorizontalAlignment="Stretch" VerticalAlignment="Center" Grid.Row="1"/>
</Grid>
</UserControl>

View File

@ -0,0 +1,87 @@
using Avalonia.Controls;
using System;
using System.Collections.Generic;
namespace ChovySign_GUI.Global
{
public partial class LabeledComboBox : UserControl
{
private List<string> items;
public string Label
{
get
{
string? lbl = this.lblTxt.Content as string;
if (lbl is null) return "";
else return lbl;
}
set
{
this.lblTxt.Content = value;
}
}
public int SelectedIndex
{
get
{
return this.comboBox.SelectedIndex;
}
set
{
this.comboBox.SelectedIndex = value;
OnSelectionChanged(new EventArgs());
}
}
public string SelectedItem
{
get
{
string? itm = this.comboBox.SelectedItem as string;
if (itm is null) return "";
else return itm;
}
set
{
this.comboBox.SelectedItem = value;
OnSelectionChanged(new EventArgs());
}
}
public string[] Items
{
get
{
string[]? strings = this.comboBox.ItemsSource as string[];
if (strings is null) return new string[0];
return strings;
}
set
{
this.comboBox.ItemsSource = value;
}
}
public event EventHandler<EventArgs>? SelectionChanged;
protected virtual void OnSelectionChanged(EventArgs e)
{
if (SelectionChanged is not null)
SelectionChanged(this, e);
}
public LabeledComboBox()
{
InitializeComponent();
this.comboBox.SelectionChanged += onComboBoxSelectionChange;
}
private void onComboBoxSelectionChange(object? sender, SelectionChangedEventArgs e)
{
OnSelectionChanged(new EventArgs());
}
}
}

View File

@ -0,0 +1,17 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Global="clr-namespace:ChovySign_GUI.Global"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="80"
x:Class="ChovySign_GUI.Global.LabeledTextBox"
Height="60">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<Label Name="lblTxt" Content="Label:" VerticalAlignment="Bottom" Grid.Row="0"/>
<Global:FilteredTextBox Name="txtBox" HorizontalAlignment="Stretch" VerticalAlignment="Center" Grid.Row="1"/>
</Grid>
</UserControl>

View File

@ -0,0 +1,104 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using System;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ChovySign_GUI.Global
{
public partial class LabeledTextBox : UserControl
{
public event EventHandler<EventArgs>? TextChanged;
protected virtual void OnTextChanged(EventArgs e)
{
if (TextChanged is not null)
TextChanged(this, e);
}
public int MaxLength
{
get
{
return this.txtBox.MaxLength;
}
set
{
this.txtBox.MaxLength = value;
}
}
public bool Password
{
get
{
return this.txtBox.Password;
}
set
{
this.txtBox.Password = value;
}
}
public string Watermark
{
get
{
return this.txtBox.Watermark;
}
set
{
this.txtBox.Watermark = value;
}
}
public string? AllowedChars
{
get
{
return this.txtBox.AllowedChars;
}
set
{
this.txtBox.AllowedChars = value;
}
}
public string Text
{
get
{
return this.txtBox.Text;
}
set
{
this.txtBox.Text = value;
}
}
public string Label
{
get
{
string? lbl = this.lblTxt.Content as string;
if (lbl is null) return "";
else return lbl;
}
set
{
this.lblTxt.Content = value;
}
}
public LabeledTextBox()
{
InitializeComponent();
this.txtBox.TextChanged += onTxtBoxTextChange;
}
private void onTxtBoxTextChange(object? sender, EventArgs e)
{
OnTextChanged(e);
}
}
}

View File

@ -0,0 +1,24 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="60"
x:Class="ChovySign_GUI.Global.ProgressStatus">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Top">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Label Name="statusLbl" Content="Progress %" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Grid.Row="0"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="15*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<ProgressBar Name="progressVal" Maximum="100" Minimum="0" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="30" Grid.Column="0"/>
<Button Name="goButton" Click="goClick" Content="Go!" HorizontalAlignment="Center" VerticalAlignment="Top" Grid.Column="1"/>
</Grid>
</Grid>
</UserControl>

View File

@ -0,0 +1,78 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Threading;
using ChovySign_GUI.Popup.Global;
using ChovySign_GUI.Settings;
using Li.Progress;
using LibChovy;
using System;
using System.Threading.Tasks;
using static ChovySign_GUI.Popup.Global.MessageBox;
namespace ChovySign_GUI.Global
{
public partial class ProgressStatus : UserControl
{
public ChovySignParameters? Parameters = null;
public event EventHandler<EventArgs>? Finished;
public event EventHandler<EventArgs>? BeforeStart;
private ChovySign chovySign;
public ProgressStatus()
{
InitializeComponent();
chovySign = new ChovySign();
chovySign.RegisterCallback(onProgress);
}
protected virtual void OnBeforeStart(EventArgs e)
{
if (BeforeStart is not null)
BeforeStart(this, e);
}
protected virtual void OnFinished(EventArgs e)
{
if (Finished is not null)
Finished(this, e);
}
private async void goClick(object sender, RoutedEventArgs e)
{
Window? currentWindow = this.VisualRoot as Window;
if (currentWindow is not Window) throw new Exception("could not find current window");
this.goButton.IsEnabled = false;
OnBeforeStart(new EventArgs());
// sanity check it
if(Parameters is null) { await MessageBox.Show(currentWindow, "ChovySignParameters was null, cannot start!", "Invalid Parameters", MessageBoxButtons.Ok); return; }
// apply settings that are global to all signs
if(SettingsTab.Settings is not null) Parameters.BuildStreamType = SettingsTab.Settings.BuildStreamType;
try
{
await Task.Run(() => {
chovySign.Go(Parameters);
});
}
catch (Exception ex)
{
await MessageBox.Show(currentWindow, "Error building: " + ex.Message + "\n\nSTACKTRACE: " + ex.StackTrace, "ERROR", MessageBoxButtons.Ok);
return;
}
OnFinished(new EventArgs());
this.goButton.IsEnabled = true;
}
private void onProgress(ProgressInfo inf)
{
Dispatcher.UIThread.Post(() =>
{
this.statusLbl.Content = inf.CurrentProcess + " (" + inf.Done + "/" + inf.Remain + ") " + inf.ProgressInt + "%";
this.progressVal.Value = inf.Progress;
});
}
}
}

BIN
ChovySign-GUI/ICON.ICO Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
ChovySign-GUI/ICON.PNG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -0,0 +1,27 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Ps1="clr-namespace:ChovySign_GUI.Ps1"
xmlns:Psp="clr-namespace:ChovySign_GUI.Psp"
xmlns:Settings="clr-namespace:ChovySign_GUI.Settings"
mc:Ignorable="d" d:DesignWidth="850" d:DesignHeight="760"
MinHeight="760"
x:Class="ChovySign_GUI.MainWindow"
Title="Chovy Sign V2" Icon="/ICON.PNG">
<Grid>
<TabControl>
<TabItem Header="PlayStation Portable">
<Psp:PspTab Name="pspTab"/>
</TabItem>
<TabItem Header="PlayStation One">
<Ps1:Ps1Tab Name="ps1Tab"/>
</TabItem>
<TabItem Header="Settings">
<Settings:SettingsTab Name="settingsTab"/>
</TabItem>
</TabControl>
</Grid>
</Window>

View File

@ -0,0 +1,13 @@
using Avalonia;
using Avalonia.Controls;
namespace ChovySign_GUI
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,30 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Global="clr-namespace:ChovySign_GUI.Global"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="ChovySign_GUI.Popup.Global.CmaBackupPicker"
Title="Select a Content Manager Backup." Icon="/ICON.PNG">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="75"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Grid VerticalAlignment="Top" Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Global:BrowseButton Name="cmaDir" Label="CMA Directory" IsDirectory="True" Grid.Column="0" HorizontalAlignment="Stretch"/>
<Global:LabeledComboBox Name="accId" Label="Account ID" Grid.Column="1" HorizontalAlignment="Stretch"/>
</Grid>
<ListBox Name="backupList" VerticalAlignment="Stretch" Grid.Row="1"/>
<Button Name="selectBtn" Click="selectBtnClick" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Center">Select "Content Manager" Backup</Button>
<Label Name="lookingInLbl" Content="Looking in:" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Left"/>
</Grid>
</Window>

View File

@ -0,0 +1,250 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using ChovySign_GUI.Global;
using GameBuilder.Psp;
using LibChovy.Config;
using Org.BouncyCastle.Asn1;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Vita.ContentManager;
namespace ChovySign_GUI.Popup.Global
{
public partial class CmaBackupPicker : Window
{
private const string lookingInLabelText = "Looking in: ";
private string[]? gameDirectories;
private string[] backupSubFolders;
private string[]? filter;
private string? cmaAccountId = null;
private string? cmaBackupDir = null;
private const string backupPickerCmaDirectoryConfigKey = "BACKUP_PICKER_CMA_DIRECTORY";
public string[] Filter
{
set
{
this.filter = value;
reloadBackupsList();
}
}
public string AccountId
{
get
{
if (cmaAccountId is null) return "";
else return cmaAccountId;
}
set
{
cmaAccountId = value;
}
}
public string BackupDir
{
get
{
if(cmaBackupDir is null)
{
string? savedBackupFolder = ChovyConfig.CurrentConfig.GetString(backupPickerCmaDirectoryConfigKey);
if (savedBackupFolder is null) savedBackupFolder = SettingsReader.BackupsFolder;
cmaBackupDir = savedBackupFolder;
}
return cmaBackupDir;
}
set
{
if (Directory.Exists(value))
{
cmaBackupDir = value;
ChovyConfig.CurrentConfig.SetString(backupPickerCmaDirectoryConfigKey, cmaBackupDir);
}
}
}
private string[] accountIdSearchFolders
{
get
{
string[] searchIn = new string[this.BackupType.Length];
for (int i = 0; i < this.BackupType.Length; i++)
{
searchIn[i] = Path.Combine(BackupDir, this.BackupType[i]);
}
return searchIn;
}
}
private string[] backupSearchFolders
{
get
{
string[] backupFolders = new string[this.BackupType.Length];
string[] searchFolders = this.accountIdSearchFolders;
for (int i = 0; i < this.BackupType.Length; i++)
{
if (this.AccountId == "") backupFolders[i] = searchFolders[i];
backupFolders[i] = Path.Combine(searchFolders[i], this.AccountId);
}
return backupFolders;
}
}
public string[] BackupType
{
get
{
return backupSubFolders;
}
set
{
backupSubFolders = value;
lookingInLbl.Content = lookingInLabelText + String.Join(", ", backupSubFolders);
reloadAccountIdsList();
reloadBackupsList();
}
}
private string[] GetAllDriectories(string[] dirList)
{
List<string> foundDir = new List<string>();
foreach(string dirSearch in dirList)
{
if (!Directory.Exists(dirSearch)) continue;
foreach(string dir in Directory.GetDirectories(dirSearch))
{
if (!foundDir.Contains(dir))
{
foundDir.Add(dir);
}
}
}
return foundDir.ToArray();
}
private void reloadAccountIdsList()
{
try
{
string[] usedAccountIds = GetAllDriectories(accountIdSearchFolders);
List<string> accountIdLst = new List<string>();
foreach (string accountId in usedAccountIds)
{
string aid = Path.GetFileName(accountId);
if (accountIdLst.Contains(aid)) continue;
if (aid.Length != 16) continue;
accountIdLst.Add(aid);
}
this.accId.Items = accountIdLst.ToArray();
if (accountIdLst.Count > 0)
this.accId.SelectedIndex = 0;
}
catch { };
this.selectBtn.IsEnabled = false;
}
private void selectBtnClick(object sender, RoutedEventArgs e)
{
if (gameDirectories is null) { this.Close(); return; }
if (this.backupList.SelectedIndex == -1) { this.Close(); return; }
string selectedDir = gameDirectories[this.backupList.SelectedIndex];
if (Directory.Exists(selectedDir))
this.Close(selectedDir);
else
this.Close();
}
private void reloadBackupsList()
{
this.selectBtn.IsEnabled = false;
this.backupList.ItemsSource = new string[0];
try
{
string[] gameBackupDirectories = GetAllDriectories(backupSearchFolders);
List<string> filteredGameDirectories = new List<string>();
List<string> gameList = new List<string>();
foreach (string gameDirectory in gameBackupDirectories)
{
string paramFile = Path.Combine(gameDirectory, "sce_sys", "param.sfo");
if (File.Exists(paramFile))
{
try
{
Sfo psfo = Sfo.ReadSfo(File.ReadAllBytes(paramFile));
string? discId = psfo["DISC_ID"] as string;
string? title = psfo["TITLE"] as string;
if (discId is null) continue;
if (title is null) continue;
// filter games set in "Filter" property.
if (filter is not null)
if (!filter.Any(discId.Contains)) continue;
gameList.Add(discId + " - " + title);
filteredGameDirectories.Add(gameDirectory);
}
catch { continue; };
}
}
this.gameDirectories = filteredGameDirectories.ToArray();
this.backupList.ItemsSource = gameList;
}
catch { }
}
public CmaBackupPicker()
{
InitializeComponent();
this.cmaDir.FilePath = BackupDir;
this.backupSubFolders = new string[] { "APP" };
this.accId.SelectionChanged += onAccountSelectionChanged;
this.cmaDir.FileChanged += onCmaDirChanged;
this.backupList.SelectionChanged += onSelectedBackupChanged;
reloadAccountIdsList();
reloadBackupsList();
}
private void onSelectedBackupChanged(object? sender, SelectionChangedEventArgs e)
{
ListBox? lstBox = sender as ListBox;
if (lstBox is null) return;
if (lstBox.SelectedIndex == -1) selectBtn.IsEnabled = false;
else selectBtn.IsEnabled = true;
}
private void onAccountSelectionChanged(object? sender, System.EventArgs e)
{
LabeledComboBox? cbox = sender as LabeledComboBox;
if (cbox is null) return;
AccountId = cbox.SelectedItem;
reloadBackupsList();
}
private void onCmaDirChanged(object? sender, System.EventArgs e)
{
BrowseButton? button = sender as BrowseButton;
if (button is null) return;
if (button.ContainsFile)
{
BackupDir = button.FilePath;
reloadAccountIdsList();
reloadBackupsList();
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -0,0 +1,27 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Global="clr-namespace:ChovySign_GUI.Global"
mc:Ignorable="d" d:DesignWidth="450" d:DesignHeight="200"
x:Class="ChovySign_GUI.Popup.Global.KeySelector.ActRifMethodGUI"
SizeToContent="Height" Width="450" Height="200"
MinWidth="450" MinHeight="200" CanResize="False"
Title="Act/Rif Method" Icon="/ICON.PNG">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Global:LabeledTextBox Name="idpsInput" MaxLength="32" AllowedChars="1234567890ABCDEFabcdef" Label="IDPS / ConsoleID:" Watermark="00000001010200140C00025753578942" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Stretch"/>
<Global:BrowseButton Name="rifFile" Extension="rif" FileTypeName="Rights Information File" Label="LICENSE.RIF: (found @ ux0:/pspemu/PSP/LICENSE)" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Stretch"/>
<Global:BrowseButton Name="actFile" Extension="dat" FileTypeName="Activation Data" Label="ACT.DAT: (found @ tm0:/npdrm/act.dat)" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Stretch"/>
<Button Name="keyGen" Click="keyGenClick" Content="Generate Keys" Grid.Row="3" HorizontalAlignment="Center"/>
<CheckBox Name="hideConsoleId" Content="Hide ConsoleID" Grid.Row="3" VerticalAlignment="Bottom"/>
</Grid>
</Window>

View File

@ -0,0 +1,155 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using ChovySign_GUI.Global;
using LibChovy.Config;
using LibChovy.VersionKey;
using GameBuilder.Psp;
using Li.Utilities;
using System;
using System.IO;
using static ChovySign_GUI.Popup.Global.MessageBox;
namespace ChovySign_GUI.Popup.Global.KeySelector
{
public partial class ActRifMethodGUI : Window
{
private const string keygenHideConsoleIdKey = "KEYGEN_HIDE_CONSOLEID";
private const string keygenIdpsKey = "KEYGEN_CID";
private const string keygenActKey = "KEYGEN_ACT";
private const string keygenRifKey = "KEYGEN_RIF";
private NpDrmRif? rif;
public NpDrmRif? Rif
{
get
{
return rif;
}
}
public ActRifMethodGUI()
{
bool? lastHideConsoleId = ChovyConfig.CurrentConfig.GetBool(keygenHideConsoleIdKey);
byte[]? lastCid = ChovyConfig.CurrentConfig.GetBytes(keygenIdpsKey);
string? lastAct = ChovyConfig.CurrentConfig.GetString(keygenActKey);
string? lastRif = ChovyConfig.CurrentConfig.GetString(keygenRifKey);
InitializeComponent();
// reload previous settings
if(lastHideConsoleId is not null)
{
hideConsoleId.IsChecked = lastHideConsoleId;
this.idpsInput.Password = (bool)lastHideConsoleId;
}
if (lastAct is not null)
actFile.FilePath = lastAct;
if (lastCid is not null)
idpsInput.Text = BitConverter.ToString(lastCid).Replace("-", "");
if (lastAct is not null)
actFile.FilePath = lastAct;
if (lastRif is not null)
rifFile.FilePath = lastRif;
hideConsoleId.Checked += onChangeCidState;
hideConsoleId.Unchecked += onChangeCidState;
idpsInput.TextChanged += onIdpsChange;
actFile.FileChanged += onActFileChange;
rifFile.FileChanged += onRifFileChange;
check();
}
private void onRifFileChange(object? sender, EventArgs e)
{
BrowseButton? filePth = sender as BrowseButton;
if (filePth is null) return;
if (!filePth.ContainsFile) return;
ChovyConfig.CurrentConfig.SetString(keygenRifKey, filePth.FilePath);
check();
}
private void onActFileChange(object? sender, EventArgs e)
{
BrowseButton? filePth = sender as BrowseButton;
if (filePth is null) return;
if (!filePth.ContainsFile) return;
ChovyConfig.CurrentConfig.SetString(keygenActKey, filePth.FilePath);
check();
}
private void onIdpsChange(object? sender, EventArgs e)
{
LabeledTextBox? labledTxtBox = sender as LabeledTextBox;
if (labledTxtBox is null) return;
if (labledTxtBox.Text.Length != 32) return;
try
{
byte[] idps = MathUtil.StringToByteArray(labledTxtBox.Text);
ChovyConfig.CurrentConfig.SetBytes(keygenIdpsKey, idps);
check();
}
catch{ };
}
private void keyGenClick(object sender, RoutedEventArgs e)
{
NpDrmInfo[] keys = new NpDrmInfo[0x5];
Window? currentWindow = this.VisualRoot as Window;
if (currentWindow is not Window) throw new Exception("could not find current window");
try
{
// read data
byte[] idps = MathUtil.StringToByteArray(idpsInput.Text);
byte[] act = File.ReadAllBytes(actFile.FilePath);
byte[] rif = File.ReadAllBytes(rifFile.FilePath);
// generate keys
for (int i = 0; i < 0x5; i++)
keys[i] = ActRifMethod.GetVersionKey(act, rif, idps, i);
this.rif = new NpDrmRif(rif);
this.Close(keys);
}
catch { MessageBox.Show(currentWindow, "Failed to generate key...", "Failed", MessageBoxButtons.Ok); }
}
private void check()
{
bool s = true;
if (idpsInput.Text.Length != 32) s = false;
if (!actFile.ContainsFile) s = false;
if (!rifFile.ContainsFile) s = false;
keyGen.IsEnabled = s;
}
private void onChangeCidState(object? sender, RoutedEventArgs e)
{
CheckBox? checkBox = sender as CheckBox;
if (checkBox is null) return;
bool? hideConsoleId = checkBox.IsChecked;
if (hideConsoleId is null) return;
ChovyConfig.CurrentConfig.SetBool(keygenHideConsoleIdKey, (bool)hideConsoleId);
this.idpsInput.Password = (bool)hideConsoleId;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -0,0 +1,28 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="1400" d:DesignHeight="150"
x:Class="ChovySign_GUI.Popup.Global.KeySelector.KeyObtainMethods"
Title="VersionKey Obtain Method" SizeToContent="WidthAndHeight"
MaxWidth="1400" MaxHeight="150" Icon="/ICON.PNG">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="5*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="5*"/>
</Grid.RowDefinitions>
<Button Content="EBOOT.PBP Method" Click="ebootMethodClick" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Button Content="IDPS+RIF+ACT Method" Click="actRifMethodClick" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Button Content="KEYS.TXT Method" Click="keysTxtMethodClick" Grid.Row="0" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Image Name="ebootMethodGraphic" Source="/Popup/Global/KeySelector/EBOOTMETHOD.PNG" Grid.Row="1" Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Stretch"/>
<Image Name="actRifMethodGraphic" Source="/Popup/Global/KeySelector/ACTRIFMETHOD.PNG" Grid.Row="1" Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Stretch"/>
<Image Name="keysTxtMethodGraphic" Source="/Popup/Global/KeySelector/KEYSTXTMETHOD.PNG" Grid.Row="1" Grid.Column="2" VerticalAlignment="Top" HorizontalAlignment="Stretch"/>
</Grid>
</Window>

View File

@ -0,0 +1,50 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using LibChovy.VersionKey;
namespace ChovySign_GUI.Popup.Global.KeySelector
{
public partial class KeyObtainMethods : Window
{
private int keyIndex;
private VersionKeyMethod method;
public VersionKeyMethod Method
{
get
{
return method;
}
}
public int KeyIndex
{
set
{
keyIndex = value;
}
}
private void ebootMethodClick(object sender, RoutedEventArgs e)
{
this.method = VersionKeyMethod.EBOOT_PBP_METHOD;
this.Close(method);
}
private void actRifMethodClick(object sender, RoutedEventArgs e)
{
this.method = VersionKeyMethod.ACT_RIF_METHOD;
this.Close(method);
}
private void keysTxtMethodClick(object sender, RoutedEventArgs e)
{
this.method = VersionKeyMethod.KEYS_TXT_METHOD;
this.Close(method);
}
public KeyObtainMethods()
{
InitializeComponent();
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

View File

@ -0,0 +1,19 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="ChovySign_GUI.Popup.Global.MessageBox"
SizeToContent="WidthAndHeight" CanResize="False" Icon="/ICON.PNG">
<StackPanel HorizontalAlignment="Center">
<TextBlock Foreground="LightGreen" HorizontalAlignment="Center" Name="Text"/>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal" Name="Buttons">
<StackPanel.Styles>
<Style Selector="Button">
<Setter Property="Margin" Value="5"/>
</Style>
</StackPanel.Styles>
</StackPanel>
</StackPanel>
</Window>

View File

@ -0,0 +1,77 @@
using System.Threading.Tasks;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
namespace ChovySign_GUI.Popup.Global
{
partial class MessageBox : Window
{
public enum MessageBoxButtons
{
Ok,
OkCancel,
YesNo,
YesNoCancel
}
public enum MessageBoxResult
{
Ok,
Cancel,
Yes,
No
}
public MessageBox()
{
AvaloniaXamlLoader.Load(this);
}
public static Task<MessageBoxResult> Show(Window parent, string text, string title, MessageBoxButtons buttons)
{
var msgbox = new MessageBox()
{
Title = title
};
msgbox.FindControl<TextBlock>("Text").Text = text;
var buttonPanel = msgbox.FindControl<StackPanel>("Buttons");
var res = MessageBoxResult.Ok;
void AddButton(string caption, MessageBoxResult r, bool def = false)
{
var btn = new Button { Content = caption };
btn.Click += (_, __) => {
res = r;
msgbox.Close();
};
buttonPanel.Children.Add(btn);
if (def)
res = r;
}
if (buttons == MessageBoxButtons.Ok || buttons == MessageBoxButtons.OkCancel)
AddButton("Ok", MessageBoxResult.Ok, true);
if (buttons == MessageBoxButtons.YesNo || buttons == MessageBoxButtons.YesNoCancel)
{
AddButton("Yes", MessageBoxResult.Yes);
AddButton("No", MessageBoxResult.No, true);
}
if (buttons == MessageBoxButtons.OkCancel || buttons == MessageBoxButtons.YesNoCancel)
AddButton("Cancel", MessageBoxResult.Cancel, true);
var tcs = new TaskCompletionSource<MessageBoxResult>();
msgbox.Closed += delegate { tcs.TrySetResult(res); };
if (parent != null)
msgbox.ShowDialog(parent);
else msgbox.Show();
return tcs.Task;
}
}
}

21
ChovySign-GUI/Program.cs Normal file
View File

@ -0,0 +1,21 @@
using Avalonia;
using System;
namespace ChovySign_GUI
{
internal class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
public static void Main(string[] args) => BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.LogToTrace();
}
}

View File

@ -0,0 +1,35 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Global="clr-namespace:ChovySign_GUI.Global"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="280"
x:Class="ChovySign_GUI.Ps1.CueSelector">
<!-- Bin/Cue Image selector -->
<Border Padding="5 5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="10*" />
</Grid.ColumnDefinitions>
<Image HorizontalAlignment="Stretch" VerticalAlignment="Center" Source="/Ps1/PS1CD.PNG" Grid.Column="0"/>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="52"/>
<RowDefinition Height="52"/>
<RowDefinition Height="52"/>
<RowDefinition Height="52"/>
<RowDefinition Height="52"/>
</Grid.RowDefinitions>
<Global:BrowseButton Name="discCue1" Extension="cue" FileTypeName="PS1 Cue Sheet" Label="Disc 1:" Grid.Row="0"/>
<Global:BrowseButton Name="discCue2" Extension="cue" FileTypeName="PS1 Cue Sheet" Label="Disc 2:" Grid.Row="1"/>
<Global:BrowseButton Name="discCue3" Extension="cue" FileTypeName="PS1 Cue Sheet" Label="Disc 3:" Grid.Row="2"/>
<Global:BrowseButton Name="discCue4" Extension="cue" FileTypeName="PS1 Cue Sheet" Label="Disc 4:" Grid.Row="3"/>
<Global:BrowseButton Name="discCue5" Extension="cue" FileTypeName="PS1 Cue Sheet" Label="Disc 5:" Grid.Row="4"/>
</Grid>
</Grid>
</Border>
</UserControl>

View File

@ -0,0 +1,88 @@
using Avalonia.Controls;
using System;
using System.Collections.Generic;
namespace ChovySign_GUI.Ps1
{
public partial class CueSelector : UserControl
{
public event EventHandler<EventArgs>? DiscsSelected;
protected virtual void OnDiscsSelected(EventArgs e)
{
if (DiscsSelected is not null)
DiscsSelected(this, e);
}
public string[] Discs
{
get
{
List<string> discList = new List<string>();
if (discCue1.ContainsFile) discList.Add(discCue1.FilePath);
if (discCue2.ContainsFile) discList.Add(discCue2.FilePath);
if (discCue3.ContainsFile) discList.Add(discCue3.FilePath);
if (discCue4.ContainsFile) discList.Add(discCue4.FilePath);
if (discCue5.ContainsFile) discList.Add(discCue5.FilePath);
return discList.ToArray();
}
}
public bool AnyDiscsSelected
{
get
{
return Discs.Length > 0;
}
}
private void clearAllAfter(int amt)
{
if (amt < 1) { discCue1.FilePath = ""; discCue1.IsEnabled = false; }
else discCue1.IsEnabled = true;
if (amt < 2) { discCue2.FilePath = ""; discCue2.IsEnabled = false; }
else discCue2.IsEnabled = true;
if (amt < 3) { discCue3.FilePath = ""; discCue3.IsEnabled = false; }
else discCue3.IsEnabled = true;
if (amt < 4) { discCue4.FilePath = ""; discCue4.IsEnabled = false; }
else discCue4.IsEnabled = true;
if (amt < 5) { discCue5.FilePath = ""; discCue5.IsEnabled = false; }
else discCue5.IsEnabled = true;
}
private void disableCueBoxes()
{
if (!discCue1.ContainsFile) clearAllAfter(1);
else if (!discCue2.ContainsFile) clearAllAfter(2);
else if (!discCue3.ContainsFile) clearAllAfter(3);
else if (!discCue4.ContainsFile) clearAllAfter(4);
else if (!discCue5.ContainsFile) clearAllAfter(5);
}
public CueSelector()
{
InitializeComponent();
disableCueBoxes();
discCue1.FileChanged += onFileChange;
discCue2.FileChanged += onFileChange;
discCue3.FileChanged += onFileChange;
discCue4.FileChanged += onFileChange;
discCue5.FileChanged += onFileChange;
}
private void onFileChange(object? sender, System.EventArgs e)
{
disableCueBoxes();
OnDiscsSelected(new EventArgs());
}
}
}

View File

@ -0,0 +1,31 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Global="clr-namespace:ChovySign_GUI.Global"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="280"
x:Class="ChovySign_GUI.Ps1.GameInfoSelector">
<Border Padding="5 5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="7*" />
</Grid.ColumnDefinitions>
<Image Name="iconPreview" HorizontalAlignment="Center" VerticalAlignment="Center" Width="80" Height="80" Grid.Column="0"/>
<Grid HorizontalAlignment="Stretch" Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="52"/>
<RowDefinition Height="52"/>
<RowDefinition Height="52"/>
<RowDefinition Height="52"/>
<RowDefinition Height="52"/>
</Grid.RowDefinitions>
<Global:LabeledTextBox HorizontalAlignment="Stretch" Name="gameTitle" Label="Title:" Watermark="The BEST PlayStation 1 Game" MaxLength="128" Grid.Row="0"/>
<Global:BrowseButton HorizontalAlignment="Stretch" Name="iconFile" Extension="png" FileTypeName="Portable Network Graphics" Watermark="(Default)" Label="icon0.png:" Grid.Row="1"/>
<Global:BrowseButton HorizontalAlignment="Stretch" Name="pic0File" Extension="png" FileTypeName="Portable Network Graphics" Watermark="(Default)" Label="pic0.png:" Grid.Row="2"/>
<Global:BrowseButton HorizontalAlignment="Stretch" Name="pic1File" Extension="png" FileTypeName="Portable Network Graphics" Watermark="(Default)" Label="pic1.png:" Grid.Row="3"/>
<Global:LabeledTextBox HorizontalAlignment="Stretch" Name="discId" AllowedChars="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" Label="Disc ID:" Watermark="SLUS00001" MaxLength="9" Grid.Row="4"/>
</Grid>
</Grid>
</Border>
</UserControl>

View File

@ -0,0 +1,207 @@
using Avalonia.Controls;
using Avalonia.Media.Imaging;
using ChovySign_GUI.Global;
using ChovySign_GUI.Popup.Global;
using GameBuilder.Pops;
using LibChovy.Art;
using System;
using System.IO;
using System.Threading.Tasks;
#pragma warning disable CS8601 // Possible null reference assignment.
// beacuse im checking if its null in the setter, but visual studio doesnt seem to understand :d
namespace ChovySign_GUI.Ps1
{
public partial class GameInfoSelector : UserControl
{
private byte[] iconCache;
private byte[] pic0Cache;
private byte[] pic1Cache;
public string DiscId
{
get
{
if (this.discId.Text is null) return "";
return this.discId.Text;
}
set
{
this.discId.Text = value;
}
}
public string Title
{
get
{
if (this.gameTitle.Text is null) return "";
return this.gameTitle.Text;
}
set
{
this.gameTitle.Text = value;
}
}
public byte[] Icon0
{
get
{
return iconCache;
}
set
{
if(value is not null)
iconCache = value;
loadIcon(iconCache);
}
}
public byte[] Pic0
{
get
{
return pic0Cache;
}
set
{
if (value is not null)
pic0Cache = value;
}
}
public byte[] Pic1
{
get
{
return pic1Cache;
}
set
{
if (value is not null)
pic1Cache = value;
}
}
private void loadIcon(byte[] imageData)
{
using (MemoryStream imageStream = new MemoryStream(imageData))
this.iconPreview.Source = new Bitmap(imageStream);
}
public async Task GetGameInfo(string cueFile)
{
try
{
PSInfo disc = new PSInfo(cueFile);
Title = disc.DiscName;
DiscId = disc.DiscId;
if (!File.Exists(this.iconFile.FilePath))
{
byte[] newCover = await Downloader.DownloadCover(disc);
loadIcon(newCover);
iconCache = newCover;
}
}
catch (Exception e) {
Window? currentWindow = this.VisualRoot as Window;
if (currentWindow is not Window) throw new Exception("could not find current window");
await MessageBox.Show(currentWindow, "unable to read cue sheet: " + Path.GetFileName(cueFile) + "\n" + e.Message + "\n\nSTACKTRACE: " + e.StackTrace, "cannot load cue sheet", MessageBox.MessageBoxButtons.Ok);
}
}
private async Task<byte[]?> doLoad(BrowseButton imgFile, int width, int height)
{
imgFile.IsEnabled = false;
if (imgFile.FilePath != "")
{
try
{
byte[] imageData = await Resizer.LoadImage(imgFile.FilePath, width, height);
imgFile.IsEnabled = true;
return imageData;
}
catch (Exception)
{
Window? currentWindow = this.VisualRoot as Window;
if (currentWindow is not Window) throw new Exception("could not find current window");
await MessageBox.Show(currentWindow, "The image you selected is could not be loaded!", "Invalid image.", MessageBox.MessageBoxButtons.Ok);
imgFile.FilePath = "";
};
}
imgFile.IsEnabled = true;
return null;
}
private async void onIconChange(object? sender, EventArgs e)
{
BrowseButton? button = sender as BrowseButton;
if (button is null) return;
Icon0 = await doLoad(button, 80, 80);
}
private async void onPic0Change(object? sender, EventArgs e)
{
BrowseButton? button = sender as BrowseButton;
if (button is null) return;
Pic0 = await doLoad(button, 310, 180);
}
private async void onPic1Change(object? sender, EventArgs e)
{
BrowseButton? button = sender as BrowseButton;
if (button is null) return;
Pic1 = await doLoad(button, 480, 272);
}
public event EventHandler<EventArgs>? TitleChanged;
protected virtual void OnTitleChanged(EventArgs e)
{
if (TitleChanged is not null)
TitleChanged(this, e);
}
public event EventHandler<EventArgs>? DiscIdChanged;
protected virtual void OnDiscIdChanged(EventArgs e)
{
if (DiscIdChanged is not null)
DiscIdChanged(this, e);
}
public GameInfoSelector()
{
InitializeComponent();
iconCache = LibChovy.Resources.ICON0;
pic0Cache = LibChovy.Resources.PIC0;
pic1Cache = LibChovy.Resources.PIC1;
loadIcon(iconCache);
this.iconFile.FileChanged += onIconChange;
this.pic0File.FileChanged += onPic0Change;
this.pic1File.FileChanged += onPic1Change;
this.gameTitle.TextChanged += onTitleChange;
this.discId.TextChanged += onDiscIdChange;
}
private void onDiscIdChange(object? sender, EventArgs e)
{
OnDiscIdChanged(new EventArgs());
}
private void onTitleChange(object? sender, EventArgs e)
{
OnTitleChanged(new EventArgs());
}
}
}
#pragma warning restore CS8601 // Possible null reference assignment.

BIN
ChovySign-GUI/Ps1/PS1CD.PNG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

View File

@ -0,0 +1,34 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Global="clr-namespace:ChovySign_GUI.Global"
xmlns:Ps1="clr-namespace:ChovySign_GUI.Ps1"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="900"
x:Class="ChovySign_GUI.Ps1.Ps1Tab">
<Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="280" />
<RowDefinition Height="280" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Global:KeySelector Name="keySelector" KeyIndex="1" Grid.Row="0" Grid.Column="1"/>
<Ps1:CueSelector Name="discSelector" Height="280" Grid.Row="1" Grid.Column="1"/>
<Ps1:GameInfoSelector Name="gameInfo" Height="280" Grid.Row="2" Grid.Column="1"/>
<Global:ProgressStatus VerticalAlignment="Center" Name="progressStatus" Grid.Row="3" Grid.Column="1"/>
</Grid>
<!-- Credits -->
<Label Content="Li, Dots TB, SquallATF, Motoharu, Davee" VerticalAlignment="Bottom" HorizontalAlignment="Right"/>
</Grid>
</UserControl>

View File

@ -0,0 +1,114 @@
using Avalonia.Controls;
using ChovySign_GUI.Global;
using ChovySign_GUI.Popup.Global;
using ChovySign_GUI.Settings;
using GameBuilder.Psp;
using LibChovy;
using System;
using System.Linq;
using Vita.ContentManager;
using static ChovySign_GUI.Popup.Global.MessageBox;
namespace ChovySign_GUI.Ps1
{
public partial class Ps1Tab : UserControl
{
public Ps1Tab()
{
InitializeComponent();
discSelector.DiscsSelected += onDiscSelected;
keySelector.ValidStateChanged += onKeyValidityChanged;
gameInfo.TitleChanged += onTitleChanged;
gameInfo.DiscIdChanged += onDiscIdChanged;
progressStatus.BeforeStart += onProcessStarting;
progressStatus.Finished += onProcessFinished;
check();
}
private async void onProcessFinished(object? sender, EventArgs e)
{
keySelector.IsEnabled = true;
discSelector.IsEnabled = true;
gameInfo.IsEnabled = true;
SettingsTab.Settings.IsEnabled = true;
Window? currentWindow = this.VisualRoot as Window;
if (currentWindow is not Window) throw new Exception("could not find current window");
_ = App.PlayFinishSound();
await MessageBox.Show(currentWindow, "Finished creating PS1 Game!\nCan now go restore it to your PSVita using Content Manager.", "Done!", MessageBoxButtons.Ok);
}
private void onProcessStarting(object? sender, EventArgs e)
{
keySelector.IsEnabled = false;
discSelector.IsEnabled = false;
gameInfo.IsEnabled = false;
SettingsTab.Settings.IsEnabled = false;
if (keySelector.Rif is null) return;
if (keySelector.VersionKey is null) return;
NpDrmRif rifInfo = new NpDrmRif(keySelector.Rif);
NpDrmInfo drmInfo = new NpDrmInfo(keySelector.VersionKey, rifInfo.ContentId, keySelector.KeyIndex);
PopsParameters popsParameters = new PopsParameters(drmInfo, rifInfo);
foreach (string disc in discSelector.Discs)
popsParameters.AddCd(disc);
popsParameters.Name = gameInfo.Title;
popsParameters.DiscId = gameInfo.DiscId;
popsParameters.Icon0 = gameInfo.Icon0;
popsParameters.Pic0 = gameInfo.Pic0;
popsParameters.Pic1 = gameInfo.Pic1;
// read settings from settings tab.
if (SettingsTab.Settings.DevkitMode) popsParameters.Account = new Account(0);
popsParameters.CrackMethod = SettingsTab.Settings.LibcryptMode;
SettingsReader.BackupsFolder = SettingsTab.Settings.CmaDirectory;
popsParameters.CreatePsvImg = SettingsTab.Settings.PackagePsvimg;
progressStatus.Parameters = popsParameters;
}
private void onDiscIdChanged(object? sender, EventArgs e)
{
check();
}
private void onTitleChanged(object? sender, EventArgs e)
{
check();
}
private void check()
{
this.progressStatus.IsEnabled = (discSelector.AnyDiscsSelected && keySelector.IsValid && gameInfo.Title != "" && gameInfo.DiscId.Length == 9);
}
private void onKeyValidityChanged(object? sender, EventArgs e)
{
KeySelector? keySelector = sender as KeySelector;
if (keySelector is null) return;
check();
}
private async void onDiscSelected(object? sender, EventArgs e)
{
CueSelector? cueSelector = sender as CueSelector;
if (cueSelector is null) return;
if (cueSelector.AnyDiscsSelected)
await this.gameInfo.GetGameInfo(cueSelector.Discs.First());
check();
}
}
}

View File

@ -0,0 +1,26 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Global="clr-namespace:ChovySign_GUI.Global"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="145"
x:Class="ChovySign_GUI.Psp.IsoSelector">
<!-- ISO Image selector -->
<Border Padding="10 10" HorizontalAlignment="Stretch" VerticalAlignment="Center">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="5*" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="5*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<Image HorizontalAlignment="Center" VerticalAlignment="Center" Width="120" Source="/Psp/UMD.PNG" Grid.Row="0"/>
<CheckBox Name="compressPbp" Content="Compress PBP" HorizontalAlignment="Center" Grid.Row="1"/>
</Grid>
<Global:BrowseButton Name="umdFile" Extension="iso" FileTypeName="Universal Media Disc 'UMD' Disc Image (ISO9660)" Label="UMD Image:" Grid.Column="1"/>
</Grid>
</Border>
</UserControl>

View File

@ -0,0 +1,54 @@
using Avalonia.Controls;
using GameBuilder.Psp;
using System;
namespace ChovySign_GUI.Psp
{
public partial class IsoSelector : UserControl
{
public event EventHandler<EventArgs>? UmdChanged;
protected virtual void OnUmdChanged(EventArgs e)
{
if (UmdChanged is not null)
UmdChanged(this, e);
}
public bool Compress
{
get
{
if (this.compressPbp.IsChecked is null) return false;
return (bool)this.compressPbp.IsChecked;
}
set
{
this.compressPbp.IsChecked = value;
}
}
public bool HasUmd
{
get
{
return this.umdFile.ContainsFile;
}
}
public UmdInfo? Umd
{
get
{
if (!this.umdFile.ContainsFile) return null;
return new UmdInfo(this.umdFile.FilePath);
}
}
public IsoSelector()
{
InitializeComponent();
this.umdFile.FileChanged += onUmdFileChanged;
}
private void onUmdFileChanged(object? sender, EventArgs e)
{
OnUmdChanged(new EventArgs());
}
}
}

View File

@ -0,0 +1,31 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Global="clr-namespace:ChovySign_GUI.Global"
xmlns:Psp="clr-namespace:ChovySign_GUI.Psp"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="900"
x:Class="ChovySign_GUI.Psp.PspTab">
<Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="5*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Global:KeySelector Name="keySelector" KeyIndex="2" Grid.Row="0" Grid.Column="1"/>
<Psp:IsoSelector Name="isoSelector" Grid.Row="1" Grid.Column="1"/>
<Global:ProgressStatus Name="progressStatus" Grid.Row="2" Grid.Column="1"/>
</Grid>
<!-- Credits -->
<Label Content="Li, Dots TB, SquallATF, Motoharu, Davee" VerticalAlignment="Bottom" HorizontalAlignment="Right"/>
</Grid>
</UserControl>

View File

@ -0,0 +1,87 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using ChovySign_GUI.Popup.Global;
using ChovySign_GUI.Settings;
using GameBuilder.Psp;
using LibChovy;
using LibChovy.Config;
using System;
using System.Media;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using Vita.ContentManager;
using static ChovySign_GUI.Popup.Global.MessageBox;
namespace ChovySign_GUI.Psp
{
public partial class PspTab : UserControl
{
private void check()
{
this.progressStatus.IsEnabled = (this.keySelector.IsValid && this.isoSelector.HasUmd);
}
public PspTab()
{
InitializeComponent();
keySelector.ValidStateChanged += onValidStateChange;
isoSelector.UmdChanged += onUmdChanged;
progressStatus.BeforeStart += onProcessStarting;
progressStatus.Finished += onProcessFinished;
check();
}
private async void onProcessFinished(object? sender, EventArgs e)
{
keySelector.IsEnabled = true;
isoSelector.IsEnabled = true;
SettingsTab.Settings.IsEnabled = true;
Window? currentWindow = this.VisualRoot as Window;
if (currentWindow is not Window) throw new Exception("could not find current window");
_ = App.PlayFinishSound();
await MessageBox.Show(currentWindow, "Finished creating PSP Game!\nCan now go restore it to your PSVita using Content Manager.", "Done!", MessageBoxButtons.Ok);
}
private void onProcessStarting(object? sender, EventArgs e)
{
keySelector.IsEnabled = false;
isoSelector.IsEnabled = false;
SettingsTab.Settings.IsEnabled = false;
if (keySelector.Rif is null) return;
if (keySelector.VersionKey is null) return;
NpDrmRif rifInfo = new NpDrmRif(keySelector.Rif);
NpDrmInfo drmInfo = new NpDrmInfo(keySelector.VersionKey, rifInfo.ContentId, keySelector.KeyIndex);
PspParameters pspParameters = new PspParameters(drmInfo, rifInfo);
UmdInfo? umd = isoSelector.Umd;
if (umd is null) return;
pspParameters.Umd = umd;
pspParameters.Compress = isoSelector.Compress;
// read settings from settings tab.
pspParameters.Account.Devkit = SettingsTab.Settings.DevkitMode;
SettingsReader.BackupsFolder = SettingsTab.Settings.CmaDirectory;
pspParameters.CreatePsvImg = SettingsTab.Settings.PackagePsvimg;
progressStatus.Parameters = pspParameters;
}
private void onUmdChanged(object? sender, EventArgs e)
{
check();
}
private void onValidStateChange(object? sender, EventArgs e)
{
check();
}
}
}

BIN
ChovySign-GUI/Psp/UMD.PNG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

72
ChovySign-GUI/Resource.Designer.cs generated Normal file
View File

@ -0,0 +1,72 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ChovySign_GUI {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Resource {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resource() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ChovySign_GUI.Resource", typeof(Resource).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
public static System.IO.UnmanagedMemoryStream FINISHSND {
get {
return ResourceManager.GetStream("FINISHSND", resourceCulture);
}
}
}
}

124
ChovySign-GUI/Resource.resx Normal file
View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="FINISHSND" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\Finished.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

Binary file not shown.

5
ChovySign-GUI/Roots.xml Normal file
View File

@ -0,0 +1,5 @@
<linker>
<!-- Can be removed if CompiledBinding and no reflection are used -->
<assembly fullname="ChovySign_GUI" preserve="All" />
<assembly fullname="Avalonia.Themes.Fluent" preserve="All" />
</linker>

View File

@ -0,0 +1,30 @@
using Avalonia.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ChovySign_GUI.Settings
{
public abstract class ConfigControl : UserControl
{
private string? configKey = null;
public string ConfigKey
{
get
{
if (configKey is null) return "";
return configKey;
}
set
{
configKey = value;
init();
}
}
internal abstract void init();
}
}

View File

@ -0,0 +1,11 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Global="clr-namespace:ChovySign_GUI.Global"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="85"
x:Class="ChovySign_GUI.Settings.ConfigDropDown">
<Grid>
<Global:LabeledComboBox Name="configComboBox" Label="Label"/>
</Grid>
</UserControl>

View File

@ -0,0 +1,71 @@
using Avalonia.Controls;
using ChovySign_GUI.Global;
using LibChovy.Config;
using System;
namespace ChovySign_GUI.Settings
{
public partial class ConfigDropDown : ConfigControl
{
internal override void init()
{
int? cfgInt = ChovyConfig.CurrentConfig.GetInt(ConfigKey);
if (cfgInt is null) cfgInt = 0;
this.configComboBox.SelectedIndex = (int)cfgInt;
}
public string Label
{
get
{
return this.configComboBox.Label;
}
set
{
this.configComboBox.Label = value;
}
}
public int SelectedIndex
{
get
{
return this.configComboBox.SelectedIndex;
}
set
{
this.configComboBox.SelectedIndex = value;
if (this.configComboBox.SelectedIndex < 0) return;
ChovyConfig.CurrentConfig.SetInt(ConfigKey, this.configComboBox.SelectedIndex);
}
}
public string[] Items
{
get
{
return this.configComboBox.Items;
}
set
{
this.configComboBox.Items = value;
init();
}
}
public ConfigDropDown()
{
InitializeComponent();
init();
this.configComboBox.SelectionChanged += onSelectionChange;
}
private void onSelectionChange(object? sender, EventArgs e)
{
LabeledComboBox? comboBox = sender as LabeledComboBox;
if (comboBox is null) return;
if (comboBox.SelectedIndex < 0) return;
ChovyConfig.CurrentConfig.SetInt(ConfigKey, comboBox.SelectedIndex);
}
}
}

View File

@ -0,0 +1,11 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Global="clr-namespace:ChovySign_GUI.Global"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="80"
x:Class="ChovySign_GUI.Settings.ConfigPath">
<Grid>
<Global:BrowseButton Name="configPath" Label="Label"/>
</Grid>
</UserControl>

View File

@ -0,0 +1,92 @@
using Avalonia.Controls;
using ChovySign_GUI.Global;
using LibChovy.Config;
using System;
namespace ChovySign_GUI.Settings
{
public partial class ConfigPath : ConfigControl
{
internal override void init()
{
string? cfgText = ChovyConfig.CurrentConfig.GetString(ConfigKey);
if (cfgText is null) cfgText = "";
configPath.FilePath = cfgText;
}
public string Label
{
get
{
return configPath.Label;
}
set
{
configPath.Label = value;
}
}
public string Value
{
get
{
return this.configPath.FilePath;
}
set
{
this.configPath.FilePath = value;
if(configPath.ContainsFile)
ChovyConfig.CurrentConfig.SetString(ConfigKey, this.configPath.FilePath);
}
}
public bool IsDirectory
{
get
{
return this.configPath.IsDirectory;
}
set
{
this.configPath.IsDirectory = value;
}
}
public string Extension
{
get
{
return this.configPath.Extension;
}
set
{
this.configPath.Extension = value;
}
}
public string FileTypeName
{
get
{
return this.configPath.FileTypeName;
}
set
{
this.configPath.FileTypeName = value;
}
}
public ConfigPath()
{
InitializeComponent();
init();
this.configPath.FileChanged += onFileChange;
}
private void onFileChange(object? sender, EventArgs e)
{
BrowseButton? browseBtn = sender as BrowseButton;
if (browseBtn is null) return;
if (!browseBtn.ContainsFile) return;
ChovyConfig.CurrentConfig.SetString(ConfigKey, browseBtn.FilePath);
}
}
}

View File

@ -0,0 +1,11 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Global="clr-namespace:ChovySign_GUI.Global"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="80"
x:Class="ChovySign_GUI.Settings.ConfigText">
<Grid>
<Global:LabeledTextBox Name="configText" Label="Label"/>
</Grid>
</UserControl>

View File

@ -0,0 +1,58 @@
using Avalonia.Controls;
using ChovySign_GUI.Global;
using LibChovy.Config;
using System;
namespace ChovySign_GUI.Settings
{
public partial class ConfigText : ConfigControl
{
internal override void init()
{
string? cfgText = ChovyConfig.CurrentConfig.GetString(ConfigKey);
if (cfgText is null) cfgText = "";
configText.Text = cfgText;
}
public string Label
{
get
{
return configText.Label;
}
set
{
configText.Label = value;
}
}
public string Value
{
get
{
if (this.configText.Text is null) return "";
return (string)this.configText.Text;
}
set
{
this.configText.Text = value;
ChovyConfig.CurrentConfig.SetString(ConfigKey, value);
}
}
public ConfigText()
{
InitializeComponent();
init();
this.configText.TextChanged += onTextChange;
}
private void onTextChange(object? sender, EventArgs e)
{
LabeledTextBox? txtBox = sender as LabeledTextBox;
if (txtBox is null) return;
if (txtBox.Text is null) return;
ChovyConfig.CurrentConfig.SetString(ConfigKey, txtBox.Text);
}
}
}

View File

@ -0,0 +1,10 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="80"
x:Class="ChovySign_GUI.Settings.ConfigToggle">
<Grid>
<CheckBox Name="configCheckbox" Content="Label"/>
</Grid>
</UserControl>

View File

@ -0,0 +1,133 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using ChovySign_GUI.Popup.Global;
using LibChovy.Config;
using System;
using System.Collections.Generic;
using static ChovySign_GUI.Popup.Global.MessageBox;
namespace ChovySign_GUI.Settings
{
public partial class ConfigToggle : ConfigControl
{
internal bool disableEvents = false;
private string? promptMsg = null;
private bool defaultSetting = false;
internal override void init()
{
bool? isToggleChecked = ChovyConfig.CurrentConfig.GetBool(ConfigKey);
if(isToggleChecked is null) isToggleChecked = defaultSetting;
this.disableEvents = true;
configCheckbox.IsChecked = isToggleChecked;
this.disableEvents = false;
}
public bool Default
{
get
{
return defaultSetting;
}
set
{
defaultSetting = value;
if (ChovyConfig.CurrentConfig.GetBool(ConfigKey) is null)
this.IsToggled = defaultSetting;
}
}
public string Label
{
get
{
string? content = configCheckbox.Content as string;
if (content is null) return "";
return content;
}
set
{
configCheckbox.Content = value;
}
}
public string Prompt
{
get
{
if (promptMsg is null) return "";
return promptMsg;
}
set
{
promptMsg = value;
}
}
private async void onToggleChecked(object? sender, RoutedEventArgs e)
{
if (disableEvents) return;
CheckBox? checkBox = sender as CheckBox;
if (checkBox is null) return;
bool? toggled = checkBox.IsChecked;
if (toggled is null) toggled = false;
if (promptMsg is not null)
{
Window? currentWindow = this.VisualRoot as Window;
if (currentWindow is not Window) throw new Exception("could not find current window");
MessageBoxResult res = await MessageBox.Show(currentWindow, Prompt, "Are you sure?", MessageBoxButtons.YesNo);
if (res == MessageBoxResult.Yes)
IsToggled = true;
else
IsToggled = false;
}
else{
IsToggled = true;
}
}
private void onToggleUnchecked(object? sender, RoutedEventArgs e)
{
if (disableEvents) return;
CheckBox? checkBox = sender as CheckBox;
if (checkBox is null) return;
bool? toggle = checkBox.IsChecked;
if (toggle is null) toggle = false;
IsToggled = (bool)toggle;
}
public bool IsToggled
{
get
{
if (this.configCheckbox.IsChecked is null) return false;
return (bool)this.configCheckbox.IsChecked;
}
set
{
this.disableEvents = true;
this.configCheckbox.IsChecked = value;
this.disableEvents = false;
ChovyConfig.CurrentConfig.SetBool(ConfigKey, value);
}
}
public ConfigToggle()
{
InitializeComponent();
init();
configCheckbox.Unchecked += onToggleUnchecked;
configCheckbox.Checked += onToggleChecked;
}
}
}

View File

@ -0,0 +1,59 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Settings="clr-namespace:ChovySign_GUI.Settings"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="ChovySign_GUI.Settings.SettingsTab">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Settings:ConfigToggle Name="devkitAccount"
ConfigKey="USE_DEVKIT_ACCOUNT_ID"
Label="Devkit Mode (Use 0x0000000000000000 Account ID)"
Prompt="This option will force the CMA Account ID to be all 0's&#x0a;Which is how it is on Devkit, Testkit and IDU Firmware&#x0a;Enabling this if you have a retail firmware will result in the games just *not* showing up&#x0a;&#x0a;If you DON'T know what this means, DON'T enable this.&#x0a;do you want to continue?"
HorizontalAlignment="Stretch"
Default="false"
Grid.Row="0"/>
<Settings:ConfigToggle Name="packagePsvimg"
ConfigKey="USE_CMA_PSVIMG"
Label="Use Content Manager (Package to PSVIMG)"
Default="true"
HorizontalAlignment="Stretch"
Grid.Row="1"/>
<Settings:ConfigPath Name="cmaDirectory"
ConfigKey="USE_CMA_DIRECTORY"
IsDirectory="true"
Label="Output Folder:"
HorizontalAlignment="Stretch"
Grid.Row="2"/>
<Settings:ConfigDropDown Name="libCryptMode"
ConfigKey="USE_LIBCRYPT_METHOD"
Label="LibCrypt Method:"
HorizontalAlignment="Stretch"
Grid.Row="3"/>
<Settings:ConfigDropDown Name="streamType"
ConfigKey="USE_STREAM_TYPE"
Label="Build Stream Type:"
HorizontalAlignment="Stretch"
Grid.Row="4"/>
</Grid>
</Grid>
</UserControl>

View File

@ -0,0 +1,72 @@
using Avalonia.Controls;
using GameBuilder.Pops.LibCrypt;
using GameBuilder;
using System.IO;
using Vita.ContentManager;
namespace ChovySign_GUI.Settings
{
public partial class SettingsTab : UserControl
{
public static SettingsTab? Settings;
public StreamType BuildStreamType
{
get
{
return (StreamType) this.streamType.SelectedIndex;
}
}
public LibCryptMethod LibcryptMode
{
get
{
if (this.libCryptMode.SelectedIndex == 0) return LibCryptMethod.METHOD_MAGIC_WORD;
else return LibCryptMethod.METHOD_SUB_CHANNEL;
}
}
public string CmaDirectory
{
get
{
return cmaDirectory.Value;
}
set
{
cmaDirectory.Value = value;
}
}
public bool DevkitMode
{
get
{
return devkitAccount.IsToggled;
}
}
public bool PackagePsvimg
{
get
{
return packagePsvimg.IsToggled;
}
}
public SettingsTab()
{
InitializeComponent();
libCryptMode.Items = new string[2] { "Magic Word in ISO Header", "Sub Channel PGD" };
streamType.Items = new string[2] { "MemoryStream - Create EBOOT in memory, faster, but high memory usage", "FileStream - Create EBOOT with temporary files, slower, but less memory usage" };
if (!Directory.Exists(this.CmaDirectory))
cmaDirectory.Value = SettingsReader.BackupsFolder;
Settings = this;
}
}
}

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- This manifest is used on Windows only.
Don't remove it as it might cause problems with window transparency and embeded controls.
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
<assemblyIdentity version="1.0.0.0" name="AvaloniaTest.Desktop"/>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on
and is designed to work with. Uncomment the appropriate elements
and Windows will automatically select the most compatible environment. -->
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
</assembly>

87
ChovySign2.sln Normal file
View File

@ -0,0 +1,87 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33516.290
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PspCrypto", "PspCrypto\PspCrypto.csproj", "{A60BE4C2-C0D2-42FD-BCFF-631B9AFC62FE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PbpResign", "PbpResign\PbpResign.csproj", "{834B9F97-1B63-48EB-922E-0FC155BB2481}"
ProjectSection(ProjectDependencies) = postProject
{75BBF537-8ED8-42A3-AA8B-80A730F1B3F2} = {75BBF537-8ED8-42A3-AA8B-80A730F1B3F2}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GameBuilder", "GameBuilder\GameBuilder.csproj", "{D1DF66DB-52BE-489C-A292-525BC71F2BB2}"
ProjectSection(ProjectDependencies) = postProject
{63475285-AAD2-4DE9-B698-AFC9FAA58AC8} = {63475285-AAD2-4DE9-B698-AFC9FAA58AC8}
{BF155D74-2923-432F-8566-26D83B15EEE8} = {BF155D74-2923-432F-8566-26D83B15EEE8}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ChovySign-CLI", "ChovySign-CLI\ChovySign-CLI.csproj", "{90FB2C00-CC46-4B77-8E24-C5F7458AB068}"
ProjectSection(ProjectDependencies) = postProject
{A60BE4C2-C0D2-42FD-BCFF-631B9AFC62FE} = {A60BE4C2-C0D2-42FD-BCFF-631B9AFC62FE}
{E8782E3B-ED26-4C41-BEEC-798CDD0FECCC} = {E8782E3B-ED26-4C41-BEEC-798CDD0FECCC}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscUtils", "DiscUtils\DiscUtils.csproj", "{BF155D74-2923-432F-8566-26D83B15EEE8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vita", "Vita\Vita.csproj", "{75BBF537-8ED8-42A3-AA8B-80A730F1B3F2}"
ProjectSection(ProjectDependencies) = postProject
{63475285-AAD2-4DE9-B698-AFC9FAA58AC8} = {63475285-AAD2-4DE9-B698-AFC9FAA58AC8}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiLib", "LiLib\LiLib.csproj", "{63475285-AAD2-4DE9-B698-AFC9FAA58AC8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibChovy", "LibChovy\LibChovy.csproj", "{E8782E3B-ED26-4C41-BEEC-798CDD0FECCC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChovySign-GUI", "ChovySign-GUI\ChovySign-GUI.csproj", "{902BD264-EAB6-4011-85FC-C8F8A2B11D90}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A60BE4C2-C0D2-42FD-BCFF-631B9AFC62FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A60BE4C2-C0D2-42FD-BCFF-631B9AFC62FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A60BE4C2-C0D2-42FD-BCFF-631B9AFC62FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A60BE4C2-C0D2-42FD-BCFF-631B9AFC62FE}.Release|Any CPU.Build.0 = Release|Any CPU
{834B9F97-1B63-48EB-922E-0FC155BB2481}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{834B9F97-1B63-48EB-922E-0FC155BB2481}.Debug|Any CPU.Build.0 = Debug|Any CPU
{834B9F97-1B63-48EB-922E-0FC155BB2481}.Release|Any CPU.ActiveCfg = Release|Any CPU
{834B9F97-1B63-48EB-922E-0FC155BB2481}.Release|Any CPU.Build.0 = Release|Any CPU
{D1DF66DB-52BE-489C-A292-525BC71F2BB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D1DF66DB-52BE-489C-A292-525BC71F2BB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D1DF66DB-52BE-489C-A292-525BC71F2BB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D1DF66DB-52BE-489C-A292-525BC71F2BB2}.Release|Any CPU.Build.0 = Release|Any CPU
{90FB2C00-CC46-4B77-8E24-C5F7458AB068}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{90FB2C00-CC46-4B77-8E24-C5F7458AB068}.Debug|Any CPU.Build.0 = Debug|Any CPU
{90FB2C00-CC46-4B77-8E24-C5F7458AB068}.Release|Any CPU.ActiveCfg = Release|Any CPU
{90FB2C00-CC46-4B77-8E24-C5F7458AB068}.Release|Any CPU.Build.0 = Release|Any CPU
{BF155D74-2923-432F-8566-26D83B15EEE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BF155D74-2923-432F-8566-26D83B15EEE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BF155D74-2923-432F-8566-26D83B15EEE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BF155D74-2923-432F-8566-26D83B15EEE8}.Release|Any CPU.Build.0 = Release|Any CPU
{75BBF537-8ED8-42A3-AA8B-80A730F1B3F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{75BBF537-8ED8-42A3-AA8B-80A730F1B3F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{75BBF537-8ED8-42A3-AA8B-80A730F1B3F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{75BBF537-8ED8-42A3-AA8B-80A730F1B3F2}.Release|Any CPU.Build.0 = Release|Any CPU
{63475285-AAD2-4DE9-B698-AFC9FAA58AC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{63475285-AAD2-4DE9-B698-AFC9FAA58AC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{63475285-AAD2-4DE9-B698-AFC9FAA58AC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{63475285-AAD2-4DE9-B698-AFC9FAA58AC8}.Release|Any CPU.Build.0 = Release|Any CPU
{E8782E3B-ED26-4C41-BEEC-798CDD0FECCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E8782E3B-ED26-4C41-BEEC-798CDD0FECCC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E8782E3B-ED26-4C41-BEEC-798CDD0FECCC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E8782E3B-ED26-4C41-BEEC-798CDD0FECCC}.Release|Any CPU.Build.0 = Release|Any CPU
{902BD264-EAB6-4011-85FC-C8F8A2B11D90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{902BD264-EAB6-4011-85FC-C8F8A2B11D90}.Debug|Any CPU.Build.0 = Debug|Any CPU
{902BD264-EAB6-4011-85FC-C8F8A2B11D90}.Release|Any CPU.ActiveCfg = Release|Any CPU
{902BD264-EAB6-4011-85FC-C8F8A2B11D90}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CEC62870-B8D5-4E33-9144-7C2B88EE8F73}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,61 @@
//
// Copyright (c) 2008-2011, Kenneth Bell
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
using System;
using DiscUtils.Streams;
namespace DiscUtils.ApplePartitionMap
{
internal sealed class BlockZero : IByteArraySerializable
{
public uint BlockCount;
public ushort BlockSize;
public ushort DeviceId;
public ushort DeviceType;
public ushort DriverCount;
public uint DriverData;
public ushort Signature;
public int Size
{
get { return 512; }
}
public int ReadFrom(byte[] buffer, int offset)
{
Signature = EndianUtilities.ToUInt16BigEndian(buffer, offset + 0);
BlockSize = EndianUtilities.ToUInt16BigEndian(buffer, offset + 2);
BlockCount = EndianUtilities.ToUInt32BigEndian(buffer, offset + 4);
DeviceType = EndianUtilities.ToUInt16BigEndian(buffer, offset + 8);
DeviceId = EndianUtilities.ToUInt16BigEndian(buffer, offset + 10);
DriverData = EndianUtilities.ToUInt32BigEndian(buffer, offset + 12);
DriverCount = EndianUtilities.ToUInt16LittleEndian(buffer, offset + 16);
return 512;
}
public void WriteTo(byte[] buffer, int offset)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,153 @@
//
// Copyright (c) 2008-2011, Kenneth Bell
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.ObjectModel;
using System.IO;
using DiscUtils.Partitions;
using DiscUtils.Streams;
namespace DiscUtils.ApplePartitionMap
{
/// <summary>
/// Interprets Apple Partition Map structures that partition a disk.
/// </summary>
public sealed class PartitionMap : PartitionTable
{
private readonly PartitionMapEntry[] _partitions;
private readonly Stream _stream;
/// <summary>
/// Initializes a new instance of the PartitionMap class.
/// </summary>
/// <param name="stream">Stream containing the contents of a disk.</param>
public PartitionMap(Stream stream)
{
_stream = stream;
stream.Position = 0;
byte[] initialBytes = StreamUtilities.ReadExact(stream, 1024);
BlockZero b0 = new BlockZero();
b0.ReadFrom(initialBytes, 0);
PartitionMapEntry initialPart = new PartitionMapEntry(_stream);
initialPart.ReadFrom(initialBytes, 512);
byte[] partTableData = StreamUtilities.ReadExact(stream, (int)(initialPart.MapEntries - 1) * 512);
_partitions = new PartitionMapEntry[initialPart.MapEntries - 1];
for (uint i = 0; i < initialPart.MapEntries - 1; ++i)
{
_partitions[i] = new PartitionMapEntry(_stream);
_partitions[i].ReadFrom(partTableData, (int)(512 * i));
}
}
/// <summary>
/// Gets the GUID of the disk, always returns Guid.Empty.
/// </summary>
public override Guid DiskGuid
{
get { return Guid.Empty; }
}
/// <summary>
/// Gets the partitions present on the disk.
/// </summary>
public override ReadOnlyCollection<PartitionInfo> Partitions
{
get { return new ReadOnlyCollection<PartitionInfo>(_partitions); }
}
/// <summary>
/// Creates a new partition that encompasses the entire disk.
/// </summary>
/// <param name="type">The partition type.</param>
/// <param name="active">Whether the partition is active (bootable).</param>
/// <returns>The index of the partition.</returns>
/// <remarks>The partition table must be empty before this method is called,
/// otherwise IOException is thrown.</remarks>
public override int Create(WellKnownPartitionType type, bool active)
{
throw new NotImplementedException();
}
/// <summary>
/// Creates a new partition with a target size.
/// </summary>
/// <param name="size">The target size (in bytes).</param>
/// <param name="type">The partition type.</param>
/// <param name="active">Whether the partition is active (bootable).</param>
/// <returns>The index of the new partition.</returns>
public override int Create(long size, WellKnownPartitionType type, bool active)
{
throw new NotImplementedException();
}
/// <summary>
/// Creates a new aligned partition that encompasses the entire disk.
/// </summary>
/// <param name="type">The partition type.</param>
/// <param name="active">Whether the partition is active (bootable).</param>
/// <param name="alignment">The alignment (in byte).</param>
/// <returns>The index of the partition.</returns>
/// <remarks>The partition table must be empty before this method is called,
/// otherwise IOException is thrown.</remarks>
/// <remarks>
/// Traditionally partitions were aligned to the physical structure of the underlying disk,
/// however with modern storage greater efficiency is acheived by aligning partitions on
/// large values that are a power of two.
/// </remarks>
public override int CreateAligned(WellKnownPartitionType type, bool active, int alignment)
{
throw new NotImplementedException();
}
/// <summary>
/// Creates a new aligned partition with a target size.
/// </summary>
/// <param name="size">The target size (in bytes).</param>
/// <param name="type">The partition type.</param>
/// <param name="active">Whether the partition is active (bootable).</param>
/// <param name="alignment">The alignment (in byte).</param>
/// <returns>The index of the new partition.</returns>
/// <remarks>
/// Traditionally partitions were aligned to the physical structure of the underlying disk,
/// however with modern storage greater efficiency is achieved by aligning partitions on
/// large values that are a power of two.
/// </remarks>
public override int CreateAligned(long size, WellKnownPartitionType type, bool active, int alignment)
{
throw new NotImplementedException();
}
/// <summary>
/// Deletes a partition at a given index.
/// </summary>
/// <param name="index">The index of the partition.</param>
public override void Delete(int index)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,112 @@
//
// Copyright (c) 2008-2011, Kenneth Bell
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
using System;
using System.IO;
using DiscUtils.Partitions;
using DiscUtils.Streams;
namespace DiscUtils.ApplePartitionMap
{
internal sealed class PartitionMapEntry : PartitionInfo, IByteArraySerializable
{
private readonly Stream _diskStream;
public uint BootBlock;
public uint BootBytes;
public uint Flags;
public uint LogicalBlocks;
public uint LogicalBlockStart;
public uint MapEntries;
public string Name;
public uint PhysicalBlocks;
public uint PhysicalBlockStart;
public ushort Signature;
public string Type;
public PartitionMapEntry(Stream diskStream)
{
_diskStream = diskStream;
}
public override byte BiosType
{
get { return 0xAF; }
}
public override long FirstSector
{
get { return PhysicalBlockStart; }
}
public override Guid GuidType
{
get { return Guid.Empty; }
}
public override long LastSector
{
get { return PhysicalBlockStart + PhysicalBlocks - 1; }
}
public override string TypeAsString
{
get { return Type; }
}
internal override PhysicalVolumeType VolumeType
{
get { return PhysicalVolumeType.ApplePartition; }
}
public int Size
{
get { return 512; }
}
public int ReadFrom(byte[] buffer, int offset)
{
Signature = EndianUtilities.ToUInt16BigEndian(buffer, offset + 0);
MapEntries = EndianUtilities.ToUInt32BigEndian(buffer, offset + 4);
PhysicalBlockStart = EndianUtilities.ToUInt32BigEndian(buffer, offset + 8);
PhysicalBlocks = EndianUtilities.ToUInt32BigEndian(buffer, offset + 12);
Name = EndianUtilities.BytesToString(buffer, offset + 16, 32).TrimEnd('\0');
Type = EndianUtilities.BytesToString(buffer, offset + 48, 32).TrimEnd('\0');
LogicalBlockStart = EndianUtilities.ToUInt32BigEndian(buffer, offset + 80);
LogicalBlocks = EndianUtilities.ToUInt32BigEndian(buffer, offset + 84);
Flags = EndianUtilities.ToUInt32BigEndian(buffer, offset + 88);
BootBlock = EndianUtilities.ToUInt32BigEndian(buffer, offset + 92);
BootBytes = EndianUtilities.ToUInt32BigEndian(buffer, offset + 96);
return 512;
}
public void WriteTo(byte[] buffer, int offset)
{
throw new NotImplementedException();
}
public override SparseStream Open()
{
return new SubStream(_diskStream, PhysicalBlockStart * 512, PhysicalBlocks * 512);
}
}
}

View File

@ -0,0 +1,66 @@
//
// Copyright (c) 2008-2011, Kenneth Bell
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
using System.IO;
using DiscUtils.Partitions;
using DiscUtils.Streams;
namespace DiscUtils.ApplePartitionMap
{
[PartitionTableFactory]
internal sealed class PartitionMapFactory : PartitionTableFactory
{
public override bool DetectIsPartitioned(Stream s)
{
if (s.Length < 1024)
{
return false;
}
s.Position = 0;
byte[] initialBytes = StreamUtilities.ReadExact(s, 1024);
BlockZero b0 = new BlockZero();
b0.ReadFrom(initialBytes, 0);
if (b0.Signature != 0x4552)
{
return false;
}
PartitionMapEntry initialPart = new PartitionMapEntry(s);
initialPart.ReadFrom(initialBytes, 512);
return initialPart.Signature == 0x504d;
}
public override PartitionTable DetectPartitionTable(VirtualDisk disk)
{
if (!DetectIsPartitioned(disk.Content))
{
return null;
}
return new PartitionMap(disk.Content);
}
}
}

View File

@ -0,0 +1,38 @@
//
// Copyright (c) 2008-2011, Kenneth Bell
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
namespace DiscUtils.Archives
{
internal sealed class FileRecord
{
public long Length;
public string Name;
public long Start;
public FileRecord(string name, long start, long length)
{
Name = name;
Start = start;
Length = length;
}
}
}

View File

@ -0,0 +1,144 @@
//
// Copyright (c) 2008-2011, Kenneth Bell
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.IO;
using DiscUtils.Streams;
namespace DiscUtils.Archives
{
/// <summary>
/// Minimal tar file format implementation.
/// </summary>
public sealed class TarFile
{
private readonly Dictionary<string, FileRecord> _files;
private readonly Stream _fileStream;
/// <summary>
/// Initializes a new instance of the TarFile class.
/// </summary>
/// <param name="fileStream">The Tar file.</param>
public TarFile(Stream fileStream)
{
_fileStream = fileStream;
_files = new Dictionary<string, FileRecord>();
TarHeader hdr = new TarHeader();
byte[] hdrBuf = StreamUtilities.ReadExact(_fileStream, TarHeader.Length);
hdr.ReadFrom(hdrBuf, 0);
while (hdr.FileLength != 0 || !string.IsNullOrEmpty(hdr.FileName))
{
FileRecord record = new FileRecord(hdr.FileName, _fileStream.Position, hdr.FileLength);
_files.Add(record.Name, record);
_fileStream.Position += (hdr.FileLength + 511) / 512 * 512;
hdrBuf = StreamUtilities.ReadExact(_fileStream, TarHeader.Length);
hdr.ReadFrom(hdrBuf, 0);
}
}
/// <summary>
/// Tries to open a file contained in the archive, if it exists.
/// </summary>
/// <param name="path">The path to the file within the archive.</param>
/// <param name="stream">A stream containing the file contents, or null.</param>
/// <returns><c>true</c> if the file could be opened, else <c>false</c>.</returns>
public bool TryOpenFile(string path, out Stream stream)
{
if (_files.ContainsKey(path))
{
FileRecord file = _files[path];
stream = new SubStream(_fileStream, file.Start, file.Length);
return true;
}
stream = null;
return false;
}
/// <summary>
/// Open a file contained in the archive.
/// </summary>
/// <param name="path">The path to the file within the archive.</param>
/// <returns>A stream containing the file contents.</returns>
/// <exception cref="FileNotFoundException">Thrown if the file is not found.</exception>
public Stream OpenFile(string path)
{
if (_files.ContainsKey(path))
{
FileRecord file = _files[path];
return new SubStream(_fileStream, file.Start, file.Length);
}
throw new FileNotFoundException("File is not in archive", path);
}
/// <summary>
/// Determines if a given file exists in the archive.
/// </summary>
/// <param name="path">The file path to test.</param>
/// <returns><c>true</c> if the file is present, else <c>false</c>.</returns>
public bool FileExists(string path)
{
return _files.ContainsKey(path);
}
/// <summary>
/// Determines if a given directory exists in the archive.
/// </summary>
/// <param name="path">The file path to test.</param>
/// <returns><c>true</c> if the directory is present, else <c>false</c>.</returns>
public bool DirExists(string path)
{
string searchStr = path;
searchStr = searchStr.Replace(@"\", "/");
searchStr = searchStr.EndsWith(@"/", StringComparison.Ordinal) ? searchStr : searchStr + @"/";
foreach (string filePath in _files.Keys)
{
if (filePath.StartsWith(searchStr, StringComparison.Ordinal))
{
return true;
}
}
return false;
}
internal IEnumerable<FileRecord> GetFiles(string dir)
{
string searchStr = dir;
searchStr = searchStr.Replace(@"\", "/");
searchStr = searchStr.EndsWith(@"/", StringComparison.Ordinal) ? searchStr : searchStr + @"/";
foreach (string filePath in _files.Keys)
{
if (filePath.StartsWith(searchStr, StringComparison.Ordinal))
{
yield return _files[filePath];
}
}
}
}
}

View File

@ -0,0 +1,122 @@
//
// Copyright (c) 2008-2011, Kenneth Bell
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.IO;
using DiscUtils.Streams;
namespace DiscUtils.Archives
{
/// <summary>
/// Builder to create UNIX Tar archive files.
/// </summary>
public sealed class TarFileBuilder : StreamBuilder
{
private readonly List<UnixBuildFileRecord> _files;
/// <summary>
/// Initializes a new instance of the <see cref="TarFileBuilder"/> class.
/// </summary>
public TarFileBuilder()
{
_files = new List<UnixBuildFileRecord>();
}
/// <summary>
/// Add a file to the tar archive.
/// </summary>
/// <param name="name">The name of the file.</param>
/// <param name="buffer">The file data.</param>
public void AddFile(string name, byte[] buffer)
{
_files.Add(new UnixBuildFileRecord(name, buffer));
}
/// <summary>
/// Add a file to the tar archive.
/// </summary>
/// <param name="name">The name of the file.</param>
/// <param name="buffer">The file data.</param>
/// <param name="fileMode">The access mode of the file.</param>
/// <param name="ownerId">The uid of the owner.</param>
/// <param name="groupId">The gid of the owner.</param>
/// <param name="modificationTime">The modification time for the file.</param>
public void AddFile(
string name, byte[] buffer, UnixFilePermissions fileMode, int ownerId, int groupId,
DateTime modificationTime)
{
_files.Add(new UnixBuildFileRecord(name, buffer, fileMode, ownerId, groupId, modificationTime));
}
/// <summary>
/// Add a file to the tar archive.
/// </summary>
/// <param name="name">The name of the file.</param>
/// <param name="stream">The file data.</param>
public void AddFile(string name, Stream stream)
{
_files.Add(new UnixBuildFileRecord(name, stream));
}
/// <summary>
/// Add a file to the tar archive.
/// </summary>
/// <param name="name">The name of the file.</param>
/// <param name="stream">The file data.</param>
/// <param name="fileMode">The access mode of the file.</param>
/// <param name="ownerId">The uid of the owner.</param>
/// <param name="groupId">The gid of the owner.</param>
/// <param name="modificationTime">The modification time for the file.</param>
public void AddFile(
string name, Stream stream, UnixFilePermissions fileMode, int ownerId, int groupId,
DateTime modificationTime)
{
_files.Add(new UnixBuildFileRecord(name, stream, fileMode, ownerId, groupId, modificationTime));
}
protected override List<BuilderExtent> FixExtents(out long totalLength)
{
List<BuilderExtent> result = new List<BuilderExtent>(_files.Count * 2 + 2);
long pos = 0;
foreach (UnixBuildFileRecord file in _files)
{
BuilderExtent fileContentExtent = file.Fix(pos + TarHeader.Length);
result.Add(new TarHeaderExtent(
pos, file.Name, fileContentExtent.Length, file.FileMode, file.OwnerId, file.GroupId,
file.ModificationTime));
pos += TarHeader.Length;
result.Add(fileContentExtent);
pos += MathUtilities.RoundUp(fileContentExtent.Length, 512);
}
// Two empty 512-byte blocks at end of tar file.
result.Add(new BuilderBufferExtent(pos, new byte[1024]));
totalLength = pos + 1024;
return result;
}
}
}

View File

@ -0,0 +1,102 @@
//
// Copyright (c) 2008-2011, Kenneth Bell
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
using System;
using DiscUtils.Streams;
namespace DiscUtils.Archives
{
internal sealed class TarHeader
{
public const int Length = 512;
public long FileLength;
public UnixFilePermissions FileMode;
public string FileName;
public int GroupId;
public DateTime ModificationTime;
public int OwnerId;
public void ReadFrom(byte[] buffer, int offset)
{
FileName = ReadNullTerminatedString(buffer, offset + 0, 100);
FileMode = (UnixFilePermissions)OctalToLong(ReadNullTerminatedString(buffer, offset + 100, 8));
OwnerId = (int)OctalToLong(ReadNullTerminatedString(buffer, offset + 108, 8));
GroupId = (int)OctalToLong(ReadNullTerminatedString(buffer, offset + 116, 8));
FileLength = OctalToLong(ReadNullTerminatedString(buffer, offset + 124, 12));
ModificationTime = OctalToLong(ReadNullTerminatedString(buffer, offset + 136, 12)).FromUnixTimeSeconds().DateTime;
}
public void WriteTo(byte[] buffer, int offset)
{
Array.Clear(buffer, offset, Length);
EndianUtilities.StringToBytes(FileName, buffer, offset, 99);
EndianUtilities.StringToBytes(LongToOctal((long)FileMode, 7), buffer, offset + 100, 7);
EndianUtilities.StringToBytes(LongToOctal(OwnerId, 7), buffer, offset + 108, 7);
EndianUtilities.StringToBytes(LongToOctal(GroupId, 7), buffer, offset + 116, 7);
EndianUtilities.StringToBytes(LongToOctal(FileLength, 11), buffer, offset + 124, 11);
EndianUtilities.StringToBytes(LongToOctal(Convert.ToUInt32((new DateTimeOffset(ModificationTime)).ToUnixTimeSeconds()), 11), buffer, offset + 136, 11);
// Checksum
EndianUtilities.StringToBytes(new string(' ', 8), buffer, offset + 148, 8);
long checkSum = 0;
for (int i = 0; i < 512; ++i)
{
checkSum += buffer[offset + i];
}
EndianUtilities.StringToBytes(LongToOctal(checkSum, 7), buffer, offset + 148, 7);
buffer[155] = 0;
}
private static string ReadNullTerminatedString(byte[] buffer, int offset, int length)
{
return EndianUtilities.BytesToString(buffer, offset, length).TrimEnd('\0');
}
private static long OctalToLong(string value)
{
long result = 0;
for (int i = 0; i < value.Length; ++i)
{
result = result * 8 + (value[i] - '0');
}
return result;
}
private static string LongToOctal(long value, int length)
{
string result = string.Empty;
while (value > 0)
{
result = (char)('0' + value % 8) + result;
value = value / 8;
}
return new string('0', length - result.Length) + result;
}
}
}

View File

@ -0,0 +1,68 @@
//
// Copyright (c) 2008-2011, Kenneth Bell
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
using System;
using DiscUtils.Streams;
namespace DiscUtils.Archives
{
internal sealed class TarHeaderExtent : BuilderBufferExtent
{
private readonly long _fileLength;
private readonly string _fileName;
private readonly int _groupId;
private readonly UnixFilePermissions _mode;
private readonly DateTime _modificationTime;
private readonly int _ownerId;
public TarHeaderExtent(long start, string fileName, long fileLength, UnixFilePermissions mode, int ownerId,
int groupId, DateTime modificationTime)
: base(start, 512)
{
_fileName = fileName;
_fileLength = fileLength;
_mode = mode;
_ownerId = ownerId;
_groupId = groupId;
_modificationTime = modificationTime;
}
public TarHeaderExtent(long start, string fileName, long fileLength)
: this(start, fileName, fileLength, 0, 0, 0, DateTimeOffsetExtensions.UnixEpoch) {}
protected override byte[] GetBuffer()
{
byte[] buffer = new byte[TarHeader.Length];
TarHeader header = new TarHeader();
header.FileName = _fileName;
header.FileLength = _fileLength;
header.FileMode = _mode;
header.OwnerId = _ownerId;
header.GroupId = _groupId;
header.ModificationTime = _modificationTime;
header.WriteTo(buffer, 0);
return buffer;
}
}
}

Some files were not shown because too many files have changed in this diff Show More