Windows.Gaming.Input.RawGameController: uniquely identify device between different applications

Nick Thissen 0 Reputation points
2023-07-04T20:10:33.94+00:00

I am using Windows.Gaming.Input.RawGameController to receive input from gamepads, joysticks and similar devices.

https://learn.microsoft.com/en-us/uwp/api/windows.gaming.input.rawgamecontroller?view=winrt-22621

For my application, the input devices are used as "button boxes" or hotkeys. The user can select which action he wants to perform, and then press a button on his gamepad to link that button to that action.

To persist the hotkeys, and to distinguish two similar devices (e.g. two Xbox360 controllers) I need to be able to uniquely identify devices.

For now, I am using the NonRoamableId property, which at least unique identifies a device on the same PC, on the same application:

https://learn.microsoft.com/en-us/uwp/api/windows.gaming.input.rawgamecontroller.nonroamableid?view=winrt-22621

Unfortunately, as the docs also say: the NonRoamableId does not remain the same between applications.

In my case, I have two applications that need to identify the same controller:

  1. App1 is the application where the user sets up his hotkeys and where I link a device button press to a certain action. App1 should not react to the device buttons at all, it is merely for making the link.
  2. App2 is another application which is listening for the button presses and executes the linked actions.

App1 and App2 are both built by me, in the same .NET Solution, but they are different projects, different executables, and simply separate applications in the end.

Is there any way at all for me to identify a device uniquely between when it is used in App1 and App2?

The NonRoamableIds look as follows for the two apps and two controllers:


App1, controller 1:  {wgi/nrid/P^8c_LU-?Ci-Rc92m-X>TK-O1gQ>-h;W65QeX}

App1, controller 2:  {wgi/nrid/IgJ-C]mORW-`7eT-dHNX?KA-CUg-g;`<=Va-5R}

App2, controller 1:  {wgi/nrid/oS?N8;75-01ckAIO-LV<SCT-e8`?F8-OVA;K}

App2, controller 2:  {wgi/nrid/b6[S7k->8dW-Y\J-PF[;kC-^7;-?CbWg-`kUb`}

There seems to be nothing in there I can use at all.

Is this simply impossible?

.NET
.NET
Microsoft Technologies based on the .NET software framework.
4,103 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 88,296 Reputation points
    2023-08-04T13:12:11.6533333+00:00

    With IDirectInput8::EnumDevices, I get GUIDs (in DIDEVICEINSTANCE)

    (tested in C# on Windows 10 22H2)

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.