[mythtv] [PATCH] Adding -grabkeyboard support to MythGame

Roger Martensson roger.martensson at gmail.com
Sat Jun 11 17:22:06 UTC 2005


[Sorry if it's shows up twice. But my first message was put on hold
becuase I'm not subscribe with this address.. Therefore I'm trying
again in subscribe mode]

Hi there!

This is the first of possible two patches. They are completely
seperate and has nothing in common expect being additions and
enhancing of the xmame part of MythGame.

I'll send the other patch later but if you want to know more about it
you can read it down below.

But first a question I'd like to discuss. That is if -joytype should
be 4 as default. Since I'm not using a joystick I'd like to see this
off/zero as default as it adds to the confusion when setting up xmame.
It just wont start if no joystick is available. It's an easy patch to
make since it only will change the insertion of the values into the
default game. It wont be intrusive since it only will happen to new
installations.

This is my first patch. Please be nice but don't hold back your
constructive comments if you see something that you don't like. I hope
it's ok to send everything as one big patch.

It is created with "diff -u" and touches: 
dbcheck.cpp
mamehandler.cpp
mamesettingsdlg.cpp
mametypes.h

This first patch adds -grabkeyboard support when executing xmame. I
need this to be able to play. Since -grabmouse is there I thought I
should do the same for -grabkeyboard.

I need to update the database to add support for this in the database
so the patch updates the dbcheck.cpp with a new database version. I
know there is one(sorry forgot your name) that is doing a big update
that touches the database. If this patch is accepted make sure you
update you're database version.

-- Down below --
The next patch will be a bit bigger but I need it to be able to play
Mame games on my PVR-350. Currently xmame(0.96) does not support
-fullscreen without compiling with XV support. The PVR-350 does not
support XV at the moment so I need to play in windowed mode.

The other problems are that it will open up the window at (0,0). I
need to use the -geometry switch to try to position the window inside
the viewable area. Also.. I'm not that fond of looking at the window
at the top left corner. So I added support to center the window in the
middle of the viewable screen. Taking in account scaling.

Currently I have added two new database attributes that stores the
screen size of the game which is filled when scanning for games. I've
tried to look if there is support for getting this data runtime but
haven't found anything. If someone has a solution for it I would be
glad because I'm not sure this should be in the database.

One thing I've also would like to add is a max value to the scaling.
I.e. if a game when scaled is outside the viewable area that scale
value shouldn't be  selectable.

I've tried to use the RomInfo/MameRomInfo classes but can't get them
to work. It looks like fillData() does it's job but somehow the values
isn't stored in the class. I'll need to try some more before I kill
the idea.
-------------- next part --------------
diff -u ./dbcheck.cpp ../../../mythplugins/mythgame/mythgame/dbcheck.cpp
--- ./dbcheck.cpp	2005-05-28 18:58:11.000000000 +0200
+++ ../../../mythplugins/mythgame/mythgame/dbcheck.cpp	2005-02-24 22:21:37.000000000 +0100
@@ -8,7 +8,7 @@
 #include "mythtv/mythcontext.h"
 #include "mythtv/mythdbcon.h"
 
-const QString currentDatabaseVersion = "1005";
+const QString currentDatabaseVersion = "1004";
 
 static void UpdateDBVersionNumber(const QString &newnumber)
 {
@@ -1107,14 +1107,4 @@
 };
         performActualUpdate(updates, "1004", dbver);
     }
-
-    if ( dbver == "1004")
-    {
-        const QString updates[] = {
-        "ALTER TABLE mamesettings ADD grabkeyboard BOOL NOT NULL DEFAULT 0;",
-        ""
-        };
-
-        performActualUpdate(updates, "1005", dbver);
-    }
 }
diff -u ./mamehandler.cpp ../../../mythplugins/mythgame/mythgame/mamehandler.cpp
--- ./mamehandler.cpp	2005-05-28 18:56:01.000000000 +0200
+++ ../../../mythplugins/mythgame/mythgame/mamehandler.cpp	2005-05-03 07:54:17.000000000 +0200
@@ -729,8 +729,6 @@
         QString nowinkeys;
         QString grabmouse;
         QString nograbmouse;
-        QString grabkeyboard;
-        QString nograbkeyboard;
         QString screenshotdir;
 
         GameSettings game_settings;
@@ -806,8 +804,6 @@
                 nowinkeys = " -nowinkeys";
                 grabmouse = " -grabmouse";
                 nograbmouse = " -nograbmouse";
-                grabkeyboard = " -grabkeyboard";
-                nograbkeyboard = " -nograbkeyboard";
         } else if (!strcmp(general_prefs.xmame_display_target, "xgl")) {
                 /* Check for version. 0.37b4->uses -nocabview */
                 /* FIXME: This is a very ugly hack. It will be replaced by a
@@ -819,8 +815,6 @@
                 nowinkeys = " -nowinkeys";
                 grabmouse = " -grabmouse";
                 nograbmouse = " -nograbmouse";
-                grabkeyboard = " -grabkeyboard";
-                nograbkeyboard = " -nograbkeyboard";
         } else if (!strcmp(general_prefs.xmame_display_target, "xfx")) {
                 fullscreen = " ";
                 windowed = " ";
@@ -828,8 +822,6 @@
                 nowinkeys = " -nowinkeys";
                 grabmouse = " -grabmouse";
                 nograbmouse = " -nograbmouse";
-                grabkeyboard = " -grabkeyboard";
-                nograbkeyboard = " -nograbkeyboard";
         }
         else if (!strcmp(general_prefs.xmame_display_target, "SDL")) {
                 fullscreen = " -fullscreen";
@@ -838,8 +830,6 @@
                 nowinkeys = " ";
                 grabmouse = " ";
                 nograbmouse = " ";
-                grabkeyboard = " ";
-                nograbkeyboard = " ";
         } else if (!strcmp(general_prefs.xmame_display_target, "ggi")) {
                 fullscreen = " ";
                 windowed = " ";
@@ -847,8 +837,6 @@
                 nowinkeys = " ";
                 grabmouse = " ";
                 nograbmouse = " ";
-                grabkeyboard = " ";
-                nograbkeyboard = " ";
                 if (game_settings.fullscreen && !getuid())
                         putenv((char *)"GGI_DISPLAY=DGA");
                 else
@@ -942,7 +930,6 @@
         *exec+= game_settings.analog_joy ? " -analogstick" : " -noanalogstick";
         *exec+= game_settings.winkeys ? winkeys : nowinkeys;
         *exec+= game_settings.grab_mouse ? grabmouse : nograbmouse;
-        *exec+= game_settings.grab_keyboard ? grabkeyboard : nograbkeyboard;
         *exec+= " -joytype ";
         *exec+= joytype;
         *exec+= game_settings.samples ? " -samples" : " -nosamples";
@@ -1035,7 +1022,6 @@
                 game_settings.volume = query.value(25).toInt();
                 game_settings.cheat = query.value(26).toBool();
                 game_settings.extra_options = query.value(27).toString();
-                game_settings.grab_keyboard = query.value(28).toBool();
             }
             else
                 game_settings.default_options = true;
@@ -1078,7 +1064,6 @@
         defaultSettings.volume = query.value(25).toInt();
         defaultSettings.cheat = query.value(26).toBool();
         defaultSettings.extra_options = query.value(27).toString();
-        defaultSettings.grab_keyboard = query.value(28).toBool();
     }
 }
 
diff -u ./mamesettingsdlg.cpp ../../../mythplugins/mythgame/mythgame/mamesettingsdlg.cpp
--- ./mamesettingsdlg.cpp	2005-05-28 18:59:22.000000000 +0200
+++ ../../../mythplugins/mythgame/mythgame/mamesettingsdlg.cpp	2004-07-01 06:41:16.000000000 +0200
@@ -299,21 +299,10 @@
         MameSetting("grabmouse", rom) {
         setLabel(QObject::tr("Grab Mouse"));
         setValue(false);
-        setHelpText(QObject::tr("Makes XMAME grab the mouse(-grabmouse)"));
+        setHelpText(QObject::tr("No Help text"));
     };
 };
 
-class MameGrabKeyboard: public CheckBoxSetting, public MameSetting {
-public:
-    MameGrabKeyboard(QString rom):
-        MameSetting("grabkeyboard", rom) {
-        setLabel(QObject::tr("Grab Keyboard"));
-        setValue(false);
-        setHelpText(QObject::tr("Makes XMAME grab the keyboard(-grabkeyboard)"));
-    };
-};
-
-
 class MameJoystickType: public ComboBoxSetting, public MameSetting {
 public:
     MameJoystickType(QString rom):
@@ -395,7 +384,6 @@
     input1->addChild(new MameWindows(romname));
     input1->addChild(new MameMouse(romname));
     input1->addChild(new MameGrabMouse(romname));
-    input1->addChild(new MameGrabKeyboard(romname));
     input1->addChild(new MameJoystickType(romname));
     input1->addChild(new MameAnalogJoy(romname));
     addChild(input1);
diff -u ./mametypes.h ../../../mythplugins/mythgame/mythgame/mametypes.h
--- ./mametypes.h	2005-05-28 18:56:58.000000000 +0200
+++ ../../../mythplugins/mythgame/mythgame/mametypes.h	2004-04-10 20:47:18.000000000 +0200
@@ -68,7 +68,6 @@
     bool mouse;
     bool winkeys;
     bool grab_mouse;
-    bool grab_keyboard;
     int joytype;
     bool sound;
     bool samples;


More information about the mythtv-dev mailing list