Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions LibOrbisPkg/GP4/Gp4Validator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ private static ValidateResult checkPkgVolumeType(Gp4Project proj, string dir)
{
case VolumeType.pkg_ps4_app:
break;
case VolumeType.pkg_ps4_patch:
break;
case VolumeType.pkg_ps4_ac_data:
break;
case VolumeType.pkg_ps4_ac_nodata:
Expand Down
22 changes: 14 additions & 8 deletions LibOrbisPkg/PKG/PkgBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,6 @@ public void BuildPkg(long pfsSize)
pkg.Metas = new MetasEntry();
pkg.Digests = new GenericEntry(EntryId.DIGESTS);
pkg.EntryNames = new NameTableEntry();
pkg.LicenseDat = GenLicense();
pkg.LicenseInfo = new GenericEntry(EntryId.LICENSE_INFO) { FileData = GenLicenseInfo() };
var paramSfoFile = project.RootDir.GetFile("sce_sys/param.sfo");
if(paramSfoFile == null)
{
Expand Down Expand Up @@ -369,10 +367,18 @@ public void BuildPkg(long pfsSize)
pkg.ChunkXml
});
}
if (volType != GP4.VolumeType.pkg_ps4_patch)
{
pkg.LicenseDat = GenLicense();
pkg.LicenseInfo = new GenericEntry(EntryId.LICENSE_INFO) { FileData = GenLicenseInfo() };
pkg.Entries.AddRange(new Entry[]
{
pkg.LicenseDat,
pkg.LicenseInfo,
});
}
pkg.Entries.AddRange(new Entry[]
{
pkg.LicenseDat,
pkg.LicenseInfo,
{
pkg.ParamSfo,
pkg.PsReservedDat
});
Expand Down Expand Up @@ -493,11 +499,9 @@ private ContentType VolTypeToContentType(GP4.VolumeType t)
switch (t)
{
case GP4.VolumeType.pkg_ps4_app:
return ContentType.GD;
case GP4.VolumeType.pkg_ps4_patch:
return ContentType.DP;
case GP4.VolumeType.pkg_ps4_remaster:
return ContentType.DP;
return ContentType.GD;
case GP4.VolumeType.pkg_ps4_ac_data:
case GP4.VolumeType.pkg_ps4_sf_theme:
case GP4.VolumeType.pkg_ps4_theme:
Expand All @@ -519,6 +523,8 @@ private ContentFlags VolTypeToContentFlags(GP4.VolumeType t)
case GP4.VolumeType.pkg_ps4_theme:
return ContentFlags.GD_AC;
case GP4.VolumeType.pkg_ps4_patch:
// TODO
return ContentFlags.PATCHGO | ContentFlags.GD_AC | ContentFlags.CUMULATIVE_PATCH;
case GP4.VolumeType.pkg_ps4_remaster:
// TODO
return ContentFlags.SUBSEQUENT_PATCH;
Expand Down
3 changes: 2 additions & 1 deletion PkgEditor/Views/GP4View.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions PkgEditor/Views/GP4View.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ private void ReloadView()
pkgTypeDropdown.SelectedIndex = 2;
entitlementKeyTextbox.Enabled = true;
break;
case VolumeType.pkg_ps4_patch:
pkgTypeDropdown.SelectedIndex = 3;
entitlementKeyTextbox.Enabled = false;
break;
default:
break;
}
Expand Down Expand Up @@ -242,7 +246,10 @@ private async void buildPkg_Click(object sender, EventArgs e)
var ofd = new SaveFileDialog();
ofd.Filter = "PKG Image|*.pkg";
ofd.Title = "Choose output path for PKG";
ofd.FileName = proj.volume.Package.ContentId + ".pkg";
if (proj.volume.Type == VolumeType.pkg_ps4_patch || proj.volume.Type == VolumeType.pkg_ps4_remaster)
ofd.FileName = proj.volume.Package.ContentId + "-patch.pkg"; // TODO: version from PARAM.SFO
else
ofd.FileName = proj.volume.Package.ContentId + ".pkg";
if (ofd.ShowDialog() == DialogResult.OK)
{
var logBox = new LogWindow();
Expand All @@ -251,12 +258,13 @@ private async void buildPkg_Click(object sender, EventArgs e)
Action<string> LogLine = x => logBox.BeginInvoke(new Action(() => writer.WriteLine(x)));
try
{
await Task.Run(() => {
await Task.Run(() =>
{
new PkgBuilder(PkgProperties.FromGp4(proj, Path.GetDirectoryName(path))).Write(ofd.FileName, LogLine);
LogLine($"Saved to {ofd.FileName}");
});
}
catch(Exception ex)
catch (Exception ex)
{
writer.WriteLine("Error: " + ex);
writer.WriteLine(ex.StackTrace);
Expand Down