o0Zz / sys-con

Nintendo Switch sysmodule that allows support for third-party controllers (XBox, PSX, PC, ...)
GNU General Public License v3.0
48 stars 4 forks source link

Feature Request - assign directions on buttons and buttons on directions #24

Closed kfkboys closed 6 days ago

kfkboys commented 1 month ago

I'm having a hard time trying to do something odd.

I got Ace Combat 7 and I have the switch setup as normal however I want to use a HOTAS setup. I've got the PS3 HOTAS and several other HOTAS setups but I've got almost everything working properly on the PS3 version of the setup - Truthfully I want to figure this out so I can get the PS4 version setup so I can attach the pedals to hook into the YAW controls and get a real flight sim setup on the switch. Everything currently works except the camera setup is odd (it does work but I want to setup to use the paddle - Left and Right - for YAW) and throttle is set to buttons not to the left stick because I have yet to figure out how to map individual stick directions to a button.

Ultimately I want to map or swap the following: left stick LEFT (Currently Throttle Paddle) to ZL left stick RIGHT (Currently Throttle Paddle) to ZR left stick UP (Currently Throttle) to R left stick DOWN (Currently Throttle) to L

and then I can then map or swap the current buttons to the camera currently left stick ZR (Currently Button 8) to something else probably left stick to right direction ZL (Currently Button 7) to something else probably left stick to left direction R (Currently Button 1) to something else probably left stick up direction L (Currently Button 4) to something else probably left stick down direction

I would also like if I can map things to the D-PAD, but ideally still map things to each stick direction would be amazing.

I see the swapDPADandLSTICK in the SwitchAbstractedPadHandler.cpp and it's possible to swap these L-stick to dpad but I am failing to see how I can do this for individual buttons. I'm sure I'm missing something simple. One of the only HOTAS setups I see in here is the X52FlightControlSystem and I unfortunately do not own that one.

Here's my setup thus far:

[044f-b109] ;Automatically added on 2024-7-13 0:30:53UTC color_body = #00FF00 color_buttons = #000000 color_leftGrip = #FF00FF color_rightGrip = #FF00FF b=6 a=5 x=11 y=12 l=4 r=1 zl=8 zr=7 minus=9 plus=10 capture=15 home=13 lstick_click=2 rstick_click=3

(update, I was able to change the colors of the controls without an issue) log.log

kfkboys commented 1 month ago

Also, if there is a working example of swapping the control stick to the d-pad in a config file I would appreciate a link. When using the example.ini file for reference the

; Swap the button inputs for dpad and lstick, so that the dpad will be treated as analog input. swap_dpad_and_lstick = false ; set this to true to swap the d-pad and left stick

if I set the setting swap_dpad_and_lstick = true and setting the logging to debug, I do not see a change in the sticks.

I have however found that the T.Flight HOTAS X which is the HOTAS setup I'm currently using has a hardware button mapping function built onto the controller.

By setting the left rotation of the main stick to button 8 and the right rotation to button 9 I am able to adjust the yaw on the flight stick to the proper settings. I have also mapped the forward direction of the left joystick to button 1 and backward direction or negative forward direction to button 4 with the current setup and have corrected the throttle.

I have not yet figured out why I can not map multiple buttons to a single button, i.e. button 2 and button 3 for a single button to launch flares, either way it currently works fantastically with this joystick.

The GOOD NEWS: Mapping functions to a single button once complete will solve these issues in software and is currently possible to do ONLY via a hardware mapping using the Thrustmaster PS3 mode T.Flight HOTAS X. Ace Combat 7 is now completely playable via this one specific PS3 Thrustmaster flight stick.

The TO BE WORKED ON: Identifying the other HOTAS setups on the switch I do not see a way to identify the 2nd stick (left) and would like to see the development of being able to identify a raw input especially when mapping it to buttons and buttons to directions i.e. buttons for camera control. Multi button to single button mapping. The Thrustmaster PS3 mode T.Flight HOTAS X does not have a way to place pedals into the flight stick in order to add heading, rudder, breaks, or yaw control via your feet.

o0Zz commented 1 month ago

Regarding swap_dpad_and_lstick I think you are mixing 2 things, the old sys-con version and this new fork. This fork don't have example.ini and don't have swap_dpad_and_lstick option. I suggest you to remove to /config/sys-con and to re-extract everything from this fork in order to not mix configurations.

Regarding other points, there is lot of information in all your tickets I will trying to summarize the need:

  1. You need to be able to simulate sticks (right or left) with buttons so for example something like:

    right_stick_left=4
    right_stick_right=1
    right_stick_up=8
    right_stick_down=7
  2. You need the reverse, be able to simulate press button from sticks or dpad example:

zl=left_stick_left
l=left_stick_right
r=left_stick_up
zr=left_stick_down
  1. In your last request, you added a way to set Multi button to single button mapping.

Is this summary correct ? Thanks

kfkboys commented 1 month ago

Yes, your summary is correct on all 3 points.

I have deleted the original config and am only using yours. You are correct, I was confusing the old swap_dpad_and_lstick on the old fork. Is the ability to map the dpad direction to a button still possible in this fork?

o0Zz commented 1 month ago

Thanks for the confirmation. its possible to map dpad with a button. But its not possible to map dpad to a button I think this is the same example than point 2. You would like to have:

zr=dpad_up
....

Correct ?

kfkboys commented 1 month ago

Something like that yes. I'm not sure I specifically want zr=dpad_up, but yes to map any button to any dpad direction would be ideal.

o0Zz commented 1 month ago

Hi,

OK I implemented the 3 points we discussed. Thus you should be able to bind multiple key and to do some alias. Let me know if it match your needs:

sys-con-1.2.2+13-ATMOSPHERE-1.6.x.zip sys-con-1.2.2+13-ATMOSPHERE-1.7.x.zip

You have some example here: https://github.com/o0Zz/sys-con/blob/master/doc/Troubleshooting.md#i-want-to-bind-a-button-to-dpad-or-stick

kfkboys commented 1 month ago

I am so excited to test this! I will report back asap

o0Zz commented 1 month ago

Any update about this ticket ?

kfkboys commented 1 month ago

Sorry for the delay. I've been attempting every way I can think of to make this work using your updates. I have not been able to change the stick directions to any button or buttons to stick directions.

right_stick_left=4 right_stick_right=1 right_stick_up=8 right_stick_down=7

I have changed single directions at a time to verify it isn't working, and I have also changed multiple directions with the same outcome. I have not yet been able to change any button or any stick direction no matter the configuration.

I have also used the following: zl=lstick_left l=lstick_right r=lstick_up z=lstick_down rstick_left=4 rstick_right=1 rstick_up=8 rstick_down=7

This was based on the default profile mapping at the top of the config.ini

o0Zz commented 1 month ago

Hum strange. I tried it on my side and seems to works. Could you provide the log in trace mode: log_level=2 (You need to reboot the switch once you set it as trace mode) then provide the complete log file and the complete ini file.

Ideally, once you rebooted the switch could you press a button that is suppose to be the direction? (In order to see it in logs)

Thanks

o0Zz commented 3 weeks ago

Any update ?

kfkboys commented 2 weeks ago

sorry about the delay, life has gotten in the way. Attached is my config file, and my log file.

I redid every combination I can think of and realized I didn't have the level 2 log enabled. I am so sorry I didn't get this earlier to you.

config.zip

log.log

o0Zz commented 2 weeks ago

Ok I will need more details here because i'm confused.

1) Could you confirm this is your joystick: image

2) Could you confirm the button ID (4, 3, etc..._) are correct on this picture ?

3) In your configuration.ini you are changing [044f-b109] which seems to be the PS3 version. However I don't see any profile=dualshock3 in this section, in order to use the PS3 driver. What's happen when you plug this controller to a PC, Does it works without any driver ?

4) in your configuration.ini this section [044f-b108] (which seems to be the "Thrustmaster T.Flight HOTAS X") look like unchanged, did you try to setup it?

Then if I check your tries versus your original request :

You tried this

l=lstick_right
r=lstick_up
z=lstick_down
rstick_left=4
rstick_right=1
rstick_up=8
rstick_down=7

while lstick = left stick and rstick = right stick

while your original request was on lstick =>

Ultimately I want to map or swap the following: left stick LEFT (Currently Throttle Paddle) to ZL left stick RIGHT (Currently Throttle Paddle) to ZR left stick UP (Currently Throttle) to R left stick DOWN (Currently Throttle) to L ZR (Currently Button 8) to something else probably left stick to right direction ZL (Currently Button 7) to something else probably left stick to left direction R (Currently Button 1) to something else probably left stick up direction L (Currently Button 4) to something else probably left stick down direction

Could you confirm what you want to do ? Thanks

kfkboys commented 2 weeks ago

Hello Thanks for your patience.

  1. Could you confirm this is your joystick: Yes, the T.Flight Hotas X joystick is the correct one, in PS3 mode, there is a switch on the back to change it to PC mode, but I am using PS3 mode.

  2. Could you confirm the button ID (4, 3, etc..._) are correct on this picture ? The button ID's are not correct in the picture. image

  3. In your configuration.ini you are changing [044f-b109] which seems to be the PS3 version. However I don't see any profile=dualshock3 in this section, in order to use the PS3 driver. What's happen when you plug this controller to a PC, Does it works without any driver ?

Yes, when plugged in, the HOTAS X in PS3 mode (same mode as when plugged into the swtich) it operates exactly as it is supposed to, no driver necessary to operate. If I include the following lines ; ; Dualshock 3 controllers ;

[044f-b109] ;T.Flight Hotas X profile=dualshock3

The controller will not connect in PS3 mode.

  1. in your configuration.ini this section [044f-b108] (which seems to be the "Thrustmaster T.Flight HOTAS X") look like unchanged, did you try to setup it?

In this mode, this is the mechanical switch on the back of the joystick labeled PC instead of PS3, This recognizes even less controls and yes I did set this up but ultimately reverted back to the PS3 version and left that config alone.

What I would like to do. image

I have attached a picture of the mechanical PS3 PC switch IMG_20240818_064018344

o0Zz commented 2 weeks ago

Thanks for the explanation, thus try this :

r=rstick_up
l=rstick_down
zl=rstick_left
zr=rstick_right

Let me know if you note any change

kfkboys commented 2 weeks ago

Excellent Thank You.

I have implemented the following in the config file r=rstick_up l=rstick_down zl=rstick_left zr=rstick_right

and this now works in part, R, L, ZR, ZL are all pressed correctly when the joysticks are moved HOWEVER, the joystick also is moving at the same time and it disables the log.

r=rstick_up ; this will press the R button when the rstick moves up, it will also register the rstick moving up l=rstick_down ; this will press the L button when the rstick moves down, it will also register the rstick moving down zl=rstick_left ; this will press the ZL button when the rstick moves left, it will also register the rstick moving left zr=rstick_right ; this will press the ZR button when the rstick moves right, it will also register the rstick moving right

Perhaps this was an oversight or misunderstanding on my part. I thought that when a button was remapped, then the original function would no longer occur.

I realize that I have asked for double function bindings, perhaps the more accurate description of what I am trying to do is replace some functions and double others if possible? Maybe the best way to ask this is how do I disable the original button or original direction after it it has been updated and bound to a key or direction so that bound key or direction direction would take over?

o0Zz commented 2 weeks ago

Ok, what you describe is actually expected, at least that is the way it was implemented. Today the code uses the rstick value to map zl zr etc... if we "disable" rstick then zl zr etc... will no longer work. This is a bit like a snake eating its own tail. The problem here is that sys-con has no way of knowing when/how to disable rstick and when/how to take it into account. And depending on the order in which it does this, it will change the result and may not fit some other use cases.

Today there is no way to disable rstick and use it for a button at the same time, it will either be disabled for all or enabled for all. Give me the night to think about it.

o0Zz commented 1 week ago

I'm back for new adventures ;) !

So this new build should do the job. In the previous version some combinations were not possible, in this one theoretically any combination is possible. However, I've changed a lot of the binding configuration, so try to forget the previous version and think of it as a new config ;)

sys-con-1.3.0+6-ATMOSPHERE-1.7.x.zip

Here is the configuration I think you want:

[044f-b109] 
color_body = #00FF00
color_buttons = #000000
color_leftGrip = #FF00FF
color_rightGrip = #FF00FF
lstick_left=8,None
lstick_right=7,None
lstick_up=1,None
lstick_down=4,None
b=6
a=5
x=11
y=12
l=-Z
r=Z
zl=-Rz
zr=Rz
minus=9
plus=10
capture=15
home=13
lstick_click=2
rstick_click=3

Let me know the result

kfkboys commented 1 week ago

Thank you, I am so grateful for your work!

I will be able to test this on Thursday or Friday due to pressing work issues.

kfkboys commented 1 week ago

I have now tested this thoroughly and have no idea why I can not remap the control sticks either left or right. The logging also doesn't register anything from any button press, only initialization and deinitialization when plugged and unplugged.

I renamed the extensions ".txt" for the files so it would append to the post if needed.

log.log.txt

config.ini.txt

o0Zz commented 1 week ago

You are running an incorrect version of sys-con, something is wrong on your setup. Try to re-extract the zip from scratch and to reboot the switch.

You are not suppose to have such kind of errors

|E|21:56:23.350|3714B0D0| Unknown key: deadzone_x, continue anyway ...
|E|21:56:23.357|3714B0D0| Unknown key: deadzone_y, continue anyway ...
|E|21:56:23.362|3714B0D0| Unknown key: deadzone_z, continue anyway ...
|E|21:56:23.368|3714B0D0| Unknown key: deadzone_rz, continue anyway ...
|E|21:56:23.374|3714B0D0| Unknown key: deadzone_rx, continue anyway ...
|E|21:56:23.379|3714B0D0| Unknown key: deadzone_ry, continue anyway ...
|E|21:56:23.387|3714B0D0| Unknown key: deadzone_slider, continue anyway ...
|E|21:56:23.393|3714B0D0| Unknown key: deadzone_dial, continue anyway ...
kfkboys commented 1 week ago

I was able to reload the same version from the zip file. Everything seems to load correctly except the control sticks are disabled.

Here is my config.ini file.

[044f-b109] controller_type=pro color_body = #00FF00 color_buttons = #000000 color_leftGrip = #FF00FF color_rightGrip = #FF00FF lstick_left=8,None lstick_right=7,None lstick_up=1,None lstick_down=4,None rstick_left=None,rstick_left rstick_right=None,rstick_right rstick_up=None,rstick_up rstick_down=None,rstick_down b=6 a=5 x=11 y=12 l=-Z r=Z zl=-Rz zr=Rz minus=9 plus=10 capture=15 home=13 lstick_click=2 rstick_click=3

All the buttons are now correctly mapped HOWEVER, if I do not include the following: rstick_left=None,rstick_left rstick_right=None,rstick_right rstick_up=None,rstick_up rstick_down=None,rstick_down

then any time I turn the joystick, my second stick is also increasing in value along with pressing the L or R mapped button. The either joystick is not functional, only the button mappings are.

log.log.txt

o0Zz commented 1 week ago

Your rstick configuration is incorrect that why it doesn't works. What do you want to map here ? Do you want to map Z ? Slider ? Rz ? Nothing ? If you want to disable rstick just write:

rstick_left=0,None
rstick_right=0,None
rstick_up=0,None
rstick_down=0,None

If you want for example to map slider on Up/Down then:

rstick_left=0,None
rstick_right=0,None
rstick_up=0,+Slider
rstick_down=-0,-Slider
kfkboys commented 6 days ago

I greatly appreciate all your help EVERYTHING WORKS!!! I had a few things that were incorrect on my end, however after rewriting my config to correctly map the controls, I realized I was using the incorrect stick to control some of it. In my controller there is a hardware remap section and it allows exactly what you did in sys-con. I didn't realize at the time, but I must have switched the left and right sticks at some point.

Now, however, You have provided completely native support for this control and it is amazing! I am so very happy with the setup I have now and It's awesome! I am so very excited to just swap in controls when needed for my game.

The final config that is working is below for Ace Combat 7 Deluxe working with a T.Flight Hotas X in PS3 Mode:

[044f-b109] ; T.Flight Hotas X - PS3 Mode controller_type=pro color_body = #00FF00 color_buttons = #000000 color_leftGrip = #FF00FF color_rightGrip = #FF00FF rstick_left=8,None rstick_right=7,None rstick_up=1,None rstick_down=4,None b=6 a=5 x=11 y=12 l=Rz r=-Rz zl=-Z zr=Z minus=9 plus=10 capture=15 home=13 lstick_click=2 rstick_click=3

I am going to try doing this with the PS4 stick that I have also in order that I may also have the pedals working :) I am so excited! This is seriously one of the best and most fun things I have had the opportunity to be a part of the development for testing. Thank You.

If I may make a suggestion, in the log, it would be awesome to have a mention of the version of sys-con so the end user may realize the version is off or incorrect the same way you pointed out to me.

o0Zz commented 6 days ago

Great! Glad to hear you finally got the binding you were waiting for ;). It was also a pleasure working with you on this feature.

Just before you continue with another controller, install this new version sys-con-1.3.0+11-ATMOSPHERE-1.7.x.zip, this version avoids the need to add ,None to disable the previous mapping. This is in fact a bug in sys-con that I fixed a few days ago, but I didn't want to bother you during your tests. I have already included your mapping in this version, so it should work without the need to change your ini file.

Regarding the sys-con version in the logs, this is in fact already implemented. Every time you boot the console, you will see the sys-con version ->

image

Enjoy ! :)