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

input configuration (sdl / linux input) not working correctly #1546

Open
teletrail opened this issue Jul 25, 2024 · 16 comments
Open

input configuration (sdl / linux input) not working correctly #1546

teletrail opened this issue Jul 25, 2024 · 16 comments

Comments

@teletrail
Copy link

What's the full name of the game (including region) ?
only looked at input config

What's your frontend ? (standalone, libretro, ...) ?
standalone

What's your OS ? (windows, linux, OSX, ...) ?
gentoo linux
What's your hardware ? (CPU, GPU, ...) ?
ryzen 5 3600 / nvidia rtx 2060 gpu / 32 gb ram / steam controller also wacom drawing tablet which detects (incorrectly) like a gamepad

What's the storage type of the game (official cd, burned cd or cd image) ?
no game

If applicable, what's the format of your cd image ? (cue/bin, ccd/img, iso, chd, ...)

Are you using any setting different from default ? If so, precise

this is freshly compiled

Did this game work previously ? Do you remember when ? Is it happening with other games ?
the main yabause software also had this issue (input configuration)

If applicable, provide error messages, logs, screenshots, or whatever additional information that could help debugging this

when configuring the inputs, when the input is selected rather than wait for an input from control pad, the configuration dialog maps an input straight away (I do not see what it is) and marks it with a check mark. that is with sdl interface, the linux input interface does not do this however it does not appear to detect inputs at all.

any help is appreciated, this is with a git cloned source compile.

thanks!

@teletrail
Copy link
Author

teletrail commented Jul 25, 2024

I unplugged the wacom tablet and was able to configure a control pad without this behaviour. it appears to be an interaction with the sdl input mapping and the tablet (current wacom drivers, kde plasma desktop environment.

however with the game pad (3d controller) configured the game (sega touring car championship JP demo) does not recognise inputs. (this is with wacom plugged back in - maybe a conflict?)

any advice would be great.

@teletrail
Copy link
Author

so currently the wacom is detected with /dev/js0 and my control pad (steam controller) is /dev/js1. with the wacom unplugged I am able to map controls however they are inconsistent in-game? (sega touring car jp demo)

looked at 3d controller and regular controller.

@Tatsh
Copy link

Tatsh commented Nov 20, 2024

Can you paste your yabause.ini file? I would like to figure out what the values are supposed to be.

@teletrail
Copy link
Author

hi! thank you for your reply.

here is the yabause.ini file.

[1.0]
Advanced\68kCore=3
Advanced\SH2Interpreter=8
Cartridge\ModemIP=127.0.0.1
Cartridge\ModemPort=1337
Cartridge\Path=
Cartridge\Path\32MbitDram=
Cartridge\STVGame=0
Cartridge\Type=7
Debug\Addr2Line=
General\Bios=
General\BiosSettings=
General\CdRom=2
General\CdRomISO=
General\ClockSync=false
General\EnableEmulatedBios=false
General\EnableVSync=true
General\FixedBaseTime=1998-01-01T12:00:00
General\Geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\x2\x82\0\0\x1*\0\0\x5\t\0\0\x3)\0\0\x2\x86\0\0\x1\x46\0\0\x5\x5\0\0\x3%\0\0\0\0\0\0\0\0\a\x80\0\0\x2\x86\0\0\x1\x46\0\0\x5\x5\0\0\x3%)
General\SH2Cache=false
General\SaveStates=/media/project/taskdisk/24.07/Kronos/yabause/build/src/port/qt
General\ScreenshotsDirectory=/media/project/taskdisk/24.07/Kronos/yabause/build/src/port/qt/screenshots
General\ScreenshotsFormat=png
General\ShowFPS=false
General\SystemLanguageID=0
General\Translation=
General\Version=2.6.1
Input\GunMouseSensitivity=100
Input\PerCore=3
Input\Port\1\Id\1\Controller\2\Key\0=1048577
Input\Port\1\Id\1\Controller\2\Key\1=1114112
Input\Port\1\Id\1\Controller\2\Key\10=3
Input\Port\1\Id\1\Controller\2\Key\11=4
Input\Port\1\Id\1\Controller\2\Key\12=1114114
Input\Port\1\Id\1\Controller\2\Key\2=1114113
Input\Port\1\Id\1\Controller\2\Key\3=1048576
Input\Port\1\Id\1\Controller\2\Key\6=8
Input\Port\1\Id\1\Controller\2\Key\7=1
Input\Port\1\Id\1\Controller\2\Key\8=2
Input\Port\1\Id\1\Controller\2\Key\9=1114117
Input\Port\1\Id\1\Controller\22\Key\0=2097168
Input\Port\1\Id\1\Controller\22\Key\1=2097184
Input\Port\1\Id\1\Controller\22\Key\10=3
Input\Port\1\Id\1\Controller\22\Key\11=4
Input\Port\1\Id\1\Controller\22\Key\12=1114114
Input\Port\1\Id\1\Controller\22\Key\18=16384
Input\Port\1\Id\1\Controller\22\Key\19=16385
Input\Port\1\Id\1\Controller\22\Key\2=2097216
Input\Port\1\Id\1\Controller\22\Key\3=2097280
Input\Port\1\Id\1\Controller\22\Key\6=8
Input\Port\1\Id\1\Controller\22\Key\7=1
Input\Port\1\Id\1\Controller\22\Key\8=2
Input\Port\1\Id\1\Controller\22\Key\9=1114117
Input\Port\1\Id\1\Type=2
Memory\ExtendMemory=false
Memory\Path=/media/project/taskdisk/24.07/Kronos/yabause/build/src/port/qt/bkram.bin
MpegROM\Path=
Recents\ISOs=
STV\Region=E
Shortcuts\%26Backup%20Manager...=Alt+B
Shortcuts\%26Cheats%20List...=Alt+L
Shortcuts\%26Debug=
Shortcuts\%26Emulation=
Shortcuts\%26File=
Shortcuts\%26Fullscreen=Alt+Return
Shortcuts\%26Help=
Shortcuts\%26Layer=
Shortcuts\%26Log=Ctrl+L
Shortcuts\%26Master%20SH2=
Shortcuts\%26Pause=F2
Shortcuts\%26Quit=Ctrl+Q
Shortcuts\%26Reset=F3
Shortcuts\%26Settings...=Ctrl+S
Shortcuts\%26Slave%20SH2=
Shortcuts\%26Tools=
Shortcuts\%26Transfer=Ctrl+T
Shortcuts\%26Vertical%20synchronization=F4
Shortcuts\%26View=
Shortcuts\0%20...%20=Alt+0
Shortcuts\1%20...%20=Alt+1
Shortcuts\2%20...%20=Alt+2
Shortcuts\3%20...%20=Alt+3
Shortcuts\4%20...%20=Alt+4
Shortcuts\5%20...%20=Alt+5
Shortcuts\6%20...%20=Alt+6
Shortcuts\7%20...%20=Alt+7
Shortcuts\8%20...%20=Alt+8
Shortcuts\9%20...%20=Alt+9
Shortcuts\Cheat%20%26Search...=Alt+S
Shortcuts\Eject\Load%20ISO...=Ctrl+I
Shortcuts\F%26PS=F12
Shortcuts\From%20File...=F5
Shortcuts\L%26oad%20State=
Shortcuts\Load0=Alt+0
Shortcuts\Load1=Alt+1
Shortcuts\Load2=Alt+2
Shortcuts\Load3=Alt+3
Shortcuts\Load4=Alt+4
Shortcuts\Load5=Alt+5
Shortcuts\Load6=Alt+6
Shortcuts\Load7=Alt+7
Shortcuts\Load8=Alt+8
Shortcuts\Load9=Alt+9
Shortcuts\Log=
Shortcuts\M%2668K=
Shortcuts\Memory%20%26Editor=
Shortcuts\Memory%20Transfer=
Shortcuts\NBG0=2
Shortcuts\NBG1=3
Shortcuts\NBG2=4
Shortcuts\NBG3=5
Shortcuts\Open%20%26CD%20Rom...=Ctrl+C
Shortcuts\R%26un=F1
Shortcuts\RBG0=6
Shortcuts\RBG1=7
Shortcuts\S%26CSP=
Shortcuts\S%26ave%20State=
Shortcuts\SCSP%20Channels=
Shortcuts\SCU-%26DSP=
Shortcuts\Save0=Ctrl+0
Shortcuts\Save1=Ctrl+1
Shortcuts\Save2=Ctrl+2
Shortcuts\Save3=Ctrl+3
Shortcuts\Save4=Ctrl+4
Shortcuts\Save5=Ctrl+5
Shortcuts\Save6=Ctrl+6
Shortcuts\Save7=Ctrl+7
Shortcuts\Save8=Ctrl+8
Shortcuts\Save9=Ctrl+9
Shortcuts\Sc%26reenshot=Ctrl+P
Shortcuts\Sound...=
Shortcuts\Start=
Shortcuts\Stop=
Shortcuts\To%20File...=F9
Shortcuts\VDP%261=
Shortcuts\VDP%262=
Shortcuts\Vdp1=1
Shortcuts\Video%20Driver=
Shortcuts\toolBar=
Sound\SoundCore=1
Sound\Volume=100
Video\AspectRatio=0
Video\BandingMode=0
Video\Fullscreen=false
Video\MeshMode=0
Video\OSDCore=3
Video\VideoCore=2
Video\Wireframe=0
Video\filter_type=0
Video\polygon_generation_mode=1
Video\resolution_mode=1
Video\upscale_type=0
View\Menubar=3
View\Toolbar=1
autostart=true

thanks again!

note: I found a udev rule file that would disable the wacom from detecting however there was a conflict with my control pad (steam controller) so I did not work with it. maybe I could look at it again?

@Tatsh
Copy link

Tatsh commented Nov 21, 2024

For any given key press value when using SDL, the SDL joystick ID is shifted 18 bits to the left so the joystick ID for 1048577 is (1048577 >> 18) is 4. The saved button index is (SDL button index + 1) OR'd with that, so the button ID is 1. (4 << 18) | (0 + 1) = 0b100000000000000000001 or 1048577.

A tool like https://github.com/Grumbel/sdl-jstest should help to get the SDL joystick and button IDs. Can also use PySDL2 if you have that installed. import sdl2; sdl2.SDL_NumJoysticks(); ...

Reference: https://github.com/FCare/Kronos/blob/10a371a5e8ca975c71c8228a4131f21657d066da/yabause/src/core/peripheral/sdl/persdljoy.c#L228C18-L228C23

@Tatsh
Copy link

Tatsh commented Nov 21, 2024

Button numbers:

0 = up
1 = right
2 = down
3 = left
4 = right trigger
5 = left trigger
6 = start
7 = A
8 = B
9 = C
10 = X
11 = Y
12 = Z

I manually mapped my PS5 controller and it is joystick ID 0:

Input\Port\1\Id\1\Controller\2\Key\0=12
Input\Port\1\Id\1\Controller\2\Key\1=15
Input\Port\1\Id\1\Controller\2\Key\10=4
Input\Port\1\Id\1\Controller\2\Key\11=6
Input\Port\1\Id\1\Controller\2\Key\12=17
Input\Port\1\Id\1\Controller\2\Key\2=13
Input\Port\1\Id\1\Controller\2\Key\3=14
Input\Port\1\Id\1\Controller\2\Key\4=11
Input\Port\1\Id\1\Controller\2\Key\5=10
Input\Port\1\Id\1\Controller\2\Key\6=7
Input\Port\1\Id\1\Controller\2\Key\7=1
Input\Port\1\Id\1\Controller\2\Key\8=2
Input\Port\1\Id\1\Controller\2\Key\9=3

Not an ideal config above because this is not an ideal controller for the purpose.

@teletrail
Copy link
Author

hallo, thank you for your reply!

I installed that sdl2-jstest tool and found the mappings for the steam controller:

Joystick Name:     'Microsoft X-Box 360 pad 0'
Joystick GUID:     030079f6de280000ff11000001000000
Joystick Number:    1
Number of Axes:     6
Number of Buttons: 11
Number of Hats:     1
Number of Balls:    0
GameControllerConfig:
  Name:    'Steam Virtual Gamepad'
  Mapping: '030079f6de280000ff11000001000000,Steam Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,'

then I copied these to the kronos.ini file, following your guide:

Input\Port\1\Id\1\Controller\2\Key\0=h0.1
Input\Port\1\Id\1\Controller\2\Key\1=h0.2
Input\Port\1\Id\1\Controller\2\Key\10=b3
Input\Port\1\Id\1\Controller\2\Key\11=b4
Input\Port\1\Id\1\Controller\2\Key\12=b5
Input\Port\1\Id\1\Controller\2\Key\2=h0.4
Input\Port\1\Id\1\Controller\2\Key\3=h0.8
Input\Port\1\Id\1\Controller\2\Key\4=a5
Input\Port\1\Id\1\Controller\2\Key\5=a2
Input\Port\1\Id\1\Controller\2\Key\6=b7
Input\Port\1\Id\1\Controller\2\Key\7=b0
Input\Port\1\Id\1\Controller\2\Key\8=b1
Input\Port\1\Id\1\Controller\2\Key\9=b2

however the inputs do not seem to affect the game? then if I attempt to remap from in the emulator it clears all mappings and enters the numerical ids from the first .ini paste.

any suggestion or advice would be appreciated.

thanks!

@Tatsh
Copy link

Tatsh commented Nov 22, 2024

The buttons are not based on that syntax. They are custom for this project as I pointed out in the link. You have a joystick at index 1 so you must shift that 18 bits to the left and then you have to add (buttonNumber + 1) to that for the final result.

1 << 18 = 262144 so all of your buttons have to be 262144 + buttonNumber + 1. So b0 will be 262145.

Simple directional axes: joystick ID shifted to the left by 18 bits, then bitwise OR'd with 0x110000 or 0x100000 then OR'd with the axis number. Negative (probably left or up) on axis 2 on joystick 1 results in 1 << 18 | 0x100000 | 2 = 1310722.

Simple hats: Hat up on hat 1 on joystick 1 results in 1 << 18 | 0x200000 | 1 << 4 | 1 = 2359313.

For axes values that require specific pressure levels see

PerAxisValue((joyId << 18) | SDL_PERSF_AXIS_VALUE | i, (u8)(((int)curAxis+32768) >> 8));
but I do not know how that value is stored in the INI.

@teletrail
Copy link
Author

hi, thanks for the support. what ought I do for the inputs that share a number? there is a5/b5 and a2/b2 and in your equation you do not appear to address the letter before the number for your example input (b0)

thanks again!

@Tatsh
Copy link

Tatsh commented Nov 22, 2024

a means axis and b means button. They are separate inputs.

@teletrail
Copy link
Author

teletrail commented Nov 22, 2024

oh, thanks yes I see now thhe triggers on this controller are axis. I will opt to work with the shoulder buttons in t heir place, since they are simple rather than axis.

for the hat inputs they are provided with a decimal place (h0.1, h0.2, h0.4, h0.8). for the equation you provided, 1 << 18 | 0x200000 | 1 << 4 | 1 does the 1 << 4 apply to key 0, so then key 1 would be 2 << 4 ?

thanks again for your help with this, would be great to get input working!

@Tatsh
Copy link

Tatsh commented Nov 22, 2024

h0 means hat 0

So you use (0 << 4) which is 0 so it can be disregarded in this case.

@teletrail
Copy link
Author

oh yes sure. ok I will look at getting these input numbers converted.

thanks for your help!

@teletrail
Copy link
Author

great, that worked! I could not get the hat equation to work, however with x+y axis on the directional control and a/b/c I will be able to get a game to run.

thanks again for your support!

@Tatsh
Copy link

Tatsh commented Nov 22, 2024

The downside of this configuration system is that if the joystick ID changes then remapping is required.

Auto mapping with the new SDL GUID is something that should be added to this emulator.

@teletrail
Copy link
Author

I will watch out for changes in id for the controller. however I got to play a game with this emulator, which is great. appreciate the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants