MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / LoadConfiguration

Function LoadConfiguration

TombEngine/Specific/configuration.cpp:352–559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

350}
351
352bool LoadConfiguration()
353{
354 // Open root key.
355 HKEY rootKey = NULL;
356 if (RegOpenKeyA(HKEY_CURRENT_USER, REGKEY_ROOT, &rootKey) != ERROR_SUCCESS)
357 {
358 RegCloseKey(rootKey);
359 return false;
360 }
361
362 // Open Graphics subkey.
363 HKEY graphicsKey = NULL;
364 if (RegOpenKeyExA(rootKey, REGKEY_GRAPHICS, 0, KEY_READ, &graphicsKey) != ERROR_SUCCESS)
365 {
366 RegCloseKey(rootKey);
367 RegCloseKey(graphicsKey);
368 return false;
369 }
370
371 DWORD screenWidth = 0;
372 DWORD screenHeight = 0;
373 bool enableWindowedMode = false;
374 DWORD shadowMode = 1;
375 DWORD shadowMapSize = GameConfiguration::DEFAULT_SHADOW_MAP_SIZE;
376 DWORD shadowBlobsMax = GameConfiguration::DEFAULT_SHADOW_BLOBS_MAX;
377 bool enableCaustics = false;
378 bool enableDecals = false;
379 DWORD antialiasingMode = 1;
380 bool enableAmbientOcclusion = false;
381 bool enableHighFramerate = false;
382
383 // Load Graphics keys.
384 if (GetDWORDRegKey(graphicsKey, REGKEY_SCREEN_WIDTH, &screenWidth, 0) != ERROR_SUCCESS ||
385 GetDWORDRegKey(graphicsKey, REGKEY_SCREEN_HEIGHT, &screenHeight, 0) != ERROR_SUCCESS ||
386 GetBoolRegKey(graphicsKey, REGKEY_ENABLE_WINDOWED_MODE, &enableWindowedMode, false) != ERROR_SUCCESS ||
387 GetDWORDRegKey(graphicsKey, REGKEY_SHADOWS, &shadowMode, 1) != ERROR_SUCCESS ||
388 GetDWORDRegKey(graphicsKey, REGKEY_SHADOW_MAP_SIZE, &shadowMapSize, GameConfiguration::DEFAULT_SHADOW_MAP_SIZE) != ERROR_SUCCESS ||
389 GetDWORDRegKey(graphicsKey, REGKEY_SHADOW_BLOBS_MAX, &shadowBlobsMax, GameConfiguration::DEFAULT_SHADOW_BLOBS_MAX) != ERROR_SUCCESS ||
390 GetBoolRegKey(graphicsKey, REGKEY_ENABLE_CAUSTICS, &enableCaustics, true) != ERROR_SUCCESS ||
391 GetBoolRegKey(graphicsKey, REGKEY_ENABLE_DECALS, &enableDecals, true) != ERROR_SUCCESS ||
392 GetDWORDRegKey(graphicsKey, REGKEY_ANTIALIASING_MODE, &antialiasingMode, true) != ERROR_SUCCESS ||
393 GetBoolRegKey(graphicsKey, REGKEY_AMBIENT_OCCLUSION, &enableAmbientOcclusion, false) != ERROR_SUCCESS ||
394 GetBoolRegKey(graphicsKey, REGKEY_HIGH_FRAMERATE, &enableHighFramerate, false) != ERROR_SUCCESS)
395 {
396 RegCloseKey(rootKey);
397 RegCloseKey(graphicsKey);
398 return false;
399 }
400
401 // Open Sound subkey.
402 HKEY soundKey = NULL;
403 if (RegOpenKeyExA(rootKey, REGKEY_SOUND, 0, KEY_READ, &soundKey) != ERROR_SUCCESS)
404 {
405 RegCloseKey(rootKey);
406 RegCloseKey(graphicsKey);
407 RegCloseKey(soundKey);
408 return false;
409 }

Callers 1

WinMainFunction · 0.85

Calls 9

GetDWORDRegKeyFunction · 0.85
GetBoolRegKeyFunction · 0.85
sprintfFunction · 0.85
SetVolumeTracksFunction · 0.85
SetVolumeFXFunction · 0.85
DefaultConflictFunction · 0.85
GetBoundKeyIDMethod · 0.80
SetKeyBindingMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected