MCPcopy Create free account
hub / github.com/VCVRack/Rack / main

Function main

adapters/standalone.cpp:56–325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54
55
56int main(int argc, char* argv[]) {
57#if defined ARCH_WIN
58 // Windows global mutex to prevent multiple instances
59 // Handle will be closed by Windows when the process ends
60 HANDLE instanceMutex = CreateMutexW(NULL, true, string::UTF8toUTF16(APP_NAME).c_str());
61 if (GetLastError() == ERROR_ALREADY_EXISTS) {
62 osdialog_message(OSDIALOG_ERROR, OSDIALOG_OK, "VCV Rack is already running. Multiple Rack instances are not supported.");
63 exit(1);
64 }
65 (void) instanceMutex;
66
67 // Don't display "Assertion failed!" dialog message.
68 _set_error_mode(_OUT_TO_STDERR);
69#endif
70
71 std::string patchPath;
72 bool screenshot = false;
73 float screenshotZoom = 1.f;
74 const std::string appInfo = APP_NAME + " " + APP_EDITION_NAME + " " + APP_VERSION + " " + APP_OS_NAME + " " + APP_CPU_NAME;
75
76 // Parse command line arguments
77 static const struct option longOptions[] = {
78 {"safe", no_argument, NULL, 'a'},
79 {"dev", no_argument, NULL, 'd'},
80 {"headless", no_argument, NULL, 'h'},
81 {"screenshot", required_argument, NULL, 't'},
82 {"system", required_argument, NULL, 's'},
83 {"user", required_argument, NULL, 'u'},
84 {"version", no_argument, NULL, 'v'},
85 {"help", no_argument, NULL, 256},
86 {NULL, 0, NULL, 0}
87 };
88 int c;
89 opterr = 0;
90
91 while ((c = getopt_long(argc, argv, "adht:s:u:vp:", longOptions, NULL)) != -1) {
92 switch (c) {
93 case 'a': {
94 settings::safeMode = true;
95 } break;
96 case 'd': {
97 settings::devMode = true;
98 } break;
99 case 'h': {
100 settings::headless = true;
101 } break;
102 case 't': {
103 screenshot = true;
104 std::sscanf(optarg, "%f", &screenshotZoom);
105 } break;
106 case 's': {
107 asset::systemDir = optarg;
108 } break;
109 case 'u': {
110 asset::userDir = optarg;
111 } break;
112 case 'v': {
113 std::fprintf(stderr, "%s\n", appInfo.c_str());

Callers 1

wmainFunction · 0.85

Calls 15

UTF8toUTF16Function · 0.85
resetFpuFlagsFunction · 0.85
userFunction · 0.85
getOperatingSystemInfoFunction · 0.85
formatTimeISOFunction · 0.85
getUnixTimeFunction · 0.85
loadFunction · 0.85
translateFunction · 0.85
systemFunction · 0.85
isDirectoryFunction · 0.85
rtaudioInitFunction · 0.85
rtmidiInitFunction · 0.85

Tested by

no test coverage detected