X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=platform%2Fconfig.cpp;h=08f53471cc739cbcda16956a5aa1e953ccefffce;hb=69f45a759e3ba9719958c4ea6f30207ced0b013c;hp=cf01595e5143527f4c9db998e7f5f1f1e3a0b6d8;hpb=cb1568357ce9462a5b4f66f9da83082c0c300ade;p=drnoksnes diff --git a/platform/config.cpp b/platform/config.cpp index cf01595..08f5347 100644 --- a/platform/config.cpp +++ b/platform/config.cpp @@ -7,7 +7,10 @@ #include "port.h" #include "snes9x.h" #include "display.h" -#include "hgw.h" + +#if CONF_GUI +#include "osso.h" +#endif #define DIE(format, ...) do { \ fprintf(stderr, "Died at %s:%d: ", __FILE__, __LINE__ ); \ @@ -63,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 }; @@ -71,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" }, @@ -185,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.player1Enabled = false; + Config.player2Enabled = false; Config.touchscreenInput = false; Config.touchscreenShow = false; @@ -372,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; @@ -407,30 +426,34 @@ static void parseArgs(poptContext optCon) S9xSetRomFile(extra_arg); } -void S9xLoadConfig(int argc, const char ** argv) +void S9xLoadConfig(int argc, char ** argv) { - poptContext optCon = - poptGetContext("drnoksnes", argc, argv, optionsTable, 0); + poptContext optCon = poptGetContext("drnoksnes", + argc, const_cast(argv), optionsTable, 0); poptSetOtherOptionHelp(optCon, ""); // Builtin defaults loadDefaults(); - // Read config file ~/apps/DrNokSnes.txt + // Read config file ~/.config/drnoksnes.conf char defConfFile[PATH_MAX]; - sprintf(defConfFile, "%s/%s", getenv("HOME"), "apps/DrNokSnes.txt"); + sprintf(defConfFile, "%s/%s", getenv("HOME"), ".config/drnoksnes.conf"); loadConfig(optCon, defConfFile); // Command line parameters (including --conf args) parseArgs(optCon); - if (!gotRomFile() && !hgwLaunched) { - // User did not specify a ROM file, - // and we're not being launched from D-Bus. - fprintf(stderr, "You need to specify a ROM, like this:\n"); - poptPrintUsage(optCon, stdout, 0); - poptFreeContext(optCon); - exit(2); +#if CONF_GUI + if (!OssoOk()) +#endif + { + if (!gotRomFile()) { + // User did not specify a ROM file in the command line + fprintf(stderr, "You need to specify a ROM, like this:\n"); + poptPrintUsage(optCon, stdout, 0); + poptFreeContext(optCon); + exit(2); + } } poptFreeContext(optCon);