Add passive F2 diagnostics overlay with persistent session visibility
This commit is contained in:
1 parent
20aa1bc2b9
commit
113e9a41cc
17 files changed
+414
-24
No files matched your search
+112
-14
@@ -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)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user