config file two players (in progress)
authorJavier S. Pedro <maemo@javispedro.com>
Mon, 8 Feb 2010 14:59:46 +0000 (15:59 +0100)
committerJavier S. Pedro <maemo@javispedro.com>
Mon, 8 Feb 2010 14:59:46 +0000 (15:59 +0100)
platform/config.cpp
platform/platform.h

index 0c21432..08f5347 100644 (file)
@@ -76,7 +76,9 @@ static struct poptOption configOptionsTable[] = {
        "scancode to map", "CODE" },
        { "button", '\0', POPT_ARG_STRING, 0, 101,
        "SNES Button to press (A, B, X, Y, L, R, Up, Down, Left, Right)", "name" },
-       { "action", '\0', POPT_ARG_STRING, 0, 102,
+       { "button2", '\0', POPT_ARG_STRING, 0, 102,
+       "SNES Button to press for joypad 2", "name" },
+       { "action", '\0', POPT_ARG_STRING, 0, 110,
        "emulator action to do (fullscreen, quit, ...)", "action" },
        { "hacks-file", '\0', POPT_ARG_STRING, 0, 200,
        "path to snesadvance.dat file", "FILE" },
@@ -195,6 +197,8 @@ static void loadDefaults()
        Config.fullscreen = false;
        Config.scaler = 0;
        Config.hacksFile = 0;
+       Config.player1Enabled = false;
+       Config.player2Enabled = false;
        Config.touchscreenInput = false;
        Config.touchscreenShow = false;
 
@@ -385,10 +389,16 @@ static void parseArgs(poptContext optCon)
                                scancode = atoi(poptGetOptArg(optCon));
                                break;
                        case 101:
-                               Config.joypad1Mapping[scancode] |= 
+                               Config.joypad1Mapping[scancode] |=
                                        buttonNameToBit(poptGetOptArg(optCon));
+                               Config.joypad1Enabled = true;
                                break;
                        case 102:
+                               Config.joypad2Mapping[scancode] |=
+                                       buttonNameToBit(poptGetOptArg(optCon));
+                               Config.joypad2Enabled = true;
+                               break;
+                       case 110:
                                Config.action[scancode] |= 
                                        actionNameToBit(poptGetOptArg(optCon));
                                break;
index 2cd1769..6598183 100644 (file)
@@ -22,6 +22,10 @@ extern struct config {
        bool saver;
        /** Speedhacks file to use */
        char * hacksFile;
+       /** Enable player 1 joypad */
+       bool joypad1Enabled;
+       /** Enable player 2 joypad */
+       bool joypad2Enabled;
        /** Enable touchscreen controls */
        bool touchscreenInput;
        /** Display touchscreen controls grid */