Initial
Rust validation / Windows x64 build and tests (push) Waiting to run
Rust validation / Formatting (push) Failing after 27s
EonaCat/ci-workflows: SonarQube / sonar (push) Successful in 45s

This commit is contained in:
EonaCat committed 2026-12-04 21:08:34 +01:00
1 parent 2cff35f215
commit 0f7377a1b5
359 files changed
+253980 -74

No files matched your search

@@ -0,0 +1,120 @@
using System.Text.RegularExpressions;
namespace EonaCat.XSBOX.Launcher;
internal sealed class PreloadProgressDialog : Form
{
static readonly Regex PipelineProgress = new(@"(?<done>\d+) of (?<total>\d+)");
static readonly Regex ShaderCount = new(@"(?<count>\d+) shaders so far");
static readonly Regex PipelineCount = new(@"(?<count>\d+) pipelines known");
readonly StackPanel stack = new() { Dock = DockStyle.Fill, AutoScroll = false };
readonly Panel accent = new() { Dock = DockStyle.Left, BackColor = Color.FromArgb(225, 48, 65) };
readonly WrapLabel heading = new() { Font = Ui.Font(17, FontStyle.Bold), ForeColor = Color.White };
readonly WrapLabel description = new() { ForeColor = Color.FromArgb(205, 194, 198) };
readonly WrapLabel detail = new() { Font = Ui.Font(8.5f), ForeColor = Color.FromArgb(155, 151, 158) };
readonly StretchProgressBar progress = new() { Height = Ui.S(12) };
readonly System.Windows.Forms.Timer closeTimer = new() { Interval = 1100 };
public PreloadProgressDialog()
{
Text = "EonaCat.XSBOX - Preparing game";
Icon = LauncherBrand.CreateIcon();
AutoScaleMode = AutoScaleMode.None;
ClientSize = new Size(Ui.S(540), Ui.S(230));
FormBorderStyle = FormBorderStyle.FixedDialog;
StartPosition = FormStartPosition.CenterScreen;
MaximizeBox = false; MinimizeBox = false; ShowInTaskbar = false;
BackColor = Color.FromArgb(18, 18, 22); ForeColor = Color.White;
Font = Ui.Font(9.5f);
ControlBox = false;
accent.Width = Ui.S(5);
stack.Padding = new Padding(Ui.S(26), Ui.S(20), Ui.S(26), Ui.S(18));
var brand = new WrapLabel
{
Text = "EONACAT / XS",
Font = Ui.Font(9, FontStyle.Bold),
ForeColor = Color.FromArgb(245, 65, 78),
Margin = new Padding(0, 0, 0, Ui.S(6))
};
heading.Text = "Preparing your game";
heading.Margin = new Padding(0, 0, 0, Ui.S(6));
description.Text = "The first launch can take a little while. This only needs to be done once per shader cache.";
description.Margin = new Padding(0, 0, 0, Ui.S(12));
progress.Style = ProgressBarStyle.Marquee;
progress.MarqueeAnimationSpeed = 24;
progress.Margin = new Padding(0, 0, 0, Ui.S(10));
detail.Text = "Starting shader compiler…";
stack.Controls.AddRange([brand, heading, description, progress, detail]);
Controls.Add(stack);
Controls.Add(accent);
closeTimer.Tick += (_, _) => { closeTimer.Stop(); Close(); };
FitHeight();
}
/// <summary>Grows or shrinks the dialog so wrapped text is never cut off.</summary>
void FitHeight()
{
var wanted = Math.Max(Ui.S(210), stack.Measure(ClientSize.Width - accent.Width));
if (wanted != ClientSize.Height) ClientSize = new Size(ClientSize.Width, wanted);
}
public void SetStage(string title, string explanation)
{
if (IsDisposed) return;
heading.Text = title;
description.Text = explanation;
detail.Text = "Working… your progress is saved as each item completes.";
FitHeight();
}
public void SetDetail(string line)
{
if (IsDisposed || string.IsNullOrWhiteSpace(line)) return;
string? text = null;
var match = PipelineProgress.Match(line);
if (match.Success && int.TryParse(match.Groups["done"].Value, out var done) && int.TryParse(match.Groups["total"].Value, out var total) && total > 0)
{
progress.Style = ProgressBarStyle.Continuous;
progress.MarqueeAnimationSpeed = 0;
progress.Minimum = 0; progress.Maximum = 100;
progress.Value = Math.Clamp((int)(done * 100L / total), 0, 100);
text = $"Building pipelines: {done:N0} of {total:N0}";
}
else if (line.Contains("shaders so far", StringComparison.OrdinalIgnoreCase))
{
var count = ShaderCount.Match(line);
text = count.Success ? $"Translated {count.Groups["count"].Value} shaders so far…" : "Compiling shaders…";
}
else if (line.Contains("pipelines known", StringComparison.OrdinalIgnoreCase))
{
var count = PipelineCount.Match(line);
text = count.Success ? $"Found {count.Groups["count"].Value} known pipelines; preparing build…" : "Preparing graphics pipelines…";
}
if (text != null && text != detail.Text) detail.Text = text;
}
public void Complete(bool success)
{
if (IsDisposed) return;
heading.Text = success ? "You're all set!" : "Preload finished with warnings";
description.Text = success
? "Shaders and graphics pipelines are ready. Starting your game now."
: "The game will still start. Any unfinished work can be retried on the next launch.";
detail.Text = success ? "Preparation complete" : "Continuing to game startup";
progress.Style = ProgressBarStyle.Continuous;
progress.MarqueeAnimationSpeed = 0;
progress.Value = 100;
FitHeight();
closeTimer.Start();
}
protected override void Dispose(bool disposing)
{
if (disposing) closeTimer.Dispose();
base.Dispose(disposing);
}
}