MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / handleCommandLine

Method handleCommandLine

Engine/source/app/mainLoop.cpp:404–578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

402}
403
404bool StandardMainLoop::handleCommandLine( S32 argc, const char **argv )
405{
406 // Allow the window manager to process command line inputs; this is
407 // done to let web plugin functionality happen in a fairly transparent way.
408 PlatformWindowManager::get()->processCmdLineArgs(argc, argv);
409
410 Process::handleCommandLine( argc, argv );
411
412 // Set up the command line args for the console scripts...
413 Con::setIntVariable("Game::argc", argc);
414 U32 i;
415 for (i = 0; i < argc; i++)
416 Con::setVariable(avar("Game::argv%d", i), argv[i]);
417
418#ifdef TORQUE_PLAYER
419 if(argc > 2 && dStricmp(argv[1], "-project") == 0)
420 {
421 char playerPath[1024];
422 Platform::makeFullPathName(argv[2], playerPath, sizeof(playerPath));
423 Platform::setCurrentDirectory(playerPath);
424
425 argv += 2;
426 argc -= 2;
427
428 // Re-locate the game:/ asset mount.
429
430 Torque::FS::Unmount( "game" );
431 Torque::FS::Mount( "game", Platform::FS::createNativeFS( playerPath ) );
432 }
433#endif
434
435 // Executes an entry script file. This is "main.tscript"
436 // by default, but any file name (with no whitespace
437 // in it) may be run if it is specified as the first
438 // command-line parameter. The script used, default
439 // or otherwise, is not compiled and is loaded here
440 // directly because the resource system restricts
441 // access to the "root" directory.
442
443 bool foundExternalMain = false;
444 CInterface::CallMain(&foundExternalMain);
445 if (foundExternalMain)
446 return true;
447
448#ifdef TORQUE_ENABLE_VFS
449 Zip::ZipArchive *vfs = openEmbeddedVFSArchive();
450 bool useVFS = vfs != NULL;
451#endif
452
453 Stream *mainCsStream = NULL;
454
455 // The working filestream.
456 FileStream str;
457
458 const char *defaultScriptName = "main." TORQUE_SCRIPT_EXTENSION;
459 bool useDefaultScript = true;
460
461 // Check if any command-line parameters were passed (the first is just the app name).

Callers

nothing calls this directly

Calls 15

setIntVariableFunction · 0.85
setVariableFunction · 0.85
avarFunction · 0.85
dStricmpFunction · 0.85
UnmountFunction · 0.85
MountFunction · 0.85
openEmbeddedVFSArchiveFunction · 0.85
compareFunction · 0.85
dStrcpyFunction · 0.85
dSprintfFunction · 0.85
closeEmbeddedVFSArchiveFunction · 0.85
evaluateFunction · 0.85

Tested by

no test coverage detected