- moved UpdateVRModes, AppActive and gamestate into the backend.

This commit is contained in:
Christoph Oelckers 2022-10-02 14:25:19 +02:00
parent 65f6e788eb
commit 8e6bdd72fa
6 changed files with 34 additions and 32 deletions

View file

@ -70,8 +70,8 @@
#define RIGHTMARGIN 8 #define RIGHTMARGIN 8
#define BOTTOMARGIN 12 #define BOTTOMARGIN 12
// todo: move these variables to a better place.
extern bool AppActive; extern bool AppActive;
int chatmodeon;
CUSTOM_CVAR(Int, con_buffersize, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CUSTOM_CVAR(Int, con_buffersize, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
{ {

View file

@ -1,5 +1,6 @@
#include "i_interface.h" #include "i_interface.h"
#include "st_start.h" #include "st_start.h"
#include "gamestate.h"
static_assert(sizeof(void*) == 8, "32 builds are not supported"); static_assert(sizeof(void*) == 8, "32 builds are not supported");
@ -10,3 +11,7 @@ FString endoomName;
bool batchrun; bool batchrun;
float menuBlurAmount; float menuBlurAmount;
bool AppActive = true;
int chatmodeon;
gamestate_t gamestate = GS_STARTUP;

View file

@ -44,6 +44,7 @@
#include "gl_framebuffer.h" #include "gl_framebuffer.h"
#include "gl_shaderprogram.h" #include "gl_shaderprogram.h"
#include "gl_buffers.h" #include "gl_buffers.h"
#include "menu.h"
EXTERN_CVAR(Int, vr_mode) EXTERN_CVAR(Int, vr_mode)
@ -53,7 +54,32 @@ EXTERN_CVAR(Float, vid_contrast)
EXTERN_CVAR(Int, gl_satformula) EXTERN_CVAR(Int, gl_satformula)
EXTERN_CVAR(Int, gl_dither_bpc) EXTERN_CVAR(Int, gl_dither_bpc)
void UpdateVRModes(bool considerQuadBuffered = true); #ifdef _WIN32
EXTERN_CVAR(Bool, vr_enable_quadbuffered)
#endif
void UpdateVRModes(bool considerQuadBuffered)
{
FOptionValues** pVRModes = OptionValues.CheckKey("VRMode");
if (pVRModes == nullptr) return;
TArray<FOptionValues::Pair>& vals = (*pVRModes)->mValues;
TArray<FOptionValues::Pair> filteredValues;
int cnt = vals.Size();
for (int i = 0; i < cnt; ++i) {
auto const& mode = vals[i];
if (mode.Value == 7) { // Quad-buffered stereo
#ifdef _WIN32
if (!vr_enable_quadbuffered) continue;
#else
continue; // Remove quad-buffered option on Mac and Linux
#endif
if (!considerQuadBuffered) continue; // Probably no compatible screen mode was found
}
filteredValues.Push(mode);
}
vals = filteredValues;
}
namespace OpenGLRenderer namespace OpenGLRenderer
{ {

View file

@ -332,7 +332,7 @@ bool nospriterename;
FStartupInfo GameStartupInfo; FStartupInfo GameStartupInfo;
FString lastIWAD; FString lastIWAD;
int restart = 0; int restart = 0;
bool AppActive = true; extern bool AppActive;
bool playedtitlemusic; bool playedtitlemusic;
FStartScreen* StartScreen; FStartScreen* StartScreen;

View file

@ -144,7 +144,6 @@ CVAR(Int, nametagcolor, CR_GOLD, CVAR_ARCHIVE)
extern bool playedtitlemusic; extern bool playedtitlemusic;
gameaction_t gameaction; gameaction_t gameaction;
gamestate_t gamestate = GS_STARTUP;
int paused; int paused;
bool pauseext; bool pauseext;

View file

@ -1463,31 +1463,3 @@ CCMD (menu_video)
M_StartControlPanel (true); M_StartControlPanel (true);
M_SetMenu(NAME_VideoModeMenu, -1); M_SetMenu(NAME_VideoModeMenu, -1);
} }
#ifdef _WIN32
EXTERN_CVAR(Bool, vr_enable_quadbuffered)
#endif
void UpdateVRModes(bool considerQuadBuffered)
{
FOptionValues** pVRModes = OptionValues.CheckKey("VRMode");
if (pVRModes == nullptr) return;
TArray<FOptionValues::Pair>& vals = (*pVRModes)->mValues;
TArray<FOptionValues::Pair> filteredValues;
int cnt = vals.Size();
for (int i = 0; i < cnt; ++i) {
auto const& mode = vals[i];
if (mode.Value == 7) { // Quad-buffered stereo
#ifdef _WIN32
if (!vr_enable_quadbuffered) continue;
#else
continue; // Remove quad-buffered option on Mac and Linux
#endif
if (!considerQuadBuffered) continue; // Probably no compatible screen mode was found
}
filteredValues.Push(mode);
}
vals = filteredValues;
}