Skip to content
Merged
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
32 changes: 32 additions & 0 deletions .github/release-notes/v2.4.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# BadBuilderLinux v2.4.0

Prepare a **Peer Pressure installer USB**, package Aurora and other homebrew for installation to the HDD, and choose Aurora as the default dashboard from BadBuilder.

## What's new

- **Exploit → Peer Pressure** downloads the official v1.0.477 `SoftmodInstaller.zip`, pinned to its exact release and upstream SHA-256, plus the Rock Band Blitz demo. The upstream installer, license, and bundled XeLL are preserved.
- **Homebrew** packages Aurora, XeXMenu, utilities, and custom apps through Peer Pressure's `SoftmodExtras.ini`. Existing catalog entries are retained, and homebrew does not replace the installer payload.
- **Set default dashboard → Aurora** adds the supported `DashXex` setting after verifying the executable exists. On the console, enable **Install Extras** and select **Aurora** to apply it. Use **Extras Only** for an existing Peer Pressure setup.
- Peer Pressure supplies its own payload and dashboard configuration. BadUpdate and ABadAvatar continue using their existing bootstrap and USB homebrew workflows.
- The README now covers downloads, workflow selection, Aurora setup after installation, recovery, and testing. A root changelog collects release history.

## Compatibility and backup

Peer Pressure supports Xenon, Zephyr, Falcon, Jasper, and Trinity consoles; **Corona and Winchester are unsupported**. It requires an HDD, with a mechanical SATA drive recommended. DashLaunch and its plugins are unsupported. Choose a dashboard such as Aurora for default startup; the picker also accepts executable maintenance utilities.

BadBuilder erases the selected USB. Peer Pressure installation on the console modifies NAND and HDD security sectors and can cause data loss or prevent booting. Create and keep the official installer's system backup outside the USB before reusing it. Follow the [official installation guide](https://github.com/grimdoomer/Xbox360PeerPressure/wiki/Installation).

## Validation

- 68 tests pass locally, covering the existing safety checks and Peer Pressure installer, extras, default-dashboard paths, and INI injection handling.
- The real upstream installer and built-in homebrew archives pass extraction, complete-plan installation into a temporary directory, copied-file hash comparison, and Aurora configuration checks.
- Linux and Windows self-contained builds have been checked; the release workflow builds and tests both platforms before publishing.
- Aurora default-dashboard startup has been confirmed on one physical setup. Broader console/HDD compatibility testing remains outstanding.

## Downloads

- `BadBuilder-linux-x64` — self-contained Linux x64 binary
- `BadBuilder-win-x64.exe` — self-contained Windows x64 binary
- `SHA256SUMS` — checksums for both binaries

On Linux, make the binary executable and run it without sudo. The previous v2.3.1 binaries remain available for earlier USB preparation workflows.
155 changes: 155 additions & 0 deletions BadBuilder.Tests/PeerPressureHomebrewTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
using BadBuilder.Configuration;
using BadBuilder.Services;

namespace BadBuilder.Tests;

public sealed class PeerPressureHomebrewTests
{
[Fact]
public async Task Extras_InstallAppsAndContentWithOneDefaultDashboardAndPreserveXell()
{
using TemporaryDirectory temporary = new();
BuilderConfig config = new(ArtifactCatalog.Homebrew) { SelectedExploit = ExploitOption.PeerPressure };
config.LaunchHomebrew = config.Homebrew[0];
var staged = CreateStagedArtifacts(temporary.Path, config);

var prepared = PeerPressureHomebrewService.PrepareArtifacts(config, staged);
InstallPlan plan = InstallService.BuildPlan(prepared, [], 128L * 1024 * 1024);
string target = Path.Combine(temporary.Path, "target");
Directory.CreateDirectory(target);
await InstallService.ExecuteAsync(plan, target, CancellationToken.None);

string extras = Path.Combine(target, "BadUpdatePayload", "SoftmodExtras");
Assert.Equal("aurora", await File.ReadAllTextAsync(Path.Combine(extras, "homebrew-aurora", "Aurora.xex")));
Assert.True(File.Exists(Path.Combine(extras, "homebrew-xexmenu", "Content", "menu")));
Assert.True(File.Exists(Path.Combine(extras, "homebrew-simple360nandflasher", "Default.xex")));
Assert.True(File.Exists(Path.Combine(extras, "Xell", "xell-2f.bin")));
Assert.Equal("installer", await File.ReadAllTextAsync(Path.Combine(target, "BadUpdatePayload", "default.xex")));
string ini = await File.ReadAllTextAsync(Path.Combine(extras, "SoftmodExtras.ini"));
Assert.StartsWith("; upstream comments\r\n[Xell]\r\nSource = \"Xell\"\r\n", ini, StringComparison.Ordinal);
Assert.Contains("Source = \"homebrew-aurora\"\r\nDestination = \"Hdd1:\\Apps\\Aurora\"", ini, StringComparison.Ordinal);
Assert.Contains("Source = \"homebrew-xexmenu\"\r\nDestination = \"Hdd1:\\\"", ini, StringComparison.Ordinal);
Assert.Single(ini.Split('\n'), line => line.StartsWith("DashXex", StringComparison.Ordinal));
Assert.Contains("DashXex = \"Aurora.xex\"", ini, StringComparison.Ordinal);
Assert.False(Directory.Exists(Path.Combine(target, "Apps")));
Assert.False(File.Exists(Path.Combine(target, "launch.ini")));
Assert.All(config.Homebrew, entry => Assert.DoesNotContain("SoftmodExtras", entry.Artifact.Operations![0].DestinationPath, StringComparison.Ordinal));
}

[Fact]
public void Extras_WithoutADefaultDoNotSetDashXex()
{
using TemporaryDirectory temporary = new();
BuilderConfig config = new(ArtifactCatalog.Homebrew) { SelectedExploit = ExploitOption.PeerPressure };
var prepared = PeerPressureHomebrewService.PrepareArtifacts(config, CreateStagedArtifacts(temporary.Path, config));
InstallPlan plan = InstallService.BuildPlan(prepared, [], 128L * 1024 * 1024);
var ini = Assert.Single(plan.Actions, action => action.Kind == PlannedActionKind.WriteFile);
Assert.DoesNotContain("DashXex", System.Text.Encoding.UTF8.GetString(ini.Contents!), StringComparison.Ordinal);
}

[Theory]
[InlineData("missing.xex", typeof(FileNotFoundException))]
[InlineData("../outside.xex", typeof(InvalidDataException))]
public void Extras_RejectInvalidDefaultEntryPointBeforeFormatting(string entryPoint, Type expectedError)
{
using TemporaryDirectory temporary = new();
HomebrewEntry aurora = ArtifactCatalog.Homebrew[0] with { EntryPointRelativePath = entryPoint };
BuilderConfig config = new([aurora]) { SelectedExploit = ExploitOption.PeerPressure, LaunchHomebrew = aurora };
var staged = CreateStagedArtifacts(temporary.Path, config);
Assert.Throws(expectedError, () => PeerPressureHomebrewService.PrepareArtifacts(config, staged));
}

[Fact]
public void Extras_RejectIniInjectionInAnAppName()
{
using TemporaryDirectory temporary = new();
HomebrewEntry aurora = ArtifactCatalog.Homebrew[0] with
{
Artifact = ArtifactCatalog.Homebrew[0].Artifact with { DisplayName = "Aurora\"\r\nDestination = HddSys:" }
};
BuilderConfig config = new([aurora]) { SelectedExploit = ExploitOption.PeerPressure };
Assert.Throws<InvalidDataException>(() => PeerPressureHomebrewService.PrepareArtifacts(config,
CreateStagedArtifacts(temporary.Path, config)));
}

[Fact]
public async Task Extras_SupportNestedCustomEntryPointsAndArchiveSubdirectories()
{
using TemporaryDirectory temporary = new();
HomebrewEntry app = ArtifactCatalog.Homebrew[0] with
{
EntryPointRelativePath = "bin/start.xex",
Artifact = ArtifactCatalog.Homebrew[0].Artifact with
{
DisplayName = "My App",
Operations = [new InstallOperation(InstallOperationKind.CopyDirectory, "Apps/My App", "package")]
}
};
BuilderConfig config = new([app]) { SelectedExploit = ExploitOption.PeerPressure, LaunchHomebrew = app };
var staged = CreateStagedArtifacts(temporary.Path, config);
WriteFile(Path.Combine(temporary.Path, app.Artifact.ID), "package/bin/start.xex", "custom");

var prepared = PeerPressureHomebrewService.PrepareArtifacts(config, staged);
InstallPlan plan = InstallService.BuildPlan(prepared, [], 128L * 1024 * 1024);
string target = Path.Combine(temporary.Path, "target");
Directory.CreateDirectory(target);
await InstallService.ExecuteAsync(plan, target, CancellationToken.None);

string extras = Path.Combine(target, "BadUpdatePayload", "SoftmodExtras");
Assert.Equal("custom", await File.ReadAllTextAsync(Path.Combine(extras, app.Artifact.ID, "bin", "start.xex")));
string ini = await File.ReadAllTextAsync(Path.Combine(extras, "SoftmodExtras.ini"));
Assert.Contains("Destination = \"Hdd1:\\Apps\\My App\"", ini, StringComparison.Ordinal);
Assert.Contains("DashXex = \"bin\\start.xex\"", ini, StringComparison.Ordinal);
}

[Fact]
public void Extras_WithNoAppsPreserveOriginalInstallerOperations()
{
using TemporaryDirectory temporary = new();
BuilderConfig config = new([]) { SelectedExploit = ExploitOption.PeerPressure };
var staged = CreateStagedArtifacts(temporary.Path, config);
var prepared = PeerPressureHomebrewService.PrepareArtifacts(config, staged);
Assert.Equal(staged, prepared);
}

[Fact]
public void Extras_RejectAStaleDefaultSelection()
{
BuilderConfig config = new([])
{
SelectedExploit = ExploitOption.PeerPressure,
LaunchHomebrew = ArtifactCatalog.Homebrew[0]
};
Assert.Throws<InvalidOperationException>(() => PeerPressureHomebrewService.PrepareArtifacts(config, []));
}

private static List<(ArtifactDefinition Artifact, string StagingPath)> CreateStagedArtifacts(string root, BuilderConfig config)
{
ArtifactDefinition installer = ArtifactCatalog.Exploits[ExploitOption.PeerPressure];
string installerRoot = Path.Combine(root, installer.ID);
foreach (string path in installer.Layout!.RequiredPaths!)
WriteFile(installerRoot, path, "installer");
WriteFile(installerRoot, "BadUpdatePayload/SoftmodExtras/SoftmodExtras.ini", "; upstream comments\r\n[Xell]\r\nSource = \"Xell\"\r\n");
List<(ArtifactDefinition, string)> staged = [(installer, installerRoot)];
foreach (HomebrewEntry entry in config.Homebrew)
{
string appRoot = Path.Combine(root, entry.Artifact.ID);
string file = entry.Artifact.ID switch
{
"homebrew-aurora" => "Aurora.xex",
"homebrew-xexmenu" => "Content/menu",
_ => "Simple 360 NAND Flasher/Default.xex"
};
WriteFile(appRoot, file, "aurora");
staged.Add((entry.Artifact, appRoot));
}
return staged;
}

private static void WriteFile(string root, string relative, string text)
{
string path = Path.Combine(root, relative);
Directory.CreateDirectory(Path.GetDirectoryName(path)!);
File.WriteAllText(path, text);
}
}
163 changes: 163 additions & 0 deletions BadBuilder.Tests/PeerPressureTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
using System.Security.Cryptography;
using BadBuilder.Configuration;
using BadBuilder.Services;

namespace BadBuilder.Tests;

public sealed class PeerPressureTests
{
[Fact]
public void Catalog_PinsOfficialInstallerReleaseAndChecksum()
{
GitHubReleaseSource source = Assert.IsType<GitHubReleaseSource>(
ArtifactCatalog.Exploits[ExploitOption.PeerPressure].Source);

Assert.Equal("grimdoomer", source.Owner);
Assert.Equal("Xbox360PeerPressure", source.Repo);
Assert.Equal("SoftmodInstaller.zip", source.AssetPattern);
Assert.Equal(ReleaseSelectionPolicy.ExactTag, source.ReleasePolicy);
Assert.Equal("v1.0.477", source.ReleaseTag);
Assert.Equal("7C7D42C301E72145B9D1F0A0E23FF164FDEFBBE780C2019A3CE7465E963B1827", source.PinnedSHA256);
}

[Theory]
[InlineData("XeUnshackle")]
[InlineData("XeUnshackleMax")]
[InlineData("FreeMyXe")]
public void Selection_IncludesHomebrewWithoutASeparateBootstrap(string bootstrap)
{
BuilderConfig config = new(ArtifactCatalog.Homebrew)
{
SelectedExploit = ExploitOption.PeerPressure,
SelectedBootstrap = Enum.Parse<BootstrapOption>(bootstrap),
LaunchHomebrew = ArtifactCatalog.Homebrew[0],
};

IReadOnlyList<ArtifactDefinition> selected = ArtifactCatalog.GetSelectedArtifacts(config);

Assert.True(config.IsPeerPressureInstall);
Assert.Equal(["badupdate-gamedata", "exploit-peerpressure", "homebrew-aurora", "homebrew-xexmenu", "homebrew-simple360nandflasher"],
selected.Select(artifact => artifact.ID));
Assert.DoesNotContain("XeUnshackle", config.ToString(), StringComparison.Ordinal);
Assert.Contains("Aurora", config.ToString(), StringComparison.Ordinal);
}

[Fact]
public void DashboardUpdate_StillTakesPrecedenceOverPeerPressure()
{
BuilderConfig config = new(ArtifactCatalog.Homebrew)
{
SelectedExploit = ExploitOption.PeerPressure,
FirmwareUpdateEnabled = true,
};

Assert.Equal("dashboard-update", Assert.Single(ArtifactCatalog.GetSelectedArtifacts(config)).ID);
Assert.False(config.IsPeerPressureInstall);
}

[Fact]
public async Task Install_MergesGameAndInstallerContentWithoutReplacingInstallerPayload()
{
using TemporaryDirectory temporary = new();
BuilderConfig config = new([]) { SelectedExploit = ExploitOption.PeerPressure };
List<(ArtifactDefinition Artifact, string StagingPath)> staged = [];
foreach (ArtifactDefinition artifact in ArtifactCatalog.GetSelectedArtifacts(config))
{
string root = Path.Combine(temporary.Path, artifact.ID);
Directory.CreateDirectory(root);
foreach (string required in artifact.Layout!.RequiredPaths!)
{
string path = Path.Combine(root, required);
Directory.CreateDirectory(Path.GetDirectoryName(path)!);
if (required == ".")
continue;
await File.WriteAllTextAsync(path, required);
}

string content = Path.Combine(root, "Content", "0000000000000000", "5841122D",
artifact.ID == "badupdate-gamedata" ? "000D0000/demo" : "00000001/DaTArrest_Xbox360BadUpdate");
Directory.CreateDirectory(Path.GetDirectoryName(content)!);
await File.WriteAllTextAsync(content, artifact.ID);
staged.Add((artifact, root));
}

InstallPlan plan = InstallService.BuildPlan(staged, [], 128L * 1024 * 1024);
string target = Path.Combine(temporary.Path, "target");
Directory.CreateDirectory(target);
await InstallService.ExecuteAsync(plan, target, CancellationToken.None);

Assert.Equal("BadUpdatePayload/default.xex",
await File.ReadAllTextAsync(Path.Combine(target, "BadUpdatePayload", "default.xex")));
Assert.True(File.Exists(Path.Combine(target, "BadUpdatePayload", "SoftmodData.zip")));
Assert.Equal("badupdate-gamedata", await File.ReadAllTextAsync(Path.Combine(target,
"Content", "0000000000000000", "5841122D", "000D0000", "demo")));
Assert.Equal("exploit-peerpressure", await File.ReadAllTextAsync(Path.Combine(target,
"Content", "0000000000000000", "5841122D", "00000001", "DaTArrest_Xbox360BadUpdate")));
Assert.False(File.Exists(Path.Combine(target, "launch.ini")));
}

[Theory]
[InlineData("BadUpdatePayload/default.xex")]
[InlineData("BadUpdatePayload/SoftmodData.zip")]
[InlineData("Content/0000000000000000/5841122D/00000001/DaTArrest_Xbox360BadUpdate")]
public void Install_RejectsAnIncompleteInstaller(string missingPath)
{
using TemporaryDirectory temporary = new();
ArtifactDefinition artifact = ArtifactCatalog.Exploits[ExploitOption.PeerPressure];
foreach (string required in artifact.Layout!.RequiredPaths!.Where(path => path != missingPath))
{
string path = Path.Combine(temporary.Path, required);
Directory.CreateDirectory(Path.GetDirectoryName(path)!);
File.WriteAllText(path, "fixture");
}

Assert.Throws<InvalidDataException>(() => InstallService.BuildPlan(
[(artifact, temporary.Path)], [], 128L * 1024 * 1024));
}

[Fact]
public async Task OptIn_RealArchivesPrepareInstallerUsbInTemporaryDirectory()
{
string? archives = Environment.GetEnvironmentVariable("BADBUILDER_PEER_PRESSURE_ARCHIVES");
if (string.IsNullOrWhiteSpace(archives))
return;

using TemporaryDirectory temporary = new();
BuilderConfig config = new(ArtifactCatalog.Homebrew) { SelectedExploit = ExploitOption.PeerPressure };
config.LaunchHomebrew = config.Homebrew[0];
List<(ArtifactDefinition Artifact, string StagingPath)> staged = [];
foreach (ArtifactDefinition artifact in ArtifactCatalog.GetSelectedArtifacts(config))
{
GitHubReleaseSource source = Assert.IsType<GitHubReleaseSource>(artifact.Source);
string archive = Path.Combine(archives, source.AssetPattern);
await using (FileStream stream = File.OpenRead(archive))
{
string hash = Convert.ToHexString(await SHA256.HashDataAsync(stream));
DownloadService.EnsureHashMatches(artifact.DisplayName, hash, source.PinnedSHA256);
}
string root = await ArchiveService.ExtractAsync(artifact.ID, archive, temporary.Path,
ArchiveExtractionLimits.CreateDefault(temporary.Path, 1024L * 1024 * 1024), CancellationToken.None);
staged.Add((artifact, root));
}

var prepared = PeerPressureHomebrewService.PrepareArtifacts(config, staged);
InstallPlan plan = InstallService.BuildPlan(prepared, [], 1024L * 1024 * 1024);
string target = Path.Combine(temporary.Path, "target");
Directory.CreateDirectory(target);
await InstallService.ExecuteAsync(plan, target, CancellationToken.None);

foreach (PlannedInstallAction action in plan.Actions.Where(action => action.Kind == PlannedActionKind.CopyFile &&
action.DestinationRelativePath != "BadUpdatePayload/SoftmodExtras/SoftmodExtras.ini"))
{
await using FileStream source = File.OpenRead(action.SourcePath!);
await using FileStream installed = File.OpenRead(Path.Combine(target, action.DestinationRelativePath));
Assert.Equal(await SHA256.HashDataAsync(source), await SHA256.HashDataAsync(installed));
}
string ini = await File.ReadAllTextAsync(Path.Combine(target, "BadUpdatePayload", "SoftmodExtras", "SoftmodExtras.ini"));
Assert.Contains("[Xell]", ini, StringComparison.Ordinal);
Assert.Contains("DashXex = \"Aurora.xex\"", ini, StringComparison.Ordinal);
Assert.True(File.Exists(Path.Combine(target, "BadUpdatePayload", "SoftmodExtras", "homebrew-aurora", "Aurora.xex")));
Assert.False(Directory.Exists(Path.Combine(target, "Apps")));
Assert.False(File.Exists(Path.Combine(target, "launch.ini")));
}
}
Loading
Loading