0

I am trying to simulate user's input in UWP app running on Xbox. At first I tried to press a key via InjectedInputKeyboardInfo and it works fine.

var inputInjector = InputInjector.TryCreate();

InjectedInputKeyboardInfo inputKeyboardInfo = new InjectedInputKeyboardInfo
{
    KeyOptions = InjectedInputKeyOptions.ScanCode,
    ScanCode = 22
};

inputInjector.InjectKeyboardInput(new[] { inputKeyboardInfo });

Then I tried to press a key on gamepad and it actually does nothing. No error, no exception.

InjectedInputGamepadInfo info = new InjectedInputGamepadInfo
{
    Buttons = GamepadButtons.A
};

inputInjector.InjectGamepadInput(info);

I updated my package manifest:

  • added namespace xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
  • added IgnorableNamespaces="rescap"
  • added capability <rescap:Capability Name="inputInjectionBrokered" />

My app has min/target version 16299.
My Xbox runs on 16299.4055.

Jakub Krampl
  • 1,774
  • 1
  • 16
  • 24

1 Answers1

0

From OS build 17134 there is new API which can be used to simulate Xbox One controller, keyboard or mouse.

https://learn.microsoft.com/en-us/windows/uwp/xbox-apps/uwp-remoteinput-api

Jakub Krampl
  • 1,774
  • 1
  • 16
  • 24
  • Do you manage to use it? I am trying connecting with webSocket but it's not working, it's just stuck on "connecting" on Postman. – Edoardo Trotta Sep 09 '22 at 13:37