src/emu/cpu/m6502/m6502.c
| r10156 | r10157 | |
| 765 | 765 | } |
| 766 | 766 | } |
| 767 | 767 | |
| 768 | /************************************************************************** |
| 769 | * CPU-specific set_info |
| 770 | **************************************************************************/ |
| 768 | 771 | |
| 772 | CPU_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 | |
| 769 | 784 | /************************************************************************** |
| 770 | 785 | * CPU-specific set_info |
| 771 | 786 | **************************************************************************/ |
| r10156 | r10157 | |
| 970 | 985 | } |
| 971 | 986 | |
| 972 | 987 | DEFINE_LEGACY_CPU_DEVICE(M6502, m6502); |
| 988 | DEFINE_LEGACY_CPU_DEVICE(M6504, m6504); |
| 973 | 989 | DEFINE_LEGACY_CPU_DEVICE(M6510, m6510); |
| 974 | 990 | DEFINE_LEGACY_CPU_DEVICE(M6510T, m6510t); |
| 975 | 991 | DEFINE_LEGACY_CPU_DEVICE(M7501, m7501); |
src/emu/clifront.c
| r10156 | r10157 | |
| 62 | 62 | static void identify_file(core_options *options, const char *name, romident_status *status); |
| 63 | 63 | static void identify_data(core_options *options, const char *name, const UINT8 *data, int length, romident_status *status); |
| 64 | 64 | static void match_roms(core_options *options, const char *hash, int length, int *found); |
| 65 | static void display_suggestions(const char *gamename); |
| 65 | 66 | |
| 66 | 67 | |
| 67 | 68 | |
| r10156 | r10157 | |
| 108 | 109 | CORE IMPLEMENTATION |
| 109 | 110 | ***************************************************************************/ |
| 110 | 111 | |
| 112 | static 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 | } |
| 111 | 127 | /*------------------------------------------------- |
| 112 | 128 | cli_execute - execute a game via the standard |
| 113 | 129 | command line interface |
| r10156 | r10157 | |
| 129 | 145 | options_add_entries(options, cli_options); |
| 130 | 146 | |
| 131 | 147 | /* 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)) |
| 133 | 149 | { |
| 134 | 150 | result = MAMERR_INVALID_CONFIG; |
| 135 | 151 | goto error; |
| r10156 | r10157 | |
| 154 | 170 | /* if we don't have a valid driver selected, offer some suggestions */ |
| 155 | 171 | if (strlen(gamename_option) > 0 && driver == NULL) |
| 156 | 172 | { |
| 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); |
| 170 | 174 | /* exit with an error */ |
| 171 | 175 | result = MAMERR_NO_SUCH_GAME; |
| 172 | 176 | goto error; |
| 173 | 177 | } |
| 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 | |
| 174 | 185 | |
| 175 | 186 | /* run the game */ |
| 176 | 187 | result = mame_execute(osd, options); |
| r10156 | r10157 | |
| 318 | 329 | if (options_get_bool(options, info_commands[i].option)) |
| 319 | 330 | { |
| 320 | 331 | const char *gamename = options_get_string(options, OPTION_GAMENAME); |
| 321 | | |
| 322 | 332 | /* parse any relevant INI files before proceeding */ |
| 323 | 333 | 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; |
| 325 | 340 | } |
| 326 | 341 | |
| 327 | 342 | return -1; |
src/lib/util/options.c
| r10156 | r10157 | |
| 456 | 456 | of command line arguments |
| 457 | 457 | -------------------------------------------------*/ |
| 458 | 458 | |
| 459 | | int options_parse_command_line(core_options *opts, int argc, char **argv, int priority) |
| 459 | int options_parse_command_line(core_options *opts, int argc, char **argv, int priority, int show_error) |
| 460 | 460 | { |
| 461 | 461 | int unadorned_index = 0; |
| 462 | 462 | int arg; |
| 463 | for (arg = 1; arg < argc; arg++) |
| 464 | { |
| 465 | const char *optionname; |
| 466 | options_data *data; |
| 467 | int is_unadorned; |
| 463 | 468 | |
| 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 | } |
| 464 | 485 | /* loop over commands, looking for options */ |
| 465 | 486 | for (arg = 1; arg < argc; arg++) |
| 466 | 487 | { |
| r10156 | r10157 | |
| 479 | 500 | data = find_entry_data(opts, optionname, TRUE); |
| 480 | 501 | if (data == NULL) |
| 481 | 502 | { |
| 503 | if (!show_error) continue; |
| 482 | 504 | message(opts, OPTMSG_ERROR, "Error: unknown option: %s\n", argv[arg]); |
| 483 | 505 | return 1; |
| 484 | 506 | } |