GetKeyState() does not support all joystick functions

Report problems with documented functionality
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

GetKeyState() does not support all joystick functions

08 Dec 2014, 06:04

GetKeyState does not support all joystick functions.
http://ahkscript.org/docs/KeyList.htm#Joystick

Windows supports up to 8 Axes:

The ones AHK currently supports:
X, Y, Z, R, U, V

However, for example in vJoy there are 8 axes, named like so:
X, Y, Z, RX, RY, RZ, SL0, SL1

Furthermore, AHK does not support the full range of buttons. Windows supports up to 128 buttons, not 32.
However, I think this is an extended thing, as Game controllers only displays the first 32.
This one is not so much of a big deal.

Finally, Windows supports up to 4 POV hats, and AHK only supports 1

Is there any chance this will be fixed?

Failing that, does anyone have a decent lib to provide access to the full range of stick inputs?
CJBrew

Re: GetKeyState() does not support all joystick functions

08 Dec 2014, 07:24

evilC wrote:GetKeyState does not support all joystick functions.
http://ahkscript.org/docs/KeyList.htm#Joystick

Windows supports up to 8 Axes:

The ones AHK currently supports:
X, Y, Z, R, U, V

However, for example in vJoy there are 8 axes, named like so:
X, Y, Z, RX, RY, RZ, SL0, SL1

Furthermore, AHK does not support the full range of buttons. Windows supports up to 128 buttons, not 32.
However, I think this is an extended thing, as Game controllers only displays the first 32.
This one is not so much of a big deal.

Finally, Windows supports up to 4 POV hats, and AHK only supports 1

Is there any chance this will be fixed?

Failing that, does anyone have a decent lib to provide access to the full range of stick inputs?
Looking at the code just now, there's probably a limitation based on joystickapi.h which is part of the Windows API

This defines a bunch of enumerations like:

Code: Select all

#define JOY_RETURNX             0x00000001l
#define JOY_RETURNY             0x00000002l
#define JOY_RETURNZ             0x00000004l
#define JOY_RETURNR             0x00000008l
#define JOY_RETURNU             0x00000010l     /* axis 5 */
#define JOY_RETURNV             0x00000020l     /* axis 6 */

Obviously it's not possible to modify these files. I don't know how Windows deals with the extra 2 axes. Possibly via a different API...??? DirectX?
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: GetKeyState() does not support all joystick functions

09 Dec 2014, 02:57

Is there any chance this will be fixed?
No.

AutoHotkey supports the maximum number of controllers, axes, POV and buttons allowed by the Multimedia Joystick API.

This is not a bug.
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: GetKeyState() does not support all joystick functions

09 Dec 2014, 04:49

"The multimedia joystick API has been superseded by DirectInput".
Is there any chance that AHK's joystick support will be moved to DirectInput?

Or would I have to hope and pray Microsoft remove WinMM from Windows 10?

Failing that, if I obtained or wrote a DirectInput library, would I be likely to see a significant performance hit over using GetKeyState?
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: GetKeyState() does not support all joystick functions

10 Dec 2014, 00:05

1. Not by me.
3. Probably not.
Note Use of legacy DirectInput is not recommended, and DirectInput is not available for Windows Store apps.
http://msdn.microsoft.com/en-us/library ... p/ee417014
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: GetKeyState() does not support all joystick functions

10 Dec 2014, 04:16

lexikos wrote:
Note Use of legacy DirectInput is not recommended, and DirectInput is not available for Windows Store apps.
http://msdn.microsoft.com/en-us/library ... p/ee417014
XInput is for XBox 360 controllers only. DirectInput is still very much alive and kicking.

It's the simulation community that wants this - modern flight sticks have 8 axes and multiple POVs, and they cannot use AHK to read all the inputs.
Yes, they could use the software that comes with their stick, but the whole point is that the apps that come with these sticks often suck horribly (Or have major limitations), and people use my apps instead to configure their sticks.

From http://en.wikipedia.org/wiki/DirectInput
XInput supports only "next generation" controllers. This limits it basically to controllers for the Xbox 360 that also have Windows drivers. Legacy Windows controllers, joysticks and generalized force-feedback devices are not supported.

XInput supports a maximum of four controllers at a time. This is an Xbox limit, carried over to Windows. Although as of 2010 few PC games require more than four controllers at once, DirectInput itself has no such limitation.

XInput supports maximum of 4 axes, 10 buttons, 2 triggers and 8-direction digital pad per controller, compared to DirectInput's support for 8 axes, 128 buttons, and full-range POV. (Incidentally, the number of axes, buttons and triggers XInput supports corresponds directly to the Xbox 360 controller.)
So yeah - XInput is worse than WinMM!
4 sticks, 6 axes, only 10 buttons ?!, 2 POVs
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: GetKeyState() does not support all joystick functions

10 Dec 2014, 04:43

evilC wrote:DirectInput is still very much alive and kicking.
So is WinMM. Both are "deprecated". If you're going to hope and pray that Microsoft remove WinMM, you should also hope and pray that they don't remove DirectInput as well. Either way, they would break a whole lot of programs and alienate a lot of users, for no good reason that I can imagine.
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: GetKeyState() does not support all joystick functions

10 Dec 2014, 04:59

lexikos wrote:
evilC wrote:DirectInput is still very much alive and kicking.
So is WinMM. Both are "deprecated". If you're going to hope and pray that Microsoft remove WinMM, you should also hope and pray that they don't remove DirectInput as well. Either way, they would break a whole lot of programs and alienate a lot of users, for no good reason that I can imagine.
Not going to happen. Every single game on the market that can use joysticks other than XBox controllers uses DirectInput.

WinMM stick input brings nothing to the table. It provides a subset of DI's functionality and will only be being used by a small percentage of applications (Things that use joystick input but are not games - that's a mighty small slice of a Venn Diagram).
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: GetKeyState() does not support all joystick functions

10 Dec 2014, 19:56

evilC wrote:Not going to happen.
That's my point. :roll:
Every single game on the market that can use joysticks other than XBox controllers uses DirectInput.
That's a rather bold, and I don't doubt, inaccurate claim.
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: GetKeyState() does not support all joystick functions

11 Dec 2014, 05:20

OK, maybe I should clarify that a bit.
What I meant was, games do not use WinMM, as evidenced by the fact that I have not seen or heard of a game in years that does not support the full 8 axes.
Apart from games with the "Games For Windows" logo - often these use XInput because they only support XBox controllers, but that is pretty rare.
From what I understand, a bunch of games now use RawInput, but whatever, the point I was making is that WinMM or anything that only provides 6 axis support is basically dead in the water.
User avatar
joedf
Posts: 8951
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: GetKeyState() does not support all joystick functions

11 Dec 2014, 09:12

I don't think anything is going to change here. :/
But, if you are trying to achieve something specific, alternatives may be your only option here.
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: GetKeyState() does not support all joystick functions

12 Dec 2014, 04:59

Well I just need to be able to read all the axes and POVs that windows supports.

So would need some AHK code (Or a DLL that my AHK code can call) that accesses this info via something like DirectInput or RawInput .
User avatar
joedf
Posts: 8951
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: GetKeyState() does not support all joystick functions

12 Dec 2014, 10:53

Sure, just "Ask For Help"! ;) or do it on your own, which ever is preferred.
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 42 guests