Diagonal input from gamepad "hat" events is not reset properly

Bug #519845 reported by MedO
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zsnes (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: zsnes

Using a USB gamepad (Saitek Ps 2700 Rumble), I assigned a normal button layout in zsnes that uses the "hat" for up/down/left/right (I'm referring to the digital direction input, not the analog stick). When I'm playing a game and move diagonally down and right, then move the hat to point straight to the right without releasing it in between, the character keeps moving diagonally instead of straight to the right. This behaviour for example makes it impossible to perform many combo moves in Street Fighter II.

This is not a problem with the gamepad hardware nor with the game, since it works properly on Windows. I found a forum thread discussing the issue and another one with a plausible-looking patch, which might be worth including in the ubuntu package until it's fixed upstream. I did not test the patch yet.

Discussion: http://ubuntuforums.org/showthread.php?t=1243218
Patch: http://board.zsnes.com/phpBB2/viewtopic.php?t=12544

ProblemType: Bug
Architecture: i386
Date: Wed Feb 10 14:42:47 2010
DistroRelease: Ubuntu 9.10
InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release i386 (20091028.5)
Package: zsnes 1.510-2.2ubuntu3
ProcEnviron:
 LANG=de_DE.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.31-19.56-generic
SourcePackage: zsnes
Uname: Linux 2.6.31-19-generic i686
XsessionErrors:
 (gnome-settings-daemon:1980): GLib-CRITICAL **: g_propagate_error: assertion `src != NULL' failed
 (nautilus:2085): Eel-CRITICAL **: eel_preferences_get_boolean: assertion `preferences_is_initialized ()' failed
 (polkit-gnome-authentication-agent-1:2117): GLib-CRITICAL **: g_once_init_leave: assertion `initialization_value != 0' failed
 (firefox:2992): GLib-WARNING **: g_set_prgname() called multiple times

Revision history for this message
MedO (smaxein) wrote :
Revision history for this message
MedO (smaxein) wrote :

I just tried out the patch. It apparently refers to an older version of the source file if I interpret the output from patch correctly, but it was applied fine and resolves the issue for me.

The zsnes project at sourceforge seems to be inactive. There have been no commits for over a year even though there are suggested patches.

Revision history for this message
MedO (smaxein) wrote :

I set up a PPA with the patched version: https://launchpad.net/~smaxein/+archive/ppa
This is the first time I buit and published a package, so don't say I didn't warn you :)
I tried it out and it appears to work fine though.

Revision history for this message
MedO (smaxein) wrote :

Please consider adding the patch referenced in the bug description to the official package.

Changed in zsnes (Ubuntu):
status: New → Confirmed
Revision history for this message
Ingo Ruhnke (grumbel) wrote :

Same problem here, the bug still exist in Ubuntu 10.10.

A temporary workaround (only works with one gamepad), that doesn't require modifications to the zsnes package can be done with SDL environment variables, which can be used to redefine the hat as regular axis, the variable has the syntax:

SDL_LINUX_JOYSTICK="'YourJoystickNameHere' NUMAXIS NUMHATS NUMBALLS"

The joystick name and number of axis can be gained from zsnes output on stdout:

Device 0 Xbox Gamepad (userspace driver)
  6 axis, 11 buttons, 1 hats, 0 balls

So the final variables would look like this:

export SDL_JOYSTICK_DEVICE=/dev/input/js0
export SDL_LINUX_JOYSTICK="'Xbox Gamepad (userspace driver)' 8 0 0"

Here the 1 hat is turned into two axis (X and Y). SDL_JOYSTICK_DEVICE is required as SDL uses /dev/input/eventX by default, not the joystick interface, the event interface in SDL doesn't allow any kind of configuration.

Revision history for this message
MedO (smaxein) wrote :

Hi Ingo. Have you tried the version in my PPA? Why use a workaround when you can have a fix?

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package zsnes - 1.510+bz2-5ubuntu1

---------------
zsnes (1.510+bz2-5ubuntu1) raring; urgency=low

  * Merge from Debian unstable.
    - Drops the amd64 build in favor of multiarch i386 support
    - Drops libao support in favor of SDL
    - Ships larger icons from upstream (LP: #377454)
    - Fixes hat positions not resetting properly (LP: #519845)
  * debian/patches/disable-fortify-source.patch:
    - Instead of blanket disabling _FORTIFY_SOURCE in debian/rules, rather
      only disable it in generated code. Patch by Hans de Goede.
 -- Michael Terry <email address hidden> Fri, 25 Jan 2013 17:32:41 -0500

Changed in zsnes (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.