start moving to other lib

This commit is contained in:
Li 2023-04-18 15:10:03 +12:00
parent eeabf1a33a
commit 537b1b1229
17 changed files with 299 additions and 29 deletions

3
.gitignore vendored
View File

@ -20,6 +20,9 @@ GameBuilder/obj/*
PspCrypto/bin/*
PspCrypto/obj/*
LibChovy/bin/*
LibChovy/obj/*
LiLib/bin/*
LiLib/obj/*

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
@ -10,21 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\GameBuilder\GameBuilder.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<ProjectReference Include="..\LibChovy\LibChovy.csproj" />
</ItemGroup>
</Project>

View File

@ -3,8 +3,6 @@ using GameBuilder.Pops;
using GameBuilder.Psp;
using GameBuilder.VersionKey;
using PspCrypto;
using System.Reflection.PortableExecutable;
using System.IO.Pipes;
namespace ChovySign_CLI
{
@ -225,7 +223,7 @@ namespace ChovySign_CLI
if (discs.Length == 1)
{
using (PbpBuilder pbpBuilder = new PbpBuilder(sfo, File.ReadAllBytes(popsIcon0File), null, (popsPic0File is not null) ? File.ReadAllBytes(popsPic0File) : null, Resources.PIC1, null, new PsIsoImg(drmInfo, discInfs.First()), 0))
using (PbpBuilder pbpBuilder = new PbpBuilder(sfo, File.ReadAllBytes(popsIcon0File), null, (popsPic0File is not null) ? File.ReadAllBytes(popsPic0File) : null, LibChovy.Resources.PIC1, null, new PsIsoImg(drmInfo, discInfs.First()), 0))
{
pbpBuilder.RegisterCallback(onProgress);
pbpBuilder.CreatePsarAndPbp();

View File

@ -1,4 +1,4 @@
using Org.BouncyCastle.Crypto.IO;
using Li.Utilities;
using System;
using System.Collections.Generic;
using System.Diagnostics;

30
LibChovy/ChovySign.cs Normal file
View File

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LibChovy
{
public class ChovySign
{
public void createPOPS()
{
}
public void createPOPSMultiDisc()
{
}
public void createPSP()
{
}
public void Go()
{
}
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LibChovy
{
public abstract class ChovySignParameters
{
public ChovyTypes Type;
public bool MakePSVIMG;
public bool ForceDevkitAid;
}
}

14
LibChovy/ChovyTypes.cs Normal file
View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LibChovy
{
public enum ChovyTypes
{
POPS,
PSP
}
}

29
LibChovy/LibChovy.csproj Normal file
View File

@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
<Compile Update="Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LibChovy
{
public class PopsParameters : ChovySignParameters
{
//public int SetSDKVersion
public string[] DiscList;
public string DiscName;
public Bitmap? Icon0Override;
public Bitmap? Pic0Override;
public Bitmap? Pic1Override;
public bool MultiDisc
{
get
{
return DiscList.Length > 1;
}
}
}
}

16
LibChovy/PspParameters.cs Normal file
View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LibChovy
{
public class PspParameters : ChovySignParameters
{
public PspParameters()
{
}
}
}

View File

@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace ChovySign_CLI {
namespace LibChovy {
using System;
@ -39,7 +39,7 @@ namespace ChovySign_CLI {
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ChovySign_CLI.Resources", typeof(Resources).Assembly);
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LibChovy.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
@ -61,12 +61,22 @@ namespace ChovySign_CLI {
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static byte[] PIC1 {
public static System.Drawing.Bitmap PIC0 {
get {
object obj = ResourceManager.GetObject("PIC0", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap PIC1 {
get {
object obj = ResourceManager.GetObject("PIC1", resourceCulture);
return ((byte[])(obj));
return ((System.Drawing.Bitmap)(obj));
}
}
}

View File

@ -118,7 +118,10 @@
<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="PIC0" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\PIC0.PNG;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="PIC1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\PIC1.PNG;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>Resources\PIC1.PNG;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

BIN
LibChovy/Resources/PIC0.PNG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
PIC0.pdn Normal file

Binary file not shown.

View File

@ -10,7 +10,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PbpResign", "PbpResign\PbpR
{75BBF537-8ED8-42A3-AA8B-80A730F1B3F2} = {75BBF537-8ED8-42A3-AA8B-80A730F1B3F2}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GameBuilder", "PopsBuilder\GameBuilder.csproj", "{D1DF66DB-52BE-489C-A292-525BC71F2BB2}"
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}
@ -19,16 +19,19 @@ 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("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vita", "Vita\Vita.csproj", "{75BBF537-8ED8-42A3-AA8B-80A730F1B3F2}"
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("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiLib", "LiLib\LiLib.csproj", "{63475285-AAD2-4DE9-B698-AFC9FAA58AC8}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiLib", "LiLib\LiLib.csproj", "{63475285-AAD2-4DE9-B698-AFC9FAA58AC8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibChovy", "LibChovy\LibChovy.csproj", "{E8782E3B-ED26-4C41-BEEC-798CDD0FECCC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -64,6 +67,10 @@ Global
{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
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,130 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Vita.ContentManager
{
public class SettingsReader
{
public static string AppFolder
{
get
{
return Path.Combine(BackupsFolder, "APP");
}
}
public static string PspSavedataFolder
{
get
{
return Path.Combine(BackupsFolder, "PSAVEDATA");
}
}
public static string PsmFolder
{
get
{
return Path.Combine(BackupsFolder, "PSM");
}
}
public static string SystemFolder
{
get
{
return Path.Combine(BackupsFolder, "SYSTEM");
}
}
public static string Ps1Folder
{
get
{
return Path.Combine(BackupsFolder, "PSGAME");
}
}
public static string PspFolder
{
get
{
return Path.Combine(BackupsFolder, "PGAME");
}
}
public static string BackupsFolder
{
get
{
string? cmaFolder = getQcmaPSVitaFolder();
if (cmaFolder is not null) return cmaFolder;
cmaFolder = getDevkitCmaPSVitaFolder();
if (cmaFolder is not null) return cmaFolder;
cmaFolder = getSonyCmaPSVitaFolder();
if (cmaFolder is not null) return cmaFolder;
return getDefaultCmaPSVitaFolder();
}
}
private static string getDefaultCmaPSVitaFolder()
{
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "PS Vita");
}
private static string? getRegistryKey(string registryPath, string keyName)
{
if (OperatingSystem.IsWindows())
{
using (RegistryKey? regKey = Registry.CurrentUser.OpenSubKey(registryPath))
{
if (regKey is null) return null;
string? keyData = (regKey.GetValue(keyName) as string);
if (keyData is null) return null;
return keyData;
}
}
else
{
throw new PlatformNotSupportedException("cannot use registry on os other than windows");
}
}
private static string? getSonyCmaPSVitaFolder()
{
if (OperatingSystem.IsWindows())
{
return getRegistryKey(@"Software\Sony Corporation\Sony Corporation\Content Manager Assistant\Settings", "ApplicationHomePath");
}
return null;
}
private static string? getDevkitCmaPSVitaFolder()
{
if (OperatingSystem.IsWindows())
{
return getRegistryKey(@"Software\SCE\PSP2\Content Manager Assistant for PlayStation(R)Vita DevKit\Settings", "ApplicationHomePath");
}
return null;
}
private static string? getQcmaPSVitaFolder()
{
if (OperatingSystem.IsWindows())
{
using(RegistryKey? qcmaKey = Registry.CurrentUser.OpenSubKey(@"Software\codestation\qcma"))
{
return getRegistryKey(@"Software\codestation\qcma", "appsPath");
}
}
else if (OperatingSystem.IsLinux())
{
string qcmaConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".config", "codestation", "qcma.conf");
// TODO: read file
}
else if (OperatingSystem.IsMacOS())
{
string qcmaConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", "Preferences", "com.codestation.qcma.plist");
// TODO: read file
}
return null;
}
}
}