Pace ADV message skip by engine ticks

This commit is contained in:
gamer147
2026-07-18 19:04:15 -04:00
parent dc50acaa9b
commit 7f5b88117b
5 changed files with 53 additions and 4 deletions

View File

@@ -81,6 +81,15 @@ public class HotspotInputTests
}
}
private sealed class MessageSkipCadenceHost : RecordingHost
{
public int ActiveSkipYields;
public override void FrameYield()
{
if (MessageSkip) ActiveSkipYields++;
}
}
[Fact]
public void ArmedHotspot_DispatchesHoverAndConsumesActivationWithoutAdvancingPage()
{
@@ -269,6 +278,25 @@ public class HotspotInputTests
Assert.Contains(true, host.MessageSkipChanges);
}
[Fact]
public void MessageSkipState_ReachesHostBeforeFollowingOpcodeCadenceYields()
{
var table = OpcodeTableJson.Load(Paths.OpcodesJson);
var script = ScriptAssembler.Assemble(table, "MESSAGE_SKIP_CADENCE", new List<(int, Operand[])>
{
(0x88, new[] { I(1) }),
(0x55, new[] { G(0x150), I(1) }),
(0x55, new[] { G(0x151), I(1) }),
(0x88, new[] { I(0) }),
(0x2, Array.Empty<Operand>()),
}, Array.Empty<string>());
var host = new MessageSkipCadenceHost();
new VirtualMachine(script, table, host).Run();
Assert.Equal(3, host.ActiveSkipYields);
}
private static Operand I(long value) => new(0, value);
private static Operand G(long address) => new(3, address);
}

View File

@@ -41,7 +41,7 @@ internal class RecordingHost : IHost
=> WaitForInput(layoutSlot, serviceInputCallback);
public void InputCallbackCompleted(GfxState gfx) => InputCallbackFrames++;
public void Sleep(long duration) => SleptDurations.Add(duration);
public void FrameYield() { }
public virtual void FrameYield() { }
public bool IsMessageSkipActive => MessageSkip;
public void SetMessageSkipActive(bool active)
{