Date: Thu, 6 Jan 2011 17:04:18 GMT From: David Demelier <demelier.david@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/153733: [patch] emulators/visualboyadvance-m: problem with joypad Message-ID: <201101061704.p06H4IIB085235@red.freebsd.org> Resent-Message-ID: <201101061710.p06HA7vd091702@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 153733 >Category: ports >Synopsis: [patch] emulators/visualboyadvance-m: problem with joypad >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Jan 06 17:10:07 UTC 2011 >Closed-Date: >Last-Modified: >Originator: David Demelier >Release: 8.2-PRERELEASE >Organization: >Environment: FreeBSD Melon.malikania.fr 8.2-PRERELEASE FreeBSD 8.2-PRERELEASE #2: Tue Jan 4 22:23:20 CET 2011 root@Melon.malikania.fr:/usr/obj/usr/src/sys/Melon amd64 >Description: There is a bug in the input dialog in vba-m. In fact if the joypad sends useless information (like the position of a hat) the input dialog is filled with crap. For example I have a joypad like that : Joystick has 4 axes, 1 hats, 0 balls, and 12 buttons Joystick 0 hat 0 value: centered Joystick 0 button 3 down Joystick 0 hat 0 value: centered Joystick 0 button 3 up Joystick 0 hat 0 value: centered Joystick 0 button 2 down Joystick 0 hat 0 value: centered Joystick 0 button 2 up This is my joypad, when I press a button, my joypad sends a useless state the hat value and vba-m takes it as a really button so I can't set any buttons. The patch made by the developers themselves (so official upstream) made a little change in the input SDL and now it works. Because there is no plan for the next release I propose to add this patch that will solve issues like this for people having joypads like these. >How-To-Repeat: >Fix: --- vba-m.patch begins here --- --- /dev/null 2011-01-06 17:57:04.000000000 +0100 +++ files/patch-src-gtk-joypadconfig.cpp 2011-01-06 17:55:04.000000000 +0100 @@ -0,0 +1,48 @@ +--- src/gtk/joypadconfig.cpp.orig 2008-09-26 20:25:23.000000000 +0200 ++++ src/gtk/joypadconfig.cpp 2011-01-06 17:53:43.000000000 +0100 +@@ -144,9 +144,17 @@ + else if (what < 0x30) + { + // joystick hat ++ int dir = (what & 3); + what = (what & 15); + what >>= 2; +- os << " Hat " << what; ++ os << " Hat " << what << " "; ++ switch (dir) ++ { ++ case 0: os << "Up"; break; ++ case 1: os << "Down"; break; ++ case 2: os << "Right"; break; ++ case 3: os << "Left"; break; ++ } + } + + csName = os.str().c_str(); +@@ -209,6 +217,7 @@ + } + + int code = inputGetEventCode(event); ++ if (!code) return; + inputSetKeymap(m_ePad, m_astKeys[m_iCurrentEntry].m_eKeyFlag, code); + vUpdateEntries(); + +@@ -241,11 +250,17 @@ + } + vEmptyEventQueue(); + break; +- case SDL_JOYHATMOTION: + case SDL_JOYBUTTONUP: + vOnInputEvent(event); + vEmptyEventQueue(); + break; ++ case SDL_JOYHATMOTION: ++ if (event.jhat.value) ++ { ++ vOnInputEvent(event); ++ vEmptyEventQueue(); ++ } ++ break; + } + } + --- /dev/null 2011-01-06 17:57:14.000000000 +0100 +++ files/patch-src-sdl-inputSDL.cpp 2011-01-06 17:55:34.000000000 +0100 @@ -0,0 +1,23 @@ +--- src/sdl/inputSDL.cpp.orig 2008-11-29 12:19:27.000000000 +0100 ++++ src/sdl/inputSDL.cpp 2011-01-06 17:53:43.000000000 +0100 +@@ -84,8 +84,11 @@ + + static uint32_t sdlGetHatCode(const SDL_Event &event) + { ++ if (!event.jhat.value) return 0; ++ + return ( + ((event.jhat.which + 1) << 16) | ++ 32 | + (event.jhat.hat << 2) | + ( + event.jhat.value & SDL_HAT_UP ? 0 : +@@ -106,6 +109,8 @@ + + static uint32_t sdlGetAxisCode(const SDL_Event &event) + { ++ if (event.jaxis.value >= -16384 && event.jaxis.value <= 16384) return 0; ++ + return ( + ((event.jaxis.which + 1) << 16) | + (event.jaxis.axis << 1) | --- vba-m.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101061704.p06H4IIB085235>