Change resolution : ConfirmVideoMode no working

Hi,

I’m trying to change the resolution :
First I call RequestResolutionChange and it changes the resolution
Then I wait on the user telling me “it works” or “revert” (after 10 seconds it will revert anyway)

Now when the resolution is confirmed with ConfirmVideoMode BUT the GetLastConfirmedScreenResolution doesn’t have the new resolution so I can’t use it to set and save the correct resolution.

This is my code :

 void UTestCopyModelGameInstance::TryResolutionChange(int32 weight, int32 height, EWindowModeEnum fullscreenMode)
 {
	 GetGameUserSettings()->RequestResolutionChange(weight, height, EWindowMode::Type(fullscreenMode),false);
 }

 void UTestCopyModelGameInstance::ConfirmVideoMode(bool bIsConfirmed)
 {
	 UGameUserSettings* settings = GetGameUserSettings();
	 if (bIsConfirmed)
	 {
		 settings->ConfirmVideoMode();
		 GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, FString::Printf(TEXT("res %d x %d"), settings->GetScreenResolution().X, settings->GetScreenResolution().Y));
		 GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, FString::Printf(TEXT("res confirm %d x %d"), settings->GetLastConfirmedScreenResolution().X, settings->GetLastConfirmedScreenResolution().Y));
		 settings->SetScreenResolution(settings->GetLastConfirmedScreenResolution());
		 settings->SetFullscreenMode(settings->GetLastConfirmedFullscreenMode());
		 
		 //settings->ApplySettings(false);
		 Scalability::SaveState(GGameUserSettingsIni);
		 settings->SaveSettings();
	 }
	 else
	 {
		 settings->RevertVideoMode();
		 settings->ApplyResolutionSettings(false);
	 }
 }

What should I do ?

rXp

I stored myself the confirmed values and applied them. But this should get look into.

Conclusion: ConfirmVideoMode() and ConvertVideoMode() are not useful at all, according to what I see in 4.25.

Hold data by yourself.

ResolutionSizeX and LastUserConfirmedResolutionSizeX will be updated when you request, no matter which you call, SetScreenResolution() or RequestResolutionChange(), where in the latter case ResolutionSizeX and LastUserConfirmedResolutionSizeX will be updated in the tick task.

Therefore, when we really want to confirm or revert the resolution setting, we don’t have reliable data in hand.

SetScreenResolution() sets ResolutionSizeX, ConfirmVideoMode() sets LastUserConfirmedResolutionSizeX by ResolutionSizeX, and RevertVideoMode() sets ResolutionSizeX by LastUserConfirmedResolutionSizeX. In 4.25 we don’t have old LastUserConfirmedResolutionSizeX when we want to revert it.

Since the mechanism is not reliable, I recommend holding both the requested resolution and the last confirmed resolution by ourselves during the request-confirm process.