Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Steam Controller in Allegro5

This thread is locked; no one can reply to it. rss feed Print
Steam Controller in Allegro5
Squall
Member #19,931
April 2021

Hi guys,

I'm new here, and new to Allegro 5. my main question is: is it possible to use a Steam Controller by Allegro 5? If so could you give me hints, code fragments, advices?

A little background - I use a port of Allegro 5.2.b1-1 for Pascal. I modified the code so it can be used by Delphi 7 (because it was done for Lazarus and latest Delphi XE 10).

As a base for my joystick experiments I use "ex_joysick_events". It works fine with my old Hama joysticks. When I plug a Steam Controller - nothing works. More precisely al_get_num_joysticks return 0, and al_get_joystick(0) returns no instance (null).

Dizzy Egg
Member #10,824
March 2009
avatar

You probably need a driver for it, in order for Allegro to detect it. Unfortunately I do not know what driver you need! Probably an XBox Input Driver (or similar)? ???

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

MiquelFire
Member #3,110
January 2003
avatar

1) I never figured out how to configure the controller to appear as an actual controller when you don't launch your game from Steam. (Made it worthless for games that you couldn't run from Steam for whatever reason)

2) Normally the default for games is to be an Xbox controller. For games without the SDK, Steam tricks the games into thinking you're using an XBox controller. For games that use the SDK for the controller (I don't know the rules for using it, but I assume you need access to the Steam API), you could should the button prompts for the Steam Controller instead of the normal Xbox button prompts most Windows games tend to use.

---
Febreze (and other air fresheners actually) is just below perfumes/colognes, and that's just below dead skunks in terms of smells that offend my nose.
MiquelFire.red
If anyone is of the opinion that there is no systemic racism in America, they're either blind, stupid, or racist too. ~Edgar Reynaldo

Squall
Member #19,931
April 2021

Thank you guys for fast answers!

"I never figured out how to configure the controller to appear as an actual controller when you don't launch your game from Steam."
Exactly! Even in the Control Panel it is recognized as HID device, but not as joystick.

Since this is a problem not only in Allegro, from what I've read on Steam forums, it seems there are 2 different standards/interfaces: dInput and xInput. dInput is something connected to DirectInput from DirectX and is pretty much what serve to older joysticks like my Hama. xInput (xbox?) is a newer and this is what my Steam Controller is using and all the new (xBox like) controllers.

So I guess my question extends to what is Allegro using under the hood - dInput or xInput? Does Allegro adds a layer of abstraction so we get events from devices regardless of the interface? If not, what code to use to utilize different types?

MiquelFire
Member #3,110
January 2003
avatar

I haven't looked at Allegro's code in forever, but I know there was a time it used DirectInput (because Allegro's Windows code pre-dates xInput), but I think I saw discussion at least for using Xinput.

Edit: Looks like Allegro does use both, but if a controller supports both at the same time (without a mode switch that is), it will appear in Allegro twice: https://github.com/liballeg/allegro5/blob/master/src/win/wjoyall.c

---
Febreze (and other air fresheners actually) is just below perfumes/colognes, and that's just below dead skunks in terms of smells that offend my nose.
MiquelFire.red
If anyone is of the opinion that there is no systemic racism in America, they're either blind, stupid, or racist too. ~Edgar Reynaldo

Go to: