TheGameCreators / AGK-Studio

3 stars 1 forks source link

Controller joystick buttons are wrong on Mac (+ some do not register) #1054

Open nicollau opened 1 year ago

nicollau commented 1 year ago

Joystick controller buttons return other values on Mac then it does on Windows. On the DPad, it returns nothing at all. (which is very problematic).

Tried every possible solution but the error seems to be in AGK itself.

For example, on Windows the DPAD buttons are represented by buttons 13-16...

..now on Mac buttons 13 and 15 represents the AnalogStickButtons, and the 14 represents the Start/Select button on a controller.

The DPAD is not registered anywhere (I've tried getting state, clicked, joyx/y/z, pov etc.)

Tested using both a Xbox One Controller and a PS4 Controller.

Tested on macOS Ventura. (There were some gamepad changes in this OS update of Mac, so that might be something to look into?)

VirtualNomad19 commented 1 year ago

did you try just the Input commands (without any Input-Raw stuff)?

IE:

Function CheckInput()
    Print("")
    Print( "JoyX/Y: " + STR(GetJoystickX(),2) + "/" + STR(GetJoystickY(),2) )
    Buttons$ = "Buttons: "
    For x = 1 to 5
        Buttons$ = Buttons$ + STR(GetButtonState( x ))
    Next x
    Print(Buttons$)
EndFunction

i'm curious if/how those work for you.

nicollau commented 1 year ago

Yes, same issue there as well.

muckypaws commented 1 year ago

Hi @VirtualNomad19 , yes I believe this is the same issue. Happy for you to close the one I opened for the original here.

Kind Regards

muckypaws commented 1 year ago

@VirtualNomad19 Copying the info from the duplicate case I raised #1069

Hello,

It seems that AGK Studio and Classic doesn't correctly detect Joystick Buttons. Documentation says that there's support for up to 64 buttons accessed via index.

I have a SteelSeries Nimbus connected to my iMac.

The analog controls are detected correctly Any buttons pressed don't register at all.

SteelSeries Nimbus+ connected The analog controls are detected, and A, B, X Y map to 1,2,3,4 and Bumpers Left and Right as 5 and 6, Triggers don't show, also D-Pad doesn't show any active state across all 64 indexes.

In addition, the SteelSeries seem to have the Y-Axis inverted from that of PS3/XBox Controllers.

GetRawJoystickName(index) doesn't return any data, although on macOS it shows in connections for other applications like OpenEMU etc.

During Startup

// Detect Connected Joysticks CompleteRawJoystickDetection()

Later in Code

` connectedJoystick$="Connected Joysticks: " for i = 1 to 64 if GetRawJoystickConnected(i) connectedJoystick$=connectedJoystick$+ GetRawJoystickName(i) + str(i)+", " endif next i print(connectedJoystick$)

print ("Joystick X: " + str(GetJoystickX()))
print ("Joystick Y: " + str(GetJoystickY()))

JoyButtons$="Joystick1 Buttons: "
for i = 1 to 64
    a = GetRawJoystickButtonState(1,i)
    if(a <> 0)
        JoyButtons$ = JoyButtons$ + str(i) + " , "
    endif
next i
print (JoyButtons$)

JoyButtons$="Joystick2 Buttons: "
for i = 1 to 64
    a = GetRawJoystickButtonState(2,i)
    if(a <> 0)
        JoyButtons$ = JoyButtons$ + str(i) + " , "
    endif
next i
print (JoyButtons$)`

I believe any combination of buttons should be detected when testing for the 1-64 indexes identified in the documentation, however this isn't the case. Other software, i.e. OpenEMU correctly detected these joysticks and buttons.

In addition Getting the Name of each of these controllers in AGK results in Null, whereas other programs reveals the correct name.

Are you using the Apple Defined GCController methods for detecting joystick controllers in macOS and iOS/iPadOS?

Have more controllers I can test with.

GG Steelseries Original : This one shows the analog sticks as one, Y-Axis is Inverted showing -1.0 for Up. IMG_2215

GG SteelSeries Nimbus+

IMG_2216

8Bit DO Arcade Stick:

P1, P2, RT, LT, Turbo and Star won't register in any of the 64 slots.

ABXY,LB,RB, Select, Start do register.

Joystick needs to be switched to LS, doesn't register as DP or RS.

IMG_2217

VirtualNomad19 commented 1 year ago

noting here for anyone coming across this:

Version 2023.01.25

  • Removed joystick support on Mac due to unsupported library