73 lines
No EOL
2.6 KiB
C#
73 lines
No EOL
2.6 KiB
C#
using System.Collections.Generic;
|
|
using System.IO;
|
|
using TeaBox.Code;
|
|
using TeaBox.Macros;
|
|
|
|
namespace TeaBox.BuildVersion
|
|
{
|
|
public class MakePs4PackageCommand : MakePackageCommand
|
|
{
|
|
public override string DefaultDiscLayout => $"ChunkMapping_{Region.GetPlatformRegionName(Platform.Orbis)}.gp4";
|
|
|
|
protected override void SetOnlineEnvironmentImpl()
|
|
{
|
|
// Environment none, uat are default ones, don't need to change anything on the disc layout
|
|
if (GameOnlineEnvironment == GameOnlineEnvironment.Default || GameOnlineEnvironment.ToString().ToLower() == "uat" || GameOnlineEnvironment.ToString().ToLower() == "")
|
|
{
|
|
Context.LogWarning($"Selected environment: - {GameOnlineEnvironment} - doesn't require any changes");
|
|
return;
|
|
}
|
|
|
|
base.SetOnlineEnvironmentImpl();
|
|
|
|
const string pattern = "param.sfo";
|
|
var onlineConfig = Path.GetFileName(EnvironmentFile);
|
|
var environmentString = $"\t<file targ_path=\"{onlineConfig}\" orig_path=\"{onlineConfig}\" chunks=\"0\" />";
|
|
|
|
UpdateDiscLayout(pattern, environmentString);
|
|
}
|
|
|
|
protected override IEnumerable<string> GetFilesList()
|
|
{
|
|
return new List<string> { $@"sce_sys\param_{Sku}.sfo", $@"sce_sys\nptitle_{Sku}.dat" };
|
|
}
|
|
|
|
protected override void PrePackageImpl()
|
|
{
|
|
base.PrePackageImpl();
|
|
|
|
var engine = Path.Combine(WorkingDirectory, EngineExecutable.ExecutableName);
|
|
var ebootbin = Path.Combine(WorkingDirectory, EngineExecutable.DiscExecutableName);
|
|
|
|
Context.AddStep($"Copy/Rename engine from {engine} to {ebootbin}", stepcontext =>
|
|
{
|
|
if (!File.Exists(engine))
|
|
{
|
|
throw new MacroException($"Cannot find file {engine}");
|
|
}
|
|
|
|
System.IO.File.Copy(engine, ebootbin, true);
|
|
|
|
if (GameType == GameType.Dev)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var stripTool = Ps4Constants.GetStripTool();
|
|
|
|
Context.AddStep("Stripping all debug symbols",
|
|
new GenericCommand(stripTool, $" -sd {ebootbin}").Execute);
|
|
});
|
|
|
|
}
|
|
|
|
protected override void GeneratePackageImpl()
|
|
{
|
|
base.GeneratePackageImpl();
|
|
|
|
PkgTool = Ps4Constants.GetPackageTool();
|
|
Context.AddStep("Creating package",
|
|
new GenericCommand(PkgTool, $"img_create --oformat {PkgFormat} \"{LayoutPath}\" \"{OutputDirectory}\"").Execute);
|
|
}
|
|
}
|
|
} |