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