void UGameUserSettings::ValidateSettings() { // Should we wipe all user settings? if ( !IsVersionValid() ) { // First try loading the settings, if they haven't been loaded before. LoadSettings(true); // If it still an old version, delete the user settings file and reload defaults. if ( !IsVersionValid() ) { // Force reset if there aren't any default .ini settings. SetToDefaults(); static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.VSync")); SetVSyncEnabled( CVar->GetValueOnGameThread() != 0 ); IFileManager::Get().Delete( *GGameUserSettingsIni ); LoadSettings(true); } } if ( ResolutionSizeX <= 0 || ResolutionSizeY <= 0 ) { SetScreenResolution(FIntPoint(GSystemResolution.ResX, GSystemResolution.ResY)); // Set last confirmed video settings LastConfirmedFullscreenMode = FullscreenMode; LastUserConfirmedResolutionSizeX = ResolutionSizeX; LastUserConfirmedResolutionSizeY = ResolutionSizeY; } // The user settings have now been validated for the current version. UpdateVersion(); }
void UGameUserSettings::ResetToCurrentSettings() { if ( GEngine && GEngine->GameViewport && GEngine->GameViewport->GetWindow().IsValid() ) { //handle the fullscreen setting SetFullscreenMode(GetWindowModeType(GEngine->GameViewport->GetWindow()->GetWindowMode())); //set the current resolution SetScreenResolution(FIntPoint(GSystemResolution.ResX, GSystemResolution.ResY)); // Set the current VSync state static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.VSync")); SetVSyncEnabled( CVar->GetValueOnGameThread() != 0 ); // Reset to confirmed settings FullscreenMode = LastConfirmedFullscreenMode; ResolutionSizeX = LastUserConfirmedResolutionSizeX; ResolutionSizeY = LastUserConfirmedResolutionSizeY; // Reset the quality settings to the current levels ScalabilityQuality = Scalability::GetQualityLevels(); } }
void CGraphics::UpdateScreenResolution() { D3DDISPLAYMODE dm; m_pDirect3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &dm); SetScreenResolution(dm.Width, dm.Height); }