mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-16 01:02:03 +00:00
- Added vid_refreshrate cvar to override Windows' automatic refresh rate
selection. SVN r754 (trunk)
This commit is contained in:
parent
5124a28a15
commit
f2c9227243
6 changed files with 83 additions and 4 deletions
|
@ -1,4 +1,6 @@
|
|||
February 18, 2008
|
||||
- Added vid_refreshrate cvar to override Windows' automatic refresh rate
|
||||
selection.
|
||||
- Singleplayers maps using allowrespawn now filter respawn inventory like
|
||||
coop games, since that's essentially what they are.
|
||||
- Fixed m_alloc.cpp compilation on Linux.
|
||||
|
|
|
@ -150,6 +150,7 @@ CVAR (Int, vid_defbits, 8, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|||
CVAR (Bool, vid_fps, false, 0)
|
||||
CVAR (Bool, ticker, false, 0)
|
||||
CVAR (Int, vid_showpalette, 0, 0)
|
||||
|
||||
CUSTOM_CVAR (Bool, vid_vsync, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
{
|
||||
if (screen != NULL)
|
||||
|
@ -158,6 +159,14 @@ CUSTOM_CVAR (Bool, vid_vsync, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|||
}
|
||||
}
|
||||
|
||||
CUSTOM_CVAR (Int, vid_refreshrate, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
{
|
||||
if (screen != NULL)
|
||||
{
|
||||
screen->NewRefreshRate();
|
||||
}
|
||||
}
|
||||
|
||||
CUSTOM_CVAR (Float, dimamount, 0.2f, CVAR_ARCHIVE)
|
||||
{
|
||||
if (self < 0.f)
|
||||
|
@ -1075,6 +1084,19 @@ void DFrameBuffer::SetVSync (bool vsync)
|
|||
{
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// DFrameBuffer :: NewRefreshRate
|
||||
//
|
||||
// Sets the fullscreen display to the new refresh rate in vid_refreshrate,
|
||||
// if possible.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void DFrameBuffer::NewRefreshRate ()
|
||||
{
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// DFrameBuffer :: SetBlendingRect
|
||||
|
|
|
@ -344,6 +344,9 @@ public:
|
|||
// Changes the vsync setting, if supported by the device.
|
||||
virtual void SetVSync (bool vsync);
|
||||
|
||||
// Tells the device to recreate itself with the new setting from vid_refreshrate.
|
||||
virtual void NewRefreshRate ();
|
||||
|
||||
// Set the rect defining the area effected by blending.
|
||||
virtual void SetBlendingRect (int x1, int y1, int x2, int y2);
|
||||
|
||||
|
|
|
@ -197,6 +197,7 @@ EXTERN_CVAR (Bool, fullscreen)
|
|||
EXTERN_CVAR (Float, Gamma)
|
||||
EXTERN_CVAR (Bool, vid_vsync)
|
||||
EXTERN_CVAR (Float, transsouls)
|
||||
EXTERN_CVAR (Int, vid_refreshrate)
|
||||
|
||||
extern IDirect3D9 *D3D;
|
||||
|
||||
|
@ -304,7 +305,19 @@ D3DFB::D3DFB (int width, int height, bool fullscreen)
|
|||
if (FAILED(D3D->CreateDevice (D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, Window,
|
||||
D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice)))
|
||||
{
|
||||
D3DDevice = NULL;
|
||||
if (d3dpp.FullScreen_RefreshRateInHz != 0)
|
||||
{
|
||||
d3dpp.FullScreen_RefreshRateInHz = 0;
|
||||
if (FAILED(hr = D3D->CreateDevice (D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, Window,
|
||||
D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice)))
|
||||
{
|
||||
if (FAILED(D3D->CreateDevice (D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, Window,
|
||||
D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice)))
|
||||
{
|
||||
D3DDevice = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (D3DDevice != NULL)
|
||||
|
@ -386,6 +399,10 @@ void D3DFB::FillPresentParameters (D3DPRESENT_PARAMETERS *pp, bool fullscreen, b
|
|||
pp->BackBufferFormat = fullscreen ? D3DFMT_A8R8G8B8 : D3DFMT_UNKNOWN;
|
||||
pp->hDeviceWindow = Window;
|
||||
pp->PresentationInterval = vsync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||
if (fullscreen)
|
||||
{
|
||||
pp->FullScreen_RefreshRateInHz = vid_refreshrate;
|
||||
}
|
||||
}
|
||||
|
||||
bool D3DFB::CreateResources ()
|
||||
|
@ -531,7 +548,18 @@ bool D3DFB::Reset ()
|
|||
FillPresentParameters (&d3dpp, !Windowed, VSync);
|
||||
if (!SUCCEEDED(D3DDevice->Reset (&d3dpp)))
|
||||
{
|
||||
return false;
|
||||
if (d3dpp.FullScreen_RefreshRateInHz != 0)
|
||||
{
|
||||
d3dpp.FullScreen_RefreshRateInHz = 0;
|
||||
if (!SUCCEEDED(D3DDevice->Reset (&d3dpp)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
LOG("Device was reset\n");
|
||||
if (!CreateFBTexture() || !CreateVertexes())
|
||||
|
@ -1090,6 +1118,14 @@ void D3DFB::SetVSync (bool vsync)
|
|||
}
|
||||
}
|
||||
|
||||
void D3DFB::NewRefreshRate ()
|
||||
{
|
||||
if (!Windowed)
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
|
||||
void D3DFB::Blank ()
|
||||
{
|
||||
// Only used by movie player, which isn't working with D3D9 yet.
|
||||
|
|
|
@ -80,6 +80,7 @@ extern bool VidResizing;
|
|||
|
||||
EXTERN_CVAR (Bool, fullscreen)
|
||||
EXTERN_CVAR (Float, Gamma)
|
||||
EXTERN_CVAR (Int, vid_refreshrate)
|
||||
|
||||
extern IDirectDraw2 *DDraw;
|
||||
|
||||
|
@ -224,6 +225,7 @@ bool DDrawFB::CreateResources ()
|
|||
DDSURFACEDESC ddsd = { sizeof(ddsd), };
|
||||
HRESULT hr;
|
||||
int bits;
|
||||
int refresh;
|
||||
|
||||
BufferCount = 1;
|
||||
|
||||
|
@ -241,13 +243,18 @@ bool DDrawFB::CreateResources ()
|
|||
break;
|
||||
}
|
||||
}
|
||||
hr = DDraw->SetDisplayMode (Width, TrueHeight, bits = vid_displaybits, 0, 0);
|
||||
hr = DDraw->SetDisplayMode (Width, TrueHeight, bits = vid_displaybits, vid_refreshrate, 0);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
hr = DDraw->SetDisplayMode (Width, TrueHeight, bits = vid_displaybits, 0, 0);
|
||||
bits = 32;
|
||||
while (FAILED(hr) && bits >= 8)
|
||||
{
|
||||
hr = DDraw->SetDisplayMode (Width, Height, bits, 0, 0);
|
||||
hr = DDraw->SetDisplayMode (Width, Height, bits, vid_refreshrate, 0);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
hr = DDraw->SetDisplayMode (Width, Height, bits, 0, 0);
|
||||
}
|
||||
bits -= 8;
|
||||
}
|
||||
if (FAILED(hr))
|
||||
|
@ -1270,6 +1277,13 @@ void DDrawFB::SetVSync (bool vsync)
|
|||
FlipFlags = vsync ? DDFLIP_WAIT : DDFLIP_WAIT|DDFLIP_NOVSYNC;
|
||||
}
|
||||
|
||||
void DDrawFB::NewRefreshRate()
|
||||
{
|
||||
if (!Windowed)
|
||||
{
|
||||
NeedResRecreate = true;
|
||||
}
|
||||
}
|
||||
|
||||
void DDrawFB::Blank ()
|
||||
{
|
||||
|
|
|
@ -159,6 +159,7 @@ public:
|
|||
int QueryNewPalette ();
|
||||
void PaletteChanged ();
|
||||
void SetVSync (bool vsync);
|
||||
void NewRefreshRate();
|
||||
HRESULT GetHR ();
|
||||
|
||||
void Blank ();
|
||||
|
@ -240,6 +241,7 @@ public:
|
|||
void Blank ();
|
||||
bool PaintToWindow ();
|
||||
void SetVSync (bool vsync);
|
||||
void NewRefreshRate();
|
||||
void GetScreenshotBuffer(const BYTE *&buffer, int &pitch, ESSType &color_type);
|
||||
void ReleaseScreenshotBuffer();
|
||||
void SetBlendingRect (int x1, int y1, int x2, int y2);
|
||||
|
|
Loading…
Reference in a new issue