Jump to content
LaunchBox Community Forums

Detecting gamepad from plugin


Recommended Posts

Hi all. Does anyone know if there is a way to set up my plugin to detect and respond to buttons pressed on the gamepad while LaunchBox/BigBox is running?

I have experimented a bit with SharpDX library for DirectInput and XInput but this feels like reimplementing something that already works in LaunchBox. Another thing I noticed is that the button numbers I detect via SharpDX are very different from the numbers that show up in the Settings.xml and BigBoxSettings.xml files. For example, the BigBoxSettings.xml has the following configs:

<ControllerSelectButton>1</ControllerSelectButton>
<ControllerBackButton>2</ControllerBackButton>
<ControllerPlayButton>8</ControllerPlayButton>

Whereas the values for those same buttons via SharpDX DirectInput are 48, 49, 55 (from state.Offset). 

When using SharpDX XInput I get the following values:

  • 'A', int value 4096
  • 'B', int value 8192
  • 'Start', int value 16

Why does Launchbox think that these buttons should get have the numbers 1,2,8 assigned instead?

Link to comment
Share on other sites

 

1 hour ago, SsjCosty said:

Why does Launchbox think that these buttons should get have the numbers 1,2,8 assigned instead?

I think the button numbers (0, 1, 2, 3...) are a sorta 'standard of the industry'.  Besides "1" is a lot easier to remember than the [more precise] Decimal value 4096.  aka, Hexadecimal value 0x1000.  (I'm sure there's a similar reasoning for Direct Input.)

But to call the 4 main buttons  A, B, X, Y doesn't really work when all you have is X, circle, square, triangle. ;) 

As for detecting specific button presses from within a plugin is well beyond my knowledge.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...