Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FF-GP1 not recognized as Game Controller #7700

Closed
drfiemost opened this issue May 12, 2023 · 14 comments
Closed

FF-GP1 not recognized as Game Controller #7700

drfiemost opened this issue May 12, 2023 · 14 comments
Labels
waiting Waiting on user response
Milestone

Comments

@drfiemost
Copy link

Trying to make the Final Fantasy XIV game controller work with SDL2 (2.24.0) on Linux but SDL_IsGameController() returns false so we cannot get the button mappings.

We tried to add the configuration to the GameControllerDB and then load it with SDL_GameControllerAddMappingsFromFile (see mdqinc/SDL_GameControllerDB#678) but it's still being recognized as "FUJIWORK CO., FF-GP1". The function returns 273 as the number of mappings added.

This is the mapping produced with SDL2 Gamepad Mapper and included in the gamecontrollerdb.txt file:
03005036852100000201000010010000,Final Fantasy XIV,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:-a0,+leftx:+a0,-lefty:-a1,+lefty:+a1,-rightx:-a2,+rightx:+a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Linux

The ID is slightly different from the one in the SDL2 internal DB:
"03000000852100000201000000000000,FF-GP1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",

@slouken
Copy link
Collaborator

slouken commented May 12, 2023

Try this patch?

diff --git a/src/joystick/SDL_gamepad_db.h b/src/joystick/SDL_gamepad_db.h
index 0847a8c38..feca2cadc 100644
--- a/src/joystick/SDL_gamepad_db.h
+++ b/src/joystick/SDL_gamepad_db.h
@@ -611,6 +611,7 @@ static const char *s_GamepadMappings[] = {
     "050000004c050000f20d000000010000,DualSense Edge Wireless Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
     "030000006f0e00003001000001010000,EA Sports PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
     "03000000790000001100000010010000,Elecom Gamepad,crc:e86c,a:b2,b:b3,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b0,y:b1,",
+    "03000000852100000201000010010000,Final Fantasy XIV,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
     "03000000b40400001124000011010000,Flydigi Vader 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b12,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b14,paddle1:b2,paddle2:b5,paddle3:b16,paddle4:b17,rightshoulder:b7,rightstick:b13,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", /* Dongle */
     "03000000b40400001224000011010000,Flydigi Vader 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b12,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b2,paddle1:b16,paddle2:b17,paddle3:b14,paddle4:b15,rightshoulder:b7,rightstick:b13,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", /* Wired */
     "05000000151900004000000001000000,Flydigi Vader 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b21,leftshoulder:b6,leftstick:b12,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b14,paddle1:b2,paddle2:b5,paddle3:b16,paddle4:b17,rightshoulder:b7,rightstick:b13,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", /* Bluetooth */

@drfiemost
Copy link
Author

I cannot test personally as I don't own the controller, but will report back as soon as I have some news. Thanks!

drfiemost added a commit to HurricanGame/Hurrican that referenced this issue Jun 21, 2023
Also add Final Fantasy XIV mapping as suggested at libsdl-org/SDL#7700
@slouken
Copy link
Collaborator

slouken commented Nov 8, 2023

Did this work?

@slouken slouken added this to the 2.30.0 milestone Nov 8, 2023
@drfiemost
Copy link
Author

Haven't got any feedback yet. @Silicomancer any chance you could check?

@Silicomancer
Copy link

I tested the patch via Hurrican game. See this issue: HurricanGame/Hurrican#35
It didn't work. I don't know if it is a game issue or a SDL issue. Can't say much more since I am not involved in developing the game.

I guess the issue can only be cleared by having Hurrican and SDL developers look at the code together.

If there is a new game version to test, just tell me.

@slouken
Copy link
Collaborator

slouken commented Nov 8, 2023

Can you grab the SDL source code and build and run test/testcontroller?

You can get the code from:
https://github.com/libsdl-org/SDL

You can build and test like this:
cd SDL; mkdir -p build; cd build; cmake .. -DSDL_TESTS=ON; make; test/testcontroller

@slouken slouken added the waiting Waiting on user response label Nov 8, 2023
@Silicomancer
Copy link

Ok, build worked, GUI is running. It found the controller and pressing buttons makes number boxes on the right side green.

What else can I do?

@slouken
Copy link
Collaborator

slouken commented Nov 9, 2023

Press "Setup Mapping" and go through the mapping process, click "Copy" and paste it here.

@Silicomancer
Copy link

Ok, this is the result:

03005036852100000201000010010000,FUJIWORK CO. FF-GP1,crc:3650,platform:Linux,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,

Do the numbers on the right-hand side have any meaning? I have noticed that the numbers in the tool do not match the numbers printed on my gamepad. Also the letters of the buttons (X,Y,A,B) do not match those on my gamepad (it only has numbers). When mapping, I just made sure that the buttons on the picture have more or less the same position as on my gamepad. Did I do it right?

@slouken
Copy link
Collaborator

slouken commented Nov 9, 2023

You did it perfectly.

So if you open a terminal window and run:
export SDL_GAMECONTROLLERCONFIG="03005036852100000201000010010000,FUJIWORK CO. FF-GP1,crc:3650,platform:Linux,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,"
and then launch a game from that terminal window, it should have the correct mapping for your controller.

@drfiemost
Copy link
Author

is it ok if we put it into the gamecontrollerdb and load it with SDL_GameControllerAddMappingsFromFile?

We've tried with the following line with no luck:

03000000852100000201000010010000,Final Fantasy XIV,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,

I see the Id is slightly different but don't understand the meaning.

@slouken
Copy link
Collaborator

slouken commented Nov 9, 2023

That should have worked as well, I'm not sure why that didn't work.

@Silicomancer
Copy link

You did it perfectly.

So if you open a terminal window and run: export SDL_GAMECONTROLLERCONFIG="03005036852100000201000010010000,FUJIWORK CO. FF-GP1,crc:3650,platform:Linux,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3," and then launch a game from that terminal window, it should have the correct mapping for your controller.

Will this also work when running a flatpak wrapped game?

@slouken
Copy link
Collaborator

slouken commented Nov 12, 2023

I don't know, try it?

@slouken slouken closed this as completed Nov 12, 2023
@slouken slouken reopened this Nov 12, 2023
@slouken slouken closed this as completed Dec 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting Waiting on user response
Projects
None yet
Development

No branches or pull requests

3 participants