X-Box xpad + MythGame-0.18.1 + snes9x + xmame + Gentoo + udev HOWTO (was: Re: [mythtv-users] recommended joysticks or gamepads for xmame and mythgame)

Jesse Guardiani jesse at wingnet.net
Tue Nov 15 10:40:45 EST 2005


byron wrote:

[...]

> I would very much like to get a hold of your patches.  I am working on
> getting MythGame and the various emulators to work with Logitech's
> wireless Xbox controller right now as well.
>   

OK, first off, I'm using the xpad driver version 0.0.5 that ships with 
the linux 2.6.13 kernel. If you're using
a different version, you might get different results.

Second, I only run MythGame, snes9x, xmame, and PC games currently, so 
if you run something else
YMMV. Please do share your results though.

Third: I've patched three programs to get this working. I think the 
first two patches highlight the fact that
joystick support under Linux is desperately in need of some standard 
config library like directInput. Perhaps
this is what libjsw is for. If so, then snes9x and xmame really should 
be overhauled to USE it. Anyway, I
found that xpad usage requires the following packages under Gentoo:

*  games-util/joystick
      Latest version available: 20050720
      Latest version installed: 20050720
      Size of downloaded files: 26 kB
      Homepage:    http://atrey.karlin.mff.cuni.cz/~vojtech/input/
      Description: joystick testing utilities
      License:     GPL-2

*  media-libs/libjsw
      Latest version available: 1.5.5
      Latest version installed: 1.5.5
      Size of downloaded files: 309 kB
      Homepage:    http://wolfpack.twu.net/libjsw/
      Description: provide a uniform API and user configuration for 
joysticks and game controllers
      License:     GPL-2

Fourth, in case you're wondering how I connected my X-Box controller to 
my PC, I used this:
    http://www.xpcgear.com/xboxusbadapter.html
(yes, I know you can create your own, but DIY stuff is usually ugly. 
These are clean, complete,
and plug-and-play. Worth the money, IMO, even though I consider the 
green led highly annoying.
But what I would REALLY enjoy is an insert for a 5 1/4" bay with 2 or 4 
female Xbox controller
ports for a really nice integrated solution. If anyone knows where I 
could get something like this,
please let me know!)

Fifth, please note that I've only used these patches with one controller 
thus far. I have ordered
another green LED xbox usb adapter, so when it arrives I'll be sure to 
comment on how well
these patches work/scale to two controllers.

On to the patches/code (please see attached):

snes9x.patch
------------------------------
This patch does 3 things against snes9x version 1.43:
1.) Add -joyaxisX argument support. This allows you to choose between 
the analog or digital joysticks.
2.) Lower the threshold to +/-50. HACK WARNING: This *should* be 
implemented via an argument,
     like -joyaxisX, but I haven't had time yet. This allows you to set 
the joystick input threshold. Use +/-50
     for analog sticks or 0 for the digital pad.
3.) Removed the "feature" where pressing ESC while in fullscreen mode 
wouldn't exit the emulator, but
     just drop to window mode. This annoyed me as I have no use for 
window mode in mythtv.
Without this, my joysticks wouldn't work.
NOTE: This patch is based on Reboot's excellent axis patch, found here:
    http://reboot.animeirc.de/contributions/snes9x.patch

xmame.patch
------------------------------
This patch is against xmame version 0.101. It sets the threshold to 40, 
lowers the extremes to 180, and
removes some bucketsize code that I think was causing a divide by zero 
or something.
Without this, my joysticks wouldn't work.

mythplugins.patch (mythgame)
------------------------------
This patch "mutes" the joystick event handler within libmyth (causes it 
to ignore joystick events) while
an Atari, Mame, NES, SNES, odyssey2, or PC game is running. Otherwise 
it'll queue up joystick
events and you'll lose control of the MythTV UI after playing a game. 
Note that this is only necessary
if you have joystick support compiled into MythTV and Myth is properly 
configured to use said joystick.

Also, I run Gentoo and udev. Attached are my udev scripts for my Mad 
Catz micro X-Box controller.
They auto-map my controller to /dev/input/js_madcatz and 
/dev/input/js_madcatz2, *AND* they
automatically run `jscal -s ...` so I don't have to. You can get the 
appropriate values for jscal with your
controller by running `jscalibrator`, then running `jscal -p`.

20-xpad.rules
------------------------------
This file goes in /etc/udev/rules.d on Gentoo. It maps my Mad Catz 
controller to /dev/input/js_madcatz
and /dev/input/js_madcatz2. This way I can enter these symlink paths in 
my MythGame config menu.
I can then remove the controller at will and rest assured that it will 
always return to the same /dev node
when I plug it back in. If you run udev, you can change the idProduct 
and idVendor values to match
your controller. Or, if you're controller reports a serial, use that. 
Mine didn't.
NOTE: This rule file creates TWO symlinks. That isn't a typo. It does 
this because MythGame uses
the first one and xmame uses the second one. For some reasons xmame 
wouldn't read the joystick
device properly on my system if MythGame and xmame both pointed to the 
same device symlink.

local.usermap
------------------------------
This file goes in /etc/hotplug/usb on Gentoo. It tells hotplug to run 
the xpad and xpad.rmv scripts (see
below) when a USB device with the given idProduct and idVendor is 
inserted or removed, respectively.

xpad
------------------------------
This file goes in /etc/hotplug/usb on Gentoo. It tells hotplug to:
1.) log to syslog that an xpad has been inserted
2.) auto calibrate the xpad after a five second timeout
3.) log that the auto calibration has been run
NOTE1: this script needs to be executable, I think.
NOTE2: this script is executed *BEFORE* the /dev entries are created, I 
think. That is why I included
the asynchronous  5 second timeout, followed by jscal. You may need to 
play with this timeout value if
it takes longer than 5 seconds to create the /dev node on your system. 
Also, please let me know if there
is a better way to do this.

xpad.rmv
------------------------------
This file goes in /etc/hotplug/usb on Gentoo. It tells hotplug to log to 
syslog that an xpad has been removed.
NOTE1: this script needs to be executable, I think.

xmame.mythtv
------------------------------
This file goes in /usr/games/bin on my Gentoo system. /usr/local/bin 
would probably also be appropriate.
I point MythGame to this script instead of the real xmame binary 
(/usr/games/bin/xmame on Gentoo)
because this script returns a FAKE VERSION STRING to keep MythGame 
0.18.1 happy. xmame
versions higher than 0.99 cause MythGame to pop up an "unsupported 
version" dialog. This script works
around that problem without patching the MythGame source.
It also logs useful debug info to /home/mythtv/xmame.cmd. I found this 
invaluable when I was first setting
up my xmame ROM paths using MythGame.
You'll need to modify a lot of the paths in this script, but hopefully 
it will be useful.

OTHER
------------------------------
Be sure to "chmod 4750 `which snes9x`" and "chmod 4750 `which xmame`", 
otherwise fullscreen
DGA mode won't work.

Hope that helps. This is the culmination of two weekends of playing, 
tinkering, and hacking. Hopefully
it will save someone else the time. :) Any additions, corrections, 
praise, criticism, etc.... are welcome.

Thanks!

-- 
Jesse Guardiani
Programmer/Sys Admin
jesse at wingnet.net

-------------- next part --------------
diff -ru snes9x-1.43-src/snes9x/snes9x.cpp snes9x-1.43-src.joy/snes9x/snes9x.cpp
--- snes9x-1.43-src/snes9x/snes9x.cpp	2004-12-30 17:15:47.000000000 -0500
+++ snes9x-1.43-src.joy/snes9x/snes9x.cpp	2005-11-11 20:03:58.000000000 -0500
@@ -200,6 +200,8 @@
 -joydevX /dev/jsY         Use joystick device /dev/jsY for emulation of gamepad X\n");
     S9xMessage (S9X_INFO, S9X_USAGE, "\
 -joymapX 0 1 2 3 4 5 6 7  Joystick buttons which should be assigned to gamepad X - A B X Y TL TR Start and Select\n");
+    S9xMessage (S9X_INFO, S9X_USAGE, "\
+-joyaxisX 0 1             Joystick axis which should be assigned to gamepad X - X-Axis Y-Axis\n");
 #else
     S9xMessage (S9X_INFO, S9X_USAGE, "\
 -four or -4               Single standard PC joystick has four buttons\n");
diff -ru snes9x-1.43-src/snes9x/unix/unix.cpp snes9x-1.43-src.joy/snes9x/unix/unix.cpp
--- snes9x-1.43-src/snes9x/unix/unix.cpp	2004-12-30 17:15:47.000000000 -0500
+++ snes9x-1.43-src.joy/snes9x/unix/unix.cpp	2005-11-12 18:54:57.000000000 -0500
@@ -198,6 +198,21 @@
     }
 };
 
+int js_axis [4][2] = {
+    {
+	0, 1
+    },
+    {
+	0, 1
+    },
+    {
+	0, 1
+    },
+    {
+	0, 1
+    }
+};
+
 #if 0
 SNES_A_MASK, SNES_B_MASK, SNES_X_MASK, SNES_Y_MASK,
 		            SNES_TL_MASK, SNES_TR_MASK, SNES_START_MASK, SNES_SELECT_MASK,
@@ -287,6 +302,18 @@
 	else
 	    S9xUsage ();
     }
+    else if (strcasecmp (argv [i], "-joyaxis1") == 0)
+    {
+	if (i + 2 < argc)
+	{
+	    int t;
+
+	    if ((t = atoi (argv [++i])) < 15) js_axis [0][0] = t;
+	    if ((t = atoi (argv [++i])) < 15) js_axis [0][1] = t;
+	}
+	else
+	    S9xUsage ();
+    }
     else if (strcasecmp (argv [i], "-joymap2") == 0)
     {
 	if (i + 8 < argc)
@@ -308,6 +335,18 @@
 	else
 	    S9xUsage ();
     }
+    else if (strcasecmp (argv [i], "-joyaxis2") == 0)
+    {
+	if (i + 2 < argc)
+	{
+	    int t;
+
+	    if ((t = atoi (argv [++i])) < 15) js_axis [1][0] = t;
+	    if ((t = atoi (argv [++i])) < 15) js_axis [1][1] = t;
+	}
+	else
+	    S9xUsage ();
+    }
     else if (strcasecmp (argv [i], "-joymap3") == 0)
     {
 	if (i + 8 < argc)
@@ -329,6 +368,18 @@
 	else
 	    S9xUsage ();
     }
+    else if (strcasecmp (argv [i], "-joyaxis3") == 0)
+    {
+	if (i + 2 < argc)
+	{
+	    int t;
+
+	    if ((t = atoi (argv [++i])) < 15) js_axis [2][0] = t;
+	    if ((t = atoi (argv [++i])) < 15) js_axis [2][1] = t;
+	}
+	else
+	    S9xUsage ();
+    }
     else if (strcasecmp (argv [i], "-joymap4") == 0)
     {
 	if (i + 8 < argc)
@@ -350,6 +401,18 @@
 	else
 	    S9xUsage ();
     }
+    else if (strcasecmp (argv [i], "-joyaxis4") == 0)
+    {
+	if (i + 2 < argc)
+	{
+	    int t;
+
+	    if ((t = atoi (argv [++i])) < 15) js_axis [3][0] = t;
+	    if ((t = atoi (argv [++i])) < 15) js_axis [3][1] = t;
+	}
+	else
+	    S9xUsage ();
+    }
     else 
 #endif
     if (strcasecmp (argv [i], "-b") == 0 ||
@@ -767,15 +830,15 @@
 	    switch (js_ev.type & ~JS_EVENT_INIT)
 	    {
 	    case JS_EVENT_AXIS:
-		if (js_ev.number == 0)
+		if (js_ev.number == js_axis[i][0])
 		{
-		    if(js_ev.value < -16384)
+		    if(js_ev.value < -50)
 		    {
 			joypads [i] |= SNES_LEFT_MASK; 
 			joypads [i] &= ~SNES_RIGHT_MASK;
 			break;
 		    }
-		    if (js_ev.value > 16384)
+		    if (js_ev.value > 50)
 		    {
 			joypads [i] &= ~SNES_LEFT_MASK;
 			joypads [i] |= SNES_RIGHT_MASK; 
@@ -786,15 +849,15 @@
 		    break;	
 		}
 
-		if (js_ev.number == 1)
+		if (js_ev.number == js_axis[i][1])
 		{
-		    if (js_ev.value < -16384)
+		    if (js_ev.value < -50)
 		    {
 			joypads [i] |= SNES_UP_MASK; 
 			joypads [i] &= ~SNES_DOWN_MASK;
 			break;
 		    }
-		    if (js_ev.value > 16384)
+		    if (js_ev.value > 50)
 		    {
 			joypads [i] &= ~SNES_UP_MASK;
 			joypads [i] |= SNES_DOWN_MASK; 
Only in snes9x-1.43-src.joy/snes9x/unix: unix.cpp~
diff -ru snes9x-1.43-src/snes9x/unix/x11.cpp snes9x-1.43-src.joy/snes9x/unix/x11.cpp
--- snes9x-1.43-src/snes9x/unix/x11.cpp	2004-12-30 17:15:47.000000000 -0500
+++ snes9x-1.43-src.joy/snes9x/unix/x11.cpp	2005-11-12 18:40:50.000000000 -0500
@@ -1717,13 +1717,6 @@
                 {
                     if(event.type != KeyPress) break;
 
-#ifdef USE_DGA_EXTENSION
-                    if (XF86.is_full_screen)
-                    {
-                        S9xSwitchToFullScreen (FALSE);
-                        break;
-                    }
-#endif
                     S9xExit ();
 
                     break;
-------------- next part --------------
diff -ur xmame-0.101/src/unix/devices.c xmame-0.101.joy/src/unix/devices.c
--- xmame-0.101/src/unix/devices.c	2005-10-21 01:48:50.000000000 -0400
+++ xmame-0.101.joy/src/unix/devices.c	2005-11-13 21:46:54.000000000 -0500
@@ -865,13 +865,12 @@
 			
 			/* if we've only ever seen one value here, or if we've been stuck at the same value for a long */
 			/* time (1 minute), mark the axis as dead or invalid */
-			if (history[1].count == 0 || history[0].count > Machine->refresh_rate * 60)
+			if (history[1].count == 0 || history[0].count > Machine->refresh_rate * 120)
 				newtype = AXIS_TYPE_INVALID;
 			
 			/* scan the history and count unique values; if we get more than 3, it's analog */
 			else
 			{
-				int bucketsize = (joy_data[joynum].axis[axis].max - joy_data[joynum].axis[axis].min) / 3;
 				int uniqueval[3] = { 1234567890, 1234567890, 1234567890 };
 				int histnum;
 				
@@ -882,7 +881,7 @@
 				for (histnum = 0; histnum < HISTORY_LENGTH; histnum++)
 					if (history[histnum].count > 0)
 					{
-						int bucket = (history[histnum].value - joy_data[joynum].axis[axis].min) / bucketsize;
+						int bucket = 1;
 
 						/* if we already have an entry in this bucket, we're analog */
 						if (uniqueval[bucket] != 1234567890 && uniqueval[bucket] != history[histnum].value)
@@ -1201,11 +1200,11 @@
 					joy_data[stick].axis[axis].mid = (joy_data[stick].axis[axis].max + joy_data[stick].axis[axis].min)/2;
 				}
 
-				threshold = (joy_data[stick].axis[axis].max - joy_data[stick].axis[axis].mid) >> 1;
+				threshold = 40;
 
-				if (joy_data[stick].axis[axis].val < (joy_data[stick].axis[axis].mid - threshold))
+				if (joy_data[stick].axis[axis].val < (0 - threshold))
 					joy_data[stick].axis[axis].dirs[0] = 1;
-				else if (joy_data[stick].axis[axis].val > (joy_data[stick].axis[axis].mid + threshold))
+				else if (joy_data[stick].axis[axis].val > (0 + threshold))
 					joy_data[stick].axis[axis].dirs[1] = 1;
 			}
 		}
diff -ur xmame-0.101/src/unix/joystick-drivers/joy_standard.c xmame-0.101.joy/src/unix/joystick-drivers/joy_standard.c
--- xmame-0.101/src/unix/joystick-drivers/joy_standard.c	2005-10-13 01:39:22.000000000 -0400
+++ xmame-0.101.joy/src/unix/joystick-drivers/joy_standard.c	2005-11-13 21:34:22.000000000 -0500
@@ -121,8 +121,8 @@
 						fprintf (stderr_file, "Joystick: Kernel driver version  : %d.%d.%d\n", version >> 16, (version >> 8) & 0xff, version & 0xff);
 						for (j=0; j<joy_data[i].num_axes; j++)
 						{
-							joy_data[i].axis[j].min = -32768;
-							joy_data[i].axis[j].max =  32768;
+							joy_data[i].axis[j].min = -180;
+							joy_data[i].axis[j].max =  180;
 							joy_data[i].axis[j].mid = 0;
 						}
 						joy_poll_func = joy_standard_new_poll;
-------------- next part --------------
diff -ur mythplugins-0.18.1/mythgame/mythgame/atarihandler.cpp mythplugins-0.18.1.mod/mythgame/mythgame/atarihandler.cpp
--- mythplugins-0.18.1/mythgame/mythgame/atarihandler.cpp	2005-02-24 16:21:37.000000000 -0500
+++ mythplugins-0.18.1.mod/mythgame/mythgame/atarihandler.cpp	2005-11-14 23:42:47.000000000 -0500
@@ -9,6 +9,7 @@
 #include <iostream>
 
 #include <mythtv/mythdialogs.h>
+#include <mythtv/jsmenuevent.h>
 
 using namespace std;
 
@@ -30,9 +31,15 @@
                    romdata->Romname() + "\"";
     cout << exec << endl;
     
-    // Run the emulator and wait for it to terminate.      
+    // Mute Joystick events in libmyth while ROM is executing
+    QApplication::postEvent(gContext->GetMainWindow(), new JoystickMenuMuteEvent(true));
+
+    // Run the emulator and wait for it to terminate.
     FILE* command = popen(exec, "w");
     pclose(command);
+
+    // Un-Mute Joystick events in libmyth now that ROM execution is finished
+    QApplication::postEvent(gContext->GetMainWindow(), new JoystickMenuMuteEvent(false));
 }
 
 void AtariHandler::edit_settings(RomInfo* romdata)
diff -ur mythplugins-0.18.1/mythgame/mythgame/mamehandler.cpp mythplugins-0.18.1.mod/mythgame/mythgame/mamehandler.cpp
--- mythplugins-0.18.1/mythgame/mythgame/mamehandler.cpp	2005-04-11 14:04:52.000000000 -0400
+++ mythplugins-0.18.1.mod/mythgame/mythgame/mamehandler.cpp	2005-11-14 23:40:09.000000000 -0500
@@ -15,6 +15,7 @@
 #include <mythtv/mythcontext.h>
 #include <mythtv/mythdbcon.h>
 #include <mythtv/mythdialogs.h>
+#include <mythtv/jsmenuevent.h>
 
 #include <string>
 using namespace std;
@@ -525,6 +526,9 @@
 
         pclose(romlist_info);
 
+        // Mute Joystick events in libmyth while ROM is executing
+        QApplication::postEvent(gContext->GetMainWindow(), new JoystickMenuMuteEvent(true));
+
         FILE *command;
         command = popen(exec + " 2>&1", "r");
 
@@ -538,6 +542,9 @@
         }
 
         pclose(command);
+
+        // Un-Mute Joystick events in libmyth now that ROM execution is finished
+        QApplication::postEvent(gContext->GetMainWindow(), new JoystickMenuMuteEvent(false));
 }
 
 void MameHandler::edit_settings(RomInfo * romdata)
diff -ur mythplugins-0.18.1/mythgame/mythgame/neshandler.cpp mythplugins-0.18.1.mod/mythgame/mythgame/neshandler.cpp
--- mythplugins-0.18.1/mythgame/mythgame/neshandler.cpp	2005-02-24 16:21:39.000000000 -0500
+++ mythplugins-0.18.1.mod/mythgame/mythgame/neshandler.cpp	2005-11-14 23:40:57.000000000 -0500
@@ -12,6 +12,7 @@
 #include <iostream>
 
 #include <mythtv/mythdialogs.h>
+#include <mythtv/jsmenuevent.h>
 
 using namespace std;
 
@@ -34,9 +35,15 @@
                    romdata->Romname() + "\"";
     cout << exec << endl;
     
-    // Run the emulator and wait for it to terminate.      
+    // Mute Joystick events in libmyth while ROM is executing
+    QApplication::postEvent(gContext->GetMainWindow(), new JoystickMenuMuteEvent(true));
+
+    // Run the emulator and wait for it to terminate.
     FILE* command = popen(exec, "w");
     pclose(command);
+
+    // Un-Mute Joystick events in libmyth now that ROM execution is finished
+    QApplication::postEvent(gContext->GetMainWindow(), new JoystickMenuMuteEvent(false));
 }
 
 void NesHandler::edit_settings(RomInfo* romdata)
diff -ur mythplugins-0.18.1/mythgame/mythgame/odyssey2handler.cpp mythplugins-0.18.1.mod/mythgame/mythgame/odyssey2handler.cpp
--- mythplugins-0.18.1/mythgame/mythgame/odyssey2handler.cpp	2005-02-24 16:21:39.000000000 -0500
+++ mythplugins-0.18.1.mod/mythgame/mythgame/odyssey2handler.cpp	2005-11-14 23:41:55.000000000 -0500
@@ -9,6 +9,7 @@
 #include <iostream>
 
 #include <mythtv/mythdialogs.h>
+#include <mythtv/jsmenuevent.h>
 
 using namespace std;
 
@@ -30,9 +31,15 @@
                    romdata->Romname() + "\"";
     cout << exec << endl;
     
-    // Run the emulator and wait for it to terminate.      
+    // Mute Joystick events in libmyth while ROM is executing
+    QApplication::postEvent(gContext->GetMainWindow(), new JoystickMenuMuteEvent(true));
+
+    // Run the emulator and wait for it to terminate.
     FILE* command = popen(exec, "w");
     pclose(command);
+
+    // Un-Mute Joystick events in libmyth now that ROM execution is finished
+    QApplication::postEvent(gContext->GetMainWindow(), new JoystickMenuMuteEvent(false));
 }
 
 void Odyssey2Handler::edit_settings(RomInfo* romdata)
diff -ur mythplugins-0.18.1/mythgame/mythgame/pchandler.cpp mythplugins-0.18.1.mod/mythgame/mythgame/pchandler.cpp
--- mythplugins-0.18.1/mythgame/mythgame/pchandler.cpp	2005-02-24 16:21:39.000000000 -0500
+++ mythplugins-0.18.1.mod/mythgame/mythgame/pchandler.cpp	2005-11-14 23:39:32.000000000 -0500
@@ -8,6 +8,7 @@
 
 #include <mythtv/mythcontext.h>
 #include <mythtv/mythdbcon.h>
+#include <mythtv/jsmenuevent.h>
 #include <qfile.h>
 #include <qdom.h>
 #include <string>
@@ -103,9 +104,15 @@
 
 void PCHandler::start_game(RomInfo * romdata)
 {
+    // Mute Joystick events in libmyth while ROM is executing
+    QApplication::postEvent(gContext->GetMainWindow(), new JoystickMenuMuteEvent(true));
+
     // Run the game and wait for it to terminate.
     FILE* command = popen(romdata->Romname(), "w");
     pclose(command);
+
+    // Un-Mute Joystick events in libmyth now that ROM execution is finished
+    QApplication::postEvent(gContext->GetMainWindow(), new JoystickMenuMuteEvent(false));
 }
 
 void PCHandler::edit_settings(RomInfo * romdata)
diff -ur mythplugins-0.18.1/mythgame/mythgame/sneshandler.cpp mythplugins-0.18.1.mod/mythgame/mythgame/sneshandler.cpp
--- mythplugins-0.18.1/mythgame/mythgame/sneshandler.cpp	2005-02-24 16:21:39.000000000 -0500
+++ mythplugins-0.18.1.mod/mythgame/mythgame/sneshandler.cpp	2005-11-13 02:21:54.000000000 -0500
@@ -14,6 +14,7 @@
 #include <mythtv/mythcontext.h>
 #include <mythtv/mythdbcon.h>
 #include <mythtv/mythdialogs.h>
+#include <mythtv/jsmenuevent.h>
 
 #include <string>
 #include <math.h>
@@ -445,9 +446,15 @@
     exec+= " \"" + gContext->GetSetting("SnesRomLocation") + "/" + romdata->Romname() + "\"";
     cout << exec << endl;
 
+    // Mute Joystick events in libmyth while ROM is executing
+    QApplication::postEvent(gContext->GetMainWindow(), new JoystickMenuMuteEvent(true));
+
     // Run the emulator and wait for it to terminate.
     FILE* command = popen(exec, "w");
     pclose(command);
+
+    // Un-Mute Joystick events in libmyth now that ROM execution is finished
+    QApplication::postEvent(gContext->GetMainWindow(), new JoystickMenuMuteEvent(false));
 }
 
 void SnesHandler::edit_settings(RomInfo * romdata)
-------------- next part --------------
BUS="usb", KERNEL="js*", SYSFS{idProduct}=="2010", SYSFS{idVendor}=="0e8f", NAME="input/%k", MODE="0664", GROUP="games", SYMLINK="input/js_madcatz", SYMLINK="input/js_madcatz2"
-------------- next part --------------
# usb module	match_flags	idVendor	idProduct	bcdDevice_lo	bcdDevice_hi	bDeviceClass	bDeviceSubClass	bDeviceProtocol	bInterfaceClass	bInterfaceSubClass	bInterfaceProtocol	driver_info

# X-Box Gamepad
xpad		0x0003		0x0e8f		0x2010		0x0		0x0		0x0		0x0		0x0		0x0		0x0			0x0			0x0

-------------- next part --------------
#!/bin/bash

# This script is called by ../usb.agent which sets the environment
# variables $ACTION, $DEVICE, and $REMOVER

# Since I only have two storage devices, only /dev/sda or /dev/sdb will
# be assigned.  If more devices are possible just extend the script to
# include them (sdc, sdd, etc)

# A symlink is created using the $REMOVER variable that the ../usb.agent
# script will execute on device removal.
logger -t xpad inserted
sleep 5 && \
/usr/bin/jscal -s 6,0,0,0,0,0,0,0,0,0,0,0,0 /dev/input/js_madcatz && \
logger -t xpad finished_jscal &
-------------- next part --------------
#!/bin/bash

# This script is called by ../usb.agent which sets the environment
# variables $ACTION, $DEVICE, and $REMOVER

# Since I only have two storage devices, only /dev/sda or /dev/sdb will
# be assigned.  If more devices are possible just extend the script to
# include them (sdc, sdd, etc)

# A symlink is created using the $REMOVER variable that the ../usb.agent
# script will execute on device removal.
logger -t xpad removed
-------------- next part --------------
#!/bin/sh

# Wrapper to make MythTV use XMAME even if the supported version doesn't match

tmp=$@
echo $@ >> /home/mythtv/xmame.cmd
while [ "$1" ]
do
  # MythGame passes a -nocheat before the last option which is the rom-name
  if [ "$1" = "-nocheat" ]; then
    shift
    #-jdev /dev/js -jt 1
    /usr/games/bin/xmame $1 -log /home/mythtv/xmame.debug  -rompath /share/xmame/roms -fullscreen -ef 2 -skip_disclaimer -jt 1 -jdev /dev/input/js_madcatz2
    exit 0

  # return fake version
  elif [ "$1" = "-version" ]; then
    echo "xmame (x11) version 0.97 (Jan 22 2005)"
    exit 0
  fi
  shift
done

# perform whatever was asked for in all other cases
/usr/games/bin/xmame -log /home/mythtv/xmame.debug $tmp
exit 0 


More information about the mythtv-users mailing list