80 lines
No EOL
3 KiB
C#
80 lines
No EOL
3 KiB
C#
using System.Collections.Generic;
|
|
using System.IO;
|
|
using TeaBox.Code;
|
|
using TeaBox.Macros;
|
|
|
|
namespace TeaBox.BuildVersion
|
|
{
|
|
public class MakePs5PackageCommand : MakePackageCommand
|
|
{
|
|
public override string DefaultDiscLayout => $"ChunkMappingSB.gp5";
|
|
|
|
//Online : default settings, can be changed with this code
|
|
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 = "eboot.bin";
|
|
var onlineConfig = Path.GetFileName(EnvironmentFile);
|
|
var environmentString = $"\t<file dst_path=\"{onlineConfig}\" src_path=\"{onlineConfig}\" chunks=\"0\" />";
|
|
|
|
UpdateDiscLayout(pattern, environmentString);
|
|
}
|
|
|
|
protected override IEnumerable<string> GetFilesList()
|
|
{
|
|
return new List<string>();
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
// TODO : Symbols generation
|
|
/*var stripTool = Ps5Constants.GetStripTool();
|
|
|
|
Context.AddStep("Stripping all debug symbols",
|
|
new GenericCommand(stripTool, $" -sd {ebootbin}").Execute);*/
|
|
});
|
|
|
|
}
|
|
|
|
protected override void GeneratePackageImpl()
|
|
{
|
|
base.GeneratePackageImpl();
|
|
var packageName = $"{UAFConstants.GameName}_pkg_{DataChangelist}_{Variant}.pkg";
|
|
var isoName = $"{UAFConstants.GameName}_iso_{DataChangelist}_{Variant}.iso";
|
|
|
|
PkgTool = Ps5Constants.GetPackageTool();
|
|
|
|
Context.AddStep("Creating package",
|
|
new GenericCommand(PkgTool, $"img_create --oformat {PkgFormat} \"{LayoutPath}\" \"{Path.Combine(OutputDirectory, packageName)}\"").Execute);
|
|
Context.AddStep("Creating iso",
|
|
new GenericCommand(PkgTool, $"iso_convert --compress on \"{Path.Combine(OutputDirectory, packageName)}\" \"{Path.Combine(OutputDirectory, isoName)}\"").Execute);
|
|
}
|
|
}
|
|
} |