namespace XFEEDToolBox.Core.Navigation; /// Physical key events only; callers supply game focus and discard injected events. public sealed class ManualTakeoverKeyboardPolicy { private bool w,s,x,requested; private ulong wAt,sAt; public void Reset(){w=s=x=requested=false;wAt=sAt=0;} public void Key(uint key,bool down,ulong at,bool gameForeground,bool injected=false) { if(!gameForeground){Reset();return;} if(injected)return; switch(key) { case 0x57:if(down&&!w)wAt=at;w=down;break; case 0x53:if(down&&!s)sAt=at;s=down;break; case 0x58:if(down&&!x)requested=true;x=down;break; } } public string Evaluate(ulong at,bool gameForeground) { if(!gameForeground){Reset();return "";} if(requested)return "physical-key-X"; if(w&&at>=wAt&&at-wAt>1000)return "physical-key-W-held"; if(s&&at>=sAt&&at-sAt>1000)return "physical-key-S-held"; return ""; } }