Compare commits

...

4 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
39 changed files with 449 additions and 194 deletions

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<RootNamespace>ChovySign_CLI</RootNamespace> <RootNamespace>ChovySign_CLI</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>

View File

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

View File

@ -9,7 +9,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PublishDir>bin\Release\Linux</PublishDir> <PublishDir>bin\Release\Linux</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId> <_TargetId>Folder</_TargetId>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier> <RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained> <SelfContained>true</SelfContained>
<PublishSingleFile>true</PublishSingleFile> <PublishSingleFile>true</PublishSingleFile>

View File

@ -9,7 +9,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PublishDir>bin\Release\Windows</PublishDir> <PublishDir>bin\Release\Windows</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId> <_TargetId>Folder</_TargetId>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained> <SelfContained>true</SelfContained>
<PublishSingleFile>true</PublishSingleFile> <PublishSingleFile>true</PublishSingleFile>

View File

@ -1,153 +1,123 @@
<Application xmlns="https://github.com/avaloniaui" <Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ChovySign_GUI.App"> x:Class="ChovySign_GUI.App"
RequestedThemeVariant="Dark">
<Application.Styles> <Application.Styles>
<FluentTheme Mode="Light"/> <FluentTheme/>
<!-- Checkbox Styling --> <!-- Checkbox Styling -->
<Style Selector="CheckBox:checked /template/ ContentPresenter">
<Setter Property="TextBlock.Foreground"> <!-- checked -->
<Setter.Value>LightGreen</Setter.Value> <Style Selector="CheckBox:checked">
</Setter> <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> </Style>
<Style Selector="CheckBox:checked /template/ Border#NormalRectangle"> <!-- unchecked -->
<Setter Property="BorderBrush">
<Setter.Value>LightGreen</Setter.Value> <Style Selector="CheckBox:unchecked">
</Setter> <Setter Property="BorderBrush" Value="LightGreen" />
<Setter Property="Background"> <Setter Property="Foreground" Value="LightGreen" />
<Setter.Value>#3f3f3f</Setter.Value>
</Setter> <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> </Style>
<Style Selector="CheckBox:pointerover /template/ Border#NormalRectangle"> <!-- pointerover -->
<Setter Property="BorderBrush">
<Setter.Value>Green</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>#1f1f1f</Setter.Value>
</Setter>
</Style>
<Style Selector="CheckBox /template/ Border#NormalRectangle"> <Style Selector="CheckBox:pointerover">
<Setter Property="BorderBrush"> <Setter Property="BorderBrush" Value="Green" />
<Setter.Value>Green</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>#3f3f3f</Setter.Value>
</Setter>
</Style>
<Style Selector="CheckBox:pointerover /template/ ContentPresenter"> <Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="TextBlock.Foreground"> <Setter Property="Foreground" Value="Green" />
<Setter.Value>Green</Setter.Value> </Style>
</Setter>
<Style Selector="^ /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="Green" />
<Setter Property="Background" Value="#1f1f1f" />
</Style>
</Style> </Style>
<Style Selector="CheckBox">
<Setter Property="BorderBrush">
<Setter.Value>LightGreen</Setter.Value>
</Setter>
<Setter Property="Foreground">
<Setter.Value>LightGreen</Setter.Value>
</Setter>
</Style>
<!-- Button styles --> <!-- Button styles -->
<Style Selector="Button:disabled /template/ ContentPresenter">
<Setter Property="Background"> <!-- disabled -->
<Setter.Value>Black</Setter.Value> <Style Selector="Button:disabled">
</Setter> <Style Selector="^:disabled /template/ ContentPresenter">
<Setter Property="BorderBrush"> <Setter Property="Background" Value="Black" />
<Setter.Value>DarkRed</Setter.Value> <Setter Property="BorderBrush" Value="DarkRed" />
</Setter> <Setter Property="Foreground" Value="DarkRed" />
<Setter Property="TextBlock.Foreground"> </Style>
<Setter.Value>DarkRed</Setter.Value>
</Setter>
</Style> </Style>
<Style Selector="Button:pointerover /template/ ContentPresenter"> <!-- pointerover -->
<Setter Property="Background"> <Style Selector="Button:pointerover">
<Setter.Value>Red</Setter.Value> <Style Selector="^:pointerover /template/ ContentPresenter">
</Setter> <Setter Property="Background" Value="Red" />
<Setter Property="BorderBrush"> <Setter Property="BorderBrush" Value="DarkRed" />
<Setter.Value>DarkRed</Setter.Value> <Setter Property="Foreground" Value="Black" />
</Setter> </Style>
<Setter Property="TextBlock.Foreground">
<Setter.Value>Black</Setter.Value>
</Setter>
</Style> </Style>
<!-- regular -->
<Style Selector="Button"> <Style Selector="Button">
<Setter Property="BorderThickness"> <Setter Property="Background" Value="Black" />
<Setter.Value>1</Setter.Value> <Setter Property="BorderBrush" Value="Red" />
</Setter> <Setter Property="Foreground" Value="Red" />
<Setter Property="Foreground"> <Setter Property="BorderThickness" Value="1" />
<Setter.Value>Red</Setter.Value>
</Setter>
<Setter Property="BorderBrush">
<Setter.Value>Red</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>Black</Setter.Value>
</Setter>
</Style> </Style>
<!-- Textbox Styling --> <!-- Textbox Styling -->
<Style Selector="TextBox:focus"> <Style Selector="TextBox:focus">
<Setter Property="Foreground"> <Setter Property="Foreground" Value="LightGreen" />
<Setter.Value>LightGreen</Setter.Value>
</Setter> <Style Selector="^ /template/ TextBlock">
</Style> <Setter Property="Foreground" Value="LightGreen" />
</Style>
<Style Selector="TextBox:focus /template/ TextBlock"> <Style Selector="^ /template/ Border">
<Setter Property="Foreground"> <Setter Property="Background" Value="#3f3f3f" />
<Setter.Value>LightGreen</Setter.Value> <Setter Property="BorderBrush" Value="LightGreen" />
</Setter> </Style>
</Style>
<Style Selector="TextBox:focus /template/ Border">
<Setter Property="Background">
<Setter.Value>#3f3f3f</Setter.Value>
</Setter>
<Setter Property="BorderBrush">
<Setter.Value>LightGreen</Setter.Value>
</Setter>
</Style> </Style>
<Style Selector="TextBox:pointerover"> <Style Selector="TextBox:pointerover">
<Setter Property="Foreground"> <Setter Property="Foreground" Value="Green" />
<Setter.Value>Green</Setter.Value>
</Setter>
</Style>
<Style Selector="TextBox:pointerover /template/ TextBlock"> <Style Selector="^ /template/ TextBlock">
<Setter Property="Foreground"> <Setter Property="Foreground" Value="Green" />
<Setter.Value>Green</Setter.Value> </Style>
</Setter>
<Style Selector="^ /template/ Border">
<Setter Property="Background" Value="#1f1f1f" />
<Setter Property="BorderBrush" Value="Green" />
</Style>
</Style> </Style>
<Style Selector="TextBox:pointerover /template/ Border">
<Setter Property="Background">
<Setter.Value>#1f1f1f</Setter.Value>
</Setter>
<Setter Property="BorderBrush">
<Setter.Value>Green</Setter.Value>
</Setter>
</Style>
<Style Selector="TextBox"> <Style Selector="TextBox">
<Setter Property="Foreground"> <Setter Property="Foreground" Value="LightGreen" />
<Setter.Value>LightGreen</Setter.Value> <Setter Property="Background" Value="#3f3f3f" />
</Setter> <Setter Property="BorderBrush" Value="LightGreen" />
<Setter Property="Background">
<Setter.Value>#3f3f3f</Setter.Value>
</Setter>
<Setter Property="BorderBrush">
<Setter.Value>LightGreen</Setter.Value>
</Setter>
</Style> </Style>
<!-- ComboBox --> <!-- ComboBox -->

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport> <BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationManifest>app.manifest</ApplicationManifest> <ApplicationManifest>app.manifest</ApplicationManifest>
@ -39,11 +39,11 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.19" /> <PackageReference Include="Avalonia" Version="11.1.0-beta1" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.19" /> <PackageReference Include="Avalonia.Desktop" Version="11.1.0-beta1" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.--> <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.19" /> <PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.1.0-beta1" />
<PackageReference Include="XamlNameReferenceGenerator" Version="1.6.1" /> <PackageReference Include="Avalonia.Themes.Fluent" Version="11.1.0-beta1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -176,19 +176,28 @@ namespace ChovySign_GUI.Global
} }
} }
public BrowseButton() public BrowseButton()
{ {
InitializeComponent(); InitializeComponent();
this.filePath.KeyUp += onKeyPress; this.filePath.PropertyChanged += onPropertyChanged;
this.extension = ""; this.extension = "";
this.fileTypeName = "All Files"; this.fileTypeName = "All Files";
} }
private void onKeyPress(object? sender, KeyEventArgs e) private void onPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e)
{ {
OnFileChanged(new EventArgs()); 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

@ -54,13 +54,13 @@ namespace ChovySign_GUI.Global
{ {
get get
{ {
string[]? strings = this.comboBox.Items as string[]; string[]? strings = this.comboBox.ItemsSource as string[];
if (strings is null) return new string[0]; if (strings is null) return new string[0];
return strings; return strings;
} }
set set
{ {
this.comboBox.Items = value; this.comboBox.ItemsSource = value;
} }
} }

View File

@ -2,6 +2,7 @@ using Avalonia.Controls;
using Avalonia.Interactivity; using Avalonia.Interactivity;
using Avalonia.Threading; using Avalonia.Threading;
using ChovySign_GUI.Popup.Global; using ChovySign_GUI.Popup.Global;
using ChovySign_GUI.Settings;
using Li.Progress; using Li.Progress;
using LibChovy; using LibChovy;
using System; using System;
@ -13,6 +14,8 @@ namespace ChovySign_GUI.Global
public partial class ProgressStatus : UserControl public partial class ProgressStatus : UserControl
{ {
public ChovySignParameters? Parameters = null; public ChovySignParameters? Parameters = null;
public event EventHandler<EventArgs>? Finished;
public event EventHandler<EventArgs>? BeforeStart;
private ChovySign chovySign; private ChovySign chovySign;
public ProgressStatus() public ProgressStatus()
{ {
@ -21,14 +24,12 @@ namespace ChovySign_GUI.Global
chovySign = new ChovySign(); chovySign = new ChovySign();
chovySign.RegisterCallback(onProgress); chovySign.RegisterCallback(onProgress);
} }
public event EventHandler<EventArgs>? BeforeStart;
protected virtual void OnBeforeStart(EventArgs e) protected virtual void OnBeforeStart(EventArgs e)
{ {
if (BeforeStart is not null) if (BeforeStart is not null)
BeforeStart(this, e); BeforeStart(this, e);
} }
public event EventHandler<EventArgs>? Finished;
protected virtual void OnFinished(EventArgs e) protected virtual void OnFinished(EventArgs e)
{ {
@ -45,8 +46,10 @@ namespace ChovySign_GUI.Global
this.goButton.IsEnabled = false; this.goButton.IsEnabled = false;
OnBeforeStart(new EventArgs()); OnBeforeStart(new EventArgs());
// sanity check it
if(Parameters is null) { await MessageBox.Show(currentWindow, "ChovySignParameters was null, cannot start!", "Invalid Parameters", MessageBoxButtons.Ok); return; } 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 try
{ {

View File

@ -170,7 +170,7 @@ namespace ChovySign_GUI.Popup.Global
private void reloadBackupsList() private void reloadBackupsList()
{ {
this.selectBtn.IsEnabled = false; this.selectBtn.IsEnabled = false;
this.backupList.Items = new string[0]; this.backupList.ItemsSource = new string[0];
try try
{ {
string[] gameBackupDirectories = GetAllDriectories(backupSearchFolders); string[] gameBackupDirectories = GetAllDriectories(backupSearchFolders);
@ -202,7 +202,7 @@ namespace ChovySign_GUI.Popup.Global
} }
this.gameDirectories = filteredGameDirectories.ToArray(); this.gameDirectories = filteredGameDirectories.ToArray();
this.backupList.Items = gameList; this.backupList.ItemsSource = gameList;
} }
catch { } catch { }
} }

View File

@ -99,9 +99,12 @@ namespace ChovySign_GUI.Ps1
Title = disc.DiscName; Title = disc.DiscName;
DiscId = disc.DiscId; DiscId = disc.DiscId;
byte[] newCover = await Downloader.DownloadCover(disc); if (!File.Exists(this.iconFile.FilePath))
loadIcon(newCover); {
iconCache = newCover; byte[] newCover = await Downloader.DownloadCover(disc);
loadIcon(newCover);
iconCache = newCover;
}
} }
catch (Exception e) { catch (Exception e) {
Window? currentWindow = this.VisualRoot as Window; Window? currentWindow = this.VisualRoot as Window;

View File

@ -1,11 +1,9 @@
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Interactivity;
using ChovySign_GUI.Global; using ChovySign_GUI.Global;
using ChovySign_GUI.Popup.Global; using ChovySign_GUI.Popup.Global;
using ChovySign_GUI.Settings; using ChovySign_GUI.Settings;
using GameBuilder.Psp; using GameBuilder.Psp;
using LibChovy; using LibChovy;
using LibChovy.Config;
using System; using System;
using System.Linq; using System.Linq;
using Vita.ContentManager; using Vita.ContentManager;

View File

@ -3,7 +3,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Global="clr-namespace:ChovySign_GUI.Global" xmlns:Global="clr-namespace:ChovySign_GUI.Global"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="80" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="85"
x:Class="ChovySign_GUI.Settings.ConfigDropDown"> x:Class="ChovySign_GUI.Settings.ConfigDropDown">
<Grid> <Grid>
<Global:LabeledComboBox Name="configComboBox" Label="Label"/> <Global:LabeledComboBox Name="configComboBox" Label="Label"/>

View File

@ -85,6 +85,9 @@ namespace ChovySign_GUI.Settings
else else
IsToggled = false; IsToggled = false;
} }
else{
IsToggled = true;
}
} }

View File

@ -17,16 +17,41 @@
<RowDefinition Height="1*"/> <RowDefinition Height="1*"/>
<RowDefinition Height="1*"/> <RowDefinition Height="1*"/>
<RowDefinition Height="1*"/> <RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Settings:ConfigToggle Name="devkitAccount" ConfigKey="USE_DEVKIT_ACCOUNT_ID" Label="Devkit Mode (Use 0x0000000000000000 Account ID)" <Settings:ConfigToggle Name="devkitAccount"
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?" ConfigKey="USE_DEVKIT_ACCOUNT_ID"
HorizontalAlignment="Stretch" Grid.Row="0"/> 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: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: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="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>
</Grid> </Grid>

View File

@ -1,5 +1,6 @@
using Avalonia.Controls; using Avalonia.Controls;
using GameBuilder.Pops.LibCrypt; using GameBuilder.Pops.LibCrypt;
using GameBuilder;
using System.IO; using System.IO;
using Vita.ContentManager; using Vita.ContentManager;
@ -9,6 +10,14 @@ namespace ChovySign_GUI.Settings
{ {
public static SettingsTab? Settings; public static SettingsTab? Settings;
public StreamType BuildStreamType
{
get
{
return (StreamType) this.streamType.SelectedIndex;
}
}
public LibCryptMethod LibcryptMode public LibCryptMethod LibcryptMode
{ {
get get
@ -51,10 +60,12 @@ namespace ChovySign_GUI.Settings
InitializeComponent(); InitializeComponent();
libCryptMode.Items = new string[2] { "Magic Word in ISO Header", "Sub Channel PGD" }; 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)) if (!Directory.Exists(this.CmaDirectory))
cmaDirectory.Value = SettingsReader.BackupsFolder; cmaDirectory.Value = SettingsReader.BackupsFolder;
Settings = this; Settings = this;
} }
} }

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

133
GameBuilder/BuildStream.cs Normal file
View File

@ -0,0 +1,133 @@
using DiscUtils.Streams;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GameBuilder
{
public class BuildStream : Stream
{
public static StreamType BuildUsingStreamType = StreamType.TYPE_MEMORY_STREAM;
private Stream underylingStream;
private StreamType uStreamType;
private string? filename = null;
private void init()
{
this.uStreamType = BuildUsingStreamType;
if (this.uStreamType == StreamType.TYPE_MEMORY_STREAM)
{
this.underylingStream = new MemoryStream();
}
else if (this.uStreamType == StreamType.TYPE_FILE_STREAM)
{
string tmpFolder = Path.Combine(Path.GetTempPath(), "chovysign2");
Directory.CreateDirectory(tmpFolder);
this.filename = Path.Combine(tmpFolder, Guid.NewGuid().ToString());
this.underylingStream = File.Create(this.filename);
}
else
{
throw new Exception("unknown stream type");
}
}
public BuildStream(byte[] data)
{
init();
this.Write(data, 0, data.Length);
this.Seek(0x00, SeekOrigin.Begin);
}
public BuildStream()
{
init();
}
public override bool CanRead {
get {
return underylingStream.CanRead;
}
}
public override bool CanSeek {
get {
return underylingStream.CanSeek;
}
}
public override bool CanWrite {
get {
return underylingStream.CanWrite;
}
}
public override long Length {
get {
return underylingStream.Length;
}
}
public override long Position {
get {
return underylingStream.Position;
}
set {
underylingStream.Position = value;
}
}
public override void Close()
{
this.underylingStream.Close();
if(this.uStreamType == StreamType.TYPE_FILE_STREAM && this.filename is not null)
File.Delete(this.filename);
base.Close();
}
public override void Flush()
{
underylingStream.Flush();
}
public override int Read(byte[] buffer, int offset, int count)
{
return underylingStream.Read(buffer, offset, count);
}
public override long Seek(long offset, SeekOrigin origin)
{
return underylingStream.Seek(offset, origin);
}
public override void SetLength(long value)
{
underylingStream.SetLength(value);
}
public override void Write(byte[] buffer, int offset, int count)
{
underylingStream.Write(buffer, offset, count);
}
public byte[] ToArray()
{
long oldLocation = this.Position;
this.Seek(0x00, SeekOrigin.Begin);
byte[] rdData = new byte[this.Length];
this.Read(rdData, 0x00, rdData.Length);
this.Seek(oldLocation, SeekOrigin.Begin);
return rdData;
}
}
}

View File

@ -269,7 +269,7 @@ namespace GameBuilder.Cue
public byte[] CreateToc() public byte[] CreateToc()
{ {
using (MemoryStream toc = new MemoryStream()) using (BuildStream toc = new BuildStream())
{ {
StreamUtil tocUtil = new StreamUtil(toc); StreamUtil tocUtil = new StreamUtil(toc);
tocUtil.WriteBytes(createDummyTracks()); tocUtil.WriteBytes(createDummyTracks());

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

View File

@ -26,8 +26,8 @@ namespace GameBuilder.Pops
this.disc = disc; this.disc = disc;
this.cue = new CueReader(disc.CueFile); this.cue = new CueReader(disc.CueFile);
this.IsoHeader = new MemoryStream(); this.IsoHeader = new BuildStream();
this.CompressedIso = new MemoryStream(); this.CompressedIso = new BuildStream();
this.isoHeaderUtil = new StreamUtil(IsoHeader); this.isoHeaderUtil = new StreamUtil(IsoHeader);
this.atrac3Encoder = encoder; this.atrac3Encoder = encoder;
@ -189,9 +189,9 @@ namespace GameBuilder.Pops
writeCDAEntry(Convert.ToInt32(CompressedIso.Position), atracData.Length, key); writeCDAEntry(Convert.ToInt32(CompressedIso.Position), atracData.Length, key);
using (MemoryStream atracStream = new MemoryStream(atracData)) using (BuildStream atracStream = new BuildStream(atracData))
{ {
using (MemoryStream encryptedAtracStream = new MemoryStream()) using (BuildStream encryptedAtracStream = new BuildStream())
{ {
AtracCrypto.ScrambleAtracData(atracStream, encryptedAtracStream, key); AtracCrypto.ScrambleAtracData(atracStream, encryptedAtracStream, key);
encryptedAtracStream.Seek(0x00, SeekOrigin.Begin); encryptedAtracStream.Seek(0x00, SeekOrigin.Begin);
@ -241,8 +241,8 @@ namespace GameBuilder.Pops
private CueReader cue; private CueReader cue;
private PopsImg srcImg; private PopsImg srcImg;
public MemoryStream IsoHeader; public BuildStream IsoHeader;
public MemoryStream CompressedIso; public BuildStream CompressedIso;
private StreamUtil isoHeaderUtil; private StreamUtil isoHeaderUtil;
private IAtracEncoderBase atrac3Encoder; private IAtracEncoderBase atrac3Encoder;

View File

@ -12,7 +12,7 @@ namespace GameBuilder.Pops.LibCrypt
{ {
public static byte[] CreateSubchannelDat(int magicWord) public static byte[] CreateSubchannelDat(int magicWord)
{ {
using(MemoryStream subChannels = new MemoryStream()) using(BuildStream subChannels = new BuildStream())
{ {
StreamUtil subChannelsUtil = new StreamUtil(subChannels); StreamUtil subChannelsUtil = new StreamUtil(subChannels);
// this header seems to mark the start of the sub channel data. // this header seems to mark the start of the sub channel data.

View File

@ -17,7 +17,7 @@ namespace GameBuilder.Pops
public PopsImg(NpDrmInfo versionKey) : base(versionKey) public PopsImg(NpDrmInfo versionKey) : base(versionKey)
{ {
simple = new MemoryStream(); simple = new BuildStream();
simpleUtil = new StreamUtil(simple); simpleUtil = new StreamUtil(simple);
this.StartDat = NpDrmPsar.CreateStartDat(Resources.STARTDATPOPS); this.StartDat = NpDrmPsar.CreateStartDat(Resources.STARTDATPOPS);
@ -86,7 +86,7 @@ namespace GameBuilder.Pops
return loaderEnc.ToArray(); return loaderEnc.ToArray();
} }
private MemoryStream simple; private BuildStream simple;
private StreamUtil simpleUtil; private StreamUtil simpleUtil;
public byte[] EbootElf; public byte[] EbootElf;

View File

@ -50,10 +50,10 @@ namespace GameBuilder.Pops
} }
isoMap = new MemoryStream(); isoMap = new BuildStream();
isoMapUtil = new StreamUtil(isoMap); isoMapUtil = new StreamUtil(isoMap);
isoPart = new MemoryStream(); isoPart = new BuildStream();
isoPartUtil = new StreamUtil(isoPart); isoPartUtil = new StreamUtil(isoPart);
@ -174,10 +174,10 @@ namespace GameBuilder.Pops
private PSInfo[] discs; private PSInfo[] discs;
private DiscCompressor[] compressors; private DiscCompressor[] compressors;
private MemoryStream isoPart; private BuildStream isoPart;
private StreamUtil isoPartUtil; private StreamUtil isoPartUtil;
private MemoryStream isoMap; private BuildStream isoMap;
private StreamUtil isoMapUtil; private StreamUtil isoMapUtil;
} }
} }

View File

@ -17,19 +17,19 @@ namespace GameBuilder.Psp
{ {
DrmInfo = npDrmInfo; DrmInfo = npDrmInfo;
Psar = new MemoryStream(); Psar = new BuildStream();
psarUtil = new StreamUtil(Psar); psarUtil = new StreamUtil(Psar);
} }
public NpDrmInfo DrmInfo; public NpDrmInfo DrmInfo;
public MemoryStream Psar; public BuildStream Psar;
internal StreamUtil psarUtil; internal StreamUtil psarUtil;
public abstract void CreatePsar(); public abstract void CreatePsar();
public abstract byte[] GenerateDataPsp(); public abstract byte[] GenerateDataPsp();
public static byte[] CreateStartDat(byte[] image) public static byte[] CreateStartDat(byte[] image)
{ {
using(MemoryStream startDatStream = new MemoryStream()) using(BuildStream startDatStream = new BuildStream())
{ {
StreamUtil startDatUtil = new StreamUtil(startDatStream); StreamUtil startDatUtil = new StreamUtil(startDatStream);

View File

@ -21,16 +21,16 @@ namespace GameBuilder.Psp
{ {
this.compress = compress; this.compress = compress;
this.npHdr = new MemoryStream(); this.npHdr = new BuildStream();
this.npHdrUtil = new StreamUtil(npHdr); this.npHdrUtil = new StreamUtil(npHdr);
this.npHdrBody = new MemoryStream(); this.npHdrBody = new BuildStream();
this.npHdrBodyUtil = new StreamUtil(npHdrBody); this.npHdrBodyUtil = new StreamUtil(npHdrBody);
this.npTbl = new MemoryStream(); this.npTbl = new BuildStream();
this.npTblUtil = new StreamUtil(npTbl); this.npTblUtil = new StreamUtil(npTbl);
this.isoData = new MemoryStream(); this.isoData = new BuildStream();
this.isoDataUtil = new StreamUtil(isoData); this.isoDataUtil = new StreamUtil(isoData);
this.headerKey = Rng.RandomBytes(0x10); this.headerKey = Rng.RandomBytes(0x10);
@ -101,7 +101,7 @@ namespace GameBuilder.Psp
public override byte[] GenerateDataPsp() public override byte[] GenerateDataPsp()
{ {
byte[] startDat = CreateStartDat(umdImage.Minis ? Resources.STARTDATMINIS : Resources.STARTDATPSP); byte[] startDat = CreateStartDat(umdImage.Minis ? Resources.STARTDATMINIS : Resources.STARTDATPSP);
using (MemoryStream dataPsp = new MemoryStream()) using (BuildStream dataPsp = new BuildStream())
{ {
StreamUtil dataPspUtil = new StreamUtil(dataPsp); StreamUtil dataPspUtil = new StreamUtil(dataPsp);
byte[] signature = signParamSfo(umdImage.DataFiles["PARAM.SFO"]); byte[] signature = signParamSfo(umdImage.DataFiles["PARAM.SFO"]);
@ -288,16 +288,16 @@ namespace GameBuilder.Psp
private byte[] dataKey; private byte[] dataKey;
private MemoryStream npHdr; private BuildStream npHdr;
private StreamUtil npHdrUtil; private StreamUtil npHdrUtil;
private MemoryStream npHdrBody; private BuildStream npHdrBody;
private StreamUtil npHdrBodyUtil; private StreamUtil npHdrBodyUtil;
private MemoryStream isoData; private BuildStream isoData;
private StreamUtil isoDataUtil; private StreamUtil isoDataUtil;
private MemoryStream npTbl; private BuildStream npTbl;
private StreamUtil npTblUtil; private StreamUtil npTblUtil;
} }
} }

View File

@ -18,7 +18,7 @@ namespace GameBuilder.Psp
private byte[]? snd0At3; private byte[]? snd0At3;
private NpDrmPsar psar; private NpDrmPsar psar;
private short pbpVersion; private short pbpVersion;
private MemoryStream pbpStream; private BuildStream pbpStream;
public PbpBuilder(byte[] paramSfo, byte[] icon0Png, byte[]? icon1Pmf, public PbpBuilder(byte[] paramSfo, byte[] icon0Png, byte[]? icon1Pmf,
byte[]? pic0Png, byte[]? pic1Png, byte[]? snd0At3, byte[]? pic0Png, byte[]? pic1Png, byte[]? snd0At3,
@ -33,11 +33,11 @@ namespace GameBuilder.Psp
this.psar = dataPsar; this.psar = dataPsar;
this.pbpVersion = version; this.pbpVersion = version;
pbpStream = new MemoryStream(); pbpStream = new BuildStream();
psar.RegisterCallback(onProgress); psar.RegisterCallback(onProgress);
} }
public MemoryStream PbpStream public BuildStream PbpStream
{ {
get get
{ {

14
GameBuilder/StreamType.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 GameBuilder
{
public enum StreamType : uint
{
TYPE_MEMORY_STREAM,
TYPE_FILE_STREAM
}
}

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

View File

@ -1,4 +1,5 @@
using GameBuilder.Pops; using GameBuilder.Pops;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;

View File

@ -1,4 +1,6 @@
using System; using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;

View File

@ -1,4 +1,5 @@
using GameBuilder.Pops; using GameBuilder;
using GameBuilder.Pops;
using GameBuilder.Psp; using GameBuilder.Psp;
using Li.Progress; using Li.Progress;
using PspCrypto; using PspCrypto;
@ -149,6 +150,8 @@ namespace LibChovy
SceNpDrm.Aid = parameters.DrmRif.AccountId; SceNpDrm.Aid = parameters.DrmRif.AccountId;
BuildStream.BuildUsingStreamType = parameters.BuildStreamType;
if (!Directory.Exists(parameters.OutputFolder)) if (!Directory.Exists(parameters.OutputFolder))
Directory.CreateDirectory(parameters.OutputFolder); Directory.CreateDirectory(parameters.OutputFolder);

View File

@ -1,4 +1,5 @@
using GameBuilder.Psp; using GameBuilder;
using GameBuilder.Psp;
using LibChovy.Config; using LibChovy.Config;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -19,6 +20,7 @@ namespace LibChovy
this.Account = new Account(DrmRif.AccountId); this.Account = new Account(DrmRif.AccountId);
this.CreatePsvImg = true; this.CreatePsvImg = true;
this.FirmwareVersion = 0x3600000; this.FirmwareVersion = 0x3600000;
this.BuildStreamType = StreamType.TYPE_MEMORY_STREAM;
} }
public int FirmwareVersion; public int FirmwareVersion;
@ -27,7 +29,8 @@ namespace LibChovy
public NpDrmRif DrmRif; public NpDrmRif DrmRif;
public Account Account; public Account Account;
public ChovyTypes Type; public ChovyTypes Type;
public StreamType BuildStreamType;
protected string? outputFolderOverride; protected string? outputFolderOverride;

77
LibChovy/ChovyStream.cs Normal file
View File

@ -0,0 +1,77 @@
using DiscUtils.Streams;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiLib
{
public class ChovyStream : Stream
{
private Stream underylingStream;
public ChovyStream()
{
underylingStream = new MemoryStream();
}
public override bool CanRead {
get {
return underylingStream.CanRead;
}
}
public override bool CanSeek {
get {
return underylingStream.CanSeek;
}
}
public override bool CanWrite {
get {
return underylingStream.CanWrite;
}
}
public override long Length {
get {
return underylingStream.Length;
}
}
public override long Position {
get {
return underylingStream.Position;
}
set {
underylingStream.Position = value;
}
}
public override void Flush()
{
underylingStream.Flush();
}
public override int Read(byte[] buffer, int offset, int count)
{
return underylingStream.Read(buffer, offset, count);
}
public override long Seek(long offset, SeekOrigin origin)
{
return underylingStream.Seek(offset, origin);
}
public override void SetLength(long value)
{
underylingStream.SetLength(value);
}
public override void Write(byte[] buffer, int offset, int count)
{
underylingStream.Write(buffer, offset, count);
}
}
}

View File

@ -2,13 +2,13 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="SixLabors.ImageSharp" Version="3.0.1" /> <PackageReference Include="SixLabors.ImageSharp" Version="3.1.4" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -2,12 +2,12 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="CommunityToolkit.HighPerformance" Version="8.1.0" /> <PackageReference Include="CommunityToolkit.HighPerformance" Version="8.2.2" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -6,10 +6,10 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>Release</Configuration> <Configuration>Release</Configuration>
<Platform>Any CPU</Platform> <Platform>Any CPU</Platform>
<PublishDir>bin\Release\net6.0\publish\win-x64\</PublishDir> <PublishDir>bin\Release\net8.0\publish\win-x64\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId> <_TargetId>Folder</_TargetId>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained> <SelfContained>true</SelfContained>
<PublishSingleFile>true</PublishSingleFile> <PublishSingleFile>true</PublishSingleFile>

View File

@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="BouncyCastle.Cryptography" Version="2.2.1" /> <PackageReference Include="BouncyCastle.Cryptography" Version="2.3.0" />
<PackageReference Include="DotNetZip" Version="1.16.0" /> <PackageReference Include="DotNetZip" Version="1.16.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" /> <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
</ItemGroup> </ItemGroup>

View File

@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="BouncyCastle.Cryptography" Version="2.2.0" /> <PackageReference Include="BouncyCastle.Cryptography" Version="2.3.0" />
<PackageReference Include="DotNetZip" Version="1.16.0" /> <PackageReference Include="DotNetZip" Version="1.16.0" />
</ItemGroup> </ItemGroup>