adding actual player 2 support
[drnoksnes] / platform / config.cpp
index 2486dd6..869dc7d 100644 (file)
@@ -66,6 +66,8 @@ static struct poptOption commonOptionsTable[] = {
        "enable safe subset of speedhacks", 0 },
        { "all-hacks", 'H', POPT_ARG_NONE, 0, 19,
        "enable all speedhacks (may break sound)", 0 },
+       { "saver", 'R', POPT_ARG_NONE, 0, 20,
+       "save&exit when the emulator window is unfocused", 0 },
        POPT_TABLEEND
 };
 
@@ -74,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" },
@@ -188,10 +192,13 @@ static void loadDefaults()
        basePath = 0;
 
        Config.quitting = false;
+       Config.saver = false;
        Config.enableAudio = true;
        Config.fullscreen = false;
        Config.scaler = 0;
        Config.hacksFile = 0;
+       Config.joypad1Enabled = false;
+       Config.joypad2Enabled = false;
        Config.touchscreenInput = false;
        Config.touchscreenShow = false;
 
@@ -375,14 +382,23 @@ static void parseArgs(poptContext optCon)
                                Settings.HacksEnabled = TRUE;
                                Settings.HacksFilter = FALSE;
                                break;
+                       case 20:
+                               Config.saver = true;
+                               break;
                        case 100:
                                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;