MCPcopy Create free account
hub / github.com/Aloshi/EmulationStation / parseArgs

Function parseArgs

src/main.cpp:27–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25namespace fs = boost::filesystem;
26
27bool parseArgs(int argc, char* argv[], unsigned int* width, unsigned int* height)
28{
29 if(argc > 1)
30 {
31 for(int i = 1; i < argc; i++)
32 {
33 if(strcmp(argv[i], "-w") == 0)
34 {
35 *width = atoi(argv[i + 1]);
36 i++; //skip the argument value
37 }else if(strcmp(argv[i], "-h") == 0)
38 {
39 *height = atoi(argv[i + 1]);
40 i++; //skip the argument value
41 }else if(strcmp(argv[i], "--gamelist-only") == 0)
42 {
43 Settings::getInstance()->setBool("PARSEGAMELISTONLY", true);
44 }else if(strcmp(argv[i], "--ignore-gamelist") == 0)
45 {
46 Settings::getInstance()->setBool("IGNOREGAMELIST", true);
47 }else if(strcmp(argv[i], "--draw-framerate") == 0)
48 {
49 Settings::getInstance()->setBool("DRAWFRAMERATE", true);
50 }else if(strcmp(argv[i], "--no-exit") == 0)
51 {
52 Settings::getInstance()->setBool("DONTSHOWEXIT", true);
53 }else if(strcmp(argv[i], "--debug") == 0)
54 {
55 Settings::getInstance()->setBool("DEBUG", true);
56 Log::setReportingLevel(LogDebug);
57 }else if(strcmp(argv[i], "--dimtime") == 0)
58 {
59 Settings::getInstance()->setInt("DIMTIME", atoi(argv[i + 1]) * 1000);
60 i++; //skip the argument value
61 }else if(strcmp(argv[i], "--windowed") == 0)
62 {
63 Settings::getInstance()->setBool("WINDOWED", true);
64 }else if(strcmp(argv[i], "--help") == 0)
65 {
66 std::cout << "EmulationStation, a graphical front-end for ROM browsing.\n";
67 std::cout << "Command line arguments:\n";
68 std::cout << "-w [width in pixels] set screen width\n";
69 std::cout << "-h [height in pixels] set screen height\n";
70 std::cout << "--gamelist-only skip automatic game detection, only read from gamelist.xml\n";
71 std::cout << "--ignore-gamelist ignore the gamelist (useful for troubleshooting)\n";
72 std::cout << "--draw-framerate display the framerate\n";
73 std::cout << "--no-exit don't show the exit option in the menu\n";
74 std::cout << "--debug even more logging\n";
75 std::cout << "--dimtime [seconds] time to wait before dimming the screen (default 30, use 0 for never)\n";
76
77 #ifdef USE_OPENGL_DESKTOP
78 std::cout << "--windowed not fullscreen\n";
79 #endif
80
81 std::cout << "--help summon a sentient, angry tuba\n\n";
82 std::cout << "More information available in README.md.\n";
83 return false; //exit after printing help
84 }

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected