mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-29 07:22:07 +00:00
- removed remaining DirectDraw code and a few other things that are no longer being used.
This commit is contained in:
parent
2ed744963c
commit
29ad081368
13 changed files with 23 additions and 288 deletions
|
@ -1261,22 +1261,6 @@ void OpenGLSWFrameBuffer::Flip()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// OpenGLSWFrameBuffer :: PaintToWindow
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
|
|
||||||
bool OpenGLSWFrameBuffer::PaintToWindow()
|
|
||||||
{
|
|
||||||
Draw3DPart(true);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// OpenGLSWFrameBuffer :: Draw3DPart
|
// OpenGLSWFrameBuffer :: Draw3DPart
|
||||||
|
|
|
@ -67,8 +67,6 @@ public:
|
||||||
void WipeCleanup() override;
|
void WipeCleanup() override;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
void Blank() override { }
|
|
||||||
bool PaintToWindow() override;
|
|
||||||
int GetTrueHeight() override { return TrueHeight; }
|
int GetTrueHeight() override { return TrueHeight; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1040,22 +1040,6 @@ void I_SetFPSLimit(int limit)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CUSTOM_CVAR(Int, vid_maxfps, 200, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|
||||||
{
|
|
||||||
if (vid_maxfps < TICRATE && vid_maxfps != 0)
|
|
||||||
{
|
|
||||||
vid_maxfps = TICRATE;
|
|
||||||
}
|
|
||||||
else if (vid_maxfps > 1000)
|
|
||||||
{
|
|
||||||
vid_maxfps = 1000;
|
|
||||||
}
|
|
||||||
else if (cl_capfps == 0)
|
|
||||||
{
|
|
||||||
I_SetFPSLimit(vid_maxfps);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CUSTOM_CVAR(Bool, vid_hidpi, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
CUSTOM_CVAR(Bool, vid_hidpi, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
{
|
{
|
||||||
CocoaVideo::UseHiDPI(self);
|
CocoaVideo::UseHiDPI(self);
|
||||||
|
|
|
@ -300,22 +300,6 @@ void I_SetFPSLimit(int limit)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CUSTOM_CVAR (Int, vid_maxfps, 200, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|
||||||
{
|
|
||||||
if (vid_maxfps < TICRATE && vid_maxfps != 0)
|
|
||||||
{
|
|
||||||
vid_maxfps = TICRATE;
|
|
||||||
}
|
|
||||||
else if (vid_maxfps > 1000)
|
|
||||||
{
|
|
||||||
vid_maxfps = 1000;
|
|
||||||
}
|
|
||||||
else if (cl_capfps == 0)
|
|
||||||
{
|
|
||||||
I_SetFPSLimit(vid_maxfps);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extern int NewWidth, NewHeight, NewBits, DisplayBits;
|
extern int NewWidth, NewHeight, NewBits, DisplayBits;
|
||||||
|
|
||||||
CUSTOM_CVAR(Bool, swtruecolor, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
|
CUSTOM_CVAR(Bool, swtruecolor, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
|
||||||
|
|
|
@ -86,6 +86,24 @@
|
||||||
#include "r_videoscale.h"
|
#include "r_videoscale.h"
|
||||||
#include "i_time.h"
|
#include "i_time.h"
|
||||||
|
|
||||||
|
EXTERN_CVAR(Bool, cl_capfps)
|
||||||
|
|
||||||
|
CUSTOM_CVAR(Int, vid_maxfps, 200, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
{
|
||||||
|
if (vid_maxfps < TICRATE && vid_maxfps != 0)
|
||||||
|
{
|
||||||
|
vid_maxfps = TICRATE;
|
||||||
|
}
|
||||||
|
else if (vid_maxfps > 1000)
|
||||||
|
{
|
||||||
|
vid_maxfps = 1000;
|
||||||
|
}
|
||||||
|
else if (cl_capfps == 0)
|
||||||
|
{
|
||||||
|
I_SetFPSLimit(vid_maxfps);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, r_blendmethod)
|
EXTERN_CVAR(Bool, r_blendmethod)
|
||||||
|
|
||||||
int active_con_scale();
|
int active_con_scale();
|
||||||
|
|
|
@ -884,17 +884,6 @@ int D3DFB::GetPageCount ()
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// D3DFB :: GetHR
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
HRESULT D3DFB::GetHR ()
|
|
||||||
{
|
|
||||||
return LastHR;
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// D3DFB :: IsFullscreen
|
// D3DFB :: IsFullscreen
|
||||||
|
@ -1097,29 +1086,6 @@ void D3DFB::CopyNextFrontBuffer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// D3DFB :: PaintToWindow
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
bool D3DFB::PaintToWindow ()
|
|
||||||
{
|
|
||||||
HRESULT hr;
|
|
||||||
|
|
||||||
hr = D3DDevice->TestCooperativeLevel();
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
if (hr != D3DERR_DEVICENOTRESET || !Reset())
|
|
||||||
{
|
|
||||||
Sleep (1);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Draw3DPart(true);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// D3DFB :: Draw3DPart
|
// D3DFB :: Draw3DPart
|
||||||
|
@ -1402,10 +1368,6 @@ void D3DFB::NewRefreshRate ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void D3DFB::Blank ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3DFB::SetBlendingRect(int x1, int y1, int x2, int y2)
|
void D3DFB::SetBlendingRect(int x1, int y1, int x2, int y2)
|
||||||
{
|
{
|
||||||
BlendingRect.left = x1;
|
BlendingRect.left = x1;
|
||||||
|
|
|
@ -52,7 +52,6 @@ EXTERN_CVAR (Bool, ticker)
|
||||||
EXTERN_CVAR (Bool, fullscreen)
|
EXTERN_CVAR (Bool, fullscreen)
|
||||||
EXTERN_CVAR (Bool, swtruecolor)
|
EXTERN_CVAR (Bool, swtruecolor)
|
||||||
EXTERN_CVAR (Float, vid_winscale)
|
EXTERN_CVAR (Float, vid_winscale)
|
||||||
EXTERN_CVAR (Bool, vid_forceddraw)
|
|
||||||
EXTERN_CVAR (Bool, win_borderless)
|
EXTERN_CVAR (Bool, win_borderless)
|
||||||
|
|
||||||
CVAR(Int, win_x, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
CVAR(Int, win_x, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
@ -208,10 +207,8 @@ void I_CreateRenderer()
|
||||||
Printf("Renderer: OpenGL\n");
|
Printf("Renderer: OpenGL\n");
|
||||||
else if (currentcanvas == 1)
|
else if (currentcanvas == 1)
|
||||||
Printf("Renderer: Software on OpenGL\n");
|
Printf("Renderer: Software on OpenGL\n");
|
||||||
else if (currentcanvas == 0 && vid_forceddraw == false)
|
|
||||||
Printf("Renderer: Software on Direct3D\n");
|
|
||||||
else if (currentcanvas == 0)
|
else if (currentcanvas == 0)
|
||||||
Printf("Renderer: Software on DirectDraw\n");
|
Printf("Renderer: Software on Direct3D\n");
|
||||||
else
|
else
|
||||||
Printf("Renderer: Unknown\n");
|
Printf("Renderer: Unknown\n");
|
||||||
if (Renderer == NULL)
|
if (Renderer == NULL)
|
||||||
|
|
|
@ -456,10 +456,6 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_PAINT:
|
case WM_PAINT:
|
||||||
if (screen != NULL && 0)
|
|
||||||
{
|
|
||||||
static_cast<BaseWinFB *> (screen)->PaintToWindow ();
|
|
||||||
}
|
|
||||||
return DefWindowProc (hWnd, message, wParam, lParam);
|
return DefWindowProc (hWnd, message, wParam, lParam);
|
||||||
|
|
||||||
case WM_SETTINGCHANGE:
|
case WM_SETTINGCHANGE:
|
||||||
|
|
|
@ -64,7 +64,7 @@ extern HWND Window;
|
||||||
extern BOOL AppActive;
|
extern BOOL AppActive;
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
_declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
||||||
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
|
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1170,29 +1170,6 @@ bool Win32GLFrameBuffer::IsFullscreen()
|
||||||
return m_Fullscreen;
|
return m_Fullscreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT Win32GLFrameBuffer::GetHR()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Win32GLFrameBuffer::Blank ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Win32GLFrameBuffer::PaintToWindow ()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Win32GLFrameBuffer::CreateResources ()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Win32GLFrameBuffer::ReleaseResources ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
|
@ -36,15 +36,6 @@ public:
|
||||||
Win32GLFrameBuffer(void *hMonitor, int width, int height, int bits, int refreshHz, bool fullscreen, bool bgra);
|
Win32GLFrameBuffer(void *hMonitor, int width, int height, int bits, int refreshHz, bool fullscreen, bool bgra);
|
||||||
virtual ~Win32GLFrameBuffer();
|
virtual ~Win32GLFrameBuffer();
|
||||||
|
|
||||||
|
|
||||||
// unused but must be defined
|
|
||||||
virtual void Blank ();
|
|
||||||
virtual bool PaintToWindow ();
|
|
||||||
virtual long/*HRESULT*/ GetHR(); // windows.h pollution prevention.
|
|
||||||
|
|
||||||
virtual bool CreateResources ();
|
|
||||||
virtual void ReleaseResources ();
|
|
||||||
|
|
||||||
void SetVSync (bool vsync);
|
void SetVSync (bool vsync);
|
||||||
void SwapBuffers();
|
void SwapBuffers();
|
||||||
void NewRefreshRate ();
|
void NewRefreshRate ();
|
||||||
|
|
|
@ -50,7 +50,6 @@ class Win32Video : public IVideo
|
||||||
~Win32Video ();
|
~Win32Video ();
|
||||||
|
|
||||||
bool InitD3D9();
|
bool InitD3D9();
|
||||||
void InitDDraw();
|
|
||||||
|
|
||||||
EDisplayType GetDisplayType () { return DISPLAY_Both; }
|
EDisplayType GetDisplayType () { return DISPLAY_Both; }
|
||||||
void SetWindowedScale (float scale);
|
void SetWindowedScale (float scale);
|
||||||
|
@ -61,7 +60,6 @@ class Win32Video : public IVideo
|
||||||
bool NextMode (int *width, int *height, bool *letterbox);
|
bool NextMode (int *width, int *height, bool *letterbox);
|
||||||
|
|
||||||
bool GoFullscreen (bool yes);
|
bool GoFullscreen (bool yes);
|
||||||
void BlankForGDI ();
|
|
||||||
|
|
||||||
void DumpAdapters ();
|
void DumpAdapters ();
|
||||||
void AddMode(int x, int y, int bits, int baseHeight, int doubling);
|
void AddMode(int x, int y, int bits, int baseHeight, int doubling);
|
||||||
|
@ -107,14 +105,9 @@ public:
|
||||||
BaseWinFB(int width, int height, bool bgra) : DFrameBuffer(width, height, bgra), Windowed(true) {}
|
BaseWinFB(int width, int height, bool bgra) : DFrameBuffer(width, height, bgra), Windowed(true) {}
|
||||||
|
|
||||||
bool IsFullscreen () { return !Windowed; }
|
bool IsFullscreen () { return !Windowed; }
|
||||||
virtual void Blank () = 0;
|
|
||||||
virtual bool PaintToWindow () = 0;
|
|
||||||
virtual long/*HRESULT*/ GetHR () = 0; // HRESULT is a long in Windows but this header should not be polluted with windows.h just for this single definition
|
|
||||||
virtual void ScaleCoordsFromWindow(int16_t &x, int16_t &y);
|
virtual void ScaleCoordsFromWindow(int16_t &x, int16_t &y);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool CreateResources () = 0;
|
|
||||||
virtual void ReleaseResources () = 0;
|
|
||||||
virtual int GetTrueHeight() { return GetHeight(); }
|
virtual int GetTrueHeight() { return GetHeight(); }
|
||||||
|
|
||||||
bool Windowed;
|
bool Windowed;
|
||||||
|
|
|
@ -38,8 +38,6 @@ public:
|
||||||
void GetFlash (PalEntry &rgb, int &amount);
|
void GetFlash (PalEntry &rgb, int &amount);
|
||||||
int GetPageCount ();
|
int GetPageCount ();
|
||||||
bool IsFullscreen ();
|
bool IsFullscreen ();
|
||||||
void Blank ();
|
|
||||||
bool PaintToWindow ();
|
|
||||||
void SetVSync (bool vsync);
|
void SetVSync (bool vsync);
|
||||||
void NewRefreshRate();
|
void NewRefreshRate();
|
||||||
void GetScreenshotBuffer(const uint8_t *&buffer, int &pitch, ESSType &color_type, float &gamma) override;
|
void GetScreenshotBuffer(const uint8_t *&buffer, int &pitch, ESSType &color_type, float &gamma) override;
|
||||||
|
@ -62,7 +60,6 @@ public:
|
||||||
void WipeEndScreen();
|
void WipeEndScreen();
|
||||||
bool WipeDo(int ticks);
|
bool WipeDo(int ticks);
|
||||||
void WipeCleanup();
|
void WipeCleanup();
|
||||||
HRESULT GetHR ();
|
|
||||||
virtual int GetTrueHeight() { return TrueHeight; }
|
virtual int GetTrueHeight() { return TrueHeight; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -103,37 +103,20 @@ extern bool VidResizing;
|
||||||
EXTERN_CVAR (Bool, fullscreen)
|
EXTERN_CVAR (Bool, fullscreen)
|
||||||
EXTERN_CVAR (Float, Gamma)
|
EXTERN_CVAR (Float, Gamma)
|
||||||
EXTERN_CVAR (Bool, cl_capfps)
|
EXTERN_CVAR (Bool, cl_capfps)
|
||||||
|
EXTERN_CVAR(Int, vid_maxfps)
|
||||||
|
|
||||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||||
|
|
||||||
static HMODULE D3D9_dll;
|
static HMODULE D3D9_dll;
|
||||||
static HMODULE DDraw_dll;
|
|
||||||
static UINT FPSLimitTimer;
|
static UINT FPSLimitTimer;
|
||||||
|
|
||||||
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
||||||
|
|
||||||
IDirectDraw2 *DDraw;
|
|
||||||
IDirect3D9 *D3D;
|
IDirect3D9 *D3D;
|
||||||
IDirect3DDevice9 *D3Device;
|
IDirect3DDevice9 *D3Device;
|
||||||
HANDLE FPSLimitEvent;
|
HANDLE FPSLimitEvent;
|
||||||
|
|
||||||
CVAR (Bool, vid_forceddraw, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|
||||||
CVAR (Int, vid_adapter, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
CVAR (Int, vid_adapter, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
CUSTOM_CVAR (Int, vid_maxfps, 200, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|
||||||
{
|
|
||||||
if (vid_maxfps < TICRATE && vid_maxfps != 0)
|
|
||||||
{
|
|
||||||
vid_maxfps = TICRATE;
|
|
||||||
}
|
|
||||||
else if (vid_maxfps > 1000)
|
|
||||||
{
|
|
||||||
vid_maxfps = 1000;
|
|
||||||
}
|
|
||||||
else if (cl_capfps == 0)
|
|
||||||
{
|
|
||||||
I_SetFPSLimit(vid_maxfps);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if VID_FILE_DEBUG
|
#if VID_FILE_DEBUG
|
||||||
FILE *dbg;
|
FILE *dbg;
|
||||||
|
@ -147,25 +130,13 @@ Win32Video::Win32Video (int parm)
|
||||||
m_Adapter (D3DADAPTER_DEFAULT)
|
m_Adapter (D3DADAPTER_DEFAULT)
|
||||||
{
|
{
|
||||||
I_SetWndProc();
|
I_SetWndProc();
|
||||||
if (!InitD3D9())
|
InitD3D9();
|
||||||
{
|
|
||||||
InitDDraw();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Win32Video::~Win32Video ()
|
Win32Video::~Win32Video ()
|
||||||
{
|
{
|
||||||
FreeModes ();
|
FreeModes ();
|
||||||
|
|
||||||
if (DDraw != NULL)
|
|
||||||
{
|
|
||||||
if (m_IsFullscreen)
|
|
||||||
{
|
|
||||||
DDraw->SetCooperativeLevel (NULL, DDSCL_NORMAL);
|
|
||||||
}
|
|
||||||
DDraw->Release();
|
|
||||||
DDraw = NULL;
|
|
||||||
}
|
|
||||||
if (D3D != NULL)
|
if (D3D != NULL)
|
||||||
{
|
{
|
||||||
D3D->Release();
|
D3D->Release();
|
||||||
|
@ -179,11 +150,6 @@ bool Win32Video::InitD3D9 ()
|
||||||
{
|
{
|
||||||
DIRECT3DCREATE9FUNC direct3d_create_9;
|
DIRECT3DCREATE9FUNC direct3d_create_9;
|
||||||
|
|
||||||
if (vid_forceddraw)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load the Direct3D 9 library.
|
// Load the Direct3D 9 library.
|
||||||
if ((D3D9_dll = LoadLibraryA ("d3d9.dll")) == NULL)
|
if ((D3D9_dll = LoadLibraryA ("d3d9.dll")) == NULL)
|
||||||
{
|
{
|
||||||
|
@ -259,124 +225,12 @@ static HRESULT WINAPI EnumDDModesCB(LPDDSURFACEDESC desc, void *data)
|
||||||
return DDENUMRET_OK;
|
return DDENUMRET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Win32Video::InitDDraw ()
|
|
||||||
{
|
|
||||||
DIRECTDRAWCREATEFUNC directdraw_create;
|
|
||||||
LPDIRECTDRAW ddraw1;
|
|
||||||
STARTLOG;
|
|
||||||
|
|
||||||
HRESULT dderr;
|
|
||||||
|
|
||||||
// Load the DirectDraw library.
|
|
||||||
if ((DDraw_dll = LoadLibraryA ("ddraw.dll")) == NULL)
|
|
||||||
{
|
|
||||||
I_FatalError ("Could not load ddraw.dll");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Obtain an IDirectDraw interface.
|
|
||||||
if ((directdraw_create = (DIRECTDRAWCREATEFUNC)GetProcAddress (DDraw_dll, "DirectDrawCreate")) == NULL)
|
|
||||||
{
|
|
||||||
I_FatalError ("The system file ddraw.dll is missing the DirectDrawCreate export");
|
|
||||||
}
|
|
||||||
|
|
||||||
dderr = directdraw_create (NULL, &ddraw1, NULL);
|
|
||||||
|
|
||||||
if (FAILED(dderr))
|
|
||||||
I_FatalError ("Could not create DirectDraw object: %08lx", dderr);
|
|
||||||
|
|
||||||
static const GUID IDIRECTDRAW2_GUID = { 0xB3A6F3E0, 0x2B43, 0x11CF, 0xA2, 0xDE, 0x00, 0xAA, 0x00, 0xB9, 0x33, 0x56 };
|
|
||||||
|
|
||||||
dderr = ddraw1->QueryInterface (IDIRECTDRAW2_GUID, (LPVOID*)&DDraw);
|
|
||||||
if (FAILED(dderr))
|
|
||||||
{
|
|
||||||
ddraw1->Release ();
|
|
||||||
DDraw = NULL;
|
|
||||||
I_FatalError ("Could not initialize IDirectDraw2 interface: %08lx", dderr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Okay, we have the IDirectDraw2 interface now, so we can release the
|
|
||||||
// really old-fashioned IDirectDraw one.
|
|
||||||
ddraw1->Release ();
|
|
||||||
|
|
||||||
DDraw->SetCooperativeLevel (Window, DDSCL_NORMAL);
|
|
||||||
FreeModes ();
|
|
||||||
dderr = DDraw->EnumDisplayModes (0, NULL, this, EnumDDModesCB);
|
|
||||||
if (FAILED(dderr))
|
|
||||||
{
|
|
||||||
DDraw->Release ();
|
|
||||||
DDraw = NULL;
|
|
||||||
I_FatalError ("Could not enumerate display modes: %08lx", dderr);
|
|
||||||
}
|
|
||||||
if (m_Modes == NULL)
|
|
||||||
{
|
|
||||||
DDraw->Release ();
|
|
||||||
DDraw = NULL;
|
|
||||||
I_FatalError ("DirectDraw returned no display modes.\n\n"
|
|
||||||
"If you started " GAMENAME " from a fullscreen DOS box, run it from "
|
|
||||||
"a DOS window instead. If that does not work, you may need to reboot.");
|
|
||||||
}
|
|
||||||
if (Args->CheckParm ("-2"))
|
|
||||||
{ // Force all modes to be pixel-doubled.
|
|
||||||
ScaleModes(1);
|
|
||||||
}
|
|
||||||
else if (Args->CheckParm ("-4"))
|
|
||||||
{ // Force all modes to be pixel-quadrupled.
|
|
||||||
ScaleModes(2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
AddLowResModes ();
|
|
||||||
}
|
|
||||||
AddLetterboxModes ();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns true if fullscreen, false otherwise
|
// Returns true if fullscreen, false otherwise
|
||||||
bool Win32Video::GoFullscreen (bool yes)
|
bool Win32Video::GoFullscreen (bool yes)
|
||||||
{
|
{
|
||||||
static const char *const yestypes[2] = { "windowed", "fullscreen" };
|
|
||||||
HRESULT hr[2];
|
|
||||||
int count;
|
|
||||||
|
|
||||||
// FIXME: Do this right for D3D.
|
// FIXME: Do this right for D3D.
|
||||||
if (D3D != NULL)
|
|
||||||
{
|
|
||||||
return yes;
|
return yes;
|
||||||
}
|
|
||||||
|
|
||||||
if (m_IsFullscreen == yes)
|
|
||||||
return yes;
|
|
||||||
|
|
||||||
for (count = 0; count < 2; ++count)
|
|
||||||
{
|
|
||||||
LOG1 ("fullscreen: %d\n", yes);
|
|
||||||
hr[count] = DDraw->SetCooperativeLevel (Window, !yes ? DDSCL_NORMAL :
|
|
||||||
DDSCL_ALLOWMODEX | DDSCL_ALLOWREBOOT | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
|
||||||
if (SUCCEEDED(hr[count]))
|
|
||||||
{
|
|
||||||
if (count != 0)
|
|
||||||
{
|
|
||||||
// Ack! Cannot print because the screen does not exist right now.
|
|
||||||
// Printf ("Setting %s mode failed. Error %08lx\n",
|
|
||||||
// yestypes[!yes], hr[0]);
|
|
||||||
}
|
|
||||||
m_IsFullscreen = yes;
|
|
||||||
return yes;
|
|
||||||
}
|
|
||||||
yes = !yes;
|
|
||||||
}
|
|
||||||
|
|
||||||
I_FatalError ("Could not set %s mode: %08lx\n"
|
|
||||||
"Could not set %s mode: %08lx\n",
|
|
||||||
yestypes[yes], hr[0], yestypes[!yes], hr[1]);
|
|
||||||
|
|
||||||
// Appease the compiler, even though we never return if we get here.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flips to the GDI surface and clears it
|
|
||||||
void Win32Video::BlankForGDI ()
|
|
||||||
{
|
|
||||||
static_cast<BaseWinFB *> (screen)->Blank ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
Loading…
Reference in a new issue