diff --git a/.gitignore b/.gitignore index 19aaf3e..327a72a 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,9 @@ GameBuilder/obj/* PspCrypto/bin/* PspCrypto/obj/* +LibChovy/bin/* +LibChovy/obj/* + LiLib/bin/* LiLib/obj/* diff --git a/ChovySign-CLI/ChovySign-CLI.csproj b/ChovySign-CLI/ChovySign-CLI.csproj index 88eee96..002e97a 100644 --- a/ChovySign-CLI/ChovySign-CLI.csproj +++ b/ChovySign-CLI/ChovySign-CLI.csproj @@ -1,4 +1,4 @@ - + Exe @@ -10,21 +10,7 @@ - - - - - True - True - Resources.resx - - - - - - PublicResXFileCodeGenerator - Resources.Designer.cs - + diff --git a/ChovySign-CLI/Program.cs b/ChovySign-CLI/Program.cs index 6588983..c30bb21 100644 --- a/ChovySign-CLI/Program.cs +++ b/ChovySign-CLI/Program.cs @@ -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(); diff --git a/GameBuilder/Atrac3/Atrac3ToolEncoder.cs b/GameBuilder/Atrac3/Atrac3ToolEncoder.cs index e29aec7..421def3 100644 --- a/GameBuilder/Atrac3/Atrac3ToolEncoder.cs +++ b/GameBuilder/Atrac3/Atrac3ToolEncoder.cs @@ -1,4 +1,4 @@ -using Org.BouncyCastle.Crypto.IO; +using Li.Utilities; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/LibChovy/ChovySign.cs b/LibChovy/ChovySign.cs new file mode 100644 index 0000000..9579404 --- /dev/null +++ b/LibChovy/ChovySign.cs @@ -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() + { + + } + } +} diff --git a/LibChovy/ChovySignParameters.cs b/LibChovy/ChovySignParameters.cs new file mode 100644 index 0000000..9047a52 --- /dev/null +++ b/LibChovy/ChovySignParameters.cs @@ -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; + + } +} diff --git a/LibChovy/ChovyTypes.cs b/LibChovy/ChovyTypes.cs new file mode 100644 index 0000000..5824ade --- /dev/null +++ b/LibChovy/ChovyTypes.cs @@ -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 + } +} diff --git a/LibChovy/LibChovy.csproj b/LibChovy/LibChovy.csproj new file mode 100644 index 0000000..e78df9b --- /dev/null +++ b/LibChovy/LibChovy.csproj @@ -0,0 +1,29 @@ + + + + Exe + net6.0 + enable + enable + + + + + + + + + True + True + Resources.resx + + + + + + PublicResXFileCodeGenerator + Resources.Designer.cs + + + + diff --git a/LibChovy/PopsParameters.cs b/LibChovy/PopsParameters.cs new file mode 100644 index 0000000..d02bb62 --- /dev/null +++ b/LibChovy/PopsParameters.cs @@ -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; + } + } + } +} diff --git a/LibChovy/PspParameters.cs b/LibChovy/PspParameters.cs new file mode 100644 index 0000000..804c66e --- /dev/null +++ b/LibChovy/PspParameters.cs @@ -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() + { + + } + } +} diff --git a/ChovySign-CLI/Resources.Designer.cs b/LibChovy/Resources.Designer.cs similarity index 80% rename from ChovySign-CLI/Resources.Designer.cs rename to LibChovy/Resources.Designer.cs index 9624b0c..76cb0c1 100644 --- a/ChovySign-CLI/Resources.Designer.cs +++ b/LibChovy/Resources.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -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 { } /// - /// Looks up a localized resource of type System.Byte[]. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// - public static byte[] PIC1 { + public static System.Drawing.Bitmap PIC0 { + get { + object obj = ResourceManager.GetObject("PIC0", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap PIC1 { get { object obj = ResourceManager.GetObject("PIC1", resourceCulture); - return ((byte[])(obj)); + return ((System.Drawing.Bitmap)(obj)); } } } diff --git a/ChovySign-CLI/Resources.resx b/LibChovy/Resources.resx similarity index 93% rename from ChovySign-CLI/Resources.resx rename to LibChovy/Resources.resx index 58f7389..f1b5140 100644 --- a/ChovySign-CLI/Resources.resx +++ b/LibChovy/Resources.resx @@ -118,7 +118,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Resources\PIC0.PNG;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + - Resources\PIC1.PNG;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + Resources\PIC1.PNG;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/LibChovy/Resources/PIC0.PNG b/LibChovy/Resources/PIC0.PNG new file mode 100644 index 0000000..fd87f84 Binary files /dev/null and b/LibChovy/Resources/PIC0.PNG differ diff --git a/ChovySign-CLI/Resources/PIC1.PNG b/LibChovy/Resources/PIC1.PNG similarity index 100% rename from ChovySign-CLI/Resources/PIC1.PNG rename to LibChovy/Resources/PIC1.PNG diff --git a/PIC0.pdn b/PIC0.pdn new file mode 100644 index 0000000..30c9195 Binary files /dev/null and b/PIC0.pdn differ diff --git a/PspTest.sln b/PspTest.sln index 9459107..45acf9d 100644 --- a/PspTest.sln +++ b/PspTest.sln @@ -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 diff --git a/Vita/ContentManager/SettingsReader.cs b/Vita/ContentManager/SettingsReader.cs new file mode 100644 index 0000000..fbc30bb --- /dev/null +++ b/Vita/ContentManager/SettingsReader.cs @@ -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; + } + } +}