src/emu/clifront.c
| r10089 | r10090 | |
| 127 | 127 | /* initialize the options manager and add the CLI-specific options */ |
| 128 | 128 | options = mame_options_init(osd_options); |
| 129 | 129 | 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++) |
| 133 | 133 | { |
| 134 | | result = MAMERR_INVALID_CONFIG; |
| 135 | | goto error; |
| 134 | if ((argv[arg][0] != '-')) { |
| 135 | gamename_option = argv[arg]; |
| 136 | break; |
| 137 | } |
| 136 | 138 | } |
| 137 | 139 | |
| 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 | | |
| 144 | 140 | /* find out what game we might be referring to */ |
| 145 | | gamename_option = options_get_string(options, OPTION_GAMENAME); |
| 146 | 141 | core_filename_extract_base(&gamename, gamename_option, TRUE); |
| 147 | 142 | driver = driver_get_name(gamename); |
| 148 | 143 | |
| 149 | | /* execute any commands specified */ |
| 150 | | result = execute_commands(options, exename, driver); |
| 151 | | if (result != -1) |
| 152 | | goto error; |
| 153 | | |
| 154 | 144 | /* if we don't have a valid driver selected, offer some suggestions */ |
| 155 | 145 | if (strlen(gamename_option) > 0 && driver == NULL) |
| 156 | 146 | { |
| r10089 | r10090 | |
| 172 | 162 | goto error; |
| 173 | 163 | } |
| 174 | 164 | |
| 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 | |
| 175 | 183 | /* run the game */ |
| 176 | 184 | result = mame_execute(osd, options); |
| 177 | 185 | } |