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