MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / main

Function main

main.cpp:239–400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237\******************************************************************************************/
238
239int main(int argc, char* argv[])
240{
241#ifdef _WIN32
242 /*---------------------------------------------------------*\
243 | Windows only - Attach console output |
244 \*---------------------------------------------------------*/
245 if (AttachConsole(ATTACH_PARENT_PROCESS))
246 {
247 /*---------------------------------------------------------*\
248 | We are running under some terminal context; otherwise |
249 | leave the GUI and CRT alone |
250 \*---------------------------------------------------------*/
251 freopen("CONIN$", "r", stdin);
252 freopen("CONOUT$", "w", stdout);
253 freopen("CONOUT$", "w", stderr);
254 }
255
256 /*---------------------------------------------------------*\
257 | Windows only - Start timer resolution correction thread |
258 \*---------------------------------------------------------*/
259 std::thread * InitializeTimerResolutionThread;
260 InitializeTimerResolutionThread = new std::thread(InitializeTimerResolutionThreadFunction);
261 InitializeTimerResolutionThread->detach();
262
263 /*---------------------------------------------------------*\
264 | Windows only - Install SMBus Driver WinRing0 |
265 \*---------------------------------------------------------*/
266 InstallWinRing0();
267#endif
268
269 /*---------------------------------------------------------*\
270 | Mac x86/x64 only - Install SMBus Driver macUSPCIO |
271 \*---------------------------------------------------------*/
272#ifdef _MACOSX_X86_X64
273 InitMacUSPCIODriver();
274#endif
275
276 /*---------------------------------------------------------*\
277 | Process command line arguments before detection |
278 \*---------------------------------------------------------*/
279 unsigned int ret_flags = cli_pre_detection(argc, argv);
280
281 /*---------------------------------------------------------*\
282 | Perform local connection and/or hardware detection if not |
283 | disabled from CLI |
284 \*---------------------------------------------------------*/
285 if(!(ret_flags & RET_FLAG_NO_AUTO_CONNECT))
286 {
287 printf("Attempting to connect to local OpenRGB server.\r\n");
288
289 if(!AttemptLocalConnection())
290 {
291 printf("Local OpenRGB server unavailable.\r\n");
292 }
293 else
294 {
295 printf("Local OpenRGB server connected, running in client mode\r\n");
296

Callers

nothing calls this directly

Calls 15

InstallWinRing0Function · 0.85
InitMacUSPCIODriverFunction · 0.85
cli_pre_detectionFunction · 0.85
AttemptLocalConnectionFunction · 0.85
cli_post_detectionFunction · 0.85
CloseMacUSPCIODriverFunction · 0.85
WaitWhileServerOnlineFunction · 0.85
DisableDetectionMethod · 0.80
GetDetectionEnabledMethod · 0.80
DetectDevicesMethod · 0.80
StartServerMethod · 0.80
GetServerMethod · 0.80

Tested by

no test coverage detected