Add passive F2 diagnostics overlay with persistent session visibility

This commit is contained in:
UnixNight committed 2026-10-25 02:17:40 -04:00
1 parent 20aa1bc2b9
commit 113e9a41cc
17 files changed
+414 -24

No files matched your search

@@ -0,0 +1,82 @@
using System.Globalization;
using System.Numerics;
namespace GamePort.Application;
public readonly record struct DebugMotion(Vector3 Velocity, float TurnRate, string Pose,
int Steps, int Jumps, int WallHits, int JetpackState, float JetpackRemaining,
int Shot, bool Blocked, int VulkanErrors, bool Paused);
/// <summary>Modern read-only gameplay diagnostics and measured wall-frame timing.</summary>
public sealed class DebugDiagnostics
{
public const uint ToggleKey = 59; // SDL scancode F2.
public const int MaxLines = 12, MaxColumns = 58;
private const double SampleSeconds = .5;
private double windowSeconds;
private long windowFrames;
private bool publishedWindow;
public bool Enabled { get; set; }
public double FramesPerSecond { get; private set; }
public double FrameMilliseconds { get; private set; }
public long Frames { get; private set; }
/// <summary>
/// Count all rendered frames; timing uses only positive elapsed samples.
/// Show the running mean initially, then publish each half-second window.
/// Caller supplies wall time, independently of paused simulation time.
/// </summary>
public void ObserveFrame(double seconds)
{
if (!double.IsFinite(seconds) || seconds < 0) throw new ArgumentOutOfRangeException(nameof(seconds));
Frames++;
if (seconds == 0) return;
windowSeconds = Finite(windowSeconds + seconds);
windowFrames++;
if (!publishedWindow || windowSeconds >= SampleSeconds)
{
var mean = windowSeconds / windowFrames;
FramesPerSecond = Finite(1 / mean);
FrameMilliseconds = Finite(mean * 1000);
}
if (windowSeconds >= SampleSeconds)
{
publishedWindow = true;
windowSeconds = 0;
windowFrames = 0;
}
}
public string[] Lines(DebugStatus status, DebugMotion motion)
{
if (!Enabled) return [];
ArgumentNullException.ThrowIfNull(status);
static string F(float value) => value.ToString("0.0", CultureInfo.InvariantCulture);
static string B(bool value) => value ? "T" : "F";
static string I(FormattableString text) => FormattableString.Invariant(text);
var camera = status.CameraMode ?? (status.Inspecting ? "ORBIT" :
string.Equals(status.Cutscene, "NONE", StringComparison.OrdinalIgnoreCase) ? "GAMEPLAY" : "CUTSCENE");
string[] lines = [
I($"DEBUG F2 | FPS {FramesPerSecond:0.0} | {FrameMilliseconds:0.00} MS"),
I($"LEVEL {status.Level} START {status.Start}"),
I($"ROOT X {F(status.Root.X)} Y {F(status.Root.Y)} Z {F(status.Root.Z)}"),
I($"VEL X {F(motion.Velocity.X)} Y {F(motion.Velocity.Y)} Z {F(motion.Velocity.Z)}"),
I($"YAW {F(status.Yaw)} SPEED {F(status.Speed)} TURN {F(motion.TurnRate)}"),
I($"GROUND {B(status.Grounded)} POSE {motion.Pose} ENERGY {F(status.Energy)}"),
I($"CTRL {B(status.Controlled)} FORCE {B(status.ForcedControl)} PAUSED {B(motion.Paused)}"),
I($"SCENE {status.SceneTask} SCORE {status.Score} JETPACK {motion.JetpackState} {F(motion.JetpackRemaining)}S"),
I($"CAM {camera} FAR {F(status.FarPlane)}"),
I($"CUT {status.Cutscene} SHOT {motion.Shot} BLOCK {B(motion.Blocked)}"),
I($"STEPS {motion.Steps} JUMPS {motion.Jumps} WALL {motion.WallHits}"),
I($"ISSUES {status.Issues} VK ERR {motion.VulkanErrors} FRAME {Frames}")
];
for (var i = 0; i < lines.Length; i++)
{
var line = lines[i].Replace('\r', ' ').Replace('\n', ' ');
lines[i] = line.Length > MaxColumns ? line[..MaxColumns] : line;
}
return lines;
}
private static double Finite(double value) => double.IsFinite(value) ? value : double.MaxValue;
}
+6 -4
View File
@@ -5,17 +5,17 @@ using GamePort.Assets;
namespace GamePort.Application;
public sealed record DebugScene(string LevelFile, string Code, string[] Starts);
public enum DebugAction { None, Resume, Camera, SkipCutscene, RefillEnergy, GiveJetpack, ApplySceneTask, LoadScene, Reset, ForceControl }
public enum DebugAction { None, Resume, Camera, SkipCutscene, RefillEnergy, GiveJetpack, ApplySceneTask, LoadScene, Reset, ForceControl, ToggleOverlay }
public sealed record DebugMenuView(string[] Lines, int SelectedLine);
public sealed record DebugStatus(string Level, string Start, Vector3 Root, float Yaw, float Speed,
bool Grounded, float Energy, int Score, int SceneTask, string Cutscene, bool Controlled,
int Issues, float FarPlane, bool Inspecting, bool ForcedControl = false);
int Issues, float FarPlane, bool Inspecting, bool ForcedControl = false, bool DiagnosticsVisible = false, string? CameraMode = null);
/// <summary>Modern investigation tools, deliberately separate from recovered game UI.</summary>
public sealed class DebugMenu
{
public const uint ToggleKey = 58; // SDL scancode F1; F11 remains fullscreen.
public const int ItemCount = 11;
public const int ItemCount = 12;
public bool Open { get; private set; }
public int Selected { get; private set; }
public int SceneTask { get; private set; }
@@ -66,6 +66,7 @@ public sealed class DebugMenu
3 => DebugAction.RefillEnergy, 4 => DebugAction.GiveJetpack, 5 => DebugAction.ApplySceneTask,
8 => Scene == null ? DebugAction.None : DebugAction.LoadScene, 9 => DebugAction.Reset,
10 => DebugAction.ForceControl,
11 => DebugAction.ToggleOverlay,
_ => DebugAction.None
};
return DebugAction.None;
@@ -84,7 +85,7 @@ public sealed class DebugMenu
$"YAW {F(status.Yaw)} SPEED {F(status.Speed)} GROUNDED {status.Grounded}",
$"ENERGY {F(status.Energy)} SCORE {status.Score} SCENE {status.SceneTask}",
$"CONTROL {status.Controlled} CUTSCENE {status.Cutscene}",
$"ISSUES {status.Issues} FAR {F(status.FarPlane)} CAMERA {(status.Inspecting ? "ORBIT" : "GAMEPLAY")}",
$"ISSUES {status.Issues} FAR {F(status.FarPlane)} CAMERA {status.CameraMode ?? (status.Inspecting ? "ORBIT" : "GAMEPLAY")}",
"",
"RESUME",
$"CAMERA: {(status.Inspecting ? "SWITCH TO GAMEPLAY" : "SWITCH TO ORBIT")}",
@@ -97,6 +98,7 @@ public sealed class DebugMenu
"LOAD SELECTED LEVEL / START",
"RESET CURRENT START",
$"FORCE CONTROL: {status.ForcedControl} (ENTER TOGGLE)",
$"LIVE OVERLAY: {status.DiagnosticsVisible} (F2 / ENTER TOGGLE)",
"",
"UP/DOWN SELECT LEFT/RIGHT CHANGE ENTER APPLY",
"SCENE TASK: PAGE UP/DOWN CHANGES BY 10",
+12 -4
View File
@@ -63,8 +63,9 @@ public sealed class DebugMenuOverlay
/// lines clip at76 characters. selectedLine is -1 or an index into lines.
/// Lowercase renders as uppercase, unsupported characters as question marks.
/// Layout uses the same640x480 reference viewport as the original HUD.
/// Compact mode uses a corner panel with58 columns and smaller live text.
/// </summary>
public void Update(Mesh destination, IReadOnlyList<string> lines, int selectedLine = -1)
public void Update(Mesh destination, IReadOnlyList<string> lines, int selectedLine = -1, bool compact = false)
{
ArgumentNullException.ThrowIfNull(destination);
ArgumentNullException.ThrowIfNull(lines);
@@ -77,7 +78,14 @@ public sealed class DebugMenuOverlay
background.Visible = lines.Count > 0;
highlight.Visible = selectedLine >= 0;
var solid = new Vector2(127.5f / AtlasWidth, 63.5f / AtlasHeight);
Quad(firstVertex, 18, 18, 604, Math.Clamp(lines.Count * LineHeight + 24, 80, 444), solid, solid, new(.025f, .04f, .07f));
var lineHeight = compact ? 10 : LineHeight;
var advance = compact ? 6 : CharacterAdvance;
var textX = compact ? 16 : 30;
var textY = compact ? 16 : 30;
var compactColumns = lines.Count == 0 ? 24 : Math.Clamp(lines.Max(line => line?.Length ?? 0), 24, 58);
Quad(firstVertex, compact ? 8 : 18, compact ? 8 : 18, compact ? compactColumns * advance + 16 : 604,
Math.Clamp(lines.Count * lineHeight + (compact ? 16 : 24), compact ? 30 : 80, 444),
solid, solid, new(.025f, .04f, .07f));
Quad(firstVertex + 4, 25, 27 + selectedLine * LineHeight, 590, LineHeight,
solid, solid, new(.07f, .24f, .33f));
for (var row = 0; row < MaxLines; row++)
@@ -89,13 +97,13 @@ public sealed class DebugMenuOverlay
var color = row == 0 ? new Vector3(1, .83f, .35f) : new(.85f, .93f, .98f);
for (var column = 0; column < MaxColumns; column++)
{
var character = column < line.Length ? char.ToUpperInvariant(line[column]) : ' ';
var character = column < line.Length && (!compact || column < 58) ? char.ToUpperInvariant(line[column]) : ' ';
if (character is < ' ' or > '~') character = '?';
var cell = character - ' ';
var x = cell % 16 * 8 + 1;
var y = cell / 16 * 8;
Quad(firstVertex + 8 + (row * MaxColumns + column) * 4,
30 + column * CharacterAdvance, 30 + row * LineHeight, 7, 9.8f,
textX + column * advance, textY + row * lineHeight, compact ? 5.6f : 7, compact ? 7.84f : 9.8f,
new((float)x / AtlasWidth, (float)y / AtlasHeight),
new((x + 5f) / AtlasWidth, (y + 7f) / AtlasHeight), color);
}
+112 -14
View File
@@ -17,9 +17,10 @@ internal static class Program
{
OriginalSave? carriedSave = null;
var returning = false;
var diagnostics = new DebugDiagnostics { Enabled = args.Contains("--debug-overlay") };
while (true)
{
var result = Run(args, carriedSave, returning, out var continuation);
var result = Run(args, carriedSave, returning, diagnostics, out var continuation);
if (result != 0 || continuation == null) return result;
args = continuation.Args; carriedSave = continuation.Save; returning = continuation.Returning;
}
@@ -38,7 +39,7 @@ internal static class Program
private sealed record SceneContinuation(string[] Args, OriginalSave Save, bool Returning);
private static int Run(string[] args, OriginalSave? carriedSave, bool returning, out SceneContinuation? continuation)
private static int Run(string[] args, OriginalSave? carriedSave, bool returning, DebugDiagnostics diagnostics, out SceneContinuation? continuation)
{
continuation = null;
if (args.Contains("--help"))
@@ -84,12 +85,14 @@ internal static class Program
--smoke-objective-panel Show original lab objective; --story-time tests timeout
--smoke-objective-window SDL O-key reopen/close/timeout check
--debug-menu Start with the F1 debug menu open
--debug-overlay Start with live F2 diagnostics visible
--smoke-debug-menu SDL debug navigation/pause/actions/resize check
--smoke-debug-overlay SDL live diagnostics/input/menu/resize check
--verify-assets Decode all original PNG/ASE files
--smoke-window Test keyboard event/resize (requires --frames 6 or more)
--no-validation Disable development validation
Walk: arrows move/turn; Shift, Insert or right mouse jump; R reset.
F1 debug menu. C pauses into inspection / resumes chase camera. F11 fullscreen, Escape quit.
F1 debug menu. F2 live diagnostics. C inspect / chase camera. F11 fullscreen, Escape quit.
Inspector: arrows/WASD orbit, +/- zoom,
F11 fullscreen, Escape quit. Animation preview: 1 idle, 2 run, 3 jump, 4 scratch.
Collision/pivot/cadence and animation timing are provisional. Full gameplay remains incomplete.
@@ -231,6 +234,7 @@ internal static class Program
var practiceWindowSmoke = args.Contains("--smoke-practice-window");
var practiceReturnSmoke = args.Contains("--smoke-practice-return");
var debugSmoke = args.Contains("--smoke-debug-menu");
var diagnosticsSmoke = args.Contains("--smoke-debug-overlay");
if (walkSmoke && jetpackSmoke) throw new ArgumentException("Select one movement smoke check");
var defaultStory = (defaultScene || args.Contains("--walk")) && !args.Contains("--inspect") && !walkSmoke && !args.Contains("--smoke-window")
&& animationPath == null && !args.Contains("--time");
@@ -365,9 +369,12 @@ internal static class Program
var storyTime = double.Parse(Option(args, "--story-time") ?? "0", System.Globalization.CultureInfo.InvariantCulture);
if (!double.IsFinite(storyTime) || storyTime < 0 || storyTime > 3600 || storyTime > 0 && !headless)
throw new ArgumentException("Story time must be0..3600 seconds in headless mode.");
var frames = int.Parse(Option(args, "--frames") ?? (walkSmoke ? "240" : jetpackSmoke ? "300" : objectiveWindowSmoke ? "180" : carlSmoke ? "60" : debugSmoke ? "16" : headless ? "1" : "0"));
var frames = int.Parse(Option(args, "--frames") ?? (walkSmoke ? "240" : jetpackSmoke ? "300" : objectiveWindowSmoke ? "180" : carlSmoke ? "60" : debugSmoke ? "16" : diagnosticsSmoke ? "24" : headless ? "1" : "0"));
if (debugSmoke && (headless || frames < 16 || director == null || level?.Code != "LV1B" || loadedSave != null || debugMenu.Open))
throw new ArgumentException("Debug SDL smoke requires fresh windowed LV1B, closed debug menu and at least16 frames");
if (diagnosticsSmoke && (headless || frames < 24 || director == null || level?.Code != "LV1B" || loadedSave != null
|| debugMenu.Open || diagnostics.Enabled || debugSmoke))
throw new ArgumentException("Live debug SDL smoke requires fresh windowed LV1B, hidden diagnostics and at least24 frames");
if (objectiveWindowSmoke && (headless || frames < 180)) throw new ArgumentException("Objective window smoke needs180 window frames");
if ((carlSmoke || objectiveSmoke) && (level?.Code != "LV1B" || loadedSave != null || objectiveSmoke && !headless && !objectiveWindowSmoke))
throw new ArgumentException("Lab conversation/objective smoke requires fresh LV1B (objective check is headless)");
@@ -424,7 +431,7 @@ internal static class Program
Console.WriteLine($"Practice RETURN: exact saved root={restored}, root={simulation.ActorRoot}, STRT yaw={simulation.Yaw}, intro suppressed={!director.Playing}, companion restored={companionRestored}.");
if (!restored) throw new InvalidOperationException("RETURN did not restore the live departure root without replaying STRT actions");
}
if (args.Contains("--skip-intro") || jetpackSmoke || debugSmoke) { sceneAudio?.StopSpeech(); director.Skip(); }
if (args.Contains("--skip-intro") || jetpackSmoke || debugSmoke || diagnosticsSmoke) { sceneAudio?.StopSpeech(); director.Skip(); }
if (practiceReturnSmoke && level.Code == "VR04")
{
director.Skip();
@@ -509,12 +516,21 @@ internal static class Program
double last = clock.Elapsed.TotalSeconds;
float angle = 0.6f, elevation = 0.32f;
var count = 0;
var lastPresentedAt = clock.Elapsed.TotalSeconds;
var debugPauseObserved = false;
var debugActionsObserved = false;
var debugEscapeObserved = false;
var debugResumeObserved = false;
var debugForceObserved = false;
float debugForceTravel = 0;
var diagnosticsShown = false;
var diagnosticsHidden = false;
var diagnosticsMoves = false;
var diagnosticsMenuPriority = false;
var diagnosticsPreference = false;
var diagnosticsMenuToggle = false;
var diagnosticsPausedSteps = 0;
var diagnosticsInitialTravel = simulation?.Travel ?? 0;
var debugPausedRoot = simulation?.ActorRoot ?? Vector3.Zero;
var debugPausedSteps = simulation?.Steps ?? 0;
void ResetScene()
@@ -570,6 +586,9 @@ internal static class Program
case DebugAction.ForceControl when director != null:
director.DebugForceControl = !director.DebugForceControl;
debugMenu.Message = $"FORCE CONTROL {director.DebugForceControl}; CLOSE MENU TO RESUME"; break;
case DebugAction.ToggleOverlay:
diagnostics.Enabled = !diagnostics.Enabled;
debugMenu.Message = $"LIVE OVERLAY {diagnostics.Enabled}; F2 TOGGLE DURING PLAY"; break;
case DebugAction.None: break;
default: debugMenu.Message = "ACTION REQUIRES PLAY MODE"; break;
}
@@ -609,6 +628,12 @@ internal static class Program
{ active = true; stepClock.Reset(); last = clock.Elapsed.TotalSeconds; }
if (e.Type == Sdl.KeyUp && debugCapturedKeys.Remove(e.Scancode)) continue;
if (e.Type == Sdl.KeyDown && !debugMenu.Open && debugCapturedKeys.Contains(e.Scancode)) continue;
if (e.Type == Sdl.KeyDown && e.Scancode == DebugDiagnostics.ToggleKey)
{
debugCapturedKeys.Add(e.Scancode);
if (e.Repeat == 0) diagnostics.Enabled = !diagnostics.Enabled;
continue;
}
if (e.Type == Sdl.KeyDown && e.Scancode == DebugMenu.ToggleKey)
{
debugCapturedKeys.Add(e.Scancode);
@@ -675,9 +700,9 @@ internal static class Program
var dt = (float)Math.Min(elapsed, 0.1);
last = now;
if (debugMenu.Open) animationStarted += elapsed;
if (simulation != null && !debugMenu.Open && !inspecting && !practice.Active && (active || headless || walkSmoke || jetpackSmoke || objectiveWindowSmoke || debugSmoke))
if (simulation != null && !debugMenu.Open && !inspecting && !practice.Active && (active || headless || walkSmoke || jetpackSmoke || objectiveWindowSmoke || debugSmoke || diagnosticsSmoke))
{
var steps = headless || walkSmoke || jetpackSmoke || practiceWindowSmoke || carlSmoke || objectiveWindowSmoke || debugSmoke ? 1 : stepClock.Advance(elapsed);
var steps = headless || walkSmoke || jetpackSmoke || practiceWindowSmoke || carlSmoke || objectiveWindowSmoke || debugSmoke || diagnosticsSmoke ? 1 : stepClock.Advance(elapsed);
for (var step = 0; step < steps; step++)
{
var input = carlSmoke ? new PlayerInput(true, false, true, false, true)
@@ -752,13 +777,26 @@ internal static class Program
objectivePanel?.Step(0, director?.ControlledTag != null, practice.Active);
hud?.Update(mesh, interactions!.CurrentObjective, level!.Code == "LV1B" && objectivePanel!.PadVisible,
practice.Active, objectivePanel!.YOffset, objectivePanel.ContentVisible);
var debugView = debugMenu.View(new(level?.Code ?? "PREVIEW", originalStart?.Tag ?? "NONE",
var gameplayProjection = originalCamera || simulation != null && !inspecting;
var cameraMode = !inspecting && director?.CameraEye != null ? "CUTSCENE"
: simulation != null && !inspecting ? "GAMEPLAY" : originalCamera ? "STRT" : "ORBIT";
var debugStatus = new DebugStatus(level?.Code ?? "PREVIEW", originalStart?.Tag ?? "NONE",
simulation?.ActorRoot ?? Vector3.Zero, simulation?.Yaw ?? 0, simulation?.Speed ?? 0,
simulation?.Grounded ?? false, simulation?.Energy ?? 0, interactions?.Score ?? 0,
storyTasks?.Get("SCENE") ?? 0, director?.CurrentTag ?? "NONE", director?.Controlled ?? false,
director?.Issues.Count ?? 0, SceneProjection.FarPlane(level?.Code), inspecting, director?.DebugForceControl ?? false));
debugOverlay.Update(mesh, debugView.Lines, debugView.SelectedLine);
var projection = originalCamera || simulation != null && !inspecting
(director?.Issues.Count ?? 0) + (interactions?.Unsupported.Count ?? 0) + (mechanisms?.Unsupported.Count ?? 0),
gameplayProjection ? SceneProjection.FarPlane(level?.Code) : radius * 20,
inspecting, director?.DebugForceControl ?? false, diagnostics.Enabled, cameraMode);
var debugView = debugMenu.View(debugStatus);
var liveDebugLines = diagnostics.Lines(debugStatus, new(simulation?.Velocity ?? Vector3.Zero,
simulation?.TurnRate ?? 0, simulation?.Pose.ToString() ?? "NONE", simulation?.Steps ?? 0,
simulation?.Jumps ?? 0, simulation?.WallHits ?? 0, interactions?.Inventory.State(0, 3) ?? 0,
simulation?.JetpackRemaining ?? 0, director?.CurrentShot ?? -1, director?.Blocked ?? false,
renderer.ValidationErrors, debugMenu.Open || practice.Active || inspecting || !active));
var liveDebugVisible = !debugMenu.Open && liveDebugLines.Length > 0;
debugOverlay.Update(mesh, debugMenu.Open ? debugView.Lines : liveDebugLines,
debugMenu.Open ? debugView.SelectedLine : -1, compact: !debugMenu.Open);
var projection = gameplayProjection
? SceneProjection.CreateGameplay(level?.Code, (float)renderer.Width / renderer.Height)
: Matrix4x4.CreatePerspectiveFieldOfView(MathF.PI / 3, (float)renderer.Width / renderer.Height, Math.Max(radius / 10000, 0.01f), radius * 20);
projection.M22 *= -1;
@@ -770,9 +808,62 @@ internal static class Program
}
renderer.UpdateVertices(mesh.Vertices);
renderer.Render(view * projection);
var presentedAt = clock.Elapsed.TotalSeconds;
diagnostics.ObserveFrame(presentedAt - lastPresentedAt);
lastPresentedAt = presentedAt;
count++;
audio?.Pump();
sceneAudio?.Pump();
if (diagnosticsSmoke)
{
void Push(uint key, bool down = true, bool repeat = false)
{
var e = new Sdl.Event { Type = down ? Sdl.KeyDown : Sdl.KeyUp, Scancode = key,
Down = down ? (byte)1 : (byte)0, Repeat = repeat ? (byte)1 : (byte)0 };
if (!Sdl.SDL_PushEvent(ref e)) throw new InvalidOperationException(Sdl.Error);
}
void Tap(uint key) { Push(key); Push(key, false); }
if (count == 1)
{
Push(82); Push(DebugDiagnostics.ToggleKey); Push(DebugDiagnostics.ToggleKey, repeat: true);
Push(DebugDiagnostics.ToggleKey, false);
if (!Sdl.SDL_SetWindowSize(window, 800, 600)) throw new InvalidOperationException(Sdl.Error);
}
if (count == 3)
diagnosticsShown = liveDebugVisible && !debugMenu.Open && sceneAudio?.Paused != true && liveDebugLines.Length == 12;
if (count == 4) Tap(DebugDiagnostics.ToggleKey);
if (count == 5) diagnosticsHidden = !liveDebugVisible && !diagnostics.Enabled && simulation!.Steps >= 5;
if (count == 6) Tap(DebugDiagnostics.ToggleKey);
if (count == 8)
{
diagnosticsMoves = liveDebugVisible && simulation!.Travel > diagnosticsInitialTravel + 5;
diagnosticsPausedSteps = simulation!.Steps;
Tap(DebugMenu.ToggleKey);
}
if (count == 9)
{
diagnosticsMenuPriority = debugMenu.Open && diagnostics.Enabled && !liveDebugVisible
&& simulation!.Steps == diagnosticsPausedSteps && sceneAudio?.Paused != false;
Tap(DebugDiagnostics.ToggleKey);
}
if (count == 10)
{
diagnosticsPreference = !diagnostics.Enabled && debugMenu.Open && sceneAudio?.Paused != false;
Tap(DebugDiagnostics.ToggleKey); Tap(DebugMenu.ToggleKey);
}
if (count == 11)
{
diagnosticsPreference &= diagnostics.Enabled && liveDebugVisible && !debugMenu.Open && sceneAudio?.Paused != true;
Push(82, false); Push(82);
}
if (count == 16) Tap(DebugDiagnostics.ToggleKey);
if (count == 18)
{
Tap(DebugMenu.ToggleKey); Tap(82); Tap(40); Tap(41); // Last menu row toggles the live panel.
}
if (count == 19) diagnosticsMenuToggle = diagnostics.Enabled && liveDebugVisible && !debugMenu.Open;
if (count == 20) Push(82, false);
}
if (debugSmoke)
{
void Push(uint key, bool down = true, bool repeat = false)
@@ -862,7 +953,7 @@ internal static class Program
if (!Sdl.SDL_PushEvent(ref cycle)) throw new InvalidOperationException(Sdl.Error);
}
}
if ((smoke || walkSmoke || jetpackSmoke || practiceWindowSmoke || objectiveWindowSmoke || debugSmoke) && renderer.Width == 800 && renderer.Height == 600) didResize = true;
if ((smoke || walkSmoke || jetpackSmoke || practiceWindowSmoke || objectiveWindowSmoke || debugSmoke || diagnosticsSmoke) && renderer.Width == 800 && renderer.Height == 600) didResize = true;
if (frames > 0 && count >= frames) break;
if (transitionRequest != null) break;
}
@@ -877,6 +968,13 @@ internal static class Program
if (Math.Abs(pixels[i] - 31) + Math.Abs(pixels[i + 1] - 51) + Math.Abs(pixels[i + 2] - 76) > 6) changed++;
Console.WriteLine($"Rendered {count} frame(s), {changed} non-background pixels, {renderer.ValidationErrors} Vulkan validation error(s).");
if (simulation != null) Console.WriteLine(simulation.Report);
if (diagnostics.Enabled) Console.WriteLine($"Live debug overlay: enabled=True, frame samples={diagnostics.Frames}.");
if (diagnosticsSmoke)
{
Console.WriteLine($"Live debug SDL check: shown={diagnosticsShown}, hidden={diagnosticsHidden}, movement={diagnosticsMoves}, menu priority={diagnosticsMenuPriority}, preference={diagnosticsPreference}, menu toggle={diagnosticsMenuToggle}, resize800x600={didResize}.");
if (!diagnosticsShown || !diagnosticsHidden || !diagnosticsMoves || !diagnosticsMenuPriority
|| !diagnosticsPreference || !diagnosticsMenuToggle || !didResize) return 2;
}
if (debugSmoke)
{
Console.WriteLine($"Debug SDL check: paused={debugPauseObserved}, actions={debugActionsObserved}, Escape/input capture={debugEscapeObserved}, resumed={debugResumeObserved}, forced movement during MCA={debugForceObserved}, resize800x600={didResize}.");
@@ -934,7 +1032,7 @@ internal static class Program
for (var i = 0; i < args.Length; i++)
{
if (args[i] is "--smoke-transition" or "--smoke-lab-route" or "--smoke-practice-prompt" or "--smoke-practice-transition"
or "--debug-menu" or "--smoke-debug-menu") continue;
or "--debug-menu" or "--smoke-debug-menu" or "--smoke-debug-overlay") continue;
if (args[i] is "--scene" or "--level" or "--start" or "--load-save" or "--story-time") { i++; continue; }
nextArgs.Add(args[i]);
}
@@ -974,7 +1072,7 @@ internal static class Program
}
}
private const string WalkTitle = "Jimmy Neutron — lab checkpoint | Arrows move | Shift / Insert / right mouse jump | F1 debug | R reset | C inspect";
private const string WalkTitle = "Jimmy Neutron — lab checkpoint | Arrows move | Shift / Insert / right mouse jump | F1 menu | F2 overlay | R reset | C inspect";
private static int VerifyAssets(string root)
{