Previous 15994 Revisions Next

r10157 Sunday 23rd January, 2011 at 18:05:09 UTC by Miodrag Milanović
Some sync with mame
[src/emu]clifront.c
[src/emu/cpu/m6502]m6502.c m6502.h
[src/lib/util]options.c options.h

src/emu/cpu/m6502/m6502.c
r10156r10157
765765   }
766766}
767767
768/**************************************************************************
769 * CPU-specific set_info
770 **************************************************************************/
768771
772CPU_GET_INFO( m6504 )
773{
774   switch (state)
775   {
776      /* --- the following bits of info are returned as NULL-terminated strings --- */
777      case DEVINFO_STR_NAME:                     strcpy(info->s, "M6504");            break;
778      case DEVINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 13;               break;
779
780      default:                              CPU_GET_INFO_CALL(m6502);         break;
781   }
782}
783
769784/**************************************************************************
770785 * CPU-specific set_info
771786 **************************************************************************/
r10156r10157
970985}
971986
972987DEFINE_LEGACY_CPU_DEVICE(M6502, m6502);
988DEFINE_LEGACY_CPU_DEVICE(M6504, m6504);
973989DEFINE_LEGACY_CPU_DEVICE(M6510, m6510);
974990DEFINE_LEGACY_CPU_DEVICE(M6510T, m6510t);
975991DEFINE_LEGACY_CPU_DEVICE(M7501, m7501);
src/emu/cpu/m6502/m6502.h
r10156r10157
6666};
6767
6868DECLARE_LEGACY_CPU_DEVICE(M6502, m6502);
69
69DECLARE_LEGACY_CPU_DEVICE(M6504, m6504);
7070extern CPU_DISASSEMBLE( m6502 );
7171
7272/****************************************************************************
src/emu/clifront.c
r10156r10157
6262static void identify_file(core_options *options, const char *name, romident_status *status);
6363static void identify_data(core_options *options, const char *name, const UINT8 *data, int length, romident_status *status);
6464static void match_roms(core_options *options, const char *hash, int length, int *found);
65static void display_suggestions(const char *gamename);
6566
6667
6768
r10156r10157
108109    CORE IMPLEMENTATION
109110***************************************************************************/
110111
112static void display_suggestions(const char *gamename)
113{
114   const game_driver *matches[10];
115   int drvnum;
116
117   /* get the top 10 approximate matches */
118   driver_list_get_approx_matches(drivers, gamename, ARRAY_LENGTH(matches), matches);
119
120   /* print them out */
121   fprintf(stderr, "\n\"%s\" approximately matches the following\n"
122         "supported " GAMESNOUN " (best match first):\n\n", gamename);
123   for (drvnum = 0; drvnum < ARRAY_LENGTH(matches); drvnum++)
124      if (matches[drvnum] != NULL)
125         fprintf(stderr, "%-18s%s\n", matches[drvnum]->name, matches[drvnum]->description);
126}
111127/*-------------------------------------------------
112128    cli_execute - execute a game via the standard
113129    command line interface
r10156r10157
129145      options_add_entries(options, cli_options);
130146
131147      /* parse the command line first; if we fail here, we're screwed */
132      if (options_parse_command_line(options, argc, argv, OPTION_PRIORITY_CMDLINE))
148      if (options_parse_command_line(options, argc, argv, OPTION_PRIORITY_CMDLINE, FALSE))
133149      {
134150         result = MAMERR_INVALID_CONFIG;
135151         goto error;
r10156r10157
154170      /* if we don't have a valid driver selected, offer some suggestions */
155171      if (strlen(gamename_option) > 0 && driver == NULL)
156172      {
157         const game_driver *matches[10];
158         int drvnum;
159
160         /* get the top 10 approximate matches */
161         driver_list_get_approx_matches(drivers, gamename_option, ARRAY_LENGTH(matches), matches);
162
163         /* print them out */
164         fprintf(stderr, "\n\"%s\" approximately matches the following\n"
165               "supported " GAMESNOUN " (best match first):\n\n", gamename_option);
166         for (drvnum = 0; drvnum < ARRAY_LENGTH(matches); drvnum++)
167            if (matches[drvnum] != NULL)
168               fprintf(stderr, "%-18s%s\n", matches[drvnum]->name, matches[drvnum]->description);
169
173         display_suggestions(gamename_option);
170174         /* exit with an error */
171175         result = MAMERR_NO_SUCH_GAME;
172176         goto error;
173177      }
178      /* parse the command line first; if we fail here, we're screwed */
179      if (options_parse_command_line(options, argc, argv, OPTION_PRIORITY_CMDLINE, TRUE))
180      {
181         result = MAMERR_INVALID_CONFIG;
182         goto error;
183      }
184     
174185
175186      /* run the game */
176187      result = mame_execute(osd, options);
r10156r10157
318329      if (options_get_bool(options, info_commands[i].option))
319330      {
320331         const char *gamename = options_get_string(options, OPTION_GAMENAME);
321
322332         /* parse any relevant INI files before proceeding */
323333         mame_parse_ini_files(options, driver);
324         return (*info_commands[i].function)(options, (gamename[0] == 0) ? "*" : gamename);
334         int retVal = (*info_commands[i].function)(options, (gamename[0] == 0) ? "*" : gamename);
335         if ( retVal == MAMERR_NO_SUCH_GAME) {
336            display_suggestions(gamename);
337            return MAMERR_NO_SUCH_GAME;
338         }
339         return retVal;
325340      }
326341
327342   return -1;
src/lib/util/options.h
r10156r10157
169169/* ----- option data extraction ----- */
170170
171171/* parse option data from a command line */
172int options_parse_command_line(core_options *opts, int argc, char **argv, int priority);
172int options_parse_command_line(core_options *opts, int argc, char **argv, int priority, int show_error);
173173
174174/*  set option value and execute callback call */
175175int options_force_option_callback(core_options *opts, const char *optionname, const char *newval, int priority);
src/lib/util/options.c
r10156r10157
456456    of command line arguments
457457-------------------------------------------------*/
458458
459int options_parse_command_line(core_options *opts, int argc, char **argv, int priority)
459int options_parse_command_line(core_options *opts, int argc, char **argv, int priority, int show_error)
460460{
461461   int unadorned_index = 0;
462462   int arg;
463   for (arg = 1; arg < argc; arg++)
464   {
465      const char *optionname;
466      options_data *data;
467      int is_unadorned;
463468
469      /* determine the entry name to search for */
470      is_unadorned = (argv[arg][0] != '-');
471      if (!is_unadorned)
472         optionname = &argv[arg][1];
473      else
474         optionname = OPTION_UNADORNED(unadorned_index);
475
476      /* find our entry */
477      data = find_entry_data(opts, optionname, TRUE);
478      if (data == NULL) continue;     
479      if ((data->flags & OPTION_COMMAND) != 0) {
480         // in case of any command force show error to TRUE
481         show_error = TRUE;
482         break;
483      }
484   }   
464485   /* loop over commands, looking for options */
465486   for (arg = 1; arg < argc; arg++)
466487   {
r10156r10157
479500      data = find_entry_data(opts, optionname, TRUE);
480501      if (data == NULL)
481502      {
503         if (!show_error) continue;
482504         message(opts, OPTMSG_ERROR, "Error: unknown option: %s\n", argv[arg]);
483505         return 1;
484506      }

Previous 15994 Revisions Next


© 1998-2018 The MESS Team