MCPcopy Create free account
hub / github.com/MergHQ/CRYENGINE / CheckCPURequirements

Function CheckCPURequirements

Code/CryEngine/CrySystem/SystemInit.cpp:2329–2374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2327#endif
2328
2329static bool CheckCPURequirements(CCpuFeatures* pCpu, CSystem* pSystem)
2330{
2331#if !defined(DEDICATED_SERVER)
2332 #if CRY_PLATFORM_WINDOWS
2333 if (!gEnv->IsEditor() && !gEnv->IsDedicated())
2334 {
2335 if (!(pCpu->hasSSE() && pCpu->hasSSE2() && pCpu->hasSSE3()))
2336 {
2337 CryLogAlways("Unsupported CPU! Need SSE, SSE2 and SSE3 instructions to be available.");
2338
2339 #if !defined(_RELEASE)
2340 const bool allowPrompts = pSystem->GetICmdLine()->FindArg(eCLAT_Pre, "noprompt") == 0;
2341 #else
2342 const bool allowPrompts = true;
2343 #endif // !defined(_RELEASE)
2344 if (allowPrompts)
2345 {
2346 CryLogAlways("Asking user if they wish to continue...");
2347 const int mbRes = MessageBoxW(0, GetErrorStringUnsupportedCPU().c_str(), L"CRYENGINE", MB_ICONWARNING | MB_OKCANCEL | MB_DEFBUTTON2 | MB_DEFAULT_DESKTOP_ONLY);
2348 if (mbRes == IDCANCEL)
2349 {
2350 CryLogAlways("User chose to cancel.");
2351 return false;
2352 }
2353 }
2354 else
2355 {
2356 #if !defined(_RELEASE)
2357 const bool obeyCPUCheck = pSystem->GetICmdLine()->FindArg(eCLAT_Pre, "anycpu") == 0;
2358 #else
2359 const bool obeyCPUCheck = true;
2360 #endif // !defined(_RELEASE)
2361 if (obeyCPUCheck)
2362 {
2363 CryLogAlways("No prompts allowed and unsupported CPU check active. Treating unsupported CPU as error and exiting.");
2364 return false;
2365 }
2366 }
2367
2368 CryLogAlways("User chose to continue despite unsupported CPU!");
2369 }
2370 }
2371 #endif
2372#endif // !defined(DEDICATED_SERVER)
2373 return true;
2374}
2375
2376// System initialization
2377/////////////////////////////////////////////////////////////////////////////////

Callers 1

SystemInit.cppFile · 0.85

Calls 10

CryLogAlwaysFunction · 0.85
IsDedicatedMethod · 0.80
hasSSEMethod · 0.80
hasSSE2Method · 0.80
hasSSE3Method · 0.80
FindArgMethod · 0.80
GetICmdLineMethod · 0.80
IsEditorMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected