From b9d7a98aeceac8987917db03c9eecce50b1b4abd Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Wed, 1 Jun 2016 06:02:37 +0200 Subject: [PATCH] Change swtruecolor cvar to take effect immediately --- src/posix/cocoa/i_video.mm | 11 ++++++++++- src/posix/sdl/hardware.cpp | 12 ++++++++++-- src/win32/hardware.cpp | 12 ++++++++++-- src/win32/win32video.cpp | 14 -------------- 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index c97460a02..c2eb58c6d 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -96,7 +96,16 @@ EXTERN_CVAR(Bool, ticker ) EXTERN_CVAR(Bool, vid_vsync) EXTERN_CVAR(Bool, vid_hidpi) -CVAR(Bool, swtruecolor, false, CVAR_ARCHIVE) +CUSTOM_CVAR(Bool, swtruecolor, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) +{ + // Strictly speaking this doesn't require a mode switch, but it is the easiest + // way to force a CreateFramebuffer call without a lot of refactoring. + extern int NewWidth, NewHeight, NewBits, DisplayBits; + NewWidth = screen->GetWidth(); + NewHeight = screen->GetHeight(); + NewBits = DisplayBits; + setmodeneeded = true; +} CUSTOM_CVAR(Bool, fullscreen, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { diff --git a/src/posix/sdl/hardware.cpp b/src/posix/sdl/hardware.cpp index 52bca35e7..9de4d03a4 100644 --- a/src/posix/sdl/hardware.cpp +++ b/src/posix/sdl/hardware.cpp @@ -281,10 +281,18 @@ CUSTOM_CVAR (Int, vid_maxfps, 200, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) } } -CVAR (Bool, swtruecolor, false, CVAR_ARCHIVE) - extern int NewWidth, NewHeight, NewBits, DisplayBits; +CUSTOM_CVAR(Bool, swtruecolor, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL) +{ + // Strictly speaking this doesn't require a mode switch, but it is the easiest + // way to force a CreateFramebuffer call without a lot of refactoring. + NewWidth = screen->GetWidth(); + NewHeight = screen->GetHeight(); + NewBits = DisplayBits; + setmodeneeded = true; +} + CUSTOM_CVAR (Bool, fullscreen, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) { NewWidth = screen->GetWidth(); diff --git a/src/win32/hardware.cpp b/src/win32/hardware.cpp index 8856924c0..49c970457 100644 --- a/src/win32/hardware.cpp +++ b/src/win32/hardware.cpp @@ -311,10 +311,18 @@ void I_RestoreWindowedPos () MoveWindow (Window, winx, winy, winw, winh, TRUE); } -CVAR (Bool, swtruecolor, false, CVAR_ARCHIVE) - extern int NewWidth, NewHeight, NewBits, DisplayBits; +CUSTOM_CVAR(Bool, swtruecolor, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL) +{ + // Strictly speaking this doesn't require a mode switch, but it is the easiest + // way to force a CreateFramebuffer call without a lot of refactoring. + NewWidth = screen->GetWidth(); + NewHeight = screen->GetHeight(); + NewBits = DisplayBits; + setmodeneeded = true; +} + CUSTOM_CVAR (Bool, fullscreen, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL) { NewWidth = screen->GetWidth(); diff --git a/src/win32/win32video.cpp b/src/win32/win32video.cpp index a180a35ea..74b10ef07 100644 --- a/src/win32/win32video.cpp +++ b/src/win32/win32video.cpp @@ -221,22 +221,8 @@ bool Win32Video::InitD3D9 () // Enumerate available display modes. FreeModes (); -#ifndef PALETTEOUTPUT // To do: remove this again (AddD3DModes fails when there are too many modes available for videomenu to display) - - AddMode(320, 200, 8, 200, 0); - AddMode(320, 240, 8, 240, 0); - AddMode(640, 480, 8, 480, 0); - AddMode(800, 600, 8, 600, 0); - AddMode(1024, 768, 8, 768, 0); - - AddMode(1920, 1080, 8, 1080, 0); // 1080p - AddMode(1920*2, 1080*2, 8, 1080*2, 0); // 4k - AddMode(2560, 1440, 8, 1440, 0); // 27" classic - AddMode(2560*2, 1440*2, 8, 1440*2, 0); // 5k -#else AddD3DModes (m_Adapter, D3DFMT_X8R8G8B8); AddD3DModes (m_Adapter, D3DFMT_R5G6B5); -#endif if (Args->CheckParm ("-2")) { // Force all modes to be pixel-doubled. ScaleModes (1);