feat: add IHost.FrameYield per-opcode hook (no-op headless, parity held)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ public sealed class CaptureHost : IHost
|
||||
public void ShowText(int offset, string text) => Emitted.Add((offset, text));
|
||||
public void WaitForInput() { }
|
||||
public void Sleep(long duration) { }
|
||||
public void FrameYield() { }
|
||||
public void CreateTexture(int slot, int width, int height) { }
|
||||
public void SetTexture(long resourceId, int slot) { }
|
||||
public void DrawTexture(int slot, int srcX, int srcY, int width, int height, int dstX, int dstY) { }
|
||||
|
||||
@@ -4,6 +4,7 @@ public interface IHost
|
||||
void ShowText(int offset, string text);
|
||||
void WaitForInput();
|
||||
void Sleep(long duration);
|
||||
void FrameYield();
|
||||
void CreateTexture(int slot, int width, int height);
|
||||
void SetTexture(long resourceId, int slot);
|
||||
void DrawTexture(int slot, int srcX, int srcY, int width, int height, int dstX, int dstY);
|
||||
|
||||
@@ -122,6 +122,7 @@ public sealed class VirtualMachine
|
||||
Steps++;
|
||||
if (_sink.TracingSteps) _sink.Emit(TraceEvent.Step(pc, frame.Script.Instructions[pc], _depth));
|
||||
int next = Step(frame.Script.Instructions[pc], pc);
|
||||
_host.FrameYield();
|
||||
if (next == FRAME_RETURN) { outcome = FrameOutcome.Returned; break; }
|
||||
if (next == HALT) { outcome = FrameOutcome.Halted; break; }
|
||||
pc = next;
|
||||
|
||||
Reference in New Issue
Block a user