Skip to content

reicast: change input mapping scripts and simplify launch script - #2992

Merged
joolswills merged 1 commit into
RetroPie:masterfrom
cmitu:reicast-mapping
Feb 19, 2020
Merged

reicast: change input mapping scripts and simplify launch script#2992
joolswills merged 1 commit into
RetroPie:masterfrom
cmitu:reicast-mapping

Conversation

@cmitu

@cmitu cmitu commented Feb 16, 2020

Copy link
Copy Markdown
Contributor

Reicast input handling has been problematic for quite some time. It looks like it's the result of 2 commits:

Instead of relying on the input:evdev_... CLI parameters, the configuration is loaded from the api_<controller_filtered_name> files, where <controller_filtered_name> is produced by make_mapping_filename.

The current configuration scripts (both from EmulationStation and Reicast) create the configuration files as controller_<gamepad_name_without_spaces>, which are not loaded by the Reicast's current version.

This PR changes the names of the .cfg file produced by the Reicast (auto)configuration and removes the input mapping from the emulator's starting script (not needed anymore).

Credit goes to user rejesterd, which analyzed this in https://retropie.org.uk/forum/topic/24544.

EDIT: the auto-configuration script called from EmulationStation doesn't reliably create a correct auto-configuration file for reicast, however SDL doesn't export any API to get the evdev event codes so we can't resolve this at the moment without modifying EmulationStation and SDL.

@joolswills

Copy link
Copy Markdown
Member

Thanks!

@joolswills

Copy link
Copy Markdown
Member

Mapping seems to work great. Thanks.

Some unrelated problem to note.

Exiting (at least on rpi4) with start and select causes a crash. I will debug this. Theres a couple of minor issues I noticed but again unrelated to this. I'm happy to.merge. thanks!

@joolswills

Copy link
Copy Markdown
Member

The crash happens when exiting during a game. It's ok when hitting tab to access in the game menu.

Just mentioning here as I'm thinking maybe while what looks like a lot of changes have been happening, maybe we should revert to an older version. This was mentioned before by one of the RetroPie devs (maybe you)?

If we did would this controller change be affected? I didn't check the history yet to see what was changed when.

@cmitu

cmitu commented Feb 17, 2020

Copy link
Copy Markdown
Contributor Author

The changes in the controller handling (referenced in my commit message) were done 1 year ago and there have been quite a lot of changed until May/June when activity kind of stopped.

The mapping script from ES doesn't seem to work - there's quite a difference between what is generated by the joystick mapping script from Reicast and what is generated after ES auto-configuration.

@joolswills

Copy link
Copy Markdown
Member

It worked for my controller at least enough that I didn't notice. There's a bunch of problems outside of this - I'm inclined to move it to experimental. Lr-flycast and redream are also available now.

Do you want me to merge this for now or hold on?

@cmitu

cmitu commented Feb 17, 2020

Copy link
Copy Markdown
Contributor Author

Let's hold on for a bit, I'll take a closer look at ES's mapping script for reicast.

@cmitu

cmitu commented Feb 18, 2020

Copy link
Copy Markdown
Contributor Author

I've taken a look at the reicast.sh auto-mapping script for EmulationStation and there are some cases which are not handled correctly anymore.

Looking at how the buttons are mapped, it assumes the evdev button indexes are starting from 288L, while some gamepads have this starting at 304L (see https://gitlab.freedesktop.org/libevdev/libevdev/blob/libevdev-1.6.0/include/linux/input-event-codes.h#L364).

Here's 2 examples with the output from a evtest report:

  1. SNES clone (iBuffalo):
Input device name: "USB,2-axis 8-button gamepad  " 
 Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 288 (BTN_TRIGGER)
    Event code 289 (BTN_THUMB)
    Event code 290 (BTN_THUMB2)
    Event code 291 (BTN_TOP)
    Event code 292 (BTN_TOP2)
    Event code 293 (BTN_PINKIE)
    Event code 294 (BTN_BASE)
    Event code 295 (BTN_BASE2)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value    128
      Min        0
      Max      255
      Flat      15
    Event code 1 (ABS_Y)
      Value    128
      Min        0
      Max      255
      Flat      15
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
  1. Sony Dualshock 4
nput device name: "Sony Interactive Entertainment Wireless Controller"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 304 (BTN_SOUTH)
    Event code 305 (BTN_EAST)
    Event code 307 (BTN_NORTH)
    Event code 308 (BTN_WEST)
    Event code 310 (BTN_TL)
    Event code 311 (BTN_TR)
    Event code 312 (BTN_TL2)
    Event code 313 (BTN_TR2)
    Event code 314 (BTN_SELECT)
    Event code 315 (BTN_START)
    Event code 316 (BTN_MODE)
    Event code 317 (BTN_THUMBL)
    Event code 318 (BTN_THUMBR)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value    130
      Min        0
      Max      255
      Fuzz      10
      Flat      15
    Event code 1 (ABS_Y)
      Value    123
      Min        0
      Max      255
      Fuzz      10
      Flat      15
    Event code 2 (ABS_Z)
      Value      0
      Min        0
      Max      255
      Fuzz      10
      Flat      15
    Event code 3 (ABS_RX)
      Value    122
      Min        0
      Max      255
      Fuzz      10
      Flat      15
    Event code 4 (ABS_RY)
      Value    128
      Min        0
      Max      255
      Fuzz      10
      Flat      15
    Event code 5 (ABS_RZ)
      Value      0
      Min        0
      Max      255
      Fuzz      10
      Flat      15
    Event code 16 (ABS_HAT0X)
      Value      0
      Min       -1
      Max        1
    Event code 17 (ABS_HAT0Y)
      Value      0
      Min       -1
      Max        1

For the 1st case, the script creates a correct mapping, but for the 2nd it doesn't. It also ignores the hat input types, so in the 2nd case (the Sony controller) it doesn't map the D-Pad buttons at all (btn_dpad1_left, btn_dpad1_right, etc. in the [dreamcast] section).

I think the auto-mapping can be fixed, but it needs an evdev compatible call to retrieve the button scancodes correctly, similar to the mapping script from reicast (using the python-evdev package).

@cmitu
cmitu marked this pull request as ready for review February 19, 2020 18:14
@cmitu

cmitu commented Feb 19, 2020

Copy link
Copy Markdown
Contributor Author

Update the status and also added the note about the limitations preventing - right now - a reliable auto-configuration method using the EmulationStation SDL scancodes or input indexes.

@joolswills

Copy link
Copy Markdown
Member

Thanks. We can revisit the mapping issues later.

@joolswills
joolswills merged commit 16c8d3b into RetroPie:master Feb 19, 2020
obrie added a commit to obrie/RetroPie-Setup that referenced this pull request Mar 6, 2023
…ial characters when generating sanitizing filenames (/, \, and *)

RetroPie#2992 references this commit in reicast: skmp/reicast-emulator@8b5c2a3#diff-b3f91e0a878ca6a79689c44f6b0e14f1e4d9d01e664190a41f5ee15f18c35adaR140-R150
which is used as the reference for which additional characters to sanitize
obrie added a commit to obrie/RetroPie-Setup that referenced this pull request Mar 6, 2023
…ial characters when generating sanitizing filenames (/, \, and *)

RetroPie#2992 references this commit in reicast: skmp/reicast-emulator@8b5c2a3#diff-b3f91e0a878ca6a79689c44f6b0e14f1e4d9d01e664190a41f5ee15f18c35adaR140-R150
which is used as the reference for which additional characters to sanitize
twojstaryzdomu pushed a commit to twojstaryzdomu/RetroPie-Setup that referenced this pull request Dec 15, 2024
…ial characters when generating sanitizing filenames (/, \, and *)

RetroPie#2992 references this commit in reicast: skmp/reicast-emulator@8b5c2a3#diff-b3f91e0a878ca6a79689c44f6b0e14f1e4d9d01e664190a41f5ee15f18c35adaR140-R150
which is used as the reference for which additional characters to sanitize
twojstaryzdomu pushed a commit to twojstaryzdomu/RetroPie-Setup that referenced this pull request Dec 15, 2024
…ial characters when generating sanitizing filenames (/, \, and *)

RetroPie#2992 references this commit in reicast: skmp/reicast-emulator@8b5c2a3#diff-b3f91e0a878ca6a79689c44f6b0e14f1e4d9d01e664190a41f5ee15f18c35adaR140-R150
which is used as the reference for which additional characters to sanitize
twojstaryzdomu pushed a commit to twojstaryzdomu/RetroPie-Setup that referenced this pull request Dec 15, 2024
…ial characters when generating sanitizing filenames (/, \, and *)

RetroPie#2992 references this commit in reicast: skmp/reicast-emulator@8b5c2a3#diff-b3f91e0a878ca6a79689c44f6b0e14f1e4d9d01e664190a41f5ee15f18c35adaR140-R150
which is used as the reference for which additional characters to sanitize
twojstaryzdomu pushed a commit to twojstaryzdomu/RetroPie-Setup that referenced this pull request Dec 15, 2024
…ial characters when generating sanitizing filenames (/, \, and *)

RetroPie#2992 references this commit in reicast: skmp/reicast-emulator@8b5c2a3#diff-b3f91e0a878ca6a79689c44f6b0e14f1e4d9d01e664190a41f5ee15f18c35adaR140-R150
which is used as the reference for which additional characters to sanitize
twojstaryzdomu pushed a commit to twojstaryzdomu/RetroPie-Setup that referenced this pull request Dec 15, 2024
…ial characters when generating sanitizing filenames (/, \, and *)

RetroPie#2992 references this commit in reicast: skmp/reicast-emulator@8b5c2a3#diff-b3f91e0a878ca6a79689c44f6b0e14f1e4d9d01e664190a41f5ee15f18c35adaR140-R150
which is used as the reference for which additional characters to sanitize
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

Successfully merging this pull request may close these issues.

2 participants