Add hidden title debug mode and pace menu polls
This commit is contained in:
@@ -50,4 +50,23 @@ public class ExitRequestTests
|
||||
Assert.False(vm.Globals.ContainsKey(0x7001));
|
||||
Assert.False(vm.Globals.ContainsKey(0x7002));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DebugIgnoreExitRequestFallsThroughToFollowingBytecode()
|
||||
{
|
||||
var table = OpcodeTableJson.Load(Paths.OpcodesJson);
|
||||
var script = ScriptAssembler.Assemble(table, "TITLE.BIN", new List<(int, Operand[])>
|
||||
{
|
||||
(0x1, Array.Empty<Operand>()),
|
||||
(0x55, new[] { G(0x7000), I(1) }),
|
||||
(0x2, Array.Empty<Operand>()),
|
||||
}, Array.Empty<string>());
|
||||
var vm = new VirtualMachine(script, table, new RecordingHost(),
|
||||
new VmOptions(IgnoreExitRequests: true));
|
||||
|
||||
vm.Run();
|
||||
|
||||
Assert.Equal("exit", vm.HaltReason);
|
||||
Assert.Equal(1, vm.Globals[0x7000]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -724,6 +724,7 @@ public sealed class VirtualMachine
|
||||
return pc + 1;
|
||||
}
|
||||
case "throw-exit-request":
|
||||
if (_o.IgnoreExitRequests) return pc + 1;
|
||||
// Native op 0x1 throws Command_Exit_Exception through callbacks and nested script
|
||||
// frames. The outer engine loop catches it and exits without advancing frame_pc.
|
||||
throw new ProcessExitRequestedException();
|
||||
|
||||
@@ -6,5 +6,7 @@ namespace Age.Engine.Vm;
|
||||
/// through every prompt into code no real playthrough reaches (which is what made a headless SC0000 spin
|
||||
/// 493k× in the name-entry poll loop). Leave false for interactive frontends that really block on input
|
||||
/// (Godot) and for the dialogue-coverage sweep that deliberately walks every page.</param>
|
||||
/// <param name="IgnoreExitRequests">Debug-only divergence: treat op 0x1 as a no-op so unreachable
|
||||
/// post-exit bytecode can be explored. Leave false for native-faithful execution.</param>
|
||||
public sealed record VmOptions(int EmitCap = 2, long MaxSteps = 2_000_000, int CallDepthCap = 64,
|
||||
bool HaltAtWaitForInput = false);
|
||||
bool HaltAtWaitForInput = false, bool IgnoreExitRequests = false);
|
||||
|
||||
Reference in New Issue
Block a user