MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / ParseCommandLineArgs

Method ParseCommandLineArgs

pcsx2-gsrunner/Main.cpp:528–830  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

526}
527
528bool GSRunner::ParseCommandLineArgs(int argc, char* argv[], VMBootParameters& params)
529{
530 std::string dumpdir; // Save from argument -dumpdir for creating sub-directories
531 bool no_more_args = false;
532 for (int i = 1; i < argc; i++)
533 {
534 if (!no_more_args)
535 {
536#define CHECK_ARG(str) !std::strcmp(argv[i], str)
537#define CHECK_ARG_PARAM(str) (!std::strcmp(argv[i], str) && ((i + 1) < argc))
538
539 if (CHECK_ARG("-help"))
540 {
541 PrintCommandLineHelp(argv[0]);
542 return false;
543 }
544 else if (CHECK_ARG("-version"))
545 {
546 PrintCommandLineVersion();
547 return false;
548 }
549 else if (CHECK_ARG_PARAM("-dumpdir"))
550 {
551 dumpdir = s_output_prefix = StringUtil::StripWhitespace(argv[++i]);
552 if (s_output_prefix.empty())
553 {
554 Console.Error("Invalid dump directory specified.");
555 return false;
556 }
557
558 if (!FileSystem::DirectoryExists(s_output_prefix.c_str()) && !FileSystem::CreateDirectoryPath(s_output_prefix.c_str(), false))
559 {
560 Console.Error("Failed to create output directory");
561 return false;
562 }
563
564 continue;
565 }
566 else if (CHECK_ARG_PARAM("-dump"))
567 {
568 std::string str(argv[++i]);
569
570 s_settings_interface.SetBoolValue("EmuCore/GS", "DumpGSData", true);
571
572 if (str.find("rt") != std::string::npos)
573 s_settings_interface.SetBoolValue("EmuCore/GS", "SaveRT", true);
574 if (str.find("f") != std::string::npos)
575 s_settings_interface.SetBoolValue("EmuCore/GS", "SaveFrame", true);
576 if (str.find("tex") != std::string::npos)
577 s_settings_interface.SetBoolValue("EmuCore/GS", "SaveTexture", true);
578 if (str.find("z") != std::string::npos)
579 s_settings_interface.SetBoolValue("EmuCore/GS", "SaveDepth", true);
580 if (str.find("a") != std::string::npos)
581 s_settings_interface.SetBoolValue("EmuCore/GS", "SaveAlpha", true);
582 if (str.find("i") != std::string::npos)
583 s_settings_interface.SetBoolValue("EmuCore/GS", "SaveInfo", true);
584 if (str.find("tr") != std::string::npos)
585 s_settings_interface.SetBoolValue("EmuCore/GS", "SaveTransferImages", true);

Callers

nothing calls this directly

Calls 15

PrintCommandLineHelpFunction · 0.85
PrintCommandLineVersionFunction · 0.85
StripWhitespaceFunction · 0.85
StrcasecmpFunction · 0.85
SplitStringFunction · 0.50
maxFunction · 0.50
formatFunction · 0.50
stringClass · 0.50
emptyMethod · 0.45
ErrorMethod · 0.45
c_strMethod · 0.45
SetBoolValueMethod · 0.45

Tested by

no test coverage detected