MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / parse_cmdline

Function parse_cmdline

src/main.cpp:1190–1499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1188#endif
1189
1190static void parse_cmdline (int argc, TCHAR **argv)
1191{
1192 auto firstconfig = true;
1193 auto loaded = false;
1194
1195 // only parse command line when starting for the first time
1196 if (cmdline_started)
1197 return;
1198 cmdline_started = true;
1199
1200 for (auto i = 1; i < argc; i++) {
1201 if (_tcsncmp(argv[i], _T("-cli="), 5) == 0 || _tcsncmp(argv[i], _T("--cli="), 6) == 0) {
1202 console_emulation = 1;
1203 TCHAR *path = _tcschr(argv[i], _T('=')) + 1;
1204 if (path && path[0]) {
1205 _tcsncpy(console_path, path, MAX_DPATH - 1);
1206 console_path[MAX_DPATH - 1] = 0;
1207 }
1208 continue;
1209 }
1210 if (_tcscmp(argv[i], _T("-cli")) == 0 || _tcscmp(argv[i], _T("--cli")) == 0) {
1211 console_emulation = 1;
1212 // Check if next argument is a path (not starting with '-')
1213 if (i + 1 < argc && argv[i + 1][0] != _T('-')) {
1214 i++;
1215 _tcsncpy(console_path, argv[i], MAX_DPATH - 1);
1216 console_path[MAX_DPATH - 1] = 0;
1217 }
1218 continue;
1219 }
1220 if (!_tcsncmp(argv[i], _T("-diskswapper="), 13)) {
1221 parse_diskswapper(argv[i] + 13);
1222 }
1223 else if (_tcsncmp(argv[i], _T("-cfgparam="), 10) == 0) {
1224 ;
1225 }
1226 else if (_tcscmp(argv[i], _T("-cfgparam")) == 0) {
1227 if (i + 1 < argc)
1228 i++;
1229 }
1230 else if (_tcscmp(argv[i], _T("--config")) == 0 || _tcscmp(argv[i], _T("-f")) == 0) {
1231 if (i + 1 == argc)
1232 write_log(_T("Missing argument for '--config' option.\n"));
1233 else
1234 {
1235 auto* const txt = parsetextpath(argv[++i]);
1236 currprefs.mountitems = 0;
1237 target_cfgfile_load(&currprefs, txt,
1238 firstconfig
1239 ? CONFIG_TYPE_ALL
1240 : CONFIG_TYPE_HARDWARE | CONFIG_TYPE_HOST | CONFIG_TYPE_NORESET, 0);
1241 xfree(txt);
1242 firstconfig = false;
1243 config_loaded = true;
1244 }
1245 loaded = true;
1246 }
1247 else if (_tcscmp(argv[i], _T("--model")) == 0) {

Callers 1

Calls 15

parse_diskswapperFunction · 0.85
parsetextpathFunction · 0.85
target_cfgfile_loadFunction · 0.85
bip_a500Function · 0.85
bip_a500plusFunction · 0.85
bip_a600Function · 0.85
bip_a1000Function · 0.85
bip_a2000Function · 0.85
bip_a3000Function · 0.85
bip_a1200Function · 0.85
bip_a4000Function · 0.85
bip_cd32Function · 0.85

Tested by

no test coverage detected