Previous 15994 Revisions Next

r10090 Tuesday 18th January, 2011 at 15:38:38 UTC by Miodrag Milanović
Fixed order of parsing parameters, this way game name is checked first, so in case of optional parameters (like for image devices) it will first give you list of drivers with nearest name and not error that parameter doesn't exist
[src/emu]clifront.c

src/emu/clifront.c
r10089r10090
127127      /* initialize the options manager and add the CLI-specific options */
128128      options = mame_options_init(osd_options);
129129      options_add_entries(options, cli_options);
130
131      /* parse the command line first; if we fail here, we're screwed */
132      if (options_parse_command_line(options, argc, argv, OPTION_PRIORITY_CMDLINE))
130     
131      gamename_option = "";
132      for (int arg = 1; arg < argc; arg++)
133133      {
134         result = MAMERR_INVALID_CONFIG;
135         goto error;
134         if ((argv[arg][0] != '-')) {
135            gamename_option = argv[arg];
136            break;
137         }
136138      }
137139
138      /* parse the simple commmands before we go any further */
139      core_filename_extract_base(&exename, argv[0], TRUE);
140      result = execute_simple_commands(options, exename);
141      if (result != -1)
142         goto error;
143
144140      /* find out what game we might be referring to */
145      gamename_option = options_get_string(options, OPTION_GAMENAME);
146141      core_filename_extract_base(&gamename, gamename_option, TRUE);
147142      driver = driver_get_name(gamename);
148143
149      /* execute any commands specified */
150      result = execute_commands(options, exename, driver);
151      if (result != -1)
152         goto error;
153
154144      /* if we don't have a valid driver selected, offer some suggestions */
155145      if (strlen(gamename_option) > 0 && driver == NULL)
156146      {
r10089r10090
172162         goto error;
173163      }
174164
165      /* parse the command line first; if we fail here, we're screwed */
166      if (options_parse_command_line(options, argc, argv, OPTION_PRIORITY_CMDLINE))
167      {
168         result = MAMERR_INVALID_CONFIG;
169         goto error;
170      }
171
172      /* parse the simple commmands before we go any further */
173      core_filename_extract_base(&exename, argv[0], TRUE);
174      result = execute_simple_commands(options, exename);
175      if (result != -1)
176         goto error;
177
178      /* execute any commands specified */
179      result = execute_commands(options, exename, driver);
180      if (result != -1)
181         goto error;
182
175183      /* run the game */
176184      result = mame_execute(osd, options);
177185   }

Previous 15994 Revisions Next


© 1998-2018 The MESS Team