Split input host contract

This commit is contained in:
gamer147
2026-08-03 10:56:47 -04:00
parent 3d807e6115
commit c5204341a3
4 changed files with 62 additions and 38 deletions

View File

@@ -27,11 +27,8 @@ public readonly record struct DiagnosticMessage(string Caption, string Text);
public readonly record struct FullwidthTextEditRequest(string CurrentText, string InitialText);
public readonly record struct FullwidthTextEditResult(bool Accepted, string Text);
public interface IHost : IDiagnosticHost, ILifecycleHost, IAudioHost, IMovieHost, IGraphicsHost
public interface IHost : IDiagnosticHost, ILifecycleHost, IAudioHost, IMovieHost, IGraphicsHost, IInputHost
{
/// <summary>Present AGERc's modal full-width editor. Cancel preserves CurrentText.</summary>
FullwidthTextEditResult EditFullwidthString(FullwidthTextEditRequest request)
=> new(false, request.CurrentText);
void ShowText(int offset, string text);
void ShowText(AdvLiveTextRun run, int glyphDelayMilliseconds)
=> ShowText(run.SourceOffset, run.Text);
@@ -89,33 +86,4 @@ public interface IHost : IDiagnosticHost, ILifecycleHost, IAudioHost, IMovieHost
void SetAdvPagePresentationSuspended(bool suspended) { }
void SetAdvPagePresentationSuspended(GfxState gfx, bool suspended)
=> SetAdvPagePresentationSuspended(suspended);
void WaitForInput();
void WaitForInput(int layoutSlot) => WaitForInput();
// Interactive hosts service script callbacks on the VM thread while the enclosing ADV page remains
// parked. The callback returns true while another queued input callback is ready to run.
void WaitForInput(int layoutSlot, Func<bool> serviceInputCallback)
{
while (serviceInputCallback()) { }
WaitForInput(layoutSlot);
}
void WaitForInput(int layoutSlot, Func<bool> serviceInputCallback,
Func<AdvAutoWaitState> autoWaitState)
=> WaitForInput(layoutSlot, serviceInputCallback);
void WakeInputCallbackService() { }
void InputCallbackCompleted(GfxState gfx) { }
// Generic AGE input-callback services (ops 0xcc/0xcd, 0xfb/0xff/0x100, 0x108).
// Interactive hosts expose the same monotonic clock used by their frame scheduler.
long InputClockMilliseconds => Environment.TickCount64;
void SetCursorResource(long resourceId) { }
void ClearCursorResource() { }
// Native 0x1c7/0x1cc query two distinct ADV skip channels. Headless and non-interactive
// hosts default to normal playback; the Godot host supplies the live interactive values.
void SetMessageSkipActive(bool active) { }
// Logical action 6 is the native hold-to-fast-forward channel. Keep it separate from the
// persistent op-0x88 channel so releasing the key cannot turn off the user's Skip toggle.
void SetPhysicalMessageSkipActive(bool active) { }
bool IsMessageSkipActive => false;
// Optional diagnostic override. Native ReadTextDB state is VM/profile-owned; interactive hosts
// normally leave this false.
bool IsAdvReadSkipActive => false;
}

View File

@@ -0,0 +1,49 @@
using Age.Engine.Model;
namespace Age.Engine.Hosting;
public interface IInputHost
{
/// <summary>Present AGERc's modal full-width editor. Cancel preserves CurrentText.</summary>
FullwidthTextEditResult EditFullwidthString(FullwidthTextEditRequest request)
=> new(false, request.CurrentText);
void WaitForInput();
void WaitForInput(int layoutSlot) => WaitForInput();
// Interactive hosts service script callbacks on the VM thread while the enclosing ADV page remains
// parked. The callback returns true while another queued input callback is ready to run.
void WaitForInput(int layoutSlot, Func<bool> serviceInputCallback)
{
while (serviceInputCallback()) { }
WaitForInput(layoutSlot);
}
void WaitForInput(int layoutSlot, Func<bool> serviceInputCallback,
Func<AdvAutoWaitState> autoWaitState)
=> WaitForInput(layoutSlot, serviceInputCallback);
void WakeInputCallbackService() { }
void InputCallbackCompleted(GfxState gfx) { }
// Generic AGE input-callback services (ops 0xcc/0xcd, 0xfb/0xff/0x100, 0x108).
// Interactive hosts expose the same monotonic clock used by their frame scheduler.
long InputClockMilliseconds => Environment.TickCount64;
void SetCursorResource(long resourceId) { }
void ClearCursorResource() { }
// Native 0x1c7/0x1cc query two distinct ADV skip channels. Headless and non-interactive
// hosts default to normal playback; the Godot host supplies the live interactive values.
void SetMessageSkipActive(bool active) { }
// Logical action 6 is the native hold-to-fast-forward channel. Keep it separate from the
// persistent op-0x88 channel so releasing the key cannot turn off the user's Skip toggle.
void SetPhysicalMessageSkipActive(bool active) { }
bool IsMessageSkipActive => false;
// Optional diagnostic override. Native ReadTextDB state is VM/profile-owned; interactive hosts
// normally leave this false.
bool IsAdvReadSkipActive => false;
}